136 lines
4.0 KiB
C#
136 lines
4.0 KiB
C#
|
|
using TMPro;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.SceneManagement;
|
||
|
|
|
||
|
|
public class IngameUIManager : MonoBehaviourSingletonTemplate<IngameUIManager>
|
||
|
|
{
|
||
|
|
//public RectTransform tf_CharacterPos;
|
||
|
|
public PCActor m_PCActor;
|
||
|
|
public GameObject[] gos; // 0 탐험 버튼
|
||
|
|
public TextMeshProUGUI[] texts_money; // 0 골드, 1 소울, 2 물약
|
||
|
|
public StageNodeBase[] arr_StageNode;
|
||
|
|
public HUD_HPShield PC_HUD_HPShield;
|
||
|
|
public HUD_HPShield[] Mob_HUD_HPShield;
|
||
|
|
public HUD_Dmg[] HUD_Dmgs;
|
||
|
|
public GainCardList m_GainCardList;
|
||
|
|
public SpecificityList m_SpecificityList;
|
||
|
|
public MoneyAnimation m_MoneyAnimation;
|
||
|
|
public PCMainStatUI m_PCMainStatUI;
|
||
|
|
public DungeonInfo m_DungeonInfo;
|
||
|
|
|
||
|
|
Animation MainCamAnim;
|
||
|
|
|
||
|
|
protected override void Awake()
|
||
|
|
{
|
||
|
|
base.Awake();
|
||
|
|
gameObject.SetActive(false);
|
||
|
|
for (int i = 0; i < HUD_Dmgs.Length; i++)
|
||
|
|
HUD_Dmgs[i].Off();
|
||
|
|
}
|
||
|
|
|
||
|
|
private void Start()
|
||
|
|
{
|
||
|
|
MainCamAnim = GameObject.Find("Background Parent").GetComponent<Animation>();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Set()
|
||
|
|
{
|
||
|
|
gameObject.SetActive(true);
|
||
|
|
InGameInfo.Ins.Start_Game();
|
||
|
|
}
|
||
|
|
public void Set_Texts(int gold, int soul, int potion)
|
||
|
|
{
|
||
|
|
texts_money[0].text = gold.ToString();
|
||
|
|
texts_money[1].text = soul.ToString();
|
||
|
|
texts_money[2].text = potion.ToString();
|
||
|
|
}
|
||
|
|
|
||
|
|
public void OnClick_Button(GameObject go)
|
||
|
|
{
|
||
|
|
switch (go.name)
|
||
|
|
{
|
||
|
|
// 일단 로비로
|
||
|
|
case "btn_option": InGameInfo.Ins.Return_To_Lobby(); break;
|
||
|
|
case "btn_deck": DeckUI.Ins.Set(); break;
|
||
|
|
case "btn_explore": Go_Explore(); break;
|
||
|
|
case "btn_potion": InGameInfo.Ins.Use_Potion(); break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Go_Explore()
|
||
|
|
{
|
||
|
|
InGameInfo.Ins.Set_Battle(false);
|
||
|
|
gos[0].SetActive(false);
|
||
|
|
MainCamAnim.Stop();
|
||
|
|
MainCamAnim.Play();
|
||
|
|
}
|
||
|
|
public void Skip_Expore()
|
||
|
|
{
|
||
|
|
InGameInfo.Ins.Set_Battle(false);
|
||
|
|
gos[0].SetActive(false);
|
||
|
|
ExploreAnimEnd();
|
||
|
|
}
|
||
|
|
public void Active_ExporeButton()
|
||
|
|
{
|
||
|
|
gos[0].SetActive(true);
|
||
|
|
for (int i = 0; i < arr_StageNode.Length; i++)
|
||
|
|
arr_StageNode[i].gameObject.SetActive(false);
|
||
|
|
for (int i = 0; i < Mob_HUD_HPShield.Length; i++)
|
||
|
|
Mob_HUD_HPShield[i].gameObject.SetActive(false);
|
||
|
|
Check_ExploreEnd();
|
||
|
|
}
|
||
|
|
public void ExploreAnimEnd()
|
||
|
|
{
|
||
|
|
++MyValue.m_MyStageData.m_NodeIndex;
|
||
|
|
MyValue.m_MyStageData.Set_CurNodeData();
|
||
|
|
for (int i = 0; i < arr_StageNode.Length; i++)
|
||
|
|
arr_StageNode[i].Set();
|
||
|
|
}
|
||
|
|
public void Check_ExploreEnd()
|
||
|
|
{
|
||
|
|
if (MyValue.m_MyStageData.m_NodeIndex < 0) return;
|
||
|
|
|
||
|
|
// 스테이지가 끝났는 지 확인
|
||
|
|
if (MyValue.m_MyStageData.m_NodeIndex + 1 >= MyValue.m_MyStageData.m_StageData.list_Nodedata.Count)
|
||
|
|
{ // 스테이지 종료
|
||
|
|
WinUI.Ins.Set(InGameInfo.Ins.Return_To_Lobby);
|
||
|
|
gos[0].SetActive(false);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
public HUD_Dmg Get_HUD_Dmg()
|
||
|
|
{
|
||
|
|
for (int i = 0; i < HUD_Dmgs.Length; i++)
|
||
|
|
if (!HUD_Dmgs[i].gameObject.activeSelf)
|
||
|
|
return HUD_Dmgs[i];
|
||
|
|
return HUD_Dmgs[0];
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool Check_BattleStart()
|
||
|
|
{
|
||
|
|
if (SelectCardUI.Ins.IsActive()) return false;
|
||
|
|
if (DefeatUI.Ins.IsActive()) return false;
|
||
|
|
return true;
|
||
|
|
}
|
||
|
|
|
||
|
|
public void Return_To_Lobby()
|
||
|
|
{
|
||
|
|
m_MoneyAnimation.AllOff();
|
||
|
|
gameObject.SetActive(false);
|
||
|
|
|
||
|
|
if (MyValue.m_MyStageData.m_EnterType == eStageEnterType.Tool ||
|
||
|
|
MyValue.m_MyStageData.m_EnterType == eStageEnterType.Tool_Mob)
|
||
|
|
{
|
||
|
|
// 툴 씬에서 다시 생성되므로 삭제
|
||
|
|
switch (MyValue.m_MyStageData.m_EnterType)
|
||
|
|
{
|
||
|
|
case eStageEnterType.Tool:
|
||
|
|
SceneManager.LoadScene("99_Tool");
|
||
|
|
break;
|
||
|
|
case eStageEnterType.Tool_Mob:
|
||
|
|
SceneManager.LoadScene("98_Tool_Mob");
|
||
|
|
break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|