Fix a confirmation hotkey bug in the multiplayer dialog. Patch by Imarok, fixes #4031.

Remove a duplicate button and move code from XML to JS.

This was SVN commit r18289.
This commit is contained in:
elexis 2016-06-02 16:47:24 +00:00
parent 6df3b0d794
commit d9caf157e2
2 changed files with 23 additions and 20 deletions

View File

@ -54,6 +54,24 @@ function cancelSetup()
Engine.PopGuiPage();
}
function confirmSetup()
{
if (Engine.GetGUIObjectByName("pageHost").hidden)
{
let joinPlayerName = Engine.GetGUIObjectByName("joinPlayerName").caption;
let joinServer = Engine.GetGUIObjectByName("joinServer").caption;
if (startJoin(joinPlayerName, joinServer))
switchSetupPage("pageJoin", "pageConnecting");
}
else
{
let hostPlayerName = Engine.GetGUIObjectByName("hostPlayerName").caption;
let hostServerName = Engine.GetGUIObjectByName("hostServerName").caption;
if (startHost(hostPlayerName, hostServerName))
switchSetupPage("pageHost", "pageConnecting");
}
}
function startConnectionStatus(type)
{
g_GameType = type;

View File

@ -45,16 +45,6 @@
this.caption = Engine.ConfigDB_GetValue("user", "multiplayerserver");
</action>
</object>
<object hotkey="confirm" type="button" size="50%+5 100%-45 100%-18 100%-17" style="ModernButtonRed">
<translatableAttribute id="caption">Continue</translatableAttribute>
<action on="Press">
var joinPlayerName = Engine.GetGUIObjectByName("joinPlayerName").caption;
var joinServer = Engine.GetGUIObjectByName("joinServer").caption;
if (startJoin(joinPlayerName, joinServer))
switchSetupPage("pageJoin", "pageConnecting");
</action>
</object>
</object>
<object name="pageHost" size="0 32 100% 100%" hidden="true">
@ -87,20 +77,15 @@
</action>
</object>
</object>
<object type="button" size="50%+5 100%-45 100%-18 100%-17" style="ModernButtonRed">
<translatableAttribute id="caption">Continue</translatableAttribute>
<action on="Press">
var hostPlayerName = Engine.GetGUIObjectByName("hostPlayerName").caption;
var hostServerName = Engine.GetGUIObjectByName("hostServerName").caption;
if (startHost(hostPlayerName, hostServerName))
switchSetupPage("pageHost", "pageConnecting");
</action>
</object>
</object>
<object name="hostFeedback" type="text" style="ModernLabelText" size="50 100%-90 100%-50 100%-50" textcolor="red" />
<object hotkey="confirm" type="button" size="50%+5 100%-45 100%-18 100%-17" style="ModernButtonRed">
<translatableAttribute id="caption">Continue</translatableAttribute>
<action on="Press">confirmSetup();</action>
</object>
<object type="button" style="ModernButtonRed" size="18 100%-45 50%-5 100%-17" hotkey="cancel">
<translatableAttribute id="caption">Cancel</translatableAttribute>
<action on="Press">cancelSetup();</action>