少年修仙传客户端代码仓库
hch
2025-07-24 50e53441950268933694eeb5aad36147bbe1014d
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
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
    public class FairySiegeScheduleGroupWin : Window
    {
        [SerializeField] Dropdown dropType;
        [SerializeField] ScrollerController scrGroup;
        [SerializeField] TextEx txtBattlefieldType;
        [SerializeField] TextEx txtTip;
        RankModel rankModel { get { return ModelCenter.Instance.GetModel<RankModel>(); } }
        FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
        int nowBattleType;
        int nowBattleGroup;
 
        #region Build-in
 
        protected override void AddListeners()
        {
            dropType.SetListener(value =>
            {
                nowBattleGroup = value + 1;
                int groupValue2 = nowBattleType * 100 + nowBattleGroup;
                Send(groupValue2);
            });
        }
 
        void Send(int groupValue2)
        {
            dropType.interactable = false;
            scrGroup.Refresh();
            scrGroup.Restart();
            rankModel.ResetQueryParam();
            rankModel.QueryCrossRank(FairySiegeActModel.crossRoundRankType, model.operationCrossAct.zoneID, groupValue2: groupValue2);
        }
        protected override void BindController()
        {
        }
 
        protected override void OnPreOpen()
        {
            dropType.interactable = true;
            scrGroup.OnRefreshCell += OnRefreshGroupCell;
            rankModel.onRankRefresh += OnRefreshRankList;
            int myBattleType;
            int myBattleGroup;
            if (!model.TryGetNowBatTypeAndGroup(model.myFamilyID, out myBattleType, out myBattleGroup))
                return;
            nowBattleType = myBattleType;
            int groupValue2 = nowBattleType * 100 + myBattleGroup;
            Send(groupValue2);
        }
 
        protected override void OnPreClose()
        {
            scrGroup.OnRefreshCell -= OnRefreshGroupCell;
            rankModel.onRankRefresh -= OnRefreshRankList;
        }
 
        private void OnRefreshRankList(int type)
        {
            if (type != FairySiegeActModel.crossRoundRankType)
                return;
            CreateGroupScroller();
            dropType.interactable = true;
        }
 
        protected override void OnAfterOpen()
        {
            CreateDropdown();
            Display();
        }
 
        protected override void OnAfterClose()
        {
        }
 
        #endregion
 
        private void OnRefreshGroupCell(ScrollerDataType type, CellView cell)
        {
            var _cell = cell.GetComponent<FairySiegeScheduleGroupCell>();
            _cell?.Display(cell.index, cell);
        }
 
        private void CreateDropdown()
        {
            dropType.ClearOptions();
            var optionDatas = new List<Dropdown.OptionData>();
            int myBattleType;
            int myBattleGroup;
            int myIndex = -1;
            if (model.TryGetNowBatTypeAndGroup(model.myFamilyID, out myBattleType, out myBattleGroup))
            {
                if (model.batGroupInfo.TryGetValue(myBattleType, out var groupDict) && !groupDict.IsNullOrEmpty())
                {
                    var list = groupDict.Keys.ToList();
                    list.Sort();
                    for (int i = 0; i < list.Count; i++)
                    {
                        int battlefieldGroup = list[i];
                        if (battlefieldGroup == myBattleGroup)
                        {
                            myIndex = i;
                        }
                        var groupStr = Language.Get(StringUtility.Contact("FairySiegeBattlefieldGroup", battlefieldGroup));
                        optionDatas.Add(new Dropdown.OptionData(groupStr));
                    }
                }
            }
            dropType.AddOptions(optionDatas);
            if (myIndex > -1)
            {
                dropType.value = myIndex;
                int groupValue2 = myBattleType * 100 + myBattleGroup;
                rankModel.ResetQueryParam();
                rankModel.QueryCrossRank(FairySiegeActModel.crossRoundRankType, model.operationCrossAct.zoneID, groupValue2: groupValue2);
            }
        }
 
        private void Display()
        {
            if (model.operationCrossAct == null)
                return;
            if (!model.TryGetNowBatTypeAndGroup(model.myFamilyID, out int myBattleType, out int myBattleGroup))
                return;
 
            bool isShowTip = model.TryGetMatchUpNum(model.operationCrossAct.JoinFamilyCnt, model.matchRound, myBattleType, out int num);
            txtTip.SetActive(isShowTip && num > 0);
            if (isShowTip && num > 0)
            {
                txtTip.text = Language.Get("FairySiege122", num);
            }
            var myTypeStr = Language.Get(StringUtility.Contact("FairySiegeBattlefieldType", myBattleType));
            txtBattlefieldType.text = StringUtility.Contact(myTypeStr, Language.Get("FairySiege121"));
        }
 
        private void CreateGroupScroller()
        {
            scrGroup.Refresh();
            var rankInfo = rankModel.GetRankPageDatas(FairySiegeActModel.crossRoundRankType);
            if (!rankInfo.IsNullOrEmpty())
            {
                var list = rankInfo.Keys.ToList();
                for (int i = 0; i < list.Count; i++)
                {
                    CellInfo info = new CellInfo();
                    info.infoInt1 = nowBattleType;
                    scrGroup.AddCell(ScrollerDataType.Header, i, info);
                }
            }
            scrGroup.Restart();
        }
    }
}