add chat input chat handle
This commit is contained in:
@@ -20,16 +20,21 @@ public class ChatInputHandler : MonoSingleton<ChatInputHandler>
|
||||
|
||||
// Lắng nghe phím Enter
|
||||
inputField.onSubmit.AddListener(OnSubmit);*/
|
||||
EventBus.Subscribe<GameSession.ChatMessageEvent>((x)=> Debug.Log(x.context));
|
||||
EventBus.Subscribe<GameSession.ChatMessageEvent>(OnSubmit);
|
||||
DontDestroyOnLoad(gameObject);
|
||||
}
|
||||
|
||||
// Khi nhấn Enter
|
||||
private void OnSubmit(string text)
|
||||
private void OnDestroy()
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text))
|
||||
EventBus.Unsubscribe<GameSession.ChatMessageEvent>(OnSubmit);
|
||||
}
|
||||
|
||||
// Khi nhấn Enter
|
||||
private void OnSubmit(GameSession.ChatMessageEvent text)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(text.context))
|
||||
{
|
||||
HandleUserInput(text);
|
||||
HandleUserInput(text.context);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user