Ticket #4031: continue_mp_v2.patch

File continue_mp_v2.patch, 3.1 KB (added by Imarok, 8 years ago)

move the js part into a seperate js function

  • binaries/data/mods/public/gui/gamesetup/gamesetup_mp.js

     
    5454    Engine.PopGuiPage();
    5555}
    5656
     57function confirmSetup()
     58{
     59    if (Engine.GetGUIObjectByName("pageHost").hidden)
     60    {
     61        var joinPlayerName = Engine.GetGUIObjectByName("joinPlayerName").caption;
     62        var joinServer = Engine.GetGUIObjectByName("joinServer").caption;
     63        if (startJoin(joinPlayerName, joinServer))
     64            switchSetupPage("pageJoin", "pageConnecting");
     65    }
     66    else
     67    {
     68        var hostPlayerName = Engine.GetGUIObjectByName("hostPlayerName").caption;
     69        var hostServerName = Engine.GetGUIObjectByName("hostServerName").caption;
     70        if (startHost(hostPlayerName, hostServerName))
     71            switchSetupPage("pageHost", "pageConnecting");
     72    }
     73}
     74
    5775function startConnectionStatus(type)
    5876{
    5977    g_GameType = type;
  • binaries/data/mods/public/gui/gamesetup/gamesetup_mp.xml

     
    4545                    this.caption = Engine.ConfigDB_GetValue("user", "multiplayerserver");
    4646                </action>
    4747            </object>
    48 
    49             <object hotkey="confirm" type="button" size="50%+5 100%-45 100%-18 100%-17" style="ModernButtonRed">
    50                 <translatableAttribute id="caption">Continue</translatableAttribute>
    51                 <action on="Press">
    52                     var joinPlayerName = Engine.GetGUIObjectByName("joinPlayerName").caption;
    53                     var joinServer = Engine.GetGUIObjectByName("joinServer").caption;
    54                     if (startJoin(joinPlayerName, joinServer))
    55                         switchSetupPage("pageJoin", "pageConnecting");
    56                 </action>
    57             </object>
    5848        </object>
    5949
    6050        <object name="pageHost" size="0 32 100% 100%" hidden="true">
     
    8777                    </action>
    8878                </object>
    8979            </object>
    90 
    91             <object type="button" size="50%+5 100%-45 100%-18 100%-17" style="ModernButtonRed">
    92                 <translatableAttribute id="caption">Continue</translatableAttribute>
    93                 <action on="Press">
    94                     var hostPlayerName = Engine.GetGUIObjectByName("hostPlayerName").caption;
    95                     var hostServerName = Engine.GetGUIObjectByName("hostServerName").caption;
    96                     if (startHost(hostPlayerName, hostServerName))
    97                         switchSetupPage("pageHost", "pageConnecting");
    98                 </action>
    99             </object>
    10080        </object>
    10181
    10282        <object name="hostFeedback" type="text" style="ModernLabelText" size="50 100%-90 100%-50 100%-50" textcolor="red" />
    10383
     84        <object hotkey="confirm" type="button" size="50%+5 100%-45 100%-18 100%-17" style="ModernButtonRed">
     85            <translatableAttribute id="caption">Continue</translatableAttribute>
     86            <action on="Press">
     87                confirmSetup();
     88            </action>
     89        </object>
     90
    10491        <object type="button" style="ModernButtonRed" size="18 100%-45 50%-5 100%-17" hotkey="cancel">
    10592            <translatableAttribute id="caption">Cancel</translatableAttribute>
    10693            <action on="Press">cancelSetup();</action>