少年修仙传客户端代码仓库
lcy
2024-12-16 a39c35fc6449430cd02bccb681c4a0a880e46cd9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace vnxbqy.UI
{
    public static class RichViewItemUtility
    {
        static string s_CacheUserData = string.Empty;
 
        static EquipGemModel equipGemModel { get { return ModelCenter.Instance.GetModel<EquipGemModel>(); } }
 
        public static void DisplayItem(int itemId, ItemTipUtility.CustomItemPlus itemplus)
        {
            if (ItemLogicUtility.Instance.IsRealmEquip(itemId) && itemplus.Preview != 1)
            {
                var itemConfig = ItemConfig.Get(itemId);
                Dictionary<int, int> gems = new Dictionary<int, int>();
                Dictionary<int, bool> gemHoleActiveStates = new Dictionary<int, bool>();
                if (itemplus.Stone != null)
                {
                    for (int i = 0; i < itemplus.Stone.Length; i++)
                    {
                        gems.Add(i, itemplus.Stone[i]);
                        if (i == 3)
                        {
                            gemHoleActiveStates.Add(i, itemplus.Stone[i] != 0);
                        }
                    }
                }
 
                for (int i = 0; i < EquipGemModel.EQUIPGEM_HOLE_COUNT; i++)
                {
                    if (i < 3)
                    {
                        gemHoleActiveStates.Add(i, equipGemModel.IsGemHoleOpen(i, itemplus.Star));
                    }
                }
 
                var legendProperties = new List<Int2>();
                var equipSkillList = new List<int>();
                Dictionary<int, List<int>> useDataDict = null;
                if (!string.IsNullOrEmpty(itemplus.UserData))
                {
                    useDataDict = ConfigParse.Analysis(itemplus.UserData);
                    if (useDataDict != null)
                    {
                        if(useDataDict.ContainsKey((int)ItemUseDataKey.legendAttrID) && useDataDict.ContainsKey((int)ItemUseDataKey.legendAttrValue))
                        {
                            var count = Mathf.Min(useDataDict[(int)ItemUseDataKey.legendAttrID].Count, useDataDict[(int)ItemUseDataKey.legendAttrValue].Count);
                            for (int i = 0; i < count; i++)
                            {
                                legendProperties.Add(new Int2(useDataDict[(int)ItemUseDataKey.legendAttrID][i], useDataDict[(int)ItemUseDataKey.legendAttrValue][i]));
                            }
                        }
                        if (useDataDict.ContainsKey((int)ItemUseDataKey.equipSkills))
                        {
                            equipSkillList = useDataDict[(int)ItemUseDataKey.equipSkills];
                        }
 
                    }
                }
 
                List<Int2> trainProperties = new List<Int2>();
                if (!itemplus.Wash.Equals(default(ItemTipUtility.CustomEquipWash)))
                {
                    var washType = EquipTrainModel.GetTrainType(itemConfig.EquipPlace);
                    var trainConfig = EquipWashConfig.Get(washType, 1);
                    for (int i = 0; i < itemplus.Wash.Value.Length; i++)
                    {
                        var propertyType = i == 0 ? trainConfig.config.attType1 : i == 1 ?
                            trainConfig.config.attType2 : trainConfig.config.attType3;
                        trainProperties.Add(new Int2(propertyType, itemplus.Wash.Value[i]));
                    }
                }
 
                Dictionary<EquipSuitType, int> suitLevels = new Dictionary<EquipSuitType, int>();
                suitLevels.Add(EquipSuitType.TwoSuit, -1);
                suitLevels.Add(EquipSuitType.FiveSuit, -1);
                suitLevels.Add(EquipSuitType.EightSuit, -1);
 
                List<int> suitplaces = new List<int>();
 
                Dictionary<int, int> placeStars = new Dictionary<int, int>();
                for (int i = 1; i <= 8; i++)
                {
                    placeStars.Add(i, -1);
                }
 
                if (itemplus.placeStars != null)
                {
                    for (int i = 0; i < itemplus.placeStars.Length; i++)
                    {
                        placeStars[i + 1] = itemplus.placeStars[i];
                    }
                }
 
                if (itemplus.suitPlaces != null && itemplus.suitLevels != null)
                {
                    suitplaces.AddRange(itemplus.suitPlaces);
                    suitLevels[EquipSuitType.TwoSuit] = itemplus.suitLevels[0];
                    suitLevels[EquipSuitType.FiveSuit] = itemplus.suitLevels[1];
                    suitLevels[EquipSuitType.EightSuit] = itemplus.suitLevels[2];
                }
                else if (itemplus.Equips != null)
                {
                    var stars = new List<int>();
                    for (int i = 0; i < itemplus.Equips.Length; i++)
                    {
                        var array = itemplus.Equips[i];
                        var config = ItemConfig.Get(array[0]);
                        if (config.EquipPlace > 8)
                        {
                            continue;
                        }
                        stars.Add(array[1]);
 
                        placeStars[config.EquipPlace] = array[1];
 
                        if (config.SuiteiD > 0)
                        {
                            suitplaces.Add(config.EquipPlace);
                        }
                    }
 
                    stars.Sort((int x, int y) => { return -x.CompareTo(y); });
 
                    var twoSuitLevel = (suitplaces.Count > 1 && stars.Count > 1) ? stars[1] : -1;
                    var fiveSuitLevel = (suitplaces.Count > 4 && stars.Count > 4) ? stars[4] : -1;
                    var eightSuitLevel = (suitplaces.Count > 7 && stars.Count > 7) ? stars[7] : -1;
 
                    suitLevels[EquipSuitType.TwoSuit] = twoSuitLevel;
                    suitLevels[EquipSuitType.FiveSuit] = fiveSuitLevel;
                    suitLevels[EquipSuitType.EightSuit] = eightSuitLevel;
                }
 
                ItemTipUtility.ShowCustomEquip(new ItemTipUtility.CustomEquipInfo()
                {
                    itemId = itemId,
                    job = itemConfig.JobLimit,
                    strengthenLevel = itemplus.PlusLV,
                    starLevel = itemplus.Star,
                    gems = gems,
                    legendProperties = legendProperties,
                    score = ItemLogicUtility.Instance.GetEquipScore(itemId, useDataDict, true),
                    gemHoleActiveStates = gemHoleActiveStates,
                    suitLevels = suitLevels,
                    suitPlaces = suitplaces,
                    trainProperties = trainProperties,
                    isEquiped = itemplus.Equipped == 1,
                    placeStars = placeStars,
                    equipSkillList = equipSkillList,
                });
            }
            else
            {
                ItemTipUtility.Show(itemId);
            }
        }
 
        public static void SendViewNotifyItem(string guid, string userdata)
        {
            s_CacheUserData = userdata;
            var pak = new CA905_tagCGQueryNotifyEquipDetailInfo();
            pak.ItemGUID = guid;
            GameNetSystem.Instance.SendInfo(pak);
        }
 
        public static void ReceivePackage(HA905_tagGCNotifyEquipDetailInfo package)
        {
            List<int[]> equips = null;
            if (package.ClassEquipCount > 0)
            {
                equips = new List<int[]>();
                foreach (var equip in package.ClassEquipList)
                {
                    equips.Add(new int[2]
                    {
                        (int)equip.ItemID,
                        equip.Star,
                    });
                }
            }
 
            ItemTipUtility.CustomItemPlus itemplus = new ItemTipUtility.CustomItemPlus()
            {
                ItemID = (int)package.ItemID,
                count = 1,
                Star = package.Star,
                PlusLV = package.PlusLV,
                EvolveLV = package.EvolveLV,
                Wash = new ItemTipUtility.CustomEquipWash()
                {
                    LV = package.WashLV,
                    Value = new int[3]
                    {
                       0<package.WashValueList.Length?(int)package.WashValueList[0]:0,
                       1<package.WashValueList.Length?(int)package.WashValueList[1]:0,
                       2<package.WashValueList.Length?(int)package.WashValueList[2]:0,
                    },
                },
                Equipped = 1,
                Stone = new int[4]
                {
                    0<package.StoneIDList.Length?(int)package.StoneIDList[0]:0,
                    1<package.StoneIDList.Length?(int)package.StoneIDList[1]:0,
                    2<package.StoneIDList.Length?(int)package.StoneIDList[2]:0,
                    3<package.StoneIDList.Length?(int)package.StoneIDList[3]:0,
                },
                UserData = s_CacheUserData,
                Equips = equips == null ? null : equips.ToArray(),
            };
 
            DisplayItem((int)itemplus.ItemID, itemplus);
        }
    }
}