feat: Lobby ui 작업 1차
This commit is contained in:
@@ -22,7 +22,18 @@ namespace TON
|
||||
[SerializeField]
|
||||
private TextMeshProUGUI characterCritical;
|
||||
|
||||
public List<string> stageList = new List<string> { "STG001", "STG002", "STG003", "STG004" };
|
||||
|
||||
public LobbyUI_StagePage stagePagePrefab;
|
||||
public Transform stagePageGroup;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
SetCharacterData();
|
||||
SetStageData();
|
||||
}
|
||||
|
||||
private void SetCharacterData()
|
||||
{
|
||||
PlayerData player = PlayerDataManager.Singleton.player;
|
||||
|
||||
@@ -37,11 +48,32 @@ namespace TON
|
||||
characterCritical.text = $"{player.critical}";
|
||||
}
|
||||
|
||||
public void OnClickStageEntryButton()
|
||||
private void SetStageData()
|
||||
{
|
||||
stageList.ForEach(stageId =>
|
||||
{
|
||||
LobbyUI_StagePage stagePage = Instantiate(stagePagePrefab, stagePageGroup);
|
||||
stagePage.Initalize(stageId);
|
||||
});
|
||||
}
|
||||
|
||||
public void OnClickChangeStageButton()
|
||||
{
|
||||
// TODO: 스테이지 입장 popupUI 비활성화
|
||||
}
|
||||
|
||||
public void OnClickStageButton()
|
||||
{
|
||||
// TODO: 스테이지 선택 UI 활성화
|
||||
|
||||
}
|
||||
|
||||
public void OnClickStagePlayButton()
|
||||
{
|
||||
UIManager.Hide<LobbyUI>(UIList.LobbyUI);
|
||||
UIManager.Show<StageEntryUI>(UIList.StageEntryUI);
|
||||
|
||||
// TODO: 선택된 스테이지 아이디 불러오기
|
||||
// 선택한 스테이지 아이디 활용 필요
|
||||
Main.Singleton.ChangeScene(SceneType.Stage);
|
||||
}
|
||||
|
||||
public void OnClickSkillSettingButton()
|
||||
|
||||
@@ -1,11 +1,63 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor.SceneManagement;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Assertions;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace TON
|
||||
{
|
||||
public class LobbyUI_StagePage : MonoBehaviour
|
||||
{
|
||||
|
||||
public Button stageEntryButton;
|
||||
public GameObject stageImage;
|
||||
public GameObject starPoint;
|
||||
|
||||
public GameObject stageEntryUI;
|
||||
public GameObject lockState;
|
||||
|
||||
private string stageId;
|
||||
|
||||
public StageClearData stageClearData;
|
||||
|
||||
public void Initalize(string stageId)
|
||||
{
|
||||
this.stageId = stageId;
|
||||
|
||||
if (stageId == "STG001")
|
||||
{
|
||||
lockState.SetActive(false);
|
||||
}
|
||||
|
||||
SerializableDictionary<string, StageClearData> bestStageClearDict = StageManager.Singleton.bestStageClearDict;
|
||||
stageClearData = bestStageClearDict.GetValueOrDefault(stageId, null);
|
||||
SetStageImage();
|
||||
|
||||
// 스테이지 슬롯에 스테이지 클리어 정보가 있는 경우
|
||||
if (stageClearData != null) // 스테이지 슬롯에 별점이 지정된 경우
|
||||
{
|
||||
// for (int i = 0; i < starCount; i++)
|
||||
// {
|
||||
// starPoint.transform.GetChild(i).gameObject.SetActive(true);
|
||||
// }
|
||||
}
|
||||
else
|
||||
{
|
||||
// 이전 스테이지가 클리어되지 않아 진입할 수 없는 경우
|
||||
stageEntryButton.interactable = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetStageImage()
|
||||
{
|
||||
Assert.IsTrue(AssetManager.Singleton.LoadStageIcon(stageId, out Sprite loadedStageImage));
|
||||
stageImage.GetComponent<Image>().sprite = loadedStageImage;
|
||||
stageImage.SetActive(true);
|
||||
}
|
||||
|
||||
public void OnClickStageButton()
|
||||
{
|
||||
stageEntryUI.SetActive(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user