瀏覽代碼

修复活动公告红点跳转返回后不刷新的bug

leiyasi 1 年之前
父節點
當前提交
45a7b6959d
共有 1 個文件被更改,包括 20 次插入4 次删除
  1. 20 4
      GameClient/Assets/Game/HotUpdate/Views/Notice/NoticeView.cs

+ 20 - 4
GameClient/Assets/Game/HotUpdate/Views/Notice/NoticeView.cs

@@ -59,6 +59,7 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.NOTICE_SYSTOM_ADD, OnCtrlChange);
             EventAgent.AddEventListener(ConstMessage.NOTICE_SYSTOM_ADD, OnCtrlChange);
             EventAgent.AddEventListener(ConstMessage.NOTICE_SYSTOM_REMOVE, OnCtrlChange);
             EventAgent.AddEventListener(ConstMessage.NOTICE_SYSTOM_REMOVE, OnCtrlChange);
             EventAgent.AddEventListener(ConstMessage.SHOW_SYSTEM_NOTICE, UpdateView);
             EventAgent.AddEventListener(ConstMessage.SHOW_SYSTEM_NOTICE, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
         }
         }
         protected override void OnShown()
         protected override void OnShown()
         {
         {
@@ -77,12 +78,14 @@ namespace GFGGame
         {
         {
             base.OnHide();
             base.OnHide();
         }
         }
+
         protected override void RemoveEventListener()
         protected override void RemoveEventListener()
         {
         {
             base.RemoveEventListener();
             base.RemoveEventListener();
             EventAgent.RemoveEventListener(ConstMessage.NOTICE_SYSTOM_ADD, OnCtrlChange);
             EventAgent.RemoveEventListener(ConstMessage.NOTICE_SYSTOM_ADD, OnCtrlChange);
             EventAgent.RemoveEventListener(ConstMessage.NOTICE_SYSTOM_REMOVE, OnCtrlChange);
             EventAgent.RemoveEventListener(ConstMessage.NOTICE_SYSTOM_REMOVE, OnCtrlChange);
             EventAgent.RemoveEventListener(ConstMessage.SHOW_SYSTEM_NOTICE, UpdateView);
             EventAgent.RemoveEventListener(ConstMessage.SHOW_SYSTEM_NOTICE, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
         }
         }
 
 
         private void AddEffect()
         private void AddEffect()
@@ -163,12 +166,14 @@ namespace GFGGame
             {
             {
                 //Hide();
                 //Hide();
                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", jumpIndex, false, false);
                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", jumpIndex, false, false);
+
             }
             }
             else
             else
             {
             {
                 //Hide();
                 //Hide();
                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", param, false, false);
                 ViewManager.Show($"GFGGame.{adCfg.jumpId}", param, false, false);
             }
             }
+
         }
         }
 
 
         /// <summary>
         /// <summary>
@@ -222,15 +227,16 @@ namespace GFGGame
 
 
         private void UpdateTitleRedDot()
         private void UpdateTitleRedDot()
         {
         {
-            RedDotController.Instance.SetComRedDot(_ui.m_btnActivity, false);
-            RedDotController.Instance.SetComRedDot(_ui.m_btnNotice, false);
+            bool btnActivityFlag = false;
+            bool btnNoticeFlag = false;
+
 
 
             // 活动公告
             // 活动公告
             for (int i = 0; i < showActivity.Count; i++)
             for (int i = 0; i < showActivity.Count; i++)
             {
             {
                 if (NoticeDataManager.Instance.GetRedDotState(showActivity[i].jumpId, showActivity[i].activityId))
                 if (NoticeDataManager.Instance.GetRedDotState(showActivity[i].jumpId, showActivity[i].activityId))
                 {
                 {
-                    RedDotController.Instance.SetComRedDot(_ui.m_btnActivity, true, "", -25);
+                    btnActivityFlag = true;
                     break;
                     break;
                 }
                 }
             }
             }
@@ -240,10 +246,13 @@ namespace GFGGame
             {
             {
                 if (!NoticeDataManager.Instance.NoticeInfos[i].readStatus)
                 if (!NoticeDataManager.Instance.NoticeInfos[i].readStatus)
                 {
                 {
-                    RedDotController.Instance.SetComRedDot(_ui.m_btnNotice, true, "", -25);
+                    btnNoticeFlag = true;
                     break;
                     break;
                 }
                 }
             }
             }
+
+            RedDotController.Instance.SetComRedDot(_ui.m_btnActivity, btnActivityFlag, "", -25);
+            RedDotController.Instance.SetComRedDot(_ui.m_btnNotice, btnNoticeFlag, "", -25);
         }
         }
 
 
         private void UpdateView()
         private void UpdateView()
@@ -256,5 +265,12 @@ namespace GFGGame
             UpdateInfo();
             UpdateInfo();
             UpdateTitleRedDot();
             UpdateTitleRedDot();
         }
         }
+
+        private void UpdateRedDot()
+        {
+            OnCtrlChange();
+            UpdateInfo();
+            UpdateTitleRedDot();
+        }
     }
     }
 }
 }