From 6444c2ee8ae673029f822a8a9e9e5f641de36af2 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期三, 14 十一月 2018 17:12:27 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/Store/StoreModel.cs                           |   84 ++++++++--------
 System/KnapSack/New/FBHelpPointExchageNotify.cs.meta |   12 ++
 System/KnapSack/New/FBHelpPointExchageNotify.cs      |   72 ++++++++++++++
 System/Dungeon/DungeonModel.cs                       |    3 
 System/MainInterfacePanel/InGamePushContainer.cs     |   17 +++
 System/WindowBase/ModelCenter.cs                     |    1 
 System/KnapSack/FBHelpPointExchageModel.cs           |   80 ++++++++++++---
 7 files changed, 209 insertions(+), 60 deletions(-)

diff --git a/System/Dungeon/DungeonModel.cs b/System/Dungeon/DungeonModel.cs
index 32ed825..205e7e0 100644
--- a/System/Dungeon/DungeonModel.cs
+++ b/System/Dungeon/DungeonModel.cs
@@ -350,6 +350,9 @@
                         }
                     }
                     break;
+                case 31160:
+                    _error = 0;
+                    return true;
             }
 
             DungeonRecord record;
diff --git a/System/KnapSack/FBHelpPointExchageModel.cs b/System/KnapSack/FBHelpPointExchageModel.cs
index a974fba..6e6c9d5 100644
--- a/System/KnapSack/FBHelpPointExchageModel.cs
+++ b/System/KnapSack/FBHelpPointExchageModel.cs
@@ -30,8 +30,7 @@
         {
             currentShopId = 0;
             helpPointShoplist.Clear();
-            PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= UpdateFBHelpPoint;
-            storeModel.UpdateHelpPointExchangeEvent -= UpdateHelpPointShop;
+            storeModel.RefreshTCBPlayerDataEvent -= UpdateFBHelpPoint;
             TimeMgr.Instance.OnDayEvent -= UpdateDay;
         }
 
@@ -41,9 +40,8 @@
             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();
         }
 
@@ -123,7 +121,30 @@
 
         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++)
             {
@@ -151,6 +172,9 @@
             {
                 helpPointShoplist.Remove(shopId);
             }
+            int type = 0;
+            bool isPush = storeModel.TryGetPushTypeByShopId(shopId, out type);
+            SetLocalSaveData(type, shopId);
         }
 
         private void UpdateHelpPointShop(int shopId)
@@ -158,9 +182,23 @@
             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();
             }
@@ -168,20 +206,26 @@
 
         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;
         }
     }
 }
diff --git a/System/KnapSack/New/FBHelpPointExchageNotify.cs b/System/KnapSack/New/FBHelpPointExchageNotify.cs
new file mode 100644
index 0000000..1a763b5
--- /dev/null
+++ b/System/KnapSack/New/FBHelpPointExchageNotify.cs
@@ -0,0 +1,72 @@
+锘縰sing UnityEngine;
+using UnityEngine.UI;
+using TableConfig;
+
+namespace Snxxz.UI
+{
+    public class FBHelpPointExchageNotify : MonoBehaviour
+    {
+        [SerializeField] CommonItemBaisc itemBaisc;
+        [SerializeField] Text titleText;
+        [SerializeField] Button closeBtn;
+        [SerializeField] Button gotoBtn;
+
+        FBHelpPointExchageModel ExchageModel { get { return ModelCenter.Instance.GetModel<FBHelpPointExchageModel>(); } }
+        ItemTipsModel tipsModel { get { return ModelCenter.Instance.GetModel<ItemTipsModel>(); } }
+
+        public void Awake()
+        {
+            gotoBtn.AddListener(ClickGoto);
+            closeBtn.AddListener(GetNextPush);
+        }
+
+        public void SetDisplay()
+        {
+            int shopId = ExchageModel.currentShopId;
+            this.gameObject.SetActive(shopId != 0);
+            if (shopId == 0) return;
+
+            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(shopId);
+            if(storeConfig != null)
+            {
+                ItemCellModel cellModel = new ItemCellModel(storeConfig.ItemID);
+                itemBaisc.Init(cellModel);
+                itemBaisc.cellBtn.RemoveAllListeners();
+                itemBaisc.cellBtn.AddListener(()=>
+                {
+                    ItemAttrData attrData = new ItemAttrData(storeConfig.ItemID);
+                    tipsModel.SetItemTipsModel(attrData);
+                });
+            }
+        }
+
+        public void ClickGoto()
+        {
+            StoreConfig storeConfig = Config.Instance.Get<StoreConfig>(ExchageModel.currentShopId);
+            switch ((StoreFunc)storeConfig.ShopType)
+            {
+                case StoreFunc.WeekStore:
+                    WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc1);
+                    break;
+                case StoreFunc.CommonStore:
+                    WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc2);
+                    break;
+                case StoreFunc.GrowStrongerStore:
+                    WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc3);
+                    break;
+                case StoreFunc.BindStore:
+                    WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc4);
+                    break;
+                case StoreFunc.IntegralStore:
+                    WindowJumpMgr.Instance.WindowJumpTo(JumpUIType.StoreFunc5);
+                    break;
+            }
+            GetNextPush();
+        }
+
+        public void GetNextPush()
+        {
+            ExchageModel.GetNextHelpPointShop(ExchageModel.currentShopId);
+        }
+    }
+}
diff --git a/System/KnapSack/New/FBHelpPointExchageNotify.cs.meta b/System/KnapSack/New/FBHelpPointExchageNotify.cs.meta
new file mode 100644
index 0000000..4f8cca4
--- /dev/null
+++ b/System/KnapSack/New/FBHelpPointExchageNotify.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 644090f0bbd882143bdd1ed02c53484d
+timeCreated: 1542177585
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/MainInterfacePanel/InGamePushContainer.cs b/System/MainInterfacePanel/InGamePushContainer.cs
index f536494..3ac0ca0 100644
--- a/System/MainInterfacePanel/InGamePushContainer.cs
+++ b/System/MainInterfacePanel/InGamePushContainer.cs
@@ -27,6 +27,8 @@
         [SerializeField] FairyGrabBossHelpBehaviour m_FairyGrabBossHelpBehaviour;
         [SerializeField] DogzNotifyBehaviour m_DogzNotifyBehaviour;
         [SerializeField] InSevenDayBehavior m_InSevenDayBehavior;
+        [SerializeField] FBHelpPointExchageNotify m_HelpPointExchangeNotify;
+
         WorldBossModel worldBossModel { get { return ModelCenter.Instance.GetModel<WorldBossModel>(); } }
         BossHomeModel bossHomeModel { get { return ModelCenter.Instance.GetModel<BossHomeModel>(); } }
         ElderGodAreaModel elderGodAreaModel { get { return ModelCenter.Instance.GetModel<ElderGodAreaModel>(); } }
@@ -34,7 +36,7 @@
         DogzDungeonModel dogzDungeonModel { get { return ModelCenter.Instance.GetModel<DogzDungeonModel>(); } }
         VipModel vipModel { get { return ModelCenter.Instance.GetModel<VipModel>(); } }
         DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
-
+        FBHelpPointExchageModel exchageModel { get { return ModelCenter.Instance.GetModel<FBHelpPointExchageModel>(); } }
         FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
         BetterEquipGetModel betterEquipGetModel { get { return ModelCenter.Instance.GetModel<BetterEquipGetModel>(); } }
         RealmBetterEquipModel realmEquipModel { get { return ModelCenter.Instance.GetModel<RealmBetterEquipModel>(); } }
@@ -65,6 +67,8 @@
             CheckFairyGrabBossHelp();
             CheckDogzNotify();
             InSevenDayShow();
+            CheckHelpPointExchange();
+            exchageModel.UpdateHelpPointShopEvent += CheckHelpPointExchange;
             playerPack.RefreshDecomAttrAct += CheckEquipDecompose;
             betterEquipGetModel.showEquipRefreshEvent += CheckBetterEquip;
             realmEquipModel.showEquipRefreshEvent += CheckRealmBetterEquip;
@@ -82,6 +86,7 @@
         public void UnInit()
         {
             fairyGrabBossModel.helpCoolDown = false;
+            exchageModel.UpdateHelpPointShopEvent -= CheckHelpPointExchange;
             playerPack.RefreshDecomAttrAct -= CheckEquipDecompose;
             betterEquipGetModel.showEquipRefreshEvent -= CheckBetterEquip;
             preciousItemGetModel.showItemRefreshEvent -= CheckPreciousItem;
@@ -95,6 +100,16 @@
             dogzModel.UpdateDogzPutRedEvent -= CheckDogzNotify;
         }
 
+        private void CheckHelpPointExchange()
+        {
+            int pushId = exchageModel.currentShopId;
+            m_HelpPointExchangeNotify.gameObject.SetActive(pushId != 0);
+            if(pushId != 0)
+            {
+                m_HelpPointExchangeNotify.SetDisplay();
+            }
+        }
+
         private void CheckRealmBetterEquip()
         {
             if (string.IsNullOrEmpty(realmEquipModel.currentEquipGuid))
diff --git a/System/Store/StoreModel.cs b/System/Store/StoreModel.cs
index 8fe8cb0..a2e1b7c 100644
--- a/System/Store/StoreModel.cs
+++ b/System/Store/StoreModel.cs
@@ -38,7 +38,6 @@
     public Dictionary<int,Dictionary<int,int>> JobReplaceIdDict = new Dictionary<int, Dictionary<int, int>>();
     public Dictionary<int, string> resetTimeDict { get; private set; }
     public Dictionary<int, int> showCoinsUIDict { get; private set; }
-    public int[] StoreRedIdlist { get; private set;}
     public int storeTrailerLv { get; private set; }
 
     bool isLogin = true;
@@ -66,7 +65,6 @@
         FuncConfigConfig mallCurrency = Config.Instance.Get<FuncConfigConfig>("MallCurrency");
         showCoinsUIDict = ConfigParse.GetDic<int, int>(mallCurrency.Numerical1);
         FuncConfigConfig mallPush = Config.Instance.Get<FuncConfigConfig>("MallPush");
-        StoreRedIdlist = ConfigParse.GetMultipleStr<int>(mallPush.Numerical2);
         storeTrailerLv = int.Parse(mallPush.Numerical1);
         MainInterfaceWin.IsCopyOfThePanel += OnMoveTopPart;
     }
@@ -1172,18 +1170,19 @@
         }
     }
 
-
     public void UpdateFreeShopRedpoint()
     {
         if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
-
+ 
         foreach (var key in showStoreTypeDict.Keys)
         {
             var storeDatas = showStoreTypeDict[key];
             for(int i = 0; i < storeDatas.Count; i++)
             {
                 var storeConfig = storeDatas[i].storeConfig;
-                if (storeConfig.MoneyNumber == 0)
+                int type = 0;
+                TryGetRedTypeByShopId(storeConfig.ID,out type);
+                if(type == 1)
                 {
                     int remainNum = 0;
                     if (!TryGetIsSellOut(storeConfig, out remainNum))
@@ -1199,7 +1198,7 @@
            
         }
     }
-    public event Action<int> UpdateHelpPointExchangeEvent;
+ 
     public void UpdateCanBuyRedpoint()
     {
         if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Store)) return;
@@ -1210,7 +1209,9 @@
             for (int i = 0; i < storeDatas.Count; i++)
             {
                 var storeConfig = storeDatas[i].storeConfig;
-                if (StoreRedIdlist.Contains(storeConfig.ID))
+                int type = 0;
+                TryGetRedTypeByShopId(storeConfig.ID, out type);
+                if(type == 4)
                 {
                     int remainNum = 0;
                     if (!TryGetIsSellOut(storeConfig, out remainNum))
@@ -1218,13 +1219,6 @@
                         if (UIHelper.GetMoneyCnt(storeConfig.MoneyType) >= (ulong)storeConfig.MoneyNumber)
                         {
                             shopRedDict[storeConfig.ID].state = RedPointState.Simple;
-                            if (storeConfig.ShopType == (int)StoreFunc.IntegralStore)
-                            {
-                                if (UpdateHelpPointExchangeEvent != null)
-                                {
-                                    UpdateHelpPointExchangeEvent(storeConfig.ID);
-                                }
-                            }
                         }
                         else
                         {
@@ -1251,7 +1245,9 @@
             for (int i = 0; i < storeDatas.Count; i++)
             {
                 var storeConfig = storeDatas[i].storeConfig;
-                if (mustIdlist.Contains(storeConfig.ItemID))
+                int type = 0;
+                TryGetRedTypeByShopId(storeConfig.ID, out type);
+                if(type == 2)
                 {
                     if (CheckIsMustBuy(storeConfig))
                     {
@@ -1269,7 +1265,9 @@
 
     public void ClearMustBuyRedpoint(StoreConfig storeConfig)
     {
-        if(mustIdlist.Contains(storeConfig.ItemID))
+        int type = 0;
+        TryGetRedTypeByShopId(storeConfig.ID,out type);
+        if(type == 2)
         {
             shopRedDict[storeConfig.ID].state = RedPointState.None;
             IsMustBuyDay = false;
@@ -1306,7 +1304,6 @@
         }
     }
 
-    public List<int> mustIdlist = new List<int>() { 4741};
     public bool CheckIsMustBuy(StoreConfig config)
     {
         int remainNum = 0;
@@ -1331,39 +1328,44 @@
         {
             var storeData = storelist[i];
             ItemConfig itemConfig = Config.Instance.Get<ItemConfig>(storeData.storeConfig.ItemID);
-            string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID,"ShopId",storeData.shopId);
-            int remainNum = 0;
-            switch(itemConfig.Type)
+            int type = 0;
+            TryGetRedTypeByShopId(storeData.shopId, out type);
+            if(type == 3)
             {
-                case 26:
-                case 41:
-                    if(!TryGetIsSellOut(storeData.storeConfig,out remainNum))
-                    {
-                        if (!PlayerPrefs.HasKey(key))
+                string key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "ShopId", storeData.shopId);
+                int remainNum = 0;
+                switch (itemConfig.Type)
+                {
+                    case 26:
+                    case 41:
+                        if (!TryGetIsSellOut(storeData.storeConfig, out remainNum))
                         {
-                            shopRedDict[storeData.shopId].state = RedPointState.Simple;
-                            LocalSave.SetBool(key,true);
-                            SetPetAndMountPushData(storeData.shopId);
-                        }
-                        else
-                        {
-                            if(LocalSave.GetBool(key))
+                            if (!PlayerPrefs.HasKey(key))
                             {
                                 shopRedDict[storeData.shopId].state = RedPointState.Simple;
+                                LocalSave.SetBool(key, true);
+                                SetPetAndMountPushData(storeData.shopId);
                             }
                             else
                             {
-                                shopRedDict[storeData.shopId].state = RedPointState.None;
+                                if (LocalSave.GetBool(key))
+                                {
+                                    shopRedDict[storeData.shopId].state = RedPointState.Simple;
+                                }
+                                else
+                                {
+                                    shopRedDict[storeData.shopId].state = RedPointState.None;
+                                }
+
                             }
-                            
                         }
-                    }
-                    else
-                    {
-                        //PlayerPrefs.DeleteKey(key);
-                        shopRedDict[storeData.shopId].state = RedPointState.None;
-                    }
-                    break;
+                        else
+                        {
+                            //PlayerPrefs.DeleteKey(key);
+                            shopRedDict[storeData.shopId].state = RedPointState.None;
+                        }
+                        break;
+                }
             }
         }
 
diff --git a/System/WindowBase/ModelCenter.cs b/System/WindowBase/ModelCenter.cs
index 90bf2ae..98b02d3 100644
--- a/System/WindowBase/ModelCenter.cs
+++ b/System/WindowBase/ModelCenter.cs
@@ -206,6 +206,7 @@
             RegisterModel<SocialModel>();
             RegisterModel<ChatBubbleModel>();
             RegisterModel<AccumulateRechargeModel>();
+            RegisterModel<FBHelpPointExchageModel>();
             inited = true;
         }
 

--
Gitblit v1.8.0