add new logic chat Input

This commit is contained in:
CuongNV
2026-03-20 13:52:55 +07:00
parent 06b4cd91ca
commit fad24cfdd8
+14 -1
View File
@@ -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 = $"<color=#0065FE>[Whisper] → {target}: {msg}</color>";
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();
}