From 58b98ce46330f85580beacce4c7a4051d46b1b8a Mon Sep 17 00:00:00 2001 From: "aube.lee" Date: Tue, 4 Mar 2025 22:33:46 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=9E=AD=ED=82=B9=20=EB=85=B8=EC=B6=9C?= =?UTF-8?q?=20=EC=A1=B0=EA=B1=B4=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/Prefabs/Rank Box/Rank Box.prefab | 8 +-- .../Resources/UI/Prefabs/UI.RankingUI.prefab | 52 +++++++++---------- .../Scripts/Backend/BackendRankDataManager.cs | 7 +-- .../Gameton/Scripts/GameData/ClearData.cs | 8 +++ .../Gameton/Scripts/GameStage/StageManager.cs | 18 ++++--- .../Assets/Gameton/Scripts/UI/RankingUI.cs | 2 +- .../Gameton/Scripts/UI/RankingUI_RankBox.cs | 6 ++- 7 files changed, 58 insertions(+), 43 deletions(-) diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Rank Box/Rank Box.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Rank Box/Rank Box.prefab index 1235df95..5ac6ab2f 100644 --- a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Rank Box/Rank Box.prefab +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/Rank Box/Rank Box.prefab @@ -1504,11 +1504,11 @@ RectTransform: - {fileID: 8160306688446430222} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 250} - m_Pivot: {x: 0.5, y: 0.5} + m_SizeDelta: {x: 840, y: 250} + m_Pivot: {x: 0.5, y: 1} --- !u!222 &2461189433906269157 CanvasRenderer: m_ObjectHideFlags: 0 diff --git a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.RankingUI.prefab b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.RankingUI.prefab index 734ea743..1fd44e07 100644 --- a/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.RankingUI.prefab +++ b/Gameton-06/Assets/Gameton/Resources/UI/Prefabs/UI.RankingUI.prefab @@ -227,7 +227,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &4887657808625157883 RectTransform: m_ObjectHideFlags: 0 @@ -330,7 +330,7 @@ MonoBehaviour: m_HandleRect: {fileID: 2996482217434952235} m_Direction: 2 m_Value: 0 - m_Size: 0.9999915 + m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: m_PersistentCalls: @@ -861,13 +861,13 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 1235168763264746713} + - {fileID: 7495923051705061397} m_Father: {fileID: 6130240796382213815} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0.00002390486} - m_SizeDelta: {x: 0, y: 300} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!1 &3043442581440476734 GameObject: @@ -2460,10 +2460,10 @@ RectTransform: - {fileID: 6417327352021012356} m_Father: {fileID: 3893907938536155103} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + 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: -100, y: -100} + m_SizeDelta: {x: 840, y: 800} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1777609069712655264 CanvasRenderer: @@ -2982,7 +2982,7 @@ RectTransform: m_Father: {fileID: 7949169664028140168} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 20, y: 20} m_Pivot: {x: 0.5, y: 0.5} @@ -3024,7 +3024,7 @@ MonoBehaviour: m_FillOrigin: 0 m_UseSpriteMesh: 0 m_PixelsPerUnitMultiplier: 1 ---- !u!1001 &1395767179664397934 +--- !u!1001 &7673060521725952674 PrefabInstance: m_ObjectHideFlags: 0 serializedVersion: 2 @@ -3038,27 +3038,27 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_Pivot.y - value: 0.5 - objectReference: {fileID: 0} - - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} - propertyPath: m_AnchorMax.x value: 1 objectReference: {fileID: 0} - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} - propertyPath: m_AnchorMax.y + propertyPath: m_AnchorMax.x value: 0.5 objectReference: {fileID: 0} + - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_AnchorMin.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} - propertyPath: m_AnchorMin.y value: 0.5 objectReference: {fileID: 0} + - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} + propertyPath: m_AnchorMin.y + value: 1 + objectReference: {fileID: 0} - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_SizeDelta.x - value: 0 + value: 840 objectReference: {fileID: 0} - target: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_SizeDelta.y @@ -3122,7 +3122,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 3398201985880822359, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_AnchoredPosition.x - value: 465.33334 + value: 463.33334 objectReference: {fileID: 0} - target: {fileID: 3398201985880822359, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_AnchoredPosition.y @@ -3162,7 +3162,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 9137538600224533238, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_AnchoredPosition.x - value: 262.6667 + value: 261.6667 objectReference: {fileID: 0} - target: {fileID: 9137538600224533238, guid: 64f6711fc3dfade4f8926564be683890, type: 3} propertyPath: m_AnchoredPosition.y @@ -3173,8 +3173,8 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 64f6711fc3dfade4f8926564be683890, type: 3} ---- !u!224 &1235168763264746713 stripped +--- !u!224 &7495923051705061397 stripped RectTransform: m_CorrespondingSourceObject: {fileID: 178720843269296823, guid: 64f6711fc3dfade4f8926564be683890, type: 3} - m_PrefabInstance: {fileID: 1395767179664397934} + m_PrefabInstance: {fileID: 7673060521725952674} m_PrefabAsset: {fileID: 0} diff --git a/Gameton-06/Assets/Gameton/Scripts/Backend/BackendRankDataManager.cs b/Gameton-06/Assets/Gameton/Scripts/Backend/BackendRankDataManager.cs index d3a07202..f7e45697 100644 --- a/Gameton-06/Assets/Gameton/Scripts/Backend/BackendRankDataManager.cs +++ b/Gameton-06/Assets/Gameton/Scripts/Backend/BackendRankDataManager.cs @@ -194,17 +194,14 @@ namespace TON // 결과 제한 수 (100개) int limit = 100; - // 첫 번째 정렬 기준 (wave 내림차순) - string firstKey = "wave"; - // 데이터 비동기 요청 - Backend.GameData.Get(RANK_TABLE, new Where(), select, limit, firstKey, TableSortOrder.DESC, bro => + Backend.GameData.Get(RANK_TABLE, new Where(), select, limit, null, TableSortOrder.DESC, bro => { // 요청 성공 확인 if (bro.IsSuccess()) { // 데이터 처리 - LitJson.JsonData rankData = bro.GetReturnValuetoJSON()["rows"]; + LitJson.JsonData rankData = bro.Rows(); Debug.Log("가져온 데이터 수: " + rankData.Count); onComplete?.Invoke(rankData); diff --git a/Gameton-06/Assets/Gameton/Scripts/GameData/ClearData.cs b/Gameton-06/Assets/Gameton/Scripts/GameData/ClearData.cs index 7f105292..597e81e8 100644 --- a/Gameton-06/Assets/Gameton/Scripts/GameData/ClearData.cs +++ b/Gameton-06/Assets/Gameton/Scripts/GameData/ClearData.cs @@ -24,6 +24,14 @@ namespace TON score = 0; } + public ClearData(string nickname, int wave, float playTime, int score) + { + this.nickname = nickname; + this.wave = wave; + this.playTime = playTime; + this.score = score; + } + public void UpdateClearData(string nickname, int wave, float playTime, int score) { this.nickname = nickname; diff --git a/Gameton-06/Assets/Gameton/Scripts/GameStage/StageManager.cs b/Gameton-06/Assets/Gameton/Scripts/GameStage/StageManager.cs index 74ba19cb..2de402e0 100644 --- a/Gameton-06/Assets/Gameton/Scripts/GameStage/StageManager.cs +++ b/Gameton-06/Assets/Gameton/Scripts/GameStage/StageManager.cs @@ -97,13 +97,14 @@ namespace TON { LitJson.JsonData row = rankData[i]; RankList.Add(new ClearData - { - nickname = row["nickname"].ToString(), - wave = int.Parse(row["wave"].ToString()), - score = int.Parse(row["score"].ToString()), - playTime = float.Parse(row["play_time"].ToString()), - }); + ( + row["nickname"]["S"].ToString(), + int.Parse(row["wave"]["N"].ToString()), + float.Parse(row["play_time"]["N"].ToString()), + int.Parse(row["score"]["N"].ToString()) + )); } + ; // 정렬 (score 내림차순, playTime 오름차순) RankList.Sort((a, b) => @@ -114,6 +115,11 @@ namespace TON }); } + public List GetRankDataList() + { + return RankList; + } + // 내 랭킹 순위 반환 public int GetMyRankNumber() { diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI.cs b/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI.cs index 27f8b792..bfcc71d9 100644 --- a/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI.cs +++ b/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI.cs @@ -64,7 +64,7 @@ namespace TON uiPrefabList.Clear(); } - List rankList = StageManager.Singleton.RankList; + List rankList = StageManager.Singleton.GetRankDataList(); if (rankList.Count == 0) { diff --git a/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI_RankBox.cs b/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI_RankBox.cs index e8fc1b9a..72e68984 100644 --- a/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI_RankBox.cs +++ b/Gameton-06/Assets/Gameton/Scripts/UI/RankingUI_RankBox.cs @@ -31,7 +31,11 @@ namespace TON playTimeText.text = $"{minutes:0}m {seconds:0}s"; SetPawIcon(rank); - SetMyRankBoxImage(); + + if (clearData.nickname == PlayerDataManager.Singleton.player.name) + { + SetMyRankBoxImage(); + } } private void SetMyRankBoxImage()