Ticket #4112: hidereadybutton3.patch

File hidereadybutton3.patch, 2.0 KB (added by echotangoecho, 8 years ago)
  • binaries/data/mods/public/gui/gamesetup/gamesetup.js

    function initRadioButtons()  
    522522        g_GameAttributes.settings.LastManStanding = false;
    523523        updateGameAttributes();
    524524    };
    525525}
    526526
     527function hideStartGameButton(hidden)
     528{
     529    Engine.GetGUIObjectByName("startGame").hidden = hidden;
     530
     531    // Move the cheatWarningText and back button to the right when hidden.
     532    Engine.GetGUIObjectByName("cancelGame").size = hidden ? "100%-164 100%-52 100%-24 100%-24" : "100%-308 100%-52 100%-168 100%-24";
     533    Engine.GetGUIObjectByName("cheatWarningText").size = hidden ? "0 100%-52 100%-176 100%-24" : "0 100%-52 100%-320 100%-24";
     534
     535    // Increase the size of onscreenToolTip when hidden.
     536    Engine.GetGUIObjectByName("onscreenToolTip").size = hidden? "20 100%-56 100%-168 100%-24" : "20 100%-56 100%-312 100%-24";
     537}
     538
    527539/**
    528540 * If we're a network client, hide the controls and show the text instead.
    529541 */
    530542function hideControls()
    531543{
    function hideControls()  
    538550        Engine.GetGUIObjectByName("playerAssignment["+i+"]").hidden = true;
    539551        Engine.GetGUIObjectByName("playerCiv["+i+"]").hidden = true;
    540552        Engine.GetGUIObjectByName("playerTeam["+i+"]").hidden = true;
    541553    }
    542554
     555    // The start game button should be hidden until the player assignments are received
     556    // and it is known whether the local player is an observer.
     557    hideStartGameButton(true);
    543558    Engine.GetGUIObjectByName("startGame").enabled = true;
    544559}
    545560
    546561/**
    547562 * Hides the GUI controls for clients and shows the read-only label instead.
    function handlePlayerAssignmentMessage(m  
    728743        if (!message.newAssignments[guid])
    729744            onClientLeave(guid);
    730745
    731746    g_PlayerAssignments = message.newAssignments;
    732747
     748    hideStartGameButton(!g_IsController && g_PlayerAssignments[Engine.GetPlayerGUID()].player == -1);
     749
    733750    updatePlayerList();
    734751    updateReadyUI();
    735752    sendRegisterGameStanza();
    736753}
    737754