From 39d895e0b23c72b12b609014b085f0e5b0e78ab0 Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期三, 15 八月 2018 17:56:24 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/HappyXB/HappyXBModel.cs                           |   12 +++++-
 Core/GameEngine/Model/TelPartialConfig/tagStoreConfig.cs |   90 +++++++++++++++++++++++++++++++++-----------
 2 files changed, 77 insertions(+), 25 deletions(-)

diff --git a/Core/GameEngine/Model/TelPartialConfig/tagStoreConfig.cs b/Core/GameEngine/Model/TelPartialConfig/tagStoreConfig.cs
index df08cbd..625a4b3 100644
--- a/Core/GameEngine/Model/TelPartialConfig/tagStoreConfig.cs
+++ b/Core/GameEngine/Model/TelPartialConfig/tagStoreConfig.cs
@@ -72,6 +72,7 @@
                     if (PlayerDatas.Instance.baseData.LV >= s_storeModelDict[type][i].LV)
                     {
                         StoreConfig storeConfig = s_storeModelDict[type][i];
+                        //绛変簬1闅愯棌
                         if (storeConfig.TheOnlyShop == 1)
                         {
                             bool isSellOut = false;
@@ -80,8 +81,8 @@
                                 List<StoreConfig> storelist = s_TheOnlyShopDict[storeConfig.ItemID];
                                 for (int j = 0; j < storelist.Count; j++)
                                 {
-                                    BuyShopItemLimit shopItemLimit = ModelCenter.Instance.GetModel<StoreModel>().GetBuyShopLimit((uint)storelist[j].ID);
-                                    if (shopItemLimit != null && shopItemLimit.BuyCnt >= storelist[j].PurchaseNumber[0])
+                                    int remainCnt = 0;
+                                    if (CheckShopIsSellOut(storelist[j], out remainCnt))
                                     {
                                         isSellOut = true;
                                         break;
@@ -95,32 +96,39 @@
                         }
                         else
                         {
-                            if (storeConfig.RefreshType != 0)
+                            if (storeConfig.IsHideSellOut != 1)
                             {
-                                modellist.Add(storeConfig);
+                                switch (storeConfig.ShopType)
+                                {
+                                    case 12:
+                                        if (CheckRuneStoreIsCanBuy(storeConfig))
+                                        {
+                                            modellist.Add(storeConfig);
+                                        }
+                                        break;
+                                    default:
+                                        modellist.Add(storeConfig);
+                                        break;
+                                }
+
                             }
                             else
                             {
-                                int canBuyCnt = 0;
-                                int addBuyCnt = 0;
-                                bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
-                                BuyShopItemLimit shopItemLimit = ModelCenter.Instance.GetModel<StoreModel>().GetBuyShopLimit((uint)storeConfig.ID);
-                                if (isLimitBuy && !_keepOld)
+                                int remainCnt = 0;
+                                switch (storeConfig.ShopType)
                                 {
-                                    int remainNum = canBuyCnt;
-                                    if (shopItemLimit != null)
-                                    {
-                                        remainNum = canBuyCnt - shopItemLimit.BuyCnt;
-                                    }
-
-                                    if (remainNum > 0)
-                                    {
-                                        modellist.Add(storeConfig);
-                                    }
-                                }
-                                else
-                                {
-                                    modellist.Add(storeConfig);
+                                    case 12:
+                                        if (CheckRuneStoreIsCanBuy(storeConfig) && !CheckShopIsSellOut(storeConfig, out remainCnt))
+                                        {
+                                            modellist.Add(storeConfig);
+                                        }
+                                        break;
+                                    default:
+                                        if (!CheckShopIsSellOut(storeConfig, out remainCnt))
+                                        {
+                                            modellist.Add(storeConfig);
+                                        }
+                                        break;
                                 }
                             }
                         }
@@ -135,6 +143,42 @@
             return sortlist;
         }
 
+        public static bool CheckShopIsSellOut(StoreConfig storeConfig,out int remainCnt)
+        {
+            int canBuyCnt = 0;
+            int addBuyCnt = 0;
+            remainCnt = 0;
+            bool isLimitBuy = BuyItemPopModel.Instance.CheckIsLimitBuyCnt(storeConfig, out canBuyCnt, out addBuyCnt);
+            BuyShopItemLimit shopItemLimit = ModelCenter.Instance.GetModel<StoreModel>().GetBuyShopLimit((uint)storeConfig.ID);
+            if (!isLimitBuy) return false;
+
+            if(shopItemLimit != null)
+            {
+                remainCnt = canBuyCnt - shopItemLimit.BuyCnt;
+                if (canBuyCnt <= shopItemLimit.BuyCnt)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        public static bool CheckRuneStoreIsCanBuy(StoreConfig storeConfig)
+        {
+            Dictionary<int, List<int>> unlockRunelist = ModelCenter.Instance.GetModel<RuneModel>().GetAllUnlockRuneIdlist();
+            if(unlockRunelist != null)
+            {
+                foreach (var tower in unlockRunelist.Keys)
+                {
+                    if(unlockRunelist[tower].Contains(storeConfig.ItemID))
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
+       
         public static int CompareByShopSort(StoreConfig start, StoreConfig end)
         {
             int sort1 = start.ShopSort;
diff --git a/System/HappyXB/HappyXBModel.cs b/System/HappyXB/HappyXBModel.cs
index 50e8594..3066b1a 100644
--- a/System/HappyXB/HappyXBModel.cs
+++ b/System/HappyXB/HappyXBModel.cs
@@ -74,12 +74,13 @@
         {
             HAPPYXBITEMKEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "HappyXBItemTime");
             XBWarehouseRedPoint();
-            XBStoreRedPoint();
+            m_storeModel.RefreshTCBPlayerDataEvent -= RefreshStoreScore;
+            m_storeModel.RefreshTCBPlayerDataEvent += RefreshStoreScore;
         }
 
         public override void UnInit()
         {
- 
+           
         }
 
         /// <summary>
@@ -688,6 +689,13 @@
             }
         }
 
+
+        private void RefreshStoreScore(PlayerDataRefresh type)
+        {
+            if (type != PlayerDataRefresh.CDBPlayerRefresh_TreasureScore) return;
+            XBStoreRedPoint();
+        }
+
         private List<StoreConfig> storelist = null;
         public void XBStoreRedPoint()
         {

--
Gitblit v1.8.0