//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Wednesday, July 18, 2018
|
//--------------------------------------------------------
|
using vnxbqy.UI;
|
using System;
|
using System.Collections.Generic;
|
using UnityEngine;
|
|
|
public class CZBMModel : Model
|
{
|
int m_SelectIndex = 0;
|
public int selectIndex
|
{
|
get { return m_SelectIndex; }
|
set
|
{
|
if (m_SelectIndex != value)
|
{
|
m_SelectIndex = value;
|
if (selectUpdate != null)
|
{
|
selectUpdate();
|
}
|
}
|
}
|
}
|
Redpoint redpoint = new Redpoint(434, 440);
|
VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
HAA31_tagMCActGrowupBuyInfo netData;
|
public event Action selectUpdate;
|
|
public override void Init()
|
{
|
m_SelectIndex = 0;
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
public HAA31_tagMCActGrowupBuyInfo.tagMCActGrowupBuyCTGItem[] GetGiftsByCTGID(int ctgID)
|
{
|
OperationCZBM operation;
|
if (OperationTimeHepler.Instance.TryGetOperation(Operation.CZBMGift, out operation))
|
{
|
|
for (int i = 0; i < operation.CZBMGiftInfo.Count; i++)
|
{
|
for (int j = 0; j < operation.CZBMGiftInfo[i].BuyCTGIDList.Length; j++)
|
{
|
if (operation.CZBMGiftInfo[i].BuyCTGIDList[j].CTGID == ctgID)
|
{
|
return operation.CZBMGiftInfo[i].BuyCTGIDList[j].GainItemList;
|
}
|
}
|
}
|
}
|
|
return null;
|
}
|
|
public void ReceivePackage(HAA31_tagMCActGrowupBuyInfo vNetData)
|
{
|
netData = vNetData;
|
UpdateRedpoint();
|
}
|
|
void UpdateRedpoint()
|
{
|
redpoint.state = RedPointState.None;
|
if (DayRemind.Instance.GetDayRemind(DayRemind.CZBM_REDPOINT))
|
return;
|
if (!OperationTimeHepler.Instance.SatisfyOpenCondition(Operation.CZBMGift))
|
return;
|
for (int i = 0; i < netData.GroupCount; i++)
|
{
|
for (int j = 0; j < netData.GroupList[i].BuyCount; j++)
|
{
|
VipModel.RechargeCount rechargeCnt;
|
vipModel.TryGetRechargeCount(netData.GroupList[i].BuyCTGIDList[j].CTGID, out rechargeCnt);
|
if (rechargeCnt.totalCount == 0)
|
{
|
redpoint.state = RedPointState.Simple;
|
break;
|
}
|
}
|
}
|
}
|
public void CloseRedpoint()
|
{
|
redpoint.state = RedPointState.None;
|
}
|
|
}
|