using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
namespace vnxbqy.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()
|
{
|
int remainSeconds = GetSurplusTime(TimeUtility.ServerNow);
|
int remainDay = remainSeconds/(24*60*60);
|
int remainHour = remainSeconds / (60 * 60);
|
if(remainDay > 0)
|
{
|
return StringUtility.Contact(remainDay,Language.Get("L1074"));
|
}
|
else if(remainHour < 1)
|
{
|
int mins = remainSeconds / 60;
|
int seconds = remainSeconds % 60;
|
return StringUtility.Contact(mins,Language.Get("Minute"),seconds,Language.Get("RealmWin_Bewrite_35"));
|
}
|
else
|
{
|
return StringUtility.Contact(remainHour, Language.Get("Hour"));
|
}
|
}
|
|
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;
|
}
|
}
|
}
|
}
|
|