From 439510ca0d2da7fa0af0496d4a05096841f01f8f Mon Sep 17 00:00:00 2001 From: wangguan <wangguan@kt007.com> Date: Mon, 26 Oct 2020 14:20:42 +0800 Subject: [PATCH] 新手引导2.0 --- Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 51 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs index ab79cf8..ca518d0 100644 --- a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs +++ b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs @@ -19,9 +19,9 @@ public TextMeshProUGUI timeStatic = null; /// <summary> - /// 选择buff界面 + /// 结算界面 /// </summary> - public GameObject SelectBuffUI; + public GameObject SettlementUI; /// <summary> /// 倒计时整体的背景图片Mask @@ -42,6 +42,8 @@ protected bool[] bVibrate; + private bool isPause; + // Start is called before the first frame update void Start() { @@ -53,8 +55,34 @@ if (timeStatic) timeStatic.gameObject.SetActive(false); - SelectBuffUI.SetActive(false); + EndlessBuffSelect.instance.HideBuffUI(); EndlessBossHPManager.instance.HideHP(); + EndlessSettlement settlement = SettlementUI.transform.GetChild(0).GetComponent<EndlessSettlement>(); + settlement.Init(); + SettlementUI.SetActive(false); + + //查询是否已经做过了新手引导 + int guide = PlayerPrefs.GetInt("GemBattleGuide"); + // if (guide == 0) + // { + // Debug.Log("需要进行新手引导"); + // Pause(); + + // uiStartMssk.gameObject.SetActive(false); + // countDownTextNew.text = ""; + // countDownTextNew.gameObject.SetActive(false); + + // Instantiate(Resources.Load<GameObject>("UI/Guide/GuidePanel"), this.transform); + // //bGameStart = true; + // // 开始关卡 + // //EndlessLevelManager.instance.StartLevel(); + // //timeTextNew.gameObject.SetActive(true); + + // // 开始播放背景音乐. + // // if (bgMusic != null) + // // bgMusic.Play(); + // } + } /// <summary> @@ -98,24 +126,39 @@ } } + public void Pause() + { + isPause = true; + } + + public void Restart() + { + isPause = false; + } + + public bool IsGameRunning { get { return !isPause; } } + // Update is called once per frame void Update() { + if (isPause) return; + if (bGameStart) { startTime += Time.deltaTime; timeTextNew.text = ConvertTime((float)Math.Ceiling(startTime)); } - if ((!bFirstLoaded) && (!bGameStart)) + if (!bFirstLoaded && !bGameStart) { bFirstLoaded = true; secToDo = 4; } - if (bFirstLoaded && (!bGameStart)) + if (bFirstLoaded && !bGameStart) { - secToDo -= (Time.deltaTime * 1.0f); // 放慢时间用于调试 + secToDo -= Time.deltaTime; + countDownTextNew.gameObject.SetActive(true); if (secToDo >= 3) { @@ -159,12 +202,11 @@ { uiStartMssk.gameObject.SetActive(false); countDownTextNew.text = ""; - + countDownTextNew.gameObject.SetActive(false); + bGameStart = true; // 开始关卡 EndlessLevelManager.instance.StartLevel(); - timeTextNew.gameObject.SetActive(true); - bGameStart = true; // 开始播放背景音乐. if (bgMusic != null) -- Gitblit v1.9.1