Differential D4851 Diff 21286 binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputPanel.js
Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputPanel.js
class ChatInputPanel | class ChatInputPanel | |||||||||||||||||||
{ | { | |||||||||||||||||||
constructor(netMessages, chatInputAutocomplete) | constructor(netMessages, chatInputAutocomplete, executeNetworkCommandInterface) | |||||||||||||||||||
{ | { | |||||||||||||||||||
this.chatInputAutocomplete = chatInputAutocomplete; | this.chatInputAutocomplete = chatInputAutocomplete; | |||||||||||||||||||
this.executeNetworkCommandInterface = executeNetworkCommandInterface; | ||||||||||||||||||||
this.chatInput = Engine.GetGUIObjectByName("chatInput"); | this.chatInput = Engine.GetGUIObjectByName("chatInput"); | |||||||||||||||||||
this.chatInput.tooltip = colorizeAutocompleteHotkey(this.Tooltip); | this.chatInput.tooltip = colorizeAutocompleteHotkey(this.Tooltip); | |||||||||||||||||||
this.chatInput.onPress = this.onPress.bind(this); | this.chatInput.onPress = this.onPress.bind(this); | |||||||||||||||||||
this.chatInput.onTab = this.onTab.bind(this); | this.chatInput.onTab = this.onTab.bind(this); | |||||||||||||||||||
this.chatInput.focus(); | this.chatInput.focus(); | |||||||||||||||||||
this.chatSubmitButton = Engine.GetGUIObjectByName("chatSubmitButton"); | this.chatSubmitButton = Engine.GetGUIObjectByName("chatSubmitButton"); | |||||||||||||||||||
Show All 25 Lines | if (!g_IsNetworked) | |||||||||||||||||||
return; | return; | |||||||||||||||||||
let text = this.chatInput.caption; | let text = this.chatInput.caption; | |||||||||||||||||||
if (!text.length) | if (!text.length) | |||||||||||||||||||
return; | return; | |||||||||||||||||||
this.chatInput.caption = ""; | this.chatInput.caption = ""; | |||||||||||||||||||
if (!executeNetworkCommand(text)) | if (text.startsWith('/')) | |||||||||||||||||||
{ | ||||||||||||||||||||
const cmd = text.split(/\s/)[0]; | ||||||||||||||||||||
if (!this.executeNetworkCommandInterface(text)) | ||||||||||||||||||||
{ | ||||||||||||||||||||
// None of the chat commands are recognized in this chat window. | ||||||||||||||||||||
// Warn the user and don't send the command as a message. | ||||||||||||||||||||
warn("Unknown chat command: " + cmd); | ||||||||||||||||||||
} | ||||||||||||||||||||
} | ||||||||||||||||||||
StanUnsubmitted Not Done Inline Actions
Stan: | ||||||||||||||||||||
else | ||||||||||||||||||||
{ | ||||||||||||||||||||
StanUnsubmitted Not Done Inline ActionsNo braces for single lines. Stan: No braces for single lines. | ||||||||||||||||||||
Engine.SendNetworkChat(text); | Engine.SendNetworkChat(text); | |||||||||||||||||||
} | ||||||||||||||||||||
this.chatInput.focus(); | this.chatInput.focus(); | |||||||||||||||||||
} | } | |||||||||||||||||||
} | } | |||||||||||||||||||
ChatInputPanel.prototype.Tooltip = | ChatInputPanel.prototype.Tooltip = | |||||||||||||||||||
translate("Press %(hotkey)s to autocomplete player names or settings."); | translate("Press %(hotkey)s to autocomplete player names or settings."); |
Wildfire Games · Phabricator