少年修仙传客户端代码仓库
client_Wu Xijin
2019-02-20 a87120c155c48fa45b20a97c1a58bdbeb77318b7
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
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
using Snxxz.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
 
using LitJson;
 
namespace Snxxz.UI
{
    [XLua.LuaCallCSharp]
    public class PlayerPackModel : Model, IBeforePlayerDataInitialize, IAfterPlayerDataInitialize, IPlayerLoginOk
    {
        public static string StrengthAttrShift_RecordKey = "";
        public const string RecordKnapsackTitle = "RecordKnapsackTitle";
 
        Dictionary<int, int> DrugToDungeonDict { get; set; }   //key 丹药ID,value副本ID
        Dictionary<int, int[]> DungeonToDrugDict { get; set; }  //key 副本ID,value丹药ID列表
        public List<AttrFruitConfig> makeDruglist { get; private set; }
        Dictionary<int, Dictionary<int, int>> decomposeAttrDict = new Dictionary<int, Dictionary<int, int>>();
        string RoleEquipLocalSave = "";
        public int MaxBagGridCnt { get; private set; }
        public int InitBagGridCnt { get; private set; }
        public int MaxDepotGridCnt { get; private set; }
        public int InitDepotGridCnt { get; private set; }
        List<int> LocalSavePlaceArray { get; set; }
        Dictionary<int, List<int>> ShareUseCntItemDict { get; set; }
        bool isUpdatePlayerLv = false;
 
        BlastFurnaceModel FurnaceModel { get { return ModelCenter.Instance.GetModel<BlastFurnaceModel>(); } }
 
        public override void Init()
        {
            ParseConfig();
            List<DungeonOpenTimeConfig> dungeonlist = DungeonOpenTimeConfig.GetValues();
            if (dungeonlist != null)
            {
                DrugToDungeonDict = new Dictionary<int, int>();
                DungeonToDrugDict = new Dictionary<int, int[]>();
 
                for (int i = 0; i < dungeonlist.Count; i++)
                {
                    int[] drugIdlist = dungeonlist[i].ElixirHint;
                    if (drugIdlist != null && drugIdlist.Length > 0)
                    {
                        DungeonToDrugDict.Add(dungeonlist[i].DataMapID, drugIdlist);
                        for (int j = 0; j < drugIdlist.Length; j++)
                        {
                            DrugToDungeonDict.Add(drugIdlist[j], dungeonlist[i].DataMapID);
                        }
 
                    }
                }
            }
 
            makeDruglist = new List<AttrFruitConfig>();
            List<AttrFruitConfig> fruitlist = AttrFruitConfig.GetValues();
            for (int i = 0; i < fruitlist.Count; i++)
            {
                if (fruitlist[i].FuncID == 2)
                {
                    makeDruglist.Add(fruitlist[i]);
                }
            }
            StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
 
            SetDevourEquipPlace();
 
            decomposeAttrDict.Clear();
            List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues();
            for (int i = 0; i < decomlist.Count; i++)
            {
                JsonData attrData = JsonMapper.ToObject(decomlist[i].Attr);
                Dictionary<int, int> attrDict = new Dictionary<int, int>();
                decomposeAttrDict.Add(decomlist[i].LV, attrDict);
                foreach (var id in attrData.Keys)
                {
                    attrDict.Add(int.Parse(id), int.Parse(attrData[id].ToString()));
                }
            }
 
            FuncConfigConfig equipDecompose = FuncConfigConfig.Get("EquipDevourCount");
            minDecomposeNum = int.Parse(equipDecompose.Numerical1);
            defaultUnSelectlist = ConfigParse.GetMultipleStr<int>(equipDecompose.Numerical2);
 
            FuncConfigConfig ShareUseCntItem = FuncConfigConfig.Get("ShareUseCntItem");
            ShareUseCntItemDict = new Dictionary<int, List<int>>();
            JsonData shareUseJson = JsonMapper.ToObject(ShareUseCntItem.Numerical1);
            if (shareUseJson.IsArray)
            {
                for (int i = 0; i < shareUseJson.Count; i++)
                {
                    var idListJson = shareUseJson[i];
                    var idlist = new List<int>();
                    ShareUseCntItemDict.Add(i, idlist);
                    foreach (var id in idListJson)
                    {
                        idlist.Add(int.Parse(id.ToString()));
                    }
                }
            }
 
            InitDepotGridCnt = int.Parse(FuncConfigConfig.Get("InitDepotCellCount").Numerical1);
            InitBagGridCnt = int.Parse(FuncConfigConfig.Get("InitBagCellCount").Numerical1);
            MaxBagGridCnt = int.Parse(FuncConfigConfig.Get("MaxBagCellCount").Numerical1);
            MaxDepotGridCnt = int.Parse(FuncConfigConfig.Get("MaxDepotCellCount").Numerical1);
            SetRoleEquipRedpoint();
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            GlobalTimeEvent.Instance.secondEvent -= UpdateSecond;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= UpdatePlayerLv;
            LocalSave.DeleteKey(RecordKnapsackTitle);
            cacheMapId = 0;
            playerPackDict.Clear();
            itemDayUseCntDict.Clear();
            itemSumUseCntDict.Clear();
            itemGUIDDict.Clear();
            showDropItem = false;
            isPlayBetterEquipEffect = false;
            equipAttrActiveDict.Clear();
            colorType = EquipColorType.Purple;
            lvType = EquipLvType.All;
            starType = EquipStarType.None;
            decomposeLv = 1;
            decomposeExp = 0;
            decomposeProgress = 0;
            isAutoDecompose = false;
        }
 
        public void OnAfterPlayerDataInitialize()
        {
 
        }
 
        public void OnPlayerLoginOk()
        {
            ItemOperateUtility.Instance.RequestWarehouseData();
            SetPlayerAttrActiveRedPoint();
            EquipDecomRedCtrl();
            RoleEquipLocalSave = StringUtility.Contact("RoleEquipLocalSave", PlayerDatas.Instance.baseData.PlayerID);
            StrengthAttrShift_RecordKey = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "StrengthAttrShift");
            if (LocalSave.GetIntArray(RoleEquipLocalSave) != null)
            {
                LocalSavePlaceArray = LocalSave.GetIntArray(RoleEquipLocalSave).ToList();
            }
            else
            {
                LocalSavePlaceArray = null;
            }
            GlobalTimeEvent.Instance.secondEvent += UpdateSecond;
            PlayerDatas.Instance.PlayerDataRefreshInfoEvent += UpdatePlayerLv;
            isUpdatePlayerLv = true;
        }
 
        public override void UnInit()
        {
 
        }
 
        PackModelInterface _modelInterface;
        PackModelInterface modelInterface {
            get { return _modelInterface ?? (_modelInterface = ModelCenter.Instance.GetModel<PackModelInterface>()); }
        }
 
        ItemTipsModel _itemTipsModel;
        ItemTipsModel itemTipsModel {
            get {
                return _itemTipsModel ?? (_itemTipsModel = ModelCenter.Instance.GetModel<ItemTipsModel>());
            }
        }
 
        public event Action<PackType> RefreshPackAct; //刷新整个背包数据
        public event Action<PackType, int, int> RefreshItemCountAct; //(单个)最新物品数量刷新(旧的弃用)在得到新物品、物品数量的改变,清理该物品时均会触发 int 位置索引 int物品id
        public event Action<PackType> GridRefreshEvent; //背包空格刷新
        public event Action<PackType, int, int> ItemCntAddAct; //物品数量增加 int 位置索引 int物品id
        public event Action<PackType, int, int> ItemCntReduceAct; //物品数量减少的改变 int 位置索引 int物品id
        public event Action<int, int> UseItemSuccessAct; //物品使用成功 int 位置索引 int物品id
 
        public event Action<int> RefreshItemDayUseCntAct;  //刷新物品每日使用数量
        public event Action<int> RefreshItemSumUseCntAct;  //刷新物品总使用数量
 
        public bool isPlayBetterEquipEffect { get; set; }  //整理背包时是否播放特效
 
        #region 接收服务端数据
        public bool showDropItem { get; private set; }
        private Dictionary<PackType, SinglePackModel> playerPackDict = new Dictionary<PackType, SinglePackModel>();
        private Dictionary<string, ItemModel> itemGUIDDict = new Dictionary<string, ItemModel>();
        public void SetPlayerPackModel(H0725_tagRolePackRefreshEx packInfo)
        {
            showDropItem = false;
            SetLookIndex(null);
            PackType type = (PackType)packInfo.PackType;
            if (!playerPackDict.ContainsKey(type))
            {
                SinglePackModel packModel = new SinglePackModel(type);
                playerPackDict.Add(type, packModel);
            }
 
            if (isPlayBetterEquipEffect)
            {
                modelInterface.itemModelDict.Clear();
            }
            for (int i = 0; i < packInfo.ItemCount; i++)
            {
 
                ItemInfo itemInfo = new ItemInfo();
                itemInfo.ItemID = (int)packInfo.ItemInfo[i].ItemID;
                itemInfo.ItemPlace = packInfo.ItemInfo[i].ItemPlace;
                itemInfo.ItemCount = packInfo.ItemInfo[i].ItemCount;
                itemInfo.RemainHour = (int)packInfo.ItemInfo[i].RemainHour;
                itemInfo.IsBind = packInfo.ItemInfo[i].IsBind;
                itemInfo.IsSuite = packInfo.ItemInfo[i].IsSuite;
                itemInfo.UserData = packInfo.ItemInfo[i].UserData;
                itemInfo.IsLocked = packInfo.ItemInfo[i].IsLocked;
                itemInfo.ItemGUID = packInfo.ItemInfo[i].ItemGUID;
                playerPackDict[type].UpdateItem(itemInfo);
 
                if (isPlayBetterEquipEffect)
                {
                    modelInterface.SetBagSortBetterEquipList(GetItemModelByGUID(itemInfo.ItemGUID));
                }
            }
 
            if (RefreshPackAct != null)
            {
                RefreshPackAct(type);
            }
 
            RedPointPackCtrl(type);
        }
 
        public void SetItemModel(H0704_tagRolePackRefresh item)
        {
            isPlayBetterEquipEffect = false;
            SetLookIndex(null);
            showDropItem = true;
            PackType type = (PackType)item.PackType;
            if (!playerPackDict.ContainsKey(type))
            {
                SinglePackModel packModel = new SinglePackModel(type);
                playerPackDict.Add(type, packModel);
            }
 
            ItemInfo itemInfo = new ItemInfo();
 
            itemInfo.ItemID = (int)item.ItemID;
            itemInfo.ItemPlace = item.ItemPlace;
            itemInfo.ItemCount = item.ItemCount;
            itemInfo.RemainHour = (int)item.RemainHour;
            itemInfo.IsBind = item.IsBind;
            itemInfo.IsSuite = item.IsSuite;
            itemInfo.UserData = item.UserData;
            itemInfo.IsLocked = item.IsLocked;
            itemInfo.ItemGUID = item.ItemGUID;
            playerPackDict[type].UpdateItem(itemInfo);
 
            DebugEx.Log("Add:" + item.ItemGUID);
            if (RefreshItemCountAct != null)
            {
                RefreshItemCountAct(type, itemInfo.ItemPlace, itemInfo.ItemID);
            }
 
            if (ItemCntAddAct != null)
            {
                ItemCntAddAct(type, itemInfo.ItemPlace, itemInfo.ItemID);
            }
            if (type == PackType.Equip)
            {
                SetPlayerAttrActiveRedPoint();
            }
            RedPointPackCtrl(type);
            EquipDecomRedCtrl();
        }
 
        public void SetOpenGridCount(H0724_tagRolePackCanUseCount useCount)
        {
            PackType type = (PackType)useCount.PackType;
            if (!playerPackDict.ContainsKey(type))
            {
                SinglePackModel packModel = new SinglePackModel(type);
                playerPackDict.Add(type, packModel);
            }
 
            playerPackDict[type].SetOpenGridCount(useCount.CanUseCount);
 
            if (GridRefreshEvent != null)
            {
                GridRefreshEvent(type);
            }
 
            RedPointPackCtrl(type);
        }
 
        public void RefreshItemCount(H0707_tagItemCountRefresh refresh)
        {
            SetLookIndex(null);
            isPlayBetterEquipEffect = false;
            PackType type = (PackType)refresh.PackType;
            SinglePackModel singlePack = null;
            playerPackDict.TryGetValue(type, out singlePack);
            if (singlePack != null)
            {
                ItemModel itemModel = singlePack.GetItemByIndex(refresh.ItemIndex);
                if (itemModel != null)
                {
                    bool isAddItemCount = false;
                    if (refresh.ItemCount > itemModel.count)
                    {
                        isAddItemCount = true;
                    }
                    itemModel.RefreshItemCount(refresh.ItemCount);
 
                    if (isAddItemCount)
                    {
                        if (ItemCntAddAct != null)
                        {
                            ItemCntAddAct(type, itemModel.itemPlace, itemModel.itemId);
                        }
                        modelInterface.GetPreciousItem(itemModel);
                        modelInterface.RefreshPickItem(type, itemModel.guid);
                    }
                    else
                    {
                        if (ItemCntReduceAct != null)
                        {
                            ItemCntReduceAct(type, itemModel.itemPlace, itemModel.itemId);
                        }
                    }
 
                    if (RefreshItemCountAct != null)
                    {
                        RefreshItemCountAct(type, itemModel.itemPlace, itemModel.itemId);
                    }
                }
            }
 
 
        }
 
        public void ClearPackModel(H0711_tagClearItemPack clearPack)
        {
            PackType type = (PackType)clearPack.PackIndex;
            SinglePackModel singlePack = null;
            playerPackDict.TryGetValue(type, out singlePack);
            if (singlePack != null)
            {
                singlePack.ClearPackModel();
            }
 
            if (type == PackType.Equip)
            {
                SetPlayerAttrActiveRedPoint();
            }
            //if (RefreshPackAct != null)
            //{
            //    RefreshPackAct(type);
            //}
 
            //RedPointPackCtrl(type);
        }
 
        public void ClearItemModel(H0709_tagClearItem clearItem)
        {
            isPlayBetterEquipEffect = false;
            SetLookIndex(null);
            PackType type = (PackType)clearItem.PackType;
 
            SinglePackModel singlePack = null;
            playerPackDict.TryGetValue(type, out singlePack);
            string guid = "";
            if (singlePack != null)
            {
                ItemModel itemModel = singlePack.GetItemByIndex(clearItem.ItemIndex);
                guid = itemModel.guid;
                int itemId = itemModel.itemId;
                DeleteItemDictByGUID(type, itemModel.guid);
                singlePack.ClearItemModelByIndex(clearItem.ItemIndex);
                if (RefreshItemCountAct != null)
                {
                    RefreshItemCountAct(type, clearItem.ItemIndex, itemId);
                }
 
                if (ItemCntReduceAct != null)
                {
                    ItemCntReduceAct(type, clearItem.ItemIndex, itemId);
                }
            }
            if (type == PackType.Equip)
            {
                SetPlayerAttrActiveRedPoint();
            }
            RedPointPackCtrl(type);
            EquipDecomRedCtrl();
 
            if (GetItemModelByGUID(guid) == null)
            {
                KnapsackTimeCDMgr.Instance.UnRegister(guid);
            }
 
        }
 
        public void PackResetOk(H0316_tagPackResetOK packreset)
        {
            modelInterface.isPackResetOk = true;
        }
 
        public void UseItemSuccess(H0706_tagUseItemSuccess success)
        {
            isPlayBetterEquipEffect = false;
            SetLookIndex(null);
            if (success.PlayerID != PlayerDatas.Instance.baseData.PlayerID)
                return;
 
            ItemConfig itemConfig = ItemConfig.Get((int)success.ItemID);
            MakeUseItemSuccess(success.ItemIndex, (int)success.ItemID);
 
            switch (success.ItemID)
            {
                case 221:
                    if (WindowCenter.Instance.IsOpen<KnapSackWin>())
                    {
                        WindowCenter.Instance.Close<KnapSackWin>();
                    }
                    break;
            }
 
            if (UseItemSuccessAct != null)
            {
                UseItemSuccessAct(success.ItemIndex, (int)success.ItemID);
            }
        }
 
        private void MakeUseItemSuccess(int index, int id)
        {
            ItemConfig itemConfig = ItemConfig.Get(id);
            if (itemConfig.CDType != 0)
            {
                float configCdTime = (float)Math.Round((double)itemConfig.CDTime / 1000, 1);
                List<ItemModel> modellist = null;
                GetSinglePackModel(PackType.Item).GetItemCountByType((int)ItemType.Buff, out modellist);
                for (int i = 0; i < modellist.Count; i++)
                {
                    if (modellist[i].itemId == 901
                        || modellist[i].itemId == 902
                        || modellist[i].itemId == 903
                        || modellist[i].itemId == 904)
                    {
                        KnapsackTimeCDMgr.Instance.Register(modellist[i].guid, modellist[i].itemId, configCdTime);
                        break;
                    }
                }
 
            }
        }
 
        public void SetItemGUIDDict(ItemModel itemModel)
        {
            if (!itemGUIDDict.ContainsKey(itemModel.guid))
            {
                itemGUIDDict.Add(itemModel.guid, itemModel);
                GetItemEventCtrl(itemModel);
            }
            else
            {
                PackType prePack = itemGUIDDict[itemModel.guid].packType;
                itemGUIDDict[itemModel.guid] = itemModel;
                if (prePack != itemModel.packType)
                {
                    GetItemEventCtrl(itemModel);
                }
            }
        }
 
        public void DeleteItemDictByGUID(PackType type, string guid)
        {
 
            if (itemGUIDDict.ContainsKey(guid))
            {
                if (itemGUIDDict[guid].packType == type)
                {
                    itemGUIDDict.Remove(guid);
                }
            }
        }
 
        /// <summary>
        /// 物品每日使用的次数
        /// </summary>
        private Dictionary<int, int> itemDayUseCntDict = new Dictionary<int, int>();
        public void SetItemUseCnt(HA809_tagMCItemDayUseCntInfo useCntInfo)
        {
            for (int i = 0; i < useCntInfo.Count; i++)
            {
                int itemId = (int)useCntInfo.ItemUseCntList[i].ItemID;
                int cnt = useCntInfo.ItemUseCntList[i].UseCnt;
                if (!itemDayUseCntDict.ContainsKey(itemId))
                {
                    itemDayUseCntDict.Add(itemId, cnt);
                }
                else
                {
                    itemDayUseCntDict[itemId] = cnt;
                }
 
                if (RefreshItemDayUseCntAct != null)
                {
                    RefreshItemDayUseCntAct(itemId);
                }
 
            }
        }
 
        private Dictionary<int, int> itemSumUseCntDict = new Dictionary<int, int>();
        public void SetItemSumUseCnt(HA339_tagMCAttrFruitEatCntList useCntInfo)
        {
            for (int i = 0; i < useCntInfo.count; i++)
            {
                int itemId = (int)useCntInfo.EatCntList[i].ItemID;
                int cnt = useCntInfo.EatCntList[i].EatCnt;
                if (!itemSumUseCntDict.ContainsKey(itemId))
                {
                    itemSumUseCntDict.Add(itemId, cnt);
                }
                else
                {
                    itemSumUseCntDict[itemId] = cnt;
                }
 
                if (RefreshItemSumUseCntAct != null)
                {
                    RefreshItemSumUseCntAct(itemId);
                }
 
            }
        }
 
        #region 接收全身星级,强化属性激活
        public event Action RefreshActiveAttrAct;
        private Dictionary<int, int> equipAttrActiveDict = new Dictionary<int, int>();
        public void SetPlayerEquipAttrActiveInfo(HA317_tagMCAllEquipAttrActiveInfo info)
        {
            for (int i = 0; i < info.Count; i++)
            {
                int type = info.ActiveInfo[i].Type;
                int cnt = (int)info.ActiveInfo[i].Cnt;
                if (type == 1)
                {
                    cnt = RoleEquipStarsConfig.GetActiveStars(cnt);
                }
                if (!equipAttrActiveDict.ContainsKey(type))
                {
                    equipAttrActiveDict.Add(type, cnt);
                }
                else
                {
                    equipAttrActiveDict[type] = cnt;
                }
            }
 
            if (RefreshActiveAttrAct != null)
            {
                RefreshActiveAttrAct();
            }
 
            SetPlayerAttrActiveRedPoint();
        }
 
        public void SendActiveAttrQuest(int type, int cnt)
        {
            CA503_tagCMActiveAllEquipAttr equipAttr = new CA503_tagCMActiveAllEquipAttr();
            equipAttr.Type = (byte)type;
            equipAttr.Cnt = (uint)cnt;
            GameNetSystem.Instance.SendInfo(equipAttr);
        }
 
        public int GetActiveCntByType(int type)
        {
            int cnt = 0;
            equipAttrActiveDict.TryGetValue(type, out cnt);
            return cnt;
        }
 
        public List<int> GetAddAttrIdByStars(int _curStarsCount, out int starsCount)
        {
            starsCount = 0;
            List<int> activeIdlist = new List<int>();
            List<int> addIdlist = new List<int>();
            List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist();
            if (starslist == null || starslist.Count < 1) return addIdlist;
            int activeStars = GetActiveCntByType(1);
            int realActiveStars = _curStarsCount > activeStars ? activeStars : _curStarsCount;
            for (int i = starslist.Count - 1; i > -1; i--)
            {
                if (i == 0 && starslist[i] > realActiveStars)
                {
                    realActiveStars = 0;
                    break;
                }
                if (starslist[i] <= realActiveStars)
                {
                    realActiveStars = starslist[i];
                    break;
                }
            }
 
            RoleEquipStarsConfig activeStarsConfig = RoleEquipStarsConfig.GetEquipStarsModel(realActiveStars);
            if (activeStarsConfig != null)
            {
                for (int i = 0; i < activeStarsConfig.attType.Length; i++)
                {
                    activeIdlist.Add(activeStarsConfig.attType[i]);
                }
            }
            List<RoleEquipStarsConfig> starsConfigs = RoleEquipStarsConfig.GetValues();
            for (int i = 0; i < starsConfigs.Count; i++)
            {
                bool isAddId = false;
                RoleEquipStarsConfig starsConfig = starsConfigs[i];
                if (realActiveStars < starsConfig.countNeed)
                {
                    for (int j = 0; j < starsConfig.attType.Length; j++)
                    {
                        int attrId = starsConfig.attType[j];
                        if (!activeIdlist.Contains(attrId))
                        {
                            isAddId = true;
                            addIdlist.Add(attrId);
                        }
                    }
                }
                if (isAddId)
                {
                    starsCount = starsConfig.countNeed;
                    break;
                }
 
            }
            return addIdlist;
        }
        #endregion
 
        #endregion
 
        #region 玩家装备特殊逻辑
        public int fairyRedPointLvlimt { get; private set; }
        public int wingsRedpointLvlimt { get; private set; }
        public int fairyGetPathId { get; private set; }
        public Dictionary<int, int> wingsGetPathIdDict { get; private set; }
        public Dictionary<int, List<int>> dungeonUseDict { get; private set; }
        public void ParseConfig()
        {
            FuncConfigConfig funcConfig = FuncConfigConfig.Get("WingYuPeiHQTJ");
            fairyRedPointLvlimt = int.Parse(funcConfig.Numerical1);
            wingsRedpointLvlimt = int.Parse(funcConfig.Numerical2);
            fairyGetPathId = int.Parse(funcConfig.Numerical3);
            wingsGetPathIdDict = ConfigParse.GetDic<int, int>(funcConfig.Numerical4);
            FuncConfigConfig copyItemBulletWindow = FuncConfigConfig.Get("CopyItemBulletWindow");
            JsonData copyWinData = JsonMapper.ToObject(copyItemBulletWindow.Numerical1);
            dungeonUseDict = new Dictionary<int, List<int>>();
            foreach (var dungeonId in copyWinData.Keys)
            {
                List<int> idlist = new List<int>();
                dungeonUseDict.Add(int.Parse(dungeonId), idlist);
                if (copyWinData[dungeonId].IsArray)
                {
                    JsonData useData = copyWinData[dungeonId];
                    for (int i = 0; i < useData.Count; i++)
                    {
                        idlist.Add(int.Parse(useData[i].ToString()));
                    }
                }
            }
        }
 
        public int GetRoleEquipPathId(int equipPlace)
        {
            int playerJob = PlayerDatas.Instance.baseData.Job;
            switch ((RoleEquipType)equipPlace)
            {
                case RoleEquipType.FairyCan:
                case RoleEquipType.FairyCan2:
                    return fairyGetPathId;
                case RoleEquipType.Wing:
                    if (wingsGetPathIdDict.ContainsKey(playerJob))
                    {
                        return wingsGetPathIdDict[playerJob];
                    }
                    break;
            }
            return 0;
        }
 
        private void UpdateSecond()
        {
            if (isUpdatePlayerLv)
            {
                for (int i = 1; i < 13; i++)
                {
                    CheckRoleEquipByPlace((RoleEquipType)i);
                }
                UpdateRoleEquipRed();
                isUpdatePlayerLv = false;
            }
        }
 
        private void UpdatePlayerLv(PlayerDataRefresh type)
        {
            if (type != PlayerDataRefresh.LV) return;
 
            isUpdatePlayerLv = true;
        }
 
        public bool IsShowAddEquipByPlace(int equipPlace)
        {
            switch ((RoleEquipType)equipPlace)
            {
                case RoleEquipType.FairyCan:
                case RoleEquipType.FairyCan2:
                    if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt)
                    {
                        return true;
                    }
                    break;
                case RoleEquipType.Wing:
                    if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt)
                    {
                        return true;
                    }
                    break;
            }
            return false;
        }
 
        public void CheckRoleEquipByPlace(RoleEquipType equipType)
        {
            ItemModel itemModel = GetItemModelByIndex(PackType.Equip, (int)equipType);
            switch (equipType)
            {
                case RoleEquipType.FairyCan:
                case RoleEquipType.FairyCan2:
                    if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && itemModel != null)
                    {
                        SetRoleEquipLocalSave((int)equipType);
                    }
                    break;
                case RoleEquipType.Wing:
                    if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && itemModel != null)
                    {
                        SetRoleEquipLocalSave((int)equipType);
                    }
                    break;
 
            }
        }
 
        public void SetRoleEquipLocalSave(int equipPlace, bool isRedState = false)
        {
            if (isRedState && roleEquipRedDict[equipPlace].state == RedPointState.None) return;
 
            if (LocalSavePlaceArray != null)
            {
                if (!LocalSavePlaceArray.Contains(equipPlace))
                {
                    LocalSavePlaceArray.Add(equipPlace);
                    LocalSave.SetIntArray(RoleEquipLocalSave, LocalSavePlaceArray.ToArray());
                }
            }
            else
            {
                LocalSavePlaceArray = new List<int>();
                LocalSavePlaceArray.Add(equipPlace);
                LocalSave.SetIntArray(RoleEquipLocalSave, LocalSavePlaceArray.ToArray());
            }
        }
        #endregion
 
        private void GetItemEventCtrl(ItemModel itemModel)
        {
            if (showDropItem)
            {
                bool isOverdue = false;
                if (itemModel.config.ExpireTime > 0)
                {
                    ItemCDCool cool = KnapsackTimeCDMgr.Instance.GetItemCoolById(itemModel.guid);
                    switch ((EquipReduceType)itemModel.config.EndureReduceType)
                    {
                        case EquipReduceType.Def_EquipReduceType_Time:
                            List<int> itemEffectTime = itemModel.GetUseDataModel((int)ItemUseDataKey.createTime);
                            if (itemEffectTime != null && itemEffectTime[0] != 0)
                            {
                                if (cool == null || cool.GetRemainTime() <= 0)
                                {
                                    isOverdue = true;
                                }
                            }
                            break;
 
                        case EquipReduceType.Def_EquipReduceType_RTimeItem:
                            if (cool == null || cool.GetRemainTime() <= 0)
                            {
                                isOverdue = true;
                            }
                            break;
 
                    }
                }
                if (!isOverdue)
                {
                    modelInterface.GetPreciousItem(itemModel);
                    modelInterface.OnGetEquip(itemModel);
                    modelInterface.RefreshPickItem(itemModel.packType, itemModel.guid);
                }
            }
 
        }
 
        /// <summary>
        /// 得到某个包裹的所有数据
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public SinglePackModel GetSinglePackModel(PackType type)
        {
            SinglePackModel singlePack = null;
            playerPackDict.TryGetValue(type, out singlePack);
            return singlePack;
        }
 
        public ItemModel GetItemModelByGUID(string guid)
        {
            ItemModel itemModel = null;
            itemGUIDDict.TryGetValue(guid, out itemModel);
            return itemModel;
        }
 
        public ItemModel GetItemModelByIndex(PackType type, int index)
        {
            switch (type)
            {
                case PackType.JadeDynastyEquip:
                    if (index >= 121)
                    {
                        index = index - 121;
                    }
                    break;
            }
 
            ItemModel itemModel = null;
            if (playerPackDict.ContainsKey(type))
            {
                itemModel = playerPackDict[type].GetItemByIndex(index);
            }
            return itemModel;
        }
 
        public List<ItemModel> GetItemModelsById(PackType type, int id)
        {
            List<ItemModel> itemModels = null;
            if (playerPackDict.ContainsKey(type))
            {
                var singlePack = playerPackDict[type];
                singlePack.GetItemCountByID(id, out itemModels);
            }
            return itemModels;
        }
 
        public string GetItemGUIDByID(int itemId)
        {
            string guid = string.Empty;
 
            foreach (var key in itemGUIDDict.Keys)
            {
                if (itemGUIDDict[key].itemId == itemId)
                {
                    guid = key;
                    return guid;
                }
            }
 
            return guid;
        }
 
        /// <summary>
        /// 得到ID相同的物品数量
        /// </summary>
        /// <param name="type"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public int GetItemCountByID(PackType type, int id)
        {
            int count = 0;
            SinglePackModel singlePack = GetSinglePackModel(type);
            if (singlePack != null)
            {
                count = singlePack.GetItemCountByID(id);
            }
 
            return count;
        }
 
        public bool CheckBagIsPutNewItem(int itemId)
        {
            SinglePackModel singlePack = GetSinglePackModel(PackType.Item);
            if (singlePack == null) return false;
            List<ItemModel> modellist = null;
            int haveCnt = singlePack.GetItemCountByID(itemId, out modellist);
            ItemConfig config = ItemConfig.Get(itemId);
            int sumPutCnt = config.PackCount * modellist.Count;
            if (sumPutCnt > haveCnt)
            {
                return true;
            }
            else if (GetReaminGridCount(PackType.Item) > 0)
            {
                return true;
            }
 
            return false;
        }
 
        public int GetReaminGridCount(PackType type)
        {
            int count = 0;
            SinglePackModel singlePack = GetSinglePackModel(type);
            if (singlePack != null)
            {
                count = singlePack.GetRemainGridCount();
            }
 
            return count;
        }
 
        public bool TryGetShareNumItem(int itemId, out List<int> idlist)
        {
            idlist = new List<int>();
            foreach (var list in ShareUseCntItemDict.Values)
            {
                if (list.Contains(itemId))
                {
                    idlist = list;
                    return true;
                }
            }
            return false;
        }
 
        /// <summary>
        /// 得到物品今日使用次数
        /// </summary>
        /// <param name="itemId"></param>
        /// <returns></returns>
        public int GetDayUseCntByID(int itemId)
        {
            int useCnt = 0;
            List<int> shareIdlist = null;
            bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
            if (isShare)
            {
                foreach (var id in shareIdlist)
                {
                    int singleUseCnt = 0;
                    itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
                    useCnt += singleUseCnt;
                }
            }
            else
            {
                itemDayUseCntDict.TryGetValue(itemId, out useCnt);
            }
            return useCnt;
        }
 
        /// <summary>
        /// 得到物品总使用次数
        /// </summary>
        /// <param name="itemId"></param>
        /// <returns></returns>
        public int GetSumUseCntByID(int itemId)
        {
            int useCnt = 0;
            List<int> shareIdlist = null;
            bool isShare = TryGetShareNumItem(itemId, out shareIdlist);
            if (isShare)
            {
                foreach (var id in shareIdlist)
                {
                    int singleUseCnt = 0;
                    itemDayUseCntDict.TryGetValue(id, out singleUseCnt);
                    useCnt += singleUseCnt;
                }
            }
            else
            {
                itemSumUseCntDict.TryGetValue(itemId, out useCnt);
            }
            return useCnt;
        }
 
        public void SetWashAttrPointModel(string guid)
        {
            ItemModel itemModel = GetItemModelByGUID(guid);
            if (itemModel == null) return;
 
            WashAttrPointWin.itemModel = itemModel;
            WindowCenter.Instance.Open<WashAttrPointWin>();
        }
 
        #region 红点逻辑判断
        private Dictionary<int, Redpoint> roleEquipRedDict = new Dictionary<int, Redpoint>();
        public void SetRoleEquipRedpoint()
        {
            roleEquipRedDict.Clear();
            for (int i = 1; i < 13; i++)
            {
                int redKey = 102011003 + i;
                Redpoint redpoint = new Redpoint(MainRedDot.RedPoint_BagFuncKey, redKey);
                roleEquipRedDict.Add(i, redpoint);
            }
        }
 
        public void UpdateRoleEquipRed()
        {
            foreach (var key in roleEquipRedDict.Keys)
            {
                ItemModel itemModel = GetItemModelByIndex(PackType.Equip, key);
                switch ((RoleEquipType)key)
                {
                    case RoleEquipType.FairyCan:
                        if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key)
                           && itemModel == null && roleEquipRedDict[(int)RoleEquipType.FairyCan2].state == RedPointState.None)
                        {
                            roleEquipRedDict[key].state = RedPointState.Simple;
                        }
                        else
                        {
                            roleEquipRedDict[key].state = RedPointState.None;
                        }
                        break;
                    case RoleEquipType.FairyCan2:
                        if (PlayerDatas.Instance.baseData.LV >= fairyRedPointLvlimt && !TryGetRoleEquipLocalSave(key)
                            && itemModel == null && roleEquipRedDict[(int)RoleEquipType.FairyCan].state == RedPointState.None)
                        {
                            roleEquipRedDict[key].state = RedPointState.Simple;
                        }
                        else
                        {
                            roleEquipRedDict[key].state = RedPointState.None;
                        }
                        break;
                    case RoleEquipType.Wing:
                        if (PlayerDatas.Instance.baseData.LV >= wingsRedpointLvlimt && !TryGetRoleEquipLocalSave(key)
                          && itemModel == null)
                        {
                            roleEquipRedDict[key].state = RedPointState.Simple;
                        }
                        else
                        {
                            roleEquipRedDict[key].state = RedPointState.None;
                        }
                        break;
                    default:
                        roleEquipRedDict[key].state = RedPointState.None;
                        break;
                }
            }
        }
 
        private bool TryGetRoleEquipLocalSave(int equipPlace)
        {
            if (LocalSavePlaceArray != null)
            {
                for (int i = 0; i < LocalSavePlaceArray.Count; i++)
                {
                    if (equipPlace == 9 || equipPlace == 10)
                    {
                        if (LocalSavePlaceArray[i] == 9 || LocalSavePlaceArray[i] == 10)
                        {
                            return true;
                        }
                    }
                    else
                    {
                        if (LocalSavePlaceArray[i] == equipPlace)
                        {
                            return true;
                        }
                    }
 
                }
            }
            return false;
        }
 
        public const int ITEMPACK_REDKEY = 102011003;
        public Redpoint redpointItemPack = new Redpoint(MainRedDot.RedPoint_BagFuncKey, ITEMPACK_REDKEY);
        private void RedPointPackCtrl(PackType type)
        {
            SinglePackModel singlePack = GetSinglePackModel(type);
            if (singlePack == null) return;
 
            switch (type)
            {
                case PackType.Item:
                    if (singlePack.GetRemainGridCount() <= 0)
                    {
                        redpointItemPack.state = RedPointState.Full;
                        SysNotifyMgr.Instance.ShowTip("BagFull");
                    }
                    else
                    {
                        redpointItemPack.state = RedPointState.None;
                    }
                    break;
 
                case PackType.Warehouse:
                    if (singlePack.GetRemainGridCount() <= 0)
                    {
                        MainRedDot.Instance.redPointDepotFunc.state = RedPointState.Full;
                    }
                    else
                    {
                        MainRedDot.Instance.redPointDepotFunc.state = RedPointState.None;
                    }
                    break;
            }
        }
 
        //public const int PLAYERSUMSTR_REDKEY = 102011001;
        public const int PLAYERSUMSTAR_REDKEY = 102011002;
        // public Redpoint redpointSTR = new Redpoint(MainRedDot.RedPoint_BagFuncKey, PLAYERSUMSTR_REDKEY);
        public Redpoint redpointSTAR = new Redpoint(MainRedDot.RedPoint_BagFuncKey, PLAYERSUMSTAR_REDKEY);
 
        public event Action<int, bool> RefreshAttrActiveAct;
        public void SetPlayerAttrActiveRedPoint()
        {
            if (IsActiveStarAttr())
            {
 
                if (redpointSTAR.state != RedPointState.Simple)
                {
                    redpointSTAR.state = RedPointState.Simple;
                    if (RefreshAttrActiveAct != null)
                    {
                        RefreshAttrActiveAct(1, true);
                    }
                }
            }
            else
            {
                if (redpointSTAR.state != RedPointState.None)
                {
                    redpointSTAR.state = RedPointState.None;
                    if (RefreshAttrActiveAct != null)
                    {
                        RefreshAttrActiveAct(1, false);
                    }
                }
            }
        }
 
        public bool IsActiveStarAttr()
        {
            List<int> starslist = RoleEquipStarsConfig.GetEquipStarsCntlist();
            SinglePackModel singlePack = GetSinglePackModel(PackType.Equip);
            if (singlePack == null || starslist == null || starslist.Count < 1) return false;
 
            Dictionary<int, ItemModel> _itemDict = singlePack.GetAllItems();
            int playerSumStars = 0;
            foreach (var model in _itemDict.Values)
            {
                playerSumStars += model.config.StarLevel;
            }
            int cnt = GetActiveCntByType(1);
            int nextActiveStars = 0;
            for (int i = 0; i < starslist.Count; i++)
            {
                if (cnt == 0)
                {
                    nextActiveStars = starslist[0];
                    break;
                }
                else
                {
                    if (starslist[i] == cnt)
                    {
                        if (i < starslist.Count - 1)
                        {
                            nextActiveStars = starslist[i + 1];
                        }
                        break;
                    }
                }
            }
 
            if (nextActiveStars != 0 && playerSumStars >= nextActiveStars)
            {
                return true;
            }
 
            return false;
        }
 
        public bool IsActiveSTRAttr()
        {
            List<string> strenlist = ItemPlusSumAttrConfig.GetKeys();
            if (strenlist == null || strenlist.Count < 1) return false;
            int playerSumSTR = 0;
            Dictionary<int, EquipmentInitialization> strenInfoDict = ModelCenter.Instance.GetModel<PlayerStrengthengDatas>()._EqInfo;
            foreach (var value in strenInfoDict.Values)
            {
                ItemModel itemModel = GetItemModelByIndex(PackType.Equip, value.EquipIndex);
                if (itemModel != null)
                {
                    playerSumSTR += value.EquipPartStarLV;
                }
            }
            int cnt = GetActiveCntByType(0);
            int nextActiveSTR = 0;
            for (int i = 0; i < strenlist.Count; i++)
            {
                if (cnt == 0)
                {
                    nextActiveSTR = int.Parse(strenlist[0]);
                    break;
                }
                else
                {
                    if (int.Parse(strenlist[i]) == cnt)
                    {
                        if (i < strenlist.Count - 1)
                        {
                            nextActiveSTR = int.Parse(strenlist[i + 1]);
                        }
                        break;
                    }
                }
            }
 
            if (nextActiveSTR != 0 && playerSumSTR >= nextActiveSTR)
            {
                return true;
            }
 
            return false;
        }
 
        public const int EquipDecompose_RedKey = 10205;
        public Redpoint redpointEquipDecom = new Redpoint(MainRedDot.RedPoint_MainPackKey, EquipDecompose_RedKey);
        public void EquipDecomRedCtrl()
        {
            if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.EquipDecompose)) return;
 
            if (GetCanDevourModellist() != null && GetCanDevourModellist().Count >= minDevourEquipNum)
            {
                redpointEquipDecom.state = RedPointState.Simple;
            }
            else
            {
                redpointEquipDecom.state = RedPointState.None;
            }
        }
        #endregion
 
        #region 查看某个位置的物品
        public event Action lookEquipEvent;
        private int _lookLineIndex = -1;
        public int lookLineIndex { get { return _lookLineIndex; } private set { _lookLineIndex = value; } }
 
        public string lookItemGUID { get; private set; }
 
        public void SetLookIndex(string guid, int singleRowCount = 5)
        {
            if (string.IsNullOrEmpty(guid) || guid == "")
            {
                lookLineIndex = -1;
                lookItemGUID = "";
            }
            else
            {
                int index = GetItemModelByGUID(guid).itemPlace;
                lookLineIndex = index / singleRowCount;
                lookItemGUID = guid;
            }
 
            if (lookEquipEvent != null)
            {
                lookEquipEvent();
            }
 
        }
 
        public event Action RefreshBagEvent;
        public void RefreshBagInfo()
        {
            if (RefreshBagEvent != null)
            {
                RefreshBagEvent();
            }
        }
        #endregion
 
        public void SetJumpToOneKeySell(Transform parent)
        {
            var goEffect = AchievementGuideEffectPool.Require(1);
            goEffect.transform.SetParentEx(parent, Vector3.zero, Quaternion.identity, Vector3.one);
            AchievementGoto.guideAchievementId = 0;
        }
 
        #region 物品使用快捷提示
 
        private int cacheMapId = 0;
        public event Action<PackType, string> itemUseAct;
        private Dictionary<int, int> itemUseTypeDict = new Dictionary<int, int>(); //key SkillTypeID,value 使用物品的ID
        private void OnStageLoadFinish()
        {
            itemUseTypeDict.Clear();
            if (PlayerDatas.Instance.baseData.MapID == cacheMapId)
            {
                return;
            }
 
            cacheMapId = PlayerDatas.Instance.baseData.MapID;
            UpdateDungeonDanUse();
            UpdateDungeonUse();
            SinglePackModel singlePack = GetSinglePackModel(PackType.Item);
            foreach (int itemId in itemUseTypeDict.Values)
            {
                List<ItemModel> modellist = null;
                singlePack.GetItemCountByID(itemId, out modellist);
                if (modellist.Count > 0)
                {
                    ItemModel itemModel = modellist[0];
                    bool isExist = StatusMgr.Instance.IsExist(PlayerDatas.Instance.hero.ServerInstID, itemModel.config.AddSkill1);
                    DebugEx.Log("Buff是否存在" + isExist);
                    if (itemUseAct != null && !isExist)
                    {
                        itemUseAct(PackType.Item, itemModel.guid);
                    }
                }
            }
        }
 
        private void AddItemUseTypeDict(int id)
        {
            SkillConfig skillConfig = GetSkillConfig(id);
            int itemCount = GetItemCountByID(PackType.Item, id);
            if (skillConfig != null && itemCount > 0)
            {
                if (!itemUseTypeDict.ContainsKey(skillConfig.SkillTypeID))
                {
                    itemUseTypeDict.Add(skillConfig.SkillTypeID, id);
                }
                else
                {
                    SkillConfig preSkillConfig = GetSkillConfig(itemUseTypeDict[skillConfig.SkillTypeID]);
                    if (skillConfig.SkillLV > preSkillConfig.SkillLV)
                    {
                        itemUseTypeDict[skillConfig.SkillTypeID] = id;
                    }
                }
            }
        }
 
        private void UpdateDungeonDanUse()
        {
            int mapId = PlayerDatas.Instance.baseData.MapID;
            int[] useDrugs = GetDrugIDListByDungeonID(mapId);
            if (useDrugs == null) return;
 
            for (int i = 0; i < useDrugs.Length; i++)
            {
                int id = useDrugs[i];
                AddItemUseTypeDict(id);
            }
        }
 
        private void UpdateDungeonUse()
        {
            int mapId = PlayerDatas.Instance.baseData.MapID;
            if (!dungeonUseDict.ContainsKey(mapId)) return;
 
            List<int> useIdlist = dungeonUseDict[mapId];
            for (int i = 0; i < useIdlist.Count; i++)
            {
                int id = useIdlist[i];
                AddItemUseTypeDict(id);
            }
        }
 
        public SkillConfig GetSkillConfig(int itemId)
        {
            ItemConfig itemConfig = ItemConfig.Get(itemId);
            SkillConfig skillConfig = SkillConfig.Get(itemConfig.AddSkill1);
            return skillConfig;
        }
 
        public int GetDungeonIDByDrugID(int drugID)
        {
            int dungeonID = 0;
            DrugToDungeonDict.TryGetValue(drugID, out dungeonID);
            return dungeonID;
        }
 
        public int[] GetDrugIDListByDungeonID(int dungeonID)
        {
            int[] drugIDlist = null;
            DungeonToDrugDict.TryGetValue(dungeonID, out drugIDlist);
            return drugIDlist;
        }
        #endregion
 
        #region 判断物品是否达到使用上限
        public bool IsReachUseLimit(string guid, out ulong count)
        {
            count = 0;
            ItemModel itemModel = GetItemModelByGUID(guid);
            if (itemModel == null) return false;
 
            AttrFruitConfig fruitConfig = AttrFruitConfig.Get(itemModel.itemId);
            int haveUseCnt = GetDayUseCntByID(itemModel.itemId);
            int sumHaveUseCnt = GetSumUseCntByID(itemModel.itemId);
            count = (ulong)itemModel.count;
            bool isReach = false;
            int remainDayCnt = 0;
            if (itemModel.config.MaxSkillCnt > 0)
            {
                remainDayCnt = itemModel.config.MaxSkillCnt - haveUseCnt;
                if (itemModel.count > remainDayCnt)
                {
                    count = (ulong)remainDayCnt;
                }
 
            }
 
            int remainSumCnt = 0;
            if (fruitConfig != null)
            {
                remainSumCnt = fruitConfig.MaxUseCnt - sumHaveUseCnt;
                if (remainSumCnt <= remainDayCnt && itemModel.count > remainSumCnt)
                {
                    count = (ulong)remainSumCnt;
                }
            }
 
            if (count < (ulong)itemModel.count)
            {
                isReach = true;
            }
 
            return isReach;
        }
        #endregion
 
        #region 物品吞噬逻辑处理
        public EquipColorType colorType { get; private set; }
        public EquipLvType lvType { get; private set; }
        public EquipStarType starType { get; private set; }
        public event Action<EquipColorType> RefreshColorSelectAct;
        public event Action<EquipLvType> RefreshLvSelectAct;
        public event Action<EquipStarType> RefreshStarSelectAct;
        public event Action RefreshEquipDecomNumAct;
        public int[] defaultUnSelectlist { get; private set; }
 
        public bool ContainPreciousItem(List<ItemModel> itemModels, out int betterEquipCnt, out int preciousCnt)
        {
            betterEquipCnt = 0;
            preciousCnt = 0;
            if (itemModels == null) return false;
 
            for (int i = 0; i < itemModels.Count; i++)
            {
                if (defaultUnSelectlist.Contains(itemModels[i].itemId))
                {
                    preciousCnt += itemModels[i].count;
                }
                else if (modelInterface.IsFightUp(itemModels[i].itemId, itemModels[i].equipScore) == 1)
                {
                    betterEquipCnt += itemModels[i].count;
                }
            }
 
            if (betterEquipCnt > 0 || preciousCnt > 0)
            {
                return true;
            }
 
            return false;
        }
 
        public bool ContainTwoStarEquip(List<ItemModel> itemModels, out int twoStarEquipCnt)
        {
            twoStarEquipCnt = 0;
            if (itemModels == null) return false;
            for (int i = 0; i < itemModels.Count; i++)
            {
                if (itemModels[i].config.StarLevel >= 2 && itemModels[i].config.ItemColor >= (int)E_ItemColor.Orange)
                {
                    twoStarEquipCnt += itemModels[i].count;
                }
            }
            if (twoStarEquipCnt > 0)
            {
                return true;
            }
            return false;
        }
 
        public void SetColorSelect(EquipColorType type)
        {
            colorType = type;
            if (colorType == EquipColorType.None)
            {
                if (lvType != EquipLvType.None)
                {
                    SetLvSelect(EquipLvType.None);
                }
            }
            else
            {
                if (lvType == EquipLvType.None)
                {
                    SetLvSelect(EquipLvType.All);
                }
            }
 
            if (RefreshColorSelectAct != null)
            {
                RefreshColorSelectAct(type);
            }
            SendEquipDevourRecordQuest();
            EquipDecomRedCtrl();
        }
 
        public void SetLvSelect(EquipLvType type)
        {
            lvType = type;
            if (lvType == EquipLvType.None)
            {
                if (colorType != EquipColorType.None)
                {
                    SetColorSelect(EquipColorType.None);
                }
            }
            else
            {
                if (colorType == EquipColorType.None)
                {
                    SetColorSelect(EquipColorType.Purple);
                }
            }
            if (RefreshLvSelectAct != null)
            {
                RefreshLvSelectAct(type);
            }
            SendEquipDevourRecordQuest();
            EquipDecomRedCtrl();
        }
 
        public void SetStarSelect(EquipStarType type)
        {
            starType = type;
            if (RefreshStarSelectAct != null)
            {
                RefreshStarSelectAct(type);
            }
            SendEquipDevourRecordQuest();
            EquipDecomRedCtrl();
        }
 
        public List<int> devourPlacelist { get; private set; }
        public int MaxDevourEquipNum { get; private set; }
        public int minDevourEquipNum { get; private set; }
        public void SetDevourEquipPlace()
        {
            devourPlacelist = new List<int>();
            FuncConfigConfig funcConfig = FuncConfigConfig.Get("PetAbsorbType");
            int[] placeArray = ConfigParse.GetMultipleStr<int>(funcConfig.Numerical1);
            for (int i = 0; i < placeArray.Length; i++)
            {
                devourPlacelist.Add(placeArray[i]);
            }
            MaxDevourEquipNum = int.Parse(funcConfig.Numerical2);
            minDevourEquipNum = int.Parse(funcConfig.Numerical3);
        }
 
        List<ItemModel> devourModellist = new List<ItemModel>();
        List<ItemModel> orderDevourModellist = new List<ItemModel>();
        public List<ItemModel> GetDevourModellist()
        {
            SinglePackModel singlePack = GetSinglePackModel(PackType.Item);
            if (singlePack == null) return null;
 
            devourModellist.Clear();
            orderDevourModellist.Clear();
            foreach (var model in singlePack.GetAllItems().Values)
            {
                if (model.config.Type == 29)
                {
                    devourModellist.Add(model);
                }
                else
                {
                    if (devourPlacelist.Contains(model.config.EquipPlace))
                    {
                        if (model.config.ItemColor >= (int)E_ItemColor.Purple)
                        {
                            devourModellist.Add(model);
                        }
                    }
                }
 
            }
            orderDevourModellist.AddRange(devourModellist);
            orderDevourModellist.Sort(CompareByColor);
            return orderDevourModellist;
        }
 
        public int CompareByColor(ItemModel start, ItemModel next)
        {
            bool typeX = start.config.Type == 29 ? true : false;
            bool typeY = next.config.Type == 29 ? true : false;
 
            if (typeX.CompareTo(typeY) != 0) return -typeX.CompareTo(typeY);
 
            int colorX = start.config.ItemColor;
            int colorY = next.config.ItemColor;
            if (colorX.CompareTo(colorY) != 0) return colorX.CompareTo(colorY);
 
            int startIndex = devourModellist.IndexOf(start);
            int nextIndex = devourModellist.IndexOf(next);
            if (startIndex.CompareTo(nextIndex) != 0) return startIndex.CompareTo(nextIndex);
 
            return 0;
        }
 
        public List<ItemModel> GetCanDevourModellist()
        {
            List<ItemModel> canDevourModellist = new List<ItemModel>();
            SinglePackModel singlePack = GetSinglePackModel(PackType.Item);
            if (singlePack == null
                || colorType == EquipColorType.None
                || lvType == EquipLvType.None)
            {
                if (RefreshEquipDecomNumAct != null)
                {
                    RefreshEquipDecomNumAct();
                }
                return null;
            }
 
            foreach (var model in singlePack.GetAllItems().Values)
            {
                if (model.config.Type == 29)
                {
                    if (!defaultUnSelectlist.Contains(model.itemId))
                    {
                        canDevourModellist.Add(model);
                    }
                }
                else
                {
                    if (IsCanDevour(model))
                    {
                        canDevourModellist.Add(model);
                    }
 
                }
            }
            if (RefreshEquipDecomNumAct != null)
            {
                RefreshEquipDecomNumAct();
            }
            return canDevourModellist;
        }
 
        public bool IsCanDevour(ItemModel model)
        {
            if (devourPlacelist.Contains(model.config.EquipPlace))
            {
                if (model.config.ItemColor >= (int)E_ItemColor.Purple)
                {
                    PetEatEquipConfig eatEquipConfig = PetEatEquipConfig.GetEquipColorAndEquipClass(model.config.ItemColor, model.config.LV);
                    if (eatEquipConfig == null) return false;
 
                    if (modelInterface.IsFightUp(model.itemId, model.equipScore) != 1)
                    {
                        if (model.config.ItemColor <= (int)colorType
                            && model.config.LV <= (int)lvType
                            && model.config.StarLevel <= (int)starType)
                        {
                            return true;
                        }
                    }
                }
            }
 
            return false;
        }
 
        public bool IsMaxDecomLv(int decomLv, out int realLv)
        {
            realLv = decomLv;
            List<EquipDeComposeConfig> decomlist = EquipDeComposeConfig.GetValues();
            if (decomLv > decomlist[decomlist.Count - 1].LV)
            {
                realLv = decomlist[decomlist.Count - 1].LV;
                return true;
            }
 
            return false;
        }
 
 
        public List<ItemModel> selectDevourlist = new List<ItemModel>();
        public void GetSelectDevourList()
        {
            selectDevourlist.Clear();
            List<ItemModel> itemModels = GetCanDevourModellist();
            if (itemModels != null)
            {
                selectDevourlist.AddRange(itemModels);
            }
        }
 
        public void RefreshGetNewItem(ItemModel model)
        {
            if (model == null) return;
 
            if (CheckIsReachDevourCondi(model))
            {
                selectDevourlist.Add(model);
                if (RefreshEquipDecomNumAct != null)
                {
                    RefreshEquipDecomNumAct();
                }
            }
        }
 
        public void AddSelectDevourModellist(ItemModel model)
        {
            selectDevourlist.Add(model);
            if (RefreshEquipDecomNumAct != null)
            {
                RefreshEquipDecomNumAct();
            }
        }
 
        public bool CheckIsReachDevourCondi(ItemModel model)
        {
            if (model.config.Type == 29)
            {
                if (!defaultUnSelectlist.Contains(model.itemId))
                {
                    return true;
                }
                return false;
            }
            else
            {
                if (IsCanDevour(model))
                {
                    return true;
                }
 
            }
            return false;
        }
 
        public void RemoveSelectDevourModellist(ItemModel model)
        {
            if (selectDevourlist.Contains(model))
            {
                selectDevourlist.Remove(model);
            }
            if (RefreshEquipDecomNumAct != null)
            {
                RefreshEquipDecomNumAct();
            }
        }
 
        public Dictionary<int, int> GetDecomAttrDictByLv(int decomLv)
        {
            if (decomposeAttrDict.ContainsKey(decomLv))
            {
                return decomposeAttrDict[decomLv];
            }
 
            return null;
        }
 
        public bool IsReachMinDecomposeNum()
        {
            List<ItemModel> itemModels = GetCanDevourModellist();
            if (itemModels != null && itemModels.Count >= minDecomposeNum)
            {
                return true;
            }
            return false;
        }
 
        public void SendEquipdevourQuest()
        {
            List<ItemModel> itemModels = GetCanDevourModellist();
            if (itemModels == null || itemModels.Count < minDecomposeNum || !modelInterface.isPackResetOk || SettingEffectMgr.Instance.isStartDecompose) return;
 
            SettingEffectMgr.Instance.isStartDecompose = true;
            isAutoDecompose = true;
            recordAutoDecomNum = itemModels.Count;
            CA32C_tagCMEquipDecompose _petEat = new CA32C_tagCMEquipDecompose();
            var _petIndex = new ushort[recordAutoDecomNum];
            var idlist = new uint[recordAutoDecomNum];
            for (int i = 0; i < recordAutoDecomNum; i++)
            {
                _petIndex[i] = (ushort)itemModels[i].itemPlace;
                idlist[i] = (uint)itemModels[i].itemId;
                if (itemModels[i].config.StarLevel >= 2
                    || (itemModels[i].config.EquipPlace == 0 && itemModels[i].config.Type != 29))
                {
                    return;
                }
            }
            _petEat.Count = (byte)_petIndex.Length;
            _petEat.IndexList = _petIndex;
            _petEat.ItemIDList = idlist;
            _petEat.IsAuto = 1;
            GameNetSystem.Instance.SendInfo(_petEat);
        }
 
        public void SendEquipDevourRecordQuest()
        {
            string record = StringUtility.Contact((int)colorType + 1, (int)lvType + 1, (int)starType + 1);
            CA32D_tagCMDecomposeSeting decomSet = new CA32D_tagCMDecomposeSeting();
            decomSet.Seting = uint.Parse(record);
            GameNetSystem.Instance.SendInfo(decomSet);
        }
        public int decomposeLv { get; private set; }
        public int decomposeExp { get; private set; }
        public int decomposeProgress { get; private set; }
        public int addDecomposeExp { get; private set; }
        public int minDecomposeNum { get; private set; }
        public bool isAutoDecompose { get; set; }
        public int recordAutoDecomNum { get; private set; }
        public DecomposeGetMatInfo[] getItems { get; private set; }
 
        public event Action RefreshDecomAttrAct;
        public void GetServerDecomposeSet(HA31C_tagMCEquipDecomposeInfo info)
        {
            addDecomposeExp = 0;
            int realLv = info.LV + 1;
            bool isMax = IsMaxDecomLv(realLv, out realLv);
            if (realLv == decomposeLv)
            {
                addDecomposeExp = (int)info.Exp - decomposeExp;
            }
            else
            {
                for (int i = decomposeLv; i <= realLv; i++)
                {
                    EquipDeComposeConfig deComposeConfig = EquipDeComposeConfig.Get(i);
                    if (i == decomposeLv)
                    {
                        addDecomposeExp = deComposeConfig.UpNeedExp - decomposeExp;
                    }
                    else if (i == realLv)
                    {
                        addDecomposeExp += (int)info.Exp;
                    }
                    else
                    {
                        addDecomposeExp += deComposeConfig.UpNeedExp;
                    }
                }
            }
 
            decomposeLv = realLv;
            decomposeExp = (int)info.Exp;
            decomposeProgress = info.DecomposeCnt;
            getItems = JsonMapper.ToObject<DecomposeGetMatInfo[]>(info.GetItemData);
 
            if (info.Seting != 0)
            {
                string decomSetStr = info.Seting.ToString();
                string colorStr = decomSetStr.Substring(0, 1);
                colorType = (EquipColorType)(int.Parse(colorStr) - 1);
                starType = (EquipStarType)((int)info.Seting % 10 - 1);
                string lvStr = decomSetStr.Substring(1, decomSetStr.Length - 2);
                lvType = (EquipLvType)(int.Parse(lvStr) - 1);
            }
            if (RefreshDecomAttrAct != null)
            {
                RefreshDecomAttrAct();
            }
        }
        /// <summary>
        /// 设置获得炼丹材料的展示数据
        /// </summary>
        /// <param name="getMatInfos"></param>
        /// <returns></returns>
        private List<DecomposeGetMatInfo> getMatInfos = new List<DecomposeGetMatInfo>();
        public List<DecomposeGetMatInfo> SetShowMatInfo()
        {
            getMatInfos.Clear();
            int sumMatCnt = 0;
            if (getItems != null)
            {
                for (int i = 0; i < getItems.Length; i++)
                {
                    if (getItems[i].Count > 0)
                    {
                        sumMatCnt += getItems[i].Count;
                    }
                    else
                    {
                        sumMatCnt += 1;
                    }
                }
            }
 
            if (sumMatCnt > 5)
            {
                for (int i = 0; i < getItems.Length; i++)
                {
                    getMatInfos.Add(getItems[i]);
                }
            }
            else
            {
                if (getItems != null)
                {
                    for (int i = 0; i < getItems.Length; i++)
                    {
                        if (getItems[i].Count > 0)
                        {
                            for (int j = 0; j < getItems[i].Count; j++)
                            {
                                DecomposeGetMatInfo matInfo = new DecomposeGetMatInfo();
                                matInfo.ItemID = getItems[i].ItemID;
                                matInfo.Count = 1;
                                matInfo.IsBind = getItems[i].IsBind;
                                matInfo.IsSuite = getItems[i].IsSuite;
                                matInfo.UserData = getItems[i].UserData;
                                getMatInfos.Add(matInfo);
                            }
                        }
                        else
                        {
                            getMatInfos.Add(getItems[i]);
                        }
                    }
                }
            }
            return getMatInfos;
        }
 
        public enum EquipColorType
        {
            None = 0,
            Purple = 3,
            Orange = 4,
            Red = 5,
            All = 10,
        }
 
        public enum EquipLvType
        {
            None = 0,
            One,
            Two,
            Three,
            Four,
            Five,
            Six,
            Seven,
            Eight,
            Nine,
            Ten,
            Eleven,
            Twelve,
            Thirteen,
            Fourteen,
            Fifteen,
            All,
        }
 
        public enum EquipStarType
        {
            None = 0,
            One,
            Two,
            Three,
            All,
        }
 
        public class DecomposeGetMatInfo
        {
            public int ItemID;
            public int Count;
            public int IsBind;
            public int IsSuite;
            public string UserData;
        }
        #endregion
 
        #region 丹药逻辑处理
 
        private int CompareMakeDrug(AttrFruitConfig start, AttrFruitConfig end)
        {
            ItemConfig configS = ItemConfig.Get(start.ID);
            ItemConfig configE = ItemConfig.Get(end.ID);
            if (configS.RealmLimit.CompareTo(configE.RealmLimit) != 0)
            {
                return configS.RealmLimit.CompareTo(configE.RealmLimit);
            }
            if (configS.LV.CompareTo(configE.LV) != 0)
            {
                return configS.LV.CompareTo(configE.LV);
            }
 
            int x = makeDruglist.IndexOf(start);
            int y = makeDruglist.IndexOf(end);
            if (x.CompareTo(y) != 0) x.CompareTo(y);
 
            return 0;
        }
 
        List<AttrFruitConfig> drugOrderlist = new List<AttrFruitConfig>();
        List<AttrFruitConfig> haveDruglist = new List<AttrFruitConfig>();
        public List<AttrFruitConfig> GetDrugOrderByCnt()
        {
            drugOrderlist.Clear();
            haveDruglist.Clear();
            drugOrderlist.AddRange(makeDruglist);
            drugOrderlist.Sort(CompareByIsHave);
            for (int i = 0; i < drugOrderlist.Count; i++)
            {
                if (IsHaveDrugUse(drugOrderlist[i]))
                {
                    haveDruglist.Add(drugOrderlist[i]);
                }
            }
            haveDruglist.Sort(CompareMakeDrug);
            for (int i = 0; i < haveDruglist.Count; i++)
            {
                drugOrderlist[i] = haveDruglist[i];
            }
 
            return drugOrderlist;
        }
 
        public bool CheckIsDrugById(int itemId)
        {
            for (int i = 0; i < makeDruglist.Count; i++)
            {
                if (makeDruglist[i].ID == itemId)
                {
                    return true;
                }
            }
            return false;
        }
 
        public int CompareByIsHave(AttrFruitConfig start, AttrFruitConfig end)
        {
            bool isHaveStart = IsHaveDrugUse(start);
            bool isHaveEnd = IsHaveDrugUse(end);
            if (isHaveStart.CompareTo(isHaveEnd) != 0) return -isHaveStart.CompareTo(isHaveEnd);
 
            //isHaveStart = IsHaveDrugRecycle(start);
            //isHaveEnd = IsHaveDrugRecycle(end);
            //if (isHaveStart.CompareTo(isHaveEnd) != 0) return -isHaveStart.CompareTo(isHaveEnd);
 
            isHaveStart = GetItemCountByID(PackType.Item, start.ID) > 0 ? true : false;
            isHaveEnd = GetItemCountByID(PackType.Item, end.ID) > 0 ? true : false;
            if (isHaveStart.CompareTo(isHaveEnd) != 0) return isHaveStart.CompareTo(isHaveEnd);
 
            isHaveStart = IsReachMaxUseDrug(start);
            isHaveEnd = IsReachMaxUseDrug(end);
            if (isHaveStart.CompareTo(isHaveEnd) != 0) return isHaveStart.CompareTo(isHaveEnd);
 
            int x = makeDruglist.IndexOf(start);
            int y = makeDruglist.IndexOf(end);
            if (x.CompareTo(y) != 0) return x.CompareTo(y);
            return 0;
        }
 
        public bool IsHaveDrugUse(AttrFruitConfig fruitConfig)
        {
            if (!IsReachMaxUseDrug(fruitConfig))
            {
                return GetItemCountByID(PackType.Item, fruitConfig.ID) > 0 ? true : false;
            }
 
            return false;
        }
 
        public bool IsHaveDrugRecycle(AttrFruitConfig fruitConfig)
        {
            if (IsReachMaxUseDrug(fruitConfig))
            {
                return GetItemCountByID(PackType.Item, fruitConfig.ID) > 0 ? true : false;
            }
            return false;
        }
 
        public bool IsReachMaxUseDrug(AttrFruitConfig fruitConfig)
        {
            if (fruitConfig == null) return false;
 
            int useNum = GetSumUseCntByID(fruitConfig.ID);
            if (useNum >= fruitConfig.MaxUseCnt)
            {
                return true;
            }
            return false;
        }
 
        List<AttrFruitConfig> limitlist = new List<AttrFruitConfig>();
        public float GetAlchemyProgress(AlchemyConfig alchemy)
        {
            var previewDanlist = FurnaceModel.GetPreviewIdlist(alchemy);
            float progress = 0;
            limitlist.Clear();
            for (int i = 0; i < previewDanlist.Count; i++)
            {
                AttrFruitConfig fruitConfig = AttrFruitConfig.Get(previewDanlist[i]);
                if (fruitConfig != null)
                {
                    limitlist.Add(fruitConfig);
                }
            }
 
            for (int i = 0; i < limitlist.Count; i++)
            {
                progress += ((float)1 / limitlist.Count) * ((float)GetSumUseCntByID(limitlist[i].ID) / limitlist[i].MaxUseCnt);
            }
            return progress * 100;
        }
        #endregion
    }
}