using System.Collections.Generic;
|
|
namespace vnxbqy.UI
|
{
|
//轮回殿活动
|
public class OperationCycleHall : OperationBase
|
{
|
// <轮回类型, HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianRound>
|
public Dictionary<int, HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianRound> roundInfoDict = new Dictionary<int, HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianRound>();
|
CycleHallActModel model { get { return ModelCenter.Instance.GetModel<CycleHallActModel>(); } }
|
public bool TryGetRound(int roundType, out HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianRound round)
|
{
|
return roundInfoDict.TryGetValue(roundType, out round);
|
}
|
|
public bool TryGetRoundInfoByIndex(int roundType, int awardIndex, out HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianAward awardInfo, out int listIndex)
|
{
|
listIndex = 0;
|
awardInfo = new HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianAward { };
|
if (!TryGetRound(roundType, out var round) || round.AwardList == null)
|
return false;
|
for (int i = 0; i < round.AwardList.Length; i++)
|
{
|
if (round.AwardList[i].AwardIndex == awardIndex)
|
{
|
awardInfo = round.AwardList[i];
|
listIndex = i;
|
return true;
|
}
|
}
|
return false;
|
}
|
|
public bool TryGetRoundInfoByNeedValue(int roundType, int needValue, out HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianAward awardInfo)
|
{
|
awardInfo = new HAA88_tagMCActLunhuidianInfo.tagMCActLunhuidianAward { };
|
if (!TryGetRound(roundType, out var round) || round.AwardList == null)
|
return false;
|
for (int i = 0; i < round.AwardList.Length; i++)
|
{
|
if (round.AwardList[i].NeedValue == needValue)
|
{
|
awardInfo = round.AwardList[i];
|
return true;
|
}
|
}
|
return true;
|
}
|
|
public override bool SatisfyOpenCondition()
|
{
|
return PlayerDatas.Instance.baseData.LV >= limitLv;
|
}
|
|
public override string ToDisplayTime()
|
{
|
var textBuilder = OperationTimeHepler.textBuilder;
|
textBuilder.Length = 0;
|
textBuilder.Append(startDate.ToDisplay());
|
if (startDate != endDate)
|
{
|
textBuilder.Append("—");
|
textBuilder.Append(endDate.ToDisplay());
|
}
|
return textBuilder.ToString();
|
}
|
|
public override void Reset()
|
{
|
base.Reset();
|
roundInfoDict.Clear();
|
model.lastCurRoundDict.Clear();
|
model.lastCurValueDict.Clear();
|
}
|
|
public void ParseCycleHallInfo(HAA88_tagMCActLunhuidianInfo package)
|
{
|
roundInfoDict.Clear();
|
for (int i = 0; i < package.RoundList.Length; i++)
|
{
|
roundInfoDict[package.RoundList[i].RoundType] = package.RoundList[i];
|
}
|
}
|
}
|
}
|