-
Notifications
You must be signed in to change notification settings - Fork 5
Description
I'm currently working on a 2d multiplayer game with chat functionality. I just used this stackoverflow post to create an IsFocussed extension:
https://stackoverflow.com/a/7972361/1149816
However I'm now trying to implement something that if you click out of the chat box that no commands are being sent to the UI anymore. I keep hearing all kinds of pops and sound effects and also the UI is still responding to arrow presses. This also happens when I use the InputManager.Current.ClearFocus() method. For some reason the next update loop the GamePlayUI is set as the focussed element again.
Is there any way to completely clear the focus of the EmptyKeys library?
I've created a video of this problem:
https://youtu.be/J001tU1ZucI
Incase you're wondering, the code that executes when you press enter or the Send button:
private void OnChatEnterClick(object obj)
{
if (gameplayUIViewModel.ChatBoxFocussed == false)
{
gameplayUIViewModel.ChatBoxFocussed = true;
}
else if (string.IsNullOrEmpty(gameplayUIViewModel.ChatTextBoxText))
{
InputManager.Current.ClearFocus();
}
else
{
SendChat(gameplayUIViewModel.ChatTextBoxText);
gameplayUIViewModel.ChatTextBoxText = "";
}
}