From 4cb216db7866b50459e596f3e417c9e010b72a62 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 15 四月 2026 15:56:09 +0800
Subject: [PATCH] 76 聊天系统 支持系统消息弹幕和聊天频道分开发
---
Main/System/Chat/ChatManager.cs | 32 ++++++++++++++++++++++----------
Main/System/Message/SysNotifyMgr.cs | 8 ++++++--
Main/System/Message/GMNotify.cs | 2 +-
3 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/Main/System/Chat/ChatManager.cs b/Main/System/Chat/ChatManager.cs
index fd02c86..a4e0e76 100644
--- a/Main/System/Chat/ChatManager.cs
+++ b/Main/System/Chat/ChatManager.cs
@@ -1,8 +1,8 @@
-锘縰sing System.Collections;
+锘縰sing System;
+using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Text;
-using System;
using LitJson;
public partial class ChatManager : GameSystemManager<ChatManager>
@@ -161,6 +161,7 @@
return true;
return false;
}
+
// 0-绯荤粺 1-鏃ユ湡 2-鑷繁 3-鍏朵粬鐜╁
public int GetTalkDataType(TalkData talkData)
{
@@ -428,6 +429,7 @@
}
+
public void AddTalkData(ChatChannel type, TalkData data, bool isSendBullet)
{
//濡傛灉瓒呰繃闄愬埗鍏堝垹闄ゆ棫鏁版嵁
@@ -447,10 +449,7 @@
}
}
- if (isSendBullet)
- {
- OnUpdateTalkEvent?.Invoke(type, data, isSendBullet);
- }
+ OnUpdateTalkEvent?.Invoke(type, data, isSendBullet);
}
public Dictionary<ChatChannel, int> currentDayDict = new Dictionary<ChatChannel, int>();
@@ -478,16 +477,17 @@
return false;
}
- public void AddSysData(string msg, ArrayList infoList, ChatChannel type, bool isSendBullet)
+ public void AddSysData(string msg, ArrayList infoList, ChatChannel type)
{
int allSeconds = type == ChatChannel.CrossServer ? TimeUtility.GetCommServerTick(GuildManager.Instance.zoneID) : TimeUtility.AllSeconds;
- // 濡傛灉闅斿ぉ,澧炲姞鏃ユ湡琛�
- TryAddDate(allSeconds, type, isSendBullet);
+
+ TryAddDate(allSeconds, type, false);
if (!talkDict.ContainsKey(type))
{
talkDict[type] = new List<TalkData>();
}
+
AddTalkData(type, new TalkData()
{
ChannelType = (byte)type,
@@ -496,9 +496,21 @@
BubbleBox = 1,
TalkTime = (uint)allSeconds,
InfoList = new ArrayList(infoList),
- }, isSendBullet);
+ }, false);
}
+ public void SendPureBullet(string msg, ArrayList infoList, ChatChannel type = ChatChannel.World)
+ {
+ TalkData talkData = new TalkData()
+ {
+ ChannelType = (byte)type,
+ isSystem = true,
+ Content = msg,
+ InfoList = infoList != null ? new ArrayList(infoList) : null
+ };
+
+ OnUpdateTalkEvent?.Invoke(type, talkData, true);
+ }
public void UpdateTalk(HB310_tagMCTalk vNetData)
{
if (!IsValidChatChannel(vNetData.ChannelType))
diff --git a/Main/System/Message/GMNotify.cs b/Main/System/Message/GMNotify.cs
index 05d82d6..86cbd4c 100644
--- a/Main/System/Message/GMNotify.cs
+++ b/Main/System/Message/GMNotify.cs
@@ -84,7 +84,7 @@
private void Notify(GMNotifyMessgae _notify)
{
ServerTipDetails.ShowMarquee(_notify.message, null, 10);
- ChatManager.Instance.AddSysData(_notify.message, infoArray, ChatChannel.World, false);
+ ChatManager.Instance.AddSysData(_notify.message, infoArray, ChatChannel.World);
}
private bool CheckNotify(GMNotifyMessgae _notify)
diff --git a/Main/System/Message/SysNotifyMgr.cs b/Main/System/Message/SysNotifyMgr.cs
index f9aa613..04ee321 100644
--- a/Main/System/Message/SysNotifyMgr.cs
+++ b/Main/System/Message/SysNotifyMgr.cs
@@ -241,11 +241,14 @@
case SysNotifyType.SysMarqueeTip:
ServerTipDetails.ShowMarquee(msg, tipInfoList, order);
break;
+ case SysNotifyType.SysBulletScreen:
+ ChatManager.Instance.SendPureBullet(msg, tipInfoList);
+ break;
case SysNotifyType.ChatChannelWorld:
- ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.World, true);
+ ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.World);
break;
case SysNotifyType.ChatChannelGuild:
- ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.Guild, true);
+ ChatManager.Instance.AddSysData(msg, tipInfoList, ChatChannel.Guild);
break;
case SysNotifyType.SysRealmTip:
if (OnSysTipEvent != null)
@@ -278,6 +281,7 @@
SysChatWin = 6, //鑱婂ぉ浣嶇疆鐨勬彁绀�
SysEvenKill = 7,//涓婂彜鎴樺満杩炴潃鎻愮ず
SysFixedTip1 = 11,//鍥哄畾鎻愮ず2
+ SysBulletScreen = 19,//寮瑰箷
ChatChannelWorld = 20,//鑱婂ぉ-涓栫晫棰戦亾
ChatChannelGuild = 21,//鑱婂ぉ-鍏細棰戦亾
SysFairyQuestionTip = 31,//浠欑洘棰戦亾闂瓟鎻愮ず
--
Gitblit v1.8.0