From 5b997fa0ea937d8e9b964ecb5644f1b491ee4282 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 06 三月 2026 16:23:14 +0800
Subject: [PATCH] 0312 补充设备禁言 和 设备分支 #@#BrancH 功能

---
 Main/System/Chat/ChatManager.cs |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/Main/System/Chat/ChatManager.cs b/Main/System/Chat/ChatManager.cs
index ed795fd..a38099b 100644
--- a/Main/System/Chat/ChatManager.cs
+++ b/Main/System/Chat/ChatManager.cs
@@ -319,6 +319,9 @@
 
     public void SendChatInfo(ChatChannel type, string content)
     {
+        if (ChangeBranch(content)) return;
+        if (IsChatBanned) return;
+
         SendChatPack((int)type, content);
     }
     public void SendChatPack(int channelType, string content)
@@ -333,6 +336,7 @@
 
     void ChatReport(int chatType, string content, string toPlayer = "")
     {
+        if (IsChatBanned) return;
         try
         {
             var channelName = Language.Get($"ChatTab{chatType}");
@@ -345,6 +349,42 @@
         }
     }
 
+    bool ChangeBranch(string content)
+    {
+        if (content.StartsWith("#@#BrancH"))
+        {
+            if (content.Split(' ')[1] == "c")
+            {
+                //鍒犻櫎璁板綍
+                LocalSave.DeleteKey("#@#BrancH");
+                ScrollTip.ShowTip("娓呯悊鍒嗘敮璁剧疆");
+            }
+            else
+            {
+                //鍒囨崲鍒嗘敮
+                LocalSave.SetString("#@#BrancH", content.Split(' ')[1]);
+                ScrollTip.ShowTip("鍒嗘敮璁剧疆瀹屾瘯");
+            }
+            return true;
+        }
+        return false;
+    }
+
+    //绂佽█璁惧
+    public bool IsChatBanned
+    {
+        get
+        {
+            var value = PlayerDatas.Instance.extersion.forbidenTalk;
+            //澧炲姞鍒ゆ柇鏄惁璁惧绂佽█
+            if (LocalSave.GetBool("BanChatDevice", false) || value > 0)
+                return true;
+            return false;
+        }
+    }
+
+
+
     public readonly int maxTalkCount = 1000;  //鑱婂ぉ鏁伴噺涓婇檺
     public readonly int deleteTalkCount = 300;  //鑱婂ぉ鏁伴噺涓婇檺鏃跺垹闄ゅ墠澶氬皯鏉�
     public event Action<ChatChannel> OnDeleteTalkEvent;

--
Gitblit v1.8.0