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();
|
}
|
}
|
}
|