少年修仙传客户端代码仓库
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
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Friday, April 26, 2019
//--------------------------------------------------------
 
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
 
    public class OtherPlayerEquipWin : Window,SecondWindowInterface
    {
        [SerializeField] RectTransform m_Content;
        [SerializeField] CyclicScroll m_EquipLevelScroll;
        [SerializeField] EquipSlots m_EquipSlots;
        [SerializeField] Text m_FightPoint;
        [SerializeField] RawImage m_Role;
        [SerializeField] OtherPlayerSuitWidget m_WidgetSuit;
 
        OtherPlayerEquipModel model { get { return ModelCenter.Instance.GetModel<OtherPlayerEquipModel>(); } }
        EquipModel equipModel { get { return ModelCenter.Instance.GetModel<EquipModel>(); } }
 
        bool resetRoleRotation = false;
        public Button close { get; set; }
        #region Built-in
 
        protected override void BindController()
        {
            if (this is SecondWindowInterface)
            {
                var frame = this.GetComponentInChildren<SecondFrameLoader>();
                frame.Create();
                close = frame.GetComponentInChildren<Button>();
            }
        }
 
        protected override void AddListeners()
        {
            close.SetListener(() => { WindowCenter.Instance.Close<OtherPlayerEquipWin>(); });
        }
 
        protected override void OnPreOpen()
        {
            resetRoleRotation = true;
            m_Content.SetActive(false);
            model.selectedLevelChangeEvent += OnSelectedLevelChange;
        }
 
        protected override void OnAfterOpen()
        {
        }
 
        protected override void OnPreClose()
        {
            model.selectedLevelChangeEvent -= OnSelectedLevelChange;
        }
 
        protected override void OnAfterClose()
        {
        }
 
        protected override void OnActived()
        {
            base.OnActived();
            DisplayEquipLevels();
            if (model.selectedLevel != 0)
            {
                m_Content.SetActive(true);
                DisplayEquips();
                DisplayFightPoint();
                DisplayAppearance();
                DisplaySuitInfo();
            }
        }
 
        #endregion
 
        private void OnSelectedLevelChange()
        {
            m_Content.SetActive(true);
            DisplayEquips();
            DisplayFightPoint();
            DisplayAppearance();
            DisplaySuitInfo();
        }
 
        private void DisplayEquipLevels()
        {
            var realm = model.playerRealm;
            var levels = new List<int>();
            var allLevels = equipModel.GetAllEquipSets();
 
            foreach (var level in allLevels)
            {
                var config = EquipControlConfig.Get(level, 1);
                if (realm >= config.realm)
                {
                    levels.Add(level);
                }
            }
 
            m_EquipLevelScroll.Init(levels);
        }
 
        private void DisplayEquips()
        {
            var equipDetails = model.GetEquipBriefs();
            for (int i = 1; i <= 12; i++)
            {
                var itemId = equipDetails.ContainsKey(i) ? equipDetails[i].itemId : 0;
                var star = equipDetails.ContainsKey(i) ? equipDetails[i].star : 0;
                m_EquipSlots[i].Display(i, itemId, star);
            }
        }
 
        private void DisplayFightPoint()
        {
            m_FightPoint.text = model.GetFightPoint().ToString();
        }
 
        private void DisplayAppearance()
        {
            var appearance = model.GetEquipAppearance();
            UI3DModelExhibition.Instance.ShowPlayer(m_Role, new UI3DPlayerExhibitionData()
            {
                job = appearance.job,
                clothesId = appearance.clothes,
                weaponId = appearance.weapon,
                secondaryId = appearance.secondary,
                keepRotation = resetRoleRotation,
                reikiRootEffectId = model.reikiRootEffectId,
                equipLevel = model.equipLevel,
            });
 
            resetRoleRotation = false;
        }
 
        private void DisplaySuitInfo()
        {
            m_WidgetSuit.Display(model.GetSuitInfo());
        }
 
        [System.Serializable]
        public class EquipSlots
        {
            public OtherPlayerEquipSlotBehaviour weapon;
            public OtherPlayerEquipSlotBehaviour secondary;
            public OtherPlayerEquipSlotBehaviour hat;
            public OtherPlayerEquipSlotBehaviour clothes;
            public OtherPlayerEquipSlotBehaviour belt;
            public OtherPlayerEquipSlotBehaviour trousers;
            public OtherPlayerEquipSlotBehaviour shoes;
            public OtherPlayerEquipSlotBehaviour glove;
            public OtherPlayerEquipSlotBehaviour neck;
            public OtherPlayerEquipSlotBehaviour fairy1;
            public OtherPlayerEquipSlotBehaviour fairy2;
            public OtherPlayerEquipSlotBehaviour jade;
 
            public OtherPlayerEquipSlotBehaviour this[int place] {
                get {
                    switch ((RoleEquipType)place)
                    {
                        case RoleEquipType.Weapon:
                            return weapon;
                        case RoleEquipType.Weapon2:
                            return secondary;
                        case RoleEquipType.Hat:
                            return hat;
                        case RoleEquipType.Clothes:
                            return clothes;
                        case RoleEquipType.Belt:
                            return belt;
                        case RoleEquipType.Trousers:
                            return trousers;
                        case RoleEquipType.Shoes:
                            return shoes;
                        case RoleEquipType.Glove:
                            return glove;
                        case RoleEquipType.Neck:
                            return neck;
                        case RoleEquipType.FairyCan1:
                            return fairy1;
                        case RoleEquipType.FairyCan2:
                            return fairy2;
                        case RoleEquipType.Jade:
                            return jade;
                        default:
                            return null;
                    }
                }
            }
        }
    }
 
}