using vnxbqy.UI;
|
using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
public class OperationLuckyCloudBuy : OperationBase
|
{
|
public int m_ZoneID; // 所属分区ID
|
public int m_RoundID; // 轮次唯一ID标识,当收到的轮次ID变更时,前端需清空购买号码记录缓存
|
public int m_RoundNum; // 今日第几轮 , 红点控制
|
public int m_SuperItemID; // 大奖物品ID
|
public int m_SuperItemCount; // 大奖物品个数
|
public int m_SuperItemMoneyType; // 大奖价值货币类型
|
public int m_SuperItemMoneyValue; // 大奖价值
|
public List<ILItem> m_RandItemList = new List<ILItem>(); // 每次购买随机奖励物品信息
|
List<List<int>> openTimes = new List<List<int>>();
|
|
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();
|
|
}
|
|
public void UpdateLuckyCloudBuyRoundInfo(IL_HC012_tagGCLuckyCloudBuyRoundInfo netPack)
|
{
|
m_ZoneID = netPack.ZoneID;
|
m_RoundID = (int)netPack.RoundID;
|
m_RoundNum = netPack.RoundNum;
|
m_SuperItemID = (int)netPack.SuperItemID;
|
m_SuperItemCount = netPack.SuperItemCount;
|
m_SuperItemMoneyType = netPack.SuperItemMoneyType;
|
m_SuperItemMoneyValue = (int)netPack.SuperItemMoneyValue;
|
|
m_RandItemList.Clear();
|
for (int i = 0; i < netPack.RandItemCount; i++)
|
{
|
m_RandItemList.Add(new ILItem()
|
{
|
id = (int)netPack.RandItemList[i].ItemID,
|
count = netPack.RandItemList[i].ItemCount,
|
bind = netPack.RandItemList[i].IsBind,
|
}) ;
|
}
|
|
openTimes.Clear();
|
for (int i = 0; i < netPack.RoundTimeList.Length; i++)
|
{
|
List<int> startEndTime = new List<int>();
|
startEndTime.Add(int.Parse(netPack.RoundTimeList[i].StartTime.Split(':')[0]));
|
startEndTime.Add(int.Parse(netPack.RoundTimeList[i].StartTime.Split(':')[1]));
|
startEndTime.Add(int.Parse(netPack.RoundTimeList[i].EndtTime.Split(':')[0]));
|
startEndTime.Add(int.Parse(netPack.RoundTimeList[i].EndtTime.Split(':')[1]));
|
startEndTime.Add(netPack.RoundTimeList[i].RoundMax);
|
openTimes.Add(startEndTime);
|
}
|
}
|
|
//获取下次的开启时间[时,分]
|
public List<int> GetStartTime()
|
{
|
var hour = ILTimeUtility.ServerCrossNow.Hour;//TimeUtility.Hour;
|
var minute = ILTimeUtility.ServerCrossNow.Minute;//TimeUtility.Minute;
|
|
for (int i = 0; i < openTimes.Count; i++)
|
{
|
var startHour = openTimes[i][0];
|
var startMinute = openTimes[i][1];
|
|
if (hour > startHour || (hour == startHour && minute > startMinute))
|
{
|
continue;
|
}
|
return new List<int> { startHour, startMinute };
|
}
|
return null;
|
}
|
|
public bool IsOver()
|
{
|
var hour = ILTimeUtility.ServerCrossNow.Hour;//TimeUtility.Hour;
|
var minute = ILTimeUtility.ServerCrossNow.Minute;//TimeUtility.Minute;
|
|
for (int i = 0; i < openTimes.Count; i++)
|
{
|
var startHour = openTimes[i][0];
|
var startMinute = openTimes[i][1];
|
var endHour = openTimes[i][2];
|
var endMinute = openTimes[i][3];
|
if (((hour == startHour && minute >= startMinute) || hour > startHour) &&
|
((hour == endHour && minute <= endMinute) || hour < endHour))
|
{
|
if (m_RoundNum < openTimes[i][4])
|
{
|
return false;
|
}
|
else if (LuckyCloudBuyModel.Instance.remainCnt == 0)
|
{
|
return true;
|
}
|
}
|
}
|
return true;
|
}
|
}
|