feat: 스테이지 클리어 정보에 따라 slide 데이터 세팅 구조 적용

This commit is contained in:
aube.lee
2025-02-14 22:44:03 +09:00
parent c54ab55c5a
commit 5c16ce7fa2
9 changed files with 225 additions and 51 deletions

View File

@@ -241,6 +241,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1707601040220393083}
m_TargetAssemblyTypeName: TON.LobbyUI, Assembly-CSharp
m_MethodName: OnClickChangeStageButton
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &446340643863793218
GameObject:
m_ObjectHideFlags: 0
@@ -1888,7 +1900,8 @@ MonoBehaviour:
- STG002
- STG003
- STG004
stagePagePrefab: {fileID: 6968453166287933383}
stagePages: []
stagePagePrefab: {fileID: 226679562418074486}
stagePageGroup: {fileID: 4696811377547952634}
--- !u!1 &3936373691637145443
GameObject:
@@ -2437,7 +2450,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2f2a180c175deed42b216234359be860, type: 3}
m_Name:
m_EditorClassIdentifier:
maxPage: 3
maxPage: 4
currentPage: 0
targetPos: {x: 0, y: 0}
pageStep: {x: -660, y: 0}
@@ -2956,6 +2969,18 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
- m_Target: {fileID: 1707601040220393083}
m_TargetAssemblyTypeName: TON.LobbyUI, Assembly-CSharp
m_MethodName: OnClickChangeStageButton
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &5489683189456517259
GameObject:
m_ObjectHideFlags: 0
@@ -5293,7 +5318,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_AnchorMin.x
@@ -5301,7 +5326,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_SizeDelta.x
@@ -5341,11 +5366,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 330
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -400
objectReference: {fileID: 0}
- target: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -5359,10 +5384,26 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2273889548321886700, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2273889548321886700, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2273889548321886700, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3703304680486478202, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_Name
value: StagePage
objectReference: {fileID: 0}
- target: {fileID: 3703304680486478202, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5659516017823469766, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_AnchorMax.y
value: 0
@@ -5379,27 +5420,25 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9027789193876814119, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 1707601040220393083}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
--- !u!1 &226679562418074486 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 3703304680486478202, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
m_PrefabInstance: {fileID: 3477223252679791116}
m_PrefabAsset: {fileID: 0}
--- !u!224 &4588716762380020347 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 1148402191174711415, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
m_PrefabInstance: {fileID: 3477223252679791116}
m_PrefabAsset: {fileID: 0}
--- !u!114 &6968453166287933383 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 5833708650400374219, guid: 37b882a126f0daf42a4b4a0f0f261a17, type: 3}
m_PrefabInstance: {fileID: 3477223252679791116}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 20a9f61ddd2bf77478b2a76ca955e678, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &4365451869886974356
PrefabInstance:
m_ObjectHideFlags: 0

View File

@@ -396,7 +396,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!224 &8587569203289185346
RectTransform:
m_ObjectHideFlags: 0
@@ -514,7 +514,8 @@ MonoBehaviour:
m_EditorClassIdentifier:
stageEntryButton: {fileID: 9027789193876814119}
stageImage: {fileID: 8654573821297256642}
starPoint: {fileID: 8481812916655228936}
starGroup: {fileID: 3135648780667157969}
starPrefab: {fileID: 1094882719706695268}
stageEntryUI: {fileID: 1556631089071821170}
lockState: {fileID: 2664070523333872795}
stageClearData:
@@ -524,6 +525,7 @@ MonoBehaviour:
clearTime: 0
starRating: 0
dateTime:
stageId:
--- !u!1 &4131198014371777443
GameObject:
m_ObjectHideFlags: 0
@@ -604,13 +606,13 @@ MonoBehaviour:
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName:
- m_Target: {fileID: 1707601040220393083, guid: f5e67b59f62c63742986e51bf631202d, type: 3}
m_TargetAssemblyTypeName: TON.LobbyUI, Assembly-CSharp
m_MethodName: OnClickStageButton
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
@@ -916,6 +918,10 @@ PrefabInstance:
propertyPath: m_Name
value: Star
objectReference: {fileID: 0}
- target: {fileID: 3281009181637503551, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_Pivot.x
value: 0.5
@@ -930,7 +936,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_AnchorMax.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_AnchorMin.x
@@ -938,7 +944,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_AnchorMin.y
value: 0
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_SizeDelta.x
@@ -978,11 +984,11 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
value: 210
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
value: -60
objectReference: {fileID: 0}
- target: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
@@ -1001,6 +1007,17 @@ PrefabInstance:
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
--- !u!114 &1094882719706695268 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 141079967592758922, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}
m_PrefabInstance: {fileID: 1064249688370116846}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba544d6702743874b920b1f4c9b8f08c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &5659516017823469766 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4633740738853513256, guid: 37628f2abd1d1af4ba1883409c81504c, type: 3}

View File

@@ -9,6 +9,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 4633740738853513256}
- component: {fileID: 141079967592758922}
m_Layer: 5
m_Name: Star
m_TagString: Untagged
@@ -37,6 +38,20 @@ RectTransform:
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &141079967592758922
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3281009181637503551}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba544d6702743874b920b1f4c9b8f08c, type: 3}
m_Name:
m_EditorClassIdentifier:
fillStar: {fileID: 3868087452441076765}
emptyStar: {fileID: 8759189818807343448}
--- !u!1 &3868087452441076765
GameObject:
m_ObjectHideFlags: 0

View File

@@ -44,12 +44,12 @@ namespace TON
Main.Singleton.Initialize();
// TODO : Custom Order After System Load
// UIManager.Show<TitleUI>(UIList.TitleUI);
UIManager.Show<TitleUI>(UIList.TitleUI);
// UIManager.Show<CharaterCreateUI>(UIList.CharaterCreateUI);
// UIManager.Show<LobbyUI>(UIList.LobbyUI);
// UIManager.Show<IngameOptionUI>(UIList.IngameOptionUI);
// UIManager.Show<SkillSettingUI>(UIList.SkillSettingUI);
UIManager.Show<ControllerUI>(UIList.ControllerUI);
// UIManager.Show<ControllerUI>(UIList.ControllerUI);
// UIManager.Show<IngameUI>(UIList.IngameUI);
// ControllerUI.Instance.Initalize();
}

View File

@@ -30,6 +30,7 @@ namespace TON
PlayerDataManager.Singleton.Initalize();
PlayerDataManager.Singleton.SetCurrentUserData();
StageManager.Singleton.Initialize();
SkillDataManager.Singleton.Initalize();
isIniaialized = true;

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TON
{
public class StageStar : MonoBehaviour
{
public GameObject fillStar;
public GameObject emptyStar;
public void SetStar(bool isFill)
{
fillStar.SetActive(isFill);
emptyStar.SetActive(!isFill);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ba544d6702743874b920b1f4c9b8f08c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Assertions;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace TON
@@ -24,7 +25,8 @@ namespace TON
public List<string> stageList = new List<string> { "STG001", "STG002", "STG003", "STG004" };
public LobbyUI_StagePage stagePagePrefab;
public List<LobbyUI_StagePage> stagePages = new List<LobbyUI_StagePage>();
public GameObject stagePagePrefab;
public Transform stagePageGroup;
private void Start()
@@ -50,22 +52,38 @@ namespace TON
private void SetStageData()
{
stageList.ForEach(stageId =>
if (stagePages.Count > 0)
{
LobbyUI_StagePage stagePage = Instantiate(stagePagePrefab, stagePageGroup);
stagePage.Initalize(stageId);
});
foreach (var stagePage in stagePages)
{
Destroy(stagePage.gameObject);
}
stagePages.Clear();
}
for (int i = 0; i < stageList.Count; i++)
{
string stageId = stageList[i];
GameObject stagePageObject = Instantiate(stagePagePrefab, stagePageGroup);
LobbyUI_StagePage stagePage = stagePageObject.GetComponent<LobbyUI_StagePage>();
stagePageObject.SetActive(true);
stagePage.Initalize(stageId, i);
stagePages.Add(stagePage);
}
}
public void OnClickChangeStageButton()
{
// TODO: 스테이지 입장 popupUI 비활성화
stagePages.ForEach(page => page.GetComponent<LobbyUI_StagePage>().OnClickStageChangeButton());
}
public void OnClickStageButton()
{
// TODO: 스테이지 선택 UI 활성화
GameObject currentSelectedGameObject = EventSystem.current.currentSelectedGameObject;
Debug.Log("OnClickStageButton:: " + currentSelectedGameObject.GetComponent<LobbyUI_StagePage>().stageId);
}
public void OnClickStagePlayButton()

View File

@@ -11,42 +11,92 @@ namespace TON
{
public Button stageEntryButton;
public GameObject stageImage;
public GameObject starPoint;
public Transform starGroup;
public StageStar starPrefab;
public GameObject stageEntryUI;
public GameObject lockState;
private string stageId;
public StageClearData stageClearData;
public void Initalize(string stageId)
public string stageId;
private SerializableDictionary<string, StageClearData> bestStageClearDict = new SerializableDictionary<string, StageClearData>();
public void Initalize(string stageId, int index)
{
this.stageId = stageId;
if (stageId == "STG001")
{
lockState.SetActive(false);
}
SerializableDictionary<string, StageClearData> bestStageClearDict = StageManager.Singleton.bestStageClearDict;
stageClearData = bestStageClearDict.GetValueOrDefault(stageId, null);
SetStageImage();
Debug.Log($"LobbyUI_StagePage stageId: {stageId}");
// 스테이지 슬롯에 스테이지 클리어 정보가 있는 경우
if (stageClearData != null) // 스테이지 슬롯에 별점이 지정된 경우
bestStageClearDict = StageManager.Singleton.bestStageClearDict;
stageClearData = bestStageClearDict.GetValueOrDefault(stageId, null);
SetStageImage();
SetStageEntryInfo(index);
}
private void SetStageEntryInfo(int index)
{
// for (int i = 0; i < starCount; i++)
// {
// starPoint.transform.GetChild(i).gameObject.SetActive(true);
// }
if (stageClearData != null)
{
// 스테이지 슬롯에 스테이지 클리어 정보가 있는 경우
for (int i = 0; i < 3; i++)
{
StageStar stageStar = Instantiate(starPrefab, starGroup);
stageStar.gameObject.SetActive(true);
if (i < stageClearData.starRating)
{
stageStar.SetStar(true);
}
else
{
// 이전 스테이지가 클리어되지 않아 진입할 수 없는 경우
stageStar.SetStar(false);
}
}
}
else
{
Debug.Log($"StageClearData is null");
// 스테이지 슬롯에 스테이지 클리어 정보가 없고 첫번째 스테이지가 아닌 경우
if (index != 0)
{
StageClearData prevStageClearData = bestStageClearDict.GetValueOrDefault($"STG00{index - 1}", null);
// 직전 스테이지의 클리어 결과가 있고 별점이 1개 이상인 경우
if (prevStageClearData != null && prevStageClearData.starRating > 0)
{
lockState.SetActive(false);
stageEntryButton.interactable = true;
}
else
{
SetDefaultStarPoint();
// 이전 스테이지를 클리어하지 않은 경우
stageEntryButton.interactable = false;
}
}
else
{
SetDefaultStarPoint();
}
}
}
private void SetDefaultStarPoint()
{
for (int i = 0; i < 3; i++)
{
StageStar stageStar = Instantiate(starPrefab, starGroup);
stageStar.gameObject.SetActive(true);
Instantiate(starPrefab, starGroup.transform).SetStar(false);
}
}
private void SetStageImage()
{
@@ -59,5 +109,10 @@ namespace TON
{
stageEntryUI.SetActive(true);
}
public void OnClickStageChangeButton()
{
stageEntryUI.SetActive(false);
}
}
}