少年修仙传客户端代码仓库
lcy
2025-05-08 1314c3b3c14cd520bbb8569b5f98d68933a22cd3
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
using System.Collections.Generic;
using UnityEngine;
 
namespace vnxbqy.UI
{
    public class FairySiegeJoinListWin : Window
    {
        [SerializeField] ButtonEx btnClose;
        [SerializeField] ScrollerController scrFairy;
        [SerializeField] ScrollerController scrPlayer;
        [SerializeField] TextEx txtDate;
        [SerializeField] TextEx txtPlayerJoinCnt;
 
        FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
 
        #region Build-in
 
        protected override void AddListeners()
        {
            btnClose.SetListener(CloseClick);
        }
 
        protected override void BindController()
        {
        }
 
        protected override void OnPreOpen()
        {
            scrFairy.OnRefreshCell += OnRefreshFairyCell;
            scrPlayer.OnRefreshCell += OnRefreshPlayerCell;
            if (model.operationCrossAct == null)
                return;
            bool hasQualification = model.hasQualification();
            scrPlayer.SetActive(hasQualification);
            txtPlayerJoinCnt.SetActive(hasQualification);
            if (hasQualification)
            {
                int familyLv = (int)PlayerDatas.Instance.fairyData.fairy.FamilyLV;
                int nowCount = model.campMemberDict.Count;
                int maxCount = FamilyConfig.Get(familyLv).memberCnt;
                txtPlayerJoinCnt.text = Language.Get("FairySiege092", nowCount, maxCount);
            }
            txtDate.text = StringUtility.Contact(Language.Get("OperationDate"), " ", model.operationCrossAct.ToDisplayTime());
        }
 
        protected override void OnPreClose()
        {
            scrFairy.OnRefreshCell -= OnRefreshFairyCell;
            scrPlayer.OnRefreshCell -= OnRefreshPlayerCell;
        }
 
        protected override void OnAfterOpen()
        {
            CreateFairyScroller();
            CreatePlayerScroller();
        }
 
        protected override void OnAfterClose()
        {
        }
 
        #endregion
 
        private void OnRefreshFairyCell(ScrollerDataType type, CellView cell)
        {
            if (type == ScrollerDataType.Header)
            {
                var _cell = cell.GetComponent<FairySiegeJoinListServerCell>();
                _cell?.Display(cell.index);
            }
            else
            {
                var _cell = cell.GetComponent<FairySiegeJoinListFairyCell>();
                _cell?.Display(cell.index, cell);
            }
        }
 
        private void OnRefreshPlayerCell(ScrollerDataType type, CellView cell)
        {
            var _cell = cell.GetComponent<FairySiegeJoinListPlayerCell>();
            _cell?.Display(cell.index);
        }
 
        private void CreateFairyScroller()
        {
            scrFairy.Refresh();
            if (model.TryGetSortServerIdList(out List<uint> list))
            {
                foreach (var serverId in list)
                {
                    scrFairy.AddCell(ScrollerDataType.Header, (int)serverId);
                    if (model.TryGetSortFamilyList(serverId, out List<FairySiegeFamilyInfo> infoList))
                    {
                        int rowCount = Mathf.CeilToInt((float)infoList.Count / model.joinListFairyRowMax);
                        for (int i = 0; i < rowCount; i++)
                        {
                            CellInfo cellInfo = new CellInfo();
                            cellInfo.infoInt1 = (int)serverId;
                            scrFairy.AddCell(ScrollerDataType.Normal, i, cellInfo);
                        }
                    }
                }
            }
            scrFairy.Restart();
        }
 
        private void CreatePlayerScroller()
        {
            scrPlayer.Refresh();
            if (model.TryGetSortMemberList(out List<FairySiegeCampMember> list))
            {
                int rowCount = Mathf.CeilToInt((float)list.Count / model.joinListFairyRowMax);
                for (int i = 0; i < rowCount; i++)
                {
                    scrPlayer.AddCell(ScrollerDataType.Header, i);
                }
            }
            scrPlayer.Restart();
        }
    }
}