버그 수정 및 로딩 추가

This commit is contained in:
김판돌 2025-02-12 08:10:53 +09:00
parent 8107321f04
commit 740bb595ab
10 changed files with 4312 additions and 3858 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,19 +10,27 @@ public class ItemPrefab : MonoBehaviour, System.IEquatable<ItemPrefab>
[SerializeField] TMP_Text suitName; [SerializeField] TMP_Text suitName;
[SerializeField] TMP_Text ownerName; [SerializeField] TMP_Text ownerName;
[SerializeField] RawImage suitImage; [SerializeField] RawImage suitImage;
[SerializeField] GameObject loading;
public void Set(Library library) public void Set(Library library)
{ {
this._library = library; this._library = library;
suitName.text = library.suit_name; suitName.text = library.suit_name;
ownerName.text = library.owner_name; ownerName.text = library.owner_name;
//if(_library._suit_image == null)
// SearchCtrl.Instance.GetImage(this, _library);
//else
// ImageSet();
} }
private void Update()
{
if (loading.activeSelf)
{
loading.transform.rotation *= Quaternion.Euler(0, 0, 5);
}
}
public void ImageSet() public void ImageSet()
{ {
loading.SetActive(false);
suitImage.texture = library._suit_image; suitImage.texture = library._suit_image;
suitImage.SetNativeSize(); suitImage.SetNativeSize();
RectTransform rect = suitImage.gameObject.GetComponent<RectTransform>(); RectTransform rect = suitImage.gameObject.GetComponent<RectTransform>();

View File

@ -10,13 +10,25 @@ public class ModalCtrl : MonoBehaviour
[SerializeField] TMP_Text ownerName; [SerializeField] TMP_Text ownerName;
[SerializeField] TMP_Text suitMaker; [SerializeField] TMP_Text suitMaker;
[SerializeField] TMP_Text debutDate; [SerializeField] TMP_Text debutDate;
[SerializeField] TMP_Text suitType; [SerializeField] TMP_Text animalType;
[SerializeField] TMP_Text suitStyle; [SerializeField] TMP_Text suitStyle;
[SerializeField] GameObject[] colors; [SerializeField] GameObject[] colors;
[SerializeField] GameObject _modelCanvas;
public GameObject modelCanvas { get { return _modelCanvas; } }
private void Update()
{
if (Input.GetKey(KeyCode.Escape))
{
_modelCanvas.SetActive(false);
}
}
public void Set(Library library) public void Set(Library library)
{ {
gameObject.SetActive(true); _modelCanvas.SetActive(true);
suitImage.texture = library._suit_image; suitImage.texture = library._suit_image;
suitImage.SetNativeSize(); suitImage.SetNativeSize();
RectTransform rect = suitImage.gameObject.GetComponent<RectTransform>(); RectTransform rect = suitImage.gameObject.GetComponent<RectTransform>();
@ -29,7 +41,7 @@ public class ModalCtrl : MonoBehaviour
ownerName.text = library.owner_name; ownerName.text = library.owner_name;
suitMaker.text = library.maker; suitMaker.text = library.maker;
debutDate.text = library.production_date; debutDate.text = library.production_date;
suitType.text = library.suit_type; animalType.text = library.animal_type;
suitStyle.text = library.suit_style; suitStyle.text = library.suit_style;
} }
} }

View File

@ -8,6 +8,7 @@ using System.Threading.Tasks;
using System.Linq; using System.Linq;
using System; using System;
using BestHTTP; using BestHTTP;
using Unity.VisualScripting;
public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl> public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
{ {
@ -28,16 +29,17 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
[SerializeField] ItemPrefab item; [SerializeField] ItemPrefab item;
[SerializeField] Transform results; [SerializeField] Transform results;
[SerializeField] GameObject listTop; [SerializeField] GameObject listTop;
[SerializeField] GameObject bar;
[SerializeField] RectTransform content; [SerializeField] RectTransform content;
[SerializeField] Animator searchUI; [SerializeField] Animator searchUI;
[SerializeField] GameObject loading;
[SerializeField] Transform loadingImage;
// 모달 UI // 모달 UI
[SerializeField] ModalCtrl model; [SerializeField] ModalCtrl model;
// 검색 결과 데이터 // 검색 결과 데이터
private SearchRequest request; private SearchRequest request = new SearchRequest();
private List<Library> librarys; [SerializeField] private List<Library> librarys;
private bool hasMore; private bool hasMore;
// 검색결과 UI 프리팹 // 검색결과 UI 프리팹
@ -49,13 +51,24 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
private bool isRefreshing = false; private bool isRefreshing = false;
private Queue<Library> searchResults = new Queue<Library>(); private Queue<Library> searchResults = new Queue<Library>();
bool isLoading = false;
protected override void OnAwake() protected override void OnAwake()
{ {
name.onEndEdit.AddListener(INPUTFIELD);
librarys = new List<Library>(); librarys = new List<Library>();
itemPrefabPool = new ObjectPool<ItemPrefab>(itemPrefabs_OnCreate, itemPrefabs_OnGet, itemPrefabs_OnRelease, null, true, 100); itemPrefabPool = new ObjectPool<ItemPrefab>(itemPrefabs_OnCreate, itemPrefabs_OnGet, itemPrefabs_OnRelease, null, true, 100);
itemPrefabs = new List<ItemPrefab>(); itemPrefabs = new List<ItemPrefab>();
} }
void INPUTFIELD(string input)
{
if (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
{
SearchButton();
}
}
#region ObjectPool #region ObjectPool
private ItemPrefab itemPrefabs_OnCreate() private ItemPrefab itemPrefabs_OnCreate()
{ {
@ -78,8 +91,9 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
private void OnEnable() private void OnEnable()
{ {
hasMore = false; hasMore = false;
model.gameObject.SetActive(false); model.modelCanvas.SetActive(false);
searchUI.SetTrigger("reset"); searchUI.SetTrigger("reset");
loading.SetActive(false);
ResetButton(); ResetButton();
ObjectClear(); ObjectClear();
} }
@ -88,7 +102,6 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
{ {
results.gameObject.SetActive(false); results.gameObject.SetActive(false);
listTop.SetActive(false); listTop.SetActive(false);
bar.SetActive(false);
librarys.Clear(); librarys.Clear();
while (itemPrefabPool.CountActive > 0) while (itemPrefabPool.CountActive > 0)
{ {
@ -112,24 +125,89 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
public void SearchButton() public void SearchButton()
{ {
ObjectClear(); bool isBefore = true;
request = new SearchRequest(); if(request.fursuitName != name.text)
request.fursuitName = name.text; {
if (suitStyle.value != 0) request.fursuitName = name.text;
request.suitStyle = GameManager.Instance.suitStyle[suitStyle.value - 1].code_id; isBefore = false;
if (suitType.value != 0) }
request.suitType = GameManager.Instance.suitType[suitType.value - 1].code_id;
if (region.value != 0)
request.suitRegion = GameManager.Instance.region[region.value - 1].code_id;
if (animalTypes.value != 0)
request.suitAnimalType = GameManager.Instance.animalTypes[animalTypes.value - 1].code_id;
results.gameObject.SetActive(true); if (suitStyle.value != 0)
listTop.SetActive(true); {
bar.SetActive(true); if (request.suitStyle != GameManager.Instance.suitStyle[suitStyle.value - 1].code_id)
SearchSuiters().Forget(); {
request.suitStyle = GameManager.Instance.suitStyle[suitStyle.value - 1].code_id;
isBefore = false;
}
}
else if(request.suitStyle != "")
{
request.suitStyle = "";
isBefore = false;
}
if (suitType.value != 0)
{
if (request.suitType != GameManager.Instance.suitType[suitType.value - 1].code_id)
{
request.suitType = GameManager.Instance.suitType[suitType.value - 1].code_id;
isBefore = false;
}
}
else if (request.suitType != "")
{
request.suitType = "";
isBefore = false;
}
if (region.value != 0)
{
if (request.suitRegion != GameManager.Instance.region[region.value - 1].code_id)
{
request.suitRegion = GameManager.Instance.region[region.value - 1].code_id;
isBefore = false;
}
}
else if (request.suitRegion != "")
{
request.suitRegion = "";
isBefore = false;
}
if (animalTypes.value != 0)
{
if (request.suitAnimalType != GameManager.Instance.animalTypes[animalTypes.value - 1].code_id)
{
request.suitAnimalType = GameManager.Instance.animalTypes[animalTypes.value - 1].code_id;
isBefore = false;
}
}
else if (request.suitAnimalType != "")
{
request.suitAnimalType = "";
isBefore = false;
}
//첫 검색이거나 이전과 검색결과가 같지 않으면 검색진행
if (!isBefore || !listTop.activeSelf)
{
request.offset = 0;
request.page = 1;
request.size = 10;
ObjectClear();
results.gameObject.SetActive(true);
listTop.SetActive(true);
SearchSuiters().Forget();
}
} }
private void Update()
{
if (isLoading)
{
loadingImage.rotation *= Quaternion.Euler(0, 0, 5);
}
}
public async UniTask SearchSuiters() public async UniTask SearchSuiters()
{ {
if (isSearching) return; if (isSearching) return;
@ -148,6 +226,7 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
} }
hasMore = data.hasMore; hasMore = data.hasMore;
tcs.SetResult(true); // 응답 완료 신호 tcs.SetResult(true); // 응답 완료 신호
loading.SetActive(hasMore);
} }
); );
@ -171,8 +250,6 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
{ {
librarys.Add(result); librarys.Add(result);
} }
// librarys.Sort((a,b) => a.owner_id.CompareTo(b.owner_id));
} }
int n = 0; int n = 0;
@ -183,14 +260,15 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
await UniTask.Yield(); await UniTask.Yield();
} }
for (; n < librarys.Count; n++) for (; n < librarys.Count; n++)
{ {
var item = itemPrefabPool.Get(); var item = itemPrefabPool.Get();
LayoutRebuilder.ForceRebuildLayoutImmediate(content);
item.Set(librarys[n]); item.Set(librarys[n]);
await UniTask.Yield(); await UniTask.Yield();
} }
isLoading = false;
loadingImage.rotation = Quaternion.identity;
for (; n > librarys.Count; n--) for (; n > librarys.Count; n--)
{ {
var item = itemPrefabs.Last(); var item = itemPrefabs.Last();
@ -198,7 +276,7 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
await UniTask.Yield(); await UniTask.Yield();
} }
await ApplayImages(); await ApplayImages();
// LayoutRebuilder.ForceRebuildLayoutImmediate(content);
isRefreshing = false; isRefreshing = false;
} }
@ -258,7 +336,7 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
suitType.value = 0; suitType.value = 0;
region.value = 0; region.value = 0;
animalTypes.value = 0; animalTypes.value = 0;
for(int n = 0; n < colors.Length; n++) for (int n = 0; n < colors.Length; n++)
{ {
colors[n].isOn = false; colors[n].isOn = false;
colors[n].image.sprite = isOnSprite[0]; colors[n].image.sprite = isOnSprite[0];
@ -275,13 +353,15 @@ public class SearchCtrl : SingletonMonoBehaviour<SearchCtrl>
model.Set(library); model.Set(library);
} }
public void ScrollValue(RectTransform Content) { public void ScrollValue(RectTransform Content)
if(Content.anchoredPosition.y < 0.0f) {
if (Content.anchoredPosition.y < 0.0f)
{ {
Content.anchoredPosition = Vector2.zero; Content.anchoredPosition = Vector2.zero;
} }
else if(hasMore && Content.sizeDelta.y != Screen.height && Content.sizeDelta.y - Screen.height < Content.anchoredPosition.y) else if (hasMore && Content.sizeDelta.y != Screen.height && Content.sizeDelta.y - Screen.height < (Content.anchoredPosition.y + 25))
{ {
isLoading = true;
NextSearch(); NextSearch();
} }
} }
@ -298,7 +378,7 @@ public class SearchRequest
public string suitType = ""; /*슈트 형태*/ public string suitType = ""; /*슈트 형태*/
public List<string> colorList = new List<string>(); /*슈트 색상*/ public List<string> colorList = new List<string>(); /*슈트 색상*/
public int page = 1; public int page = 1;
public int size = 5; public int size = 10;
public int offset = 0; public int offset = 0;
} }
public class SearchResponse public class SearchResponse
@ -319,7 +399,6 @@ public class Library
public string owner_id; public string owner_id;
public string owner_name; public string owner_name;
public string production_date; public string production_date;
public string suit_image;//»ç¿ë¾ÈÇÔ
public Texture2D _suit_image = null; public Texture2D _suit_image = null;
public string maker; public string maker;
public string region; public string region;

View File

@ -14,4 +14,24 @@ public class GameManager : DontDestroy<GameManager>
{ {
Application.targetFrameRate = 100; Application.targetFrameRate = 100;
} }
public enum eColor
{
= 500001,
= 500002,
= 500003,
= 500004,
= 500005,
= 500006,
= 500007,
= 500008,
= 500009,
= 500010,
= 500011,
= 500012,
= 500013,
= 500014,
= 500015,
= 500016,
}
} }

View File

@ -40,7 +40,7 @@ public class TopMenuCtrl : MonoBehaviour
fursuit.text = sizeY < 0.5f ? "퍼\n슈\n트\n\n등\n록" : "퍼\n슈\n트"; fursuit.text = sizeY < 0.5f ? "퍼\n슈\n트\n\n등\n록" : "퍼\n슈\n트";
sizeY = (sizeY < 1.0f ? sizeY : 1.0f); sizeY = (sizeY < 1.0f ? sizeY : 1.0f);
rectTransform.sizeDelta = new Vector2(282.5f, 242 - (sizeY * 87)); rectTransform.sizeDelta = new Vector2(282.5f, 242 - (sizeY * 87));
topButton.anchoredPosition = new Vector2(-50, -100f + (sizeY * 150f)); topButton.anchoredPosition = new Vector2(-28, -100f + (sizeY * 129f));
} }
} }
public void TopButton() public void TopButton()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 165 KiB

View File

@ -137,9 +137,23 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 1da056f246b185842aae317b0faf0a3b, type: 3} m_Script: {fileID: 11500000, guid: 1da056f246b185842aae317b0faf0a3b, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_library:
imageBase64:
suit_name:
owner_id:
owner_name:
production_date:
_suit_image: {fileID: 0}
maker:
region:
animal_type:
suit_style:
suit_type:
suit_color: []
suitName: {fileID: 8144517625848204680} suitName: {fileID: 8144517625848204680}
ownerName: {fileID: 2525889181953908848} ownerName: {fileID: 2525889181953908848}
suitImage: {fileID: 3834666193358897927} suitImage: {fileID: 3834666193358897927}
loading: {fileID: 5262172002440681221}
--- !u!114 &748755465289565643 --- !u!114 &748755465289565643
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -566,6 +580,81 @@ MonoBehaviour:
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0} m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &5262172002440681221
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7097115115093172578}
- component: {fileID: 3151196771925636361}
- component: {fileID: 4446388371920305231}
m_Layer: 5
m_Name: Loading
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7097115115093172578
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5262172002440681221}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 716527630986831245}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 50, y: 50}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &3151196771925636361
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5262172002440681221}
m_CullTransparentMesh: 1
--- !u!114 &4446388371920305231
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5262172002440681221}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 96ae92151615e4241b2e95873bbc5ede, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &6543022936957413842 --- !u!1 &6543022936957413842
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -598,6 +687,7 @@ RectTransform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 104449160465615579} - {fileID: 104449160465615579}
- {fileID: 7097115115093172578}
- {fileID: 6213423518440723368} - {fileID: 6213423518440723368}
m_Father: {fileID: 6212042657398888647} m_Father: {fileID: 6212042657398888647}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

File diff suppressed because one or more lines are too long

View File

@ -408,7 +408,7 @@ PlayerSettings:
m_APIs: 10000000 m_APIs: 10000000
m_Automatic: 1 m_Automatic: 1
m_BuildTargetVRSettings: [] m_BuildTargetVRSettings: []
m_DefaultShaderChunkSizeInMB: 32 m_DefaultShaderChunkSizeInMB: 256
m_DefaultShaderChunkCount: 0 m_DefaultShaderChunkCount: 0
openGLRequireES31: 0 openGLRequireES31: 0
openGLRequireES31AEP: 0 openGLRequireES31AEP: 0
@ -687,7 +687,7 @@ PlayerSettings:
webGLMemoryGrowthMode: 2 webGLMemoryGrowthMode: 2
webGLMemoryLinearGrowthStep: 16 webGLMemoryLinearGrowthStep: 16
webGLMemoryGeometricGrowthStep: 0.2 webGLMemoryGeometricGrowthStep: 0.2
webGLMemoryGeometricGrowthCap: 96 webGLMemoryGeometricGrowthCap: 256
webGLPowerPreference: 2 webGLPowerPreference: 2
scriptingDefineSymbols: scriptingDefineSymbols:
WebGL: ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1 WebGL: ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1
@ -780,7 +780,13 @@ PlayerSettings:
XboxOneOverrideIdentityName: XboxOneOverrideIdentityName:
XboxOneOverrideIdentityPublisher: XboxOneOverrideIdentityPublisher:
vrEditorSettings: {} vrEditorSettings: {}
cloudServicesEnabled: {} cloudServicesEnabled:
Build: 0
Game Performance: 0
Legacy Analytics: 0
Purchasing: 0
UDP: 0
Unity Ads: 0
luminIcon: luminIcon:
m_Name: m_Name:
m_ModelFolderPath: m_ModelFolderPath:
@ -797,14 +803,14 @@ PlayerSettings:
embeddedLinuxEnableGamepadInput: 1 embeddedLinuxEnableGamepadInput: 1
hmiLogStartupTiming: 0 hmiLogStartupTiming: 0
hmiCpuConfiguration: hmiCpuConfiguration:
apiCompatibilityLevel: 3 apiCompatibilityLevel: 6
activeInputHandler: 0 activeInputHandler: 0
windowsGamepadBackendHint: 0 windowsGamepadBackendHint: 0
cloudProjectId: 30451103-25d6-4a7d-873a-a34ec38976d2 cloudProjectId:
framebufferDepthMemorylessMode: 0 framebufferDepthMemorylessMode: 0
qualitySettingsNames: [] qualitySettingsNames: []
projectName: Unity_Web projectName:
organizationId: jyp0036 organizationId:
cloudEnabled: 0 cloudEnabled: 0
legacyClampBlendShapeWeights: 0 legacyClampBlendShapeWeights: 0
hmiLoadingImage: {fileID: 0} hmiLoadingImage: {fileID: 0}