Hide the "I'm ready" button to observers. Patch by echotangoecho, fixes #4112.
Right-align the affected buttons and neighboring GUI objects. This was SVN commit r18701.
This commit is contained in:
parent
f61f051d74
commit
565709701e
@ -519,6 +519,31 @@ function initRadioButtons()
|
||||
};
|
||||
}
|
||||
|
||||
function hideStartGameButton(hidden)
|
||||
{
|
||||
const offset = 10;
|
||||
|
||||
let startGame = Engine.GetGUIObjectByName("startGame");
|
||||
startGame.hidden = hidden;
|
||||
let right = hidden ? startGame.size.right : startGame.size.left - offset;
|
||||
|
||||
let cancelGame = Engine.GetGUIObjectByName("cancelGame");
|
||||
let cancelGameSize = cancelGame.size;
|
||||
let xButtonSize = cancelGameSize.right - cancelGameSize.left;
|
||||
cancelGameSize.right = right;
|
||||
right -= xButtonSize;
|
||||
|
||||
for (let element of ["cheatWarningText", "onscreenToolTip"])
|
||||
{
|
||||
let elementSize = Engine.GetGUIObjectByName(element).size;
|
||||
elementSize.right = right - (cancelGameSize.left - elementSize.right);
|
||||
Engine.GetGUIObjectByName(element).size = elementSize;
|
||||
}
|
||||
|
||||
cancelGameSize.left = right;
|
||||
cancelGame.size = cancelGameSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* If we're a network client, hide the controls and show the text instead.
|
||||
*/
|
||||
@ -535,6 +560,9 @@ function hideControls()
|
||||
Engine.GetGUIObjectByName("playerTeam["+i+"]").hidden = true;
|
||||
}
|
||||
|
||||
// The start game button should be hidden until the player assignments are received
|
||||
// and it is known whether the local player is an observer.
|
||||
hideStartGameButton(true);
|
||||
Engine.GetGUIObjectByName("startGame").enabled = true;
|
||||
}
|
||||
|
||||
@ -725,6 +753,8 @@ function handlePlayerAssignmentMessage(message)
|
||||
|
||||
g_PlayerAssignments = message.newAssignments;
|
||||
|
||||
hideStartGameButton(!g_IsController && g_PlayerAssignments[Engine.GetPlayerGUID()].player == -1);
|
||||
|
||||
updatePlayerList();
|
||||
updateReadyUI();
|
||||
sendRegisterGameStanza();
|
||||
|
Loading…
Reference in New Issue
Block a user