Add base script for chat

This commit is contained in:
CuongNV
2026-03-06 16:45:35 +07:00
parent 4c055cab63
commit 72299d0b71
17 changed files with 1953 additions and 85 deletions
+8 -3
View File
@@ -6,6 +6,7 @@ using TMPro;
using BrewMonster.Network;
using CSNetwork;
using CSNetwork.GPDataType;
using EditorAttributes;
public class ChatInputHandler : MonoSingleton<ChatInputHandler>
{
@@ -32,10 +33,11 @@ public class ChatInputHandler : MonoSingleton<ChatInputHandler>
// Khi nhấn Enter
private void OnSubmit(GameSession.ChatMessageEvent text)
{
if (!string.IsNullOrWhiteSpace(text.context))
Debug.Log("[Cuong] receiver chat:" + text);
/*if (!string.IsNullOrWhiteSpace(text.context))
{
HandleUserInput(text.context);
}
}*/
}
// Khi nhấn nút Gửi
@@ -60,11 +62,14 @@ public class ChatInputHandler : MonoSingleton<ChatInputHandler>
inputField.ActivateInputField(); // focus lại để tiếp tục gõ
}
private void Send(string text)
[Button]
public void Send(string text)
{
Debug.Log("Người dùng vừa gõ: " + text);
// TODO: xử lý text (ví dụ: thêm vào chat box, gửi network,...)
UnityGameSession.SendChatData((byte)ChatChannel.GP_CHAT_LOCAL, text,0,0);
Debug.Log("[Cuong] send ChatChannel:" + (byte)ChatChannel.GP_CHAT_LOCAL);
Debug.Log("[Cuong] send ChatChannel:" + ChatChannel.GP_CHAT_LOCAL);
}
}