From adb0dae8a82a7eabb4e686bc0e83c8859bf6445f Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Fri, 25 Dec 2020 10:48:53 +0800 Subject: [PATCH] Merge branch 'master' of http://47.95.218.140:8090/r/GemBattle into master --- Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs | 128 ++++++++++++++++-------------------------- 1 files changed, 49 insertions(+), 79 deletions(-) diff --git a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs index 496e1e2..f068add 100644 --- a/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs +++ b/Assets/Scripts/TowerDefense/UI/EndlessUIStart.cs @@ -15,7 +15,7 @@ /// </summary> public class EndlessUIStart : Singleton<EndlessUIStart> { - public TextMeshProUGUI countDownTextNew = null; + //public TextMeshProUGUI countDownTextNew = null; public TextMeshProUGUI timeTextNew = null; @@ -62,16 +62,23 @@ protected override void Awake() { base.Awake(); + + if (Application.platform == RuntimePlatform.WindowsEditor || + Application.platform == RuntimePlatform.WindowsPlayer) + { + GameConfig.useSDK = false; + GameConfig.OpenDebug = true; + GMBtn.SetActive(true); + } + else + { + GMBtn.SetActive(false); + } //这里为了方便直接使用Endless2D GameObject root = GameObject.Find("ManagerRoot"); if (root == null) { - if (Application.platform == RuntimePlatform.WindowsEditor || - Application.platform == RuntimePlatform.WindowsPlayer) - { - GameConfig.useSDK = false; - } root = new GameObject("ManagerRoot"); @@ -158,7 +165,7 @@ transform.Find("Panel/BuffPreviewButton").gameObject.SetActive(false); transform.Find("Panel/SwitchSpeed").gameObject.SetActive(false); - GMBtn.SetActive(false); + GameConfig.EnergyCount = 0; GameConfig.SkillLevel = 1; @@ -191,13 +198,43 @@ GameConfig.CanDragTower = false; Pause(); HideUIMask(); - countDownTextNew.text = ""; - countDownTextNew.gameObject.SetActive(false); + //countDownTextNew.text = ""; + //countDownTextNew.gameObject.SetActive(false); GameObject prefab = Resources.Load<GameObject>("UI/Guide/GuidePanel"); GameObject guideObj = Instantiate(prefab, transform.Find("Panel")); guideObj.GetComponent<RectTransform>().offsetMin += tmpOffect; AddGuideEvent(); + } + else + { + //开始倒计时 + StartCoroutine(StartCountDown()); + } + } + public GameObject countDownPS; + + IEnumerator StartCountDown() + { + countDownPS.SetActive(true); + MMVibrationManager.Haptic(HapticTypes.MediumImpact); + yield return new WaitForSeconds(1.0f); + MMVibrationManager.Haptic(HapticTypes.MediumImpact); + yield return new WaitForSeconds(1.0f); + MMVibrationManager.Haptic(HapticTypes.MediumImpact); + yield return new WaitForSeconds(1.0f); + HideUIMask(); + //countDownTextNew.text = ""; + countDownPS.SetActive(false); + bGameStart = true; + // 开始关卡 + EndlessLevelManager.instance.StartLevel(); + timeTextNew.gameObject.SetActive(true); + + JsonDataReadDone(); + // 开始播放背景音乐. + if (bgMusic != null) + bgMusic.Play(); } public void GameOver() @@ -621,7 +658,7 @@ fireSkillCost = JsonDataCenter.GetSkillLevelInfo(fireSkillID, GameConfig.SkillLevel).cost; bombSkillCost = JsonDataCenter.GetSkillLevelInfo(bombSkillID, GameConfig.SkillLevel).cost; //Debug.Log($"技能最高5级,当前技能等级:{GameConfig.SkillLevel} fireSkillCost:{fireSkillCost} "); - fireSkillLevelText.text = "Lv." + GameConfig.SkillLevel; + fireSkillLevelText.text = GameConfig.SkillLevel + "级"; } } @@ -672,75 +709,7 @@ timeTextNew.text = ConvertTime((float)Math.Ceiling(startTime)); } - if (!GameConfig.IsNewbie) - { - if (!bFirstLoaded && !bGameStart) - { - bFirstLoaded = true; - secToDo = 4; - } - - if (bFirstLoaded && !bGameStart) - { - secToDo -= Time.deltaTime; - countDownTextNew.gameObject.SetActive(true); - - if (secToDo >= 3) - { - countDownTextNew.text = "3"; - if (!bVibrate[3]) - { - bVibrate[3] = true; - MMVibrationManager.Haptic(HapticTypes.SoftImpact); - } - } - else if (secToDo >= 2) - { - countDownTextNew.text = "2"; - if (!bVibrate[2]) - { - bVibrate[2] = true; - MMVibrationManager.Haptic(HapticTypes.MediumImpact); - } - } - else if (secToDo >= 1) - { - countDownTextNew.text = "1"; - if (!bVibrate[1]) - { - bVibrate[1] = true; - MMVibrationManager.Haptic(HapticTypes.HeavyImpact); - } - } - else if (secToDo < 1) - { - countDownTextNew.text = "GO!"; - if (!bVibrate[0]) - { - bVibrate[0] = true; - MMVibrationManager.Haptic(HapticTypes.HeavyImpact); - } - } - - // 开启游戏,且隐藏中间的数字. - if (secToDo <= 0) - { - HideUIMask(); - countDownTextNew.text = ""; - countDownTextNew.gameObject.SetActive(false); - bGameStart = true; - // 开始关卡 - EndlessLevelManager.instance.StartLevel(); - timeTextNew.gameObject.SetActive(true); - - JsonDataReadDone(); - // 开始播放背景音乐. - if (bgMusic != null) - bgMusic.Play(); - } - } - } - else + if (GameConfig.IsNewbie) { // 新手走的流程 if (!bFirstLoaded && !bGameStart) @@ -758,5 +727,6 @@ bgMusic.Play(); } } + } } -- Gitblit v1.9.1