| | |
| | | public Dictionary<int, string> resetTimeDict { get; private set; }
|
| | | public Dictionary<int, int> showCoinsUIDict { get; private set; }
|
| | | public int[] StoreRedIdlist { get; private set;}
|
| | | bool isLogin = true;
|
| | | public override void Init()
|
| | | {
|
| | | FuncConfigConfig buyItemHinit = Config.Instance.Get<FuncConfigConfig>("BuyItemHinit");
|
| | |
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | IsMustBuyDay = false;
|
| | | isLogin = true;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= FuncStateChange;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyMine -= RefreshServerHour;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= RefreshFamilyLv;
|
| | |
| | | FuncOpen.Instance.OnFuncStateChangeEvent += FuncStateChange;
|
| | | RefreshTCBPlayerDataEvent += RefreshPlayerLv;
|
| | | TimeMgr.Instance.OnHourEvent += RefreshServerHour;
|
| | |
|
| | | SetIsMustBuyDay();
|
| | | shoplist = null;
|
| | | CheckWeekStoreIsShopBuy(out shoplist);
|
| | | ControllerRedPoint();
|
| | | SetShopRedpoint();
|
| | | CheckShopRedpoint();
|
| | | SetJobReplaceIDDict();
|
| | | UpdateMustBuyRedpoint();
|
| | | isLogin = false;
|
| | | }
|
| | |
|
| | | public string GetStoreRefreshTimeByType(int type)
|
| | |
| | | switch(type)
|
| | | {
|
| | | case PlayerDataRefresh.LV:
|
| | | CheckShopRedpoint();
|
| | | UpdateMustBuyRedpoint();
|
| | | break;
|
| | | case PlayerDataRefresh.VIPLv:
|
| | | case PlayerDataRefresh.Gold:
|
| | | case PlayerDataRefresh.GoldPaper:
|
| | |
| | | private void RefreshServerHour()
|
| | | {
|
| | | ControllerRedPoint();
|
| | | if (PlayerPrefs.HasKey(MUSTBUYSAVE_KEY))
|
| | | {
|
| | | int day = LocalSave.GetInt(MUSTBUYSAVE_KEY);
|
| | | if (day != TimeUtility.ServerNow.Day)
|
| | | {
|
| | | IsMustBuyDay = true;
|
| | | LocalSave.SetInt(MUSTBUYSAVE_KEY, TimeUtility.ServerNow.Day);
|
| | | UpdateMustBuyRedpoint();
|
| | | }
|
| | | }
|
| | | if(!PlayerDatas.Instance.fairyData.HasFairy)
|
| | | {
|
| | | PlayerPrefs.DeleteKey(UNIONSTORESAVE_KEY);
|
| | |
| | | }
|
| | |
|
| | | }
|
| | | |
| | | if(!isLogin)
|
| | | {
|
| | | CheckShopRedpoint();
|
| | | UpdateMustBuyRedpoint();
|
| | | }
|
| | | if (RefreshBuyShopLimitEvent != null)
|
| | | RefreshBuyShopLimitEvent();
|
| | | }
|
| | |
| | | }
|
| | | SetShopRedpoint();
|
| | | CheckShopRedpoint();
|
| | | UpdateMustBuyRedpoint();
|
| | | }
|
| | |
|
| | | public bool CheckWeekStoreIsShopBuy(out List<StoreConfig> buylist)
|
| | |
| | | foreach(var key in shopRedDict.Keys)
|
| | | {
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
|
| | | if(!mustIdlist.Contains(storeConfig.ItemID))
|
| | | {
|
| | | if (storeConfig.MoneyNumber == 0)
|
| | | {
|
| | | if(CheckShopIsCanBuy(storeConfig))
|
| | |
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | UpdateMustBuyRedpoint(storeConfig);
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateMustBuyRedpoint(StoreConfig storeConfig)
|
| | | public void UpdateMustBuyRedpoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | |
|
| | | foreach (var key in shopRedDict.Keys)
|
| | | {
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
|
| | | if(mustIdlist.Contains(storeConfig.ItemID))
|
| | | {
|
| | | if (CheckIsMustBuy(storeConfig))
|
| | | {
|
| | |
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void ClearMustBuyRedpoint(StoreConfig storeConfig)
|
| | | {
|
| | | if(mustIdlist.Contains(storeConfig.ItemID))
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | IsMustBuyDay = false;
|
| | | }
|
| | | }
|
| | |
|
| | | public bool IsMustBuyDay { get; private set; }
|
| | | public void SetIsMustBuyDay()
|
| | | {
|
| | | if (IsMustBuyDay) return;
|
| | |
|
| | | if (PlayerPrefs.HasKey(MUSTBUYSAVE_KEY))
|
| | | {
|
| | | int day = LocalSave.GetInt(MUSTBUYSAVE_KEY);
|
| | | if (day != TimeUtility.ServerNow.Day)
|
| | | {
|
| | | IsMustBuyDay = true;
|
| | | LocalSave.SetInt(MUSTBUYSAVE_KEY, TimeUtility.ServerNow.Day);
|
| | | }
|
| | | else
|
| | | {
|
| | | IsMustBuyDay = false;
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | IsMustBuyDay = true;
|
| | | LocalSave.SetInt(MUSTBUYSAVE_KEY, TimeUtility.ServerNow.Day);
|
| | | }
|
| | | }
|
| | |
|
| | | public List<int> mustIdlist = new List<int>() { 4741};
|
| | | public bool CheckIsMustBuy(StoreConfig config)
|
| | | {
|
| | | if(mustIdlist.Contains(config.ItemID)
|
| | | && CheckShopIsCanBuy(config))
|
| | | {
|
| | | if(IsNewDay(MUSTBUYSAVE_KEY))
|
| | | if(CheckShopIsCanBuy(config) && IsMustBuyDay)
|
| | | {
|
| | | return true;
|
| | | }
|
| | | }
|
| | | return false;
|
| | | }
|