From 8cea417746487967704e5abc758dfadfe3dd25dc Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期二, 18 九月 2018 14:35:03 +0800
Subject: [PATCH] 3586 商城出售坐骑、灵宠推送
---
System/Store/StoreModel.cs | 299 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----
1 files changed, 277 insertions(+), 22 deletions(-)
diff --git a/System/Store/StoreModel.cs b/System/Store/StoreModel.cs
index ab4728c..1bb9437 100644
--- a/System/Store/StoreModel.cs
+++ b/System/Store/StoreModel.cs
@@ -5,6 +5,7 @@
using TableConfig;
using UnityEngine;
using LitJson;
+using System.Collections;
public class BuyShopItemLimit
{
@@ -50,18 +51,24 @@
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();
@@ -77,20 +84,25 @@
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;
}
@@ -137,21 +149,24 @@
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;
@@ -297,8 +312,10 @@
if(!isLogin)
{
- CheckShopRedpoint();
+ UpdateFreeShopRedpoint();
+ UpdateCanBuyRedpoint();
UpdateMustBuyRedpoint();
+ UpdatePetAndMountPutAwayRedpoint();
}
if (RefreshBuyShopLimitEvent != null)
RefreshBuyShopLimitEvent();
@@ -684,8 +701,10 @@
}
}
SetShopRedpoint();
- CheckShopRedpoint();
+ UpdateFreeShopRedpoint();
+ UpdateCanBuyRedpoint();
UpdateMustBuyRedpoint();
+ UpdatePetAndMountPutAwayRedpoint();
}
public bool CheckWeekStoreIsShopBuy(out List<StoreConfig> buylist)
@@ -835,18 +854,39 @@
}
}
- 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;
}
@@ -857,17 +897,9 @@
}
else
{
- if (CheckScoreStoreIsCanBuy(storeConfig))
- {
- shopRedDict[storeConfig.ID].state = RedPointState.Simple;
- }
- else
- {
- shopRedDict[storeConfig.ID].state = RedPointState.None;
- }
+ shopRedDict[storeConfig.ID].state = RedPointState.None;
}
}
-
}
}
@@ -976,6 +1008,229 @@
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
}
--
Gitblit v1.8.0