From fad24cfdd8f9a530ca8b1bcfd067d60b6fce9df4 Mon Sep 17 00:00:00 2001 From: CuongNV <> Date: Fri, 20 Mar 2026 13:52:55 +0700 Subject: [PATCH] add new logic chat Input --- Assets/Scripts/ChatInputHandler.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Assets/Scripts/ChatInputHandler.cs b/Assets/Scripts/ChatInputHandler.cs index 52ea285b5f..21b772865b 100644 --- a/Assets/Scripts/ChatInputHandler.cs +++ b/Assets/Scripts/ChatInputHandler.cs @@ -106,6 +106,7 @@ namespace BrewMonster.Scripts.ChatUI if (strText.Length <= 0) { + ClearTextInInputField(); //ChangeFocus(); return; } @@ -133,6 +134,7 @@ namespace BrewMonster.Scripts.ChatUI SaveHistory(resolvedChannel, strText, nPack, nSlot, now); + ClearTextInInputField(); //ChangeFocus(); } @@ -317,6 +319,14 @@ namespace BrewMonster.Scripts.ChatUI private void SendPrivateChat(string target, string msg, int pack, int slot) { Debug.Log($"Whisper to {target}: {msg}"); + + // [Port] C++: CDlgChat::OnCommand_speak → privatechat branch + // Gửi tin nhắn mật (whisper) lên server qua GameSession. + UnityGameSession.Instance.GameSession.SendPrivateChatData(target, msg, 0, 0, pack, slot); + + // Server không echo whisper lại cho chính mình → hiện local echo + string localEcho = $"[Whisper] → {target}: {msg}"; + EventBus.Publish(new GameSession.ChatMessageEvent(localEcho, (byte)ChatChannel.GP_CHAT_WHISPER)); } // ===================================================== @@ -410,9 +420,12 @@ namespace BrewMonster.Scripts.ChatUI private bool IsPlayerBlacklisted(int idPlayer) => false; // Placeholder - private void ChangeFocus() + private void ClearTextInInputField() { inputField.text = ""; + } + private void ChangeFocus() + { inputField.ActivateInputField(); }