RandomGFGoStop/Assets/Scripts/UI/BottomPanel.cs

134 lines
4.5 KiB
C#

using UnityEngine;
public class BottomPanel : MonoBehaviour
{
[SerializeField] private GameObject[] Panels;
[SerializeField] private UnityEngine.UI.Image SelectGlow;
[SerializeField] private RectTransform[] CategoryRTs;
[SerializeField] private GameObject MainButtonPanel;
[SerializeField] private GameObject FullViewPanel;
[SerializeField] private GameObject StoreBackPanel;
private void Start()
{
if (GameManager.Instance != null)
{
GameManager.Event.RegistEvent(EEventType.OnStartNormalGame, this.OnClickStartGame);
GameManager.Event.RegistEvent(EEventType.OnChallengeStart, this.OnClickStartGame);
GameManager.Event.RegistEvent(EEventType.OnReturnToHome, this.OnReturnToHome);
GameManager.Event.RegistEvent(EEventType.OnReturnToHunting, this.OnReturnToHunting);
GameManager.Event.RegistEvent(EEventType.MoveToStore_Heart, this.MoveToStore);
GameManager.Event.RegistEvent(EEventType.MoveToStore_Heart_DuringGame, this.MoveToStoreDuringGame);
GameManager.Event.RegistEvent(EEventType.MoveToStore_Key, this.MoveToStore);
GameManager.Event.RegistEvent(EEventType.OnClickFullView, this.OnClickFullView);
GameManager.Event.RegistEvent(EEventType.OnReturnToGameFromStore, this.OnReturnToGameFromStoreCallback);
}
CanvasControl.Ins.Go_Main();
}
private void OnDestroy()
{
if (GameManager.Instance != null)
{
GameManager.Event.RemoveEvent(EEventType.OnStartNormalGame, this.OnClickStartGame);
GameManager.Event.RemoveEvent(EEventType.OnChallengeStart, this.OnClickStartGame);
GameManager.Event.RemoveEvent(EEventType.OnReturnToHome, this.OnReturnToHome);
GameManager.Event.RemoveEvent(EEventType.OnReturnToHunting, this.OnReturnToHunting);
GameManager.Event.RemoveEvent(EEventType.MoveToStore_Heart, this.MoveToStore);
GameManager.Event.RemoveEvent(EEventType.MoveToStore_Heart_DuringGame, this.MoveToStoreDuringGame);
GameManager.Event.RemoveEvent(EEventType.MoveToStore_Key, this.MoveToStore);
GameManager.Event.RemoveEvent(EEventType.OnReturnToGameFromStore, this.OnReturnToGameFromStoreCallback);
}
}
public void OnClickFullView(object huntingDataID, object huntingListDataID)
{
//MainButtonPanel.SetActive(false);
//FullViewPanel.SetActive(true);
//StoreBackPanel.SetActive(false);
}
public void ClickReturnFullView()
{
//MainButtonPanel.SetActive(true);
//FullViewPanel.SetActive(false);
//StoreBackPanel.SetActive(false);
GameManager.Event.InvokeEvent(EEventType.OnReturnFullView);
}
public void ClickReturnToGame()
{
MainButtonPanel.SetActive(false);
FullViewPanel.SetActive(false);
StoreBackPanel.SetActive(true);
GameManager.Event.InvokeEvent(EEventType.OnReturnFullView);
}
public void ClickBackButtonStoreDuringGame()
{
GameManager.Event.InvokeEvent(EEventType.OnReturnToGameFromStore);
}
private void OnReturnToGameFromStoreCallback()
{
MainButtonPanel.SetActive(false);
FullViewPanel.SetActive(false);
StoreBackPanel.SetActive(false);
this.gameObject.SetActive(false);
}
private void OnClickStartGame()
{
this.gameObject.SetActive(false);
for (int i = 0; i < Panels.Length; i++)
{
Panels[i].SetActive(false);
}
}
private void OnReturnToHome()
{
this.gameObject.SetActive(true);
MainButtonPanel.SetActive(true);
CanvasControl.Ins.Go_Main();
}
private void OnReturnToHunting()
{
this.gameObject.SetActive(true);
MainButtonPanel.SetActive(true);
this.ClickCategory(0);
}
public void ClickCategory(int index)
{
GameManager.Sound.PlaySFX(ESFXType.Button_Hit);
if (index == 0) CanvasControl.Ins.Go_Album();
else if (index == 1) CanvasControl.Ins.Go_HideUI();
else CanvasControl.Ins.Go_Shop();
}
private void MoveToStore()
{
MainButtonPanel.SetActive(true);
this.ClickCategory(2);
}
private void MoveToStoreDuringGame()
{
if (this.gameObject.activeInHierarchy == false)
this.gameObject.SetActive(true);
MainButtonPanel.SetActive(false);
FullViewPanel.SetActive(false);
StoreBackPanel.SetActive(true);
}
}