少年修仙传客户端代码仓库
hch
2025-03-03 28785d6ddf9c08e49527ede9405c7b6c93c6ed32
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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, May 17, 2018
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    public enum RidingAndPetActivation
    {
        MountActivation = 0,//坐骑激活
        MountSkillActivates = 1,//坐骑技能激活
        PetActivation = 2,//灵宠激活
        PetSkillActivates = 3,//灵宠技能激活
        MountRankUp = 5,//坐骑升阶
                        //后续IL开发添加预设
        default1,
        default2,
        default3,
        default4,
        default5,
        default6,
        default7,
        default8,
        default9,
        default10,
 
    }
 
    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_SkillGroupObj;//技能组
        [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>()); } }
        PetModel petModel { get { return ModelCenter.Instance.GetModel<PetModel>(); } }
        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.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>(true);
                    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;
                case RidingAndPetActivation.MountRankUp:
                    SetMountRankUP(ActivateID);
                    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.SetActive(false);
            m_RawImageMount.SetActive(true);
            HorseConfig Horseconfig = HorseConfig.Get(ActivateID);
            UI3DModelExhibition.Instance.ShowHourse(Horseconfig.Model, m_RawImageMount);
            MountSkills.Clear();
            m_SkillGroupObj.SetActive(false);
            var tagMode = HorseSkinPlusConfig.Get(mountModel.mountSkin[ActivateID]);
            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).SetActive(true);
                    PropertiesDirectory propertiesDirector = m_CharacterPalette.GetChild(i).GetComponent<PropertiesDirectory>();
                    
                    FightDic.Add(strListType[i], strListValue[i]);
                    propertiesDirector.AssignValueType1(PlayerPropertyConfig.Get(strListType[i]).ShowName,
                        PlayerPropertyConfig.GetValueDescription(strListType[i], strListValue[i]));
                    
                }
                else
                {
                    if (m_CharacterPalette.GetChild(i).gameObject.name == "SkillGroupObj")
                    {
                        continue;
                    }
                    else
                    {
                        m_CharacterPalette.GetChild(i).SetActive(false);
                    }
 
                }
            }
 
 
            m_MilitaryPowerText.text = UIHelper.ReplaceLargeArtNum(UIHelper.GetFightPower(FightDic) + tagMode.InitFightPower);
        }
 
        private void SetMountRankUP(int ActivateID)//坐骑升阶
        {
            m_CharacterPaletteObj.SetActive(true);
            m_PanelSkill.SetActive(false);
            m_NameImage.SetSprite("ziti_10");
            m_RawImagePet.SetActive(false);
            m_RawImageMount.SetActive(true);
            HorseConfig Horseconfig = HorseConfig.Get(ActivateID);
            UI3DModelExhibition.Instance.ShowHourse(Horseconfig.Model, m_RawImageMount);
            MountSkills.Clear();
            m_SkillGroupObj.SetActive(false);
            var tagMode = HorseLVUpConfig.Get(mountModel.HorseLV);
            int[] strListType = tagMode.LVAttrType;
            int[] strListValue = tagMode.LVAttrValue;
            FightDic.Clear();
            for (int i = 0; i < m_CharacterPalette.childCount; i++)
            {
                if (i < strListValue.Length)
                {
                    m_CharacterPalette.GetChild(i).SetActive(true);
                    PropertiesDirectory propertiesDirector = m_CharacterPalette.GetChild(i).GetComponent<PropertiesDirectory>();
 
                    FightDic.Add(strListType[i], strListValue[i]);
                    propertiesDirector.AssignValueType1(PlayerPropertyConfig.Get(strListType[i]).ShowName,
                        PlayerPropertyConfig.GetValueDescription(strListType[i], strListValue[i]));
 
                }
                else
                {
                    if (m_CharacterPalette.GetChild(i).gameObject.name == "SkillGroupObj")
                    {
                        continue;
                    }
                    else
                    {
                        m_CharacterPalette.GetChild(i).SetActive(false);
                    }
 
                }
            }
 
 
            m_MilitaryPowerText.text = UIHelper.ReplaceLargeArtNum(UIHelper.GetFightPower(FightDic));
        }
 
 
 
        private void SetMountSkillActivates(int ActivateID, int SkillID, int lv)//坐骑技能激活
        {
            m_CharacterPaletteObj.SetActive(false);
            m_PanelSkill.SetActive(false);
            m_NameImage.SetSprite("UI_JH_6");
            m_RawImagePet.SetActive(false);
            m_RawImageMount.SetActive(true);
            HorseConfig Horseconfig = HorseConfig.Get(ActivateID);
            UI3DModelExhibition.Instance.ShowHourse(Horseconfig.Model, m_RawImageMount);
            m_PropertiesDirectory.AssignValueType2(Language.Get("Class_Z"), (lv - 1).ToString(), lv.ToString());
            FightDic.Clear();
            var config = HorseSkinPlusConfig.Get(mountModel.mountSkin[ActivateID]);
            int i = 0;
            foreach (var attrID in config.AttrType)
            {
                FightDic[attrID] = config.AttrValue[i];
                i++;
            }
 
            m_MilitaryPowerText.text = UIHelper.ReplaceLargeArtNum(UIHelper.GetFightPower(FightDic) + config.InitFightPower);
        }
 
        private void SetPetActivation(int ActivateID)//灵宠激活
        {
            m_CharacterPaletteObj.SetActive(true);
            m_PanelSkill.SetActive(false);
            m_NameImage.SetSprite("UI_JH_11");
            m_RawImagePet.SetActive(true);
            m_RawImageMount.SetActive(false);
            m_SkillGroupObj.SetActive(true);
            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;
            int fightNumber = 0;
            int lv = petModel._DicPetBack[petInfoConfig.ID].PetClass;
            for (int j = 0; j < strListSkillLv.Length; j++)
            {
                if (lv >= strListSkillLv[j])
                {
                    SkillConfig skillconfig = SkillConfig.Get(strListSkills[j]);
                    fightNumber += skillconfig.FightPower;
                }
            }
 
            for (int i = 0; i < m_SkillGroup.childCount; i++)
            {
                if (i < strListSkills.Length)
                {
                    m_SkillGroup.GetChild(i).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).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).SetActive(false);
                }
            }
            PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(ActivateID, lv);
            FightDic.Clear();
            FightDic.Add(77, _tagPetClass.AtkAdd);
            FightDic.Add(78, _tagPetClass.AtkAdd);
            m_CharacterPalette.GetChild(0).SetActive(true);
            PropertiesDirectory propertiesDirector1 = m_CharacterPalette.GetChild(0).GetComponent<PropertiesDirectory>();
            propertiesDirector1.AssignValueType1(Language.Get("AttackPower_Z"), _tagPetClass.AtkAdd.ToString());
            m_MilitaryPowerText.text = UIHelper.ReplaceLargeArtNum(UIHelper.GetFightPower(FightDic) + fightNumber + InitFightPower);
        }
 
        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.SetActive(true);
            m_RawImageMount.SetActive(false);
            m_SkillGroupObj.SetActive(true);
            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.ReplaceLargeArtNum(UIHelper.GetFightPower(FightDic) + fightNumber + InitFightPower);
        }
 
 
    }
    #endregion
 
}