using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.UI; public class MainPanel : MonoBehaviour { public static MainPanel ins; [SerializeField] private GameObject startPanel;//开始界面 [SerializeField] private GameObject levelPanel;//关卡界面 [SerializeField] private PackPanel packPanel;//背包界面 [SerializeField] private WinPanel winPanel;//胜利界面 [SerializeField] private LosePanel losePanel;//失败界面 [SerializeField] private TourPanel tourPanel;//旅行界面 [SerializeField] private HomePanel homePanel;//家园界面 [SerializeField] private Button winrestButton; [SerializeField] private Button wincloseButton; [SerializeField] private Button loseRestButton; [SerializeField] private Button loseCloseButton; [SerializeField] private TextMeshProUGUI _textMeshPro; private void Awake() { ins = this; } /// /// 关闭页面方法 /// public void ClosePanelEvent() { GameManager.ins.start = false; // startPanel.SetActive(true); // winPanel.SetActive(false); // packPanel.gameObject.SetActive(false); // losePanel.SetActive(false); // tourPanel.SetActive(false); OpenLevelPanel(); } public void OpenLevelPanel() { GameManager.ins.soundSystem.MainAudio(); startPanel.SetActive(false); winPanel.gameObject.SetActive(false); losePanel.gameObject.SetActive(false); packPanel.gameObject.SetActive(false); levelPanel.SetActive(true); tourPanel.gameObject.SetActive(false); homePanel.gameObject.SetActive(false); levelPanel.GetComponent().StartPanel(DataManager.chapter); } /// /// 开始游戏页面方法 /// public void StartPanelEvent() { GameManager.ins.soundSystem.PackAudio(); startPanel.SetActive(false); levelPanel.gameObject.SetActive(false); winPanel.gameObject.SetActive(false); losePanel.gameObject.SetActive(false); packPanel.gameObject.SetActive(true); packPanel.ResetTextData(); packPanel.StartPanel(); // _textMeshPro.text = "剩余箱子数:" + (GameManager.ins.index - 1); ResetPropattributes(); } public void StartTourPanel() { GameManager.ins.soundSystem.tourAudio(); GameManager.ins.start = false; startPanel.SetActive(false); winPanel.gameObject.SetActive(false); packPanel.gameObject.SetActive(false); losePanel.gameObject.SetActive(false); tourPanel.gameObject.SetActive(true); tourPanel.GetComponent().StartVoid(); } /// /// 胜利页面 /// public void Win() { winPanel.gameObject.SetActive(true); winPanel.SaveData(GameManager.ins.level); } /// /// 失败页面 /// public void Lose() { losePanel.gameObject.SetActive(true); losePanel.SaveData(GameManager.ins.level); } /// /// 家园界面 /// public void HomePanel() { DataManager.SaveAllStarNum(); homePanel.gameObject.SetActive(true); startPanel.SetActive(false); winPanel.gameObject.SetActive(false); losePanel.gameObject.SetActive(false); packPanel.gameObject.SetActive(false); levelPanel.SetActive(false); tourPanel.gameObject.SetActive(false); homePanel.ResetImage(); } // Start is called before the first frame update void Start() { // ClosePanelEvent(); } public void ResetPropattributes() { packPanel.ResetPropattributes(); } public void AddTourPanel(int addTime) { GameManager.ins.soundSystem.tourAudio(); tourPanel.AddTime(addTime); } public void ResetPackLockButtonRest() { packPanel.ResetAddUnlock(); } // Update is called once per frame void Update() { } }