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 ++++++++++++++++++++++----------
1 files changed, 22 insertions(+), 10 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))
--
Gitblit v1.8.0