Don't move elements in the bottom panel of the game setup
Also fix the tooltip overlaping with the warning. Differential Revision: https://code.wildfiregames.com/D5260 This was SVN commit r28078.
This commit is contained in:
parent
a16a3f82a1
commit
086e95d39c
@ -39,8 +39,7 @@ SetupWindowPages.GameSetupPage = class
|
||||
"resetCivsButton": new ResetCivsButton(setupWindow),
|
||||
"resetTeamsButton": new ResetTeamsButton(setupWindow),
|
||||
"soundNotification": new SoundNotification(setupWindow),
|
||||
"tipsPanel": new TipsPanel(gameSettingsPanel),
|
||||
"tooltip": new Tooltip(this.panelButtons.cancelButton)
|
||||
"tipsPanel": new TipsPanel(gameSettingsPanel)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@
|
||||
|
||||
<object name="bottomLeftPanel">
|
||||
|
||||
<object size="20 100%-32 100%-312 100%">
|
||||
<object size="20 100%-32 100%-430 100%">
|
||||
<include file="gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.xml"/>
|
||||
</object>
|
||||
|
||||
|
@ -4,31 +4,12 @@ class CancelButton
|
||||
{
|
||||
this.setupWindow = setupWindow;
|
||||
|
||||
this.cancelButtonResizeHandlers = new Set();
|
||||
|
||||
this.buttonPositions = Engine.GetGUIObjectByName("bottomRightPanel").children;
|
||||
|
||||
this.cancelButton = Engine.GetGUIObjectByName("cancelButton");
|
||||
this.cancelButton.caption = this.Caption;
|
||||
this.cancelButton.tooltip = Engine.HasXmppClient() ? this.TooltipLobby : this.TooltipMenu;
|
||||
this.cancelButton.onPress = setupWindow.closePage.bind(setupWindow);
|
||||
|
||||
readyButton.registerButtonHiddenChangeHandler(this.onNeighborButtonHiddenChange.bind(this));
|
||||
startGameButton.registerButtonHiddenChangeHandler(this.onNeighborButtonHiddenChange.bind(this));
|
||||
}
|
||||
|
||||
registerCancelButtonResizeHandler(handler)
|
||||
{
|
||||
this.cancelButtonResizeHandlers.add(handler);
|
||||
}
|
||||
|
||||
onNeighborButtonHiddenChange()
|
||||
{
|
||||
this.cancelButton.size = this.buttonPositions[
|
||||
this.buttonPositions[1].children.every(button => button.hidden) ? 1 : 0].size;
|
||||
|
||||
for (let handler of this.cancelButtonResizeHandlers)
|
||||
handler(this.cancelButton);
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,5 +21,3 @@ CancelButton.prototype.TooltipLobby =
|
||||
|
||||
CancelButton.prototype.TooltipMenu =
|
||||
translate("Return to the main menu.");
|
||||
|
||||
CancelButton.prototype.Margin = 0;
|
||||
|
@ -6,7 +6,6 @@ class ReadyButton
|
||||
|
||||
this.hidden = undefined;
|
||||
|
||||
this.buttonHiddenChangeHandlers = new Set();
|
||||
this.readyButtonPressHandlers = new Set();
|
||||
|
||||
this.readyButton = Engine.GetGUIObjectByName("readyButton");
|
||||
@ -20,11 +19,6 @@ class ReadyButton
|
||||
this.readyController.setReady(this.readyController.StayReady, true);
|
||||
}
|
||||
|
||||
registerButtonHiddenChangeHandler(handler)
|
||||
{
|
||||
this.buttonHiddenChangeHandlers.add(handler);
|
||||
}
|
||||
|
||||
onNetStatusMessage(message)
|
||||
{
|
||||
if (message.status == "disconnected")
|
||||
@ -47,9 +41,6 @@ class ReadyButton
|
||||
|
||||
this.hidden = hidden;
|
||||
this.readyButton.hidden = hidden;
|
||||
|
||||
for (let handler of this.buttonHiddenChangeHandlers)
|
||||
handler(this.readyButton);
|
||||
}
|
||||
|
||||
registerReadyButtonPressHandler(handler)
|
||||
|
@ -5,8 +5,6 @@ class StartGameButton
|
||||
this.setupWindow = setupWindow;
|
||||
this.gameStarted = false;
|
||||
|
||||
this.buttonHiddenChangeHandlers = new Set();
|
||||
|
||||
this.startGameButton = Engine.GetGUIObjectByName("startGameButton");
|
||||
this.startGameButton.caption = this.Caption;
|
||||
this.startGameButton.onPress = this.onPress.bind(this);
|
||||
@ -15,16 +13,9 @@ class StartGameButton
|
||||
setupWindow.controls.playerAssignmentsController.registerPlayerAssignmentsChangeHandler(this.update.bind(this));
|
||||
}
|
||||
|
||||
registerButtonHiddenChangeHandler(handler)
|
||||
{
|
||||
this.buttonHiddenChangeHandlers.add(handler);
|
||||
}
|
||||
|
||||
onLoad()
|
||||
{
|
||||
this.startGameButton.hidden = !g_IsController;
|
||||
for (let handler of this.buttonHiddenChangeHandlers)
|
||||
handler();
|
||||
}
|
||||
|
||||
update()
|
||||
|
@ -7,8 +7,6 @@ class GameSettingWarning
|
||||
|
||||
this.gameSettingWarning = Engine.GetGUIObjectByName("gameSettingWarning");
|
||||
|
||||
cancelButton.registerCancelButtonResizeHandler(this.onCancelButtonResize.bind(this));
|
||||
|
||||
g_GameSettings.cheats.watch(() => this.onSettingsChange(), ["enabled"]);
|
||||
g_GameSettings.rating.watch(() => this.onSettingsChange(), ["enabled"]);
|
||||
}
|
||||
@ -25,17 +23,8 @@ class GameSettingWarning
|
||||
this.gameSettingWarning.caption = caption;
|
||||
this.gameSettingWarning.hidden = !caption;
|
||||
}
|
||||
|
||||
onCancelButtonResize(cancelButton)
|
||||
{
|
||||
let size = this.gameSettingWarning.size;
|
||||
size.right = cancelButton.size.left - this.Margin;
|
||||
this.gameSettingWarning.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
GameSettingWarning.prototype.Margin = 10;
|
||||
|
||||
GameSettingWarning.prototype.CheatsEnabled =
|
||||
translate("Cheats enabled.");
|
||||
|
||||
|
@ -1,17 +0,0 @@
|
||||
class Tooltip
|
||||
{
|
||||
constructor(cancelButton)
|
||||
{
|
||||
this.onscreenToolTip = Engine.GetGUIObjectByName("onscreenToolTip");
|
||||
cancelButton.registerCancelButtonResizeHandler(this.onCancelButtonResize.bind(this));
|
||||
}
|
||||
|
||||
onCancelButtonResize(cancelButton)
|
||||
{
|
||||
let size = this.onscreenToolTip.size;
|
||||
size.right = cancelButton.size.left - this.Margin;
|
||||
this.onscreenToolTip.size = size;
|
||||
}
|
||||
}
|
||||
|
||||
Tooltip.prototype.Margin = 10;
|
Loading…
Reference in New Issue
Block a user