From 56217ac5db17c9b43bc1c5ea9c60a674b713f993 Mon Sep 17 00:00:00 2001
From: Client_PangDeRong <593317293@qq.com>
Date: 星期四, 06 九月 2018 15:51:22 +0800
Subject: [PATCH] 1882 寻宝功能开启时有免费寻宝次数没红点

---
 System/HappyXB/HappyXBModel.cs |   36 +++++++++++++++++++++++++++++-------
 1 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/System/HappyXB/HappyXBModel.cs b/System/HappyXB/HappyXBModel.cs
index 033b7ba..1a5eb89 100644
--- a/System/HappyXB/HappyXBModel.cs
+++ b/System/HappyXB/HappyXBModel.cs
@@ -70,6 +70,8 @@
         public void OnBeforePlayerDataInitialize()
         {
             m_storeModel.RefreshTCBPlayerDataEvent -= RefreshStoreScore;
+            FuncOpen.Instance.OnFuncStateChangeEvent -= UpdateFuncState;
+            playerPack.RefreshItemCountAct -= RefreshXBTool;
             isXBCoolTime = false;
             XBNotifyParms.Clear();
             xbTypeInfoDict.Clear();
@@ -83,8 +85,8 @@
             HAPPYXBITEMKEY = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "HappyXBItemTime");
             XBWarehouseRedPoint();
             m_storeModel.RefreshTCBPlayerDataEvent += RefreshStoreScore;
-            playerPack.RefreshItemCountAct -= RefreshXBTool;
             playerPack.RefreshItemCountAct += RefreshXBTool;
+            FuncOpen.Instance.OnFuncStateChangeEvent += UpdateFuncState;
         }
 
         public override void UnInit()
@@ -795,8 +797,10 @@
         public const int XBWarehouse_RedKey = 20304;
         public const int BestXB_OneRedKey = 20301001;
         public const int BestXB_ManyRedKey = 20301002;
+        public const int BestXB_FreeRedKey = 20301003;
         public const int RuneXB_OneRedKey = 20302001;
         public const int RuneXB_ManyRedKey = 20302002;
+        public const int RuneXB_FreeRedKey = 20302003;
 
         public Redpoint mainTopRed = new Redpoint(MainTop_RedKey);
         public Redpoint happyXBRed = new Redpoint(MainTop_RedKey, HappyXB_RedKey);
@@ -806,8 +810,18 @@
         public Redpoint xbWarehouseRed = new Redpoint(HappyXB_RedKey,XBWarehouse_RedKey);
         public Redpoint bestXBOneRed = new Redpoint(BestXB_RedKey,BestXB_OneRedKey);
         public Redpoint bestXBManyRed = new Redpoint(BestXB_RedKey,BestXB_ManyRedKey);
+        public Redpoint bestXBFreeRed = new Redpoint(BestXB_RedKey,BestXB_FreeRedKey);
         public Redpoint runeXBOneRed = new Redpoint(RuneXB_RedKey, RuneXB_OneRedKey);
         public Redpoint runeXBManyRed = new Redpoint(RuneXB_RedKey, RuneXB_ManyRedKey);
+        public Redpoint runeXBFreeRed = new Redpoint(RuneXB_RedKey, RuneXB_FreeRedKey);
+
+        private void UpdateFuncState(int funcId)
+        {
+            if (funcId != (int)FuncOpenEnum.HappyFindTreasure) return;
+            XBWarehouseRedPoint();
+            BestAndRuneXBRedPoint();
+            XBStoreRedPoint();
+        }
 
         public void RefreshXBWarehouse()
         {
@@ -848,9 +862,14 @@
             int needtoolCnt = 0;
             if (IsHaveFreeXB(1))
             {
-                bestXBRed.state = RedPointState.Simple;
+                bestXBFreeRed.state = RedPointState.Simple;
             }
-            else if(IsHaveManyXBTool(1,out xbtoolCnt,out needtoolCnt))
+            else
+            {
+                bestXBFreeRed.state = RedPointState.None;
+            }
+
+            if(IsHaveManyXBTool(1,out xbtoolCnt,out needtoolCnt))
             {
                 if(xbtoolCnt >= needtoolCnt)
                 {
@@ -866,14 +885,18 @@
             {
                 bestXBOneRed.state = RedPointState.None;
                 bestXBManyRed.state = RedPointState.None;
-                bestXBRed.state = RedPointState.None;
             }
 
             if (IsHaveFreeXB(2))
             {
-                runeXBRed.state = RedPointState.Simple;
+                runeXBFreeRed.state = RedPointState.Simple;
             }
-            else if(IsHaveManyXBTool(2,out xbtoolCnt,out needtoolCnt))
+            else
+            {
+                runeXBFreeRed.state = RedPointState.None;
+            }
+
+            if(IsHaveManyXBTool(2,out xbtoolCnt,out needtoolCnt))
             {
                 if (xbtoolCnt >= needtoolCnt)
                 {
@@ -889,7 +912,6 @@
             {
                 runeXBOneRed.state = RedPointState.None;
                 runeXBManyRed.state = RedPointState.None;
-                runeXBRed.state = RedPointState.None;
             }
         }
 

--
Gitblit v1.8.0