少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Thursday, May 09, 2019
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
 
    public class RealmRecommandEquipWin : Window
    {
        [SerializeField] Text m_InfoText;
        [SerializeField] RichText[] m_EquipTexts;
        [SerializeField] Button[] m_EquipGetWay;
        [SerializeField] Button m_Close;
 
        RealmModel model { get { return ModelCenter.Instance.GetModel<RealmModel>(); } }
        PackModel packModel { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
        EquipStarModel equipStarModel { get { return ModelCenter.Instance.GetModel<EquipStarModel>(); } }
 
        RealmLevelUpEquipCondition equipCondition;
        List<int> notSatisfyPlaces = new List<int>();
 
        #region Built-in
        protected override void BindController()
        {
        }
 
        protected override void AddListeners()
        {
            m_Close.AddListener(CloseClick);
            for (int i = 0; i < m_EquipGetWay.Length; i++)
            {
                m_EquipGetWay[i].AddListener(OnGetWay);
            }
        }
 
        protected override void OnPreOpen()
        {
            Display();
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
        }
 
        protected override void OnAfterClose()
        {
        }
        #endregion
 
        void Display()
        {
            var config = RealmLVUPTaskConfig.Get(functionOrder);
 
            equipCondition = new RealmLevelUpEquipCondition()
            {
                level = config.NeedValueList[0],
                starLevel = config.NeedValueList[1],
                isSuit = config.NeedValueList[2] == 1,
                itemColor = config.NeedValueList[3],
            };
            var equipSet = equipModel.GetEquipSet(equipCondition.level);
            var realmConfig = RealmConfig.Get(equipSet.realm);
 
            notSatisfyPlaces = new List<int>();
            model.SatisfyEquipCondition(model.equipNeedConfig, out notSatisfyPlaces);
 
            int count;
            string countStr = "";
            if (config.NeedValueList.Length == 5)
            {
                count = config.NeedValueList[4];
                if (count == 8)
                {
                    countStr = StringUtility.Contact(countStr, count);
                }
                else
                {
                    countStr = StringUtility.Contact(countStr, Language.Get("L2031"), count);
                }
            }
            else
            {
                count = 8;
                countStr = StringUtility.Contact(countStr, count);
            }
 
 
            if (!equipCondition.isSuit)
            {
                var colorName = UIHelper.GetColorNameByItemColor(equipCondition.itemColor);
                m_InfoText.text = Language.Get("RealmNeedEquipCondition_1", realmConfig.NameEx, colorName, equipCondition.starLevel, countStr)
                    + " (" + Language.Get("BlessedLand036", Math.Min(count, 8 - notSatisfyPlaces.Count), count) + ")";
            }
            else
            {
                m_InfoText.text = Language.Get("RealmNeedEquipCondition_2", realmConfig.NameEx, equipCondition.starLevel, countStr)
                    + " (" + Language.Get("BlessedLand036", Math.Min(count, 8 - notSatisfyPlaces.Count), count) + ")";
            }
 
 
            
            int[] recommandEquips;
            model.TryGetRecommandEquips(equipCondition.level, PlayerDatas.Instance.baseData.Job, model.equipNeedConfig.NeedValueList[3], out recommandEquips);
            for (int i = 0; i < m_EquipTexts.Length; i++)
            {
                int place = i + 1;
                int equipState = 0; // 0 完成 1. 没有装备引导获得途径 2. 背包中有更好的装备引导穿戴 3.引导升星
                int curStarLevel = 0;
                int targetStarLevel = equipCondition.starLevel;
 
                var equipGuid = equipModel.GetEquip(new Int2(equipCondition.level, place));
                var itemModel = packModel.GetItemByGuid(equipGuid);
                if (itemModel != null)
                {
                    curStarLevel = equipStarModel.GetEquipStarLevel(new Int2(equipCondition.level, place));
 
                    if (curStarLevel < targetStarLevel)
                    {
                        equipState = 3;
                    }
 
                    if (equipCondition.isSuit)
                    {
                        if (itemModel.config.SuiteiD == 0)
                        {
                            equipState = 1;
                        }
                    }
                    else if (itemModel.config.ItemColor < equipCondition.itemColor)
                    {
                        equipState = 1;
                    }
 
                }
                else
                {
                    equipState = 1;
                }
 
                //查找背包中是否有更好的装备
                if (equipState == 1)
                {
                    var items = packModel.GetItems(PackType.Item, new SinglePack.FilterParams()
                    {
                        levels = new List<int>() { equipCondition.level },
                        equipTypes = new List<int>() { place },
                        jobs = new List<int>() { PlayerDatas.Instance.baseData.Job },
                    });
                    if (items != null)
                    {
                        foreach (var item in items)
                        {
                            if ((equipCondition.isSuit && item.config.SuiteiD > 0) ||
                                (!equipCondition.isSuit && item.config.ItemColor >= equipCondition.itemColor))
                            {
                                equipState = 2;
                                break;
                            }
                        }
                    }
                }
 
                var itemConfig = ItemConfig.Get(recommandEquips[i]);
                string suffix = string.Empty;
                if (equipState == 0)
                {
                    suffix = StringUtility.Contact("(", Language.Get("TaskWin_Btn_Finish"), ")");
                    m_EquipGetWay[i].RemoveAllListeners();
                }
                else if (equipState == 1)
                {
                    suffix = StringUtility.Contact("<color=#ff0000><a>", Language.Get("HolidayXianXiaMJLotterynWin__1"), "</a></color>");
                    m_EquipGetWay[i].AddListener(OnGetWay);
                }
                else if (equipState == 2)
                {
                    suffix = StringUtility.Contact("<color=#ff0000><a>", Language.Get("RealmRecommandEquipWin__2"), "</a></color>");
                    m_EquipGetWay[i].AddListener(() => {
                        Goto(2);
                    });
                }
                else if (equipState == 3)
                {
                    suffix = StringUtility.Contact("<color=#ff0000><a>", Language.Get("gotoEquipStar"), "</a></color>");
                    m_EquipGetWay[i].AddListener(() => {
                        Goto(1);
                    });
                }
                string equipName = StringUtility.Contact(itemConfig.ItemName, " ", 
                    Language.Get("EquipStarLevel", Language.Get("BlessedLand036", curStarLevel, targetStarLevel)), " ", suffix);
                m_EquipTexts[i].text = UIHelper.AppendColor(notSatisfyPlaces.Contains(place) ? TextColType.Gray : TextColType.Green, equipName, true);
            }
 
        }
 
        private void OnGetWay()
        {
            var config = EquipControlConfig.Get(equipCondition.level, notSatisfyPlaces[0]);
            RealmRecommandEquipGetWayWin.equipGetWays.Clear();
            RealmRecommandEquipGetWayWin.equipGetWays.AddRange(config.getWays);
            WindowCenter.Instance.Open<RealmRecommandEquipGetWayWin>();
        }
 
        private void Goto(int state)
        {
            if (state == 2)
            {
                equipModel.SelectSet(equipCondition.level);
                WindowCenter.Instance.Open<KnapSackWin>(false, 0);
            }
            else 
            {
 
                equipStarModel.jumpEquipPos = new Int2(equipCondition.level, notSatisfyPlaces[0]);
                WindowCenter.Instance.Open<EquipFrameWin>(false, 1);
            }
            CloseImmediately();
            WindowCenter.Instance.Close<RealmWin>();
        }
 
 
    }
 
}