mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 04:33:04 +00:00
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:
@@ -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.
|
* 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;
|
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;
|
Engine.GetGUIObjectByName("startGame").enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,6 +753,8 @@ function handlePlayerAssignmentMessage(message)
|
|||||||
|
|
||||||
g_PlayerAssignments = message.newAssignments;
|
g_PlayerAssignments = message.newAssignments;
|
||||||
|
|
||||||
|
hideStartGameButton(!g_IsController && g_PlayerAssignments[Engine.GetPlayerGUID()].player == -1);
|
||||||
|
|
||||||
updatePlayerList();
|
updatePlayerList();
|
||||||
updateReadyUI();
|
updateReadyUI();
|
||||||
sendRegisterGameStanza();
|
sendRegisterGameStanza();
|
||||||
|
|||||||
Reference in New Issue
Block a user