wangguan
2020-11-14 c51363d4055176c0a715a6dc36bd9c4969cc3482
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
using System.Collections;
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 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);
        EventCenter.Ins.Add((int)KTGMGemClient.EventType.GuideFinish, GuideFinish);
 
    }
 
    //购买宝石
    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);
 
    }
 
    private void GuideFinish(){
 
        Debug.Log("新手引导流程结束");
    }
 
}