| | |
| | | {
|
| | | currentShopId = 0;
|
| | | helpPointShoplist.Clear();
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= UpdateFBHelpPoint;
|
| | | storeModel.UpdateHelpPointExchangeEvent -= UpdateHelpPointShop;
|
| | | storeModel.RefreshTCBPlayerDataEvent -= UpdateFBHelpPoint;
|
| | | TimeMgr.Instance.OnDayEvent -= UpdateDay;
|
| | | }
|
| | |
|
| | |
| | | shopDayLocalSave = StringUtility.Contact("ShopDayLocalSave",playerId);
|
| | | shopLifeLocalSave = StringUtility.Contact("ShopLifeLocalSave",playerId);
|
| | | curDayLocalSave = StringUtility.Contact("CurDayLocalSave",playerId);
|
| | | PlayerDatas.Instance.PlayerDataRefreshInfoEvent += UpdateFBHelpPoint;
|
| | | storeModel.RefreshTCBPlayerDataEvent += UpdateFBHelpPoint;
|
| | | TimeMgr.Instance.OnDayEvent += UpdateDay;
|
| | | storeModel.UpdateHelpPointExchangeEvent += UpdateHelpPointShop;
|
| | | GetLocalSaveData();
|
| | | }
|
| | |
|
| | |
| | |
|
| | | private void UpdateFBHelpPoint(PlayerDataRefresh type)
|
| | | {
|
| | | if (type != PlayerDataRefresh.FBHelpPoint) return;
|
| | | if (type != PlayerDataRefresh.FBHelpPoint |
| | | || !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | |
|
| | | var storeDatas = storeModel.TryGetStoreDatas((int)StoreFunc.IntegralStore);
|
| | | if(storeDatas != null)
|
| | | {
|
| | | for(int i = 0; i < storeDatas.Count; i++)
|
| | | {
|
| | | var storeData = storeDatas[i];
|
| | | int pushType = 0;
|
| | | storeModel.TryGetPushTypeByShopId(storeData.shopId,out pushType);
|
| | | if(pushType != 0)
|
| | | {
|
| | | int remainNum = 0;
|
| | | bool isSellOut = storeModel.TryGetIsSellOut(storeData.storeConfig,out remainNum);
|
| | | ulong haveMoney = UIHelper.GetMoneyCnt(storeData.storeConfig.MoneyType);
|
| | | bool isEnoughMoney = haveMoney >= (ulong)storeData.storeConfig.MoneyNumber ? true : false;
|
| | | if(!isSellOut && isEnoughMoney)
|
| | | {
|
| | | UpdateHelpPointShop(storeData.shopId);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | for(int i = 0; i < helpPointShoplist.Count; i++)
|
| | | {
|
| | |
| | | {
|
| | | helpPointShoplist.Remove(shopId);
|
| | | }
|
| | | int type = 0;
|
| | | bool isPush = storeModel.TryGetPushTypeByShopId(shopId, out type);
|
| | | SetLocalSaveData(type, shopId);
|
| | | }
|
| | |
|
| | | private void UpdateHelpPointShop(int shopId)
|
| | |
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopId);
|
| | | if (storeConfig == null) return;
|
| | |
|
| | | currentShopId = shopId;
|
| | | AddHelpPointShop(shopId);
|
| | | if(UpdateHelpPointShopEvent != null)
|
| | | if(!IsAlreadPush(shopId))
|
| | | {
|
| | | currentShopId = shopId;
|
| | | AddHelpPointShop(shopId);
|
| | | if (UpdateHelpPointShopEvent != null)
|
| | | {
|
| | | UpdateHelpPointShopEvent();
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void GetNextHelpPointShop(int shopId)
|
| | | {
|
| | | RemoveHelpPointShop(shopId);
|
| | | int length = helpPointShoplist.Count;
|
| | | currentShopId = length == 0 ? 0 : helpPointShoplist[length - 1];
|
| | | if (UpdateHelpPointShopEvent != null)
|
| | | {
|
| | | UpdateHelpPointShopEvent();
|
| | | }
|
| | |
| | |
|
| | | public bool IsAlreadPush(int shopId)
|
| | | {
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopId);
|
| | | if (storeConfig == null) return false;
|
| | |
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storeConfig.ItemID);
|
| | | switch((ItemType)itemConfig.Type)
|
| | | int type = 0;
|
| | | storeModel.TryGetPushTypeByShopId(shopId, out type);
|
| | | switch (type)
|
| | | {
|
| | | case ItemType.OfflineCard:
|
| | | case 1:
|
| | | if(todayShoplist != null |
| | | && todayShoplist.Contains(shopId))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | break;
|
| | | case ItemType.MountDan:
|
| | | break;
|
| | | default:
|
| | | case 2:
|
| | | if (lifeShoplist != null
|
| | | && lifeShoplist.Contains(shopId))
|
| | | {
|
| | | return true;
|
| | | }
|
| | | break;
|
| | | }
|
| | | return true;
|
| | | return false;
|
| | | }
|
| | | }
|
| | | }
|