Explorar o código

雅集聊天增加红点提示

huangxiaoyue hai 1 ano
pai
achega
1d64f0bc08

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Constant/ConstMessage.cs

@@ -121,6 +121,7 @@ namespace GFGGame
         // public const string LEAGUE_ANSWER_STATE_CHANGE = "LEAGUE_ANSWER_STATE_CHANGE";//联盟答题状态更新
         public const string OTHER_ROLE_INFO_CHANGE = "OTHER_ROLE_INFO_CHANGE"; //其他玩家信息变化
         public const string NOTICE_CHAT_MESSAGE = "NOTICE_CHAT_MESSAGE"; //通知聊天信息
+        public const string OPEN_CHAT_MESSAGE = "OPEN_CHAT_MESSAGE"; //打开查看聊天信息
         public const string ACTIVE_SKILL = "ACTIVE_SKILL";//技能激活
 
         public const string CONTINUOUS_REBATE_GIFT = "CONTINUOUS_REBATE_GIFT"; //领取连续返利礼包

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Data/ChatDataManager.cs

@@ -9,6 +9,7 @@ namespace GFGGame
     {
         public Dictionary<int, List<ChatData>> ChatDatas = new Dictionary<int, List<ChatData>>();//int:ChatType
         public Dictionary<long, List<ChatData>> PrivateChatDatas = new Dictionary<long, List<ChatData>>();//int:RoleId
+        public bool NewChatInfo = false;  //ÓÐеÄÑż¯ÁÄÌìÐÅÏ¢
 
         public void Clear()
         {

+ 3 - 0
GameClient/Assets/Game/HotUpdate/ServerProxy/ChatSProxy.cs

@@ -22,6 +22,9 @@ namespace ET
             {
                 ChatDataManager.Instance.GetChatDatas(chatData.Type).Add(chatData);
             }
+            if (!ViewManager.isViewOpen(typeof(LeagueChatView).FullName)) 
+                ChatDataManager.Instance.NewChatInfo = true;
+
             EventAgent.DispatchEvent(ConstMessage.NOTICE_CHAT_MESSAGE);
             await ETTask.CompletedTask;
         }

+ 2 - 0
GameClient/Assets/Game/HotUpdate/Views/League/LeagueChatView.cs

@@ -44,6 +44,8 @@ namespace GFGGame
         protected override void OnShown()
         {
             base.OnShown();
+            ChatDataManager.Instance.NewChatInfo = false;
+            EventAgent.DispatchEvent(ConstMessage.OPEN_CHAT_MESSAGE);
             UpdateChatList();
         }
 

+ 10 - 0
GameClient/Assets/Game/HotUpdate/Views/League/LeagueView.cs

@@ -82,7 +82,10 @@ namespace GFGGame
             EventAgent.AddEventListener(ConstMessage.LEAGUE_INFO_CHANGE, UpdateView);
             EventAgent.AddEventListener(ConstMessage.LEAGUE_NUMBERIC_CHANGE, UpdateView);
             EventAgent.AddEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
+            EventAgent.AddEventListener(ConstMessage.NOTICE_CHAT_MESSAGE, UpdateRedChatBtn);
+            EventAgent.AddEventListener(ConstMessage.OPEN_CHAT_MESSAGE, UpdateRedChatBtn);
         }
+
         protected override void OnShown()
         {
             base.OnShown();
@@ -108,6 +111,8 @@ namespace GFGGame
             EventAgent.RemoveEventListener(ConstMessage.LEAGUE_INFO_CHANGE, UpdateView);
             EventAgent.RemoveEventListener(ConstMessage.LEAGUE_NUMBERIC_CHANGE, UpdateView);
             EventAgent.RemoveEventListener(ConstMessage.RED_CHANGE, UpdateRedDot);
+            EventAgent.RemoveEventListener(ConstMessage.NOTICE_CHAT_MESSAGE, UpdateRedChatBtn);
+            EventAgent.RemoveEventListener(ConstMessage.OPEN_CHAT_MESSAGE, UpdateRedChatBtn);
         }
 
         private void OnBtnBackClick()
@@ -250,6 +255,11 @@ namespace GFGGame
             RedDotController.Instance.SetComRedDot(_ui.m_btnParty.target, RedDotDataManager.Instance.GetLeagueTeaPartyRed(), "", -440, 60);
         }
 
+        private void UpdateRedChatBtn()
+        {
+            RedDotController.Instance.SetComRedDot(_ui.m_btnChat, ChatDataManager.Instance.NewChatInfo, "", 10, -10);
+        }
+
         private void UpdateEffect()
         {
             _ui.m_btnPray.m_effect.scale = new Vector2(0.8f, 0.8f);