From 079ecd71b24f5bf9aac653f18f76d4670bcd169e Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期五, 14 九月 2018 16:17:28 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts
---
System/Store/StoreModel.cs | 121 +++++++++++++++++++++++++++++----------
1 files changed, 89 insertions(+), 32 deletions(-)
diff --git a/System/Store/StoreModel.cs b/System/Store/StoreModel.cs
index d40b37c..1c1ea9e 100644
--- a/System/Store/StoreModel.cs
+++ b/System/Store/StoreModel.cs
@@ -39,6 +39,7 @@
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");
@@ -53,6 +54,8 @@
public void OnBeforePlayerDataInitialize()
{
+ IsMustBuyDay = false;
+ isLogin = true;
FuncOpen.Instance.OnFuncStateChangeEvent -= FuncStateChange;
PlayerDatas.Instance.fairyData.OnRefreshFairyMine -= RefreshServerHour;
PlayerDatas.Instance.fairyData.OnRefreshFairyInfo -= RefreshFamilyLv;
@@ -80,13 +83,15 @@
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)
@@ -132,6 +137,9 @@
switch(type)
{
case PlayerDataRefresh.LV:
+ CheckShopRedpoint();
+ UpdateMustBuyRedpoint();
+ break;
case PlayerDataRefresh.VIPLv:
case PlayerDataRefresh.Gold:
case PlayerDataRefresh.GoldPaper:
@@ -232,6 +240,16 @@
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);
@@ -272,7 +290,12 @@
}
}
- CheckShopRedpoint();
+
+ if(!isLogin)
+ {
+ CheckShopRedpoint();
+ UpdateMustBuyRedpoint();
+ }
if (RefreshBuyShopLimitEvent != null)
RefreshBuyShopLimitEvent();
}
@@ -658,6 +681,7 @@
}
SetShopRedpoint();
CheckShopRedpoint();
+ UpdateMustBuyRedpoint();
}
public bool CheckWeekStoreIsShopBuy(out List<StoreConfig> buylist)
@@ -814,42 +838,53 @@
foreach(var key in shopRedDict.Keys)
{
StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
- if (storeConfig.MoneyNumber == 0)
+ if(!mustIdlist.Contains(storeConfig.ItemID))
{
- if(CheckShopIsCanBuy(storeConfig))
+ if (storeConfig.MoneyNumber == 0)
{
- shopRedDict[storeConfig.ID].state = RedPointState.Simple;
+ if (CheckShopIsCanBuy(storeConfig))
+ {
+ shopRedDict[storeConfig.ID].state = RedPointState.Simple;
+ }
+ else
+ {
+ shopRedDict[storeConfig.ID].state = RedPointState.None;
+ }
}
else
{
- shopRedDict[storeConfig.ID].state = RedPointState.None;
+ if (CheckScoreStoreIsCanBuy(storeConfig))
+ {
+ shopRedDict[storeConfig.ID].state = RedPointState.Simple;
+ }
+ else
+ {
+ shopRedDict[storeConfig.ID].state = RedPointState.None;
+ }
}
}
- else
- {
- if(CheckScoreStoreIsCanBuy(storeConfig))
- {
- shopRedDict[storeConfig.ID].state = RedPointState.Simple;
- }
- else
- {
- shopRedDict[storeConfig.ID].state = RedPointState.None;
- }
- }
-
- UpdateMustBuyRedpoint(storeConfig);
+
}
}
- public void UpdateMustBuyRedpoint(StoreConfig storeConfig)
+ public void UpdateMustBuyRedpoint()
{
- if (CheckIsMustBuy(storeConfig))
+ if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
+
+ foreach (var key in shopRedDict.Keys)
{
- shopRedDict[storeConfig.ID].state = RedPointState.Simple;
- }
- else
- {
- shopRedDict[storeConfig.ID].state = RedPointState.None;
+ StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(key);
+ if(mustIdlist.Contains(storeConfig.ItemID))
+ {
+ if (CheckIsMustBuy(storeConfig))
+ {
+ shopRedDict[storeConfig.ID].state = RedPointState.Simple;
+ }
+ else
+ {
+ shopRedDict[storeConfig.ID].state = RedPointState.None;
+ }
+ }
}
}
@@ -858,19 +893,41 @@
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(CheckShopIsCanBuy(config) && IsMustBuyDay)
{
- if(IsNewDay(MUSTBUYSAVE_KEY))
- {
- return true;
- }
+ return true;
}
return false;
}
--
Gitblit v1.8.0