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/Guide/TestButton.cs | 127 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 124 insertions(+), 3 deletions(-) diff --git a/Assets/Scripts/Guide/TestButton.cs b/Assets/Scripts/Guide/TestButton.cs index 2841fdb..977399d 100644 --- a/Assets/Scripts/Guide/TestButton.cs +++ b/Assets/Scripts/Guide/TestButton.cs @@ -1,17 +1,138 @@ using System.Collections; -using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; - +using KTGMGemClient; public class TestButton : MonoBehaviour { + //public Text t; // Start is called before the first frame update void Start() { + transform.Find("TowerBuyBtn").GetComponent<Button>().onClick.AddListener(OnClickTowerBuyBtn); + + transform.Find("GuidePanel/Image_TowerPos2").GetComponent<Button>().onClick.AddListener(GetOneTowerPos); + + int guide = PlayerPrefs.GetInt("GemBattleGuide"); + + // string s="<color=red>范围伤害</color>"; + // t.text=s; + // Debug.Log(s.Length); } - private void OnClickTowerBuyBtn(){ + private void OnEnable() + { + EventCenter.Ins.Add((int)KTGMGemClient.EventType.AddCard, AddCard); + EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFireLv2, CreateFireLv2); + EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateFirstWave, CreateFirstWave); + EventCenter.Ins.Add((int)KTGMGemClient.EventType.RestartWave, RestartWave); + EventCenter.Ins.Add<int>((int)KTGMGemClient.EventType.AddGold, AddGold); + EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateWaterLv1, CreateWaterLv1); + EventCenter.Ins.Add((int)KTGMGemClient.EventType.CreateSecondWave, CreateSecondWave); + EventCenter.Ins.Add((int)KTGMGemClient.EventType.SkillRelease, SkillRelease); + + + } + + //购买宝石 + private void OnClickTowerBuyBtn() + { Debug.Log("点击了TowerBuyBtn"); } + + private void AddCard() + { + Debug.Log("这里需要生成一个二级宝石"); + } + + + private void CreateFireLv2() + { + Debug.Log("生成一个2级的火焰塔"); + + } + + private void CreateFirstWave() + { + Debug.Log("第一关小怪出木元素小怪"); + StartCoroutine(CreateWave()); + } + + IEnumerator CreateWave() + { + yield return new WaitForSeconds(1f); + Debug.Log("出怪完毕,等待火元素完成第一次充能"); + yield return new WaitForSeconds(1f); + Debug.Log("火元素充能效果结束,暂停出怪"); + EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.ChargingEnd); + + } + + + private void RestartWave() + { + Debug.Log("恢复出怪"); + StartCoroutine(RestartWaveCoroutine()); + } + + IEnumerator RestartWaveCoroutine() + { + yield return new WaitForSeconds(1f); + Debug.Log("出怪完毕"); + yield return new WaitForSeconds(1f); + Debug.Log("怪物被杀光,这里需要停止出下一波怪物"); + EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.KillDone); + + } + + private void AddGold(int gold) + { + Debug.Log("增加金钱:" + gold); + + } + + private void GetOneTowerPos() + { + Debug.Log("解锁了第一排第二个塔位"); + EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.GetOneTowerPos); + + } + + private void CreateWaterLv1() + { + Debug.Log("生成一个1级的水元素塔"); + } + + private void CreateSecondWave() + { + Debug.Log("第二关小怪出火属性小怪"); + StartCoroutine(CreateSecondWaveCoroutine()); + + } + IEnumerator CreateSecondWaveCoroutine() + { + yield return new WaitForSeconds(1f); + Debug.Log("当第二关第8波怪物生成后或玩家塔位收到第一次伤害后,这里需要暂停时间"); + + EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.SkillStep); + + } + + private void SkillRelease() + { + Debug.Log("释放技能"); + + StartCoroutine(SkillReleaseDone()); + + } + + IEnumerator SkillReleaseDone() + { + yield return new WaitForSeconds(1f); + Debug.Log("技能效果播放完毕秒杀小怪后,暂停事件"); + + EventCenter.Ins.BroadCast((int)KTGMGemClient.EventType.SkillReleaseDone); + + } + } -- Gitblit v1.9.1