2
0
Fork 0
mirror of https://github.com/GTA-ASM/SanAndreasUnity synced 2025-02-20 14:58:29 +00:00

send chat on Enter

This commit is contained in:
in0finite 2019-11-16 17:15:49 +01:00
parent 030726add0
commit 5ed306d137

View file

@ -33,7 +33,17 @@ namespace SanAndreasUnity.UI
rect.xMin -= this.textInputWidth;
rect.xMax -= buttonSize.x + 15;
GUI.SetNextControlName("chat_text_input");
m_chatText = GUI.TextField(rect, m_chatText, 100);
if (Event.current.isKey && GUI.GetNameOfFocusedControl () == "chat_text_input")
{
if (Event.current.keyCode == KeyCode.Return)
{
// enter pressed
Chat.ChatManager.SendChatMessageToAllPlayersAsLocalPlayer(m_chatText);
m_chatText = "";
}
}
}