namespace vnxbqy.UI
|
{
|
public class ExclusiveBenefitModel : Model, IBeforePlayerDataInitialize
|
{
|
public int ctgid;
|
public int[] lvArr;
|
VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
|
|
public override void Init()
|
{
|
//PlayerDatas.Instance.playerDataRefreshEvent += OnplayerDataRefreshEvent;
|
ctgid = int.Parse(FuncConfigConfig.Get("ExclusiveBenefit").Numerical1);
|
lvArr = LitJson.JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("ExclusiveBenefit").Numerical2);
|
}
|
|
public bool IsBuy()
|
{
|
VipModel.RechargeCount rechargeCount;
|
vipModel.TryGetRechargeCount(ctgid, out rechargeCount);
|
var ctgConfig = CTGConfig.Get(ctgid);
|
int buyCnt;
|
int totalCnt;
|
if (ctgConfig.DailyBuyCount != 0)
|
{
|
buyCnt = rechargeCount.todayCount;
|
totalCnt = ctgConfig.DailyBuyCount;
|
}
|
else
|
{
|
buyCnt = rechargeCount.totalCount;
|
totalCnt = ctgConfig.TotalBuyCount;
|
}
|
return buyCnt >= totalCnt;
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
|
}
|
|
|
//private void OnplayerDataRefreshEvent(PlayerDataType type)
|
//{
|
// if (type == PlayerDataType.LV)
|
// {
|
// for (int i = 0; i < lvArr.Length; i++)
|
// {
|
// if (PlayerDatas.Instance.baseData.LV == lvArr[i] && !IsBuy())
|
// {
|
// PopupWindowsProcessor.Instance.Add("ExclusiveBenefitWin");
|
// return;
|
// }
|
// }
|
// }
|
//}
|
|
public override void UnInit()
|
{
|
//PlayerDatas.Instance.playerDataRefreshEvent -= OnplayerDataRefreshEvent;
|
}
|
}
|
}
|