Ticket #4112: hidereadybutton5.patch

File hidereadybutton5.patch, 2.3 KB (added by echotangoecho, 8 years ago)

Remove the size constants.

  • 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    if (Engine.GetGUIObjectByName("startGame").hidden == hidden)
     530        return;
     531
     532    Engine.GetGUIObjectByName("startGame").hidden = hidden;
     533    let offset = hidden ? 144 : -144;
     534
     535    // Move the cheatWarningText and back button to the right when hidden.
     536    let cancelGameSize = Engine.GetGUIObjectByName("cancelGame").size;
     537    cancelGameSize.left += offset;
     538    cancelGameSize.right += offset;
     539
     540    Engine.GetGUIObjectByName("cancelGame").size = cancelGameSize;
     541
     542    let cheatWarningTextSize = Engine.GetGUIObjectByName("cheatWarningText").size;
     543    cheatWarningTextSize.right += offset;
     544    Engine.GetGUIObjectByName("cheatWarningText").size = cheatWarningTextSize;
     545
     546    // Increase the size of onscreenToolTip when hidden.
     547    let onscreenToolTipSize = Engine.GetGUIObjectByName("onscreenToolTip").size;
     548    onscreenToolTipSize.right += offset;
     549    Engine.GetGUIObjectByName("onscreenToolTip").size = onscreenToolTipSize;
     550}
     551
    527552/**
    528553 * If we're a network client, hide the controls and show the text instead.
    529554 */
    530555function hideControls()
    531556{
    function hideControls()  
    538563        Engine.GetGUIObjectByName("playerAssignment["+i+"]").hidden = true;
    539564        Engine.GetGUIObjectByName("playerCiv["+i+"]").hidden = true;
    540565        Engine.GetGUIObjectByName("playerTeam["+i+"]").hidden = true;
    541566    }
    542567
     568    // The start game button should be hidden until the player assignments are received
     569    // and it is known whether the local player is an observer.
     570    hideStartGameButton(true);
    543571    Engine.GetGUIObjectByName("startGame").enabled = true;
    544572}
    545573
    546574/**
    547575 * Hides the GUI controls for clients and shows the read-only label instead.
    function handlePlayerAssignmentMessage(m  
    728756        if (!message.newAssignments[guid])
    729757            onClientLeave(guid);
    730758
    731759    g_PlayerAssignments = message.newAssignments;
    732760
     761    hideStartGameButton(!g_IsController && g_PlayerAssignments[Engine.GetPlayerGUID()].player == -1);
     762
    733763    updatePlayerList();
    734764    updateReadyUI();
    735765    sendRegisterGameStanza();
    736766}
    737767