少年修仙传客户端代码仓库
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
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Tuesday, November 14, 2017
//--------------------------------------------------------
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
 
 
using System;
using Snxxz.UI;
using System.Collections.Generic;
using EnhancedUI.EnhancedScroller;
 
namespace Snxxz.UI
{
 
    public class PetAttributeMethods : MonoBehaviour
    {
        [SerializeField] GameObject FragmentUnlockTip;//未解锁面板
        [SerializeField] Image m_BGM_Image;//背景框
        [SerializeField] Button FragmentBtn;//点击框
        [SerializeField] Image ImageIcon;//材料图标
        [SerializeField] Text AttAddTxt;//材料数量
 
        [SerializeField] GameObject FullAttTip;//满阶面板
        [SerializeField] UIEffect _uiEffect;//特效播放
        [SerializeField] GameObject m_PetAttributeWin;
        [SerializeField] RawImage _rawImage;
 
        [Header("所有宠物属性加成")]
        [SerializeField]
        Text allFightText;
        [SerializeField] Text allAttackText;
        [SerializeField] Text attackSpeed;//攻击速度
 
        [Header("进阶消耗")]
        [SerializeField]
        GameObject upgradeCostTip;
        [SerializeField] Text petlvText;
        [SerializeField] IntensifySmoothSlider _ExpSlider;//当前灵兽经验条
        [SerializeField] Text expSliderText;
        [SerializeField] int costNum = 1;
        [SerializeField] float delayTime = 0.2f;
        [Header("中间部分UI")]
        [SerializeField]
        Button petStoneBtn;
        [SerializeField] Button petAttrBtn;
        [SerializeField] Text curPetNameText;
 
 
        [Header("宠物技能部分")]
        [SerializeField]
        ScrollerController curPetSkillCtrl;
        [SerializeField] ScrollerController allPetSkillCtrl;
 
        [Header("宠物功能按钮")]
        [SerializeField]
        Button breakLockBtn;//解锁按钮
        [SerializeField] RedpointBehaviour m_RedPointreakLock;
        [SerializeField] Button petTrainBtn;//培养按钮
        [SerializeField] RedpointBehaviour m_RedPointpetTrain;
        [SerializeField] Image m_PetDanIcon1;
        [SerializeField] Text m_PetDanText;
        [SerializeField] Button petAutoTrainBtn;
        [SerializeField] Text petAutoTrainText;
 
        [Header("控制绳子")]
        [SerializeField]
        GameObject Skillimage1;
        [SerializeField]
        GameObject Skillimage2;
        [SerializeField]
        GameObject Skillimage3;
        [SerializeField]
        GameObject Skillimage4;
        [SerializeField]
        GameObject Skillimage5;
        [SerializeField] UIEffect m_UIeffect2;//经验条特效
        private int typePetID = 0;
        private float timePlay = 0;//灵宠动作播放时间
        PetModel m_petModel;
        PetModel petmodel { get { return m_petModel ?? (m_petModel = ModelCenter.Instance.GetModel<PetModel>()); } }
        PackModel _playerPack;
        PackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); } }
        RidingAndPetActivationModel ridingModel { get { return ModelCenter.Instance.GetModel<RidingAndPetActivationModel>(); } }
        PetInfoConfig petInfoConfig;
        bool isAutoTrain = false;
        List<GameObject> Skillimage = new List<GameObject>();
        private void OnEnable()
        {
            timePlay = 0;
           
            isAutoTrain = false;
            breakLockBtn.AddListener(ClickBreakBtn);
            petAutoTrainBtn.AddListener(ClickPetAutoTrainBtn);
            PetModel.Event_H0704Update += RefreshPetInfoUpdate;
            PetModel.Event_H0704Add += RefreshPetInfo;
            petStoneBtn.AddListener(() => { WindowCenter.Instance.Open<PetStoneTipsWin>(); });
            curPetSkillCtrl.OnRefreshCell += RefreshCurPetSkillCell;
            allPetSkillCtrl.OnRefreshCell += RefreshAllPetSkillCell;
            CreateAllPetSkill();
            StartCoroutine(LoadingFrame());
            petTrainBtn.AddListener(ClickPetTrainBtn);
        }
 
        IEnumerator LoadingFrame()
        {
            yield return null;
            allPetSkillCtrl.JumpIndex(0);
        }
        private void OnDisable()
        {
            typePetID = 0;
            StopCoroutine("FrameDelay");
            PetModel.Event_H0704Update -= RefreshPetInfoUpdate;
            PetModel.Event_H0704Add -= RefreshPetInfo;
            curPetSkillCtrl.OnRefreshCell -= RefreshCurPetSkillCell;
            allPetSkillCtrl.OnRefreshCell -= RefreshAllPetSkillCell;
            petStoneBtn.RemoveAllListeners();
            breakLockBtn.RemoveAllListeners();
            petTrainBtn.RemoveAllListeners();
            petAutoTrainBtn.RemoveAllListeners();
        }
 
        private void LateUpdate()
        {
            timePlay += Time.deltaTime;
            if (timePlay >= GeneralDefine.PetDanceInterval)
            {
                timePlay = 0;
                if (UI3DModelExhibition.Instance.NpcModelPet != null)
                {
                    var animator = UI3DModelExhibition.Instance.NpcModelPet.GetComponent<Animator>();
                    if (animator != null)
                    {
                        StartCoroutine("FrameDelay");
                    }
                }
 
            }
        }
        #region 修改部分
        #region 宠物技能
        int[] curPetSkillIds;
        int[] curPetUnlocks;
        private void CreateCurPetSkill()
        {
            curPetSkillIds = null;
            curPetUnlocks = null;
            if (petInfoConfig == null) return;
 
            curPetSkillIds = petInfoConfig.SkillID;
            curPetUnlocks = petInfoConfig.SkillUnLock;
            curPetSkillCtrl.Refresh();
            for (int i = 0; i < Skillimage.Count; i++)
            {
                Skillimage[i].SetActive(false);
            }
            for (int i = 0; i < curPetSkillIds.Length; i++)
            {
                if (i < Skillimage.Count)
                {
                    Skillimage[i].SetActive(true);
                }
                curPetSkillCtrl.AddCell(ScrollerDataType.Header, i);
            }
            curPetSkillCtrl.Restart();
        }
 
        private void RefreshCurPetSkillCell(ScrollerDataType type, CellView cell)
        {
            int skillIdIndex = cell.index;
            SkillButtonPet skillButton = cell.transform.GetComponent<SkillButtonPet>();
            FunctionUnlockFlyObjectTarget functionUnlockFlyObjectTarget = cell.transform.GetComponent<FunctionUnlockFlyObjectTarget>();
            UIEffect uie = cell.transform.GetComponent<UIEffect>();
            if (petmodel.ListEffectSkill.Contains(curPetSkillIds[skillIdIndex]))
            {
                uie.Play();
            }
            if (petmodel._DicPetBack.ContainsKey(petInfoConfig.ID))
            {
                PetBackpack _PetBackpack = petmodel._DicPetBack[petInfoConfig.ID];
                if (_PetBackpack.PetClass >= curPetUnlocks[skillIdIndex])
                {
                    skillButton.SetModel(curPetSkillIds[skillIdIndex], curPetUnlocks[skillIdIndex], true, petInfoConfig.ID, SkillType.PetSkill);
                }
                else
                {
                    skillButton.SetModel(curPetSkillIds[skillIdIndex], curPetUnlocks[skillIdIndex], false, petInfoConfig.ID, SkillType.PetSkill);
                }
            }
            else
            {
                skillButton.SetModel(curPetSkillIds[skillIdIndex], curPetUnlocks[skillIdIndex], false, petInfoConfig.ID, SkillType.PetSkill);
            }
            functionUnlockFlyObjectTarget.IdList = new int[] { curPetSkillIds[skillIdIndex] };
            functionUnlockFlyObjectTarget.Z_UnLockType = FunctionUnlockType.Skill;
            FunctionUnlockFlyObjectTargetCenter.Register(FunctionUnlockType.Skill, new int[] { curPetSkillIds[skillIdIndex] }, functionUnlockFlyObjectTarget);
        }
 
        List<int> displayTotalSkills = new List<int>();
        private void SetAllPetSkillModel()
        {
            displayTotalSkills.Clear();
 
            var skills = petmodel.GetPetTotalSkills();
            foreach (var id in skills)
            {
                var config = SkillConfig.Get(id);
                var skillId = 0;
                var effect = SkillConfig.GetSkillEffectValue(config);
                if (petmodel.TryGetIntegrationSkill(effect, out skillId))
                {
                    if (!displayTotalSkills.Contains(skillId))
                    {
                        displayTotalSkills.Add(skillId);
                    }
                    continue;
                }
                displayTotalSkills.Add(id);
            }
 
            displayTotalSkills.Sort(Compare);
        }
 
        private void CreateAllPetSkill()
        {
            SetAllPetSkillModel();
            if (allPetSkillCtrl.GetNumberOfCells(allPetSkillCtrl.m_Scorller) > 0)
            {
                allPetSkillCtrl.m_Scorller.RefreshActiveCellViews();
            }
            else
            {
                allPetSkillCtrl.Refresh();
                var line = Mathf.CeilToInt((float)displayTotalSkills.Count / 3);
                for (int i = 0; i < line; i++)
                {
                    allPetSkillCtrl.AddCell(ScrollerDataType.Header, i);
                }
                allPetSkillCtrl.Restart();
            }
        }
 
        private void RefreshAllPetSkillCell(ScrollerDataType type, CellView cell)
        {
            int length = cell.transform.childCount;
            for (int i = 0; i < length; i++)
            {
                int index = cell.index * 3 + i;
                SkillButtonPet skillButton = cell.transform.GetChild(i).GetComponent<SkillButtonPet>();
                if (index < displayTotalSkills.Count)
                {
                    var skillId = displayTotalSkills[index];
                    skillButton.gameObject.SetActive(true);
                    skillButton.SetModel(skillId, 0, petmodel.IsSkillUnlock(skillId), 0, SkillType.PetSkill, true);
                }
                else
                {
                    skillButton.gameObject.SetActive(false);
                }
            }
        }
 
        #endregion
        private void RefreshPetInfoUpdate(int _petID)
        {
            if (petInfoConfig == null) return;
            SoundPlayer.Instance.PlayUIAudio(19);
            m_UIeffect2.Play();
            AllPetAttrCtrl();
            curPetSkillCtrl.m_Scorller.RefreshActiveCellViews();
            CreateAllPetSkill();
            PetPanelAssignment(petInfoConfig.ID, true);
        }
        private void RefreshPetInfo()
        {
            if (petInfoConfig == null) return;
            SoundPlayer.Instance.PlayUIAudio(19);
            m_UIeffect2.Play();
            AllPetAttrCtrl();
            curPetSkillCtrl.m_Scorller.RefreshActiveCellViews();
            CreateAllPetSkill();
            PetPanelAssignment(petInfoConfig.ID, true);
        }
        public void AllPetAttrCtrl()
        {
            if (petmodel._DicPetBack.Count <= 0)
            {
                allFightText.text = "0";
                allAttackText.text = "0";
                attackSpeed.text = "0";
            }
            else
            {
                int _MaxNumber = 0;
                foreach (var key in petmodel._DicPetBack.Keys)
                {
                    PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(key, petmodel._DicPetBack[key].PetClass);
                    _MaxNumber += _tagPetClass.AtkAdd;
                }
                allAttackText.text = ((int)(_MaxNumber + ridingModel.GetAllPetAddAttack())).ToString();
                int sumFight = 0;
                int InitFightPower = 0;
                foreach (var petId in petmodel._DicPetBack.Keys)
                {
                    int _scoreNum = 0;
                    int _scoreNumAll = 0;
                    PetInfoConfig config = PetInfoConfig.Get(petId);
                    InitFightPower += int.Parse(config.InitFightPower);
                    int[] strNumberSkill = config.SkillID;
                    int[] strSkillUnLock = config.SkillUnLock;
                    PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(petId, petmodel._DicPetBack[petId].PetClass);
                    for (int i = 0; i < strSkillUnLock.Length; i++)
                    {
                        if (petmodel._DicPetBack[petId].PetClass >= strSkillUnLock[i])
                        {
                            SkillConfig skillconfig = SkillConfig.Get(strNumberSkill[i]);
                            if (skillconfig != null)
                            {
                                _scoreNum += skillconfig.FightPower;
                            }
                        }
                    }
                    Dictionary<int, int> Dic = new Dictionary<int, int>();
                    Dic.Add(78, _tagPetClass.AtkAdd);
                    Dic.Add(77, _tagPetClass.AtkAdd);
                    _scoreNumAll = UIHelper.GetFightPower(Dic) + _scoreNum;
                    sumFight += _scoreNumAll;
                }
                allFightText.text = (sumFight + InitFightPower).ToString();
                attackSpeed.text = ((float)UIHelper.GetPropertyValue(PropertyType.ATKSPEED) / 100).ToString();
            }
        }
 
        public void RefreshPetUpgradeCostUI(bool isRefresh = false)
        {
            if (petInfoConfig == null) return;
 
            upgradeCostTip.SetActive(true);
            ItemConfig itemConfig = ItemConfig.Get(petmodel.petUpgradeToolId);
            if (itemConfig != null)
            {
                m_PetDanIcon1.SetSprite(itemConfig.IconKey);
                int haveCnt = playerPack.GetItemCountByID(PackType.Item, petmodel.petUpgradeToolId);
                m_PetDanText.text = string.Format(Language.Get("Remaining_Z1"), UIHelper.ReplaceLargeNum(haveCnt));
            }
 
            StartCoroutine(PlayerTrainAni(isRefresh));
        }
 
        IEnumerator PlayerTrainAni(bool isRefresh = false)
        {
            PetBackpack _PetBackpack = petmodel._DicPetBack[petInfoConfig.ID];
            PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(petInfoConfig.ID, _PetBackpack.PetClass);
            petlvText.text = Language.Get("LoadIconLV", _PetBackpack.PetClass);
            if (!isRefresh)
            {
                _ExpSlider.delay = 0;
                _ExpSlider.ResetStage();
            }
            else
            {
                if (_PetBackpack.PetClass == 1 && _PetBackpack.petExp == 0)
                {
                    _ExpSlider.delay = 0;
                }
                else
                {
                    _ExpSlider.delay = 0.1f;
                }
            }
            _ExpSlider.stage = _PetBackpack.PetClass;
            _ExpSlider.value = (float)Math.Round((double)_PetBackpack.petExp / _tagPetClass.UpNeedExp, 2, MidpointRounding.AwayFromZero);//经验条的初始化和刷新
            expSliderText.text = StringUtility.Contact(_PetBackpack.petExp, "/", _tagPetClass.UpNeedExp);
 
            yield return null;
 
            if (isAutoTrain)
            {
                CheckPetTrainCondi();
            }
        }
 
        private void RefreshPetFuncBtn(bool isUnlock, bool isMaxRank)
        {
            if (petInfoConfig == null) return;
 
            if (isUnlock)
            {
                breakLockBtn.gameObject.SetActive(false);
                if (isMaxRank)
                {
                    petTrainBtn.gameObject.SetActive(false);
                    petAutoTrainBtn.gameObject.SetActive(false);
                }
                else
                {
                    petTrainBtn.gameObject.SetActive(true);
                    petAutoTrainBtn.gameObject.SetActive(true);
                }
            }
            else
            {
                breakLockBtn.gameObject.SetActive(true);
                petTrainBtn.gameObject.SetActive(false);
                petAutoTrainBtn.gameObject.SetActive(false);
            }
        }
 
        private void ClickBreakBtn()
        {
            if (petInfoConfig == null) return;
 
            int haveCnt = playerPack.GetItemCountByID(PackType.Item, petInfoConfig.UnLockNeedItemID);
            if (haveCnt >= petInfoConfig.UnLockNeedItemCnt)
            {
                petmodel.SendBreakPetLockQuest(petInfoConfig.ID);
            }
            else
            {
                ScrollTip.ShowTip(Language.Get("Z1812"));//未达到解锁条件
            }
        }
 
        private void ClickPetTrainBtn()
        {
            if (petInfoConfig == null) return;
 
            if (isAutoTrain)
            {
                isAutoTrain = false;
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
            }
 
            int haveCnt = playerPack.GetItemCountByID(PackType.Item, petmodel.petUpgradeToolId);
            if (haveCnt >= costNum)
            {
                if (petmodel._DicPetBack.ContainsKey(petInfoConfig.ID))
                {
                    petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, 1);
                }
            }
            else
            {
                ItemTipUtility.Show(petmodel.petUpgradeToolId);
            }
 
 
            // petTrainBtn.RemoveAllListeners();
        }
 
        private void ClickPetAutoTrainBtn()
        {
            int haveCnt = playerPack.GetItemCountByID(PackType.Item, petmodel.petUpgradeToolId);
            if (haveCnt < costNum)
            {
                ItemTipUtility.Show(petmodel.petUpgradeToolId);
                return;
            }
            isAutoTrain = !isAutoTrain;
            if (isAutoTrain)
            {
                CheckPetTrainCondi();
            }
            else
            {
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
            }
 
        }
 
        public void CheckPetTrainCondi()
        {
            int haveCnt = playerPack.GetItemCountByID(PackType.Item, petmodel.petUpgradeToolId);
            if (haveCnt >= costNum)
            {
                if (WindowCenter.Instance.IsOpen<RidingAndPetActivationWin>())
                {
                    petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                    isAutoTrain = false;
                    return;
                }
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_7");
                if (petmodel._DicPetBack.ContainsKey(petInfoConfig.ID))
                {
 
                    int exp = PetClassCostConfig.GetPetIdAndRank(petInfoConfig.ID, petmodel._DicPetBack[petInfoConfig.ID].PetClass).UpNeedExp;
                    int NeedNum = ridingModel.PetAndHorseNeedDanNum(exp);
                    if (haveCnt >= NeedNum)
                    {
                        if (petmodel.Wait)
                        {
                            petmodel.Wait = false;
                            petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, NeedNum);
                        }
                    }
                    else
                    {
                        if (petmodel.Wait)
                        {
                            petmodel.Wait = false;
                            petmodel.SendPetTrainQuest(petmodel._DicPetBack[petInfoConfig.ID].ItemPlace, haveCnt);
                        }
                    }
 
 
                }
            }
            else
            {
                petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
                isAutoTrain = false;
 
            }
        }
        #endregion
 
        IEnumerator FrameDelay()
        {
            yield return null;
            if (UI3DModelExhibition.Instance.NpcModelPet)
            {
                var animator = UI3DModelExhibition.Instance.NpcModelPet.GetComponent<Animator>();
                animator.Play(GAStaticDefine.State_Dance);
            }
        }
 
        public void ModelShow(int PetID)
        {
            SetSkillimage();
            petmodel.curPetId = PetID;
            isAutoTrain = false;
            petInfoConfig = PetInfoConfig.Get(PetID);
            LoadingShowNPC(PetID);
            petAutoTrainText.text = Language.Get("PetWin_EvolveTrainBtn_6");
            PetPanelAssignment(PetID);
            CreateCurPetSkill();
            curPetNameText.text = petInfoConfig.Name;
            AllPetAttrCtrl();
 
            if (WindowCenter.Instance.Get<PetAttributeWin>().AchievementGuideEffect2 != null)
            {
                AchievementGuideEffectPool.Recycle(WindowCenter.Instance.Get<PetAttributeWin>().AchievementGuideEffect2);
            }
        }
 
        void LoadingShowNPC(int PetID)
        {
            _rawImage.gameObject.SetActive(true);
 
            if (typePetID != PetID)
            {
                if (_uiEffect.IsPlaying)
                {
                    _uiEffect.StopImediatly();
                }
                typePetID = PetID;
                timePlay = 0;
                var npcConfig = NPCConfig.Get(PetID);
                UI3DModelExhibition.Instance.ShowNPC(PetID, npcConfig.UIModeLOffset, npcConfig.UIModelRotation, _rawImage);
                if (UI3DModelExhibition.Instance.NpcModelPet != null)
                {
                    var animator = UI3DModelExhibition.Instance.NpcModelPet.GetComponent<Animator>();
                    if (animator != null)
                    {
                        if (m_PetAttributeWin.activeSelf)
                        {
                            StartCoroutine("FrameDelay");
                        }
                        else
                        {
                            animator.Play(GAStaticDefine.State_Dance);
                        }
                    }
                }
            }
        }
 
        public void PetPanelAssignment(int PetID, bool isRefresh = false)//关于面板赋值选择
        {
            PetInfoConfig PetModel = PetInfoConfig.Get(PetID);
            petAttrBtn.RemoveAllListeners();
            if (petmodel._DicPetBack.ContainsKey(PetID))
            {
                petAttrBtn.gameObject.SetActive(true);
                FragmentUnlockTip.SetActive(false);
                petAttrBtn.AddListener(() =>
                {
                    ridingModel.property = PropertyTip.Pet;
                    ridingModel.RidingId = PetID;
                    WindowCenter.Instance.Open<TargetPetAttrWin>();
                    //  WindowCenter.Instance.Get<TargetPetAttrWin>().PropertyMountAndPet(PropertyTip.Pet, PetID);
 
                });
                if (petmodel._DicPetBack[PetID].PetClass >= PetModel.MaxRank)//满阶
                {
                    RefreshPetFuncBtn(true, true);
                    upgradeCostTip.SetActive(false);
                    FullOrderPanel(PetID);
                }
                else
                {
                    FullAttTip.SetActive(false);
                    RefreshPetUpgradeCostUI(isRefresh);
                    RefreshPetFuncBtn(true, false);
                    m_RedPointpetTrain.redpointId = petmodel.CultivateRedPoint[PetID].id;
                }
            }
            else//未解锁
            {
                RefreshPetFuncBtn(false, false);
                upgradeCostTip.SetActive(false);
                NotUnlock(PetID);
                petAttrBtn.gameObject.SetActive(false);
                m_RedPointreakLock.redpointId = petmodel.DeblockingRedPoint[PetID].id;
            }
        }
 
        void NotUnlock(int PetID)
        {
            FragmentUnlockTip.SetActive(true);
            FullAttTip.SetActive(false);
            PetInfoConfig PetModel = PetInfoConfig.Get(PetID);
            ItemConfig _item = ItemConfig.Get(PetModel.UnLockNeedItemID);
            ImageIcon.SetSprite(_item.IconKey);
            m_BGM_Image.SetItemBackGround(_item.ItemColor);
            if (playerPack.GetItemCountByID(PackType.Item, PetModel.UnLockNeedItemID) < PetModel.UnLockNeedItemCnt)
                AttAddTxt.text = "<color=#ff4500>" + playerPack.GetItemCountByID(PackType.Item, PetModel.UnLockNeedItemID) + "</color>/" + PetModel.UnLockNeedItemCnt;
            else
                AttAddTxt.text = playerPack.GetItemCountByID(PackType.Item, PetModel.UnLockNeedItemID) + "/" + PetModel.UnLockNeedItemCnt;
            FragmentBtn.RemoveAllListeners();
            FragmentBtn.AddListener(() =>
            {
                ItemTipUtility.Show(_item.ID);
            });
        }
 
        void FullOrderPanel(int PetID)
        {
            PetInfoConfig PetModel = PetInfoConfig.Get(PetID);
            PetClassCostConfig _tagPetClass = PetClassCostConfig.GetPetIdAndRank(PetID, PetModel.MaxRank);
            FragmentUnlockTip.SetActive(false);
            FullAttTip.SetActive(true);
        }
        private void SetSkillimage()
        {
            if (Skillimage.Count <= 0)
            {
                Skillimage.Add(Skillimage1);
                Skillimage.Add(Skillimage2);
                Skillimage.Add(Skillimage3);
                Skillimage.Add(Skillimage4);
                Skillimage.Add(Skillimage5);
            }        
        }
 
        int Compare(int lhs, int rhs)
        {
            var lhs_unlock = petmodel.IsSkillUnlock(lhs);
            var rhs_unlock = petmodel.IsSkillUnlock(rhs);
            if (lhs_unlock != rhs_unlock)
            {
                return -lhs_unlock.CompareTo(rhs_unlock);
            }
            var lhs_config = SkillConfig.Get(lhs);
            var rhs_config = SkillConfig.Get(rhs);
            var lhs_Id = 0;
            var rhs_Id = 0;
            var lhs_effect = SkillConfig.GetSkillEffectValue(lhs_config);
            var rhs_effect = SkillConfig.GetSkillEffectValue(rhs_config);
            var lhs_integration = petmodel.TryGetIntegrationSkill(lhs_effect, out lhs_Id);
            var rhs_integration = petmodel.TryGetIntegrationSkill(rhs_effect, out rhs_Id);
            if (lhs_integration != rhs_integration)
            {
                return -lhs_integration.CompareTo(rhs_integration);
            }
            if (lhs_integration && rhs_integration)
            {
                return lhs_config.Effect1.CompareTo(rhs_config.Effect1);
            }
            var lhs_petId = 0;
            var rhs_petId = 0;
            petmodel.TryGetPetId(lhs, out lhs_petId);
            petmodel.TryGetPetId(rhs, out rhs_petId);
            var lhs_petconfig = PetInfoConfig.Get(lhs_petId);
            var rhs_petconfig = PetInfoConfig.Get(rhs_petId);
            return lhs_petconfig.Sort.CompareTo(rhs_petconfig.Sort);
        }
    }
}