using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
namespace Snxxz.UI
|
{
|
public class OperationLuckyTreasure : OperationBase
|
{
|
public int sumLuckPoint; //// 总幸运值
|
public List<LuckyTreasureItem> luckTreasureItems = new List<LuckyTreasureItem>();
|
|
public override void Reset()
|
{
|
base.Reset();
|
sumLuckPoint = 0;
|
luckTreasureItems.Clear();
|
}
|
|
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 int GetActivityDay()
|
{
|
int dayIndex = IndexOfDays(TimeUtility.ServerNow);
|
if(resetType == 0)
|
{
|
return dayIndex + 1;
|
}
|
else if(resetType == 1)
|
{
|
if(IsLastDay)
|
{
|
return dayIndex;
|
}
|
else
|
{
|
return dayIndex + 1;
|
}
|
}
|
return dayIndex + 1;
|
}
|
|
public int GetActivitySumDay()
|
{
|
if(resetType == 0)
|
{
|
return totalDays + 1;
|
}
|
else if(resetType == 1)
|
{
|
return totalDays;
|
}
|
return totalDays;
|
}
|
|
public void ParsePackage(HAA1F_tagMCLuckyTreasureInfo package)
|
{
|
for (int i = 0; i < package.Count; i++)
|
{
|
var itemInfo = package.ItemList[i];
|
LuckyTreasureItem treasureItem = new LuckyTreasureItem((int)itemInfo.ItemID,itemInfo.ItemCnt,itemInfo.IsBind);
|
luckTreasureItems.Add(treasureItem);
|
}
|
}
|
|
public bool TryGetLuckBigAward(out LuckyTreasureItem treasureItem)
|
{
|
treasureItem = null;
|
if(luckTreasureItems != null && luckTreasureItems.Count > 0)
|
{
|
treasureItem = luckTreasureItems[luckTreasureItems.Count - 1];
|
}
|
return treasureItem != null;
|
}
|
|
public class LuckyTreasureItem
|
{
|
public int itemId;
|
public int itemCount;
|
public int isBind;
|
|
public LuckyTreasureItem(int id, int count, int isBind)
|
{
|
this.itemId = id;
|
this.itemCount = count;
|
this.isBind = isBind;
|
}
|
}
|
}
|
}
|
|