| | |
| | | using UnityEngine; |
| | | namespace Snxxz.UI
|
| | | {
|
| | | public class OSGiftModel : Model, IPlayerLoginOk, IBeforePlayerDataInitialize
|
| | | public class OSGiftModel : Model, IPlayerLoginOk, IBeforePlayerDataInitialize, IOpenServerActivity
|
| | | {
|
| | | public override void Init()
|
| | | {
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += PlayerDataRefreshInfoEvent;
|
| | | storeModel.RefreshBuyShopLimitEvent += RefreshBuyShopLimitEvent;
|
| | | vipModel.firstChargeRewardEvent += firstChargeRewardEvent;
|
| | | vipModel.firstChargeRewardEvent += FirstChargeRewardEvent;
|
| | | OpenServerActivityCenter.Instance.Register(6, this);
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | |
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | activate = CheckActivate();
|
| | | if (OnOSGiftStateChange != null)
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | OnOSGiftStateChange();
|
| | | onStateUpate(6);
|
| | | }
|
| | | }
|
| | |
|
| | | public event Action OnOSGiftStateChange;
|
| | | public event Action<int> onStateUpate;
|
| | |
|
| | | public bool activate { get; private set; }
|
| | |
|
| | |
| | | {
|
| | | m_GiftGetNotify = value;
|
| | | OSGiftRedpoint.state = value ? RedPointState.Simple : RedPointState.None;
|
| | | if (OnOSGiftStateChange != null)
|
| | | {
|
| | | OnOSGiftStateChange();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | |
|
| | | VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
|
| | |
|
| | | public bool CheckOpen()
|
| | | public bool IsOpen
|
| | | {
|
| | | if (!login)
|
| | | get
|
| | | {
|
| | | return false;
|
| | | return CheckActivate();
|
| | | }
|
| | | login = false;
|
| | | if (!PreFightMission.Instance.IsFinished()
|
| | | || DayRemind.Instance.GetDayRemind(DayRemind.OSGIFT_TIP) || PlayerDatas.Instance.baseData.coinPointTotal == 0
|
| | | || !ModelCenter.Instance.GetModel<VipModel>().firstChargeRewardGet)
|
| | | }
|
| | |
|
| | | public bool priorityOpen
|
| | | {
|
| | | get
|
| | | {
|
| | | return false;
|
| | | return OSGiftRedpoint.state == RedPointState.Simple;
|
| | | }
|
| | | var _list = StoreConfig.GetTypeStoreModel((int)StoreFunc.OSGift);
|
| | | for (int i = 0; i < _list.Count; i++)
|
| | | {
|
| | | var _limit = storeModel.GetBuyShopLimit((uint)_list[i].ID);
|
| | | if (_limit == null || _limit.BuyCnt < _list[i].PurchaseNumber[0])
|
| | | {
|
| | | if (!WindowCenter.Instance.CheckOpen<OpenServerGiftWin>())
|
| | | {
|
| | | DayRemind.Instance.SetDayRemind(DayRemind.OSGIFT_TIP, true);
|
| | | WindowCenter.Instance.Open<OpenServerGiftWin>();
|
| | | return true;
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|
| | |
|
| | | private void RefreshBuyShopLimitEvent()
|
| | |
| | | if (activate != _activate)
|
| | | {
|
| | | activate = _activate;
|
| | | if (OnOSGiftStateChange != null)
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | OnOSGiftStateChange();
|
| | | onStateUpate(6);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private void firstChargeRewardEvent()
|
| | | private void FirstChargeRewardEvent()
|
| | | {
|
| | | bool _activate = CheckActivate();
|
| | | if (activate != _activate)
|
| | | {
|
| | | activate = _activate;
|
| | | if (OnOSGiftStateChange != null)
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | OnOSGiftStateChange();
|
| | | onStateUpate(6);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | if (_type == PlayerDataRefresh.ChangeCoinPointTotal && activate != _activate)
|
| | | {
|
| | | activate = _activate;
|
| | | if (OnOSGiftStateChange != null)
|
| | | if (onStateUpate != null)
|
| | | {
|
| | | OnOSGiftStateChange();
|
| | | onStateUpate(6);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | private bool login = false;
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | giftGetNotify = false;
|
| | | if (!(StageManager.Instance.CurrentStage is DungeonStage))
|
| | | {
|
| | | login = true;
|
| | | }
|
| | | else
|
| | | {
|
| | | login = false;
|
| | | }
|
| | | }
|
| | |
|
| | | public Redpoint OSGiftRedpoint = new Redpoint(2, 36);
|
| | | public Redpoint OSGiftRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENSERVER, 20906);
|
| | | }
|
| | | } |
| | | |