少年修仙传客户端代码仓库
client_Wu Xijin
2018-10-22 ec36f7122391b3e5d46838e67f64a2d54714626e
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
using System;
using System.Collections.Generic;
using UnityEngine;
using TableConfig;
using Snxxz.UI;
using System.Linq;
 
public class WashProValue
{
    public int XLAttrValue;        // 当前属性值
 
    public int XLAttrChange;        // 洗练操作属性值, 当大于0时代表当前部位有还未确认的洗练结果, 与当前属性值相减得出洗练正负
 
    public int addAttrValue; //增加洗练属性值
 
    public WashState washState;
}
 
public enum WashState
{
    None,       //未洗练
    MustWash,   //必增洗练
    normalWash, //普通洗练
}
 
public class WashProCount
{
    public int EquipPlace;        // 装备位    
 
    public int XLAttrLV;        // 洗练等级
 
    public int XLAttrCnt;        // 属性条数
 
    public bool isPutOn = false;
 
    public string placeName = "";
 
    public WashProValue[] proValuelist = null;        // 属性列表,索引0的代表属性1,依次递增
}
 
[XLua.LuaCallCSharp]
    public class EquipWashModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
{
 
    public delegate void OnRefreshWashModel();
    public event OnRefreshWashModel RefreshWashModelEvent;
 
    public int[] washGroups1 { get; private set; }
    public int[] washGroups2 { get; private set; }
    public int[] washGroups3 { get; private set; }
 
    private Dictionary<int, WashProCount> washEquipProDict = new Dictionary<int, WashProCount>();
    private FuncConfigConfig funcModel;
    private Dictionary<int, Dictionary<int, int>> _equipWashLimitDict = new Dictionary<int, Dictionary<int, int>>();
    private List<WashProCount> orderWashProlist = new List<WashProCount>();
    PlayerPackModel _playerPack;
    PlayerPackModel playerPack
    {
        get { return _playerPack ?? (_playerPack = ModelCenter.Instance.GetModel<PlayerPackModel>()); }
    }
 
    private bool _isWashUI = true;
    public bool isWashUI { get { return _isWashUI; } set { _isWashUI = value; } }
 
    public bool isMustAddAttr { get; private set; }
 
    private bool FirstLogin = true;
 
    private void RefreshItemCount(PackType arg1, int arg2, int arg3)
    {
        switch (arg1)
        {
            case PackType.rptEquip:
                GetWashModellist();
                break;
            case PackType.rptItem:
                if (arg3 == 5303)
                {
                    GetWashModellist();
                }
                break;
 
        }
    }
 
    private void WashFuncOpen(int obj)
    {
        if (obj != 91)
            return;
 
        GetWashModellist();
    }
 
    public override void Init()
    {
        _equipWashLimitDict.Clear();
        FuncConfigConfig washGroup1Model = Config.Instance.Get<FuncConfigConfig>("EquipWashGroup1");
        FuncConfigConfig washGroup2Model = Config.Instance.Get<FuncConfigConfig>("EquipWashGroup2");
        FuncConfigConfig washGroup3Model = Config.Instance.Get<FuncConfigConfig>("EquipWashGroup3");
        washGroups1 = ConfigParse.GetMultipleStr<int>(washGroup1Model.Numerical1);
        washGroups2 = ConfigParse.GetMultipleStr<int>(washGroup2Model.Numerical1);
        washGroups3 = ConfigParse.GetMultipleStr<int>(washGroup3Model.Numerical1);
        SetEquipWashMaxLV(washGroups1, washGroup1Model.Numerical2);
        SetEquipWashMaxLV(washGroups2, washGroup2Model.Numerical2);
        SetEquipWashMaxLV(washGroups3, washGroup3Model.Numerical2);
    }
 
    private void SetEquipWashMaxLV(int[] groups,string limit)
    {
        Dictionary<int,int> limitDict = ConfigParse.GetDic<int, int>(limit);
        if (groups != null && limitDict != null)
        {
            for (int i = 0; i < groups.Length; i++)
            {
                if (!_equipWashLimitDict.ContainsKey(groups[i]))
                {
                    _equipWashLimitDict.Add(groups[i], limitDict);
                }
            }
        }
    }
 
    public override void UnInit()
    {
        FuncOpen.Instance.OnFuncStateChangeEvent -= WashFuncOpen;
        playerPack.RefreshItemCountAct -= RefreshItemCount;
    }
 
    public void OnBeforePlayerDataInitialize()
    {
        FirstLogin = true;
        isMustAddAttr = false;
        funcModel = null;
        _isWashUI = true;
        FuncOpen.Instance.OnFuncStateChangeEvent -= WashFuncOpen;
        playerPack.RefreshItemCountAct -= RefreshItemCount;
        InitWashModel();
    }
 
    public void OnAfterPlayerDataInitialize()
    {
 
        FuncOpen.Instance.OnFuncStateChangeEvent += WashFuncOpen;
        playerPack.RefreshItemCountAct += RefreshItemCount;
        SetWashEquipRedPointlist();
        GetWashModellist();
    }
 
    public void OnPlayerLoginOk()
    {
        isMustAddAttr = true;
        FirstLogin = false;
        PlayerPrefs.DeleteKey(MasterGroup1ActiveKey);
        PlayerPrefs.DeleteKey(MasterGroup2ActiveKey);
        PlayerPrefs.DeleteKey(MasterGroup3ActiveKey);
        PlayerPrefs.DeleteKey(MasterGroup1RaiseKey);
        PlayerPrefs.DeleteKey(MasterGroup2RaiseKey);
        PlayerPrefs.DeleteKey(MasterGroup3RaiseKey);
        CheckIsMasterLv();
    }
 
    public int[] washPlacelist { get; private set; }
    public List<WashProCount> washProlist { get; private set; }
    private void InitWashModel()
    {
        FuncConfigConfig washDisPlayer = Config.Instance.Get<FuncConfigConfig>("StrengthenDisplay");
        washPlacelist = ConfigParse.GetMultipleStr<int>(washDisPlayer.Numerical1);
        washEquipProDict.Clear();
        if (washPlacelist != null)
        {
            for (int i = 0; i < washPlacelist.Length; i++)
            {
                WashProCount proCount = new WashProCount();
                proCount.EquipPlace = washPlacelist[i];
                proCount.isPutOn = false;
                proCount.XLAttrCnt = 3;
                proCount.XLAttrLV = 1;
                proCount.proValuelist = new WashProValue[proCount.XLAttrCnt];
                if (proCount.XLAttrCnt > 0)
                {
                    for (int j = 0; j < proCount.XLAttrCnt; j++)
                    {
                        proCount.proValuelist[j] = new WashProValue();
                        proCount.proValuelist[j].XLAttrValue = 0;
                        proCount.proValuelist[j].XLAttrChange = 0;
                        proCount.proValuelist[j].addAttrValue = 0;
                        proCount.proValuelist[j].washState = WashState.None;
                    }
                }
                washEquipProDict.Add(washPlacelist[i], proCount);
            }
        }
        washProlist = washEquipProDict.Values.ToList();
 
    }
 
    public void ReFreshModel(HA3BB_tagMCEquipPartXLAttrInfo info)
    {
        for (int i = 0; i < info.Count; i++)
        {
            if (washEquipProDict.ContainsKey(info.InfoList[i].EquipPlace))
            {
                WashProCount proCount = washEquipProDict[info.InfoList[i].EquipPlace];
                proCount.EquipPlace = info.InfoList[i].EquipPlace;
                proCount.XLAttrLV = info.InfoList[i].XLAttrLV;
                proCount.XLAttrCnt = info.InfoList[i].XLAttrCnt;
                proCount.isPutOn = false;
                if (proCount.XLAttrCnt > 0)
                {
                    for (int j = 0; j < proCount.XLAttrCnt; j++)
                    {
                        proCount.proValuelist[j].XLAttrChange = (int)info.InfoList[i].XLAttrList[j].XLAttrChange;
 
                        if (proCount.proValuelist[j].XLAttrChange <= 0)
                        {
                            proCount.proValuelist[j].addAttrValue = (int)info.InfoList[i].XLAttrList[j].XLAttrValue - proCount.proValuelist[j].XLAttrValue;
 
                            switch (proCount.proValuelist[j].washState)
                            {
                                case WashState.None:
                                    if (isMustAddAttr)
                                    {
                                        if (proCount.proValuelist[j].addAttrValue > 0)
                                        {
                                            proCount.proValuelist[j].washState = WashState.MustWash;
                                        }
                                    }
                                    break;
                                case WashState.MustWash:
                                    proCount.proValuelist[j].washState = WashState.None;
                                    break;
                                case WashState.normalWash:
                                    proCount.proValuelist[j].washState = WashState.None;
                                    break;
                            }
 
                        }
                        else
                        {
                            proCount.proValuelist[j].washState = WashState.normalWash;
                            proCount.proValuelist[j].addAttrValue = 0;
                        }
                        proCount.proValuelist[j].XLAttrValue = (int)info.InfoList[i].XLAttrList[j].XLAttrValue;
 
                    }
                }
            }
        }
        if (RefreshWashModelEvent != null)
            RefreshWashModelEvent();
 
        if (!FirstLogin)
        {
            CheckIsMasterLv();
        }
        GetWashModellist();
    }
 
    //设置洗练数据的排列顺序
    public void SetModelOrder()
    {
        orderWashProlist.Clear();
        orderWashProlist.AddRange(washProlist);
 
        SinglePackModel rptEquipPack = playerPack.GetSinglePackModel(PackType.rptEquip);
        Dictionary<int, ItemModel> itemPlaceDict = null;
        if (rptEquipPack != null)
        {
            itemPlaceDict = rptEquipPack.GetPackModelIndexDict();
        }
 
        int i = 0;
        for (i = 0; i < washPlacelist.Length; i++)
        {
            if (washEquipProDict.ContainsKey(washPlacelist[i]))
            {
                if (itemPlaceDict != null)
                {
                    if (itemPlaceDict.ContainsKey(washPlacelist[i]))
                    {
                        washEquipProDict[washPlacelist[i]].isPutOn = true;
                    }
                    else
                    {
                        washEquipProDict[washPlacelist[i]].isPutOn = false;
                    }
                }
            }
        }
 
        orderWashProlist.Sort(CompareByIsPutOn);
    }
 
    public int CompareByIsPutOn(WashProCount start, WashProCount end)
    {
        bool startIsput = start.isPutOn;
        bool endIsPut = end.isPutOn;
        if (startIsput.CompareTo(endIsPut) != 0) return -startIsput.CompareTo(endIsPut);
 
        int startIndex = washProlist.IndexOf(start);
        int endIndex = washProlist.IndexOf(end);
 
        if (startIndex.CompareTo(endIndex) != 0) return startIndex.CompareTo(endIndex);
 
        return 0;
    }
 
    public List<WashProCount> GetWashModellist()
    {
        SetModelOrder();
        ReachWashCondition();
        return orderWashProlist;
    }
 
    public Dictionary<int, WashProCount> GetWashInfoDict()
    {
        return washEquipProDict;
    }
 
    public WashProCount GetWashEquipInfo(int equipPlace)
    {
        if (washEquipProDict.ContainsKey(equipPlace))
            return washEquipProDict[equipPlace];
        else
            return null;
    }
 
    //得到洗练群组类型
    public int OnGetWashType(int itemPlace)
    {
        int i = 0;
        for (i = 0; i < washGroups1.Length; i++)
        {
            if (washGroups1[i] == itemPlace)
                return 1;
        }
 
        for (i = 0; i < washGroups2.Length; i++)
        {
            if (washGroups2[i] == itemPlace)
                return 2;
        }
 
        for (i = 0; i < washGroups3.Length; i++)
        {
            if (washGroups3[i] == itemPlace)
                return 3;
        }
        return 0;
    }
    public List<WashProCount> washGroup1 = null;
    public List<WashProCount> washGroup2 = null;
    public List<WashProCount> washGroup3 = null;
 
    //得到大师洗练的数据
    public void OnGetMasterModel(List<WashProCount> washInfolist)
    {
        washGroup1 = new List<WashProCount>();
        washGroup2 = new List<WashProCount>();
        washGroup3 = new List<WashProCount>();
        int i = 0;
        for (i = 0; i < washInfolist.Count; i++)
        {
            if (OnGetWashType(washInfolist[i].EquipPlace) == 1)
                washGroup1.Add(washInfolist[i]);
            else if (OnGetWashType(washInfolist[i].EquipPlace) == 2)
                washGroup2.Add(washInfolist[i]);
            else if (OnGetWashType(washInfolist[i].EquipPlace) == 3)
                washGroup3.Add(washInfolist[i]);
        }
        if (washGroup1.Count > 1)
            washGroup1.Sort(Compare);
        if (washGroup2.Count > 1)
            washGroup2.Sort(Compare);
        if (washGroup3.Count > 1)
            washGroup3.Sort(Compare);
 
    }
 
    public int Compare(WashProCount start, WashProCount next)
    {
        int startLevel = start.XLAttrLV;
        int nextLevel = next.XLAttrLV;
        if (startLevel.CompareTo(nextLevel) != 0) return startLevel.CompareTo(nextLevel);
        return 0;
    }
 
 
    //得到当前装备的洗练数值
    public int[] WashProValues(int itemPlace)
    {
        if (washEquipProDict.ContainsKey(itemPlace))
        {
            int[] values = new int[washEquipProDict[itemPlace].proValuelist.Length];
            int i = 0;
            for (i = 0; i < washEquipProDict[itemPlace].proValuelist.Length; i++)
            {
                values[i] = (int)washEquipProDict[itemPlace].proValuelist[i].XLAttrValue;
            }
            return values;
        }
        else
        {
            return null;
        }
 
    }
 
    /// <summary>
    /// 得打装备等级对应的最大洗练等级
    /// </summary>
    /// <param name="equipLv"></param>
    /// <returns></returns>
    public int GetWashFullLv(int equipPlace,int equipLv)
    {
        if (_equipWashLimitDict.ContainsKey(equipPlace))
        {
            if(_equipWashLimitDict[equipPlace].ContainsKey(equipLv))
            {
                return _equipWashLimitDict[equipPlace][equipLv];
            }
        }
        return 0;
    }
 
    public int GetEquipWashMinLv(int equipPlace)
    {
        if (_equipWashLimitDict.ContainsKey(equipPlace))
        {
            List<int> lvlist = _equipWashLimitDict[equipPlace].Keys.ToList();
            if (lvlist != null && lvlist.Count > 0)
            {
                return lvlist[0];
            }
        }
        return 0;
    }
 
 
    /// <summary>
    /// 判断当前装备是否洗练满阶
    /// </summary>
    /// <returns></returns>
    private ItemConfig chinItemModel;
    public bool IsWashFull(ItemModel model, WashProCount washPro, EquipWashConfig tagEquipWash)
    {
        if (model == null)
            return false;
 
        chinItemModel = Config.Instance.Get<ItemConfig>((int)model.itemInfo.ItemID);
        int fullLv = GetWashFullLv(chinItemModel.EquipPlace,chinItemModel.LV);
        if (washPro.XLAttrLV == fullLv)
        {
            if (washPro.proValuelist[0].XLAttrValue < tagEquipWash.attMax1)
            {
                return false;
            }
 
            if (washPro.proValuelist[1].XLAttrValue < tagEquipWash.attMax2)
            {
                return false;
            }
 
            if (washPro.proValuelist[2].XLAttrValue < tagEquipWash.attMax3)
            {
                return false;
            }
            return true;
        }
        else if (washPro.XLAttrLV > fullLv)
        {
            return true;
        }
        else
            return false;
 
    }
 
    public bool IsCanWash(ItemModel model)
    {
        if (model == null)
            return false;
 
        chinItemModel = Config.Instance.Get<ItemConfig>((int)model.itemInfo.ItemID);
        if(chinItemModel.LV >= GetEquipWashMinLv(chinItemModel.EquipPlace))
        {
            return true;
        }
        return false;
    }
 
    /// <summary>
    /// 得到装备位最大洗练等级
    /// </summary>
    /// <returns></returns>
    public int GetMaxWashLv(int equipPlace)
    {
        if (_equipWashLimitDict.ContainsKey(equipPlace))
        {
            List<int> washLvlist = _equipWashLimitDict[equipPlace].Values.ToList();
            if (washLvlist != null && washLvlist.Count > 0)
            {
                return washLvlist[washLvlist.Count - 1];
            }
        }
        return 0;
    }
 
    public string GetCurWashLvStr(WashProCount washPro, EquipWashConfig tagEquipWash)
    {
        int maxWashLv = GetMaxWashLv(washPro.EquipPlace);
 
        if (washPro.XLAttrLV < maxWashLv)
        {
            return Language.Get("EquipWash108", washPro.XLAttrLV);
        }
        else
        {
            if (washPro.proValuelist[0].XLAttrValue < tagEquipWash.attMax1)
            {
                return Language.Get("EquipWash109");
            }
 
            if (washPro.proValuelist[1].XLAttrValue < tagEquipWash.attMax2)
            {
                return Language.Get("EquipWash109");
            }
 
            if (washPro.proValuelist[2].XLAttrValue < tagEquipWash.attMax3)
            {
                return Language.Get("EquipWash109");
            }
            return Language.Get("EquipWash110");
        }
 
    }
 
    /// <summary>
    /// 判断当前洗练装备是否保存洗练数值
    /// </summary>
    /// <param name="washPro"></param>
    /// <returns></returns>
    public bool IsSaveWashValue(WashProCount washPro)
    {
        int i = 0;
        for (i = 0; i < washPro.proValuelist.Length; i++)
        {
            if (washPro.proValuelist[i].XLAttrChange != 0)
            {
                return false;
            }
        }
        return true;
    }
 
    public bool IsEnoughMat(EquipWashConfig tagWashModel)
    {
        if (playerPack.GetItemCountByID(PackType.rptItem, tagWashModel.costItem) >= tagWashModel.costCount)
            return true;
        else
            return false;
    }
 
    public void SendWashQuest(int equipPlace, int code)
    {
        CA325_tagCMEquipXLAttrChange equipWash = new CA325_tagCMEquipXLAttrChange();
        equipWash.EquipPlace = (byte)equipPlace;
        equipWash.CheckUseGoldAttr = (byte)code;
        GameNetSystem.Instance.SendInfo(equipWash);
    }
 
    #region 红点逻辑处理
    public List<Redpoint> washEquipRedPointlist { get; private set; }
    public const int WashBtnRed_Key = 1060501;
    public Redpoint washBtnRedpoint = new Redpoint(WashBtnRed_Key);
    public void SetWashEquipRedPointlist()
    {
        washEquipRedPointlist = new List<Redpoint>();
        int i = 0;
        for (i = 0; i < 10; i++)
        {
            int id = MainRedDot.RedPoint_WashFuncKey * 1000 + i;
            Redpoint washRedPoint = new Redpoint(MainRedDot.RedPoint_WashFuncKey, id);
            washEquipRedPointlist.Add(washRedPoint);
        }
    }
 
    Dictionary<int, WashProCount> RedpointWashDict = new Dictionary<int, WashProCount>();
 
    public int JumpToIndex { get; set;}
    public void ReachWashCondition()
    {
        RedpointWashDict.Clear();
        JumpToIndex = 0;
        int i = 0;
        for(i = 0; i < orderWashProlist.Count; i++)
        {
            washEquipRedPointlist[i].state = RedPointState.None;
        }
        for (i = 0; i < orderWashProlist.Count; i++)
        {
            ItemModel model = playerPack.GetItemModelByIndex(PackType.rptEquip, orderWashProlist[i].EquipPlace);
            EquipWashConfig washModel = EquipWashConfig.GetCurrentWashEquipModel(OnGetWashType(orderWashProlist[i].EquipPlace), orderWashProlist[i].XLAttrLV);
            if (model != null && washModel != null)
            {
                if (IsCanWash(model) && IsEnoughMat(washModel) && !IsWashFull(model, orderWashProlist[i], washModel)
                    && FuncOpen.Instance.IsFuncOpen(91))
                {
                    RedpointWashDict.Add(i, orderWashProlist[i]);
                }
            }
        }
 
        List<WashProCount> redpointlist = RedpointWashDict.Values.ToList();
        redpointlist.Sort(CompareByLv);
        foreach(var key in RedpointWashDict.Keys)
        {
            if(RedpointWashDict[key].EquipPlace == redpointlist[0].EquipPlace)
            {
                washEquipRedPointlist[key].state = RedPointState.Simple;
                JumpToIndex = key;
                return;
            }
        }
    }
 
    public int CompareByLv(WashProCount start,WashProCount end)
    {
        int startLv = start.XLAttrLV;
        int endLv = end.XLAttrLV;
        if (startLv.CompareTo(endLv) != 0) return startLv.CompareTo(endLv);
 
        int startIndex = orderWashProlist.IndexOf(start);
        int endIndex = orderWashProlist.IndexOf(end);
        if (startIndex.CompareTo(endIndex) != 0) return startIndex.CompareTo(endIndex);
 
        return 0;
    }
 
    #endregion
 
    public string GetProValueTypeStr(PlayerPropertyConfig playerproModel, int value)
    {
        string s = "";
        if (playerproModel.ISPercentage == 0)
        {
            s = value.ToString();
        }
        else if (playerproModel.ISPercentage == 1)
        {
            s = (float)Math.Round(value / 100f, 1) + "%";
        }
        else if (playerproModel.ISPercentage == 2)
        {
            s = ((float)Math.Round(value / 100f, 1)).ToString();
        }
        return s;
    }
 
    #region 大师洗练数据
    public int washType { get; private set; }
    public int washLv { get; private set; }
    public void SetWashMasterModel(int type, int groupLv)
    {
        washType = type;
        washLv = groupLv;
    }
 
    public readonly string MasterGroup1ActiveKey = "MasterGroup1Active";
    public readonly string MasterGroup2ActiveKey = "MasterGroup2Active";
    public readonly string MasterGroup3ActiveKey = "MasterGroup3Active";
    public readonly string MasterGroup1RaiseKey = "MasterGroup1Raise";
    public readonly string MasterGroup2RaiseKey = "MasterGroup2Raise";
    public readonly string MasterGroup3RaiseKey = "MasterGroup3Raise";
 
    public int MasterWashState { get; private set; } //1 激活 2 升级
 
    private void CheckIsMasterLv()
    {
        List<WashProCount> washAttrlist = washEquipProDict.Values.ToList();
        OnGetMasterModel(washAttrlist);
        for (int i = 1; i < 4; i++)
        {
            int curTypeLv = 0;
            switch (i)
            {
                case 1:
                    curTypeLv = washGroup1[0].XLAttrLV;
                    SetMasterGroupActiveRecord(curTypeLv,1,MasterGroup1ActiveKey);
                    SetMasterGroupRaiseRecord(curTypeLv, 1, MasterGroup1RaiseKey);
                    break;
                case 2:
                    curTypeLv = washGroup2[0].XLAttrLV;
                    SetMasterGroupActiveRecord(curTypeLv,2, MasterGroup2ActiveKey);
                    SetMasterGroupRaiseRecord(curTypeLv, 2, MasterGroup2RaiseKey);
                    break;
                case 3:
                    curTypeLv = washGroup3[0].XLAttrLV;
                    SetMasterGroupActiveRecord(curTypeLv, 3, MasterGroup3ActiveKey);
                    SetMasterGroupRaiseRecord(curTypeLv, 3, MasterGroup3RaiseKey);
                    break;
            }
        }
    }
 
    public void SetMasterGroupRaiseRecord(int curGroupLv, int type, string groupRaise)
    {
        List<EquipWashSpecConfig> tagSpecModellist = EquipWashSpecConfig.GetWashSpecModel(type);
        for(int i = 0; i < tagSpecModellist.Count; i++)
        {
            if(curGroupLv < tagSpecModellist[i].levelNeed)
            {
                if(i == 0)
                {
                    LocalSave.SetInt(groupRaise, tagSpecModellist[i].levelNeed);
                }
                else
                {
                    if (!PlayerPrefs.HasKey(groupRaise))
                    {
                        LocalSave.SetInt(groupRaise, tagSpecModellist[i-1].levelNeed);
                    }
                    else
                    {
                        int groupLv = LocalSave.GetInt(groupRaise);
                        if (tagSpecModellist[i - 1].levelNeed > groupLv)
                        {
                            MasterWashState = 2;
                            SetWashMasterModel(type, curGroupLv);
                            WindowCenter.Instance.Open<WashMasterActiveWin>();
                            LocalSave.SetInt(groupRaise, tagSpecModellist[i - 1].levelNeed);
                        }
                    }
                }
                return;
            }
            else if(curGroupLv >= tagSpecModellist[tagSpecModellist.Count -1].levelNeed)
            {
                if (!PlayerPrefs.HasKey(groupRaise))
                {
                    LocalSave.SetInt(groupRaise, tagSpecModellist[tagSpecModellist.Count - 1].levelNeed);
                }
                else
                {
                    int groupLv = LocalSave.GetInt(groupRaise);
                    if (tagSpecModellist[tagSpecModellist.Count - 1].levelNeed > groupLv)
                    {
                        MasterWashState = 2;
                        SetWashMasterModel(type, curGroupLv);
                        WindowCenter.Instance.Open<WashMasterActiveWin>();
                        LocalSave.SetInt(groupRaise, tagSpecModellist[tagSpecModellist.Count - 1].levelNeed);
                    }
                }
                return;
            }
        }
    }
 
    public void SetMasterGroupActiveRecord(int curGroupLv,int type,string groupActive)
    {
        List<EquipWashSpecConfig> tagSpecModellist = EquipWashSpecConfig.GetWashSpecModel(type);
        if (curGroupLv >= tagSpecModellist[0].levelNeed)
        {
            if (!PlayerPrefs.HasKey(groupActive))
            {
                LocalSave.SetBool(groupActive, true);
            }
            else
            {
                bool isActive = LocalSave.GetBool(groupActive);
                if (!isActive)
                {
                    MasterWashState = 1;
                    SetWashMasterModel(type, curGroupLv);
                    WindowCenter.Instance.Open<WashMasterActiveWin>();
                }
                LocalSave.SetBool(groupActive, true);
            }
        }
        else
        {
            LocalSave.SetBool(groupActive, false);
        }
    }
    #endregion
 
}