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(); }