Rename the 'Objectives' dialog to 'Match Settings'

This commit is contained in:
Vantha 2025-04-22 12:41:46 +02:00 committed by Nicolas Auvray
parent 2f54155219
commit 7938a120d1
12 changed files with 56 additions and 55 deletions

View file

@ -401,7 +401,7 @@ toggle = "Alt+G" ; Toggle visibility of session GUI
menu.toggle = "F10" ; Toggle in-game menu
diplomacy.toggle = "Ctrl+H" ; Toggle in-game diplomacy page
barter.toggle = "Ctrl+B" ; Toggle in-game barter/trade page
objectives.toggle = "Ctrl+O" ; Toggle in-game objectives page
matchsettings.toggle = "Ctrl+O" ; Toggle in-game match settings page
tutorial.toggle = "Ctrl+P" ; Toggle in-game tutorial panel
[hotkey.session.savedgames]

View file

@ -59,9 +59,9 @@
"name": "Toggle barter",
"desc": "Toggle in-game barter/trade page."
},
"session.gui.objectives.toggle": {
"name": "Toggle objectives",
"desc": "Toggle in-game objectives page."
"session.gui.matchsettings.toggle": {
"name": "Toggle match settings",
"desc": "Toggle in-game match settings page."
},
"session.gui.tutorial.toggle": {
"name": "Toggle tutorial",

View file

@ -93,7 +93,7 @@ You may change hotkeys in [font="sans-bold-14"]Options > Hotkeys[font="sans-14"]
hotkey.lobby Show the multiplayer lobby in a dialog window
hotkey.session.gui.diplomacy.toggle Toggle in-game diplomacy panel
hotkey.session.gui.barter.toggle Toggle in-game barter and trade panel
hotkey.session.gui.objectives.toggle Toggle in-game objectives panel
hotkey.session.gui.matchsettings.toggle Toggle in-game match settings panel
hotkey.session.gui.tutorial.toggle Toggle in-game tutorial panel
hotkey.structree Toggle structure tree panel
hotkey.civinfo Toggle civilization info panel

View file

@ -3,7 +3,7 @@
*/
class TopPanel
{
constructor(playerViewControl, diplomacyDialog, tradeDialog, objectivesDialog, gameSpeedControl)
constructor(playerViewControl, diplomacyDialog, tradeDialog, matchSettingsDialog, gameSpeedControl)
{
this.counterManager = new CounterManager(playerViewControl);
this.civIcon = new CivIcon(playerViewControl);
@ -13,7 +13,7 @@ class TopPanel
this.diplomacyDialogButton = new DiplomacyDialogButton(playerViewControl, diplomacyDialog);
this.gameSpeedButton = new GameSpeedButton(gameSpeedControl);
this.objectivesDialogButton = new ObjectivesDialogButton(objectivesDialog);
this.matchSettingsDialogButton = new MatchSettingsDialogButton(matchSettingsDialog);
this.tradeDialogButton = new TradeDialogButton(playerViewControl, tradeDialog);
}
}

View file

@ -1,17 +1,17 @@
class ObjectivesDialog
class MatchSettingsDialog
{
constructor(playerViewControl, mapCache)
{
this.gameDescription = Engine.GetGUIObjectByName("gameDescription");
this.objectivesPlayerstate = Engine.GetGUIObjectByName("objectivesPlayerstate");
this.objectivesPanel = Engine.GetGUIObjectByName("objectivesPanel");
this.objectivesTitle = Engine.GetGUIObjectByName("objectivesTitle");
this.matchSettingsPlayerstate = Engine.GetGUIObjectByName("matchSettingsPlayerstate");
this.matchSettingsPanel = Engine.GetGUIObjectByName("matchSettingsPanel");
this.matchSettingsTitle = Engine.GetGUIObjectByName("matchSettingsTitle");
// TODO: atlas should support this
if (!Engine.IsAtlasRunning())
Engine.GetGUIObjectByName("gameDescriptionText").caption = getGameDescription(g_InitAttributes, mapCache);
Engine.GetGUIObjectByName("closeObjectives").onPress = this.close.bind(this);
Engine.GetGUIObjectByName("matchSettingsCloseButton").onPress = this.close.bind(this);
registerPlayersInitHandler(this.rebuild.bind(this));
registerPlayersFinishedHandler(this.rebuild.bind(this));
@ -20,17 +20,17 @@ class ObjectivesDialog
open()
{
this.objectivesPanel.hidden = false;
this.matchSettingsPanel.hidden = false;
}
close()
{
this.objectivesPanel.hidden = true;
this.matchSettingsPanel.hidden = true;
}
isOpen()
{
return !this.objectivesPanel.hidden;
return !this.matchSettingsPanel.hidden;
}
toggle()
@ -49,11 +49,11 @@ class ObjectivesDialog
const playerState = player && player.state;
const isActive = !playerState || playerState == "active";
this.objectivesPlayerstate.hidden = isActive;
this.objectivesPlayerstate.caption = g_PlayerStateMessages[playerState] || "";
this.matchSettingsPlayerstate.hidden = isActive;
this.matchSettingsPlayerstate.caption = g_PlayerStateMessages[playerState] || "";
const size = this.gameDescription.size;
size.top = (isActive ? this.objectivesTitle : this.objectivesPlayerstate).size.bottom;
size.top = (isActive ? this.matchSettingsTitle : this.matchSettingsPlayerstate).size.bottom;
this.gameDescription.size = size;
}
}

View file

@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<object
name="objectivesPanel"
name="matchSettingsPanel"
size="50%-300 24%-70 50%+300 76%-70"
type="image"
hidden="true"
sprite="ModernDialog"
>
<object
name="objectivesTitle"
name="matchSettingsTitle"
type="text"
style="TitleText"
size="50%-128 -16 50%+128 16"
>
<translatableAttribute id="caption">Objectives</translatableAttribute>
<translatableAttribute id="caption">Match Settings</translatableAttribute>
</object>
<object
name="objectivesPlayerstate"
name="matchSettingsPlayerstate"
size="20 40 100%-20 80"
font="sans-bold-18"
type="text"
@ -39,7 +39,7 @@
/>
</object>
<object name="closeObjectives" size="50%-64 100%-50 50%+64 100%-22" type="button" style="StoneButton">
<object name="matchSettingsCloseButton" size="50%-64 100%-50 50%+64 100%-22" type="button" style="StoneButton">
<translatableAttribute id="caption">Close</translatableAttribute>
</object>

View file

@ -16,11 +16,11 @@ var g_DeveloperOverlay;
var g_DiplomacyColors;
var g_DiplomacyDialog;
var g_GameSpeedControl;
var g_MatchSettingsDialog;
var g_Menu;
var g_MiniMapPanel;
var g_NetworkStatusOverlay;
var g_NetworkDelayOverlay;
var g_ObjectivesDialog;
var g_OutOfSyncNetwork;
var g_OutOfSyncReplay;
var g_PanelEntityManager;
@ -291,11 +291,11 @@ function init(initData, hotloadData)
g_DeveloperOverlay = new DeveloperOverlay(g_PlayerViewControl, g_Selection);
g_DiplomacyDialog = new DiplomacyDialog(g_PlayerViewControl, g_DiplomacyColors);
g_GameSpeedControl = new GameSpeedControl(g_PlayerViewControl);
g_MatchSettingsDialog = new MatchSettingsDialog(g_PlayerViewControl, mapCache);
g_Menu = new Menu(g_PauseControl, g_PlayerViewControl, g_Chat);
g_MiniMapPanel = new MiniMapPanel(g_PlayerViewControl, g_DiplomacyColors, g_WorkerTypes);
g_NetworkStatusOverlay = new NetworkStatusOverlay();
g_NetworkDelayOverlay = new NetworkDelayOverlay();
g_ObjectivesDialog = new ObjectivesDialog(g_PlayerViewControl, mapCache);
g_OutOfSyncNetwork = new OutOfSyncNetwork();
g_OutOfSyncReplay = new OutOfSyncReplay();
g_PanelEntityManager = new PanelEntityManager(g_PlayerViewControl, g_Selection, g_PanelEntityOrder);
@ -305,7 +305,7 @@ function init(initData, hotloadData)
g_RangeOverlayManager = new RangeOverlayManager(g_Selection);
g_ResearchProgress = new ResearchProgress(g_PlayerViewControl, g_Selection);
g_TradeDialog = new TradeDialog(g_PlayerViewControl);
g_TopPanel = new TopPanel(g_PlayerViewControl, g_DiplomacyDialog, g_TradeDialog, g_ObjectivesDialog, g_GameSpeedControl);
g_TopPanel = new TopPanel(g_PlayerViewControl, g_DiplomacyDialog, g_TradeDialog, g_MatchSettingsDialog, g_GameSpeedControl);
g_TimeNotificationOverlay = new TimeNotificationOverlay(g_PlayerViewControl);
initBatchTrain();
@ -515,7 +515,7 @@ function closeOpenDialogs()
g_Menu.close();
g_Chat.closePage();
g_DiplomacyDialog.close();
g_ObjectivesDialog.close();
g_MatchSettingsDialog.close();
g_TradeDialog.close();
}

View file

@ -13,9 +13,9 @@
<script directory="gui/session/diplomacy/playercontrols/"/>
<script directory="gui/session/lobby/"/>
<script directory="gui/session/lobby/LobbyRatingReport/"/>
<script directory="gui/session/match_settings/"/>
<script directory="gui/session/message_box/"/>
<script directory="gui/session/minimap/"/>
<script directory="gui/session/objectives/"/>
<script directory="gui/session/top_panel/"/>
<script directory="gui/session/top_panel/IconButtons/"/>
<script directory="gui/session/trade/"/>
@ -55,7 +55,7 @@
<include directory="gui/session/developer_overlay/"/>
<include directory="gui/session/dialogs/"/>
<include directory="gui/session/diplomacy/"/>
<include directory="gui/session/objectives/"/>
<include directory="gui/session/match_settings/"/>
<include file="gui/session/GameSpeedControl.xml"/>
<include file="gui/session/PanelEntities.xml"/>
<include file="gui/session/ResearchProgress.xml"/>

View file

@ -0,0 +1,23 @@
/**
* This class handles the button that displays the active match's settings.
*/
class MatchSettingsDialogButton
{
constructor(matchSettingsDialog)
{
this.button = Engine.GetGUIObjectByName("matchSettingsButton");
this.button.enabled = !Engine.IsAtlasRunning();
this.button.onPress = matchSettingsDialog.toggle.bind(matchSettingsDialog);
registerHotkeyChangeHandler(this.onHotkeyChange.bind(this));
}
onHotkeyChange()
{
this.button.tooltip =
colorizeHotkey("%(hotkey)s" + " ", "session.gui.matchsettings.toggle") +
translate(this.Tooltip);
}
}
MatchSettingsDialogButton.prototype.Tooltip = markForTranslation("Match Settings");

View file

@ -1,16 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<object
type="button"
name="objectivesButton"
name="matchSettingsButton"
size="100%-194 4 100%-166 32"
style="iconButton"
tooltip_style="sessionToolTip"
hotkey="session.gui.objectives.toggle"
hotkey="session.gui.matchsettings.toggle"
>
<object
size="2 3 100%-4 100%-3"
type="image"
sprite="stretched:session/icons/objectives.png"
sprite="stretched:session/icons/match-settings.png"
ghost="true"
/>
</object>

View file

@ -1,23 +0,0 @@
/**
* This class handles the button that displays the games objectives.
*/
class ObjectivesDialogButton
{
constructor(objectivesDialog)
{
this.objectivesButton = Engine.GetGUIObjectByName("objectivesButton");
this.objectivesButton.enabled = !Engine.IsAtlasRunning();
this.objectivesButton.onPress = objectivesDialog.toggle.bind(objectivesDialog);
registerHotkeyChangeHandler(this.onHotkeyChange.bind(this));
}
onHotkeyChange()
{
this.objectivesButton.tooltip =
colorizeHotkey("%(hotkey)s" + " ", "session.gui.objectives.toggle") +
translate(this.Tooltip);
}
}
ObjectivesDialogButton.prototype.Tooltip = markForTranslation("Objectives");