Add base script for chat
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user