Resets chat text field in lobby when Esc is pressed.

This commit is contained in:
deniz1a
2015-07-24 23:21:37 +03:00
parent 7337afcfeb
commit f5b4befc75

View File

@@ -523,9 +523,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
chatLabel = lobby.Get<LabelWidget>("LABEL_CHATTYPE"); chatLabel = lobby.Get<LabelWidget>("LABEL_CHATTYPE");
var chatTextField = lobby.Get<TextFieldWidget>("CHAT_TEXTFIELD"); var chatTextField = lobby.Get<TextFieldWidget>("CHAT_TEXTFIELD");
chatTextField.TakeKeyboardFocus(); chatTextField.TakeKeyboardFocus();
chatTextField.OnEnterKey = () => chatTextField.OnEnterKey = () =>
{ {
if (chatTextField.Text.Length == 0) if (chatTextField.Text.Length == 0)
@@ -538,6 +536,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
chatTextField.Text = ""; chatTextField.Text = "";
return true; return true;
}; };
chatTextField.OnTabKey = () => chatTextField.OnTabKey = () =>
{ {
var previousText = chatTextField.Text; var previousText = chatTextField.Text;
@@ -550,6 +549,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
return true; return true;
}; };
chatTextField.OnEscKey = () => { chatTextField.Text = ""; return true; };
chatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY"); chatPanel = lobby.Get<ScrollPanelWidget>("CHAT_DISPLAY");
chatTemplate = chatPanel.Get("CHAT_TEMPLATE"); chatTemplate = chatPanel.Get("CHAT_TEMPLATE");
chatPanel.RemoveChildren(); chatPanel.RemoveChildren();