少年修仙传客户端代码仓库
client_Wu Xijin
2019-06-13 033958214c0b16d7e7b93cc821b018c295251867
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, May 17, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
using UnityEngine.UI;
 
namespace Snxxz.UI
{
    public enum RidingAndPetActivation
    {
        MountActivation = 0,//坐骑激活
        MountSkillActivates = 1,//坐骑技能激活
        PetActivation = 2,//灵宠激活
        PetSkillActivates = 3,//灵宠技能激活
 
    }
 
    public class RidingAndPetActivationWin : Window
    {
        [SerializeField] Image m_NameImage;//类型名
        [SerializeField] RawImage m_RawImagePet;//灵宠模型展示
        [SerializeField] RawImage m_RawImageMount;//坐骑模型
        [SerializeField] Text m_MilitaryPowerText;//战斗力
        [SerializeField] Button m_BGMObjButton;//关闭按钮
 
        [SerializeField] GameObject m_CharacterPaletteObj;//激活面板
        [SerializeField] Transform m_SkillGroup;//技能组
        [SerializeField] Transform m_CharacterPalette;//属性组
 
        [SerializeField] GameObject m_PanelSkill;//技能解锁面板
        [SerializeField] Text m_SkillText;//技能名
        [SerializeField] PropertiesDirectory m_PropertiesDirectory;
        [SerializeField] SkillButtonPet m_SkillBtn1;//技能按钮
        [SerializeField] Text m_DescribeText;//技能描述
 
        [SerializeField] GameObject m_Text;
 
        #region Built-in
        MountModel m_MountModel;
        MountModel mountModel { get { return m_MountModel ?? (m_MountModel = ModelCenter.Instance.GetModel<MountModel>()); } }
        RidingAndPetActivationModel ridingAndPetActivationModel { get { return ModelCenter.Instance.GetModel<RidingAndPetActivationModel>(); } }
        List<HorseSkillClass> MountSkills = new List<HorseSkillClass>();
        Dictionary<int, int> FightDic = new Dictionary<int, int>();
        public static event Action FairyJadeDEvent;
        private float LatencyTime = 0;//等待时间
        protected override void BindController()
        {
        }
 
        protected override void AddListeners()
        {
            m_BGMObjButton.AddListener(OnClickCloseButton);
        }
 
        protected override void OnPreOpen()
        {
            m_Text.gameObject.SetActive(false);
            LatencyTime = 0f;
            m_BGMObjButton.interactable = false;
            RidingAndPetActivationSet(ridingAndPetActivationModel.RidingAndPetActivation1, ridingAndPetActivationModel.ActivateID1, ridingAndPetActivationModel.SkillID1, ridingAndPetActivationModel.Lv);
        }
 
        protected override void OnAfterOpen()
        {
 
 
        }
 
        protected override void OnPreClose()
        {
            switch (ridingAndPetActivationModel.RidingAndPetActivation1)
            {
                case RidingAndPetActivation.MountSkillActivates:
                case RidingAndPetActivation.PetSkillActivates:
                    WindowCenter.Instance.Open<FlySkillIconWin>();
                    break;
                default:
                    if (FairyJadeDEvent != null)
                    {
                        FairyJadeDEvent();
                    }
                    break;
            }
        }
 
        protected override void OnAfterClose()
        {
 
        }
 
        protected override void LateUpdate()
        {
            LatencyTime += Time.deltaTime;
            if (LatencyTime > 2f)
            {
                if (!m_BGMObjButton.interactable)
                {
                    m_BGMObjButton.interactable = true;
                }
                if (!m_Text.activeInHierarchy)
                {
                    m_Text.SetActive(true);
                }
            }
        }
 
        private void OnClickCloseButton()
        {
            Close();
        }
        public void RidingAndPetActivationSet(RidingAndPetActivation ridingAndPetActivation, int ActivateID, int SkillID = 0, int lv = 1)
        {
            switch (ridingAndPetActivation)
            {
                case RidingAndPetActivation.MountActivation:
                    SetMountActivation(ActivateID);
                    break;
                case RidingAndPetActivation.MountSkillActivates:
                    SetMountSkillActivates(ActivateID, SkillID, lv);
                    break;
                case RidingAndPetActivation.PetActivation:
                    SetPetActivation(ActivateID);
                    break;
                case RidingAndPetActivation.PetSkillActivates:
                    SetPetSkillActivates(ActivateID, SkillID, lv);
                    break;
                default:
                    break;
            }
        }
 
        IEnumerator FrameDelay()
        {
            yield return null;
            if (UI3DModelExhibition.Instance.NpcModelPet)
            {
                var animator = UI3DModelExhibition.Instance.NpcModelPet.GetComponent<Animator>();
                animator.Play(GAStaticDefine.State_Dance);
            }
        }
 
        private void SetMountActivation(int ActivateID)//坐骑激活
        {
            m_CharacterPaletteObj.SetActive(true);
            m_PanelSkill.SetActive(false);
            m_NameImage.SetSprite("UI_JH_11");
            m_RawImagePet.gameObject.SetActive(false);
            m_RawImageMount.gameObject.SetActive(true);
            HorseConfig Horseconfig = HorseConfig.Get(ActivateID);
            int InitFightPower = 0;
            InitFightPower += Horseconfig.InitFightPower;
            UI3DModelExhibition.Instance.ShowHourse(Horseconfig.Model, m_RawImageMount);
            MountSkills.Clear();
            foreach (var key in mountModel.GetMountSkillAndItem.Keys)
            {
                if (mountModel.GetMountSkillAndItem[key].HorseID == ActivateID)
                {
                    MountSkills.Add(mountModel.GetMountSkillAndItem[key]);
                }
            }
            for (int i = 0; i < m_SkillGroup.childCount; i++)
            {
                if (i < MountSkills.Count)
                {
                    m_SkillGroup.GetChild(i).gameObject.SetActive(true);
                    SkillButtonPet mountSkill = m_SkillGroup.GetChild(i).gameObject.GetComponent<SkillButtonPet>();
                    mountSkill.SetModel(MountSkills[i].SkillID, MountSkills[i].HorseLV, true, ActivateID, SkillType.MountSkill);
                }
                else
                {
                    m_SkillGroup.GetChild(i).gameObject.SetActive(false);
                }
            }
            HorseUpConfig tagMode = HorseUpConfig.GetHorseIDAndLV(ActivateID, 1);
            int[] strListType = tagMode.AttrType;
            int[] strListValue = tagMode.AttrValue;
            FightDic.Clear();
            for (int i = 0; i < m_CharacterPalette.childCount; i++)
            {
                if (i < strListValue.Length)
                {
                    m_CharacterPalette.GetChild(i).gameObject.SetActive(true);
                    PropertiesDirectory propertiesDirector = m_CharacterPalette.GetChild(i).GetComponent<PropertiesDirectory>();
                    switch (strListType[i])
                    {
                        case 6:
                            FightDic.Add(6, strListValue[i]);
                            propertiesDirector.AssignValueType1(Language.Get("Hit_Z"), strListValue[i].ToString());
                            break;
                        case 7:
                            FightDic.Add(7, strListValue[i]);
                            propertiesDirector.AssignValueType1(Language.Get("AttackPower_Z"), strListValue[i].ToString());
                            break;
                        case 23:
                            propertiesDirector.AssignValueType1(Language.Get("MovingSpeed_Z"), strListValue[i].ToString());
                            break;
                    }
                }
                else
                {
                    if (m_CharacterPalette.GetChild(i).gameObject.name == "SkillGroupObj")
                    {
                        continue;
                    }
                    else
                    {
                        m_CharacterPalette.GetChild(i).gameObject.SetActive(false);
                    }
 
                }
            }
            m_MilitaryPowerText.text = (UIHelper.GetFightPower(FightDic) + InitFightPower).ToString();
        }
 
        private void SetMountSkillActivates(int ActivateID, int SkillID, int lv)//坐骑技能激活
        {
            m_CharacterPaletteObj.SetActive(false);
            m_PanelSkill.SetActive(true);
            m_NameImage.SetSprite("UI_JH_6");
            m_RawImagePet.gameObject.SetActive(false);
            m_RawImageMount.gameObject.SetActive(true);
            HorseConfig Horseconfig = HorseConfig.Get(ActivateID);
            int InitFightPower = 0;
            InitFightPower += Horseconfig.InitFightPower;
            UI3DModelExhibition.Instance.ShowHourse(Horseconfig.Model, m_RawImageMount);
            MountSkills.Clear();
            foreach (var key in mountModel.GetMountSkillAndItem.Keys)
            {
                if (mountModel.GetMountSkillAndItem[key].HorseID == ActivateID)
                {
                    MountSkills.Add(mountModel.GetMountSkillAndItem[key]);
                }
            }
            m_SkillBtn1.SetModel(SkillID, lv, true, ActivateID, SkillType.MountSkill);
            m_PropertiesDirectory.AssignValueType2(Language.Get("Class_Z"), (lv - 1).ToString(), lv.ToString());
            SkillConfig skillconfig = SkillConfig.Get(SkillID);
 
            m_SkillText.text = skillconfig.SkillName;
            m_DescribeText.text = skillconfig.Description;
            int fightNumber = 0;
            Dictionary<int, float> Dic = ridingAndPetActivationModel.GetOneMountPropertyQuality(ActivateID);
            FightDic.Clear();
            FightDic.Add(6, (int)Dic[6]);
            FightDic.Add(7, (int)Dic[7]);
            for (int k = 0; k < MountSkills.Count; k++)
            {
                if (lv >= MountSkills[k].HorseLV)
                {
                    SkillConfig skillcon = SkillConfig.Get(MountSkills[k].SkillID);
                    fightNumber += skillcon.FightPower;
                }
            }
            m_MilitaryPowerText.text = (UIHelper.GetFightPower(FightDic) + fightNumber + InitFightPower).ToString();
        }
 
        private void SetPetActivation(int ActivateID)//灵宠激活
        {
            m_CharacterPaletteObj.SetActive(true);
            m_PanelSkill.SetActive(false);
            m_NameImage.SetSprite("UI_JH_11");
            m_RawImagePet.gameObject.SetActive(true);
            m_RawImageMount.gameObject.SetActive(false);
            var npcConfig = NPCConfig.Get(ActivateID);
            UI3DModelExhibition.Instance.ShowNPC(ActivateID, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_RawImagePet);
            PetInfoConfig petInfoConfig = PetInfoConfig.Get(ActivateID);
            int InitFightPower = int.Parse(petInfoConfig.InitFightPower);
            int[] strListSkills = petInfoConfig.SkillID;
            int[] strListSkillLv = petInfoConfig.SkillUnLock;
            for (int i = 0; i < m_SkillGroup.childCount; i++)
            {
                if (i < strListSkills.Length)
                {
                    m_SkillGroup.GetChild(i).gameObject.SetActive(true);
                    SkillButtonPet mountSkill = m_SkillGroup.GetChild(i).gameObject.GetComponent<SkillButtonPet>();
                    mountSkill.SetModel(strListSkills[i], strListSkillLv[i], true, ActivateID, SkillType.PetSkill);
                }
                else
                {
                    m_SkillGroup.GetChild(i).gameObject.SetActive(false);
                }
 
            }
            for (int j = 0; j < m_CharacterPalette.childCount; j++)
            {
                if (m_CharacterPalette.GetChild(j).gameObject.name == "SkillGroupObj")
                {
                    continue;
                }
                else
                {
                    m_CharacterPalette.GetChild(j).gameObject.SetActive(false);
                }
            }
            PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(ActivateID, 1);
            FightDic.Clear();
            FightDic.Add(77, _tagPetClass.AtkAdd);
            FightDic.Add(78, _tagPetClass.AtkAdd);
            m_CharacterPalette.GetChild(0).gameObject.SetActive(true);
            PropertiesDirectory propertiesDirector1 = m_CharacterPalette.GetChild(0).GetComponent<PropertiesDirectory>();
            propertiesDirector1.AssignValueType1(Language.Get("AttackPower_Z"), _tagPetClass.AtkAdd.ToString());
            m_MilitaryPowerText.text = (UIHelper.GetFightPower(FightDic) + InitFightPower).ToString();
        }
 
        private void SetPetSkillActivates(int ActivateID, int SkillID, int lv)//灵宠技能激活
        {
            m_CharacterPaletteObj.SetActive(false);
            m_PanelSkill.SetActive(true);
            m_NameImage.SetSprite("UI_JH_6");
            m_RawImagePet.gameObject.SetActive(true);
            m_RawImageMount.gameObject.SetActive(false);
 
            var npcConfig = NPCConfig.Get(ActivateID);
            UI3DModelExhibition.Instance.ShowNPC(ActivateID, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, m_RawImagePet);
            // StartCoroutine("FrameDelay");
            PetInfoConfig petInfoConfig = PetInfoConfig.Get(ActivateID);
            int InitFightPower = int.Parse(petInfoConfig.InitFightPower);
            int[] strListSkills = petInfoConfig.SkillID;
            int[] strListSkillLv = petInfoConfig.SkillUnLock;
            m_SkillBtn1.SetModel(SkillID, lv, true, ActivateID, SkillType.PetSkill);
            m_PropertiesDirectory.AssignValueType2(Language.Get("Class_Z"), (lv - 1).ToString(), lv.ToString());
            SkillConfig skillcon = SkillConfig.Get(SkillID);
            m_SkillText.text = skillcon.SkillName;
            m_DescribeText.text = skillcon.Description;
            PetClassCostConfig _tagPetClass1 = PetClassCostConfig.GetPetIdAndRank(ActivateID, lv);
            int fightNumber = 0;
            for (int j = 0; j < strListSkillLv.Length; j++)
            {
                if (lv >= strListSkillLv[j])
                {
                    SkillConfig skillconfig = SkillConfig.Get(strListSkills[j]);
                    fightNumber += skillconfig.FightPower;
                }
            }
            FightDic.Clear();
            int OnePetAddLife = (int)ridingAndPetActivationModel.GetOnePetAddLife(ActivateID);
            FightDic.Add(77, _tagPetClass1.AtkAdd);
            FightDic.Add(78, _tagPetClass1.AtkAdd);
            FightDic.Add(6, OnePetAddLife);
            m_MilitaryPowerText.text = (UIHelper.GetFightPower(FightDic) + fightNumber + InitFightPower).ToString();
        }
 
 
    }
    #endregion
 
}