| | |
| | | using TableConfig;
|
| | | using UnityEngine;
|
| | | using LitJson;
|
| | | using System.Collections;
|
| | |
|
| | | public class BuyShopItemLimit
|
| | | {
|
| | |
| | | showCoinsUIDict = ConfigParse.GetDic<int, int>(mallCurrency.Numerical1);
|
| | | FuncConfigConfig mallPush = Config.Instance.Get<FuncConfigConfig>("MallPush");
|
| | | StoreRedIdlist = ConfigParse.GetMultipleStr<int>(mallPush.Numerical2);
|
| | | MainInterfaceWin.IsCopyOfThePanel += OnMoveTopPart;
|
| | | }
|
| | |
|
| | | public void OnBeforePlayerDataInitialize()
|
| | | {
|
| | | IsMustBuyDay = false;
|
| | | isLogin = true;
|
| | | StageManager.Instance.onStageLoadFinish -= OnStageLoadFinish;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent -= FuncStateChange;
|
| | | WindowCenter.Instance.windowAfterCloseEvent -= windowAfterOpen;
|
| | | WindowCenter.Instance.windowAfterCloseEvent -= windowAfterClose;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyMine -= RefreshServerHour;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= RefreshFamilyLv;
|
| | | RefreshTCBPlayerDataEvent -= RefreshPlayerLv;
|
| | | TimeMgr.Instance.OnHourEvent -= RefreshServerHour;
|
| | | NewBieCenter.Instance.guideBeginEvent -= GuidBegin;
|
| | | shopItemlimitDict.Clear();
|
| | | petAndMountPushlist.Clear();
|
| | | tagTowerModel = null;
|
| | | storeFuncType = StoreFunc.WeekStore;
|
| | | tcbRefreshDict.Clear();
|
| | |
| | |
|
| | | public void OnPlayerLoginOk()
|
| | | {
|
| | | |
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyInfo += RefreshFamilyLv;
|
| | | PlayerDatas.Instance.fairyData.OnRefreshFairyMine += RefreshServerHour;
|
| | | FuncOpen.Instance.OnFuncStateChangeEvent += FuncStateChange;
|
| | | RefreshTCBPlayerDataEvent += RefreshPlayerLv;
|
| | | TimeMgr.Instance.OnHourEvent += RefreshServerHour;
|
| | | StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
|
| | | WindowCenter.Instance.windowAfterOpenEvent += windowAfterOpen;
|
| | | WindowCenter.Instance.windowAfterCloseEvent += windowAfterClose;
|
| | | NewBieCenter.Instance.guideBeginEvent += GuidBegin;
|
| | | SetIsMustBuyDay();
|
| | | shoplist = null;
|
| | | CheckWeekStoreIsShopBuy(out shoplist);
|
| | | ControllerRedPoint();
|
| | | SetShopRedpoint();
|
| | | CheckShopRedpoint();
|
| | | UpdateFreeShopRedpoint();
|
| | | UpdateCanBuyRedpoint();
|
| | | SetJobReplaceIDDict();
|
| | | UpdateMustBuyRedpoint();
|
| | | UpdatePetAndMountPutAwayRedpoint();
|
| | | isLogin = false;
|
| | | }
|
| | |
|
| | |
| | | switch(type)
|
| | | {
|
| | | case PlayerDataRefresh.LV:
|
| | | CheckShopRedpoint();
|
| | | UpdateFreeShopRedpoint();
|
| | | UpdateCanBuyRedpoint();
|
| | | UpdateMustBuyRedpoint();
|
| | | UpdatePetAndMountPutAwayRedpoint();
|
| | | break;
|
| | | case PlayerDataRefresh.VIPLv:
|
| | | case PlayerDataRefresh.Gold:
|
| | | case PlayerDataRefresh.GoldPaper:
|
| | | case PlayerDataRefresh.FBHelpPoint:
|
| | | CheckShopRedpoint();
|
| | | UpdateFreeShopRedpoint();
|
| | | UpdateCanBuyRedpoint();
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | public override void UnInit()
|
| | | {
|
| | | |
| | | MainInterfaceWin.IsCopyOfThePanel -= OnMoveTopPart;
|
| | | }
|
| | |
|
| | | ItemTipsModel _itemTipsModel;
|
| | |
| | |
|
| | | if(!isLogin)
|
| | | {
|
| | | CheckShopRedpoint();
|
| | | UpdateFreeShopRedpoint();
|
| | | UpdateCanBuyRedpoint();
|
| | | UpdateMustBuyRedpoint();
|
| | | UpdatePetAndMountPutAwayRedpoint();
|
| | | }
|
| | | if (RefreshBuyShopLimitEvent != null)
|
| | | RefreshBuyShopLimitEvent();
|
| | |
| | | }
|
| | | }
|
| | | SetShopRedpoint();
|
| | | CheckShopRedpoint();
|
| | | UpdateFreeShopRedpoint();
|
| | | UpdateCanBuyRedpoint();
|
| | | UpdateMustBuyRedpoint();
|
| | | UpdatePetAndMountPutAwayRedpoint();
|
| | | }
|
| | |
|
| | | public bool CheckWeekStoreIsShopBuy(out List<StoreConfig> buylist)
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | public void CheckShopRedpoint()
|
| | | public void UpdateFreeShopRedpoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | | |
| | | foreach(var key in shopRedDict.Keys)
|
| | |
|
| | | foreach (var key in shopRedDict.Keys)
|
| | | {
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
|
| | | if(!mustIdlist.Contains(storeConfig.ItemID))
|
| | | if (storeConfig.MoneyNumber == 0)
|
| | | {
|
| | | if (storeConfig.MoneyNumber == 0)
|
| | | if (CheckShopIsCanBuy(storeConfig))
|
| | | {
|
| | | if (CheckShopIsCanBuy(storeConfig))
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void UpdateCanBuyRedpoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | |
|
| | | foreach (var key in shopRedDict.Keys)
|
| | | {
|
| | | StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
|
| | | if (StoreRedIdlist.Contains(storeConfig.ID))
|
| | | {
|
| | | if (CheckShopIsCanBuy(storeConfig))
|
| | | {
|
| | | if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.Simple;
|
| | | }
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (CheckScoreStoreIsCanBuy(storeConfig))
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | }
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | }
|
| | |
|
| | |
| | | return false;
|
| | | }
|
| | |
|
| | | /// <summary>
|
| | | /// 新灵宠坐骑上架红点
|
| | | /// </summary>
|
| | | public void UpdatePetAndMountPutAwayRedpoint()
|
| | | {
|
| | | if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
|
| | |
|
| | | List<StoreConfig> storelist = StoreConfig.GetAllShoplist();
|
| | | for(int i = 0; i < storelist.Count; i++)
|
| | | {
|
| | | if (storelist[i].ShopType != (int)StoreFunc.GrowStrongerStore) continue;
|
| | |
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storelist[i].ItemID);
|
| | | string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"ShopId",storelist[i].ID);
|
| | | switch(itemConfig.Type)
|
| | | {
|
| | | case 26:
|
| | | case 41:
|
| | | if(CheckShopIsCanBuy(storelist[i]))
|
| | | {
|
| | | if (!PlayerPrefs.HasKey(key))
|
| | | {
|
| | | shopRedDict[storelist[i].ID].state = RedPointState.Simple;
|
| | | LocalSave.SetBool(key,true);
|
| | | SetPetAndMountPushData(storelist[i].ID);
|
| | | }
|
| | | else
|
| | | {
|
| | | if(LocalSave.GetBool(key))
|
| | | {
|
| | | shopRedDict[storelist[i].ID].state = RedPointState.Simple;
|
| | | }
|
| | | else
|
| | | {
|
| | | shopRedDict[storelist[i].ID].state = RedPointState.None;
|
| | | }
|
| | | |
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | PlayerPrefs.DeleteKey(key);
|
| | | shopRedDict[storelist[i].ID].state = RedPointState.None;
|
| | | }
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | public void ClearPetAndMountRedpoint(StoreConfig storeConfig)
|
| | | {
|
| | | ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storeConfig.ItemID);
|
| | | switch (itemConfig.Type)
|
| | | {
|
| | | case 26:
|
| | | case 41:
|
| | | string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", storeConfig.ID);
|
| | | if (shopRedDict[storeConfig.ID].state == RedPointState.Simple)
|
| | | {
|
| | | shopRedDict[storeConfig.ID].state = RedPointState.None;
|
| | | LocalSave.SetBool(key,false);
|
| | | }
|
| | | break;
|
| | | }
|
| | | |
| | | }
|
| | | #endregion
|
| | |
|
| | | #region 坐骑灵宠推送
|
| | |
|
| | | List<int> petAndMountPushlist = new List<int>();
|
| | | public int currentPushId { get; private set; }
|
| | | public event Action pushRefreshEvent;
|
| | | private void SetPetAndMountPushData(int shopId)
|
| | | {
|
| | | if (!petAndMountPushlist.Contains(shopId))
|
| | | {
|
| | | petAndMountPushlist.Add(shopId);
|
| | | }
|
| | |
|
| | | if (currentPushId == 0 || (currentPushId != 0 && currentPushId != shopId))
|
| | | {
|
| | | currentPushId = shopId;
|
| | | if (pushRefreshEvent != null)
|
| | | {
|
| | | pushRefreshEvent();
|
| | | }
|
| | | }
|
| | | if(!isLogin)
|
| | | {
|
| | | SetPushPetAndMountWinState();
|
| | | }
|
| | | }
|
| | |
|
| | | private int cacheMapId = 0;
|
| | | private void OnStageLoadFinish()
|
| | | {
|
| | | if (PlayerDatas.Instance.baseData.MapID == cacheMapId)
|
| | | {
|
| | | return;
|
| | | }
|
| | | MapConfig curMapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | | if (curMapConfig == null || curMapConfig.MapFBType != 0)
|
| | | {
|
| | | SetPushPetAndMountWinState(true,true);
|
| | | }
|
| | | }
|
| | |
|
| | | private void GuidBegin()
|
| | | {
|
| | | SetPushPetAndMountWinState(true,true);
|
| | | }
|
| | |
|
| | | private void OnMoveTopPart(bool isMove)
|
| | | {
|
| | | SetPushPetAndMountWinState(!isMove);
|
| | | }
|
| | |
|
| | |
|
| | | private void windowAfterOpen(Window win)
|
| | | {
|
| | | if (win is FirstTimeRechargeWin)
|
| | | {
|
| | | SetPushPetAndMountWinState(true,true);
|
| | | }
|
| | | }
|
| | |
|
| | | private void windowAfterClose(Window win)
|
| | | {
|
| | | if(win is MainInterfaceWin)
|
| | | {
|
| | | SetPushPetAndMountWinState(true);
|
| | | }
|
| | | else if(win is RoleParticularsWin
|
| | | || win is FirstTimeRechargeWin)
|
| | | {
|
| | | SetPushPetAndMountWinState();
|
| | | }
|
| | | }
|
| | |
|
| | | public void SetPushPetAndMountWinState(bool isMustClose = false, bool isClearData = false)
|
| | | {
|
| | | if(isClearData)
|
| | | {
|
| | | ClearPushData();
|
| | | WindowCenter.Instance.CloseImmediately<PetAndMountPushWin>();
|
| | | return;
|
| | | }
|
| | |
|
| | | if(CheckIsShowPush(isMustClose))
|
| | | {
|
| | | if (!WindowCenter.Instance.CheckOpen<PetAndMountPushWin>())
|
| | | {
|
| | | WindowCenter.Instance.Open<PetAndMountPushWin>();
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | WindowCenter.Instance.CloseImmediately<PetAndMountPushWin>();
|
| | | }
|
| | | }
|
| | |
|
| | | public bool CheckIsShowPush(bool isMustClose = false)
|
| | | {
|
| | | bool isShow = false;
|
| | | if (isMustClose)
|
| | | {
|
| | | isShow = false;
|
| | | }
|
| | | else
|
| | | {
|
| | | MapConfig curMapConfig = Config.Instance.Get<MapConfig>(PlayerDatas.Instance.baseData.MapID);
|
| | | |
| | | if ((curMapConfig == null || curMapConfig.MapFBType != 0)
|
| | | || !WindowCenter.Instance.CheckOpen<MainInterfaceWin>()
|
| | | || NewBieCenter.Instance.inGuiding
|
| | | || WindowCenter.Instance.CheckOpen<FirstTimeRechargeWin>()
|
| | | || currentPushId == 0)
|
| | | {
|
| | | isShow = false;
|
| | | }
|
| | | else
|
| | | {
|
| | | isShow = true;
|
| | | }
|
| | | }
|
| | | return isShow;
|
| | | }
|
| | |
|
| | | public void ClearPushData()
|
| | | {
|
| | | currentPushId = 0;
|
| | | petAndMountPushlist.Clear();
|
| | | }
|
| | |
|
| | | public void RemovePetAndMountPush(int shopId)
|
| | | {
|
| | | if(petAndMountPushlist.Contains(shopId))
|
| | | {
|
| | | petAndMountPushlist.Remove(shopId);
|
| | | currentPushId = GetPrePetAndMountPushId();
|
| | | if(pushRefreshEvent != null)
|
| | | {
|
| | | pushRefreshEvent();
|
| | | }
|
| | | }
|
| | | else
|
| | | {
|
| | | ClearPushData();
|
| | | }
|
| | | }
|
| | |
|
| | | private int GetPrePetAndMountPushId()
|
| | | {
|
| | | currentPushId = 0;
|
| | | for(int i = petAndMountPushlist.Count - 1; i > -1; i--)
|
| | | {
|
| | | currentPushId = petAndMountPushlist[i];
|
| | | break;
|
| | | }
|
| | | return currentPushId;
|
| | | }
|
| | |
|
| | | #endregion
|
| | | }
|
| | |
|