少年修仙传客户端代码仓库
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
using UnityEngine;
 
namespace vnxbqy.UI
{
    public class FairySiegeScheduleTimeCell : CellView
    {
        [SerializeField] TextEx txtRound;
        [SerializeField] TextEx txtState;
        [SerializeField] TextEx txtTime;
        [SerializeField] ImageEx imgFlag;
 
        FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } }
 
        public void Display(int index)
        {
            int round = index + 1;
            if (model.operationCrossAct == null)
                return;
            int startTimeState = round * 10 + 2;//轮次状态=轮次*10+轮次阶段;轮次阶段:1-分组战备;2-战斗;3-休战结算
            if (!ActTimeFlowConfig.TryGetID(model.operationCrossAct.ActFlowID, startTimeState, out int startFlowId))
                return;
            if (!ActTimeFlowConfig.Has(startFlowId))
                return;
            ActTimeFlowConfig startConfig = ActTimeFlowConfig.Get(startFlowId);
            int endTimeState = round * 10 + 3;//轮次状态=轮次*10+轮次阶段;轮次阶段:1-分组战备;2-战斗;3-休战结算
            if (!ActTimeFlowConfig.TryGetID(model.operationCrossAct.ActFlowID, endTimeState, out int endFlowId))
                return;
            if (!ActTimeFlowConfig.Has(endFlowId))
                return;
            ActTimeFlowConfig endConfig = ActTimeFlowConfig.Get(endFlowId);
 
            txtTime.text = DisplayTime(startConfig.StartDay, startConfig.StartHour, startConfig.StartMinute, endConfig.StartDay, endConfig.StartHour, endConfig.StartMinute);
            txtRound.text = round.ToString();
            txtState.text = StringUtility.Contact(Language.Get(StringUtility.Contact("FairySiegeBattlefieldType", round)), Language.Get("FairySiege121"));
            imgFlag.SetActive(model.matchRound == round);
        }
 
        public string DisplayTime(int startDay, int startHour, int startMinute, int endDay, int endHour, int endMinute)
        {
            if (model.operationCrossAct == null)
                return string.Empty;
            OperationDate startDate = model.operationCrossAct.startDate;
            var textBuilder = OperationTimeHepler.textBuilder;
            textBuilder.Length = 0;
            OperationDate nowDate = new OperationDate();
            nowDate.year = startDate.year;
            nowDate.month = startDate.month;
            nowDate.day = startDate.day + startDay - 1;
            textBuilder.Append(nowDate.ToDisplay());
            textBuilder.Append(string.Format(" {0}:{1}", startHour.ToString("D2"), startMinute.ToString("D2")));
            textBuilder.Append(" - ");
            OperationDate endDate = new OperationDate();
            endDate.year = startDate.year;
            endDate.month = startDate.month;
            endDate.day = startDate.day + endDay - 1;
            textBuilder.Append(endDate.ToDisplay());
            textBuilder.Append(string.Format(" {0}:{1}", endHour.ToString("D2"), endMinute.ToString("D2")));
            return textBuilder.ToString();
        }
    }
}