少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
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
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
using System;
using System.Linq;
using vnxbqy.UI;
 
public class WingsRefined : MonoBehaviour
{
    //羽翼精炼
    public int LINE = 6;//需要生成的行数
    [SerializeField] ScrollerController m_ScrollerController;
    [SerializeField] Image WingsBG;//背景框
    [SerializeField] Button WingsImage;//(没有翅膀按钮点击)
    [SerializeField] Button IconButton;//有翅膀按钮和图
    [SerializeField] Text WText;//翅膀资质
    [SerializeField] GameObject EquipFirstTxt;//没有翅膀提示框
    [SerializeField] Text PlusNum;//预览比值1
    [SerializeField] Text PlusNum1;//预览比值2
    [SerializeField] Text PlusNum2;//预览比值3
    [SerializeField] GameObject FullTxt;//满级显示提示本文
    [SerializeField] Button _refiningBtn;//精炼按钮
    [SerializeField] Button _KeyRefiningBtn;//一键精炼按钮;
    [SerializeField] Button _RefineStopBtn;//停止精炼按钮
    [SerializeField] GameObject _ManagementFrame;//羽翼精炼面板框
    [SerializeField] RawImage _wingRawImage;//翅膀模型创建
    [SerializeField] RawImage _wingRawImage2;//翅膀模型创建2
    [SerializeField] Text _AttrNameTextNum1;//增加的伤害值
    [SerializeField] Text _AttrNameTextNum2;//增加的生命值
    [SerializeField] Slider _Pmgressbar;//精炼值
    [SerializeField] Text _PmgressText;//精炼数值
    [SerializeField] UIEffect m_UIEffect1;//翅膀特效1
    [SerializeField] UIEffect m_UIEffect2;//翅膀特效2
    private Dictionary<int, int> _wingItemDic = new Dictionary<int, int>();//获取翅膀字典
    private Dictionary<int, bool> _DevourDIc = new Dictionary<int, bool>();//需要吞噬的物品
    private Dictionary<int, ItemModel> WingDic = new Dictionary<int, ItemModel>();//获取翅膀属性
    private List<int> intPetAbsorbTyp = new List<int>();
    Dictionary<int, WingRefineAttrModel> _DicWingRe = new Dictionary<int, WingRefineAttrModel>();//获取属性上限值
 
    PackModel _playerPack;
    PackModel playerPack { get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PackModel>()); } }
 
    WingsRedDotModel M_WingsRedDotModel;
    WingsRedDotModel wingsRedDotModel { get { return M_WingsRedDotModel ?? (M_WingsRedDotModel = ModelCenter.Instance.GetModel<WingsRedDotModel>()); } }
 
    private bool IsOpen = false;
    class WingRefineAttrModel
    {
        public int Ability1;//属性值1
        public int Ability1Value;//数值1
        public int Ability2;//属性值2
        public int Ability2Value;//数值2
    }
 
    public class EquippedClass
    {
        public int ItemId;//物品ID
        public string Index;//索引下标
        public int BackpackIndex;//所对应背包的索引
    }
 
 
 
    private int _currentRefining = 0;//当前精炼度
    private int _currentRefiningAll = 1;//总精炼度
    private float _RefiningRatio;//精炼比值
 
    private int Lifevalue = 0;//生命值
    private float Damagevalue = 0;//伤害值
    private bool AutomaticBool = false;//自动精炼
    private bool CoroutinesBool = true;//协程控制
 
    public Dictionary<int, int> wingLv2GenerDict = new Dictionary<int, int>();
    List<WingRefineAttrConfig> wingRefineAttrConfigs = new List<WingRefineAttrConfig>();
    private void Awake()
    {
        var _funcCfg = FuncConfigConfig.Get("WingLV");
        LitJson.JsonData _json = LitJson.JsonMapper.ToObject(_funcCfg.Numerical1);
        foreach (var _wingLv in _json.Keys)
        {
            wingLv2GenerDict.Add(int.Parse(_wingLv), int.Parse(_json[_wingLv].ToString()));
        }
        WingRefine();
    }
 
    void OnEnable()
    {
        wingsRedDotModel.IsBoolOpenWingeWin = true;
        AutomaticBool = false;
        CoroutinesBool = true;
        IsOpen = false;
        _wingRawImage.SetActive(false);
        _wingRawImage2.SetActive(false);
        _DevourDIc.Clear();
        m_ScrollerController.OnRefreshCell += OnRefreshGridCell;
 
        playerPack.refrechPackEvent += ItemsToRefresh;//背包物品刷新
        playerPack.itemCntReduceEvent += BackpackRefresh;//背包物品清理
        playerPack.itemCntAddEvent += EquippedWithRefresh;//角色装备刷新
 
        EquipmentPositionJudgment();//判断是否有穿戴翅膀
        WingClassify();
        SortAll();
        _RefineStopBtn.SetActive(false);
        _KeyRefiningBtn.SetActive(true);
        _refiningBtn.SetActive(true);
        OnCreateGridLineCell(m_ScrollerController);
        PreviewTheValue();
    }
 
 
    void Start()
    {
        WingsImage.onClick.AddListener(WingsBGButton);
        _refiningBtn.onClick.AddListener(RefiningButton);
        _KeyRefiningBtn.onClick.AddListener(KeyRefiningButton);
        _RefineStopBtn.onClick.AddListener(RefineStopButton);
    }
 
    void OnDisable()
    {
        wingsRedDotModel.IsBoolOpenWingeWin = false;
        IsOpen = false;
        _DevourDIc.Clear();
        //  _wingItemDic.Clear();
        PlusNum.SetActive(false);
        PlusNum1.SetActive(false);
        PlusNum2.SetActive(false);
        StopCoroutine("AkeyRefining");
        UI3DModelExhibition.Instance.StopShow();
        // RoleCameraCtrl.GetInstance().OnDestroyModel();
        playerPack.refrechPackEvent -= ItemsToRefresh;//背包物品刷新
        playerPack.itemCntReduceEvent -= BackpackRefresh;//背包物品清理
        playerPack.itemCntAddEvent -= EquippedWithRefresh;//角色装备刷新
        m_ScrollerController.OnRefreshCell -= OnRefreshGridCell;
    }
    private void OnCreateGridLineCell(ScrollerController gridCtrl)
    {
        gridCtrl.Refresh();
        int code = 0;
        for (code = 0; code < LINE; code++)
        {
            gridCtrl.AddCell(ScrollerDataType.Header, code);
        }
        gridCtrl.Restart();
    }
 
    private void OnRefreshGridCell(ScrollerDataType type, CellView cell)
    {
        int gridlineIndex = cell.index;
        int childCode = 0;
        for (childCode = 0; childCode < cell.transform.childCount; childCode++)
        {
            ChildNodes _ChildNodes = cell.transform.GetChild(childCode).GetComponent<ChildNodes>();
            _ChildNodes._ItemIcon.SetActive(false);
            _ChildNodes._Elect.SetActive(false);
            int cellCount = (cell.transform.childCount) * gridlineIndex + (childCode + 1);
            if (cellCount - 1 < intPetAbsorbTyp.Count)
            {
                int _index = cellCount - 1;
                _ChildNodes._ItemIcon.SetActive(true);
                ItemModel model = playerPack.GetItemByIndex(PackType.Item, intPetAbsorbTyp[cellCount - 1]);
                _ChildNodes._ItemIcon.GetComponent<ItemCell>().Init(model);
                _ChildNodes._ItemButton.onceClick = null;
                if (_DevourDIc.ContainsKey(intPetAbsorbTyp[cellCount - 1]))
                {
                    _ChildNodes._Elect.SetActive(true);
 
                }
 
                _ChildNodes._ItemButton.onceClick = (int info) =>
                {
                    if (_ChildNodes._Elect.activeSelf)
                    {
                        _ChildNodes._Elect.SetActive(false);
                        _DevourDIc.Remove(intPetAbsorbTyp[_index]);
                    }
                    else
                    {
                        if (IsAbsorb())
                        {
                            _ChildNodes._Elect.SetActive(true);
                            _DevourDIc.Add(intPetAbsorbTyp[_index], true);
                        }
                        else
                        {
 
                            SysNotifyMgr.Instance.ShowTip("WingRefineisFull");
                        }
                    }
                    m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
                    PreviewTheValue();
                };
            }
        }
    }
 
    bool IsAbsorb()//判断能否吸收
    {
        int expValue = 0;
        expValue += (int)_currentRefining;
        if (_DevourDIc.Count != 0)
        {
            foreach (var key in _DevourDIc.Keys)
            {
                expValue += Sort2(key);
                //ItemModel model = playerPack.GetItemModelByIndex(PackType.rptItem, key);
                //expValue += WingRefineExpConfig.Get(model.itemId).EXPupper;
            }
        }
        return _currentRefiningAll > expValue;
    }
 
    void RefineStopButton()//停止精炼
    {
        _RefineStopBtn.SetActive(false);
        _KeyRefiningBtn.SetActive(true);
        _refiningBtn.SetActive(true);
        StopCoroutine("AkeyRefining");
    }
 
    void RefiningButton()//精炼按钮
    {
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
 
        if (itemModel == null)
        {
            ServerTipDetails.DisplayNormalTip(Language.Get("EquipReinforceWin_WingRefLv_2"));
            return;
        }
 
        if (_DevourDIc.Count == 0)
        {
            if (!JudgeConditions())
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("Z1018"));//翅膀精炼已到达满级无法继续精炼
            }
            else
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("EquipReinforceWin_WingHText_1"));//所需材料不足
            }
 
            return;
        }
        if (JudgeConditions())
        {
            CA32E_tagCMWingUp _CA32E = new CA32E_tagCMWingUp();
            byte[] _byte = new byte[1];
            _byte[0] = (byte)_DevourDIc.Keys.First();
            _CA32E.Count = (byte)_byte.Length;
            _CA32E.WingIndexList = _byte;
            GameNetSystem.Instance.SendInfo(_CA32E);
        }
        else
        {
            ServerTipDetails.DisplayNormalTip(Language.Get("Z1018"));//翅膀精炼已到达满级无法继续精炼
        }
    }
 
 
    void PreviewTheValue()//预览值
    {
        if (_DevourDIc.Count == 0)
        {
            PlusNum.SetActive(false);
            PlusNum1.SetActive(false);
            PlusNum2.SetActive(false);
        }
        else
        {
            PlusNum.SetActive(true);
            PlusNum1.SetActive(true);
            PlusNum2.SetActive(true);
        }
 
 
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        if (itemModel == null)
        {
            return;
        }
        var WingItem = WingRefineExpConfig.Get(itemModel.itemId);
        if (WingItem == null)
        {
            return;
        }
        int YRefiningRatioMin = 0;//预览生命比值
        int YRefiningRatioMax = 0;//预览生命比值
        float _RefiningDegreesMin = 0;
        float _RefiningDegreesMaX = 0;
        int Min = 0;
        int Max = 0;
 
        foreach (var key in _DevourDIc.Keys)
        {
            var wingConfig = WingRefineExpConfig.Get(_wingItemDic[key]);
            if (WingDic[key].GetUseData((int)ItemUseDataKey.wingProgressValue) != null || WingDic[key].GetUseData((int)ItemUseDataKey.wingMaterialItemID) != null)
            {
 
                Min += wingConfig.EXPlower + GetWingRefiningValue(WingDic[key]); ;
                Max += wingConfig.EXPupper + GetWingRefiningValue(WingDic[key]); ;
            }
            else
            {
                ItemModel model = playerPack.GetItemByIndex(PackType.Item, key);
 
                for (int i = 0; i < model.count; i++)
                {
                    if (wingConfig.EXPmaterial != null && !wingConfig.EXPmaterial.Equals(string.Empty))
                    {
                        Dictionary<int, int> dicExp = ConfigParse.GetDic<int, int>(wingConfig.EXPmaterial);
                        Min += dicExp[itemModel.config.LV];
                        Max += dicExp[itemModel.config.LV];
                    }
                    else
                    {
                        Min += wingConfig.EXPlower;
                        Max += wingConfig.EXPupper;
                    }
                }
            }
        }
 
        int PreviewMin = _currentRefining + Min;//最大下限
        int PreviewMax = _currentRefining + Max;//最大上限值
        if (PreviewMin >= _currentRefiningAll)
        {
            PreviewMin = _currentRefiningAll;
        }
        if (PreviewMax >= _currentRefiningAll)
        {
            PreviewMax = _currentRefiningAll;
        }
        var config = WingRefineExpConfig.Get((int)itemModel.itemId);
        _RefiningDegreesMin = (float)Math.Round((itemModel.config.EffectValueA2 +
            _DicWingRe[config.WingsPhase].Ability2Value *
            ((float)PreviewMin / _currentRefiningAll)) / 100, 2);
 
        _RefiningDegreesMaX = (float)Math.Round((itemModel.config.EffectValueA2 +
                 _DicWingRe[config.WingsPhase].Ability2Value *
                 ((float)PreviewMax / _currentRefiningAll)) / 100, 2);
 
        YRefiningRatioMin = (Mathf.CeilToInt(_DicWingRe[config.WingsPhase]
            .Ability1Value * ((float)PreviewMin / _currentRefiningAll) + itemModel.config.EffectValueA1));
        YRefiningRatioMax = (Mathf.CeilToInt(_DicWingRe[config.WingsPhase]
            .Ability1Value * ((float)PreviewMax / _currentRefiningAll) + itemModel.config.EffectValueA1));
 
        PlusNum1.text = "+" + ((float)Math.Round(_RefiningDegreesMin - Damagevalue, 1)).ToString("f2") + "% ~ " + ((float)Math.Round(_RefiningDegreesMaX - Damagevalue, 1)).ToString("f2") + "%";
        PlusNum2.text = "+" + (YRefiningRatioMin - Lifevalue) + " ~ " + (YRefiningRatioMax - Lifevalue);
        PlusNum.text = "+" + Min.ToString() + " ~ " + Max.ToString();
    }
 
    bool JudgeConditions()//执行判断条件
    {
 
        if (_currentRefiningAll > _currentRefining)
        {
            return true;
        }
        else
        {
            return false;
        }
 
    }
    Dictionary<int, int> dicWingUseDateValue = new Dictionary<int, int>();
    private int GetWingRefiningValue(ItemModel ItemModel)
    {
        dicWingUseDateValue.Clear();
        int GetUseDateValue = 0;
        if (ItemModel.GetUseData((int)ItemUseDataKey.wingMaterialItemID) != null
            || ItemModel.GetUseData((int)ItemUseDataKey.wingMaterialItemCount) != null)
        {
            for (int i = 0; i < ItemModel.GetUseData((int)ItemUseDataKey.wingMaterialItemID).Count; i++)
            {
                dicWingUseDateValue.Add(ItemModel.GetUseData((int)ItemUseDataKey.wingMaterialItemID)[i], ItemModel.GetUseData((int)ItemUseDataKey.wingMaterialItemCount)[i]);
            }
        }
        if (ItemModel.GetUseData((int)ItemUseDataKey.wingProgressValue) != null)
        {
            GetUseDateValue += ItemModel.GetUseData((int)ItemUseDataKey.wingProgressValue)[0];
        }
        int WingLv1 = ItemModel.config.LV;
        foreach (var key in dicWingUseDateValue.Keys)
        {
            var wingConfig = WingRefineExpConfig.Get(key);
            if (wingConfig.EXPmaterial != null && !wingConfig.EXPmaterial.Equals(string.Empty))
            {
                Dictionary<int, int> dicExp = ConfigParse.GetDic<int, int>(wingConfig.EXPmaterial);
                GetUseDateValue -= dicExp[WingLv1] * dicWingUseDateValue[key];
            }
 
        }
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        int WingLv2 = itemModel.config.LV;
        foreach (var key in dicWingUseDateValue.Keys)
        {
            var wingConfig = WingRefineExpConfig.Get(key);
            if (wingConfig.EXPmaterial != null && !wingConfig.EXPmaterial.Equals(string.Empty))
            {
                Dictionary<int, int> dicExp = ConfigParse.GetDic<int, int>(wingConfig.EXPmaterial);
                GetUseDateValue += dicExp[WingLv2] * dicWingUseDateValue[key];
            }
        }
        return GetUseDateValue;
    }
 
    void KeyRefiningButton()//一键精炼
    {
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        if (itemModel == null)
        {
            ServerTipDetails.DisplayNormalTip(Language.Get("EquipReinforceWin_WingRefLv_2"));
            return;
        }
 
        if (_DevourDIc.Count > 0 && JudgeConditions())
        {
            AutomaticBool = true;
            StartCoroutine("AkeyRefining");
        }
        else
        {
            if (!JudgeConditions())
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("Z1018"));//翅膀精炼已到达满级无法继续精炼
            }
            else if (_DevourDIc.Count <= 0)
            {
                ServerTipDetails.DisplayNormalTip(Language.Get("EquipReinforceWin_WingHText_1"));//所需材料不足
            }
 
        }
 
    }
    IEnumerator AkeyRefining()//一键精炼协成
    {
        while (true)
        {
            if (JudgeConditions() && _DevourDIc.Count > 0)
            {
                if (CoroutinesBool)
                {
                    _RefineStopBtn.SetActive(true);
                    _KeyRefiningBtn.SetActive(false);
                    _refiningBtn.SetActive(false);
                    CA32E_tagCMWingUp _CA32E = new CA32E_tagCMWingUp();
                    byte[] _byte = new byte[1];
                    _byte[0] = (byte)_DevourDIc.Keys.First();
                    _CA32E.Count = (byte)_byte.Length;
                    _CA32E.WingIndexList = _byte;
                    GameNetSystem.Instance.SendInfo(_CA32E);
                    CoroutinesBool = false;
                    yield return null;
                }
            }
            if (!JudgeConditions())
            {
                RefineStopButton();//停止精炼按钮
                ServerTipDetails.DisplayNormalTip(Language.Get("Z1018"));//翅膀精炼已到达满级无法继续精炼
                yield break;
            }
            if (_DevourDIc.Count <= 0)
            {
                RefineStopButton();//停止精炼按钮
                yield break;
            }
            yield return null;
        }
    }
    void WingsBGButton()//点击翅膀背景框按钮
    {
 
        bool markingbbol = false;
        SinglePack singlePack = playerPack.GetSinglePack(PackType.Item);
        if (singlePack == null || singlePack.GetAllItems().Count == 0)
        {
            ServerTipDetails.DisplayNormalTip(Language.Get("WingsRefine_NoWing"));
            return;
        }
        Dictionary<int, ItemModel> backpack_dic = singlePack.GetAllItems();
        foreach (int index in backpack_dic.Keys)
        {
            int _id = (int)backpack_dic[index].itemId;
            if (!ItemLogicUtility.Instance.IsWing(_id))
            {
                continue;
            }
 
            var wingConfig = ItemConfig.Get(_id);
            if (wingConfig.Type == 113 && ItemLogicUtility.Instance.IsJobCompatibleItem(_id))
            {
                markingbbol = true;
            }
        }
        if (markingbbol)
        {
            WindowCenter.Instance.Open<WingsBouncedWin>();
        }
        else
        {
            ServerTipDetails.DisplayNormalTip(Language.Get("WingsRefine_NoWing"));
        }
 
    }
 
    void Backpacking()//物品读取
    {
        _wingItemDic.Clear();
        intPetAbsorbTyp.Clear();
        WingDic.Clear();
        //背包字典
 
        SinglePack rptItemPack = playerPack.GetSinglePack(PackType.Item);
        ItemModel putOnModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        if (rptItemPack == null || rptItemPack.GetAllItems().Count == 0 || putOnModel == null)
        {
            return;
        }
        int itemID = putOnModel.itemId;//物品ID
        var WingItem = WingRefineExpConfig.Get(itemID);
        if (WingItem == null)
        {
            return;
        }
 
        var items = rptItemPack.GetAllItems();
        foreach (var itemIndex in items.Keys)
        {
            var item = items[itemIndex];
            if (WingRefineExpConfig.Has(item.itemId))
            {
                if (ItemLogicUtility.Instance.IsWing(item.itemId))
                {
                    _wingItemDic.Add(itemIndex, item.itemId);
                    WingDic.Add(itemIndex, item);
                }
            }
        }
 
        if (_wingItemDic.Count != 0)
        {
            foreach (var key in _wingItemDic.Keys)
            {
                intPetAbsorbTyp.Add(key);
            }
        }
    }
 
    void EquipmentPositionJudgment()//判断是否有穿戴翅膀
    {
        Backpacking();//物品读取
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        int itemID = 0;
        if (itemModel != null)
        {
            itemID = itemModel.itemId;//物品ID
        }
        var WingItem = WingRefineExpConfig.Get(itemID);
        if (itemModel != null && WingItem != null)
        {
            WingsImage.SetActive(false);
            IconButton.SetActive(true);
            WingsBG.SetItemBackGround(ItemLogicUtility.Instance.GetItemQuality(itemModel.itemId, itemModel.useDataDict));
            IconButton.GetComponent<Image>().SetSprite(itemModel.config.IconKey);
            IconButton.RemoveAllListeners();
            IconButton.AddListener(() =>
            {
                ItemTipUtility.Show(itemModel.guid);
            });
            ModelCreationDisplay();//模型展示创建
            RefiningDegrees();//精炼度(刷新)
        }
        else
        {
            EquipFirstTxt.SetActive(true);
            _wingRawImage.SetActive(false);
            _wingRawImage2.SetActive(false);
            WingsImage.SetActive(true);
            IconButton.SetActive(false);
            WingsBG.SetItemBackGround(1);//翅膀框默认颜色值
            DegreeOfRefining();//精炼度初始没翅膀时
        }
    }
 
    void ModelCreationDisplay()//模型展示创建
    {
        if (_wingRawImage.gameObject.activeSelf || _wingRawImage2.gameObject.activeSelf)
        {
            return;
        }
        EquipFirstTxt.SetActive(false);
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        var config = WingRefineExpConfig.Get((int)itemModel.itemId);
        int _modelID = config.Model;
        if (itemModel.itemId == 3724)
        {
            _wingRawImage2.SetActive(true);
            _wingRawImage.SetActive(false);
            UI3DModelExhibition.Instance.ShowWing(_modelID, _wingRawImage2);
        }
        else
        {
            _wingRawImage.SetActive(true);
            _wingRawImage2.SetActive(false);
            UI3DModelExhibition.Instance.ShowWing(_modelID, _wingRawImage);
        }
 
    }
 
    void DegreeOfRefining()//精炼度初始没翅膀时
    {
        WText.SetActive(true);
        _AttrNameTextNum1.text = "0.00%";
        Damagevalue = 0;
        Lifevalue = 0;
        _AttrNameTextNum2.text = "0";
        _Pmgressbar.value = 0f;
        _PmgressText.text = "0/0";
        WText.text = Language.Get("EquipReinforceWin_WingRefLv_2");
    }
 
    void RefiningDegrees()//精炼度(刷新)
    {
        WText.SetActive(true);
 
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
 
        if (itemModel.GetUseData((int)ItemUseDataKey.wingProgressValue) != null)
        {
            _currentRefining = itemModel.GetUseData((int)ItemUseDataKey.wingProgressValue)[0];//当前精炼度
        }
        else
        {
            _currentRefining = 0;//当前精炼度
        }
        if (wingRefineAttrConfigs.Count <= 0)
        {
            wingRefineAttrConfigs = WingRefineAttrConfig.GetValues();
        }
        //  var wingRefineAttrConfigs = WingRefineAttrConfig.GetValues();
        foreach (var config in wingRefineAttrConfigs)
        {
            if (itemModel.config.LV == config.wingsPhase)
            {
                _currentRefiningAll = config.EXPupper;//总精炼度
                _PmgressText.text = _currentRefining.ToString() + "/" + _currentRefiningAll.ToString();
                if (_currentRefining >= _currentRefiningAll)
                {
                    _currentRefining = _currentRefiningAll;
                    FullTxt.SetActive(true);
                }
                else
                {
                    FullTxt.SetActive(false);
                }
                if (IsOpen)
                {
                    EffectMgr.Instance.PlayUIEffect(1070, 2500, m_UIEffect1.transform, false);
                }
 
                if (_currentRefining >= _currentRefiningAll && IsOpen)
                {
                    m_UIEffect2.Play();
                }
                if (!IsOpen)
                {
                    IsOpen = true;
                }
                _Pmgressbar.value = (float)_currentRefining / _currentRefiningAll;
                _RefiningRatio = (float)_currentRefining / _currentRefiningAll;//精炼比值
                int Number = Mathf.CeilToInt(((float)_currentRefining / _currentRefiningAll) * 100);
                WText.text = string.Format(Language.Get("EquipReinforceWin_WingRefLv_1"), Number) + "%";
                float _RefiningDegrees = (float)Math.Round((double)(itemModel.config.EffectValueA2 + _DicWingRe[itemModel.config.LV].Ability2Value * _RefiningRatio) / 100, 1);
                _AttrNameTextNum1.text = _RefiningDegrees.ToString("f2") + "%";
                Damagevalue = _RefiningDegrees;
                _AttrNameTextNum2.text = (Mathf.CeilToInt(_DicWingRe[itemModel.config.LV].Ability1Value * _RefiningRatio + itemModel.config.EffectValueA1)).ToString();
                Lifevalue = Mathf.CeilToInt(_DicWingRe[itemModel.config.LV].Ability1Value * _RefiningRatio + itemModel.config.EffectValueA1);
            }
        }
 
 
    }
    void ItemSX(int _Equipped)//用于精炼度和边框变色的刷新
    {
        if (_Equipped == (int)RoleEquipType.Wing)
        {
 
            ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
            ;
            int ItemColor = ItemLogicUtility.Instance.GetItemQuality(itemModel.itemId, itemModel.useDataDict);
            WingsBG.SetItemBackGround(ItemColor);
            IconButton.GetComponent<Image>().SetSprite(itemModel.config.IconKey);
            int Number = Mathf.CeilToInt(((float)_currentRefining / _currentRefiningAll) * 100);
            WText.text = string.Format(Language.Get("EquipReinforceWin_WingRefLv_1"), Number) + "%";
        }
    }
 
    void WingRefine()//精炼属性值获取
    {
        if (wingRefineAttrConfigs.Count <= 0)
        {
            wingRefineAttrConfigs = WingRefineAttrConfig.GetValues();
        }
        //  var wingConfigs = WingRefineAttrConfig.GetValues();
        foreach (var config in wingRefineAttrConfigs)
        {
            if (!_DicWingRe.ContainsKey(config.wingsPhase))
            {
                WingRefineAttrModel _wingRefineAttrModel = new WingRefineAttrModel();
                int[] array = ConfigParse.GetKeyValueKeys<int>(config.attrupper);
                int[] intarray = ConfigParse.GetKeyValueValues<int>(config.attrupper);
                _wingRefineAttrModel.Ability1 = array[0];
                _wingRefineAttrModel.Ability2 = array[1];
                _wingRefineAttrModel.Ability1Value = intarray[0];
                _wingRefineAttrModel.Ability2Value = intarray[1];
                _DicWingRe.Add(config.wingsPhase, _wingRefineAttrModel);
            }
        }
    }
 
 
 
    void ItemsToRefresh(PackType type)//背包刷新
    {
        Backpacking();
        if (AutomaticBool)
        {
            CoroutinesBool = true;
        }
 
        m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
 
    }
 
    void BackpackRefresh(PackType type, int itemPlace, int id)//背包物品清理
    {
        if (_DevourDIc.ContainsKey(itemPlace))
        {
            ItemModel model = playerPack.GetItemByIndex(PackType.Item, itemPlace);
            if (model == null)
            {
                _DevourDIc.Remove(itemPlace);
            }
        }
 
        Backpacking();
        if (AutomaticBool)
        {
            CoroutinesBool = true;
        }
 
        m_ScrollerController.m_Scorller.RefreshActiveCellViews();//刷新可见
        PreviewTheValue();
    }
 
    void EquippedWithRefresh(PackType type, int index, int id)//角色装备刷新
    {
        //临时条件判断
        if (type != PackType.Equip)
        {
            return;
        }
 
 
        if (index == (int)RoleEquipType.Wing)
        {
            WingsImage.SetActive(false);
            IconButton.SetActive(true);
            ModelCreationDisplay();
            ItemSX(index);
            RefiningDegrees();//精炼度(刷新)
        }
 
    }
 
 
    private int GetMaxOrderWing()
    {
        int MaxMaxOrder = 0;
 
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        if (itemModel != null)
        {
            WingRefineExpConfig wingRefineExpConfig = WingRefineExpConfig.Get(itemModel.itemId);
            if (wingRefineExpConfig != null)
            {
                if (wingLv2GenerDict.ContainsKey(wingRefineExpConfig.WingsPhase) && wingLv2GenerDict[wingRefineExpConfig.WingsPhase] > MaxMaxOrder)
                {
                    MaxMaxOrder = wingLv2GenerDict[wingRefineExpConfig.WingsPhase];
                }
 
            }
        }
 
        if (intPetAbsorbTyp.Count > 0)
        {
            for (int i = 0; i < intPetAbsorbTyp.Count; i++)
            {
                ItemModel model = playerPack.GetItemByIndex(PackType.Item, intPetAbsorbTyp[i]);
                WingRefineExpConfig wingRefineExpConfig = WingRefineExpConfig.Get(model.itemId);
                if (wingRefineExpConfig != null)
                {
                    if (wingLv2GenerDict.ContainsKey(wingRefineExpConfig.WingsPhase) && wingLv2GenerDict[wingRefineExpConfig.WingsPhase] > MaxMaxOrder)
                    {
                        MaxMaxOrder = wingLv2GenerDict[wingRefineExpConfig.WingsPhase];
                    }
 
                }
            }
 
        }
 
        return MaxMaxOrder;
    }
    List<int> ClassifyList = new List<int>();//存背包位置
    private void WingClassify()
    {
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        if (itemModel == null)
        {
            return;
        }
        int MaxMaxOrder = GetMaxOrderWing();
        ClassifyList.Clear();
        if (MaxMaxOrder <= 2)//最高阶的翅膀或翅膀材料阶数为1阶或者2阶
        {
            for (int i = 0; i < intPetAbsorbTyp.Count; i++)
            {
                ItemModel model = playerPack.GetItemByIndex(PackType.Item, intPetAbsorbTyp[i]);
                WingRefineExpConfig wingRefineExpConfig = WingRefineExpConfig.Get(model.itemId);
                if (wingRefineExpConfig.WingsPhase <= 0 || (wingLv2GenerDict.ContainsKey(wingRefineExpConfig.WingsPhase) && wingLv2GenerDict[wingRefineExpConfig.WingsPhase] <= 1))
                {
                    ClassifyList.Add(intPetAbsorbTyp[i]);
                }
            }
        }
        else//最高阶的翅膀或翅膀材料阶数3阶及以上
        {
            for (int i = 0; i < intPetAbsorbTyp.Count; i++)
            {
                ItemModel model = playerPack.GetItemByIndex(PackType.Item, intPetAbsorbTyp[i]);
                WingRefineExpConfig wingRefineExpConfig = WingRefineExpConfig.Get(model.itemId);
                if (wingRefineExpConfig.WingsPhase <= 0 || (wingLv2GenerDict.ContainsKey(wingRefineExpConfig.WingsPhase) && wingLv2GenerDict[wingRefineExpConfig.WingsPhase] <= MaxMaxOrder - 2))
                {
                    ClassifyList.Add(intPetAbsorbTyp[i]);
                }
            }
        }
        ClassifyList.Sort(Compare);
        for (int j = 0; j < ClassifyList.Count; j++)
        {
            if (IsAbsorb())
            {
                _DevourDIc.Add(ClassifyList[j], true);
            }
        }
    }
    int Compare(int x, int y)//数组排列
    {
        bool havex = Sort1(x);
        bool havey = Sort1(y);
        if (havex.CompareTo(havey) != 0)
        {
            return -havex.CompareTo(havey);
        }
        var _sort_x = Sort2(x);
        var _sort_y = Sort2(y);
        return -_sort_x.CompareTo(_sort_y);
    }
 
    private bool Sort1(int Index)
    {
        ItemModel model = playerPack.GetItemByIndex(PackType.Item, Index);
        if (model.itemId == 3807 || model.itemId == 3808)
        {
            return true;
        }
        return false;
    }
 
    private int Sort2(int Index)
    {
        int Max = 0;
        ItemModel itemModel = playerPack.GetItemByIndex(PackType.Equip, SpiritWeaponModel.WING_EQUIPINDEX);
        if (itemModel == null)
        {
            return 0;
        }
        var wingConfig = WingRefineExpConfig.Get(_wingItemDic[Index]);
        if (WingDic[Index].GetUseData((int)ItemUseDataKey.wingProgressValue) != null || WingDic[Index].GetUseData((int)ItemUseDataKey.wingMaterialItemID) != null)
        {
            Max = wingConfig.EXPupper + GetWingRefiningValue(WingDic[Index]);
        }
        else
        {
            ItemModel model = playerPack.GetItemByIndex(PackType.Item, Index);
            for (int i = 0; i < model.count; i++)
            {
                if (wingConfig.EXPmaterial != null && !wingConfig.EXPmaterial.Equals(string.Empty))
                {
                    Dictionary<int, int> dicExp = ConfigParse.GetDic<int, int>(wingConfig.EXPmaterial);
                    Max = dicExp[itemModel.config.LV];
                }
                else
                {
                    Max = wingConfig.EXPupper;
                }
            }
        }
        return Max;
    }
 
    private void SortAll()//翅膀总的排序
    {
        intPetAbsorbTyp.Sort(CompareAll);
 
    }
    int CompareAll(int x, int y)//数组排列
    {
        bool IsBoolx = ClassifyList.Contains(x);
        bool IsBooly = ClassifyList.Contains(y);
        if (IsBoolx.CompareTo(IsBooly) != 0)
        {
            return -IsBoolx.CompareTo(IsBooly);
        }
        if (ClassifyList.Contains(x) && ClassifyList.Contains(y))
        {
            var _sort_x1 = ClassifyList.IndexOf(x);
            var _sort_y1 = ClassifyList.IndexOf(y);
            return _sort_x1.CompareTo(_sort_y1);
        }
        else
        {
            var _sort_x = Sort2(x);
            var _sort_y = Sort2(y);
            return -_sort_x.CompareTo(_sort_y);
        }
 
    }
}