using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
|
namespace Snxxz.UI
|
{
|
[XLua.LuaCallCSharp]
|
public class OpenServerActivityNotifyModel : Model,IBeforePlayerDataInitialize,IPlayerLoginOk
|
{
|
|
public override void Init()
|
{
|
|
}
|
|
public void OnBeforePlayerDataInitialize()
|
{
|
FlashRushToBuyActivityClose();
|
GlobalTimeEvent.Instance.minuteEvent -= UpdateMinute;
|
OperationTimeHepler.Instance.operationStartEvent -= OperationStartEvent;
|
OperationTimeHepler.Instance.operationEndEvent -= OperationEndEvent;
|
OperationTimeHepler.Instance.operationTimeUpdateEvent -= OperationTimeEvent;
|
OperationTimeHepler.Instance.operationServerCloseEvent -= OperationServerCloseEvent;
|
NewBieCenter.Instance.guideCompletedEvent -= GuideCompletedEvent;
|
}
|
|
public void OnPlayerLoginOk()
|
{
|
OperationTimeHepler.Instance.operationStartEvent += OperationStartEvent;
|
OperationTimeHepler.Instance.operationEndEvent += OperationEndEvent;
|
OperationTimeHepler.Instance.operationTimeUpdateEvent += OperationTimeEvent;
|
OperationTimeHepler.Instance.operationServerCloseEvent += OperationServerCloseEvent;
|
NewBieCenter.Instance.guideCompletedEvent += GuideCompletedEvent;
|
GlobalTimeEvent.Instance.minuteEvent += UpdateMinute;
|
SetFlashRushToBuyNotify();
|
if (!WindowCenter.Instance.IsOpen<OpenServerActivityNotifyWin>())
|
{
|
WindowCenter.Instance.Open<OpenServerActivityNotifyWin>();
|
}
|
}
|
|
public override void UnInit()
|
{
|
|
}
|
|
private void UpdateMinute()
|
{
|
SetFlashRushToBuyNotify();
|
}
|
|
private void OperationTimeEvent(Operation type)
|
{
|
switch (type)
|
{
|
case Operation.MultipleExp:
|
break;
|
case Operation.ConsumeRebate:
|
break;
|
case Operation.FlashSale:
|
break;
|
case Operation.BossReborn:
|
break;
|
case Operation.GiftPackage:
|
break;
|
case Operation.FairyCeremony:
|
break;
|
case Operation.MultipRealmPoint:
|
break;
|
case Operation.FlashRushToBuy:
|
SetFlashRushToBuyNotify();
|
break;
|
case Operation.max:
|
break;
|
}
|
}
|
|
private void OperationStartEvent(Operation type, int state)
|
{
|
switch (type)
|
{
|
case Operation.MultipleExp:
|
break;
|
case Operation.ConsumeRebate:
|
break;
|
case Operation.FlashSale:
|
break;
|
case Operation.BossReborn:
|
break;
|
case Operation.GiftPackage:
|
break;
|
case Operation.FairyCeremony:
|
break;
|
case Operation.MultipRealmPoint:
|
break;
|
case Operation.FlashRushToBuy:
|
SetFlashRushToBuyNotify();
|
break;
|
case Operation.max:
|
break;
|
}
|
}
|
|
|
private void OperationServerCloseEvent(Operation type)
|
{
|
switch (type)
|
{
|
case Operation.MultipleExp:
|
break;
|
case Operation.ConsumeRebate:
|
break;
|
case Operation.FlashSale:
|
break;
|
case Operation.BossReborn:
|
break;
|
case Operation.GiftPackage:
|
break;
|
case Operation.FairyCeremony:
|
break;
|
case Operation.MultipRealmPoint:
|
break;
|
case Operation.FlashRushToBuy:
|
FlashRushToBuyActivityClose();
|
break;
|
case Operation.max:
|
break;
|
}
|
}
|
|
private void OperationEndEvent(Operation type, int state)
|
{
|
switch (type)
|
{
|
case Operation.MultipleExp:
|
break;
|
case Operation.ConsumeRebate:
|
break;
|
case Operation.FlashSale:
|
break;
|
case Operation.BossReborn:
|
break;
|
case Operation.GiftPackage:
|
break;
|
case Operation.FairyCeremony:
|
break;
|
case Operation.MultipRealmPoint:
|
break;
|
case Operation.FlashRushToBuy:
|
FlashRushToBuyActivityClose();
|
break;
|
case Operation.max:
|
break;
|
}
|
}
|
|
private void GuideCompletedEvent(int id)
|
{
|
SetFlashRushToBuyNotify();
|
}
|
|
#region 限时抢购
|
public event Action UpdateFlashRushToBuyEvent;
|
FlashRushToBuyModel rushToBuyModel { get { return ModelCenter.Instance.GetModel<FlashRushToBuyModel>(); } }
|
public List<OperationFlashRushToBuy.FlashSaleShop> flashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
|
public void SetFlashRushToBuyNotify()
|
{
|
if (NewBieCenter.Instance.inGuiding) return;
|
|
OperationFlashRushToBuy.FlashSaleShop saleShop = null;
|
bool isPush = rushToBuyModel.CheckIsPush(out saleShop);
|
if(isPush && !flashSaleShops.Contains(saleShop))
|
{
|
flashSaleShops.Add(saleShop);
|
if(UpdateFlashRushToBuyEvent != null)
|
{
|
UpdateFlashRushToBuyEvent();
|
}
|
}
|
}
|
|
public void FlashRushToBuyActivityClose()
|
{
|
flashSaleShops.Clear();
|
closeflashSaleShops.Clear();
|
if (UpdateFlashRushToBuyEvent != null)
|
{
|
UpdateFlashRushToBuyEvent();
|
}
|
}
|
|
public List<OperationFlashRushToBuy.FlashSaleShop> closeflashSaleShops = new List<OperationFlashRushToBuy.FlashSaleShop>();
|
public void SetCloseFlashRushToBuyList()
|
{
|
if(flashSaleShops.Count > 0)
|
{
|
closeflashSaleShops.Add(flashSaleShops[flashSaleShops.Count - 1]);
|
}
|
}
|
|
#endregion
|
|
}
|
}
|