From 02f3454051593c48ef1acc5facde4e71b104608c Mon Sep 17 00:00:00 2001
From: client_Zxw <826696702@qq.com>
Date: 星期三, 16 一月 2019 22:56:08 +0800
Subject: [PATCH] 3335 代码优化

---
 System/MainInterfacePanel/FeatureNoticeModel.cs |  189 ++++------------------------------------------
 1 files changed, 18 insertions(+), 171 deletions(-)

diff --git a/System/MainInterfacePanel/FeatureNoticeModel.cs b/System/MainInterfacePanel/FeatureNoticeModel.cs
index e8bedef..0652854 100644
--- a/System/MainInterfacePanel/FeatureNoticeModel.cs
+++ b/System/MainInterfacePanel/FeatureNoticeModel.cs
@@ -25,6 +25,7 @@
     private bool RedPointChange = false;
     private bool IsRedPoint = false;
     public int FunctionForecastIndex = 0;
+    private bool  Isbool=true;
     public override void Init()
     {
         AddList();
@@ -34,10 +35,7 @@
 
     public void OnBeforePlayerDataInitialize()
     {
-        //PlayerDatas.Instance.PlayerDataRefreshInfoEvent -= OnPlayersUpLV;
-        //FuncOpen.Instance.OnFuncStateChangeEvent -= OnFuncStateChangeEvent;
-        //treasureModel.treasureStateChangeEvent -= treasureStateChangeEvent;
-        //treasureModel.treasureStageUpEvent -= treasureStageUpEvent;
+        Isbool = true;
         FunctionForecastIndex = 0;
         DicOpenFuncState.Clear();
         StageManager.Instance.onStageLoadFinish -= OnStageLoadFinish;
@@ -46,21 +44,31 @@
 
     public void OnPlayerLoginOk()
     {
-        //FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
-        //PlayerDatas.Instance.PlayerDataRefreshInfoEvent += OnPlayersUpLV;
-        //treasureModel.treasureStateChangeEvent += treasureStateChangeEvent;
-        //treasureModel.treasureStageUpEvent += treasureStageUpEvent;    
+        Isbool = true;
         StageManager.Instance.onStageLoadFinish += OnStageLoadFinish;
         PlayerDatas.Instance.PlayerDataRefreshInfoEvent += Updatefighting;
+        GlobalTimeEvent.Instance.secondEvent -= secondEvent;
+        GlobalTimeEvent.Instance.secondEvent += secondEvent;
         RedPoint_State();
-        // RedDotStatus();
+    }
+
+    private void secondEvent()
+    {
+        if (!Isbool)
+        {
+            Isbool = true;
+        }
     }
 
     private void Updatefighting(PlayerDataRefresh _tCDBPlayerRefresh)
     {
         if (_tCDBPlayerRefresh == PlayerDataRefresh.LV &&PlayerDatas.Instance.baseData.LV>=100)
         {
-            RedPoint_State();
+            if (Isbool)
+            {
+                RedPoint_State();
+                Isbool = false;
+            }         
         }
     }
 
@@ -77,28 +85,6 @@
             IsRedPoint = false;
         }
     }
-    //private void treasureStageUpEvent(int obj)
-    //{
-    //    RedDotStatus();
-    //}
-
-    //private void treasureStateChangeEvent(int obj)
-    //{
-    //    RedDotStatus();
-    //}
-
-    //private void OnFuncStateChangeEvent(int obj)
-    //{
-    //    RedDotStatus();
-    //}
-
-    //private void OnPlayersUpLV(PlayerDataRefresh obj)
-    //{
-    //    if (obj == PlayerDataRefresh.LV)
-    //    {
-    //        RedDotStatus();
-    //    }
-    //}
     private void AddList()//娣诲姞鍒楄〃淇℃伅
     {
         if (FunctionList.Count <= 0)
@@ -147,7 +133,6 @@
                     DicAwardItem.Add(functionForecastConfig.FuncId, _award);
                 }
             }
-            //  DebugEx.LogError(DicAwardItem);
         }
 
     }
@@ -190,144 +175,7 @@
             }
         }
     }
-    //private void RedDotStatus()//绾㈢偣1
-    //{
-    //    for (int i = 0; i < FunctionList.Count; i++)
-    //    {
-    //        if (!FuncOpen.Instance.IsFuncOpen(FunctionList[i].FuncId))
-    //        {
-    //            redPointStre1.state = RedPointState.None;
-    //            if (OpenFuncId != FunctionList[i].FuncId)
-    //            {
-    //                RedPointChange = false;
-    //            }
-    //            if (OpenFuncId != FunctionList[i].FuncId || !RedPointChange)
-    //            {
-    //                OpenFuncId = FunctionList[i].FuncId;
-    //                IsRedPoint = false;
-    //                TrailerClassification(FunctionList[i].FuncId);
-    //            }
-    //            return;
-    //        }
-    //    }
-    //}
-
-    //private void TrailerClassification(int funcID)//绾㈢偣1
-    //{
-    //    FuncOpenLVConfig funcoPenConfig = Config.Instance.Get<FuncOpenLVConfig>(funcID);
-    //    var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(funcID);
-    //    if (funcoPenConfig.LimitMagicWeapon != 0 || funcoPenConfig.LimitMissionID != 0)
-    //    {
-    //        if (funcoPenConfig.LimitMagicWeapon != 0)//娉曞疂
-    //        {
-    //            int faBaoID = funcoPenConfig.LimitMagicWeapon / 100;
-    //            MagicWeapon(faBaoID, funcID);
-    //            return;
-    //        }
-    //        else if (funcoPenConfig.LimitMissionID != 0)//浠诲姟
-    //        {
-    //            if (functionForecastConfig.RedPointLV <= 0)
-    //            {
-    //                return;
-    //            }
-    //            if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
-    //            {
-    //                RedPointChange = true;
-    //                IsRedPoint = true;
-    //            }
-    //            if (IsRedPoint)
-    //            {
-    //                redPointStre1.state = RedPointState.Simple;
-    //            }
-    //            else
-    //            {
-    //                redPointStre1.state = RedPointState.None;
-    //            }
-    //            return;
-    //        }
-    //    }
-    //    else//绛夌骇
-    //    {
-    //        if (functionForecastConfig.RedPointLV <= 0)
-    //        {
-    //            return;
-    //        }
-    //        if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
-    //        {
-    //            RedPointChange = true;
-    //            IsRedPoint = true;
-    //        }
-    //        if (IsRedPoint)
-    //        {
-    //            redPointStre1.state = RedPointState.Simple;
-    //        }
-    //        else
-    //        {
-    //            redPointStre1.state = RedPointState.None;
-    //        }
-    //        return;
-    //    }
-    //}
     TreasureModel treasureModel { get { return ModelCenter.Instance.GetModel<TreasureModel>(); } }
-    //private void MagicWeapon(int fabaoID, int funcID)//绾㈢偣1
-    //{
-    //    var functionForecastConfig = Config.Instance.Get<FunctionForecastConfig>(funcID);
-    //    if (functionForecastConfig.RedPointLV > 0)//鏍规嵁濉殑绛夌骇鏉�
-    //    {
-    //        if (PlayerDatas.Instance.baseData.LV >= functionForecastConfig.RedPointLV)
-    //        {
-    //            RedPointChange = true;
-    //            IsRedPoint = true;
-    //        }
-    //        if (IsRedPoint)
-    //        {
-    //            redPointStre1.state = RedPointState.Simple;
-    //        }
-    //        else
-    //        {
-    //            redPointStre1.state = RedPointState.None;
-    //        }
-    //        return;
-    //    }
-    //    Treasure treasure;//鏍规嵁瑙i攣娉曞疂鐨勭櫨鍒嗘瘮
-
-    //    if (treasureModel.TryGetTreasure(fabaoID, out treasure)
-    //          && treasure.state == TreasureState.Collected)
-    //    {
-    //        var list = treasure.treasureStages;
-    //        var funcStage = 0;
-    //        for (int i = 0; i < list.Count; i++)
-    //        {
-    //            if (list[i].unlockType == TreasureStageUnlock.Func &&
-    //                list[i].func == funcID)
-    //            {
-    //                funcStage = i;
-    //                break;
-    //            }
-    //        }
-    //        if (treasure.stage == funcStage - 1 || funcStage == 0)
-    //        {
-    //            float exp = ((float)treasure.exp / treasure.treasureStages[funcStage].exp) * 100;
-    //            if (functionForecastConfig.RedPointPercentage > -1)
-    //            {
-    //                if (exp >= functionForecastConfig.RedPointPercentage)
-    //                {
-    //                    RedPointChange = true;
-    //                    IsRedPoint = true;
-    //                }
-    //                if (IsRedPoint)
-    //                {
-    //                    redPointStre1.state = RedPointState.Simple;
-    //                }
-    //            }
-    //            else
-    //            {
-    //                redPointStre1.state = RedPointState.None;
-    //            }
-    //        }
-    //    }
-    //}
-
     public IEnumerator WhetherToPlayTheBox()
     {
         yield return new WaitForSeconds(0.7f);
@@ -404,7 +252,6 @@
         {
             functionForecastValue= Config.Instance.GetAllValues<FunctionForecastConfig>();
         }
-       // var functionForecastValue = Config.Instance.GetAllValues<FunctionForecastConfig>();
         foreach (var value in functionForecastValue)
         {
             if (value.OpenNumber == Inedx)

--
Gitblit v1.8.0