Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.js (nonexistent)
@@ -1,147 +0,0 @@
-/**
- * The GamesetupPage is the root class owning all other class instances.
- * The class shall be ineligible to perform any GUI object logic and shall defer that task to owned classes.
- */
-class GamesetupPage
-{
- constructor(initData, hotloadData)
- {
- if (!g_Settings)
- return;
-
- Engine.ProfileStart("GamesetupPage");
-
- this.loadHandlers = new Set();
- this.closePageHandlers = new Set();
- this.getHotloadDataHandlers = new Set();
-
- let netMessages = new NetMessages(this);
- let startGameControl = new StartGameControl(netMessages);
- let mapCache = new MapCache();
- let mapFilters = new MapFilters(mapCache);
- let gameSettingsControl = new GameSettingsControl(this, netMessages, startGameControl, mapCache);
- let playerAssignmentsControl = new PlayerAssignmentsControl(this, netMessages);
- let readyControl = new ReadyControl(netMessages, gameSettingsControl, startGameControl, playerAssignmentsControl);
-
- // These class instances control central data and do not manage any GUI Object.
- this.controls = {
- "gameSettingsControl": gameSettingsControl,
- "playerAssignmentsControl": playerAssignmentsControl,
- "mapCache": mapCache,
- "mapFilters": mapFilters,
- "readyControl": readyControl,
- "startGameControl": startGameControl
- };
-
- // These class instances are interfaces to networked messages and do not manage any GUI Object.
- this.netMessages = {
- "netMessages": netMessages,
- "gameRegisterStanza":
- Engine.HasXmppClient() &&
- new GameRegisterStanza(
- initData, this, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache)
- };
-
- // This class instance owns all gamesetting GUI controls such as dropdowns and checkboxes.
- // The controls also deterministically sanitize g_GameAttributes and g_PlayerAssignments
- // without broadcasting the change.
- this.gameSettingControlManager =
- new GameSettingControlManager(this, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl);
-
- // These classes manage GUI buttons.
- {
- let startGameButton = new StartGameButton(this, startGameControl, netMessages, readyControl, playerAssignmentsControl);
- let readyButton = new ReadyButton(readyControl, netMessages, playerAssignmentsControl);
- this.panelButtons = {
- "cancelButton": new CancelButton(this, startGameButton, readyButton, this.netMessages.gameRegisterStanza),
- "civInfoButton": new CivInfoButton(),
- "lobbyButton": new LobbyButton(),
- "readyButton": readyButton,
- "startGameButton": startGameButton
- };
- }
-
- // These classes manage GUI Objects.
- {
- let gameSettingTabs = new GameSettingTabs(this, this.panelButtons.lobbyButton);
- let gameSettingsPanel = new GameSettingsPanel(
- this, gameSettingTabs, gameSettingsControl, this.gameSettingControlManager);
-
- this.panels = {
- "chatPanel": new ChatPanel(this.gameSettingControlManager, gameSettingsControl, netMessages, playerAssignmentsControl, readyControl, gameSettingsPanel),
- "gameSettingWarning": new GameSettingWarning(gameSettingsControl, this.panelButtons.cancelButton),
- "gameDescription": new GameDescription(mapCache, gameSettingTabs, gameSettingsControl),
- "gameSettingsPanel": gameSettingsPanel,
- "gameSettingsTabs": gameSettingTabs,
- "loadingWindow": new LoadingWindow(netMessages),
- "mapPreview": new MapPreview(gameSettingsControl, mapCache),
- "resetCivsButton": new ResetCivsButton(gameSettingsControl),
- "resetTeamsButton": new ResetTeamsButton(gameSettingsControl),
- "soundNotification": new SoundNotification(netMessages, playerAssignmentsControl),
- "tipsPanel": new TipsPanel(gameSettingsPanel),
- "tooltip": new Tooltip(this.panelButtons.cancelButton)
- };
- }
-
- setTimeout(displayGamestateNotifications, 1000);
- Engine.GetGUIObjectByName("setupWindow").onTick = updateTimers;
-
- // This event is triggered after all classes have been instantiated and subscribed to each others events
- for (let handler of this.loadHandlers)
- handler(initData, hotloadData);
-
- Engine.ProfileStop();
-
- if (gameSettingsControl.autostart)
- startGameControl.launchGame();
- }
-
- registerLoadHandler(handler)
- {
- this.loadHandlers.add(handler);
- }
-
- unregisterLoadHandler(handler)
- {
- this.loadHandlers.delete(handler);
- }
-
- registerClosePageHandler(handler)
- {
- this.closePageHandlers.add(handler);
- }
-
- unregisterClosePageHandler(handler)
- {
- this.closePageHandlers.delete(handler);
- }
-
- registerGetHotloadDataHandler(handler)
- {
- this.getHotloadDataHandlers.add(handler);
- }
-
- unregisterGetHotloadDataHandler(handler)
- {
- this.getHotloadDataHandlers.delete(handler);
- }
-
- getHotloadData()
- {
- let object = {};
- for (let handler of this.getHotloadDataHandlers)
- handler(object);
- return object;
- }
-
- closePage()
- {
- for (let handler of this.closePageHandlers)
- handler();
-
- if (Engine.HasXmppClient())
- Engine.SwitchGuiPage("page_lobby.xml", { "dialog": false });
- else
- Engine.SwitchGuiPage("page_pregame.xml");
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlLabels.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlLabels.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlLabels.xml (nonexistent)
@@ -1,20 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlLabels.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.js (nonexistent)
@@ -1,60 +0,0 @@
-/**
- * This class is implemented by gamesettings that are controlled by a checkbox.
- */
-class GameSettingControlCheckbox extends GameSettingControl
-{
- constructor(...args)
- {
- super(...args);
-
- this.isInGuiUpdate = false;
- this.previousSelectedValue = undefined;
- }
-
- setControl(gameSettingControlManager)
- {
- let row = gameSettingControlManager.getNextRow("checkboxSettingFrame");
- this.frame = Engine.GetGUIObjectByName("checkboxSettingFrame[" + row + "]");
- this.checkbox = Engine.GetGUIObjectByName("checkboxSettingControl[" + row + "]");
- this.checkbox.onPress = this.onPressSuper.bind(this);
-
- let labels = this.frame.children[0].children;
- this.title = labels[0];
- this.label = labels[1];
- }
-
- setControlTooltip(tooltip)
- {
- this.checkbox.tooltip = tooltip;
- }
-
- setControlHidden(hidden)
- {
- this.checkbox.hidden = hidden;
- }
-
- setChecked(checked)
- {
- if (this.previousSelectedValue == checked)
- return;
-
- this.isInGuiUpdate = true;
- this.checkbox.checked = checked;
- this.isInGuiUpdate = false;
-
- if (this.label)
- this.label.caption = checked ? this.Checked : this.Unchecked;
- }
-
- onPressSuper()
- {
- if (!this.isInGuiUpdate)
- this.onPress(this.checkbox.checked);
- }
-}
-
-GameSettingControlCheckbox.prototype.Checked =
- translate("Yes");
-
-GameSettingControlCheckbox.prototype.Unchecked =
- translate("No");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.xml (nonexistent)
@@ -1,14 +0,0 @@
-
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlCheckbox.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlManager.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlManager.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlManager.js (nonexistent)
@@ -1,66 +0,0 @@
-/**
- * Each property of this class is a class that inherits GameSettingControl and is
- * instantiated by the GameSettingControlManager.
- */
-class GameSettingControls
-{
-}
-
-/**
- * The GameSettingControlManager owns all classes that handle a logical property of g_GameAttributes.
- */
-class GameSettingControlManager
-{
- constructor(gamesetupPage, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl)
- {
- this.gameSettingsControl = gameSettingsControl;
-
- this.rows = {};
- this.gameSettingControls = {};
-
- let args = Array.from(arguments);
-
- let getCategory = name =>
- g_GameSettingsLayout.findIndex(category => category.settings.indexOf(name) != -1);
-
- for (let name in GameSettingControls)
- this.gameSettingControls[name] =
- new GameSettingControls[name](
- this, getCategory(name), undefined, ...args);
-
- for (let victoryCondition of g_VictoryConditions)
- this.gameSettingControls[victoryCondition.Name] =
- new VictoryConditionCheckbox(
- victoryCondition, this, getCategory(victoryCondition.Name), undefined, ...args);
-
- this.playerSettingControlManagers = Array.from(
- new Array(g_MaxPlayers),
- (value, playerIndex) =>
- new PlayerSettingControlManager(playerIndex, ...args));
- }
-
- getNextRow(name)
- {
- if (this.rows[name] === undefined)
- this.rows[name] = 0;
- else
- ++this.rows[name];
-
- return this.rows[name];
- }
-
- updateSettingVisibility()
- {
- for (let name in this.gameSettingControls)
- this.gameSettingControls[name].updateVisibility();
- }
-
- addAutocompleteEntries(entries)
- {
- for (let name in this.gameSettingControls)
- this.gameSettingControls[name].addAutocompleteEntries(name, entries);
-
- for (let playerSettingControlManager of this.playerSettingControlManagers)
- playerSettingControlManager.addAutocompleteEntries(entries);
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlManager.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.js (nonexistent)
@@ -1,64 +0,0 @@
-/**
- * This class is implemented by gamesettings that are controlled by a dropdown.
- */
-class GameSettingControlDropdown extends GameSettingControl
-{
- constructor(...args)
- {
- super(...args);
-
- this.isInGuiUpdate = false;
- this.dropdown.onSelectionChange = this.onSelectionChangeSuper.bind(this);
- if (this.onHoverChange)
- this.dropdown.onHoverChange = this.onHoverChange.bind(this);
- }
-
- setControl(gameSettingControlManager)
- {
- let row = gameSettingControlManager.getNextRow("dropdownSettingFrame");
- this.frame = Engine.GetGUIObjectByName("dropdownSettingFrame[" + row + "]");
- this.dropdown = Engine.GetGUIObjectByName("dropdownSettingControl[" + row + "]");
-
- let labels = this.frame.children[0].children;
- this.title = labels[0];
- this.label = labels[1];
- }
-
- setControlTooltip(tooltip)
- {
- this.dropdown.tooltip = tooltip;
- }
-
- setControlHidden(hidden)
- {
- this.dropdown.hidden = hidden;
- }
-
- setSelectedValue(value)
- {
- let index = this.dropdown.list_data.indexOf(String(value));
-
- this.isInGuiUpdate = true;
- this.dropdown.selected = index;
- this.isInGuiUpdate = false;
-
- if (this.label)
- this.label.caption = index == -1 ? this.UnknownValue : this.dropdown.list[index];
- }
-
- onSelectionChangeSuper()
- {
- if (!this.isInGuiUpdate)
- this.onSelectionChange(this.dropdown.selected);
- }
-}
-
-/**
- * Highlight the "random" dropdownlist item.
- */
-GameSettingControlDropdown.prototype.RandomItemTags = {
- "color": "orange"
-};
-
-GameSettingControlDropdown.prototype.UnknownValue =
- translateWithContext("settings value", "Unknown");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PlayerSettingControlManager.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PlayerSettingControlManager.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PlayerSettingControlManager.js (nonexistent)
@@ -1,29 +0,0 @@
-/**
- * Each property of this class is a class that inherits GameSettingControl and is
- * instantiated by the PlayerSettingControlManager.
- */
-class PlayerSettingControls
-{
-}
-
-/**
- * The purpose of the PlayerSettingControlManager is to own all controls that handle a property of g_GameAttributes.settings.PlayerData.
- */
-class PlayerSettingControlManager
-{
- constructor(playerIndex, gamesetupPage, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl)
- {
- this.playerSettingControls = {};
-
- for (let name in PlayerSettingControls)
- this.playerSettingControls[name] =
- new PlayerSettingControls[name](
- undefined, undefined, playerIndex, gamesetupPage, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl);
- }
-
- addAutocompleteEntries(autocomplete)
- {
- for (let name in this.playerSettingControls)
- this.playerSettingControls[name].addAutocompleteEntries(name, autocomplete);
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PlayerSettingControlManager.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Cheats.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Cheats.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Cheats.js (nonexistent)
@@ -1,43 +0,0 @@
-/**
- * Cheats are always enabled in singleplayer mode, since they are the choice of that one player.
- */
-GameSettingControls.Cheats = class extends GameSettingControlCheckbox
-{
- constructor(...args)
- {
- super(...args);
- this.setHidden(!g_IsNetworked);
- }
-
- onGameAttributesChange()
- {
- if (g_GameAttributes.settings.CheatsEnabled === undefined ||
- g_GameAttributes.settings.CheatsEnabled && g_GameAttributes.settings.RatingEnabled ||
- !g_GameAttributes.settings.CheatsEnabled && !g_IsNetworked)
- {
- g_GameAttributes.settings.CheatsEnabled = !g_IsNetworked;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setChecked(g_GameAttributes.settings.CheatsEnabled);
- this.setEnabled(!g_GameAttributes.settings.RatingEnabled);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.CheatsEnabled =
- !g_IsNetworked ||
- checked && !g_GameAttributes.settings.RatingEnabled;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.Cheats.prototype.TitleCaption =
- translate("Cheats");
-
-GameSettingControls.Cheats.prototype.Tooltip =
- translate("Toggle the usability of cheats.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Cheats.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LastManStanding.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LastManStanding.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LastManStanding.js (nonexistent)
@@ -1,61 +0,0 @@
-GameSettingControls.LastManStanding = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- !mapData.settings.LockTeams &&
- mapData.settings.LastManStanding;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.LastManStanding)
- {
- g_GameAttributes.settings.LastManStanding = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- this.available = !g_GameAttributes.settings.LockTeams;
- if (this.available)
- {
- if (g_GameAttributes.settings.LastManStanding === undefined)
- {
- g_GameAttributes.settings.LastManStanding = false;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.LastManStanding !== undefined)
- {
- delete g_GameAttributes.settings.LastManStanding;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- // Always display this, so that players are aware that there is this gamemode
- this.setChecked(!!g_GameAttributes.settings.LastManStanding);
- this.setEnabled(g_GameAttributes.mapType != "scenario" && !g_GameAttributes.settings.LockTeams);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.LastManStanding = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.LastManStanding.prototype.TitleCaption =
- translate("Last Man Standing");
-
-GameSettingControls.LastManStanding.prototype.Tooltip =
- translate("Toggle whether the last remaining player or the last remaining set of allies wins.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LastManStanding.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js (nonexistent)
@@ -1,62 +0,0 @@
-GameSettingControls.LockedTeams = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- !mapData.settings.LockTeams &&
- mapData.settings.LastManStanding;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.LastManStanding)
- {
- g_GameAttributes.settings.LastManStanding = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- if (g_GameAttributes.settings.LockTeams === undefined ||
- g_GameAttributes.settings.RatingEnabled && !g_GameAttributes.settings.LockTeams)
- {
- g_GameAttributes.settings.LockTeams = g_IsNetworked;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- this.setChecked(g_GameAttributes.settings.LockTeams);
-
- this.setEnabled(
- g_GameAttributes.mapType != "scenario" &&
- !g_GameAttributes.settings.RatingEnabled);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.LockTeams = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.LockedTeams.prototype.TitleCaption =
- translate("Teams Locked");
-
-GameSettingControls.LockedTeams.prototype.Tooltip =
- translate("Toggle locked teams.");
-
-/**
- * In multiplayer mode, players negotiate teams before starting the match and
- * expect to play the match with these teams unless explicitly stated otherwise during the match settings.
- * For singleplayermode, preserve the historic default of open diplomacies.
- */
-GameSettingControls.LockedTeams.prototype.DefaultValue = Engine.HasNetClient();
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/LockedTeams.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Treasures.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Treasures.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Treasures.js (nonexistent)
@@ -1,45 +0,0 @@
-GameSettingControls.Treasures = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.DisableTreasures;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.DisableTreasures)
- {
- g_GameAttributes.settings.DisableTreasures = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- this.setEnabled(g_GameAttributes.mapType != "scenario");
- }
-
- onGameAttributesChange()
- {
- if (g_GameAttributes.settings.DisableTreasures === undefined)
- {
- g_GameAttributes.settings.DisableTreasures = false;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setChecked(g_GameAttributes.settings.DisableTreasures);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.DisableTreasures = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.Treasures.prototype.TitleCaption =
- translate("Disable Treasures");
-
-GameSettingControls.Treasures.prototype.Tooltip =
- translate("Do not add treasures to the map.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Treasures.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Nomad.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Nomad.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Nomad.js (nonexistent)
@@ -1,63 +0,0 @@
-GameSettingControls.Nomad = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let available = g_GameAttributes.mapType == "random";
- this.setHidden(!available);
- if (!available)
- return;
-
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.Nomad;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.Nomad)
- {
- g_GameAttributes.settings.Nomad = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- if (g_GameAttributes.mapType == "random")
- {
- if (g_GameAttributes.settings.Nomad === undefined)
- {
- g_GameAttributes.settings.Nomad = false;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.Nomad !== undefined)
- {
- delete g_GameAttributes.settings.Nomad;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- if (g_GameAttributes.mapType == "random")
- this.setChecked(g_GameAttributes.settings.Nomad);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.Nomad = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.Nomad.prototype.TitleCaption =
- translate("Nomad");
-
-GameSettingControls.Nomad.prototype.Tooltip =
- translate("In Nomad mode, players start with only few units and have to find a suitable place to build their city. Ceasefire is recommended.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Nomad.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/ExploredMap.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/ExploredMap.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/ExploredMap.js (nonexistent)
@@ -1,58 +0,0 @@
-GameSettingControls.ExploredMap = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.ExploreMap || undefined;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.ExploreMap)
- {
- g_GameAttributes.settings.ExploreMap = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- if (g_GameAttributes.settings.ExploreMap === undefined)
- {
- g_GameAttributes.settings.ExploreMap = !!g_GameAttributes.settings.RevealMap;
- this.gameSettingsControl.updateGameAttributes();
- }
- else if (g_GameAttributes.settings.RevealMap &&
- !g_GameAttributes.settings.ExploreMap)
- {
- g_GameAttributes.settings.ExploreMap = true;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- this.setChecked(g_GameAttributes.settings.ExploreMap);
- this.setEnabled(g_GameAttributes.mapType != "scenario" && !g_GameAttributes.settings.RevealMap);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.ExploreMap = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.ExploredMap.prototype.TitleCaption =
- // Translation: Make sure to differentiate between the revealed map and explored map settings!
- translate("Explored Map");
-
-GameSettingControls.ExploredMap.prototype.Tooltip =
- // Translation: Make sure to differentiate between the revealed map and explored map settings!
- translate("Toggle explored map (see initial map).");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/ExploredMap.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RegicideGarrison.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RegicideGarrison.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RegicideGarrison.js (nonexistent)
@@ -1,67 +0,0 @@
-GameSettingControls.RegicideGarrison = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- this.setEnabled(g_GameAttributes.mapType != "scenario");
-
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.VictoryConditions &&
- mapData.settings.VictoryConditions.indexOf(this.RegicideName) != -1 &&
- mapData.settings.RegicideGarrison;
-
- if (mapValue !== undefined || !g_GameAttributes.settings || mapValue == g_GameAttributes.settings.RegicideGarrison)
- return;
-
- if (!g_GameAttributes.settings.VictoryConditions)
- g_GameAttributes.settings.VictoryConditions = [];
-
- if (g_GameAttributes.settings.VictoryConditions.indexOf(this.RegicideName) == -1)
- g_GameAttributes.settings.VictoryConditions.push(this.RegicideName);
-
- g_GameAttributes.settings.RegicideGarrison = mapValue;
-
- this.gameSettingsControl.updateGameAttributes();
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.settings.VictoryConditions)
- return;
-
- let available = g_GameAttributes.settings.VictoryConditions.indexOf(this.RegicideName) != -1;
- this.setHidden(!available);
-
- if (available)
- {
- if (g_GameAttributes.settings.RegicideGarrison === undefined)
- {
- g_GameAttributes.settings.RegicideGarrison = false;
- this.gameSettingsControl.updateGameAttributes();
- }
- this.setChecked(g_GameAttributes.settings.RegicideGarrison);
- }
- else if (g_GameAttributes.settings.RegicideGarrison !== undefined)
- {
- delete g_GameAttributes.settings.RegicideGarrison;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.RegicideGarrison = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.RegicideGarrison.prototype.TitleCaption =
- translate("Hero Garrison");
-
-GameSettingControls.RegicideGarrison.prototype.Tooltip =
- translate("Toggle whether heroes can be garrisoned.");
-
-GameSettingControls.RegicideGarrison.prototype.RegicideName =
- "regicide";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RegicideGarrison.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Spies.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Spies.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Spies.js (nonexistent)
@@ -1,45 +0,0 @@
-GameSettingControls.Spies = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.DisableSpies;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.DisableSpies)
- {
- g_GameAttributes.settings.DisableSpies = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- this.setEnabled(g_GameAttributes.mapType != "scenario");
- }
-
- onGameAttributesChange()
- {
- if (g_GameAttributes.settings.DisableSpies === undefined)
- {
- g_GameAttributes.settings.DisableSpies = false;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setChecked(g_GameAttributes.settings.DisableSpies);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.DisableSpies = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.Spies.prototype.TitleCaption =
- translate("Disable Spies");
-
-GameSettingControls.Spies.prototype.Tooltip =
- translate("Disable spies during the game.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Spies.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Rating.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Rating.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Rating.js (nonexistent)
@@ -1,54 +0,0 @@
-GameSettingControls.Rating = class extends GameSettingControlCheckbox
-{
- constructor(...args)
- {
- super(...args);
-
- this.hasXmppClient = Engine.HasXmppClient();
- this.available = false;
- }
-
- onGameAttributesChange()
- {
- this.available = this.hasXmppClient && g_GameAttributes.settings.PlayerData.length == 2;
- if (this.available)
- {
- if (g_GameAttributes.settings.RatingEnabled === undefined)
- {
- g_GameAttributes.settings.RatingEnabled = true;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.RatingEnabled !== undefined)
- {
- delete g_GameAttributes.settings.RatingEnabled;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setHidden(!this.available);
- if (this.available)
- this.setChecked(g_GameAttributes.settings.RatingEnabled);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.RatingEnabled = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- onGameAttributesFinalize()
- {
- if (this.hasXmppClient)
- Engine.SetRankedGame(!!g_GameAttributes.settings.RatingEnabled);
- }
-};
-
-GameSettingControls.Rating.prototype.TitleCaption =
- translate("Rated Game");
-
-GameSettingControls.Rating.prototype.Tooltip =
- translate("Toggle if this game will be rated for the leaderboard.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/Rating.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RevealedMap.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RevealedMap.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RevealedMap.js (nonexistent)
@@ -1,53 +0,0 @@
-GameSettingControls.RevealedMap = class extends GameSettingControlCheckbox
-{
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.RevealMap || undefined;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.RevealMap)
- {
- g_GameAttributes.settings.RevealMap = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- this.setEnabled(g_GameAttributes.mapType != "scenario");
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- if (g_GameAttributes.settings.RevealMap === undefined)
- {
- g_GameAttributes.settings.RevealMap = false;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- this.setChecked(g_GameAttributes.settings.RevealMap);
- }
-
- onPress(checked)
- {
- g_GameAttributes.settings.RevealMap = checked;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.RevealedMap.prototype.TitleCaption =
- // Translation: Make sure to differentiate between the revealed map and explored map settings!
- translate("Revealed Map");
-
-GameSettingControls.RevealedMap.prototype.Tooltip =
- // Translation: Make sure to differentiate between the revealed map and explored map settings!
- translate("Toggle revealed map (see everything).");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Checkboxes/RevealedMap.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicDuration.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicDuration.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicDuration.js (nonexistent)
@@ -1,85 +0,0 @@
-GameSettingControls.RelicDuration = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = prepareForDropdown(g_Settings.VictoryDurations);
-
- this.dropdown.list = this.values.Title;
- this.dropdown.list_data = this.values.Duration;
-
- this.available = false;
- }
-
- onMapChange(mapData)
- {
- this.setEnabled(g_GameAttributes.mapType != "scenario");
-
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.VictoryConditions &&
- mapData.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1 &&
- mapData.settings.RelicDuration || undefined;
-
- if (mapValue === undefined || mapValue == g_GameAttributes.settings.RelicDuration)
- return;
-
- if (!g_GameAttributes.settings.VictoryConditions)
- g_GameAttributes.settings.VictoryConditions = [];
-
- if (g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) == -1)
- g_GameAttributes.settings.VictoryConditions.push(this.NameCaptureTheRelic);
-
- g_GameAttributes.settings.RelicDuration = mapValue;
-
- this.gameSettingsControl.updateGameAttributes();
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.settings.VictoryConditions)
- return;
-
- this.available = g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1;
-
- if (this.available)
- {
- if (g_GameAttributes.settings.RelicDuration === undefined)
- {
- g_GameAttributes.settings.RelicDuration = this.values.Duration[this.values.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.RelicDuration !== undefined)
- {
- delete g_GameAttributes.settings.RelicDuration;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setHidden(!this.available);
-
- if (this.available)
- this.setSelectedValue(g_GameAttributes.settings.RelicDuration);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.RelicDuration = this.values.Duration[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.RelicDuration.prototype.TitleCaption =
- translate("Relic Duration");
-
-GameSettingControls.RelicDuration.prototype.Tooltip =
- translate("Minutes until the player has achieved Relic Victory.");
-
-GameSettingControls.RelicDuration.prototype.NameCaptureTheRelic =
- "capture_the_relic";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicDuration.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/WonderDuration.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/WonderDuration.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/WonderDuration.js (nonexistent)
@@ -1,85 +0,0 @@
-GameSettingControls.WonderDuration = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = prepareForDropdown(g_Settings.VictoryDurations);
-
- this.dropdown.list = this.values.Title;
- this.dropdown.list_data = this.values.Duration;
-
- this.available = false;
- }
-
- onMapChange(mapData)
- {
- this.setEnabled(g_GameAttributes.mapType != "scenario");
-
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.VictoryConditions &&
- mapData.settings.VictoryConditions.indexOf(this.NameWonderVictory) != -1 &&
- mapData.settings.WonderDuration || undefined;
-
- if (mapValue === undefined || mapValue == g_GameAttributes.settings.WonderDuration)
- return;
-
- if (!g_GameAttributes.settings.VictoryConditions)
- g_GameAttributes.settings.VictoryConditions = [];
-
- if (g_GameAttributes.settings.VictoryConditions.indexOf(this.NameWonderVictory) == -1)
- g_GameAttributes.settings.VictoryConditions.push(this.NameWonderVictory);
-
- g_GameAttributes.settings.WonderDuration = mapValue;
-
- this.gameSettingsControl.updateGameAttributes();
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.settings.VictoryConditions)
- return;
-
- this.available = g_GameAttributes.settings.VictoryConditions.indexOf(this.NameWonderVictory) != -1;
-
- if (this.available)
- {
- if (g_GameAttributes.settings.WonderDuration === undefined)
- {
- g_GameAttributes.settings.WonderDuration = this.values.Duration[this.values.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.WonderDuration !== undefined)
- {
- delete g_GameAttributes.settings.WonderDuration;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setHidden(!this.available);
-
- if (this.available)
- this.setSelectedValue(g_GameAttributes.settings.WonderDuration);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.WonderDuration = this.values.Duration[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.WonderDuration.prototype.TitleCaption =
- translate("Wonder Duration");
-
-GameSettingControls.WonderDuration.prototype.Tooltip =
- translate("Minutes until the player has achieved Wonder Victory");
-
-GameSettingControls.WonderDuration.prototype.NameWonderVictory =
- "wonder";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/WonderDuration.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PlayerCount.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PlayerCount.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PlayerCount.js (nonexistent)
@@ -1,52 +0,0 @@
-GameSettingControls.PlayerCount = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = Array.from(
- new Array(g_MaxPlayers),
- (v, i) => i + 1);
-
- this.dropdown.list = this.values;
- this.dropdown.list_data = this.values;
- }
-
- onMapChange(mapData)
- {
- if (mapData &&
- mapData.settings &&
- mapData.settings.PlayerData &&
- mapData.settings.PlayerData.length != g_GameAttributes.settings.PlayerData.length)
- {
- this.onSelectionChange(this.values.indexOf(mapData.settings.PlayerData.length));
- }
-
- this.setEnabled(g_GameAttributes.mapType == "random");
- }
-
- onGameAttributesBatchChange()
- {
- this.setSelectedValue(g_GameAttributes.settings.PlayerData.length);
- }
-
- onSelectionChange(itemIdx)
- {
- let length = this.values[itemIdx];
- if (g_GameAttributes.settings.PlayerData.length == length)
- return;
-
- g_GameAttributes.settings.PlayerData.length = length;
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
-
- this.playerAssignmentsControl.unassignInvalidPlayers();
- }
-};
-
-GameSettingControls.PlayerCount.prototype.TitleCaption =
- translate("Number of Players");
-
-GameSettingControls.PlayerCount.prototype.Tooltip =
- translate("Select number of players.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PlayerCount.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicCount.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicCount.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicCount.js (nonexistent)
@@ -1,86 +0,0 @@
-GameSettingControls.RelicCount = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = Object.keys(g_CivData).map((v, i) => i + 1);
-
- this.dropdown.list = this.values;
- this.dropdown.list_data = this.values;
-
- this.available = false;
- }
-
- onMapChange(mapData)
- {
- this.setEnabled(g_GameAttributes.mapType != "scenario");
-
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.VictoryConditions &&
- mapData.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1 &&
- mapData.settings.RelicCount || undefined;
-
- if (mapValue === undefined || mapValue == g_GameAttributes.settings.RelicCount)
- return;
-
- if (!g_GameAttributes.settings.VictoryConditions)
- g_GameAttributes.settings.VictoryConditions = [];
-
- if (g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) == -1)
- g_GameAttributes.settings.VictoryConditions.push(this.NameCaptureTheRelic);
-
- g_GameAttributes.settings.RelicCount = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.settings.VictoryConditions)
- return;
-
- this.available = g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1;
-
- if (this.available)
- {
- if (g_GameAttributes.settings.RelicCount === undefined)
- {
- g_GameAttributes.settings.RelicCount = this.DefaultRelicCount;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.RelicCount !== undefined)
- {
- delete g_GameAttributes.settings.RelicCount;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setHidden(!this.available);
-
- if (this.available)
- this.setSelectedValue(g_GameAttributes.settings.RelicCount);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.RelicCount = this.values[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.RelicCount.prototype.TitleCaption =
- translate("Relic Count");
-
-GameSettingControls.RelicCount.prototype.Tooltip =
- translate("Total number of relics spawned on the map. Relic victory is most realistic with only one or two relics. With greater numbers, the relics are important to capture to receive aura bonuses.");
-
-GameSettingControls.RelicCount.prototype.NameCaptureTheRelic =
- "capture_the_relic";
-
-GameSettingControls.RelicCount.prototype.DefaultRelicCount = 2;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/RelicCount.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSize.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSize.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSize.js (nonexistent)
@@ -1,79 +0,0 @@
-GameSettingControls.MapSize = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.previousMapType = undefined;
-
- this.dropdown.list = g_MapSizes.Name;
- this.dropdown.list_data = g_MapSizes.Tiles;
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = g_MapSizes.Tooltip[this.dropdown.hovered] || this.Tooltip;
- }
-
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.Size || undefined;
-
- if (g_GameAttributes.mapType == "random" && mapValue !== undefined && mapValue != g_GameAttributes.settings.Size)
- {
- g_GameAttributes.settings.Size = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType ||
- !g_GameAttributes.settings ||
- this.previousMapType == g_GameAttributes.mapType)
- return;
-
- this.previousMapType = g_GameAttributes.mapType;
-
- let available = g_GameAttributes.mapType == "random";
- this.setHidden(!available);
-
- if (available)
- {
- if (g_GameAttributes.settings.Size === undefined)
- {
- g_GameAttributes.settings.Size = g_MapSizes.Tiles[g_MapSizes.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- this.setSelectedValue(g_GameAttributes.settings.Size);
- }
- else if (g_GameAttributes.settings.Size !== undefined)
- {
- delete g_GameAttributes.settings.Size;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- getAutocompleteEntries()
- {
- return g_MapSizes.Name;
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.Size = g_MapSizes.Tiles[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.MapSize.prototype.TitleCaption =
- translate("Map Size");
-
-GameSettingControls.MapSize.prototype.Tooltip =
- translate("Select map size. (Larger sizes may reduce performance.)");
-
-GameSettingControls.MapSize.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSize.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PopulationCap.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PopulationCap.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PopulationCap.js (nonexistent)
@@ -1,101 +0,0 @@
-GameSettingControls.PopulationCap = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.perPlayer = false;
-
- this.dropdown.list = g_PopulationCapacities.Title;
- this.dropdown.list_data = g_PopulationCapacities.Population;
-
- this.sprintfArgs = {};
- }
-
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.PopulationCap || undefined;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.PopulationCap)
- {
- g_GameAttributes.settings.PopulationCap = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- let isScenario = g_GameAttributes.mapType == "scenario";
-
- this.perPlayer =
- isScenario &&
- mapData.settings.PlayerData &&
- mapData.settings.PlayerData.some(pData => pData && pData.PopulationLimit !== undefined);
-
- this.setEnabled(!isScenario && !this.perPlayer);
-
- if (this.perPlayer)
- this.label.caption = this.PerPlayerCaption;
- }
-
- onGameAttributesChange()
- {
- if (g_GameAttributes.settings.PopulationCap === undefined)
- {
- g_GameAttributes.settings.PopulationCap = g_PopulationCapacities.Population[g_PopulationCapacities.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!this.perPlayer)
- this.setSelectedValue(g_GameAttributes.settings.PopulationCap);
- }
-
- onHoverChange()
- {
- let tooltip = this.Tooltip;
- if (this.dropdown.hovered != -1)
- {
- let popCap = g_PopulationCapacities.Population[this.dropdown.hovered];
- let players = g_GameAttributes.settings.PlayerData.length;
- if (popCap * players >= this.PopulationCapacityRecommendation)
- {
- this.sprintfArgs.players = players;
- this.sprintfArgs.popCap = popCap;
- tooltip = setStringTags(sprintf(this.HoverTooltip, this.sprintfArgs), this.HoverTags);
- }
- }
- this.dropdown.tooltip = tooltip;
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.PopulationCap = g_PopulationCapacities.Population[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.PopulationCap.prototype.TitleCaption =
- translate("Population Cap");
-
-GameSettingControls.PopulationCap.prototype.Tooltip =
- translate("Select population limit.");
-
-GameSettingControls.PopulationCap.prototype.PerPlayerCaption =
- translateWithContext("population limit", "Per Player");
-
-GameSettingControls.PopulationCap.prototype.HoverTooltip =
- translate("Warning: There might be performance issues if all %(players)s players reach %(popCap)s population.");
-
-GameSettingControls.PopulationCap.prototype.HoverTags = {
- "color": "orange"
-};
-
-/**
- * Total number of units that the engine can run with smoothly.
- * It means a 4v4 with 150 population can still run nicely, but more than that might "lag".
- */
-GameSettingControls.PopulationCap.prototype.PopulationCapacityRecommendation = 1200;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/PopulationCap.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapType.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapType.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapType.js (nonexistent)
@@ -1,66 +0,0 @@
-/**
- * Maptype design:
- * Scenario maps have fixed terrain and all settings predetermined.
- * Skirmish maps have fixed terrain, playercount but settings are free.
- * For random maps, settings are fully determined by the player and the terrain is generated based on them.
- */
-GameSettingControls.MapType = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.dropdown.list = g_MapTypes.Title;
- this.dropdown.list_data = g_MapTypes.Name;
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = g_MapTypes.Description[this.dropdown.hovered] || this.Tooltip;
- }
-
- onGameAttributesChange()
- {
- if (g_MapTypes.Name.indexOf(g_GameAttributes.mapType || undefined) == -1)
- {
- g_GameAttributes.mapType = g_MapTypes.Name[g_MapTypes.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setSelectedValue(g_GameAttributes.mapType);
- }
-
- getAutocompleteEntries()
- {
- return g_MapTypes.Title;
- }
-
- onSelectionChange(itemIdx)
- {
- let mapType = g_MapTypes.Name[itemIdx];
-
- if (g_GameAttributes.mapType == mapType)
- return;
-
- if (mapType == "scenario")
- g_GameAttributes = {
- "mapFilter": g_GameAttributes.mapFilter
- };
-
- g_GameAttributes.mapType = mapType;
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.MapType.prototype.TitleCaption =
- translate("Map Type");
-
-GameSettingControls.MapType.prototype.Tooltip =
- translate("Select a map type.");
-
-GameSettingControls.MapType.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapType.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSelection.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSelection.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSelection.js (nonexistent)
@@ -1,171 +0,0 @@
-GameSettingControls.MapSelection = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = undefined;
-
- this.previousMapType = undefined;
- this.previousMapFilter = undefined;
-
- this.randomItem = {
- "file": this.RandomMapId,
- "name": setStringTags(this.RandomMapCaption, this.RandomItemTags),
- "description": this.RandomMapDescription
- };
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = this.values.description[this.dropdown.hovered] || this.Tooltip;
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType || !g_GameAttributes.mapFilter)
- return;
-
- this.updateMapList();
-
- if (!this.gameSettingsControl.autostart &&
- this.values &&
- this.values.file.indexOf(g_GameAttributes.map || undefined) == -1)
- {
- g_GameAttributes.map = this.values.file[0];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (g_GameAttributes.map)
- this.setSelectedValue(g_GameAttributes.map);
- }
-
- updateMapList()
- {
- if (this.previousMapType &&
- this.previousMapType == g_GameAttributes.mapType &&
- this.previousMapFilter &&
- this.previousMapFilter == g_GameAttributes.mapFilter)
- return;
-
- Engine.ProfileStart("updateMapSelectionList");
-
- this.previousMapType = g_GameAttributes.mapType;
- this.previousMapFilter = g_GameAttributes.mapFilter;
-
- {
- let values =
- this.mapFilters.getFilteredMaps(
- g_GameAttributes.mapType,
- g_GameAttributes.mapFilter,
- false);
-
- values.sort(sortNameIgnoreCase);
-
- if (g_GameAttributes.mapType == "random")
- values.unshift(this.randomItem);
-
- this.values = prepareForDropdown(values);
- }
-
- this.dropdown.list = this.values.name;
- this.dropdown.list_data = this.values.file;
- Engine.ProfileStop();
- }
-
- onSelectionChange(itemIdx)
- {
- this.selectMap(this.values.file[itemIdx]);
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- /**
- * @param mapPath - for example "maps/skirmishes/Acropolis Bay (2)"
- */
- selectMap(mapPath)
- {
- if (g_GameAttributes.map == mapPath)
- return;
-
- Engine.ProfileStart("selectMap");
-
- // For scenario map, reset every setting per map selection
- // For skirmish and random maps, persist player choices
- if (g_GameAttributes.mapType == "scenario")
- g_GameAttributes = {
- "mapType": g_GameAttributes.mapType,
- "mapFilter": g_GameAttributes.mapFilter
- };
-
- g_GameAttributes.map = mapPath;
- this.gameSettingsControl.updateGameAttributes();
-
- Engine.ProfileStop();
- }
-
- getAutocompleteEntries()
- {
- return this.values.name;
- }
-
- onPickRandomItems()
- {
- if (g_GameAttributes.map == this.RandomMapId)
- {
- this.selectMap(pickRandom(this.values.file.slice(1)));
- this.gameSettingsControl.pickRandomItems();
- }
- }
-
- onGameAttributesFinalize()
- {
- // Copy map well known properties (and only well known properties)
- let mapData = this.mapCache.getMapData(g_GameAttributes.mapType, g_GameAttributes.map);
-
- g_GameAttributes.settings.CircularMap =
- mapData.settings.CircularMap || true;
-
- if (g_GameAttributes.mapType == "random")
- g_GameAttributes.script = mapData.settings.Script;
-
- g_GameAttributes.settings.TriggerScripts = Array.from(new Set([
- ...(g_GameAttributes.settings.TriggerScripts || []),
- ...(mapData.settings.TriggerScripts || [])
- ]));
-
- for (let property of this.MapSettings)
- if (mapData.settings[property] !== undefined)
- g_GameAttributes.settings[property] = mapData.settings[property];
- }
-};
-
-GameSettingControls.MapSelection.prototype.TitleCaption =
- translate("Select Map");
-
-GameSettingControls.MapSelection.prototype.Tooltip =
- translate("Select a map to play on.");
-
-GameSettingControls.MapSelection.prototype.RandomMapId =
- "random";
-
-GameSettingControls.MapSelection.prototype.RandomMapCaption =
- translateWithContext("map selection", "Random");
-
-GameSettingControls.MapSelection.prototype.RandomMapDescription =
- translate("Pick any of the given maps at random.");
-
-GameSettingControls.MapSelection.prototype.AutocompleteOrder = 0;
-
-GameSettingControls.MapSelection.prototype.MapSettings = [
- "StartingTechnologies",
- "DisabledTechnologies",
- "DisabledTemplates",
- "StartingCamera",
- "Garrison",
- // Copy the map name so that the replay menu doesn't have to load hundreds of map descriptions on init
- // Also it allows determining the english mapname from the replay file if the map is not available.
- "Name"
-];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapSelection.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapFilter.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapFilter.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapFilter.js (nonexistent)
@@ -1,94 +0,0 @@
-GameSettingControls.MapFilter = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = undefined;
- this.previousMapType = undefined;
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip;
- }
-
- onGameAttributesChange()
- {
- this.checkMapTypeChange();
-
- if (this.values)
- {
- if (this.values.Name.indexOf(g_GameAttributes.mapFilter || undefined) == -1)
- {
- g_GameAttributes.mapFilter = this.values.Name[this.values.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.mapFilter !== undefined)
- {
- delete g_GameAttributes.mapFilter;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- checkMapTypeChange()
- {
- if (!g_GameAttributes.mapType || this.previousMapType == g_GameAttributes.mapType)
- return;
-
- Engine.ProfileStart("updateMapFilterList");
- this.previousMapType = g_GameAttributes.mapType;
-
- let values = prepareForDropdown(
- this.mapFilters.getAvailableMapFilters(
- g_GameAttributes.mapType));
-
- if (values.Name.length)
- {
- this.dropdown.list = values.Title;
- this.dropdown.list_data = values.Name;
- this.values = values;
- }
- else
- this.values = undefined;
-
- this.setHidden(!this.values);
- Engine.ProfileStop();
- }
-
- onGameAttributesBatchChange()
- {
- if (this.values && g_GameAttributes.mapFilter)
- this.setSelectedValue(g_GameAttributes.mapFilter);
- }
-
- getAutocompleteEntries()
- {
- return this.values && this.values.Title;
- }
-
- onSelectionChange(itemIdx)
- {
- if (this.values)
- {
- g_GameAttributes.mapFilter = this.values.Name[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
- }
-
- onGameAttributesFinalize()
- {
- // The setting is only relevant to the gamesetup stage!
- delete g_GameAttributes.mapFilter;
- }
-};
-
-GameSettingControls.MapFilter.prototype.TitleCaption =
- translate("Map Filter");
-
-GameSettingControls.MapFilter.prototype.Tooltip =
- translate("Select a map filter.");
-
-GameSettingControls.MapFilter.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/MapFilter.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/TriggerDifficulty.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/TriggerDifficulty.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/TriggerDifficulty.js (nonexistent)
@@ -1,84 +0,0 @@
-GameSettingControls.TriggerDifficulty = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = undefined;
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip =
- this.values && this.values.Tooltip[this.dropdown.hovered] ||
- this.Tooltip;
- }
-
- onMapChange(mapData)
- {
- let available = mapData && mapData.settings && mapData.settings.SupportedTriggerDifficulties || undefined;
- this.setHidden(!available);
-
- if (available)
- {
- Engine.ProfileStart("updateTriggerDifficultyList");
- let values = g_Settings.TriggerDifficulties;
- if (Array.isArray(available.Values))
- values = values.filter(diff => available.Values.indexOf(diff.Name) != -1);
-
- this.values = prepareForDropdown(values);
-
- this.dropdown.list = this.values.Title;
- this.dropdown.list_data = this.values.Difficulty;
-
- if (mapData.settings.TriggerDifficulty &&
- this.values.Difficulty.indexOf(mapData.settings.TriggerDifficulty) != -1)
- g_GameAttributes.settings.TriggerDifficulty = mapData.settings.TriggerDifficulty;
- Engine.ProfileStop();
- }
- else
- {
- this.values = undefined;
- this.defaultValue = undefined;
- }
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- if (this.values)
- {
- if (this.values.Difficulty.indexOf(g_GameAttributes.settings.TriggerDifficulty || undefined) == -1)
- {
- g_GameAttributes.settings.TriggerDifficulty = this.values.Difficulty[this.values.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.TriggerDifficulty !== undefined)
- {
- delete g_GameAttributes.settings.TriggerDifficulty;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (this.values)
- this.setSelectedValue(g_GameAttributes.settings.TriggerDifficulty);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.TriggerDifficulty = this.values.Difficulty[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.TriggerDifficulty.prototype.TitleCaption =
- translate("Difficulty");
-
-GameSettingControls.TriggerDifficulty.prototype.Tooltip =
- translate("Select the difficulty of this scenario.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/TriggerDifficulty.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/StartingResources.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/StartingResources.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/StartingResources.js (nonexistent)
@@ -1,92 +0,0 @@
-GameSettingControls.StartingResources = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.dropdown.list = g_StartingResources.Title;
- this.dropdown.list_data = g_StartingResources.Resources;
-
- this.perPlayer = false;
- this.sprintfArgs = {};
- }
-
- onHoverChange()
- {
- let tooltip = this.Tooltip;
- if (this.dropdown.hovered != -1)
- {
- this.sprintfArgs.resources = g_StartingResources.Resources[this.dropdown.hovered];
- tooltip = sprintf(this.HoverTooltip, this.sprintfArgs);
- }
- this.dropdown.tooltip = tooltip;
- }
-
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.StartingResources || undefined;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.StartingResources)
- {
- g_GameAttributes.settings.StartingResources = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- let isScenario = g_GameAttributes.mapType == "scenario";
-
- this.perPlayer =
- isScenario &&
- mapData.settings.PlayerData &&
- mapData.settings.PlayerData.some(pData => pData && pData.Resources !== undefined);
-
- this.setEnabled(!isScenario && !this.perPlayer);
-
- if (this.perPlayer)
- this.label.caption = this.PerPlayerCaption;
- }
-
- onGameAttributesChange()
- {
- if (g_GameAttributes.settings.StartingResources === undefined)
- {
- g_GameAttributes.settings.StartingResources =
- g_StartingResources.Resources[g_StartingResources.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!this.perPlayer)
- this.setSelectedValue(g_GameAttributes.settings.StartingResources);
- }
-
- getAutocompleteEntries()
- {
- return g_StartingResources.Title;
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.StartingResources = g_StartingResources.Resources[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.StartingResources.prototype.TitleCaption =
- translate("Starting Resources");
-
-GameSettingControls.StartingResources.prototype.Tooltip =
- translate("Select the game's starting resources.");
-
-GameSettingControls.StartingResources.prototype.HoverTooltip =
- translate("Initial amount of each resource: %(resources)s.");
-
-GameSettingControls.StartingResources.prototype.PerPlayerCaption =
- translateWithContext("starting resources", "Per Player");
-
-GameSettingControls.StartingResources.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/StartingResources.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Ceasefire.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Ceasefire.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Ceasefire.js (nonexistent)
@@ -1,55 +0,0 @@
-GameSettingControls.Ceasefire = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = prepareForDropdown(g_Settings.Ceasefire);
-
- this.dropdown.list = this.values.Title;
- this.dropdown.list_data = this.values.Duration;
- }
-
- onMapChange(mapData)
- {
- let mapValue =
- mapData &&
- mapData.settings &&
- mapData.settings.Ceasefire || undefined;
-
- if (mapValue !== undefined && mapValue != g_GameAttributes.settings.Ceasefire)
- {
- g_GameAttributes.settings.Ceasefire = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- this.setEnabled(g_GameAttributes.mapType != "scenario");
- }
-
- onGameAttributesChange()
- {
- if (g_GameAttributes.settings.Ceasefire == undefined)
- {
- g_GameAttributes.settings.Ceasefire = this.values.Default;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setSelectedValue(g_GameAttributes.settings.Ceasefire);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.Ceasefire = this.values.Duration[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.Ceasefire.prototype.TitleCaption =
- translate("Ceasefire");
-
-GameSettingControls.Ceasefire.prototype.Tooltip =
- translate("Set time where no attacks are possible.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Ceasefire.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/GameSpeed.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/GameSpeed.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/GameSpeed.js (nonexistent)
@@ -1,76 +0,0 @@
-GameSettingControls.GameSpeed = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.previousAllowFastForward = undefined;
- }
-
- onMapChange(mapData)
- {
- let mapValue = mapData && mapData.gameSpeed || undefined;
- if (mapValue !== undefined && mapValue != g_GameAttributes.gameSpeed)
- {
- g_GameAttributes.gameSpeed = mapValue;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onPlayerAssignmentsChange()
- {
- this.update();
- }
-
- onGameAttributesChange()
- {
- this.update();
- }
-
- update()
- {
- let allowFastForward = true;
- for (let guid in g_PlayerAssignments)
- if (g_PlayerAssignments[guid].player != -1)
- {
- allowFastForward = false;
- break;
- }
-
- if (this.previousAllowFastForward !== allowFastForward)
- {
- Engine.ProfileStart("updateGameSpeedList");
- this.previousAllowFastForward = allowFastForward;
- this.values = prepareForDropdown(
- g_Settings.GameSpeeds.filter(speed => !speed.FastForward || allowFastForward));
-
- this.dropdown.list = this.values.Title;
- this.dropdown.list_data = this.values.Speed;
- Engine.ProfileStop();
- }
-
- if (this.values.Speed.indexOf(g_GameAttributes.gameSpeed || undefined) == -1)
- {
- g_GameAttributes.gameSpeed = this.values.Speed[this.values.Default];
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setSelectedValue(g_GameAttributes.gameSpeed);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.gameSpeed = this.values.Speed[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-GameSettingControls.GameSpeed.prototype.TitleCaption =
- translate("Game Speed");
-
-GameSettingControls.GameSpeed.prototype.Tooltip =
- translate("Select game speed.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/GameSpeed.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Landscape.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Landscape.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Landscape.js (nonexistent)
@@ -1,148 +0,0 @@
-GameSettingControls.Landscape = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = undefined;
- this.lastLandscape = undefined;
- this.mapData = undefined;
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip;
- }
-
- onMapChange(mapData)
- {
- this.mapData = mapData;
-
- if (mapData && mapData.settings && mapData.settings.Landscapes)
- {
- let randomItems = [];
- for (let item of this.RandomItems)
- if (item.Id == "random" || mapData.settings.Landscapes.land && mapData.settings.Landscapes.naval)
- randomItems.push({
- "Id": item.Id,
- "Name": setStringTags(item.Name, this.RandomItemTags),
- "Description": item.Description,
- "Preview": mapData.settings.Preview || this.mapCache.DefaultPreview
- });
-
- let sort = (item1, item2) => item1.Name > item2.Name;
-
- this.values = prepareForDropdown([
- ...randomItems,
- ...mapData.settings.Landscapes.land.sort(sort),
- ...mapData.settings.Landscapes.naval.sort(sort)
- ]);
-
- this.dropdown.list = this.values.Name;
- this.dropdown.list_data = this.values.Id;
- }
- else
- this.values = undefined;
-
- this.lastLandscape = undefined;
-
- this.setHidden(!this.values);
- }
-
- onGameAttributesChange()
- {
- if (this.values)
- {
- if (this.values.Id.indexOf(g_GameAttributes.settings.Landscape || undefined) == -1)
- {
- g_GameAttributes.settings.Landscape = "random";
- this.gameSettingsControl.updateGameAttributes();
- }
-
- if (this.lastLandscape != g_GameAttributes.settings.Landscape)
- {
- g_GameAttributes.settings.Preview = this.values.Preview[this.values.Id.indexOf(g_GameAttributes.settings.Landscape)];
- this.lastLandscape = g_GameAttributes.settings.Biome;
- }
- }
- else if (g_GameAttributes.settings.Landscape !== undefined)
- {
- delete g_GameAttributes.settings.Landscape;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (g_GameAttributes.settings.Landscape)
- this.setSelectedValue(g_GameAttributes.settings.Landscape);
- }
-
- getAutocompleteEntries()
- {
- return this.values.Name;
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.Landscape = this.values.Id[itemIdx];
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- onPickRandomItems()
- {
- if (!this.mapData)
- return;
-
- let items;
- let landscapes = this.mapData.settings.Landscapes;
-
- switch (g_GameAttributes.settings.Landscape || undefined)
- {
- case "random":
- items = [...landscapes.land, ...landscapes.naval];
- break;
- case "random_land":
- items = landscapes.land;
- break;
- case "random_naval":
- items = landscapes.naval;
- break;
- default:
- return;
- }
-
- g_GameAttributes.settings.Landscape = pickRandom(items).Id;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.pickRandomItems();
- }
-};
-
-GameSettingControls.Landscape.prototype.TitleCaption =
- translate("Landscape");
-
-GameSettingControls.Landscape.prototype.Tooltip =
- translate("Select one of the landscapes of this map.");
-
-GameSettingControls.Landscape.prototype.RandomItems =
-[
- {
- "Id": "random",
- "Name": translateWithContext("landscape selection", "Random Land or Naval"),
- "Description": translateWithContext("landscape selection", "Select a random land or naval map generation.")
- },
- {
- "Id": "random_land",
- "Name": translateWithContext("landscape selection", "Random Land"),
- "Description": translateWithContext("landscape selection", "Select a random land map generation.")
- },
- {
- "Id": "random_naval",
- "Name": translateWithContext("landscape selection", "Random Naval"),
- "Description": translateWithContext("landscape selection", "Select a random naval map generation.")
- }
-];
-
-GameSettingControls.Landscape.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Landscape.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Biome.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Biome.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Biome.js (nonexistent)
@@ -1,149 +0,0 @@
-GameSettingControls.Biome = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = undefined;
- this.biomeValues = undefined;
-
- this.lastBiome = undefined;
-
- this.randomItem = {
- "Id": this.RandomBiomeId,
- "Title": setStringTags(this.RandomBiome, this.RandomItemTags),
- "Autocomplete": this.RandomBiome,
- "Description": this.RandomDescription
- };
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip =
- this.values && this.values.Description && this.values.Description[this.dropdown.hovered] ||
- this.Tooltip;
- }
-
- onMapChange(mapData)
- {
- let available = g_GameAttributes.mapType == "random" &&
- mapData && mapData.settings && mapData.settings.SupportedBiomes || undefined;
-
- this.setHidden(!available);
-
- if (available)
- {
- Engine.ProfileStart("updateBiomeList");
- this.biomeValues =
- g_Settings.Biomes.filter(this.filterBiome(available)).map(this.createBiomeItem);
-
- this.values = prepareForDropdown([
- this.randomItem,
- ...this.biomeValues
- ]);
-
- this.dropdown.list = this.values.Title;
- this.dropdown.list_data = this.values.Id;
- Engine.ProfileStop();
- }
- else
- this.values = undefined;
-
- this.lastBiome = undefined;
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.mapType || !g_GameAttributes.map)
- return;
-
- if (this.values)
- {
- if (this.values.Id.indexOf(g_GameAttributes.settings.Biome || undefined) == -1)
- {
- g_GameAttributes.settings.Biome = this.RandomBiomeId;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- if (this.lastBiome != g_GameAttributes.settings.Biome)
- {
- let biomePreviewFile =
- basename(g_GameAttributes.map) + "_" +
- basename(g_GameAttributes.settings.Biome || "") + ".png";
-
- if (Engine.TextureExists(this.mapCache.TexturesPath + this.mapCache.PreviewsPath + biomePreviewFile))
- g_GameAttributes.settings.Preview = biomePreviewFile;
-
- this.lastBiome = g_GameAttributes.settings.Biome;
- }
- }
- else if (g_GameAttributes.settings.Biome)
- {
- delete g_GameAttributes.settings.Biome;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (this.values)
- this.setSelectedValue(g_GameAttributes.settings.Biome);
- }
-
- filterBiome(available)
- {
- if (typeof available == "string")
- return biome => biome.Id.startsWith(available);
-
- return biome => available.indexOf(biome.Id) != -1;
- }
-
- createBiomeItem(biome)
- {
- return {
- "Id": biome.Id,
- "Title": biome.Title,
- "Autocomplete": biome.Title,
- "Description": biome.Description
- };
- }
-
- getAutocompleteEntries()
- {
- return this.values && this.values.Autocomplete;
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.Biome = this.values.Id[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- onPickRandomItems()
- {
- if (this.values && g_GameAttributes.settings.Biome == this.RandomBiomeId)
- {
- g_GameAttributes.settings.Biome = pickRandom(this.biomeValues).Id;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.pickRandomItems();
- }
- }
-};
-
-GameSettingControls.Biome.prototype.TitleCaption =
- translate("Biome");
-
-GameSettingControls.Biome.prototype.RandomBiomeId =
- "random";
-
-GameSettingControls.Biome.prototype.Tooltip =
- translate("Select the flora and fauna.");
-
-GameSettingControls.Biome.prototype.RandomBiome =
- translateWithContext("biome", "Random");
-
-GameSettingControls.Biome.prototype.RandomDescription =
- translate("Pick a biome at random.");
-
-GameSettingControls.Biome.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Biome.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Daytime.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Daytime.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Daytime.js (nonexistent)
@@ -1,107 +0,0 @@
-GameSettingControls.Daytime = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = undefined;
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip;
- }
-
- onMapChange(mapData)
- {
- if (mapData && mapData.settings && mapData.settings.Daytime)
- {
- this.values = prepareForDropdown([
- {
- "Id": "random",
- "Name": setStringTags(this.RandomTitle, this.RandomItemTags),
- "Description": this.RandomDescription,
- "Preview": mapData.settings.Preview
- },
- ...mapData.settings.Daytime
- ]);
-
- this.dropdown.list = this.values.Name;
- this.dropdown.list_data = this.values.Id;
- }
- else
- this.values = undefined;
-
- this.setHidden(!this.values);
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.map)
- return;
-
- if (this.values)
- {
- if (this.values.Id.indexOf(g_GameAttributes.settings.Daytime || undefined) == -1)
- {
- g_GameAttributes.settings.Daytime = "random";
- this.gameSettingsControl.updateGameAttributes();
- }
-
- let preview = this.values.Preview[this.values.Id.indexOf(g_GameAttributes.settings.Daytime)];
- if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != preview)
- {
- g_GameAttributes.settings.Preview = preview;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (g_GameAttributes.settings.Daytime !== undefined)
- {
- delete g_GameAttributes.settings.Daytime;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (g_GameAttributes.settings.Daytime)
- this.setSelectedValue(g_GameAttributes.settings.Daytime);
- }
-
- getAutocompleteEntries()
- {
- return this.values.Name;
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.Daytime = this.values.Id[itemIdx];
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- onPickRandomItems()
- {
- if (this.values && g_GameAttributes.settings.Daytime == "random")
- {
- g_GameAttributes.settings.Daytime = pickRandom(this.values.Id.slice(1));
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.pickRandomItems();
- }
- }
-};
-
-GameSettingControls.Daytime.prototype.TitleCaption =
- translate("Daytime");
-
-GameSettingControls.Daytime.prototype.Tooltip =
- translate("Select whether the match takes place at daylight or night.");
-
-GameSettingControls.Daytime.prototype.RandomTitle =
- translateWithContext("daytime selection", "Random");
-
-GameSettingControls.Daytime.prototype.RandomDescription =
- translateWithContext("daytime selection", "Randomly pick a time of the day.");
-
-GameSettingControls.Daytime.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Dropdowns/Daytime.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Seed.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Seed.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Seed.js (nonexistent)
@@ -1,12 +0,0 @@
-GameSettingControls.Seed = class extends GameSettingControl
-{
- onGameAttributesFinalize()
- {
- // The matchID is used for identifying rated game reports for the lobby and possibly when sharing replays.
- g_GameAttributes.matchID = Engine.GetMatchID();
-
- // Seed is used for map generation and simulation.
- g_GameAttributes.settings.Seed = randIntExclusive(0, Math.pow(2, 32));
- g_GameAttributes.settings.AISeed = randIntExclusive(0, Math.pow(2, 32));
- }
-};
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/Single/Seed.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml (nonexistent)
@@ -1,55 +0,0 @@
-
-
-
-
-
- Player Name
-
-
-
- Color
-
-
-
- Player Placement
-
-
-
- Civilization
-
-
-
-
-
-
- Team
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayersPanel.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js (nonexistent)
@@ -1,269 +0,0 @@
-PlayerSettingControls.PlayerAssignment = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.clientItemFactory = new PlayerAssignmentItem.Client();
- this.aiItemFactory = new PlayerAssignmentItem.AI();
- this.unassignedItem = new PlayerAssignmentItem.Unassigned().createItem();
-
- this.aiItems =
- g_Settings.AIDescriptions.filter(ai => !ai.data.hidden).map(
- this.aiItemFactory.createItem.bind(this.aiItemFactory));
-
- this.values = undefined;
- this.assignedGUID = undefined;
- this.fixedAI = undefined;
-
- this.playerAssignmentsControl.registerClientJoinHandler(this.onClientJoin.bind(this));
- }
-
- setControl()
- {
- this.dropdown = Engine.GetGUIObjectByName("playerAssignment[" + this.playerIndex + "]");
- this.label = Engine.GetGUIObjectByName("playerAssignmentText[" + this.playerIndex + "]");
- }
-
- onLoad(initData, hotloadData)
- {
- if (!hotloadData && !g_IsNetworked)
- this.onClientJoin("local", g_PlayerAssignments);
- }
-
- onClientJoin(newGUID, newAssignments)
- {
- if (!g_IsController || this.fixedAI || newAssignments[newGUID].player != -1)
- return;
-
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- // Assign the client (or only buddies if prefered) to a free slot
- if (newGUID != Engine.GetPlayerGUID())
- {
- let assignOption = Engine.ConfigDB_GetValue("user", this.ConfigAssignPlayers);
- if (assignOption == "disabled" ||
- assignOption == "buddies" && g_Buddies.indexOf(splitRatingFromNick(newAssignments[newGUID].name).nick) == -1)
- return;
- }
-
- for (let guid in newAssignments)
- if (newAssignments[guid].player == this.playerIndex + 1)
- return;
-
- if (pData.AI)
- {
- pData.AI = false;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- newAssignments[newGUID].player = this.playerIndex + 1;
- this.playerAssignmentsControl.assignClient(newGUID, this.playerIndex + 1);
- }
-
- onPlayerAssignmentsChange()
- {
- this.assignedGUID = undefined;
- for (let guid in g_PlayerAssignments)
- if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
- {
- this.assignedGUID = guid;
- break;
- }
-
- this.playerItems = sortGUIDsByPlayerID().map(
- this.clientItemFactory.createItem.bind(this.clientItemFactory));
-
- this.rebuildList();
- this.updateSelection();
- }
-
- onMapChange(mapData)
- {
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- this.fixedAI = mapPData && mapPData.AI || undefined;
- }
-
- onGameAttributesChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- if (this.fixedAI && pData.AI != this.fixedAI)
- {
- pData.AI = this.fixedAI;
- this.gameSettingsControl.updateGameAttributes();
- this.playerAssignmentsControl.unassignClient(this.playerIndex + 1);
- }
- }
-
- onGameAttributesBatchChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- this.setEnabled(!this.fixedAI);
- this.updateSelection();
- }
-
- updateSelection()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (pData && this.values)
- this.setSelectedValue(
- this.values.Value.findIndex((value, i) =>
- this.values.Handler[i].isSelected(pData, this.assignedGUID, value)));
- }
-
- rebuildList()
- {
- Engine.ProfileStart("updatePlayerAssignmentsList");
- this.values = prepareForDropdown([
- ...this.playerItems,
- ...this.aiItems,
- this.unassignedItem
- ]);
-
- this.dropdown.list = this.values.Caption;
- this.dropdown.list_data = this.values.Value.map((value, i) => i);
- Engine.ProfileStop();
- }
-
- onSelectionChange(itemIdx)
- {
- this.values.Handler[itemIdx].onSelectionChange(
- this.gameSettingsControl,
- this.playerAssignmentsControl,
- this.playerIndex,
- this.values.Value[itemIdx]);
- }
-
- getAutocompleteEntries()
- {
- return this.values.Autocomplete;
- }
-};
-
-PlayerSettingControls.PlayerAssignment.prototype.Tooltip =
- translate("Select player.");
-
-PlayerSettingControls.PlayerAssignment.prototype.AutocompleteOrder = 100;
-
-PlayerSettingControls.PlayerAssignment.prototype.ConfigAssignPlayers =
- "gui.gamesetup.assignplayers";
-
-class PlayerAssignmentItem
-{
-}
-
-{
- PlayerAssignmentItem.Client = class
- {
- createItem(guid)
- {
- return {
- "Handler": this,
- "Value": guid,
- "Autocomplete": g_PlayerAssignments[guid].name,
- "Caption": setStringTags(
- g_PlayerAssignments[guid].name,
- g_PlayerAssignments[guid].player == -1 ? this.ObserverTags : this.PlayerTags)
- };
- }
-
- onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex, guidToAssign)
- {
- let sourcePlayer = g_PlayerAssignments[guidToAssign].player - 1;
- playerAssignmentsControl.assignPlayer(guidToAssign, playerIndex);
- gameSettingsControl.assignPlayer(sourcePlayer, playerIndex);
- }
-
- isSelected(pData, guid, value)
- {
- return guid !== undefined && guid == value;
- }
- };
-
- PlayerAssignmentItem.Client.prototype.PlayerTags =
- { "color": "white" };
-
- PlayerAssignmentItem.Client.prototype.ObserverTags =
- { "color": "170 170 250" };
-}
-
-{
- PlayerAssignmentItem.AI = class
- {
- createItem(ai)
- {
- let aiName = translate(ai.data.name);
- return {
- "Handler": this,
- "Value": ai.id,
- "Autocomplete": aiName,
- "Caption": setStringTags(sprintf(this.Label, { "ai": aiName }), this.Tags)
- };
- }
-
- onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex, value)
- {
- playerAssignmentsControl.unassignClient(playerIndex + 1);
-
- g_GameAttributes.settings.PlayerData[playerIndex].AI = value;
-
- gameSettingsControl.updateGameAttributes();
- gameSettingsControl.setNetworkGameAttributes();
- }
-
- isSelected(pData, guid, value)
- {
- return !guid && pData.AI && pData.AI == value;
- }
- };
-
- PlayerAssignmentItem.AI.prototype.Label =
- translate("AI: %(ai)s");
-
- PlayerAssignmentItem.AI.prototype.Tags =
- { "color": "70 150 70" };
-}
-
-{
- PlayerAssignmentItem.Unassigned = class
- {
- createItem()
- {
- return {
- "Handler": this,
- "Value": undefined,
- "Autocomplete": this.Label,
- "Caption": setStringTags(this.Label, this.Tags)
- };
- }
-
- onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex)
- {
- playerAssignmentsControl.unassignClient(playerIndex + 1);
-
- g_GameAttributes.settings.PlayerData[playerIndex].AI = false;
- gameSettingsControl.updateGameAttributes();
- gameSettingsControl.setNetworkGameAttributes();
- }
-
- isSelected(pData, guid, value)
- {
- return !guid && !pData.AI;
- }
- };
-
- PlayerAssignmentItem.Unassigned.prototype.Label =
- translate("Unassigned");
-
- PlayerAssignmentItem.Unassigned.prototype.Tags =
- { "color": "140 140 140" };
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerColor.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerColor.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerColor.js (nonexistent)
@@ -1,175 +0,0 @@
-PlayerSettingControls.PlayerColor = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.defaultColors = g_Settings.PlayerDefaults.slice(1).map(pData => pData.Color);
- }
-
- setControl()
- {
- this.dropdown = Engine.GetGUIObjectByName("playerColor[" + this.playerIndex + "]");
- this.playerBackgroundColor = Engine.GetGUIObjectByName("playerBackgroundColor[" + this.playerIndex + "]");
- this.playerColorHeading = Engine.GetGUIObjectByName("playerColorHeading");
- }
-
- onMapChange(mapData)
- {
- Engine.ProfileStart("updatePlayerColorList");
- let hidden = !g_IsController || g_GameAttributes.mapType == "scenario";
- this.dropdown.hidden = hidden;
- this.playerColorHeading.hidden = hidden;
-
- // Step 1: Pick colors that the map specifies, add most unsimilar default colors
- // Provide the access to g_MaxPlayers different colors, regardless of current playercount.
- let values = [];
- for (let i = 0; i < g_MaxPlayers; ++i)
- {
- let pData = this.gameSettingsControl.getPlayerData(mapData, i);
- values.push(pData && pData.Color || this.findFarthestUnusedColor(values));
- }
-
- // Step 2: Sort these colors so that the order is most reminiscent of the default colors
- this.values = [];
- for (let i = 0; i < g_MaxPlayers; ++i)
- {
- let closestColor;
- let smallestDistance = Infinity;
- for (let color of values)
- {
- if (this.values.some(col => sameColor(col, color)))
- continue;
-
- let distance = colorDistance(color, this.defaultColors[i]);
- if (distance <= smallestDistance)
- {
- closestColor = color;
- smallestDistance = distance;
- }
- }
- this.values.push(closestColor);
- }
-
- this.dropdown.list = this.values.map(color => coloredText(this.ColorIcon, rgbToGuiColor(color)));
- this.dropdown.list_data = this.values.map((color, i) => i);
-
- // If the map specified a color for this slot, use that
- let mapPlayerData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- let playerData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
-
- if (playerData && mapPlayerData && mapPlayerData.Color &&
- (!playerData.Color || !sameColor(playerData.Color, mapPlayerData.Color)))
- {
- playerData.Color = mapPlayerData.Color;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- Engine.ProfileStop();
- }
-
- onGameAttributesChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData || !this.values)
- return;
-
- let inUse =
- pData.Color &&
- g_GameAttributes.settings.PlayerData.some((otherPData, i) =>
- i < this.playerIndex &&
- otherPData.Color &&
- sameColor(pData.Color, otherPData.Color));
-
- if (!pData.Color || this.values.indexOf(pData.Color) == -1 || inUse)
- {
- pData.Color =
- (pData.Color && !inUse) ?
- this.findClosestColor(pData.Color, this.values) :
- this.getUnusedColor();
-
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData || !this.values)
- return;
-
- this.setSelectedValue(this.values.indexOf(pData.Color));
- this.playerBackgroundColor.sprite = "color:" + rgbToGuiColor(pData.Color, 100);
- }
-
- onAssignPlayer(source, target)
- {
- if (g_GameAttributes.mapType != "scenario" && source && target)
- [source.Color, target.Color] = [target.Color, source.Color];
- }
-
- onSelectionChange(itemIdx)
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
-
- // If someone else has that color, give that player the old color
- let otherPData = g_GameAttributes.settings.PlayerData.find(data =>
- sameColor(this.values[itemIdx], data.Color));
-
- if (otherPData)
- otherPData.Color = pData.Color;
-
- pData.Color = this.values[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- findClosestColor(targetColor, colors)
- {
- let colorDistances = colors.map(color => colorDistance(color, targetColor));
-
- let smallestDistance = colorDistances.find(
- distance => colorDistances.every(distance2 => distance2 >= distance));
-
- return colors.find(color => colorDistance(color, targetColor) == smallestDistance);
- }
-
- findFarthestUnusedColor(values)
- {
- let farthestColor;
- let farthestDistance = 0;
-
- for (let defaultColor of this.defaultColors)
- {
- let smallestDistance = Infinity;
- for (let usedColor of values)
- {
- let distance = colorDistance(usedColor, defaultColor);
- if (distance < smallestDistance)
- smallestDistance = distance;
- }
-
- if (smallestDistance >= farthestDistance)
- {
- farthestColor = defaultColor;
- farthestDistance = smallestDistance;
- }
- }
- return farthestColor;
- }
-
- getUnusedColor()
- {
- return this.values.find(color =>
- g_GameAttributes &&
- g_GameAttributes.settings &&
- g_GameAttributes.settings.PlayerData &&
- g_GameAttributes.settings.PlayerData.every(pData => !pData.Color || !sameColor(color, pData.Color)));
- }
-};
-
-PlayerSettingControls.PlayerColor.prototype.Tooltip =
- translate("Pick a color.");
-
-PlayerSettingControls.PlayerColor.prototype.ColorIcon =
- "â– ";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerColor.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js (nonexistent)
@@ -1,142 +0,0 @@
-PlayerSettingControls.PlayerCiv = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.fixedCiv = undefined;
- this.values = prepareForDropdown(this.getItems());
-
- this.dropdown.list = this.values.name;
- this.dropdown.list_data = this.values.civ;
- }
-
- setControl()
- {
- this.label = Engine.GetGUIObjectByName("playerCivText[" + this.playerIndex + "]");
- this.dropdown = Engine.GetGUIObjectByName("playerCiv[" + this.playerIndex + "]");
- }
-
- onHoverChange()
- {
- this.dropdown.tooltip = this.values && this.values.tooltip[this.dropdown.hovered] || this.Tooltip;
- }
-
- onMapChange(mapData)
- {
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- this.fixedCiv = mapPData && mapPData.Civ || undefined;
- }
-
- onAssignPlayer(source, target)
- {
- if (g_GameAttributes.mapType != "scenario" && source && target)
- [source.Civ, target.Civ] = [target.Civ, source.Civ];
- }
-
- onGameAttributesChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData || !g_GameAttributes.mapType)
- return;
-
- if (this.fixedCiv)
- {
- if (!pData.Civ || this.fixedCiv != pData.Civ)
- {
- pData.Civ = this.fixedCiv;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (this.values.civ.indexOf(pData.Civ || undefined) == -1)
- {
- pData.Civ =
- g_GameAttributes.mapType == "scenario" ?
- g_Settings.PlayerDefaults[this.playerIndex + 1].Civ :
- this.RandomCivId;
-
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData || !g_GameAttributes.mapType)
- return;
-
- this.setEnabled(!this.fixedCiv);
- this.setSelectedValue(pData.Civ);
- }
-
- getItems()
- {
- let values = [];
-
- for (let civ in g_CivData)
- if (g_CivData[civ].SelectableInGameSetup)
- values.push({
- "name": g_CivData[civ].Name,
- "autocomplete": g_CivData[civ].Name,
- "tooltip": g_CivData[civ].History,
- "civ": civ
- });
-
- values.sort(sortNameIgnoreCase);
-
- values.unshift({
- "name": setStringTags(this.RandomCivCaption, this.RandomItemTags),
- "autocomplete": this.RandomCivCaption,
- "tooltip": this.RandomCivTooltip,
- "civ": this.RandomCivId
- });
-
- return values;
- }
-
- getAutocompleteEntries()
- {
- return this.values.autocomplete;
- }
-
- onSelectionChange(itemIdx)
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- pData.Civ = this.values.civ[itemIdx];
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- onPickRandomItems()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData || pData.Civ != this.RandomCivId)
- return;
-
- // Get a unique array of selectable cultures
- let cultures = Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup).map(civ => g_CivData[civ].Culture);
- cultures = cultures.filter((culture, index) => cultures.indexOf(culture) === index);
-
- // Pick a random civ of a random culture
- let culture = pickRandom(cultures);
- pData.Civ = pickRandom(Object.keys(g_CivData).filter(civ =>
- g_CivData[civ].Culture == culture && g_CivData[civ].SelectableInGameSetup));
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.pickRandomItems();
- }
-};
-
-PlayerSettingControls.PlayerCiv.prototype.Tooltip =
- translate("Choose the civilization for this player.");
-
-PlayerSettingControls.PlayerCiv.prototype.RandomCivCaption =
- translateWithContext("civilization", "Random");
-
-PlayerSettingControls.PlayerCiv.prototype.RandomCivId =
- "random";
-
-PlayerSettingControls.PlayerCiv.prototype.RandomCivTooltip =
- translate("Picks one civilization at random when the game starts.");
-
-PlayerSettingControls.PlayerCiv.prototype.AutocompleteOrder = 90;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js (nonexistent)
@@ -1,78 +0,0 @@
-PlayerSettingControls.PlayerTeam = class extends GameSettingControlDropdown
-{
- constructor(...args)
- {
- super(...args);
-
- this.values = prepareForDropdown([
- {
- "label": this.NoTeam,
- "id": this.NoTeamId
- },
- ...Array.from(
- new Array(g_MaxTeams),
- (v, i) => ({
- "label": i + 1,
- "id": i
- }))
- ]);
- this.dropdown.list = this.values.label;
- this.dropdown.list_data = this.values.id;
- }
-
- setControl()
- {
- this.label = Engine.GetGUIObjectByName("playerTeamText[" + this.playerIndex + "]");
- this.dropdown = Engine.GetGUIObjectByName("playerTeam[" + this.playerIndex + "]");
- }
-
- onMapChange(mapData)
- {
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
-
- if (pData && mapPData && mapPData.Team !== undefined)
- {
- pData.Team = mapPData.Team;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- if (pData.Team === undefined)
- {
- pData.Team = this.NoTeamId;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- this.setEnabled(g_GameAttributes.mapType != "scenario");
- this.setSelectedValue(pData.Team);
- }
-
- onSelectionChange(itemIdx)
- {
- g_GameAttributes.settings.PlayerData[this.playerIndex].Team = itemIdx - 1;
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-PlayerSettingControls.PlayerTeam.prototype.Tooltip =
- translate("Select player's team.");
-
-PlayerSettingControls.PlayerTeam.prototype.NoTeam =
- translateWithContext("team", "None");
-
-PlayerSettingControls.PlayerTeam.prototype.NoTeamId = -1;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerFrame.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerFrame.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerFrame.js (nonexistent)
@@ -1,23 +0,0 @@
-PlayerSettingControls.PlayerFrame = class extends GameSettingControl
-{
- constructor(...args)
- {
- super(...args);
-
- this.playerFrame = Engine.GetGUIObjectByName("playerFrame[" + this.playerIndex + "]");
-
- {
- let size = this.playerFrame.size;
- size.top = this.Height * this.playerIndex;
- size.bottom = this.Height * (this.playerIndex + 1);
- this.playerFrame.size = size;
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.playerFrame.hidden = !this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- }
-}
-
-PlayerSettingControls.PlayerFrame.prototype.Height = 32;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerFrame.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/AIConfigButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/AIConfigButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/AIConfigButton.js (nonexistent)
@@ -1,188 +0,0 @@
-PlayerSettingControls.AIConfigButton = class extends GameSettingControl
-{
- constructor(...args)
- {
- super(...args);
-
- this.playerConfig = Engine.GetGUIObjectByName("playerConfig[" + this.playerIndex + "]");
-
- this.isPageOpen = false;
- this.guid = undefined;
- this.fixedAI = undefined;
-
- this.defaultAIDiff = +Engine.ConfigDB_GetValue("user", this.ConfigDifficulty);
- this.defaultBehavior = Engine.ConfigDB_GetValue("user", this.ConfigBehavior);
-
- // Save little performance by not reallocating every call
- this.sprintfArgs = {};
-
- this.playerConfig.onPress = this.openConfigPage.bind(this, this.playerIndex);
- }
-
- onMapChange(mapData)
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- let isScenario = g_GameAttributes.mapType == "scenario";
-
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- if (mapPData && mapPData.AI)
- {
- let defaultPData = g_Settings.PlayerDefaults[this.playerIndex + 1];
-
- this.fixedAI = {
- "AI": mapPData.AI,
- "AIDiff":
- mapPData.AIDiff !== undefined ?
- mapPData.AIDiff :
- defaultPData.AIDiff,
- "AIBehavior":
- mapPData.AIBehavior !== undefined ?
- mapPData.AIBehavior :
- defaultPData.AIBehavior
- };
- }
- else
- this.fixedAI = undefined;
- }
-
- onAssignPlayer(source, target)
- {
- if (source && target.AI)
- {
- source.AI = target.AI;
- source.AIDiff = target.AIDiff;
- source.AIBehavior = target.AIBehavior;
- }
-
- target.AI = false;
- delete target.AIDiff;
- delete target.AIBehavior;
- }
-
- onPlayerAssignmentsChange()
- {
- this.guid = undefined;
-
- for (let guid in g_PlayerAssignments)
- if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
- this.guid = guid;
- }
-
- onGameAttributesChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- // Enforce map specified AI
- if (this.fixedAI &&
- (pData.AI !== this.fixedAI.AI ||
- pData.AIDiff !== this.fixedAI.AIDiff ||
- pData.AIBehavior !== this.fixedAI.AIBehavior))
- {
- pData.AI = this.fixedAI.AI;
- pData.AIDiff = this.fixedAI.AIDiff;
- pData.AIBehavior = this.fixedAI.AIBehavior;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- // Sanitize, make AI state self-consistent
- if (pData.AI)
- {
- if (pData.AIDiff === undefined || pData.AIBehavior === undefined)
- {
- if (pData.AIDiff === undefined)
- pData.AIDiff = this.defaultAIDiff;
-
- if (pData.AIBehavior === undefined)
- pData.AIBehavior = this.defaultBehavior;
-
- this.gameSettingsControl.updateGameAttributes();
- }
- }
- else if (pData.AI === undefined)
- {
- if (this.guid)
- pData.AI = false;
- else
- {
- pData.AI = g_Settings.PlayerDefaults[this.playerIndex + 1].AI;
- pData.AIDiff = this.defaultAIDiff;
- pData.AIBehavior = this.defaultBehavior;
- }
- this.gameSettingsControl.updateGameAttributes();
- }
- else if (pData.AIBehavior !== undefined || pData.AIDiff !== undefined)
- {
- pData.AI = false;
- delete pData.AIBehavior;
- delete pData.AIDiff;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- let isPageOpen = this.isPageOpen;
- if (isPageOpen)
- Engine.PopGuiPage();
-
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- this.sprintfArgs.description = translateAISettings(pData);
- this.playerConfig.tooltip = sprintf(this.Tooltip, this.sprintfArgs);
- this.playerConfig.hidden = !pData.AI;
-
- if (isPageOpen)
- this.openConfigPage();
- }
-
- openConfigPage()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData || !pData.AI)
- return;
-
- this.isPageOpen = true;
- Engine.PushGuiPage(
- "page_aiconfig.xml",
- {
- "playerSlot": this.playerIndex,
- "id": pData.AI,
- "difficulty": pData.AIDiff,
- "behavior": pData.AIBehavior,
- "fixed": !!this.fixedAI
- },
- this.onConfigPageClosed.bind(this));
- }
-
- onConfigPageClosed(data)
- {
- this.isPageOpen = false;
-
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!data || !data.save || !g_IsController || !pData)
- return;
-
- pData.AI = data.id;
- pData.AIDiff = data.difficulty;
- pData.AIBehavior = data.behavior;
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-};
-
-PlayerSettingControls.AIConfigButton.prototype.Tooltip =
- translate("Configure AI: %(description)s.");
-
-PlayerSettingControls.AIConfigButton.prototype.ConfigDifficulty =
- "gui.gamesetup.aidifficulty";
-
-PlayerSettingControls.AIConfigButton.prototype.ConfigBehavior =
- "gui.gamesetup.aibehavior";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/AIConfigButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js (nonexistent)
@@ -1,129 +0,0 @@
-// TODO: There should be an indication which player is not ready yet
-// The color does not indicate it's meaning and is insufficient to inform many players.
-PlayerSettingControls.PlayerName = class extends GameSettingControl
-{
- constructor(...args)
- {
- super(...args);
-
- this.playerName = Engine.GetGUIObjectByName("playerName[" + this.playerIndex + "]");
-
- this.displayedName = undefined;
- this.guid = undefined;
- }
-
- onMapChange(mapData)
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- pData.Name = mapPData && mapPData.Name || g_Settings.PlayerDefaults[this.playerIndex + 1].Name;
- this.gameSettingsControl.updateGameAttributes();
- }
-
- onGameAttributesChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- if (!pData.Name)
- {
- pData.Name = g_Settings.PlayerDefaults[this.playerIndex + 1].Name;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- this.displayedName = g_IsNetworked ? pData.Name : translate(pData.Name);
- this.rebuild();
- }
-
- onPlayerAssignmentsChange()
- {
- this.guid = undefined;
-
- for (let guid in g_PlayerAssignments)
- if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
- {
- this.guid = guid;
- break;
- }
-
- this.rebuild();
- }
-
- rebuild()
- {
- let name = this.displayedName;
- if (!name)
- return;
-
- if (g_IsNetworked)
- {
- let status = this.guid ? g_PlayerAssignments[this.guid].status : this.ReadyTags.length - 1;
- name = setStringTags(this.displayedName, this.ReadyTags[status]);
- }
-
- this.playerName.caption = name;
- }
-
- onGameAttributesFinalize()
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- if (g_GameAttributes.mapType != "scenario" && pData.AI)
- {
- // Pick one of the available botnames for the chosen civ
- // Determine botnames
- let chosenName = pickRandom(g_CivData[pData.Civ].AINames);
-
- if (!g_IsNetworked)
- chosenName = translate(chosenName);
-
- // Count how many players use the chosenName
- let usedName = g_GameAttributes.settings.PlayerData.filter(otherPData =>
- otherPData.Name && otherPData.Name.indexOf(chosenName) !== -1).length;
-
- pData.Name =
- usedName ?
- sprintf(this.RomanLabel, {
- "playerName": chosenName,
- "romanNumber": this.RomanNumbers[usedName + 1]
- }) :
- chosenName;
- }
- else
- // Copy client playernames so they appear in replays
- for (let guid in g_PlayerAssignments)
- if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
- pData.Name = g_PlayerAssignments[guid].name;
- }
-};
-
-PlayerSettingControls.PlayerName.prototype.RomanLabel =
- translate("%(playerName)s %(romanNumber)s");
-
-PlayerSettingControls.PlayerName.prototype.RomanNumbers =
- [undefined, "I", "II", "III", "IV", "V", "VI", "VII", "VIII"];
-
-PlayerSettingControls.PlayerName.prototype.ReadyTags = [
- {
- "color": "white",
- },
- {
- "color": "green",
- },
- {
- "color": "150 150 250",
- }
-];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerName.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerSettings.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerSettings.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerSettings.js (nonexistent)
@@ -1,45 +0,0 @@
-// TODO: There should be a dialog allowing to specify starting resources and population capacity per player
-PlayerSettingControls.PlayerSettings = class extends GameSettingControl
-{
- onMapChange(mapData)
- {
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- if (!pData)
- return;
-
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- let isScenario = mapPData && g_GameAttributes.mapType == "scenario";
-
- if (isScenario && mapPData.Resources)
- pData.Resources = mapPData.Resources;
- else
- delete pData.Resources;
-
- if (isScenario && mapPData.PopulationLimit)
- pData.PopulationLimit = mapPData.PopulationLimit;
- else
- delete pData.PopulationLimit;
- }
-
- onGameAttributesFinalize()
- {
- // Copy map well known properties (and only well known properties)
- let mapData = this.mapCache.getMapData(g_GameAttributes.mapType, g_GameAttributes.map);
-
- let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
- let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
- if (!pData || !mapPData)
- return;
-
- for (let property of this.MapSettings)
- if (mapPData[property] !== undefined)
- pData[property] = mapPData[property];
- }
-};
-
-PlayerSettingControls.PlayerSettings.prototype.MapSettings = [
- "StartingTechnologies",
- "DisabledTechnologies",
- "DisabledTemplates",
- "StartingCamera"
-];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/PerPlayer/PlayerSettings.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControl.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControl.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControl.js (nonexistent)
@@ -1,178 +0,0 @@
-/**
- * The GameSettingControl is an abstract class that is inherited by gamesetting control classes specific to a GUI object type,
- * such as the GameSettingControlCheckbox or GameSettingControlDropdown.
- *
- * These classes are abstract classes too and are implemented by each handler class specific to one logical setting of g_GameAttributes.
- * The purpose of these classes is to control precisely one logical setting of g_GameAttributes.
- * Having one class per logical setting allows to handle each setting without making a restriction as to how the property should be written to g_GameAttributes or g_PlayerAssignments.
- * The base classes allow implementing that while avoiding duplication.
- *
- * A GameSettingControl may depend on and read from other g_GameAttribute values,
- * but the class instance is to be the sole instance writing to its setting value in g_GameAttributes and
- * shall not write to setting values of other logical settings.
- *
- * The derived classes shall not make assumptions on the validity of g_GameAttributes,
- * sanitize or delete their value if it is incompatible.
- *
- * A class should only write values to g_GameAttributes that it itself has confirmed to be accurate.
- * This means that handlers may not copy an entire object or array of values, for example on mapchange.
- * This avoids writing a setting value to g_GameAttributes that is not tracked and deleted when it becomes invalid.
- *
- * Since GameSettingControls shall be able to subscribe to g_GameAttributes changes,
- * it is an obligation of the derived GameSettingControl class to broadcast the GameAttributesChange event each time it changes g_GameAttributes.
- */
-class GameSettingControl
-{
- // The constructor and inherited constructors shall not modify game attributes,
- // since all GameSettingControl shall be able to subscribe to any gamesetting change.
- constructor(gameSettingControlManager, category, playerIndex, gamesetupPage, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl)
- {
- // Store arguments
- {
- this.category = category;
- if (playerIndex !== undefined)
- this.playerIndex = playerIndex;
- this.gamesetupPage = gamesetupPage;
- this.gameSettingsControl = gameSettingsControl;
- this.mapCache = mapCache;
- this.mapFilters = mapFilters;
- this.netMessages = netMessages;
- this.playerAssignmentsControl = playerAssignmentsControl;
- }
-
- // enabled and hidden should only be modified through their setters or
- // by calling updateVisibility after modification.
- this.enabled = true;
- this.hidden = false;
-
- if (this.setControl)
- this.setControl(gameSettingControlManager);
-
- // This variable also used for autocompleting chat.
- this.autocompleteTitle = undefined;
-
- if (this.title && this.TitleCaption)
- this.setTitle(this.TitleCaption);
-
- if (this.Tooltip)
- this.setTooltip(this.Tooltip);
-
- this.setHidden(false);
-
- if (this.onMapChange)
- gameSettingsControl.registerMapChangeHandler(this.onMapChange.bind(this));
-
- if (this.onLoad)
- gamesetupPage.registerLoadHandler(this.onLoad.bind(this));
-
- if (this.onGameAttributesChange)
- gameSettingsControl.registerGameAttributesChangeHandler(this.onGameAttributesChange.bind(this));
-
- if (this.onGameAttributesBatchChange)
- gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
-
- if (this.onAssignPlayer && this.playerIndex === 0)
- this.gameSettingsControl.registerAssignPlayerHandler(this.onAssignPlayer.bind(this));
-
- if (this.onPickRandomItems)
- gameSettingsControl.registerPickRandomItemsHandler(this.onPickRandomItems.bind(this));
-
- if (this.onGameAttributesFinalize)
- gameSettingsControl.registerGameAttributesFinalizeHandler(this.onGameAttributesFinalize.bind(this));
-
- if (this.onPlayerAssignmentsChange)
- playerAssignmentsControl.registerPlayerAssignmentsChangeHandler(this.onPlayerAssignmentsChange.bind(this));
- }
-
- setTitle(titleCaption)
- {
- this.autocompleteTitle = titleCaption;
- this.title.caption = sprintf(this.TitleCaptionFormat, {
- "setting": titleCaption
- });
- }
-
- setTooltip(tooltip)
- {
- if (this.title)
- this.title.tooltip = tooltip;
-
- if (this.label)
- this.label.tooltip = tooltip;
-
- if (this.setControlTooltip)
- this.setControlTooltip(tooltip);
- }
-
- /**
- * Do not call functions calling updateVisibility onMapChange but onGameAttributesChange,
- * so that changes take effect when increasing the playercount as well.
- */
- setEnabled(enabled)
- {
- this.enabled = enabled;
- this.updateVisibility();
- }
-
- setHidden(hidden)
- {
- this.hidden = hidden;
- this.updateVisibility();
- }
-
- updateVisibility()
- {
- let hidden =
- this.hidden ||
- this.playerIndex === undefined &&
- this.category != g_TabCategorySelected ||
- this.playerIndex !== undefined &&
- g_GameAttributes.settings && this.playerIndex >= g_GameAttributes.settings.PlayerData.length;
-
- if (this.frame)
- this.frame.hidden = hidden;
-
- if (hidden)
- return;
-
- let enabled = g_IsController && this.enabled;
-
- if (this.setControlHidden)
- this.setControlHidden(!enabled);
-
- if (this.label)
- this.label.hidden = !!enabled;
- }
-
- /**
- * Returns whether the control specifies an order but didn't implement the function.
- */
- addAutocompleteEntries(name, autocomplete)
- {
- if (this.autocompleteTitle)
- autocomplete[0].push(this.autocompleteTitle);
-
- if (!Number.isInteger(this.AutocompleteOrder))
- return;
-
- if (!this.getAutocompleteEntries)
- {
- error(name + " specifies AutocompleteOrder but didn't implement getAutocompleteEntries");
- return;
- }
-
- let newEntries = this.getAutocompleteEntries();
- if (newEntries)
- autocomplete[this.AutocompleteOrder] =
- (autocomplete[this.AutocompleteOrder] || []).concat(newEntries);
- }
-}
-
-GameSettingControl.prototype.TitleCaptionFormat =
- translateWithContext("Title for specific setting", "%(setting)s:");
-
-/**
- * Derived classes can set this to a number to enable chat autocompleting of setting values.
- * Higher numbers are autocompleted first.
- */
-GameSettingControl.prototype.AutocompleteOrder = undefined;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControl.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingsLayout.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingsLayout.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingsLayout.js (nonexistent)
@@ -1,48 +0,0 @@
-/**
- * This array determines the order in which the GUI controls are shown in the GameSettingTabs panel.
- * The names correspond to property names of the GameSettingControls prototype.
- */
-var g_GameSettingsLayout = [
- {
- "label": translateWithContext("Match settings tab name", "Map"),
- "settings": [
- "MapType",
- "MapFilter",
- "MapSelection",
- "MapSize",
- "Landscape",
- "Biome",
- "Daytime",
- "TriggerDifficulty",
- "Nomad",
- "Treasures",
- "ExploredMap",
- "RevealedMap"
- ]
- },
- {
- "label": translateWithContext("Match settings tab name", "Player"),
- "settings": [
- "PlayerCount",
- "PopulationCap",
- "StartingResources",
- "Spies",
- "Cheats"
- ]
- },
- {
- "label": translateWithContext("Match settings tab name", "Game Type"),
- "settings": [
- ...g_VictoryConditions.map(victoryCondition => victoryCondition.Name),
- "RelicCount",
- "RelicDuration",
- "WonderDuration",
- "RegicideGarrison",
- "GameSpeed",
- "Ceasefire",
- "LockedTeams",
- "LastManStanding",
- "Rating"
- ]
- }
-];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingsLayout.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.xml (nonexistent)
@@ -1,14 +0,0 @@
-
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/GameSettingControlDropdown.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/VictoryConditionCheckbox.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/VictoryConditionCheckbox.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/VictoryConditionCheckbox.js (nonexistent)
@@ -1,105 +0,0 @@
-/**
- * This is an abstract class instantiated per defined VictoryCondition.
- */
-class VictoryConditionCheckbox extends GameSettingControlCheckbox
-{
- constructor(victoryCondition, ...args)
- {
- super(...args);
-
- this.victoryCondition = victoryCondition;
-
- this.setTitle(this.victoryCondition.Title);
- this.setTooltip(this.victoryCondition.Description);
- }
-
- onMapChange(mapData)
- {
- let mapIndex =
- mapData &&
- mapData.settings &&
- mapData.settings.VictoryConditions &&
- mapData.settings.VictoryConditions.indexOf(this.victoryCondition.Name);
-
- if (mapIndex === undefined)
- return;
-
- let index =
- g_GameAttributes.settings &&
- g_GameAttributes.settings.VictoryConditions &&
- g_GameAttributes.settings.VictoryConditions.indexOf(this.victoryCondition.Name);
-
- if (index !== undefined && (mapIndex == -1) == (index == -1))
- return;
-
- if (!g_GameAttributes.settings.VictoryConditions)
- g_GameAttributes.settings.VictoryConditions = [];
-
- if (mapIndex == -1)
- {
- if (index !== undefined)
- g_GameAttributes.settings.VictoryConditions.splice(index, 1);
- }
- else
- g_GameAttributes.settings.VictoryConditions.push(this.victoryCondition.Name);
-
- this.gameSettingsControl.updateGameAttributes();
- }
-
- onGameAttributesChange()
- {
- if (!g_GameAttributes.settings.VictoryConditions)
- {
- g_GameAttributes.settings.VictoryConditions = [];
- for (let victoryCondition of g_VictoryConditions)
- if (victoryCondition.Default)
- g_GameAttributes.settings.VictoryConditions.push(victoryCondition.Name);
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- this.setEnabled(
- g_GameAttributes.mapType != "scenario" &&
- (!this.victoryCondition.DisabledWhenChecked ||
- this.victoryCondition.DisabledWhenChecked.every(name =>
- g_GameAttributes.settings.VictoryConditions.indexOf(name) == -1)));
-
- this.setChecked(g_GameAttributes.settings.VictoryConditions.indexOf(this.victoryCondition.Name) != -1);
- }
-
- onPress(checked)
- {
- let victoryCondition = new Set(g_GameAttributes.settings.VictoryConditions);
-
- if (checked)
- {
- victoryCondition.add(this.victoryCondition.Name);
-
- if (this.victoryCondition.ChangeOnChecked)
- for (let name in this.victoryCondition.ChangeOnChecked)
- if (this.victoryCondition.ChangeOnChecked[name])
- victoryCondition.add(name);
- else
- victoryCondition.delete(name);
- }
- else
- victoryCondition.delete(this.victoryCondition.Name);
-
- g_GameAttributes.settings.VictoryConditions = Array.from(victoryCondition);
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-
- onGameAttributesFinalize()
- {
- if (!g_GameAttributes.settings.TriggerScripts)
- g_GameAttributes.settings.TriggerScripts = [];
-
- if (g_GameAttributes.settings.VictoryConditions.indexOf(this.victoryCondition.Name) != -1)
- for (let script of this.victoryCondition.Scripts)
- if (g_GameAttributes.settings.TriggerScripts.indexOf(script) == -1)
- g_GameAttributes.settings.TriggerScripts.push(script);
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSettings/VictoryConditionCheckbox.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.js (nonexistent)
@@ -1,188 +0,0 @@
-class GameSettingsPanel
-{
- constructor(gamesetupPage, gameSettingTabs, gameSettingsControl, gameSettingControlManager)
- {
- this.centerRightPanel = Engine.GetGUIObjectByName("centerRightPanel");
- this.settingTabButtonsFrame = Engine.GetGUIObjectByName("settingTabButtonsFrame");
- this.settingsPanelFrame = Engine.GetGUIObjectByName("settingsPanelFrame");
-
- this.gameSettingControlManager = gameSettingControlManager;
- this.gameSettingsPanelResizeHandlers = new Set();
-
- this.setupWindow = Engine.GetGUIObjectByName("setupWindow");
- this.setupWindow.onWindowResized = this.onWindowResized.bind(this);
-
- this.settingsPanel = Engine.GetGUIObjectByName("settingsPanel");
-
- this.enabled = Engine.ConfigDB_GetValue("user", this.ConfigNameSlide) == "true";
- this.slideSpeed = this.enabled ? this.SlideSpeed : Infinity;
- this.lastTickTime = undefined;
-
- gameSettingTabs.registerTabSelectHandler(this.updateSize.bind(this));
- gameSettingsControl.registerGameAttributesBatchChangeHandler(this.updateSize.bind(this));
- gamesetupPage.registerLoadHandler(this.triggerResizeHandlers.bind(this));
- }
-
- registerGameSettingsPanelResizeHandler(handler)
- {
- this.gameSettingsPanelResizeHandlers.add(handler);
- }
-
- triggerResizeHandlers()
- {
- for (let handler of this.gameSettingsPanelResizeHandlers)
- handler(this.settingsPanelFrame);
- }
-
- onWindowResized()
- {
- this.updateSize();
- this.triggerResizeHandlers();
- }
-
- updateSize()
- {
- this.gameSettingControlManager.updateSettingVisibility();
- this.positionSettings();
-
- this.lastTickTime = undefined;
- this.settingsPanelFrame.onTick = this.onTick.bind(this);
- }
-
- onTick()
- {
- let now = Date.now();
- let tickLength = now - this.lastTickTime;
- let previousTime = this.lastTickTime;
- this.lastTickTime = now;
- if (previousTime === undefined)
- return;
-
- let distance = this.slideSpeed * tickLength;
- let rightBorder = this.settingTabButtonsFrame.size.left;
- let offset = 0;
- if (g_TabCategorySelected === undefined)
- {
- let maxOffset = rightBorder - this.settingsPanelFrame.size.left;
- if (maxOffset > 0)
- offset = Math.min(distance, maxOffset);
- }
- else if (rightBorder > this.settingsPanelFrame.size.right)
- {
- offset = Math.min(distance, rightBorder - this.settingsPanelFrame.size.right);
- }
- else
- {
- let maxOffset = this.settingsPanelFrame.size.left - rightBorder + (this.settingsPanelFrame.size.right - this.settingsPanelFrame.size.left);
- if (maxOffset > 0)
- offset = -Math.min(distance, maxOffset);
- }
-
- if (offset)
- this.changePanelWidth(offset);
- else
- {
- delete this.settingsPanelFrame.onTick;
- this.lastTickTime = undefined;
- }
- }
-
- changePanelWidth(offset)
- {
- if (!offset)
- return;
-
- let size = this.settingsPanelFrame.size;
- size.left += offset;
- size.right += offset;
- this.settingsPanelFrame.size = size;
-
- this.triggerResizeHandlers();
- }
-
- /**
- * Distribute the currently visible settings over the settings panel.
- * First calculate the number of columns required, then place the setting frames.
- */
- positionSettings()
- {
- let setupWindowSize = this.setupWindow.getComputedSize();
-
- let columnWidth = Math.min(
- this.MaxColumnWidth,
- (setupWindowSize.right - setupWindowSize.left + this.centerRightPanel.size.left) / 2);
-
- let settingsPerColumn;
- {
- let settingPanelSize = this.settingsPanel.getComputedSize();
- let maxSettingsPerColumn = Math.floor((settingPanelSize.bottom - settingPanelSize.top) / this.SettingHeight);
- let settingCount = this.settingsPanel.children.filter(child => !child.children[0].hidden).length;
- settingsPerColumn = settingCount / Math.ceil(settingCount / maxSettingsPerColumn);
- }
-
- let yPos = this.SettingMarginBottom;
- let column = 0;
- let settingsThisColumn = 0;
-
- let selectedTab = g_GameSettingsLayout[g_TabCategorySelected];
- if (!selectedTab)
- return;
-
- for (let name of selectedTab.settings)
- {
- let settingFrame = this.gameSettingControlManager.gameSettingControls[name].frame;
- if (settingFrame.hidden)
- continue;
-
- if (settingsThisColumn >= settingsPerColumn)
- {
- yPos = this.SettingMarginBottom;
- ++column;
- settingsThisColumn = 0;
- }
-
- settingFrame.size = new GUISize(
- columnWidth * column,
- yPos,
- columnWidth * (column + 1) - this.SettingMarginRight,
- yPos + this.SettingHeight - this.SettingMarginBottom);
-
- yPos += this.SettingHeight;
- ++settingsThisColumn;
- }
-
- {
- let size = this.settingsPanelFrame.size;
- size.right = size.left + (column + 1) * columnWidth;
- this.settingsPanelFrame.size = size;
- }
- }
-}
-
-GameSettingsPanel.prototype.ConfigNameSlide =
- "gui.gamesetup.settingsslide";
-
-/**
- * Maximum width of a column in the settings panel.
- */
-GameSettingsPanel.prototype.MaxColumnWidth = 470;
-
-/**
- * Pixels per millisecond the settings panel slides when opening/closing.
- */
-GameSettingsPanel.prototype.SlideSpeed = 1.2;
-
-/**
- * Vertical size of a setting frame.
- */
-GameSettingsPanel.prototype.SettingHeight = 32;
-
-/**
- * Horizontal space between two setting frames.
- */
-GameSettingsPanel.prototype.SettingMarginRight = 10;
-
-/**
- * Vertical space between two setting frames.
- */
-GameSettingsPanel.prototype.SettingMarginBottom = 2;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.js (nonexistent)
@@ -1,27 +0,0 @@
-class GameDescription
-{
- constructor(mapCache, gameSettingTabs, gameSettingsControl)
- {
- this.mapCache = mapCache;
-
- this.gameDescriptionFrame = Engine.GetGUIObjectByName("gameDescriptionFrame");
- this.gameDescription = Engine.GetGUIObjectByName("gameDescription");
-
- gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
- gameSettingTabs.registerTabsResizeHandler(this.onTabsResize.bind(this));
- }
-
- onTabsResize(settingsTabButtonsFrame)
- {
- let size = this.gameDescriptionFrame.size;
- size.top = settingsTabButtonsFrame.size.bottom + this.Margin;
- this.gameDescriptionFrame.size = size;
- }
-
- onGameAttributesBatchChange()
- {
- this.gameDescription.caption = getGameDescription(this.mapCache);
- }
-}
-
-GameDescription.prototype.Margin = 3;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.xml (nonexistent)
@@ -1,7 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.js (nonexistent)
@@ -1,36 +0,0 @@
-class MapPreview
-{
- constructor(gameSettingsControl, mapCache)
- {
- this.gameSettingsControl = gameSettingsControl;
- this.mapCache = mapCache;
-
- this.mapInfoName = Engine.GetGUIObjectByName("mapInfoName");
- this.mapPreview = Engine.GetGUIObjectByName("mapPreview");
-
- gameSettingsControl.registerMapChangeHandler(this.onMapChange.bind(this));
- gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
- }
-
- onMapChange(mapData)
- {
- let preview = mapData && mapData.settings && mapData.settings.Preview;
- if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != preview)
- {
- g_GameAttributes.settings.Preview = preview;
- this.gameSettingsControl.updateGameAttributes();
- }
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.map || !g_GameAttributes.mapType)
- return;
-
- this.mapInfoName.caption = this.mapCache.translateMapName(
- this.mapCache.getTranslatableMapName(g_GameAttributes.mapType, g_GameAttributes.map));
-
- this.mapPreview.sprite =
- this.mapCache.getMapPreview(g_GameAttributes.mapType, g_GameAttributes.map, g_GameAttributes);
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.xml (nonexistent)
@@ -1,2 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tips.txt
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tips.txt (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tips.txt (nonexistent)
@@ -1 +0,0 @@
-Although reasonably easy for an experienced player, the default AI level is quite challenging for new players yet to master the basic mechanisms of the game. Beginners are advised to start by playing against a lower level AI (Sandbox or Very Easy). Change the AI level by clicking the gear icon next to the player you want to modify in the selection panel above.
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tips.txt
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.js (nonexistent)
@@ -1,88 +0,0 @@
-class ReadyButton
-{
- constructor(readyControl, netMessages, playerAssignmentsControl)
- {
- this.readyControl = readyControl;
-
- this.hidden = undefined;
-
- this.buttonHiddenChangeHandlers = new Set();
- this.readyButtonPressHandlers = new Set();
-
- this.readyButton = Engine.GetGUIObjectByName("readyButton");
- this.readyButton.onPress = this.onPress.bind(this);
- this.readyButton.onPressRight = this.onPressRight.bind(this);
-
- playerAssignmentsControl.registerPlayerAssignmentsChangeHandler(this.onPlayerAssignmentsChange.bind(this));
- netMessages.registerNetMessageHandler("netstatus", this.onNetStatusMessage.bind(this));
-
- if (g_IsController && g_IsNetworked)
- this.readyControl.setReady(this.readyControl.StayReady, true);
- }
-
- registerButtonHiddenChangeHandler(handler)
- {
- this.buttonHiddenChangeHandlers.add(handler);
- }
-
- onNetStatusMessage(message)
- {
- if (message.status == "disconnected")
- this.readyButton.enabled = false;
- }
-
- onPlayerAssignmentsChange()
- {
- let playerAssignment = g_PlayerAssignments[Engine.GetPlayerGUID()];
- let hidden = g_IsController || !playerAssignment || playerAssignment.player == -1;
-
- if (!hidden)
- {
- this.readyButton.caption = this.Caption[playerAssignment.status];
- this.readyButton.tooltip = this.Tooltip[playerAssignment.status];
- }
-
- if (hidden == this.hidden)
- return;
-
- this.hidden = hidden;
- this.readyButton.hidden = hidden;
-
- for (let handler of this.buttonHiddenChangeHandlers)
- handler(this.readyButton);
- }
-
- registerReadyButtonPressHandler(handler)
- {
- this.readyButtonPressHandlers.add(handler);
- }
-
- onPress()
- {
- let newState =
- (g_PlayerAssignments[Engine.GetPlayerGUID()].status + 1) % (this.readyControl.StayReady + 1);
-
- for (let handler of this.readyButtonPressHandlers)
- handler(newState);
-
- this.readyControl.setReady(newState, true);
- }
-
- onPressRight()
- {
- if (g_PlayerAssignments[Engine.GetPlayerGUID()].status != this.readyControl.NotReady)
- this.readyControl.setReady(this.readyControl.NotReady, true);
- }
-}
-
-ReadyButton.prototype.Caption = [
- translate("I'm ready"),
- translate("Stay ready"),
- translate("I'm not ready!")
-];
-
-ReadyButton.prototype.Tooltip = [
- translate("State that you are ready to play."),
- translate("Stay ready even when the game settings change."),
- translate("State that you are not ready to play.")
-];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.js (nonexistent)
@@ -1,47 +0,0 @@
-class CancelButton
-{
- constructor(gamesetupPage, startGameButton, readyButton, gameSettingsControl)
- {
- this.gamesetupPage = gamesetupPage;
- this.startGameButton = startGameButton;
- this.readyButton = readyButton;
- this.gameSettingsControl = gameSettingsControl;
-
- 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 = gamesetupPage.closePage.bind(gamesetupPage);
-
- 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);
- }
-}
-
-CancelButton.prototype.Caption =
- translate("Back");
-
-CancelButton.prototype.TooltipLobby =
- translate("Return to the lobby.");
-
-CancelButton.prototype.TooltipMenu =
- translate("Return to the main menu.");
-
-CancelButton.prototype.Margin = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.js (nonexistent)
@@ -1,19 +0,0 @@
-class LobbyButton
-{
- constructor()
- {
- this.lobbyButton = Engine.GetGUIObjectByName("lobbyButton");
- this.lobbyButton.tooltip = this.Tooltip;
- this.lobbyButton.onPress = this.onPress.bind(this);
- this.lobbyButton.hidden = !Engine.HasXmppClient();
- }
-
- onPress()
- {
- if (Engine.HasXmppClient())
- Engine.PushGuiPage("page_lobby.xml", { "dialog": true });
- }
-}
-
-LobbyButton.prototype.Tooltip =
- translate("Show the multiplayer lobby in a dialog window.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetCivsButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetCivsButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetCivsButton.js (nonexistent)
@@ -1,36 +0,0 @@
-class ResetCivsButton
-{
- constructor(gameSettingsControl)
- {
- this.gameSettingsControl = gameSettingsControl;
- this.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
-
- this.civResetButton = Engine.GetGUIObjectByName("civResetButton");
- this.civResetButton.tooltip = this.Tooltip;
- this.civResetButton.onPress = this.onPress.bind(this);
- }
-
- onGameAttributesBatchChange()
- {
- if (g_GameAttributes.mapType)
- this.civResetButton.hidden = g_GameAttributes.mapType == "scenario" || !g_IsController;
- }
-
- onPress()
- {
- if (!g_GameAttributes.settings || !g_GameAttributes.settings.PlayerData)
- return;
-
- for (let pData of g_GameAttributes.settings.PlayerData)
- pData.Civ = this.RandomCivId;
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-}
-
-ResetCivsButton.prototype.Tooltip =
- translate("Reset any civilizations that have been selected to the default (random).");
-
-ResetCivsButton.prototype.RandomCivId =
- "random";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetCivsButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.js (nonexistent)
@@ -1,72 +0,0 @@
-class StartGameButton
-{
- constructor(gamesetupPage, startGameControl, netMessages, readyControl, playerAssignmentsControl)
- {
- this.startGameControl = startGameControl;
- this.readyControl = readyControl;
- this.gameStarted = false;
-
- this.buttonHiddenChangeHandlers = new Set();
-
- this.startGameButton = Engine.GetGUIObjectByName("startGameButton");
- this.startGameButton.caption = this.Caption;
- this.startGameButton.onPress = this.onPress.bind(this);
-
- gamesetupPage.registerLoadHandler(this.onLoad.bind(this));
- playerAssignmentsControl.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()
- {
- let isEveryoneReady = this.isEveryoneReady();
- this.startGameButton.enabled = !this.gameStarted && isEveryoneReady;
- this.startGameButton.tooltip =
- !g_IsNetworked || isEveryoneReady ?
- this.ReadyTooltip :
- this.ReadyTooltipWaiting;
- }
-
- isEveryoneReady()
- {
- if (!g_IsNetworked)
- return true;
-
- for (let guid in g_PlayerAssignments)
- if (g_PlayerAssignments[guid].player != -1 &&
- g_PlayerAssignments[guid].status == this.readyControl.NotReady)
- return false;
-
- return true;
- }
-
- onPress()
- {
- if (this.gameStarted)
- return;
-
- this.gameStarted = true;
- this.update();
- this.startGameControl.launchGame();
- }
-}
-
-StartGameButton.prototype.Caption =
- translate("Start Game!");
-
-StartGameButton.prototype.ReadyTooltip =
- translate("Start a new game with the current settings.");
-
-StartGameButton.prototype.ReadyTooltipWaiting =
- translate("Start a new game with the current settings (disabled until all players are ready).");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.xml (nonexistent)
@@ -1,8 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ReadyButton.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.xml (nonexistent)
@@ -1,8 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CancelButton.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.xml (nonexistent)
@@ -1,8 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/StartGameButton.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.xml (nonexistent)
@@ -1,11 +0,0 @@
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/LobbyButton.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetTeamsButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetTeamsButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetTeamsButton.js (nonexistent)
@@ -1,35 +0,0 @@
-class ResetTeamsButton
-{
- constructor(gameSettingsControl)
- {
- this.gameSettingsControl = gameSettingsControl;
- this.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
-
- this.teamResetButton = Engine.GetGUIObjectByName("teamResetButton");
- this.teamResetButton.tooltip = this.Tooltip;
- this.teamResetButton.onPress = this.onPress.bind(this);
- }
-
- onGameAttributesBatchChange()
- {
- if (!g_GameAttributes.mapType)
- return;
-
- this.teamResetButton.hidden = g_GameAttributes.mapType == "scenario" || !g_IsController;
- }
-
- onPress()
- {
- if (!g_GameAttributes.settings || !g_GameAttributes.settings.PlayerData)
- return;
-
- for (let pData of g_GameAttributes.settings.PlayerData)
- pData.Team = -1;
-
- this.gameSettingsControl.updateGameAttributes();
- this.gameSettingsControl.setNetworkGameAttributes();
- }
-}
-
-ResetTeamsButton.prototype.Tooltip =
- translate("Reset all teams to the default.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/ResetTeamsButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CivInfoButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CivInfoButton.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CivInfoButton.js (nonexistent)
@@ -1,48 +0,0 @@
-class CivInfoButton
-{
- constructor()
- {
- this.civInfo = {
- "civ": "",
- "page": "page_civinfo.xml"
- };
-
- let civInfoButton = Engine.GetGUIObjectByName("civInfoButton");
- civInfoButton.onPress = this.onPress.bind(this);
- civInfoButton.tooltip =
- sprintf(translate(this.Tooltip), {
- "hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"),
- "hotkey_structree": colorizeHotkey("%(hotkey)s", "structree")
- });
-
- Engine.SetGlobalHotkey("structree", this.openPage.bind(this, "page_structree.xml"));
- Engine.SetGlobalHotkey("civinfo", this.openPage.bind(this, "page_civinfo.xml"));
- }
-
- onPress()
- {
- this.openPage(this.civInfo.page);
- }
-
- openPage(page)
- {
- Engine.PushGuiPage(
- page,
- { "civ": this.civInfo.civ },
- this.storeCivInfoPage.bind(this));
- }
-
- storeCivInfoPage(data)
- {
- if (data.nextPage)
- Engine.PushGuiPage(
- data.nextPage,
- { "civ": data.civ },
- this.storeCivInfoPage.bind(this));
- else
- this.civInfo = data;
- }
-}
-
-CivInfoButton.prototype.Tooltip =
- translate("%(hotkey_civinfo)s / %(hotkey_structree)s: View History / Structure Tree\nLast opened will be reopened on click.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Buttons/CivInfoButton.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.xml (nonexistent)
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
- Show this message in the future.
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.xml (nonexistent)
@@ -1,5 +0,0 @@
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.xml (nonexistent)
@@ -1,11 +0,0 @@
-
-
-
-
- Loading
-
-
-
- Loading map data. Please wait…
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.js (nonexistent)
@@ -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;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Tooltip.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.js (nonexistent)
@@ -1,41 +0,0 @@
-class GameSettingWarning
-{
- constructor(gameSettingsControl, cancelButton)
- {
- if (!g_IsNetworked)
- return;
-
- this.gameSettingWarning = Engine.GetGUIObjectByName("gameSettingWarning");
-
- gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
- cancelButton.registerCancelButtonResizeHandler(this.onCancelButtonResize.bind(this));
- }
-
- onGameAttributesBatchChange()
- {
- let caption =
- g_GameAttributes.settings.CheatsEnabled ?
- this.CheatsEnabled :
- g_GameAttributes.settings.RatingEnabled ?
- this.RatingEnabled :
- "";
-
- 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.");
-
-GameSettingWarning.prototype.RatingEnabled =
- translate("Rated game.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingWarning.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.xml (nonexistent)
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsPanel.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.js (nonexistent)
@@ -1,45 +0,0 @@
-/**
- * The TipsPanel shows some hints to newcomers.
- * It is only shown in Singleplayer mode since the chat is shown instead in multiplayer mode.
- */
-class TipsPanel
-{
- constructor(gameSettingsPanel)
- {
- let available = !g_IsNetworked && Engine.ConfigDB_GetValue("user", this.Config) == "true";
-
- this.spTips = Engine.GetGUIObjectByName("spTips");
- this.spTips.hidden = !available;
- if (!available)
- return;
-
- this.displaySPTips = Engine.GetGUIObjectByName("displaySPTips");
- this.displaySPTips.onPress = this.onPress.bind(this);
-
- Engine.GetGUIObjectByName("aiTips").caption =
- Engine.TranslateLines(Engine.ReadFile(this.File));
-
- gameSettingsPanel.registerGameSettingsPanelResizeHandler(this.onGameSettingsPanelResize.bind(this));
- }
-
- onPress()
- {
- Engine.ConfigDB_CreateAndWriteValueToFile(
- "user",
- this.Config,
- String(this.displaySPTips.checked),
- "config/user.cfg");
- }
-
- onGameSettingsPanelResize(settingsPanel)
- {
- this.spTips.hidden =
- this.spTips.getComputedSize().right > settingsPanel.getComputedSize().left;
- }
-}
-
-TipsPanel.prototype.File =
- "gui/gamesetup/Panels/Tips.txt";
-
-TipsPanel.prototype.Config =
- "gui.gamesetup.enabletips";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/TipsPanel.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/SoundNotification.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/SoundNotification.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/SoundNotification.js (nonexistent)
@@ -1,28 +0,0 @@
-class SoundNotification
-{
- constructor(netMessages, playerAssignmentsControl)
- {
- netMessages.registerNetMessageHandler("chat", this.onClientChat.bind(this));
- playerAssignmentsControl.registerClientJoinHandler(this.onClientJoin.bind(this));
- }
-
- onClientJoin(guid)
- {
- if (guid != Engine.GetPlayerGUID())
- soundNotification(this.ConfigJoinNotification);
- }
-
- onClientChat(message)
- {
- if (message.guid != Engine.GetPlayerGUID() &&
- message.text.toLowerCase().indexOf(
- splitRatingFromNick(g_PlayerAssignments[Engine.GetPlayerGUID()].name).nick.toLowerCase()) != -1)
- soundNotification(this.ConfigNickNotification);
- }
-}
-
-SoundNotification.prototype.ConfigJoinNotification =
- "gamesetup.join";
-
-SoundNotification.prototype.ConfigNickNotification =
- "nick";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/SoundNotification.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.xml (nonexistent)
@@ -1,4 +0,0 @@
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameDescription.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.xml (nonexistent)
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/MapPreview.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.js (nonexistent)
@@ -1,97 +0,0 @@
-class GameSettingTabs
-{
- constructor(gamesetupPage, lobbyButton)
- {
- this.lobbyButton = lobbyButton;
-
- this.tabSelectHandlers = new Set();
- this.tabsResizeHandlers = new Set();
-
- this.settingsTabButtonsFrame = Engine.GetGUIObjectByName("settingTabButtonsFrame");
-
- for (let tab in g_GameSettingsLayout)
- g_GameSettingsLayout[tab].tooltip =
- sprintf(this.ToggleTooltip, { "name": g_GameSettingsLayout[tab].label }) +
- colorizeHotkey("\n" + this.HotkeyDownTooltip, this.ConfigNameHotkeyDown) +
- colorizeHotkey("\n" + this.HotkeyUpTooltip, this.ConfigNameHotkeyUp);
-
- gamesetupPage.registerLoadHandler(this.onLoad.bind(this));
- Engine.SetGlobalHotkey("cancel", selectPanel);
- }
-
- registerTabsResizeHandler(handler)
- {
- this.tabsResizeHandlers.add(handler);
- }
-
- registerTabSelectHandler(handler)
- {
- this.tabSelectHandlers.add(handler);
- }
-
- onLoad()
- {
- placeTabButtons(
- g_GameSettingsLayout,
- this.TabButtonHeight,
- this.TabButtonMargin,
- this.onTabPress.bind(this),
- this.onTabSelect.bind(this));
-
- this.resize();
-
- if (!g_IsController)
- selectPanel();
- }
-
- resize()
- {
- let size = this.settingsTabButtonsFrame.size;
- size.bottom = size.top + g_GameSettingsLayout.length * (this.TabButtonHeight + this.TabButtonMargin);
-
- if (!this.lobbyButton.lobbyButton.hidden)
- {
- let lobbyButtonSize = this.lobbyButton.lobbyButton.parent.size;
- size.right -= lobbyButtonSize.right - lobbyButtonSize.left + this.LobbyButtonMargin;
- }
- this.settingsTabButtonsFrame.size = size;
-
- for (let handler of this.tabsResizeHandlers)
- handler(this.settingsTabButtonsFrame);
- }
-
- onTabPress(category)
- {
- selectPanel(category == g_TabCategorySelected ? undefined : category);
- }
-
- onTabSelect()
- {
- for (let handler of this.tabSelectHandlers)
- handler();
- }
-}
-
-GameSettingTabs.prototype.ToggleTooltip =
- translate("Toggle the %(name)s settings tab.");
-
-GameSettingTabs.prototype.HotkeyUpTooltip =
- translate("Use %(hotkey)s to move a settings tab up.");
-
-GameSettingTabs.prototype.HotkeyDownTooltip =
- translate("Use %(hotkey)s to move a settings tab down.");
-
-GameSettingTabs.prototype.ConfigNameHotkeyUp =
- "tab.next";
-
-GameSettingTabs.prototype.ConfigNameHotkeyDown =
- "tab.prev";
-
-GameSettingTabs.prototype.TabButtonHeight = 30;
-
-GameSettingTabs.prototype.TabButtonMargin = 4;
-
-/**
- * Horizontal space between tab buttons and lobby button.
- */
-GameSettingTabs.prototype.LobbyButtonMargin = 8;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/GameSettingsTabs.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessagesPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessagesPanel.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessagesPanel.js (nonexistent)
@@ -1,81 +0,0 @@
-/**
- * This class stores and displays the chat history since the login and
- * displays timestamps if enabled.
- */
-class ChatMessagesPanel
-{
- constructor(gameSettingsPanel)
- {
- this.gameSettingsPanel = gameSettingsPanel;
-
- this.chatHistory = "";
-
- this.statusMessageFormat = new StatusMessageFormat();
-
- if (Engine.ConfigDB_GetValue("user", this.ConfigTimestamp) == "true")
- this.timestampWrapper = new TimestampWrapper();
-
- this.chatText = Engine.GetGUIObjectByName("chatText");
- this.chatPanel = Engine.GetGUIObjectByName("chatPanel");
- this.chatPanel.onWindowResized = this.onWindowResized.bind(this);
- gameSettingsPanel.registerGameSettingsPanelResizeHandler(this.onGameSettingsPanelResize.bind(this));
-
- // TODO: Remove global requirements by gui/common/network.js
- g_NetworkCommands["/list"] = () => { this.addText(getUsernameList()); };
- g_NetworkCommands["/clear"] = this.clearChatMessages.bind(this);
- global.kickError = () => {};
- }
-
- addText(text)
- {
- if (this.timestampWrapper)
- text = this.timestampWrapper.format(text);
-
- this.chatHistory += this.chatHistory ? "\n" + text : text;
- this.chatText.caption = this.chatHistory;
- }
-
- addStatusMessage(text)
- {
- this.addText(this.statusMessageFormat.format(text));
- }
-
- clearChatMessages()
- {
- this.chatHistory = "";
- this.chatText.caption = "";
- }
-
- updateHidden()
- {
- let size = this.chatPanel.getComputedSize();
- this.chatPanel.hidden = !g_IsNetworked || size.right - size.left < this.MinimumWidth;
- }
-
- onWindowResized()
- {
- this.updateHidden();
- }
-
- onGameSettingsPanelResize(settingsPanel)
- {
- let size = this.chatPanel.size;
- size.right = settingsPanel.size.left + this.gameSettingsPanel.MaxColumnWidth + this.Margin;
- this.chatPanel.size = size;
-
- this.updateHidden();
- }
-}
-
-/**
- * Minimum amount of pixels required for the chat panel to be visible.
- */
-ChatMessagesPanel.prototype.MinimumWidth = 96;
-
-/**
- * Horizontal space between the chat window and the settings panel.
- */
-ChatMessagesPanel.prototype.Margin = 10;
-
-ChatMessagesPanel.prototype.ConfigTimestamp =
- "chat.timestamp";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessagesPanel.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientChat.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientChat.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientChat.js (nonexistent)
@@ -1,53 +0,0 @@
-ChatMessageEvents.ClientChat = class
-{
- constructor(chatMessagesPanel, netMessages)
- {
- this.chatMessagesPanel = chatMessagesPanel;
-
- netMessages.registerNetMessageHandler("chat", this.onClientChat.bind(this));
- this.usernameArgs = {};
- this.messageArgs = {};
-
- // TODO: Remove this global required by gui/common/
- global.colorizePlayernameByGUID = this.colorizePlayernameByGUID.bind(this);
- }
-
- onClientChat(message)
- {
- this.usernameArgs.username = this.colorizePlayernameByGUID(message.guid);
- this.messageArgs.username = setStringTags(sprintf(this.SenderFormat, this.usernameArgs), this.SenderTags);
- this.messageArgs.message = escapeText(message.text);
- this.chatMessagesPanel.addText(sprintf(this.MessageFormat, this.messageArgs));
- }
-
- colorizePlayernameByGUID(guid)
- {
- // TODO: Controllers should have the moderator-prefix
- let username = g_PlayerAssignments[guid] ? escapeText(g_PlayerAssignments[guid].name) : translate("Unknown Player");
- let playerID = g_PlayerAssignments[guid] ? g_PlayerAssignments[guid].player : -1;
-
- let color = "white";
- if (playerID > 0)
- {
- color = g_GameAttributes.settings.PlayerData[playerID - 1].Color;
-
- // Enlighten playercolor to improve readability
- let [h, s, l] = rgbToHsl(color.r, color.g, color.b);
- let [r, g, b] = hslToRgb(h, s, Math.max(0.6, l));
-
- color = rgbToGuiColor({ "r": r, "g": g, "b": b });
- }
-
- return coloredText(username, color);
- }
-};
-
-ChatMessageEvents.ClientChat.prototype.SenderFormat =
- translate("<%(username)s>");
-
-ChatMessageEvents.ClientChat.prototype.MessageFormat =
- translate("%(username)s %(message)s");
-
-ChatMessageEvents.ClientChat.prototype.SenderTags = {
- "font": "sans-bold-13"
-};
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientChat.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientConnection.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientConnection.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientConnection.js (nonexistent)
@@ -1,30 +0,0 @@
-ChatMessageEvents.ClientConnection = class
-{
- constructor(chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl)
- {
- this.chatMessagesPanel = chatMessagesPanel;
-
- playerAssignmentsControl.registerClientJoinHandler(this.onClientJoin.bind(this));
- playerAssignmentsControl.registerClientLeaveHandler(this.onClientLeave.bind(this));
-
- this.args = {};
- }
-
- onClientJoin(newGUID, newAssignments)
- {
- this.args.username = newAssignments[newGUID].name;
- this.chatMessagesPanel.addStatusMessage(sprintf(this.JoinText, this.args));
- }
-
- onClientLeave(guid)
- {
- this.args.username = g_PlayerAssignments[guid].name;
- this.chatMessagesPanel.addStatusMessage(sprintf(this.LeaveText, this.args));
- }
-};
-
-ChatMessageEvents.ClientConnection.prototype.JoinText =
- translate("%(username)s has joined");
-
-ChatMessageEvents.ClientConnection.prototype.LeaveText =
- translate("%(username)s has left");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientConnection.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientReady.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientReady.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientReady.js (nonexistent)
@@ -1,30 +0,0 @@
-ChatMessageEvents.ClientReady = class
-{
- constructor(chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl, readyControl)
- {
- this.chatMessagesPanel = chatMessagesPanel;
-
- this.args = {};
-
- netMessages.registerNetMessageHandler("ready", this.onReadyMessage.bind(this));
- }
-
- onReadyMessage(message)
- {
- let playerAssignment = g_PlayerAssignments[message.guid];
- if (!playerAssignment || playerAssignment.player == -1)
- return;
-
- let text = this.ReadyMessage[message.status] || undefined;
- if (!text)
- return;
-
- this.args.username = playerAssignment.name;
- this.chatMessagesPanel.addText(sprintf(text, this.args));
- }
-};
-
-ChatMessageEvents.ClientReady.prototype.ReadyMessage = [
- translate("* %(username)s is not ready."),
- translate("* %(username)s is ready!")
-];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientReady.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/GameSettingsChanged.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/GameSettingsChanged.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/GameSettingsChanged.js (nonexistent)
@@ -1,22 +0,0 @@
-/**
- * The purpose of this message is to indicate to the local player when settings they had agreed on changed.
- */
-ChatMessageEvents.GameSettingsChanged = class
-{
- constructor(chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl, readyControl)
- {
- this.readyControl = readyControl;
- this.chatMessagesPanel = chatMessagesPanel;
-
- readyControl.registerResetReadyHandler(this.onResetReady.bind(this));
- }
-
- onResetReady()
- {
- if (this.readyControl.getLocalReadyState() == this.readyControl.Ready)
- this.chatMessagesPanel.addStatusMessage(this.MessageText);
- }
-};
-
-ChatMessageEvents.GameSettingsChanged.prototype.MessageText =
- translate("Game settings have been changed");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/GameSettingsChanged.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientKicked.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientKicked.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientKicked.js (nonexistent)
@@ -1,25 +0,0 @@
-ChatMessageEvents.ClientKicked = class
-{
- constructor(chatMessagesPanel, netMessages)
- {
- this.chatMessagesPanel = chatMessagesPanel;
-
- this.messageArgs = {};
-
- netMessages.registerNetMessageHandler("kicked", this.onClientKicked.bind(this));
- }
-
- onClientKicked(message)
- {
- this.messageArgs.username = message.username;
- this.chatMessagesPanel.addStatusMessage(sprintf(
- message.banned ? this.BannedMessage : this.KickedMessage,
- this.messageArgs));
- }
-};
-
-ChatMessageEvents.ClientKicked.prototype.KickedMessage =
- translate("%(username)s has been kicked");
-
-ChatMessageEvents.ClientKicked.prototype.BannedMessage =
- translate("%(username)s has been banned");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatMessages/ClientKicked.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputPanel.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputPanel.js (nonexistent)
@@ -1,55 +0,0 @@
-class ChatInputPanel
-{
- constructor(netMessages, chatInputAutocomplete)
- {
- this.chatInputAutocomplete = chatInputAutocomplete;
-
- this.chatInput = Engine.GetGUIObjectByName("chatInput");
- this.chatInput.tooltip = colorizeAutocompleteHotkey(this.Tooltip);
- this.chatInput.onPress = this.onPress.bind(this);
- this.chatInput.onTab = this.onTab.bind(this);
- this.chatInput.focus();
-
- this.chatSubmitButton = Engine.GetGUIObjectByName("chatSubmitButton");
- this.chatSubmitButton.onPress = this.onPress.bind(this);
-
- netMessages.registerNetMessageHandler("netstatus", this.onNetStatusMessage.bind(this));
- }
-
- onNetStatusMessage(message)
- {
- if (message.status == "disconnected")
- {
- reportDisconnect(message.reason, true);
- this.chatInput.hidden = true;
- this.chatSubmitButton.hidden = true;
- }
- }
-
- onTab()
- {
- autoCompleteText(
- this.chatInput,
- this.chatInputAutocomplete.getAutocompleteEntries());
- }
-
- onPress()
- {
- if (!g_IsNetworked)
- return;
-
- let text = this.chatInput.caption;
- if (!text.length)
- return;
-
- this.chatInput.caption = "";
-
- if (!executeNetworkCommand(text))
- Engine.SendNetworkChat(text);
-
- this.chatInput.focus();
- }
-}
-
-ChatInputPanel.prototype.Tooltip =
- translate("Press %(hotkey)s to autocomplete player names or settings.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputPanel.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.js (nonexistent)
@@ -1,26 +0,0 @@
-/**
- * Properties of this prototype are classes that subscribe to one or more events and
- * construct a formatted chat message to be displayed on that event.
- *
- * Important: Apply escapeText on player provided input to avoid players breaking the game for everybody.
- */
-class ChatMessageEvents
-{
-}
-
-class ChatPanel
-{
- constructor(gameSettingControlManager, gameSettingsControl, netMessages, playerAssignmentsControl, readyControl, gameSettingsPanel)
- {
- this.statusMessageFormat = new StatusMessageFormat();
-
- this.chatMessagesPanel = new ChatMessagesPanel(gameSettingsPanel);
- this.chatInputAutocomplete = new ChatInputAutocomplete(gameSettingControlManager, gameSettingsControl, playerAssignmentsControl);
- this.chatInputPanel = new ChatInputPanel(netMessages, this.chatInputAutocomplete);
-
- this.chatMessageEvents = [];
- for (let name in ChatMessageEvents)
- this.chatMessageEvents.push(new ChatMessageEvents[name](
- this.chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl, readyControl));
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/StatusMessageFormat.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/StatusMessageFormat.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/StatusMessageFormat.js (nonexistent)
@@ -1,28 +0,0 @@
-/**
- * Status messages are textual event notifications triggered by multi-user chat room actions.
- */
-class StatusMessageFormat
-{
- constructor()
- {
- this.args = {};
- }
-
- /**
- * escapeText is the responsibility of the caller.
- */
- format(text)
- {
- this.args.message = text;
- return setStringTags(
- sprintf(this.MessageFormat, this.args),
- this.MessageTags);
- }
-}
-
-StatusMessageFormat.prototype.MessageFormat =
- translate("== %(message)s");
-
-StatusMessageFormat.prototype.MessageTags = {
- "font": "sans-bold-13"
-};
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/StatusMessageFormat.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputAutocomplete.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputAutocomplete.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputAutocomplete.js (nonexistent)
@@ -1,37 +0,0 @@
-class ChatInputAutocomplete
-{
- constructor(gameSettingControlManager, gameSettingsControl, playerAssignmentsControl)
- {
- this.gameSettingControlManager = gameSettingControlManager;
- this.entries = undefined;
-
- playerAssignmentsControl.registerPlayerAssignmentsChangeHandler(this.onAutocompleteChange.bind(this));
- gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onAutocompleteChange.bind(this));
- }
-
- onAutocompleteChange()
- {
- this.entries = undefined;
- }
-
- // Collects all strings that can be autocompleted and
- // sorts them by priority (so that playernames are always autocompleted first).
- getAutocompleteEntries()
- {
- if (this.entries)
- return this.entries;
-
- // Maps from priority to autocompletable strings
- let entries = { "0": [] };
-
- this.gameSettingControlManager.addAutocompleteEntries(entries);
-
- let allEntries = Object.keys(entries).sort((a, b) => +b - +a).reduce(
- (all, priority) => all.concat(entries[priority]),
- []);
-
- this.entries = Array.from(new Set(allEntries));
-
- return this.entries;
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatInputAutocomplete.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.xml (nonexistent)
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
-
- Send
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/ChatPanel.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/TimestampWrapper.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/TimestampWrapper.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/TimestampWrapper.js (nonexistent)
@@ -1,31 +0,0 @@
-/**
- * This class wraps a string with a timestamp dating to when the message was sent.
- */
-class TimestampWrapper
-{
- constructor()
- {
- this.timeArgs = {};
- this.timestampArgs = {};
- }
-
- format(text)
- {
- this.timeArgs.time =
- Engine.FormatMillisecondsIntoDateStringLocal(Date.now(), this.TimeFormat);
-
- this.timestampArgs.time = sprintf(this.TimestampFormat, this.timeArgs);
- this.timestampArgs.message = text;
-
- return sprintf(this.TimestampedMessageFormat, this.timestampArgs);
- }
-}
-
-TimestampWrapper.prototype.TimestampedMessageFormat =
- translate("%(time)s %(message)s");
-
-TimestampWrapper.prototype.TimestampFormat =
- translate("\\[%(time)s]");
-
-TimestampWrapper.prototype.TimeFormat =
- translate("HH:mm");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/Chat/TimestampWrapper.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.js (nonexistent)
@@ -1,25 +0,0 @@
-/**
- * The purpose of this page is to display a placeholder in multiplayer until the settings from the server have been received.
- * This is not technically necessary, but only performed to avoid confusion or irritation when showing the clients first the
- * default settings and then switching to the server settings quickly thereafter.
- */
-class LoadingWindow
-{
- constructor(netMessages)
- {
- if (g_IsNetworked)
- netMessages.registerNetMessageHandler("gamesetup", this.hideLoadingWindow.bind(this));
- else
- this.hideLoadingWindow();
- }
-
- hideLoadingWindow()
- {
- let loadingWindow = Engine.GetGUIObjectByName("loadingWindow");
- if (loadingWindow.hidden)
- return;
-
- loadingWindow.hidden = true;
- Engine.GetGUIObjectByName("setupWindow").hidden = false;
- }
-}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Panels/LoadingWindow.js
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.xml (nonexistent)
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/GameSetupPage.xml
___________________________________________________________________
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Spies.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Spies.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Spies.js (revision 23413)
@@ -0,0 +1,45 @@
+GameSettingControls.Spies = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.DisableSpies;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.DisableSpies)
+ {
+ g_GameAttributes.settings.DisableSpies = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_GameAttributes.settings.DisableSpies === undefined)
+ {
+ g_GameAttributes.settings.DisableSpies = false;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setChecked(g_GameAttributes.settings.DisableSpies);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.DisableSpies = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.Spies.prototype.TitleCaption =
+ translate("Disable Spies");
+
+GameSettingControls.Spies.prototype.Tooltip =
+ translate("Disable spies during the game.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Spies.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js (revision 23413)
@@ -0,0 +1,48 @@
+/**
+ * This array determines the order in which the GUI controls are shown in the GameSettingTabs panel.
+ * The names correspond to property names of the GameSettingControls prototype.
+ */
+var g_GameSettingsLayout = [
+ {
+ "label": translateWithContext("Match settings tab name", "Map"),
+ "settings": [
+ "MapType",
+ "MapFilter",
+ "MapSelection",
+ "MapSize",
+ "Landscape",
+ "Biome",
+ "Daytime",
+ "TriggerDifficulty",
+ "Nomad",
+ "Treasures",
+ "ExploredMap",
+ "RevealedMap"
+ ]
+ },
+ {
+ "label": translateWithContext("Match settings tab name", "Player"),
+ "settings": [
+ "PlayerCount",
+ "PopulationCap",
+ "StartingResources",
+ "Spies",
+ "Cheats"
+ ]
+ },
+ {
+ "label": translateWithContext("Match settings tab name", "Game Type"),
+ "settings": [
+ ...g_VictoryConditions.map(victoryCondition => victoryCondition.Name),
+ "RelicCount",
+ "RelicDuration",
+ "WonderDuration",
+ "RegicideGarrison",
+ "GameSpeed",
+ "Ceasefire",
+ "LockedTeams",
+ "LastManStanding",
+ "Rating"
+ ]
+ }
+];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingsLayout.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js (revision 23413)
@@ -0,0 +1,142 @@
+PlayerSettingControls.PlayerCiv = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.fixedCiv = undefined;
+ this.values = prepareForDropdown(this.getItems());
+
+ this.dropdown.list = this.values.name;
+ this.dropdown.list_data = this.values.civ;
+ }
+
+ setControl()
+ {
+ this.label = Engine.GetGUIObjectByName("playerCivText[" + this.playerIndex + "]");
+ this.dropdown = Engine.GetGUIObjectByName("playerCiv[" + this.playerIndex + "]");
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = this.values && this.values.tooltip[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ this.fixedCiv = mapPData && mapPData.Civ || undefined;
+ }
+
+ onAssignPlayer(source, target)
+ {
+ if (g_GameAttributes.mapType != "scenario" && source && target)
+ [source.Civ, target.Civ] = [target.Civ, source.Civ];
+ }
+
+ onGameAttributesChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData || !g_GameAttributes.mapType)
+ return;
+
+ if (this.fixedCiv)
+ {
+ if (!pData.Civ || this.fixedCiv != pData.Civ)
+ {
+ pData.Civ = this.fixedCiv;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (this.values.civ.indexOf(pData.Civ || undefined) == -1)
+ {
+ pData.Civ =
+ g_GameAttributes.mapType == "scenario" ?
+ g_Settings.PlayerDefaults[this.playerIndex + 1].Civ :
+ this.RandomCivId;
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData || !g_GameAttributes.mapType)
+ return;
+
+ this.setEnabled(!this.fixedCiv);
+ this.setSelectedValue(pData.Civ);
+ }
+
+ getItems()
+ {
+ let values = [];
+
+ for (let civ in g_CivData)
+ if (g_CivData[civ].SelectableInGameSetup)
+ values.push({
+ "name": g_CivData[civ].Name,
+ "autocomplete": g_CivData[civ].Name,
+ "tooltip": g_CivData[civ].History,
+ "civ": civ
+ });
+
+ values.sort(sortNameIgnoreCase);
+
+ values.unshift({
+ "name": setStringTags(this.RandomCivCaption, this.RandomItemTags),
+ "autocomplete": this.RandomCivCaption,
+ "tooltip": this.RandomCivTooltip,
+ "civ": this.RandomCivId
+ });
+
+ return values;
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values.autocomplete;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ pData.Civ = this.values.civ[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ onPickRandomItems()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData || pData.Civ != this.RandomCivId)
+ return;
+
+ // Get a unique array of selectable cultures
+ let cultures = Object.keys(g_CivData).filter(civ => g_CivData[civ].SelectableInGameSetup).map(civ => g_CivData[civ].Culture);
+ cultures = cultures.filter((culture, index) => cultures.indexOf(culture) === index);
+
+ // Pick a random civ of a random culture
+ let culture = pickRandom(cultures);
+ pData.Civ = pickRandom(Object.keys(g_CivData).filter(civ =>
+ g_CivData[civ].Culture == culture && g_CivData[civ].SelectableInGameSetup));
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.pickRandomItems();
+ }
+};
+
+PlayerSettingControls.PlayerCiv.prototype.Tooltip =
+ translate("Choose the civilization for this player.");
+
+PlayerSettingControls.PlayerCiv.prototype.RandomCivCaption =
+ translateWithContext("civilization", "Random");
+
+PlayerSettingControls.PlayerCiv.prototype.RandomCivId =
+ "random";
+
+PlayerSettingControls.PlayerCiv.prototype.RandomCivTooltip =
+ translate("Picks one civilization at random when the game starts.");
+
+PlayerSettingControls.PlayerCiv.prototype.AutocompleteOrder = 90;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerCiv.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerFrame.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerFrame.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerFrame.js (revision 23413)
@@ -0,0 +1,23 @@
+PlayerSettingControls.PlayerFrame = class extends GameSettingControl
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.playerFrame = Engine.GetGUIObjectByName("playerFrame[" + this.playerIndex + "]");
+
+ {
+ let size = this.playerFrame.size;
+ size.top = this.Height * this.playerIndex;
+ size.bottom = this.Height * (this.playerIndex + 1);
+ this.playerFrame.size = size;
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.playerFrame.hidden = !this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ }
+}
+
+PlayerSettingControls.PlayerFrame.prototype.Height = 32;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerFrame.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/WonderDuration.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/WonderDuration.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/WonderDuration.js (revision 23413)
@@ -0,0 +1,85 @@
+GameSettingControls.WonderDuration = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = prepareForDropdown(g_Settings.VictoryDurations);
+
+ this.dropdown.list = this.values.Title;
+ this.dropdown.list_data = this.values.Duration;
+
+ this.available = false;
+ }
+
+ onMapChange(mapData)
+ {
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.VictoryConditions &&
+ mapData.settings.VictoryConditions.indexOf(this.NameWonderVictory) != -1 &&
+ mapData.settings.WonderDuration || undefined;
+
+ if (mapValue === undefined || mapValue == g_GameAttributes.settings.WonderDuration)
+ return;
+
+ if (!g_GameAttributes.settings.VictoryConditions)
+ g_GameAttributes.settings.VictoryConditions = [];
+
+ if (g_GameAttributes.settings.VictoryConditions.indexOf(this.NameWonderVictory) == -1)
+ g_GameAttributes.settings.VictoryConditions.push(this.NameWonderVictory);
+
+ g_GameAttributes.settings.WonderDuration = mapValue;
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.settings.VictoryConditions)
+ return;
+
+ this.available = g_GameAttributes.settings.VictoryConditions.indexOf(this.NameWonderVictory) != -1;
+
+ if (this.available)
+ {
+ if (g_GameAttributes.settings.WonderDuration === undefined)
+ {
+ g_GameAttributes.settings.WonderDuration = this.values.Duration[this.values.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.WonderDuration !== undefined)
+ {
+ delete g_GameAttributes.settings.WonderDuration;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setHidden(!this.available);
+
+ if (this.available)
+ this.setSelectedValue(g_GameAttributes.settings.WonderDuration);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.WonderDuration = this.values.Duration[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.WonderDuration.prototype.TitleCaption =
+ translate("Wonder Duration");
+
+GameSettingControls.WonderDuration.prototype.Tooltip =
+ translate("Minutes until the player has achieved Wonder Victory");
+
+GameSettingControls.WonderDuration.prototype.NameWonderVictory =
+ "wonder";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/WonderDuration.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/ExploredMap.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/ExploredMap.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/ExploredMap.js (revision 23413)
@@ -0,0 +1,58 @@
+GameSettingControls.ExploredMap = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.ExploreMap || undefined;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.ExploreMap)
+ {
+ g_GameAttributes.settings.ExploreMap = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ if (g_GameAttributes.settings.ExploreMap === undefined)
+ {
+ g_GameAttributes.settings.ExploreMap = !!g_GameAttributes.settings.RevealMap;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ else if (g_GameAttributes.settings.RevealMap &&
+ !g_GameAttributes.settings.ExploreMap)
+ {
+ g_GameAttributes.settings.ExploreMap = true;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ this.setChecked(g_GameAttributes.settings.ExploreMap);
+ this.setEnabled(g_GameAttributes.mapType != "scenario" && !g_GameAttributes.settings.RevealMap);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.ExploreMap = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.ExploredMap.prototype.TitleCaption =
+ // Translation: Make sure to differentiate between the revealed map and explored map settings!
+ translate("Explored Map");
+
+GameSettingControls.ExploredMap.prototype.Tooltip =
+ // Translation: Make sure to differentiate between the revealed map and explored map settings!
+ translate("Toggle explored map (see initial map).");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/ExploredMap.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LockedTeams.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LockedTeams.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LockedTeams.js (revision 23413)
@@ -0,0 +1,62 @@
+GameSettingControls.LockedTeams = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ !mapData.settings.LockTeams &&
+ mapData.settings.LastManStanding;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.LastManStanding)
+ {
+ g_GameAttributes.settings.LastManStanding = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ if (g_GameAttributes.settings.LockTeams === undefined ||
+ g_GameAttributes.settings.RatingEnabled && !g_GameAttributes.settings.LockTeams)
+ {
+ g_GameAttributes.settings.LockTeams = g_IsNetworked;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ this.setChecked(g_GameAttributes.settings.LockTeams);
+
+ this.setEnabled(
+ g_GameAttributes.mapType != "scenario" &&
+ !g_GameAttributes.settings.RatingEnabled);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.LockTeams = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.LockedTeams.prototype.TitleCaption =
+ translate("Teams Locked");
+
+GameSettingControls.LockedTeams.prototype.Tooltip =
+ translate("Toggle locked teams.");
+
+/**
+ * In multiplayer mode, players negotiate teams before starting the match and
+ * expect to play the match with these teams unless explicitly stated otherwise during the match settings.
+ * For singleplayermode, preserve the historic default of open diplomacies.
+ */
+GameSettingControls.LockedTeams.prototype.DefaultValue = Engine.HasNetClient();
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LockedTeams.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Rating.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Rating.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Rating.js (revision 23413)
@@ -0,0 +1,54 @@
+GameSettingControls.Rating = class extends GameSettingControlCheckbox
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.hasXmppClient = Engine.HasXmppClient();
+ this.available = false;
+ }
+
+ onGameAttributesChange()
+ {
+ this.available = this.hasXmppClient && g_GameAttributes.settings.PlayerData.length == 2;
+ if (this.available)
+ {
+ if (g_GameAttributes.settings.RatingEnabled === undefined)
+ {
+ g_GameAttributes.settings.RatingEnabled = true;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.RatingEnabled !== undefined)
+ {
+ delete g_GameAttributes.settings.RatingEnabled;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setHidden(!this.available);
+ if (this.available)
+ this.setChecked(g_GameAttributes.settings.RatingEnabled);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.RatingEnabled = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ onGameAttributesFinalize()
+ {
+ if (this.hasXmppClient)
+ Engine.SetRankedGame(!!g_GameAttributes.settings.RatingEnabled);
+ }
+};
+
+GameSettingControls.Rating.prototype.TitleCaption =
+ translate("Rated Game");
+
+GameSettingControls.Rating.prototype.Tooltip =
+ translate("Toggle if this game will be rated for the leaderboard.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Rating.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RevealedMap.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RevealedMap.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RevealedMap.js (revision 23413)
@@ -0,0 +1,53 @@
+GameSettingControls.RevealedMap = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.RevealMap || undefined;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.RevealMap)
+ {
+ g_GameAttributes.settings.RevealMap = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ if (g_GameAttributes.settings.RevealMap === undefined)
+ {
+ g_GameAttributes.settings.RevealMap = false;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ this.setChecked(g_GameAttributes.settings.RevealMap);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.RevealMap = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.RevealedMap.prototype.TitleCaption =
+ // Translation: Make sure to differentiate between the revealed map and explored map settings!
+ translate("Revealed Map");
+
+GameSettingControls.RevealedMap.prototype.Tooltip =
+ // Translation: Make sure to differentiate between the revealed map and explored map settings!
+ translate("Toggle revealed map (see everything).");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RevealedMap.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Seed.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Seed.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Seed.js (revision 23413)
@@ -0,0 +1,12 @@
+GameSettingControls.Seed = class extends GameSettingControl
+{
+ onGameAttributesFinalize()
+ {
+ // The matchID is used for identifying rated game reports for the lobby and possibly when sharing replays.
+ g_GameAttributes.matchID = Engine.GetMatchID();
+
+ // Seed is used for map generation and simulation.
+ g_GameAttributes.settings.Seed = randIntExclusive(0, Math.pow(2, 32));
+ g_GameAttributes.settings.AISeed = randIntExclusive(0, Math.pow(2, 32));
+ }
+};
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Seed.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js (revision 23413)
@@ -0,0 +1,269 @@
+PlayerSettingControls.PlayerAssignment = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.clientItemFactory = new PlayerAssignmentItem.Client();
+ this.aiItemFactory = new PlayerAssignmentItem.AI();
+ this.unassignedItem = new PlayerAssignmentItem.Unassigned().createItem();
+
+ this.aiItems =
+ g_Settings.AIDescriptions.filter(ai => !ai.data.hidden).map(
+ this.aiItemFactory.createItem.bind(this.aiItemFactory));
+
+ this.values = undefined;
+ this.assignedGUID = undefined;
+ this.fixedAI = undefined;
+
+ this.playerAssignmentsControl.registerClientJoinHandler(this.onClientJoin.bind(this));
+ }
+
+ setControl()
+ {
+ this.dropdown = Engine.GetGUIObjectByName("playerAssignment[" + this.playerIndex + "]");
+ this.label = Engine.GetGUIObjectByName("playerAssignmentText[" + this.playerIndex + "]");
+ }
+
+ onLoad(initData, hotloadData)
+ {
+ if (!hotloadData && !g_IsNetworked)
+ this.onClientJoin("local", g_PlayerAssignments);
+ }
+
+ onClientJoin(newGUID, newAssignments)
+ {
+ if (!g_IsController || this.fixedAI || newAssignments[newGUID].player != -1)
+ return;
+
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ // Assign the client (or only buddies if prefered) to a free slot
+ if (newGUID != Engine.GetPlayerGUID())
+ {
+ let assignOption = Engine.ConfigDB_GetValue("user", this.ConfigAssignPlayers);
+ if (assignOption == "disabled" ||
+ assignOption == "buddies" && g_Buddies.indexOf(splitRatingFromNick(newAssignments[newGUID].name).nick) == -1)
+ return;
+ }
+
+ for (let guid in newAssignments)
+ if (newAssignments[guid].player == this.playerIndex + 1)
+ return;
+
+ if (pData.AI)
+ {
+ pData.AI = false;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ newAssignments[newGUID].player = this.playerIndex + 1;
+ this.playerAssignmentsControl.assignClient(newGUID, this.playerIndex + 1);
+ }
+
+ onPlayerAssignmentsChange()
+ {
+ this.assignedGUID = undefined;
+ for (let guid in g_PlayerAssignments)
+ if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
+ {
+ this.assignedGUID = guid;
+ break;
+ }
+
+ this.playerItems = sortGUIDsByPlayerID().map(
+ this.clientItemFactory.createItem.bind(this.clientItemFactory));
+
+ this.rebuildList();
+ this.updateSelection();
+ }
+
+ onMapChange(mapData)
+ {
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ this.fixedAI = mapPData && mapPData.AI || undefined;
+ }
+
+ onGameAttributesChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ if (this.fixedAI && pData.AI != this.fixedAI)
+ {
+ pData.AI = this.fixedAI;
+ this.gameSettingsControl.updateGameAttributes();
+ this.playerAssignmentsControl.unassignClient(this.playerIndex + 1);
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ this.setEnabled(!this.fixedAI);
+ this.updateSelection();
+ }
+
+ updateSelection()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (pData && this.values)
+ this.setSelectedValue(
+ this.values.Value.findIndex((value, i) =>
+ this.values.Handler[i].isSelected(pData, this.assignedGUID, value)));
+ }
+
+ rebuildList()
+ {
+ Engine.ProfileStart("updatePlayerAssignmentsList");
+ this.values = prepareForDropdown([
+ ...this.playerItems,
+ ...this.aiItems,
+ this.unassignedItem
+ ]);
+
+ this.dropdown.list = this.values.Caption;
+ this.dropdown.list_data = this.values.Value.map((value, i) => i);
+ Engine.ProfileStop();
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ this.values.Handler[itemIdx].onSelectionChange(
+ this.gameSettingsControl,
+ this.playerAssignmentsControl,
+ this.playerIndex,
+ this.values.Value[itemIdx]);
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values.Autocomplete;
+ }
+};
+
+PlayerSettingControls.PlayerAssignment.prototype.Tooltip =
+ translate("Select player.");
+
+PlayerSettingControls.PlayerAssignment.prototype.AutocompleteOrder = 100;
+
+PlayerSettingControls.PlayerAssignment.prototype.ConfigAssignPlayers =
+ "gui.gamesetup.assignplayers";
+
+class PlayerAssignmentItem
+{
+}
+
+{
+ PlayerAssignmentItem.Client = class
+ {
+ createItem(guid)
+ {
+ return {
+ "Handler": this,
+ "Value": guid,
+ "Autocomplete": g_PlayerAssignments[guid].name,
+ "Caption": setStringTags(
+ g_PlayerAssignments[guid].name,
+ g_PlayerAssignments[guid].player == -1 ? this.ObserverTags : this.PlayerTags)
+ };
+ }
+
+ onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex, guidToAssign)
+ {
+ let sourcePlayer = g_PlayerAssignments[guidToAssign].player - 1;
+ playerAssignmentsControl.assignPlayer(guidToAssign, playerIndex);
+ gameSettingsControl.assignPlayer(sourcePlayer, playerIndex);
+ }
+
+ isSelected(pData, guid, value)
+ {
+ return guid !== undefined && guid == value;
+ }
+ };
+
+ PlayerAssignmentItem.Client.prototype.PlayerTags =
+ { "color": "white" };
+
+ PlayerAssignmentItem.Client.prototype.ObserverTags =
+ { "color": "170 170 250" };
+}
+
+{
+ PlayerAssignmentItem.AI = class
+ {
+ createItem(ai)
+ {
+ let aiName = translate(ai.data.name);
+ return {
+ "Handler": this,
+ "Value": ai.id,
+ "Autocomplete": aiName,
+ "Caption": setStringTags(sprintf(this.Label, { "ai": aiName }), this.Tags)
+ };
+ }
+
+ onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex, value)
+ {
+ playerAssignmentsControl.unassignClient(playerIndex + 1);
+
+ g_GameAttributes.settings.PlayerData[playerIndex].AI = value;
+
+ gameSettingsControl.updateGameAttributes();
+ gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ isSelected(pData, guid, value)
+ {
+ return !guid && pData.AI && pData.AI == value;
+ }
+ };
+
+ PlayerAssignmentItem.AI.prototype.Label =
+ translate("AI: %(ai)s");
+
+ PlayerAssignmentItem.AI.prototype.Tags =
+ { "color": "70 150 70" };
+}
+
+{
+ PlayerAssignmentItem.Unassigned = class
+ {
+ createItem()
+ {
+ return {
+ "Handler": this,
+ "Value": undefined,
+ "Autocomplete": this.Label,
+ "Caption": setStringTags(this.Label, this.Tags)
+ };
+ }
+
+ onSelectionChange(gameSettingsControl, playerAssignmentsControl, playerIndex)
+ {
+ playerAssignmentsControl.unassignClient(playerIndex + 1);
+
+ g_GameAttributes.settings.PlayerData[playerIndex].AI = false;
+ gameSettingsControl.updateGameAttributes();
+ gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ isSelected(pData, guid, value)
+ {
+ return !guid && !pData.AI;
+ }
+ };
+
+ PlayerAssignmentItem.Unassigned.prototype.Label =
+ translate("Unassigned");
+
+ PlayerAssignmentItem.Unassigned.prototype.Tags =
+ { "color": "140 140 140" };
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerAssignment.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js (revision 23413)
@@ -0,0 +1,78 @@
+PlayerSettingControls.PlayerTeam = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = prepareForDropdown([
+ {
+ "label": this.NoTeam,
+ "id": this.NoTeamId
+ },
+ ...Array.from(
+ new Array(g_MaxTeams),
+ (v, i) => ({
+ "label": i + 1,
+ "id": i
+ }))
+ ]);
+ this.dropdown.list = this.values.label;
+ this.dropdown.list_data = this.values.id;
+ }
+
+ setControl()
+ {
+ this.label = Engine.GetGUIObjectByName("playerTeamText[" + this.playerIndex + "]");
+ this.dropdown = Engine.GetGUIObjectByName("playerTeam[" + this.playerIndex + "]");
+ }
+
+ onMapChange(mapData)
+ {
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+
+ if (pData && mapPData && mapPData.Team !== undefined)
+ {
+ pData.Team = mapPData.Team;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ if (pData.Team === undefined)
+ {
+ pData.Team = this.NoTeamId;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+ this.setSelectedValue(pData.Team);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.PlayerData[this.playerIndex].Team = itemIdx - 1;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+PlayerSettingControls.PlayerTeam.prototype.Tooltip =
+ translate("Select player's team.");
+
+PlayerSettingControls.PlayerTeam.prototype.NoTeam =
+ translateWithContext("team", "None");
+
+PlayerSettingControls.PlayerTeam.prototype.NoTeamId = -1;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerTeam.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/GameSettingsControl.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/GameSettingsControl.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/GameSettingsControl.js (revision 23413)
@@ -1,269 +1,269 @@
/**
* This class provides a property independent interface to g_GameAttributes events.
* Classes may use this interface in order to react to changing g_GameAttributes.
*/
class GameSettingsControl
{
- constructor(gamesetupPage, netMessages, startGameControl, mapCache)
+ constructor(setupWindow, netMessages, startGameControl, mapCache)
{
this.startGameControl = startGameControl;
this.mapCache = mapCache;
- this.gameSettingsFile = new GameSettingsFile(gamesetupPage);
+ this.gameSettingsFile = new GameSettingsFile(setupWindow);
this.previousMap = undefined;
this.depth = 0;
// This property may be read from publicly
this.autostart = false;
this.gameAttributesChangeHandlers = new Set();
this.gameAttributesBatchChangeHandlers = new Set();
this.gameAttributesFinalizeHandlers = new Set();
this.pickRandomItemsHandlers = new Set();
this.assignPlayerHandlers = new Set();
this.mapChangeHandlers = new Set();
- gamesetupPage.registerLoadHandler(this.onLoad.bind(this));
- gamesetupPage.registerGetHotloadDataHandler(this.onGetHotloadData.bind(this));
+ setupWindow.registerLoadHandler(this.onLoad.bind(this));
+ setupWindow.registerGetHotloadDataHandler(this.onGetHotloadData.bind(this));
startGameControl.registerLaunchGameHandler(this.onLaunchGame.bind(this));
if (g_IsNetworked)
netMessages.registerNetMessageHandler("gamesetup", this.onGamesetupMessage.bind(this));
}
registerMapChangeHandler(handler)
{
this.mapChangeHandlers.add(handler);
}
unregisterMapChangeHandler(handler)
{
this.mapChangeHandlers.delete(handler);
}
/**
* This message is triggered everytime g_GameAttributes change.
* Handlers may subsequently change g_GameAttributes and trigger this message again.
*/
registerGameAttributesChangeHandler(handler)
{
this.gameAttributesChangeHandlers.add(handler);
}
unregisterGameAttributesChangeHandler(handler)
{
this.gameAttributesChangeHandlers.delete(handler);
}
/**
* This message is triggered after g_GameAttributes changed and recursed gameAttributesChangeHandlers finished.
* The use case for this is to update GUI objects which do not change g_GameAttributes but only display the attributes.
*/
registerGameAttributesBatchChangeHandler(handler)
{
this.gameAttributesBatchChangeHandlers.add(handler);
}
unregisterGameAttributesBatchChangeHandler(handler)
{
this.gameAttributesBatchChangeHandlers.delete(handler);
}
registerGameAttributesFinalizeHandler(handler)
{
this.gameAttributesFinalizeHandlers.add(handler);
}
unregisterGameAttributesFinalizeHandler(handler)
{
this.gameAttributesFinalizeHandlers.delete(handler);
}
registerAssignPlayerHandler(handler)
{
this.assignPlayerHandlers.add(handler);
}
unregisterAssignPlayerHandler(handler)
{
this.assignPlayerHandlers.delete(handler);
}
registerPickRandomItemsHandler(handler)
{
this.pickRandomItemsHandlers.add(handler);
}
unregisterPickRandomItemsHandler(handler)
{
this.pickRandomItemsHandlers.delete(handler);
}
onLoad(initData, hotloadData)
{
if (initData && initData.map && initData.mapType)
{
Object.defineProperty(this, "autostart", {
"value": true,
"writable": false,
"configurable": false
});
// TODO: Fix g_GameAttributes, g_GameAttributes.settings,
// g_GameAttributes.settings.PlayerData object references and
// copy over each attribute individually when receiving
// settings from the server or the local file.
g_GameAttributes = {
"mapType": initData.mapType,
"map": initData.map
};
this.updateGameAttributes();
// Don't launchGame before all Load handlers finished
}
else
{
if (hotloadData)
g_GameAttributes = hotloadData.gameAttributes;
else if (g_IsController && this.gameSettingsFile.enabled)
g_GameAttributes = this.gameSettingsFile.loadFile();
this.updateGameAttributes();
this.setNetworkGameAttributes();
}
}
onGetHotloadData(object)
{
object.gameAttributes = g_GameAttributes;
}
onGamesetupMessage(message)
{
if (!message.data)
return;
g_GameAttributes = message.data;
this.updateGameAttributes();
}
/**
* This is to be called whenever g_GameAttributes has been changed except on gameAttributes finalization.
*/
updateGameAttributes()
{
if (this.depth == 0)
Engine.ProfileStart("updateGameAttributes");
if (this.depth >= this.MaxDepth)
{
error("Infinite loop: " + new Error().stack);
Engine.ProfileStop();
return;
}
++this.depth;
// Basic sanitization
{
if (!g_GameAttributes.settings)
g_GameAttributes.settings = {};
if (!g_GameAttributes.settings.PlayerData)
g_GameAttributes.settings.PlayerData = new Array(this.DefaultPlayerCount);
for (let i = 0; i < g_GameAttributes.settings.PlayerData.length; ++i)
if (!g_GameAttributes.settings.PlayerData[i])
g_GameAttributes.settings.PlayerData[i] = {};
}
// Map change handlers are triggered first, so that GameSettingControls can update their
// gameAttributes model prior to applying that model in their gameAttributesChangeHandler.
if (g_GameAttributes.map && this.previousMap != g_GameAttributes.map && g_GameAttributes.mapType)
{
this.previousMap = g_GameAttributes.map;
let mapData = this.mapCache.getMapData(g_GameAttributes.mapType, g_GameAttributes.map);
for (let handler of this.mapChangeHandlers)
handler(mapData);
}
for (let handler of this.gameAttributesChangeHandlers)
handler();
--this.depth;
if (this.depth == 0)
{
for (let handler of this.gameAttributesBatchChangeHandlers)
handler();
Engine.ProfileStop();
}
}
/**
* This function is to be called when a GUI control has initiated a value change.
*
* To avoid an infinite loop, do not call this function when a gamesetup message was
* received and the data had only been modified deterministically.
*/
setNetworkGameAttributes()
{
if (g_IsNetworked)
Engine.SetNetworkGameAttributes(g_GameAttributes);
}
getPlayerData(gameAttributes, playerIndex)
{
return gameAttributes &&
gameAttributes.settings &&
gameAttributes.settings.PlayerData &&
gameAttributes.settings.PlayerData[playerIndex] || undefined;
}
assignPlayer(sourcePlayerIndex, playerIndex)
{
if (playerIndex == -1)
return;
let target = this.getPlayerData(g_GameAttributes, playerIndex);
let source = this.getPlayerData(g_GameAttributes, sourcePlayerIndex);
for (let handler of this.assignPlayerHandlers)
handler(source, target);
this.updateGameAttributes();
this.setNetworkGameAttributes();
}
/**
* This function is called everytime a random setting selection was resolved,
* so that subsequent random settings are triggered too,
* for example picking a random biome after picking a random map.
*/
pickRandomItems()
{
for (let handler of this.pickRandomItemsHandlers)
handler();
}
onLaunchGame()
{
if (!this.autostart)
this.gameSettingsFile.saveFile();
this.pickRandomItems();
for (let handler of this.gameAttributesFinalizeHandlers)
handler();
this.setNetworkGameAttributes();
}
}
GameSettingsControl.prototype.MaxDepth = 512;
/**
* This number is used when selecting the random map type, which doesn't provide PlayerData.
*/
GameSettingsControl.prototype.DefaultPlayerCount = 4;
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/GameSettingsFile.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/GameSettingsFile.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/GameSettingsFile.js (revision 23413)
@@ -1,64 +1,64 @@
/**
* This class provides a way to save g_GameAttributes to a file and load them.
*/
class GameSettingsFile
{
- constructor(gamesetupPage)
+ constructor(setupWindow)
{
this.filename = g_IsNetworked ?
this.GameAttributesFileMultiplayer :
this.GameAttributesFileSingleplayer;
this.engineInfo = Engine.GetEngineInfo();
this.enabled = Engine.ConfigDB_GetValue("user", this.ConfigName) == "true";
- gamesetupPage.registerClosePageHandler(this.saveFile.bind(this));
+ setupWindow.registerClosePageHandler(this.saveFile.bind(this));
}
loadFile()
{
Engine.ProfileStart("loadPersistMatchSettingsFile");
let data =
this.enabled &&
g_IsController &&
Engine.FileExists(this.filename) &&
Engine.ReadJSONFile(this.filename);
let gameAttributes =
data &&
data.attributes &&
data.engine_info &&
data.engine_info.engine_version == this.engineInfo.engine_version &&
hasSameMods(data.engine_info.mods, this.engineInfo.mods) &&
data.attributes || {};
Engine.ProfileStop();
return gameAttributes;
}
/**
* Delete settings if disabled, so that players are not confronted with old settings after enabling the setting again.
*/
saveFile()
{
if (!g_IsController)
return;
Engine.ProfileStart("savePersistMatchSettingsFile");
Engine.WriteJSONFile(this.filename, {
"attributes": this.enabled ? g_GameAttributes : {},
"engine_info": this.engineInfo
});
Engine.ProfileStop();
}
}
GameSettingsFile.prototype.ConfigName =
"persistmatchsettings";
GameSettingsFile.prototype.GameAttributesFileSingleplayer =
"config/matchsettings.json";
GameSettingsFile.prototype.GameAttributesFileMultiplayer =
"config/matchsettings.mp.json";
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/PlayerAssignmentsControl.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/PlayerAssignmentsControl.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Controls/PlayerAssignmentsControl.js (revision 23413)
@@ -1,164 +1,164 @@
/**
* This class provides a property independent interface to g_PlayerAssignment events and actions.
*/
class PlayerAssignmentsControl
{
- constructor(gamesetupPage, netMessages)
+ constructor(setupWindow, netMessages)
{
this.clientJoinHandlers = new Set();
this.clientLeaveHandlers = new Set();
this.playerAssignmentsChangeHandlers = new Set();
if (!g_IsNetworked)
{
let name = singleplayerName();
// Replace empty player name when entering a single-player match for the first time.
Engine.ConfigDB_CreateAndWriteValueToFile("user", this.ConfigNameSingleplayer, name, "config/user.cfg");
g_PlayerAssignments = {
"local": {
"name": name,
"player": -1
}
};
}
- gamesetupPage.registerLoadHandler(this.onLoad.bind(this));
- gamesetupPage.registerGetHotloadDataHandler(this.onGetHotloadData.bind(this));
+ setupWindow.registerLoadHandler(this.onLoad.bind(this));
+ setupWindow.registerGetHotloadDataHandler(this.onGetHotloadData.bind(this));
netMessages.registerNetMessageHandler("players", this.onPlayerAssignmentMessage.bind(this));
}
registerPlayerAssignmentsChangeHandler(handler)
{
this.playerAssignmentsChangeHandlers.add(handler);
}
unregisterPlayerAssignmentsChangeHandler(handler)
{
this.playerAssignmentsChangeHandlers.delete(handler);
}
registerClientJoinHandler(handler)
{
this.clientJoinHandlers.add(handler);
}
unregisterClientJoinHandler(handler)
{
this.clientJoinHandlers.delete(handler);
}
registerClientLeaveHandler(handler)
{
this.clientLeaveHandlers.add(handler);
}
unregisterClientLeaveHandler(handler)
{
this.clientLeaveHandlers.delete(handler);
}
onLoad(initData, hotloadData)
{
if (hotloadData)
{
g_PlayerAssignments = hotloadData.playerAssignments;
this.updatePlayerAssignments();
}
}
onGetHotloadData(object)
{
object.playerAssignments = g_PlayerAssignments;
}
/**
* To be called when g_PlayerAssignments is modified.
*/
updatePlayerAssignments()
{
Engine.ProfileStart("updatePlayerAssignments");
for (let handler of this.playerAssignmentsChangeHandlers)
handler();
Engine.ProfileStop();
}
/**
* Called whenever a client joins/leaves or any gamesetting is changed.
*/
onPlayerAssignmentMessage(message)
{
let newAssignments = message.newAssignments;
for (let guid in newAssignments)
if (!g_PlayerAssignments[guid])
for (let handler of this.clientJoinHandlers)
handler(guid, message.newAssignments);
for (let guid in g_PlayerAssignments)
if (!newAssignments[guid])
for (let handler of this.clientLeaveHandlers)
handler(guid);
g_PlayerAssignments = newAssignments;
this.updatePlayerAssignments();
}
assignClient(guid, playerIndex)
{
if (g_IsNetworked)
Engine.AssignNetworkPlayer(playerIndex, guid);
else
{
g_PlayerAssignments[guid].player = playerIndex;
this.updatePlayerAssignments();
}
}
/**
* If both clients are assigned players, this will swap their assignments.
*/
assignPlayer(guidToAssign, playerIndex)
{
if (g_PlayerAssignments[guidToAssign].player != -1)
for (let guid in g_PlayerAssignments)
if (g_PlayerAssignments[guid].player == playerIndex + 1)
{
this.assignClient(guid, g_PlayerAssignments[guidToAssign].player);
break;
}
this.assignClient(guidToAssign, playerIndex + 1);
if (!g_IsNetworked)
this.updatePlayerAssignments();
}
unassignClient(playerID)
{
if (g_IsNetworked)
Engine.AssignNetworkPlayer(playerID, "");
else if (g_PlayerAssignments.local.player == playerID)
{
g_PlayerAssignments.local.player = -1;
this.updatePlayerAssignments();
}
}
unassignInvalidPlayers()
{
if (g_IsNetworked)
for (let playerID = g_GameAttributes.settings.PlayerData.length + 1; playerID <= g_MaxPlayers; ++playerID)
// Remove obsolete playerIDs from the servers playerassignments copy
Engine.AssignNetworkPlayer(playerID, "");
else if (g_PlayerAssignments.local.player > g_GameAttributes.settings.PlayerData.length)
{
g_PlayerAssignments.local.player = -1;
this.updatePlayerAssignments();
}
}
}
PlayerAssignmentsControl.prototype.ConfigNameSingleplayer =
"playername.singleplayer";
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/NetMessages/GameRegisterStanza.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/NetMessages/GameRegisterStanza.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/NetMessages/GameRegisterStanza.js (revision 23413)
@@ -1,146 +1,146 @@
/**
* If there is an XmppClient, this class informs the XPartaMuPP lobby bot that
* this match is being setup so that others can join.
* It informs of the lobby of some setting values and the participating clients.
*/
class GameRegisterStanza
{
- constructor(initData, gamesetupPage, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache)
+ constructor(initData, setupWindow, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache)
{
this.mapCache = mapCache;
this.serverName = initData.serverName;
this.serverPort = initData.serverPort;
this.stunEndpoint = initData.stunEndpoint;
this.mods = JSON.stringify(Engine.GetEngineInfo().mods);
this.timer = undefined;
// Only send a lobby update when its data changed
this.lastStanza = undefined;
// Events
let sendImmediately = this.sendImmediately.bind(this);
playerAssignmentsControl.registerClientJoinHandler(sendImmediately);
playerAssignmentsControl.registerClientLeaveHandler(sendImmediately);
- gamesetupPage.registerClosePageHandler(this.onClosePage.bind(this));
+ setupWindow.registerClosePageHandler(this.onClosePage.bind(this));
gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
netMessages.registerNetMessageHandler("start", this.onGameStart.bind(this));
}
onGameAttributesBatchChange()
{
if (this.lastStanza)
this.sendDelayed();
else
this.sendImmediately();
}
onGameStart()
{
if (!g_IsController || !Engine.HasXmppClient())
return;
this.sendImmediately();
let clients = this.formatClientsForStanza();
Engine.SendChangeStateGame(clients.connectedPlayers, clients.list);
}
onClosePage()
{
if (g_IsController && Engine.HasXmppClient())
Engine.SendUnregisterGame();
}
/**
* Send the relevant gamesettings to the lobbybot in a deferred manner.
*/
sendDelayed()
{
if (!g_IsController || !Engine.HasXmppClient())
return;
if (this.timer !== undefined)
clearTimeout(this.timer);
this.timer = setTimeout(this.sendImmediately.bind(this), this.Timeout);
}
/**
* Send the relevant gamesettings to the lobbybot immediately.
*/
sendImmediately()
{
if (!g_IsController || !Engine.HasXmppClient())
return;
Engine.ProfileStart("sendRegisterGameStanza");
if (this.timer !== undefined)
{
clearTimeout(this.timer);
this.timer = undefined;
}
let clients = this.formatClientsForStanza();
let stanza = {
"name": this.serverName,
"port": this.serverPort,
"hostUsername": Engine.LobbyGetNick(),
"mapName": g_GameAttributes.map,
"niceMapName": this.mapCache.getTranslatableMapName(g_GameAttributes.mapType, g_GameAttributes.map),
"mapSize": g_GameAttributes.mapType == "random" ? g_GameAttributes.settings.Size : "Default",
"mapType": g_GameAttributes.mapType,
"victoryConditions": g_GameAttributes.settings.VictoryConditions.join(","),
"nbp": clients.connectedPlayers,
"maxnbp": g_GameAttributes.settings.PlayerData.length,
"players": clients.list,
"stunIP": this.stunEndpoint ? this.stunEndpoint.ip : "",
"stunPort": this.stunEndpoint ? this.stunEndpoint.port : "",
"mods": this.mods
};
// Only send the stanza if one of these properties changed
if (this.lastStanza && Object.keys(stanza).every(prop => this.lastStanza[prop] == stanza[prop]))
return;
this.lastStanza = stanza;
Engine.SendRegisterGame(stanza);
Engine.ProfileStop();
}
/**
* Send a list of playernames and distinct between players and observers.
* Don't send teams, AIs or anything else until the game was started.
* The playerData format from g_GameAttributes is kept to reuse the GUI function presenting the data.
*/
formatClientsForStanza()
{
let connectedPlayers = 0;
let playerData = [];
for (let guid in g_PlayerAssignments)
{
let pData = { "Name": g_PlayerAssignments[guid].name };
if (g_GameAttributes.settings.PlayerData[g_PlayerAssignments[guid].player - 1])
++connectedPlayers;
else
pData.Team = "observer";
playerData.push(pData);
}
return {
"list": playerDataToStringifiedTeamList(playerData),
"connectedPlayers": connectedPlayers
};
}
}
/**
* Send the current gamesettings to the lobby bot if the settings didn't change for this number of milliseconds.
*/
GameRegisterStanza.prototype.Timeout = 2000;
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/NetMessages/NetMessages.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/NetMessages/NetMessages.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/NetMessages/NetMessages.js (revision 23413)
@@ -1,71 +1,71 @@
/**
* This class enables other classes to subscribe to specific CNetMessage types (see NetMessage.h, NetMessages.h) sent by the CNetServer.
*/
class NetMessages
{
- constructor(gamesetupPage)
+ constructor(setupWindow)
{
this.netMessageHandlers = {};
for (let messageType of this.MessageTypes)
this.netMessageHandlers[messageType] = new Set();
this.registerNetMessageHandler("netwarn", addNetworkWarning);
Engine.GetGUIObjectByName("netMessages").onTick = this.onTick.bind(this);
- gamesetupPage.registerClosePageHandler(this.onClosePage.bind(this));
+ setupWindow.registerClosePageHandler(this.onClosePage.bind(this));
}
registerNetMessageHandler(messageType, handler)
{
if (this.netMessageHandlers[messageType])
this.netMessageHandlers[messageType].add(handler);
else
error("Unknown net message type: " + uneval(messageType));
}
unregisterNetMessageHandler(messageType, handler)
{
if (this.netMessageHandlers[messageType])
this.netMessageHandlers[messageType].delete(handler);
else
error("Unknown net message type: " + uneval(messageType));
}
onTick()
{
while (true)
{
let message = Engine.PollNetworkClient();
if (!message)
break;
log("Net message: " + uneval(message));
if (this.netMessageHandlers[message.type])
for (let handler of this.netMessageHandlers[message.type])
handler(message);
else
error("Unrecognized net message type " + message.type);
}
}
onClosePage()
{
Engine.DisconnectNetworkGame();
}
}
/**
* Messages types are present here if and only if they are sent by NetClient.cpp.
*/
NetMessages.prototype.MessageTypes = [
"chat",
"ready",
"gamesetup",
"kicked",
"netstatus",
"netwarn",
"players",
"start"
];
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControl.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControl.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControl.js (revision 23413)
@@ -0,0 +1,178 @@
+/**
+ * The GameSettingControl is an abstract class that is inherited by gamesetting control classes specific to a GUI object type,
+ * such as the GameSettingControlCheckbox or GameSettingControlDropdown.
+ *
+ * These classes are abstract classes too and are implemented by each handler class specific to one logical setting of g_GameAttributes.
+ * The purpose of these classes is to control precisely one logical setting of g_GameAttributes.
+ * Having one class per logical setting allows to handle each setting without making a restriction as to how the property should be written to g_GameAttributes or g_PlayerAssignments.
+ * The base classes allow implementing that while avoiding duplication.
+ *
+ * A GameSettingControl may depend on and read from other g_GameAttribute values,
+ * but the class instance is to be the sole instance writing to its setting value in g_GameAttributes and
+ * shall not write to setting values of other logical settings.
+ *
+ * The derived classes shall not make assumptions on the validity of g_GameAttributes,
+ * sanitize or delete their value if it is incompatible.
+ *
+ * A class should only write values to g_GameAttributes that it itself has confirmed to be accurate.
+ * This means that handlers may not copy an entire object or array of values, for example on mapchange.
+ * This avoids writing a setting value to g_GameAttributes that is not tracked and deleted when it becomes invalid.
+ *
+ * Since GameSettingControls shall be able to subscribe to g_GameAttributes changes,
+ * it is an obligation of the derived GameSettingControl class to broadcast the GameAttributesChange event each time it changes g_GameAttributes.
+ */
+class GameSettingControl
+{
+ // The constructor and inherited constructors shall not modify game attributes,
+ // since all GameSettingControl shall be able to subscribe to any gamesetting change.
+ constructor(gameSettingControlManager, category, playerIndex, setupWindow, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl)
+ {
+ // Store arguments
+ {
+ this.category = category;
+ if (playerIndex !== undefined)
+ this.playerIndex = playerIndex;
+ this.setupWindow = setupWindow;
+ this.gameSettingsControl = gameSettingsControl;
+ this.mapCache = mapCache;
+ this.mapFilters = mapFilters;
+ this.netMessages = netMessages;
+ this.playerAssignmentsControl = playerAssignmentsControl;
+ }
+
+ // enabled and hidden should only be modified through their setters or
+ // by calling updateVisibility after modification.
+ this.enabled = true;
+ this.hidden = false;
+
+ if (this.setControl)
+ this.setControl(gameSettingControlManager);
+
+ // This variable also used for autocompleting chat.
+ this.autocompleteTitle = undefined;
+
+ if (this.title && this.TitleCaption)
+ this.setTitle(this.TitleCaption);
+
+ if (this.Tooltip)
+ this.setTooltip(this.Tooltip);
+
+ this.setHidden(false);
+
+ if (this.onMapChange)
+ gameSettingsControl.registerMapChangeHandler(this.onMapChange.bind(this));
+
+ if (this.onLoad)
+ setupWindow.registerLoadHandler(this.onLoad.bind(this));
+
+ if (this.onGameAttributesChange)
+ gameSettingsControl.registerGameAttributesChangeHandler(this.onGameAttributesChange.bind(this));
+
+ if (this.onGameAttributesBatchChange)
+ gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
+
+ if (this.onAssignPlayer && this.playerIndex === 0)
+ this.gameSettingsControl.registerAssignPlayerHandler(this.onAssignPlayer.bind(this));
+
+ if (this.onPickRandomItems)
+ gameSettingsControl.registerPickRandomItemsHandler(this.onPickRandomItems.bind(this));
+
+ if (this.onGameAttributesFinalize)
+ gameSettingsControl.registerGameAttributesFinalizeHandler(this.onGameAttributesFinalize.bind(this));
+
+ if (this.onPlayerAssignmentsChange)
+ playerAssignmentsControl.registerPlayerAssignmentsChangeHandler(this.onPlayerAssignmentsChange.bind(this));
+ }
+
+ setTitle(titleCaption)
+ {
+ this.autocompleteTitle = titleCaption;
+ this.title.caption = sprintf(this.TitleCaptionFormat, {
+ "setting": titleCaption
+ });
+ }
+
+ setTooltip(tooltip)
+ {
+ if (this.title)
+ this.title.tooltip = tooltip;
+
+ if (this.label)
+ this.label.tooltip = tooltip;
+
+ if (this.setControlTooltip)
+ this.setControlTooltip(tooltip);
+ }
+
+ /**
+ * Do not call functions calling updateVisibility onMapChange but onGameAttributesChange,
+ * so that changes take effect when increasing the playercount as well.
+ */
+ setEnabled(enabled)
+ {
+ this.enabled = enabled;
+ this.updateVisibility();
+ }
+
+ setHidden(hidden)
+ {
+ this.hidden = hidden;
+ this.updateVisibility();
+ }
+
+ updateVisibility()
+ {
+ let hidden =
+ this.hidden ||
+ this.playerIndex === undefined &&
+ this.category != g_TabCategorySelected ||
+ this.playerIndex !== undefined &&
+ g_GameAttributes.settings && this.playerIndex >= g_GameAttributes.settings.PlayerData.length;
+
+ if (this.frame)
+ this.frame.hidden = hidden;
+
+ if (hidden)
+ return;
+
+ let enabled = g_IsController && this.enabled;
+
+ if (this.setControlHidden)
+ this.setControlHidden(!enabled);
+
+ if (this.label)
+ this.label.hidden = !!enabled;
+ }
+
+ /**
+ * Returns whether the control specifies an order but didn't implement the function.
+ */
+ addAutocompleteEntries(name, autocomplete)
+ {
+ if (this.autocompleteTitle)
+ autocomplete[0].push(this.autocompleteTitle);
+
+ if (!Number.isInteger(this.AutocompleteOrder))
+ return;
+
+ if (!this.getAutocompleteEntries)
+ {
+ error(name + " specifies AutocompleteOrder but didn't implement getAutocompleteEntries");
+ return;
+ }
+
+ let newEntries = this.getAutocompleteEntries();
+ if (newEntries)
+ autocomplete[this.AutocompleteOrder] =
+ (autocomplete[this.AutocompleteOrder] || []).concat(newEntries);
+ }
+}
+
+GameSettingControl.prototype.TitleCaptionFormat =
+ translateWithContext("Title for specific setting", "%(setting)s:");
+
+/**
+ * Derived classes can set this to a number to enable chat autocompleting of setting values.
+ * Higher numbers are autocompleted first.
+ */
+GameSettingControl.prototype.AutocompleteOrder = undefined;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControl.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.xml (revision 23413)
@@ -0,0 +1,14 @@
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.xml (revision 23413)
@@ -0,0 +1,14 @@
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlManager.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlManager.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlManager.js (revision 23413)
@@ -0,0 +1,64 @@
+/**
+ * Each property of this class is a class that inherits GameSettingControl and is
+ * instantiated by the GameSettingControlManager.
+ */
+class GameSettingControls
+{
+}
+
+/**
+ * The GameSettingControlManager owns all classes that handle a logical property of g_GameAttributes.
+ */
+class GameSettingControlManager
+{
+ constructor(setupWindow, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl)
+ {
+ this.rows = {};
+ this.gameSettingControls = {};
+
+ let args = Array.from(arguments);
+
+ let getCategory = name =>
+ g_GameSettingsLayout.findIndex(category => category.settings.indexOf(name) != -1);
+
+ for (let name in GameSettingControls)
+ this.gameSettingControls[name] =
+ new GameSettingControls[name](
+ this, getCategory(name), undefined, ...args);
+
+ for (let victoryCondition of g_VictoryConditions)
+ this.gameSettingControls[victoryCondition.Name] =
+ new VictoryConditionCheckbox(
+ victoryCondition, this, getCategory(victoryCondition.Name), undefined, ...args);
+
+ this.playerSettingControlManagers = Array.from(
+ new Array(g_MaxPlayers),
+ (value, playerIndex) =>
+ new PlayerSettingControlManager(playerIndex, ...args));
+ }
+
+ getNextRow(name)
+ {
+ if (this.rows[name] === undefined)
+ this.rows[name] = 0;
+ else
+ ++this.rows[name];
+
+ return this.rows[name];
+ }
+
+ updateSettingVisibility()
+ {
+ for (let name in this.gameSettingControls)
+ this.gameSettingControls[name].updateVisibility();
+ }
+
+ addAutocompleteEntries(entries)
+ {
+ for (let name in this.gameSettingControls)
+ this.gameSettingControls[name].addAutocompleteEntries(name, entries);
+
+ for (let playerSettingControlManager of this.playerSettingControlManagers)
+ playerSettingControlManager.addAutocompleteEntries(entries);
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlManager.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PlayerSettingControlManager.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PlayerSettingControlManager.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PlayerSettingControlManager.js (revision 23413)
@@ -0,0 +1,29 @@
+/**
+ * Each property of this class is a class that inherits GameSettingControl and is
+ * instantiated by the PlayerSettingControlManager.
+ */
+class PlayerSettingControls
+{
+}
+
+/**
+ * The purpose of the PlayerSettingControlManager is to own all controls that handle a property of g_GameAttributes.settings.PlayerData.
+ */
+class PlayerSettingControlManager
+{
+ constructor(playerIndex, setupWindow, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl)
+ {
+ this.playerSettingControls = {};
+
+ for (let name in PlayerSettingControls)
+ this.playerSettingControls[name] =
+ new PlayerSettingControls[name](
+ undefined, undefined, playerIndex, setupWindow, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl);
+ }
+
+ addAutocompleteEntries(autocomplete)
+ {
+ for (let name in this.playerSettingControls)
+ this.playerSettingControls[name].addAutocompleteEntries(name, autocomplete);
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PlayerSettingControlManager.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Landscape.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Landscape.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Landscape.js (revision 23413)
@@ -0,0 +1,148 @@
+GameSettingControls.Landscape = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = undefined;
+ this.lastLandscape = undefined;
+ this.mapData = undefined;
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ this.mapData = mapData;
+
+ if (mapData && mapData.settings && mapData.settings.Landscapes)
+ {
+ let randomItems = [];
+ for (let item of this.RandomItems)
+ if (item.Id == "random" || mapData.settings.Landscapes.land && mapData.settings.Landscapes.naval)
+ randomItems.push({
+ "Id": item.Id,
+ "Name": setStringTags(item.Name, this.RandomItemTags),
+ "Description": item.Description,
+ "Preview": mapData.settings.Preview || this.mapCache.DefaultPreview
+ });
+
+ let sort = (item1, item2) => item1.Name > item2.Name;
+
+ this.values = prepareForDropdown([
+ ...randomItems,
+ ...mapData.settings.Landscapes.land.sort(sort),
+ ...mapData.settings.Landscapes.naval.sort(sort)
+ ]);
+
+ this.dropdown.list = this.values.Name;
+ this.dropdown.list_data = this.values.Id;
+ }
+ else
+ this.values = undefined;
+
+ this.lastLandscape = undefined;
+
+ this.setHidden(!this.values);
+ }
+
+ onGameAttributesChange()
+ {
+ if (this.values)
+ {
+ if (this.values.Id.indexOf(g_GameAttributes.settings.Landscape || undefined) == -1)
+ {
+ g_GameAttributes.settings.Landscape = "random";
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ if (this.lastLandscape != g_GameAttributes.settings.Landscape)
+ {
+ g_GameAttributes.settings.Preview = this.values.Preview[this.values.Id.indexOf(g_GameAttributes.settings.Landscape)];
+ this.lastLandscape = g_GameAttributes.settings.Biome;
+ }
+ }
+ else if (g_GameAttributes.settings.Landscape !== undefined)
+ {
+ delete g_GameAttributes.settings.Landscape;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (g_GameAttributes.settings.Landscape)
+ this.setSelectedValue(g_GameAttributes.settings.Landscape);
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values.Name;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.Landscape = this.values.Id[itemIdx];
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ onPickRandomItems()
+ {
+ if (!this.mapData)
+ return;
+
+ let items;
+ let landscapes = this.mapData.settings.Landscapes;
+
+ switch (g_GameAttributes.settings.Landscape || undefined)
+ {
+ case "random":
+ items = [...landscapes.land, ...landscapes.naval];
+ break;
+ case "random_land":
+ items = landscapes.land;
+ break;
+ case "random_naval":
+ items = landscapes.naval;
+ break;
+ default:
+ return;
+ }
+
+ g_GameAttributes.settings.Landscape = pickRandom(items).Id;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.pickRandomItems();
+ }
+};
+
+GameSettingControls.Landscape.prototype.TitleCaption =
+ translate("Landscape");
+
+GameSettingControls.Landscape.prototype.Tooltip =
+ translate("Select one of the landscapes of this map.");
+
+GameSettingControls.Landscape.prototype.RandomItems =
+[
+ {
+ "Id": "random",
+ "Name": translateWithContext("landscape selection", "Random Land or Naval"),
+ "Description": translateWithContext("landscape selection", "Select a random land or naval map generation.")
+ },
+ {
+ "Id": "random_land",
+ "Name": translateWithContext("landscape selection", "Random Land"),
+ "Description": translateWithContext("landscape selection", "Select a random land map generation.")
+ },
+ {
+ "Id": "random_naval",
+ "Name": translateWithContext("landscape selection", "Random Naval"),
+ "Description": translateWithContext("landscape selection", "Select a random naval map generation.")
+ }
+];
+
+GameSettingControls.Landscape.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Landscape.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicCount.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicCount.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicCount.js (revision 23413)
@@ -0,0 +1,86 @@
+GameSettingControls.RelicCount = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = Object.keys(g_CivData).map((v, i) => i + 1);
+
+ this.dropdown.list = this.values;
+ this.dropdown.list_data = this.values;
+
+ this.available = false;
+ }
+
+ onMapChange(mapData)
+ {
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.VictoryConditions &&
+ mapData.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1 &&
+ mapData.settings.RelicCount || undefined;
+
+ if (mapValue === undefined || mapValue == g_GameAttributes.settings.RelicCount)
+ return;
+
+ if (!g_GameAttributes.settings.VictoryConditions)
+ g_GameAttributes.settings.VictoryConditions = [];
+
+ if (g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) == -1)
+ g_GameAttributes.settings.VictoryConditions.push(this.NameCaptureTheRelic);
+
+ g_GameAttributes.settings.RelicCount = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.settings.VictoryConditions)
+ return;
+
+ this.available = g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1;
+
+ if (this.available)
+ {
+ if (g_GameAttributes.settings.RelicCount === undefined)
+ {
+ g_GameAttributes.settings.RelicCount = this.DefaultRelicCount;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.RelicCount !== undefined)
+ {
+ delete g_GameAttributes.settings.RelicCount;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setHidden(!this.available);
+
+ if (this.available)
+ this.setSelectedValue(g_GameAttributes.settings.RelicCount);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.RelicCount = this.values[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.RelicCount.prototype.TitleCaption =
+ translate("Relic Count");
+
+GameSettingControls.RelicCount.prototype.Tooltip =
+ translate("Total number of relics spawned on the map. Relic victory is most realistic with only one or two relics. With greater numbers, the relics are important to capture to receive aura bonuses.");
+
+GameSettingControls.RelicCount.prototype.NameCaptureTheRelic =
+ "capture_the_relic";
+
+GameSettingControls.RelicCount.prototype.DefaultRelicCount = 2;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicCount.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Biome.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Biome.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Biome.js (revision 23413)
@@ -0,0 +1,149 @@
+GameSettingControls.Biome = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = undefined;
+ this.biomeValues = undefined;
+
+ this.lastBiome = undefined;
+
+ this.randomItem = {
+ "Id": this.RandomBiomeId,
+ "Title": setStringTags(this.RandomBiome, this.RandomItemTags),
+ "Autocomplete": this.RandomBiome,
+ "Description": this.RandomDescription
+ };
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip =
+ this.values && this.values.Description && this.values.Description[this.dropdown.hovered] ||
+ this.Tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ let available = g_GameAttributes.mapType == "random" &&
+ mapData && mapData.settings && mapData.settings.SupportedBiomes || undefined;
+
+ this.setHidden(!available);
+
+ if (available)
+ {
+ Engine.ProfileStart("updateBiomeList");
+ this.biomeValues =
+ g_Settings.Biomes.filter(this.filterBiome(available)).map(this.createBiomeItem);
+
+ this.values = prepareForDropdown([
+ this.randomItem,
+ ...this.biomeValues
+ ]);
+
+ this.dropdown.list = this.values.Title;
+ this.dropdown.list_data = this.values.Id;
+ Engine.ProfileStop();
+ }
+ else
+ this.values = undefined;
+
+ this.lastBiome = undefined;
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType || !g_GameAttributes.map)
+ return;
+
+ if (this.values)
+ {
+ if (this.values.Id.indexOf(g_GameAttributes.settings.Biome || undefined) == -1)
+ {
+ g_GameAttributes.settings.Biome = this.RandomBiomeId;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ if (this.lastBiome != g_GameAttributes.settings.Biome)
+ {
+ let biomePreviewFile =
+ basename(g_GameAttributes.map) + "_" +
+ basename(g_GameAttributes.settings.Biome || "") + ".png";
+
+ if (Engine.TextureExists(this.mapCache.TexturesPath + this.mapCache.PreviewsPath + biomePreviewFile))
+ g_GameAttributes.settings.Preview = biomePreviewFile;
+
+ this.lastBiome = g_GameAttributes.settings.Biome;
+ }
+ }
+ else if (g_GameAttributes.settings.Biome)
+ {
+ delete g_GameAttributes.settings.Biome;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (this.values)
+ this.setSelectedValue(g_GameAttributes.settings.Biome);
+ }
+
+ filterBiome(available)
+ {
+ if (typeof available == "string")
+ return biome => biome.Id.startsWith(available);
+
+ return biome => available.indexOf(biome.Id) != -1;
+ }
+
+ createBiomeItem(biome)
+ {
+ return {
+ "Id": biome.Id,
+ "Title": biome.Title,
+ "Autocomplete": biome.Title,
+ "Description": biome.Description
+ };
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values && this.values.Autocomplete;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.Biome = this.values.Id[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ onPickRandomItems()
+ {
+ if (this.values && g_GameAttributes.settings.Biome == this.RandomBiomeId)
+ {
+ g_GameAttributes.settings.Biome = pickRandom(this.biomeValues).Id;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.pickRandomItems();
+ }
+ }
+};
+
+GameSettingControls.Biome.prototype.TitleCaption =
+ translate("Biome");
+
+GameSettingControls.Biome.prototype.RandomBiomeId =
+ "random";
+
+GameSettingControls.Biome.prototype.Tooltip =
+ translate("Select the flora and fauna.");
+
+GameSettingControls.Biome.prototype.RandomBiome =
+ translateWithContext("biome", "Random");
+
+GameSettingControls.Biome.prototype.RandomDescription =
+ translate("Pick a biome at random.");
+
+GameSettingControls.Biome.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Biome.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Daytime.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Daytime.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Daytime.js (revision 23413)
@@ -0,0 +1,107 @@
+GameSettingControls.Daytime = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = undefined;
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ if (mapData && mapData.settings && mapData.settings.Daytime)
+ {
+ this.values = prepareForDropdown([
+ {
+ "Id": "random",
+ "Name": setStringTags(this.RandomTitle, this.RandomItemTags),
+ "Description": this.RandomDescription,
+ "Preview": mapData.settings.Preview
+ },
+ ...mapData.settings.Daytime
+ ]);
+
+ this.dropdown.list = this.values.Name;
+ this.dropdown.list_data = this.values.Id;
+ }
+ else
+ this.values = undefined;
+
+ this.setHidden(!this.values);
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.map)
+ return;
+
+ if (this.values)
+ {
+ if (this.values.Id.indexOf(g_GameAttributes.settings.Daytime || undefined) == -1)
+ {
+ g_GameAttributes.settings.Daytime = "random";
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ let preview = this.values.Preview[this.values.Id.indexOf(g_GameAttributes.settings.Daytime)];
+ if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != preview)
+ {
+ g_GameAttributes.settings.Preview = preview;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.Daytime !== undefined)
+ {
+ delete g_GameAttributes.settings.Daytime;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (g_GameAttributes.settings.Daytime)
+ this.setSelectedValue(g_GameAttributes.settings.Daytime);
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values.Name;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.Daytime = this.values.Id[itemIdx];
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ onPickRandomItems()
+ {
+ if (this.values && g_GameAttributes.settings.Daytime == "random")
+ {
+ g_GameAttributes.settings.Daytime = pickRandom(this.values.Id.slice(1));
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.pickRandomItems();
+ }
+ }
+};
+
+GameSettingControls.Daytime.prototype.TitleCaption =
+ translate("Daytime");
+
+GameSettingControls.Daytime.prototype.Tooltip =
+ translate("Select whether the match takes place at daylight or night.");
+
+GameSettingControls.Daytime.prototype.RandomTitle =
+ translateWithContext("daytime selection", "Random");
+
+GameSettingControls.Daytime.prototype.RandomDescription =
+ translateWithContext("daytime selection", "Randomly pick a time of the day.");
+
+GameSettingControls.Daytime.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Daytime.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Ceasefire.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Ceasefire.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Ceasefire.js (revision 23413)
@@ -0,0 +1,55 @@
+GameSettingControls.Ceasefire = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = prepareForDropdown(g_Settings.Ceasefire);
+
+ this.dropdown.list = this.values.Title;
+ this.dropdown.list_data = this.values.Duration;
+ }
+
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.Ceasefire || undefined;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.Ceasefire)
+ {
+ g_GameAttributes.settings.Ceasefire = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_GameAttributes.settings.Ceasefire == undefined)
+ {
+ g_GameAttributes.settings.Ceasefire = this.values.Default;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setSelectedValue(g_GameAttributes.settings.Ceasefire);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.Ceasefire = this.values.Duration[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.Ceasefire.prototype.TitleCaption =
+ translate("Ceasefire");
+
+GameSettingControls.Ceasefire.prototype.Tooltip =
+ translate("Set time where no attacks are possible.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/Ceasefire.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/GameSpeed.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/GameSpeed.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/GameSpeed.js (revision 23413)
@@ -0,0 +1,76 @@
+GameSettingControls.GameSpeed = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.previousAllowFastForward = undefined;
+ }
+
+ onMapChange(mapData)
+ {
+ let mapValue = mapData && mapData.gameSpeed || undefined;
+ if (mapValue !== undefined && mapValue != g_GameAttributes.gameSpeed)
+ {
+ g_GameAttributes.gameSpeed = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onPlayerAssignmentsChange()
+ {
+ this.update();
+ }
+
+ onGameAttributesChange()
+ {
+ this.update();
+ }
+
+ update()
+ {
+ let allowFastForward = true;
+ for (let guid in g_PlayerAssignments)
+ if (g_PlayerAssignments[guid].player != -1)
+ {
+ allowFastForward = false;
+ break;
+ }
+
+ if (this.previousAllowFastForward !== allowFastForward)
+ {
+ Engine.ProfileStart("updateGameSpeedList");
+ this.previousAllowFastForward = allowFastForward;
+ this.values = prepareForDropdown(
+ g_Settings.GameSpeeds.filter(speed => !speed.FastForward || allowFastForward));
+
+ this.dropdown.list = this.values.Title;
+ this.dropdown.list_data = this.values.Speed;
+ Engine.ProfileStop();
+ }
+
+ if (this.values.Speed.indexOf(g_GameAttributes.gameSpeed || undefined) == -1)
+ {
+ g_GameAttributes.gameSpeed = this.values.Speed[this.values.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setSelectedValue(g_GameAttributes.gameSpeed);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.gameSpeed = this.values.Speed[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.GameSpeed.prototype.TitleCaption =
+ translate("Game Speed");
+
+GameSettingControls.GameSpeed.prototype.Tooltip =
+ translate("Select game speed.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/GameSpeed.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapFilter.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapFilter.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapFilter.js (revision 23413)
@@ -0,0 +1,94 @@
+GameSettingControls.MapFilter = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = undefined;
+ this.previousMapType = undefined;
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = this.values.Description[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onGameAttributesChange()
+ {
+ this.checkMapTypeChange();
+
+ if (this.values)
+ {
+ if (this.values.Name.indexOf(g_GameAttributes.mapFilter || undefined) == -1)
+ {
+ g_GameAttributes.mapFilter = this.values.Name[this.values.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.mapFilter !== undefined)
+ {
+ delete g_GameAttributes.mapFilter;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ checkMapTypeChange()
+ {
+ if (!g_GameAttributes.mapType || this.previousMapType == g_GameAttributes.mapType)
+ return;
+
+ Engine.ProfileStart("updateMapFilterList");
+ this.previousMapType = g_GameAttributes.mapType;
+
+ let values = prepareForDropdown(
+ this.mapFilters.getAvailableMapFilters(
+ g_GameAttributes.mapType));
+
+ if (values.Name.length)
+ {
+ this.dropdown.list = values.Title;
+ this.dropdown.list_data = values.Name;
+ this.values = values;
+ }
+ else
+ this.values = undefined;
+
+ this.setHidden(!this.values);
+ Engine.ProfileStop();
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (this.values && g_GameAttributes.mapFilter)
+ this.setSelectedValue(g_GameAttributes.mapFilter);
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values && this.values.Title;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ if (this.values)
+ {
+ g_GameAttributes.mapFilter = this.values.Name[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+ }
+
+ onGameAttributesFinalize()
+ {
+ // The setting is only relevant to the gamesetup stage!
+ delete g_GameAttributes.mapFilter;
+ }
+};
+
+GameSettingControls.MapFilter.prototype.TitleCaption =
+ translate("Map Filter");
+
+GameSettingControls.MapFilter.prototype.Tooltip =
+ translate("Select a map filter.");
+
+GameSettingControls.MapFilter.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapFilter.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSelection.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSelection.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSelection.js (revision 23413)
@@ -0,0 +1,171 @@
+GameSettingControls.MapSelection = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = undefined;
+
+ this.previousMapType = undefined;
+ this.previousMapFilter = undefined;
+
+ this.randomItem = {
+ "file": this.RandomMapId,
+ "name": setStringTags(this.RandomMapCaption, this.RandomItemTags),
+ "description": this.RandomMapDescription
+ };
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = this.values.description[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType || !g_GameAttributes.mapFilter)
+ return;
+
+ this.updateMapList();
+
+ if (!this.gameSettingsControl.autostart &&
+ this.values &&
+ this.values.file.indexOf(g_GameAttributes.map || undefined) == -1)
+ {
+ g_GameAttributes.map = this.values.file[0];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (g_GameAttributes.map)
+ this.setSelectedValue(g_GameAttributes.map);
+ }
+
+ updateMapList()
+ {
+ if (this.previousMapType &&
+ this.previousMapType == g_GameAttributes.mapType &&
+ this.previousMapFilter &&
+ this.previousMapFilter == g_GameAttributes.mapFilter)
+ return;
+
+ Engine.ProfileStart("updateMapSelectionList");
+
+ this.previousMapType = g_GameAttributes.mapType;
+ this.previousMapFilter = g_GameAttributes.mapFilter;
+
+ {
+ let values =
+ this.mapFilters.getFilteredMaps(
+ g_GameAttributes.mapType,
+ g_GameAttributes.mapFilter,
+ false);
+
+ values.sort(sortNameIgnoreCase);
+
+ if (g_GameAttributes.mapType == "random")
+ values.unshift(this.randomItem);
+
+ this.values = prepareForDropdown(values);
+ }
+
+ this.dropdown.list = this.values.name;
+ this.dropdown.list_data = this.values.file;
+ Engine.ProfileStop();
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ this.selectMap(this.values.file[itemIdx]);
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ /**
+ * @param mapPath - for example "maps/skirmishes/Acropolis Bay (2)"
+ */
+ selectMap(mapPath)
+ {
+ if (g_GameAttributes.map == mapPath)
+ return;
+
+ Engine.ProfileStart("selectMap");
+
+ // For scenario map, reset every setting per map selection
+ // For skirmish and random maps, persist player choices
+ if (g_GameAttributes.mapType == "scenario")
+ g_GameAttributes = {
+ "mapType": g_GameAttributes.mapType,
+ "mapFilter": g_GameAttributes.mapFilter
+ };
+
+ g_GameAttributes.map = mapPath;
+ this.gameSettingsControl.updateGameAttributes();
+
+ Engine.ProfileStop();
+ }
+
+ getAutocompleteEntries()
+ {
+ return this.values.name;
+ }
+
+ onPickRandomItems()
+ {
+ if (g_GameAttributes.map == this.RandomMapId)
+ {
+ this.selectMap(pickRandom(this.values.file.slice(1)));
+ this.gameSettingsControl.pickRandomItems();
+ }
+ }
+
+ onGameAttributesFinalize()
+ {
+ // Copy map well known properties (and only well known properties)
+ let mapData = this.mapCache.getMapData(g_GameAttributes.mapType, g_GameAttributes.map);
+
+ g_GameAttributes.settings.CircularMap =
+ mapData.settings.CircularMap || true;
+
+ if (g_GameAttributes.mapType == "random")
+ g_GameAttributes.script = mapData.settings.Script;
+
+ g_GameAttributes.settings.TriggerScripts = Array.from(new Set([
+ ...(g_GameAttributes.settings.TriggerScripts || []),
+ ...(mapData.settings.TriggerScripts || [])
+ ]));
+
+ for (let property of this.MapSettings)
+ if (mapData.settings[property] !== undefined)
+ g_GameAttributes.settings[property] = mapData.settings[property];
+ }
+};
+
+GameSettingControls.MapSelection.prototype.TitleCaption =
+ translate("Select Map");
+
+GameSettingControls.MapSelection.prototype.Tooltip =
+ translate("Select a map to play on.");
+
+GameSettingControls.MapSelection.prototype.RandomMapId =
+ "random";
+
+GameSettingControls.MapSelection.prototype.RandomMapCaption =
+ translateWithContext("map selection", "Random");
+
+GameSettingControls.MapSelection.prototype.RandomMapDescription =
+ translate("Pick any of the given maps at random.");
+
+GameSettingControls.MapSelection.prototype.AutocompleteOrder = 0;
+
+GameSettingControls.MapSelection.prototype.MapSettings = [
+ "StartingTechnologies",
+ "DisabledTechnologies",
+ "DisabledTemplates",
+ "StartingCamera",
+ "Garrison",
+ // Copy the map name so that the replay menu doesn't have to load hundreds of map descriptions on init
+ // Also it allows determining the english mapname from the replay file if the map is not available.
+ "Name"
+];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSelection.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSize.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSize.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSize.js (revision 23413)
@@ -0,0 +1,79 @@
+GameSettingControls.MapSize = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.previousMapType = undefined;
+
+ this.dropdown.list = g_MapSizes.Name;
+ this.dropdown.list_data = g_MapSizes.Tiles;
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = g_MapSizes.Tooltip[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.Size || undefined;
+
+ if (g_GameAttributes.mapType == "random" && mapValue !== undefined && mapValue != g_GameAttributes.settings.Size)
+ {
+ g_GameAttributes.settings.Size = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType ||
+ !g_GameAttributes.settings ||
+ this.previousMapType == g_GameAttributes.mapType)
+ return;
+
+ this.previousMapType = g_GameAttributes.mapType;
+
+ let available = g_GameAttributes.mapType == "random";
+ this.setHidden(!available);
+
+ if (available)
+ {
+ if (g_GameAttributes.settings.Size === undefined)
+ {
+ g_GameAttributes.settings.Size = g_MapSizes.Tiles[g_MapSizes.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ this.setSelectedValue(g_GameAttributes.settings.Size);
+ }
+ else if (g_GameAttributes.settings.Size !== undefined)
+ {
+ delete g_GameAttributes.settings.Size;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ getAutocompleteEntries()
+ {
+ return g_MapSizes.Name;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.Size = g_MapSizes.Tiles[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.MapSize.prototype.TitleCaption =
+ translate("Map Size");
+
+GameSettingControls.MapSize.prototype.Tooltip =
+ translate("Select map size. (Larger sizes may reduce performance.)");
+
+GameSettingControls.MapSize.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapSize.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapType.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapType.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapType.js (revision 23413)
@@ -0,0 +1,66 @@
+/**
+ * Maptype design:
+ * Scenario maps have fixed terrain and all settings predetermined.
+ * Skirmish maps have fixed terrain, playercount but settings are free.
+ * For random maps, settings are fully determined by the player and the terrain is generated based on them.
+ */
+GameSettingControls.MapType = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.dropdown.list = g_MapTypes.Title;
+ this.dropdown.list_data = g_MapTypes.Name;
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip = g_MapTypes.Description[this.dropdown.hovered] || this.Tooltip;
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_MapTypes.Name.indexOf(g_GameAttributes.mapType || undefined) == -1)
+ {
+ g_GameAttributes.mapType = g_MapTypes.Name[g_MapTypes.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setSelectedValue(g_GameAttributes.mapType);
+ }
+
+ getAutocompleteEntries()
+ {
+ return g_MapTypes.Title;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ let mapType = g_MapTypes.Name[itemIdx];
+
+ if (g_GameAttributes.mapType == mapType)
+ return;
+
+ if (mapType == "scenario")
+ g_GameAttributes = {
+ "mapFilter": g_GameAttributes.mapFilter
+ };
+
+ g_GameAttributes.mapType = mapType;
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.MapType.prototype.TitleCaption =
+ translate("Map Type");
+
+GameSettingControls.MapType.prototype.Tooltip =
+ translate("Select a map type.");
+
+GameSettingControls.MapType.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/MapType.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PlayerCount.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PlayerCount.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PlayerCount.js (revision 23413)
@@ -0,0 +1,52 @@
+GameSettingControls.PlayerCount = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = Array.from(
+ new Array(g_MaxPlayers),
+ (v, i) => i + 1);
+
+ this.dropdown.list = this.values;
+ this.dropdown.list_data = this.values;
+ }
+
+ onMapChange(mapData)
+ {
+ if (mapData &&
+ mapData.settings &&
+ mapData.settings.PlayerData &&
+ mapData.settings.PlayerData.length != g_GameAttributes.settings.PlayerData.length)
+ {
+ this.onSelectionChange(this.values.indexOf(mapData.settings.PlayerData.length));
+ }
+
+ this.setEnabled(g_GameAttributes.mapType == "random");
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setSelectedValue(g_GameAttributes.settings.PlayerData.length);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ let length = this.values[itemIdx];
+ if (g_GameAttributes.settings.PlayerData.length == length)
+ return;
+
+ g_GameAttributes.settings.PlayerData.length = length;
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+
+ this.playerAssignmentsControl.unassignInvalidPlayers();
+ }
+};
+
+GameSettingControls.PlayerCount.prototype.TitleCaption =
+ translate("Number of Players");
+
+GameSettingControls.PlayerCount.prototype.Tooltip =
+ translate("Select number of players.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PlayerCount.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PopulationCap.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PopulationCap.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PopulationCap.js (revision 23413)
@@ -0,0 +1,101 @@
+GameSettingControls.PopulationCap = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.perPlayer = false;
+
+ this.dropdown.list = g_PopulationCapacities.Title;
+ this.dropdown.list_data = g_PopulationCapacities.Population;
+
+ this.sprintfArgs = {};
+ }
+
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.PopulationCap || undefined;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.PopulationCap)
+ {
+ g_GameAttributes.settings.PopulationCap = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ let isScenario = g_GameAttributes.mapType == "scenario";
+
+ this.perPlayer =
+ isScenario &&
+ mapData.settings.PlayerData &&
+ mapData.settings.PlayerData.some(pData => pData && pData.PopulationLimit !== undefined);
+
+ this.setEnabled(!isScenario && !this.perPlayer);
+
+ if (this.perPlayer)
+ this.label.caption = this.PerPlayerCaption;
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_GameAttributes.settings.PopulationCap === undefined)
+ {
+ g_GameAttributes.settings.PopulationCap = g_PopulationCapacities.Population[g_PopulationCapacities.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!this.perPlayer)
+ this.setSelectedValue(g_GameAttributes.settings.PopulationCap);
+ }
+
+ onHoverChange()
+ {
+ let tooltip = this.Tooltip;
+ if (this.dropdown.hovered != -1)
+ {
+ let popCap = g_PopulationCapacities.Population[this.dropdown.hovered];
+ let players = g_GameAttributes.settings.PlayerData.length;
+ if (popCap * players >= this.PopulationCapacityRecommendation)
+ {
+ this.sprintfArgs.players = players;
+ this.sprintfArgs.popCap = popCap;
+ tooltip = setStringTags(sprintf(this.HoverTooltip, this.sprintfArgs), this.HoverTags);
+ }
+ }
+ this.dropdown.tooltip = tooltip;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.PopulationCap = g_PopulationCapacities.Population[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.PopulationCap.prototype.TitleCaption =
+ translate("Population Cap");
+
+GameSettingControls.PopulationCap.prototype.Tooltip =
+ translate("Select population limit.");
+
+GameSettingControls.PopulationCap.prototype.PerPlayerCaption =
+ translateWithContext("population limit", "Per Player");
+
+GameSettingControls.PopulationCap.prototype.HoverTooltip =
+ translate("Warning: There might be performance issues if all %(players)s players reach %(popCap)s population.");
+
+GameSettingControls.PopulationCap.prototype.HoverTags = {
+ "color": "orange"
+};
+
+/**
+ * Total number of units that the engine can run with smoothly.
+ * It means a 4v4 with 150 population can still run nicely, but more than that might "lag".
+ */
+GameSettingControls.PopulationCap.prototype.PopulationCapacityRecommendation = 1200;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/PopulationCap.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicDuration.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicDuration.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicDuration.js (revision 23413)
@@ -0,0 +1,85 @@
+GameSettingControls.RelicDuration = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = prepareForDropdown(g_Settings.VictoryDurations);
+
+ this.dropdown.list = this.values.Title;
+ this.dropdown.list_data = this.values.Duration;
+
+ this.available = false;
+ }
+
+ onMapChange(mapData)
+ {
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.VictoryConditions &&
+ mapData.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1 &&
+ mapData.settings.RelicDuration || undefined;
+
+ if (mapValue === undefined || mapValue == g_GameAttributes.settings.RelicDuration)
+ return;
+
+ if (!g_GameAttributes.settings.VictoryConditions)
+ g_GameAttributes.settings.VictoryConditions = [];
+
+ if (g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) == -1)
+ g_GameAttributes.settings.VictoryConditions.push(this.NameCaptureTheRelic);
+
+ g_GameAttributes.settings.RelicDuration = mapValue;
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.settings.VictoryConditions)
+ return;
+
+ this.available = g_GameAttributes.settings.VictoryConditions.indexOf(this.NameCaptureTheRelic) != -1;
+
+ if (this.available)
+ {
+ if (g_GameAttributes.settings.RelicDuration === undefined)
+ {
+ g_GameAttributes.settings.RelicDuration = this.values.Duration[this.values.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.RelicDuration !== undefined)
+ {
+ delete g_GameAttributes.settings.RelicDuration;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setHidden(!this.available);
+
+ if (this.available)
+ this.setSelectedValue(g_GameAttributes.settings.RelicDuration);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.RelicDuration = this.values.Duration[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.RelicDuration.prototype.TitleCaption =
+ translate("Relic Duration");
+
+GameSettingControls.RelicDuration.prototype.Tooltip =
+ translate("Minutes until the player has achieved Relic Victory.");
+
+GameSettingControls.RelicDuration.prototype.NameCaptureTheRelic =
+ "capture_the_relic";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/RelicDuration.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/StartingResources.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/StartingResources.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/StartingResources.js (revision 23413)
@@ -0,0 +1,92 @@
+GameSettingControls.StartingResources = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.dropdown.list = g_StartingResources.Title;
+ this.dropdown.list_data = g_StartingResources.Resources;
+
+ this.perPlayer = false;
+ this.sprintfArgs = {};
+ }
+
+ onHoverChange()
+ {
+ let tooltip = this.Tooltip;
+ if (this.dropdown.hovered != -1)
+ {
+ this.sprintfArgs.resources = g_StartingResources.Resources[this.dropdown.hovered];
+ tooltip = sprintf(this.HoverTooltip, this.sprintfArgs);
+ }
+ this.dropdown.tooltip = tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.StartingResources || undefined;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.StartingResources)
+ {
+ g_GameAttributes.settings.StartingResources = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ let isScenario = g_GameAttributes.mapType == "scenario";
+
+ this.perPlayer =
+ isScenario &&
+ mapData.settings.PlayerData &&
+ mapData.settings.PlayerData.some(pData => pData && pData.Resources !== undefined);
+
+ this.setEnabled(!isScenario && !this.perPlayer);
+
+ if (this.perPlayer)
+ this.label.caption = this.PerPlayerCaption;
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_GameAttributes.settings.StartingResources === undefined)
+ {
+ g_GameAttributes.settings.StartingResources =
+ g_StartingResources.Resources[g_StartingResources.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!this.perPlayer)
+ this.setSelectedValue(g_GameAttributes.settings.StartingResources);
+ }
+
+ getAutocompleteEntries()
+ {
+ return g_StartingResources.Title;
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.StartingResources = g_StartingResources.Resources[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.StartingResources.prototype.TitleCaption =
+ translate("Starting Resources");
+
+GameSettingControls.StartingResources.prototype.Tooltip =
+ translate("Select the game's starting resources.");
+
+GameSettingControls.StartingResources.prototype.HoverTooltip =
+ translate("Initial amount of each resource: %(resources)s.");
+
+GameSettingControls.StartingResources.prototype.PerPlayerCaption =
+ translateWithContext("starting resources", "Per Player");
+
+GameSettingControls.StartingResources.prototype.AutocompleteOrder = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/StartingResources.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/TriggerDifficulty.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/TriggerDifficulty.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/TriggerDifficulty.js (revision 23413)
@@ -0,0 +1,84 @@
+GameSettingControls.TriggerDifficulty = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.values = undefined;
+ }
+
+ onHoverChange()
+ {
+ this.dropdown.tooltip =
+ this.values && this.values.Tooltip[this.dropdown.hovered] ||
+ this.Tooltip;
+ }
+
+ onMapChange(mapData)
+ {
+ let available = mapData && mapData.settings && mapData.settings.SupportedTriggerDifficulties || undefined;
+ this.setHidden(!available);
+
+ if (available)
+ {
+ Engine.ProfileStart("updateTriggerDifficultyList");
+ let values = g_Settings.TriggerDifficulties;
+ if (Array.isArray(available.Values))
+ values = values.filter(diff => available.Values.indexOf(diff.Name) != -1);
+
+ this.values = prepareForDropdown(values);
+
+ this.dropdown.list = this.values.Title;
+ this.dropdown.list_data = this.values.Difficulty;
+
+ if (mapData.settings.TriggerDifficulty &&
+ this.values.Difficulty.indexOf(mapData.settings.TriggerDifficulty) != -1)
+ g_GameAttributes.settings.TriggerDifficulty = mapData.settings.TriggerDifficulty;
+ Engine.ProfileStop();
+ }
+ else
+ {
+ this.values = undefined;
+ this.defaultValue = undefined;
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ if (this.values)
+ {
+ if (this.values.Difficulty.indexOf(g_GameAttributes.settings.TriggerDifficulty || undefined) == -1)
+ {
+ g_GameAttributes.settings.TriggerDifficulty = this.values.Difficulty[this.values.Default];
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.TriggerDifficulty !== undefined)
+ {
+ delete g_GameAttributes.settings.TriggerDifficulty;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (this.values)
+ this.setSelectedValue(g_GameAttributes.settings.TriggerDifficulty);
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ g_GameAttributes.settings.TriggerDifficulty = this.values.Difficulty[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.TriggerDifficulty.prototype.TitleCaption =
+ translate("Difficulty");
+
+GameSettingControls.TriggerDifficulty.prototype.Tooltip =
+ translate("Select the difficulty of this scenario.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Dropdowns/TriggerDifficulty.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Cheats.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Cheats.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Cheats.js (revision 23413)
@@ -0,0 +1,43 @@
+/**
+ * Cheats are always enabled in singleplayer mode, since they are the choice of that one player.
+ */
+GameSettingControls.Cheats = class extends GameSettingControlCheckbox
+{
+ constructor(...args)
+ {
+ super(...args);
+ this.setHidden(!g_IsNetworked);
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_GameAttributes.settings.CheatsEnabled === undefined ||
+ g_GameAttributes.settings.CheatsEnabled && g_GameAttributes.settings.RatingEnabled ||
+ !g_GameAttributes.settings.CheatsEnabled && !g_IsNetworked)
+ {
+ g_GameAttributes.settings.CheatsEnabled = !g_IsNetworked;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setChecked(g_GameAttributes.settings.CheatsEnabled);
+ this.setEnabled(!g_GameAttributes.settings.RatingEnabled);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.CheatsEnabled =
+ !g_IsNetworked ||
+ checked && !g_GameAttributes.settings.RatingEnabled;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.Cheats.prototype.TitleCaption =
+ translate("Cheats");
+
+GameSettingControls.Cheats.prototype.Tooltip =
+ translate("Toggle the usability of cheats.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Cheats.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LastManStanding.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LastManStanding.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LastManStanding.js (revision 23413)
@@ -0,0 +1,61 @@
+GameSettingControls.LastManStanding = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ !mapData.settings.LockTeams &&
+ mapData.settings.LastManStanding;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.LastManStanding)
+ {
+ g_GameAttributes.settings.LastManStanding = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ this.available = !g_GameAttributes.settings.LockTeams;
+ if (this.available)
+ {
+ if (g_GameAttributes.settings.LastManStanding === undefined)
+ {
+ g_GameAttributes.settings.LastManStanding = false;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.LastManStanding !== undefined)
+ {
+ delete g_GameAttributes.settings.LastManStanding;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ // Always display this, so that players are aware that there is this gamemode
+ this.setChecked(!!g_GameAttributes.settings.LastManStanding);
+ this.setEnabled(g_GameAttributes.mapType != "scenario" && !g_GameAttributes.settings.LockTeams);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.LastManStanding = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.LastManStanding.prototype.TitleCaption =
+ translate("Last Man Standing");
+
+GameSettingControls.LastManStanding.prototype.Tooltip =
+ translate("Toggle whether the last remaining player or the last remaining set of allies wins.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/LastManStanding.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Nomad.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Nomad.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Nomad.js (revision 23413)
@@ -0,0 +1,63 @@
+GameSettingControls.Nomad = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let available = g_GameAttributes.mapType == "random";
+ this.setHidden(!available);
+ if (!available)
+ return;
+
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.Nomad;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.Nomad)
+ {
+ g_GameAttributes.settings.Nomad = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ if (g_GameAttributes.mapType == "random")
+ {
+ if (g_GameAttributes.settings.Nomad === undefined)
+ {
+ g_GameAttributes.settings.Nomad = false;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (g_GameAttributes.settings.Nomad !== undefined)
+ {
+ delete g_GameAttributes.settings.Nomad;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ if (g_GameAttributes.mapType == "random")
+ this.setChecked(g_GameAttributes.settings.Nomad);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.Nomad = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.Nomad.prototype.TitleCaption =
+ translate("Nomad");
+
+GameSettingControls.Nomad.prototype.Tooltip =
+ translate("In Nomad mode, players start with only few units and have to find a suitable place to build their city. Ceasefire is recommended.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Nomad.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RegicideGarrison.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RegicideGarrison.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RegicideGarrison.js (revision 23413)
@@ -0,0 +1,67 @@
+GameSettingControls.RegicideGarrison = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.VictoryConditions &&
+ mapData.settings.VictoryConditions.indexOf(this.RegicideName) != -1 &&
+ mapData.settings.RegicideGarrison;
+
+ if (mapValue !== undefined || !g_GameAttributes.settings || mapValue == g_GameAttributes.settings.RegicideGarrison)
+ return;
+
+ if (!g_GameAttributes.settings.VictoryConditions)
+ g_GameAttributes.settings.VictoryConditions = [];
+
+ if (g_GameAttributes.settings.VictoryConditions.indexOf(this.RegicideName) == -1)
+ g_GameAttributes.settings.VictoryConditions.push(this.RegicideName);
+
+ g_GameAttributes.settings.RegicideGarrison = mapValue;
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.settings.VictoryConditions)
+ return;
+
+ let available = g_GameAttributes.settings.VictoryConditions.indexOf(this.RegicideName) != -1;
+ this.setHidden(!available);
+
+ if (available)
+ {
+ if (g_GameAttributes.settings.RegicideGarrison === undefined)
+ {
+ g_GameAttributes.settings.RegicideGarrison = false;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ this.setChecked(g_GameAttributes.settings.RegicideGarrison);
+ }
+ else if (g_GameAttributes.settings.RegicideGarrison !== undefined)
+ {
+ delete g_GameAttributes.settings.RegicideGarrison;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.RegicideGarrison = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.RegicideGarrison.prototype.TitleCaption =
+ translate("Hero Garrison");
+
+GameSettingControls.RegicideGarrison.prototype.Tooltip =
+ translate("Toggle whether heroes can be garrisoned.");
+
+GameSettingControls.RegicideGarrison.prototype.RegicideName =
+ "regicide";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/RegicideGarrison.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Treasures.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Treasures.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Treasures.js (revision 23413)
@@ -0,0 +1,45 @@
+GameSettingControls.Treasures = class extends GameSettingControlCheckbox
+{
+ onMapChange(mapData)
+ {
+ let mapValue =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.DisableTreasures;
+
+ if (mapValue !== undefined && mapValue != g_GameAttributes.settings.DisableTreasures)
+ {
+ g_GameAttributes.settings.DisableTreasures = mapValue;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ this.setEnabled(g_GameAttributes.mapType != "scenario");
+ }
+
+ onGameAttributesChange()
+ {
+ if (g_GameAttributes.settings.DisableTreasures === undefined)
+ {
+ g_GameAttributes.settings.DisableTreasures = false;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setChecked(g_GameAttributes.settings.DisableTreasures);
+ }
+
+ onPress(checked)
+ {
+ g_GameAttributes.settings.DisableTreasures = checked;
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+GameSettingControls.Treasures.prototype.TitleCaption =
+ translate("Disable Treasures");
+
+GameSettingControls.Treasures.prototype.Tooltip =
+ translate("Do not add treasures to the map.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/Single/Checkboxes/Treasures.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/AIConfigButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/AIConfigButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/AIConfigButton.js (revision 23413)
@@ -0,0 +1,188 @@
+PlayerSettingControls.AIConfigButton = class extends GameSettingControl
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.playerConfig = Engine.GetGUIObjectByName("playerConfig[" + this.playerIndex + "]");
+
+ this.isPageOpen = false;
+ this.guid = undefined;
+ this.fixedAI = undefined;
+
+ this.defaultAIDiff = +Engine.ConfigDB_GetValue("user", this.ConfigDifficulty);
+ this.defaultBehavior = Engine.ConfigDB_GetValue("user", this.ConfigBehavior);
+
+ // Save little performance by not reallocating every call
+ this.sprintfArgs = {};
+
+ this.playerConfig.onPress = this.openConfigPage.bind(this, this.playerIndex);
+ }
+
+ onMapChange(mapData)
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ let isScenario = g_GameAttributes.mapType == "scenario";
+
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ if (mapPData && mapPData.AI)
+ {
+ let defaultPData = g_Settings.PlayerDefaults[this.playerIndex + 1];
+
+ this.fixedAI = {
+ "AI": mapPData.AI,
+ "AIDiff":
+ mapPData.AIDiff !== undefined ?
+ mapPData.AIDiff :
+ defaultPData.AIDiff,
+ "AIBehavior":
+ mapPData.AIBehavior !== undefined ?
+ mapPData.AIBehavior :
+ defaultPData.AIBehavior
+ };
+ }
+ else
+ this.fixedAI = undefined;
+ }
+
+ onAssignPlayer(source, target)
+ {
+ if (source && target.AI)
+ {
+ source.AI = target.AI;
+ source.AIDiff = target.AIDiff;
+ source.AIBehavior = target.AIBehavior;
+ }
+
+ target.AI = false;
+ delete target.AIDiff;
+ delete target.AIBehavior;
+ }
+
+ onPlayerAssignmentsChange()
+ {
+ this.guid = undefined;
+
+ for (let guid in g_PlayerAssignments)
+ if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
+ this.guid = guid;
+ }
+
+ onGameAttributesChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ // Enforce map specified AI
+ if (this.fixedAI &&
+ (pData.AI !== this.fixedAI.AI ||
+ pData.AIDiff !== this.fixedAI.AIDiff ||
+ pData.AIBehavior !== this.fixedAI.AIBehavior))
+ {
+ pData.AI = this.fixedAI.AI;
+ pData.AIDiff = this.fixedAI.AIDiff;
+ pData.AIBehavior = this.fixedAI.AIBehavior;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ // Sanitize, make AI state self-consistent
+ if (pData.AI)
+ {
+ if (pData.AIDiff === undefined || pData.AIBehavior === undefined)
+ {
+ if (pData.AIDiff === undefined)
+ pData.AIDiff = this.defaultAIDiff;
+
+ if (pData.AIBehavior === undefined)
+ pData.AIBehavior = this.defaultBehavior;
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+ else if (pData.AI === undefined)
+ {
+ if (this.guid)
+ pData.AI = false;
+ else
+ {
+ pData.AI = g_Settings.PlayerDefaults[this.playerIndex + 1].AI;
+ pData.AIDiff = this.defaultAIDiff;
+ pData.AIBehavior = this.defaultBehavior;
+ }
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ else if (pData.AIBehavior !== undefined || pData.AIDiff !== undefined)
+ {
+ pData.AI = false;
+ delete pData.AIBehavior;
+ delete pData.AIDiff;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let isPageOpen = this.isPageOpen;
+ if (isPageOpen)
+ Engine.PopGuiPage();
+
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ this.sprintfArgs.description = translateAISettings(pData);
+ this.playerConfig.tooltip = sprintf(this.Tooltip, this.sprintfArgs);
+ this.playerConfig.hidden = !pData.AI;
+
+ if (isPageOpen)
+ this.openConfigPage();
+ }
+
+ openConfigPage()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData || !pData.AI)
+ return;
+
+ this.isPageOpen = true;
+ Engine.PushGuiPage(
+ "page_aiconfig.xml",
+ {
+ "playerSlot": this.playerIndex,
+ "id": pData.AI,
+ "difficulty": pData.AIDiff,
+ "behavior": pData.AIBehavior,
+ "fixed": !!this.fixedAI
+ },
+ this.onConfigPageClosed.bind(this));
+ }
+
+ onConfigPageClosed(data)
+ {
+ this.isPageOpen = false;
+
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!data || !data.save || !g_IsController || !pData)
+ return;
+
+ pData.AI = data.id;
+ pData.AIDiff = data.difficulty;
+ pData.AIBehavior = data.behavior;
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+};
+
+PlayerSettingControls.AIConfigButton.prototype.Tooltip =
+ translate("Configure AI: %(description)s.");
+
+PlayerSettingControls.AIConfigButton.prototype.ConfigDifficulty =
+ "gui.gamesetup.aidifficulty";
+
+PlayerSettingControls.AIConfigButton.prototype.ConfigBehavior =
+ "gui.gamesetup.aibehavior";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/AIConfigButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerColor.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerColor.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerColor.js (revision 23413)
@@ -0,0 +1,175 @@
+PlayerSettingControls.PlayerColor = class extends GameSettingControlDropdown
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.defaultColors = g_Settings.PlayerDefaults.slice(1).map(pData => pData.Color);
+ }
+
+ setControl()
+ {
+ this.dropdown = Engine.GetGUIObjectByName("playerColor[" + this.playerIndex + "]");
+ this.playerBackgroundColor = Engine.GetGUIObjectByName("playerBackgroundColor[" + this.playerIndex + "]");
+ this.playerColorHeading = Engine.GetGUIObjectByName("playerColorHeading");
+ }
+
+ onMapChange(mapData)
+ {
+ Engine.ProfileStart("updatePlayerColorList");
+ let hidden = !g_IsController || g_GameAttributes.mapType == "scenario";
+ this.dropdown.hidden = hidden;
+ this.playerColorHeading.hidden = hidden;
+
+ // Step 1: Pick colors that the map specifies, add most unsimilar default colors
+ // Provide the access to g_MaxPlayers different colors, regardless of current playercount.
+ let values = [];
+ for (let i = 0; i < g_MaxPlayers; ++i)
+ {
+ let pData = this.gameSettingsControl.getPlayerData(mapData, i);
+ values.push(pData && pData.Color || this.findFarthestUnusedColor(values));
+ }
+
+ // Step 2: Sort these colors so that the order is most reminiscent of the default colors
+ this.values = [];
+ for (let i = 0; i < g_MaxPlayers; ++i)
+ {
+ let closestColor;
+ let smallestDistance = Infinity;
+ for (let color of values)
+ {
+ if (this.values.some(col => sameColor(col, color)))
+ continue;
+
+ let distance = colorDistance(color, this.defaultColors[i]);
+ if (distance <= smallestDistance)
+ {
+ closestColor = color;
+ smallestDistance = distance;
+ }
+ }
+ this.values.push(closestColor);
+ }
+
+ this.dropdown.list = this.values.map(color => coloredText(this.ColorIcon, rgbToGuiColor(color)));
+ this.dropdown.list_data = this.values.map((color, i) => i);
+
+ // If the map specified a color for this slot, use that
+ let mapPlayerData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ let playerData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+
+ if (playerData && mapPlayerData && mapPlayerData.Color &&
+ (!playerData.Color || !sameColor(playerData.Color, mapPlayerData.Color)))
+ {
+ playerData.Color = mapPlayerData.Color;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ Engine.ProfileStop();
+ }
+
+ onGameAttributesChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData || !this.values)
+ return;
+
+ let inUse =
+ pData.Color &&
+ g_GameAttributes.settings.PlayerData.some((otherPData, i) =>
+ i < this.playerIndex &&
+ otherPData.Color &&
+ sameColor(pData.Color, otherPData.Color));
+
+ if (!pData.Color || this.values.indexOf(pData.Color) == -1 || inUse)
+ {
+ pData.Color =
+ (pData.Color && !inUse) ?
+ this.findClosestColor(pData.Color, this.values) :
+ this.getUnusedColor();
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData || !this.values)
+ return;
+
+ this.setSelectedValue(this.values.indexOf(pData.Color));
+ this.playerBackgroundColor.sprite = "color:" + rgbToGuiColor(pData.Color, 100);
+ }
+
+ onAssignPlayer(source, target)
+ {
+ if (g_GameAttributes.mapType != "scenario" && source && target)
+ [source.Color, target.Color] = [target.Color, source.Color];
+ }
+
+ onSelectionChange(itemIdx)
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+
+ // If someone else has that color, give that player the old color
+ let otherPData = g_GameAttributes.settings.PlayerData.find(data =>
+ sameColor(this.values[itemIdx], data.Color));
+
+ if (otherPData)
+ otherPData.Color = pData.Color;
+
+ pData.Color = this.values[itemIdx];
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ findClosestColor(targetColor, colors)
+ {
+ let colorDistances = colors.map(color => colorDistance(color, targetColor));
+
+ let smallestDistance = colorDistances.find(
+ distance => colorDistances.every(distance2 => distance2 >= distance));
+
+ return colors.find(color => colorDistance(color, targetColor) == smallestDistance);
+ }
+
+ findFarthestUnusedColor(values)
+ {
+ let farthestColor;
+ let farthestDistance = 0;
+
+ for (let defaultColor of this.defaultColors)
+ {
+ let smallestDistance = Infinity;
+ for (let usedColor of values)
+ {
+ let distance = colorDistance(usedColor, defaultColor);
+ if (distance < smallestDistance)
+ smallestDistance = distance;
+ }
+
+ if (smallestDistance >= farthestDistance)
+ {
+ farthestColor = defaultColor;
+ farthestDistance = smallestDistance;
+ }
+ }
+ return farthestColor;
+ }
+
+ getUnusedColor()
+ {
+ return this.values.find(color =>
+ g_GameAttributes &&
+ g_GameAttributes.settings &&
+ g_GameAttributes.settings.PlayerData &&
+ g_GameAttributes.settings.PlayerData.every(pData => !pData.Color || !sameColor(color, pData.Color)));
+ }
+};
+
+PlayerSettingControls.PlayerColor.prototype.Tooltip =
+ translate("Pick a color.");
+
+PlayerSettingControls.PlayerColor.prototype.ColorIcon =
+ "â– ";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/Dropdowns/PlayerColor.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerName.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerName.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerName.js (revision 23413)
@@ -0,0 +1,129 @@
+// TODO: There should be an indication which player is not ready yet
+// The color does not indicate it's meaning and is insufficient to inform many players.
+PlayerSettingControls.PlayerName = class extends GameSettingControl
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.playerName = Engine.GetGUIObjectByName("playerName[" + this.playerIndex + "]");
+
+ this.displayedName = undefined;
+ this.guid = undefined;
+ }
+
+ onMapChange(mapData)
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ pData.Name = mapPData && mapPData.Name || g_Settings.PlayerDefaults[this.playerIndex + 1].Name;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ onGameAttributesChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ if (!pData.Name)
+ {
+ pData.Name = g_Settings.PlayerDefaults[this.playerIndex + 1].Name;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ this.displayedName = g_IsNetworked ? pData.Name : translate(pData.Name);
+ this.rebuild();
+ }
+
+ onPlayerAssignmentsChange()
+ {
+ this.guid = undefined;
+
+ for (let guid in g_PlayerAssignments)
+ if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
+ {
+ this.guid = guid;
+ break;
+ }
+
+ this.rebuild();
+ }
+
+ rebuild()
+ {
+ let name = this.displayedName;
+ if (!name)
+ return;
+
+ if (g_IsNetworked)
+ {
+ let status = this.guid ? g_PlayerAssignments[this.guid].status : this.ReadyTags.length - 1;
+ name = setStringTags(this.displayedName, this.ReadyTags[status]);
+ }
+
+ this.playerName.caption = name;
+ }
+
+ onGameAttributesFinalize()
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ if (g_GameAttributes.mapType != "scenario" && pData.AI)
+ {
+ // Pick one of the available botnames for the chosen civ
+ // Determine botnames
+ let chosenName = pickRandom(g_CivData[pData.Civ].AINames);
+
+ if (!g_IsNetworked)
+ chosenName = translate(chosenName);
+
+ // Count how many players use the chosenName
+ let usedName = g_GameAttributes.settings.PlayerData.filter(otherPData =>
+ otherPData.Name && otherPData.Name.indexOf(chosenName) !== -1).length;
+
+ pData.Name =
+ usedName ?
+ sprintf(this.RomanLabel, {
+ "playerName": chosenName,
+ "romanNumber": this.RomanNumbers[usedName + 1]
+ }) :
+ chosenName;
+ }
+ else
+ // Copy client playernames so they appear in replays
+ for (let guid in g_PlayerAssignments)
+ if (g_PlayerAssignments[guid].player == this.playerIndex + 1)
+ pData.Name = g_PlayerAssignments[guid].name;
+ }
+};
+
+PlayerSettingControls.PlayerName.prototype.RomanLabel =
+ translate("%(playerName)s %(romanNumber)s");
+
+PlayerSettingControls.PlayerName.prototype.RomanNumbers =
+ [undefined, "I", "II", "III", "IV", "V", "VI", "VII", "VIII"];
+
+PlayerSettingControls.PlayerName.prototype.ReadyTags = [
+ {
+ "color": "white",
+ },
+ {
+ "color": "green",
+ },
+ {
+ "color": "150 150 250",
+ }
+];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerName.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerSettings.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerSettings.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerSettings.js (revision 23413)
@@ -0,0 +1,45 @@
+// TODO: There should be a dialog allowing to specify starting resources and population capacity per player
+PlayerSettingControls.PlayerSettings = class extends GameSettingControl
+{
+ onMapChange(mapData)
+ {
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ if (!pData)
+ return;
+
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ let isScenario = mapPData && g_GameAttributes.mapType == "scenario";
+
+ if (isScenario && mapPData.Resources)
+ pData.Resources = mapPData.Resources;
+ else
+ delete pData.Resources;
+
+ if (isScenario && mapPData.PopulationLimit)
+ pData.PopulationLimit = mapPData.PopulationLimit;
+ else
+ delete pData.PopulationLimit;
+ }
+
+ onGameAttributesFinalize()
+ {
+ // Copy map well known properties (and only well known properties)
+ let mapData = this.mapCache.getMapData(g_GameAttributes.mapType, g_GameAttributes.map);
+
+ let pData = this.gameSettingsControl.getPlayerData(g_GameAttributes, this.playerIndex);
+ let mapPData = this.gameSettingsControl.getPlayerData(mapData, this.playerIndex);
+ if (!pData || !mapPData)
+ return;
+
+ for (let property of this.MapSettings)
+ if (mapPData[property] !== undefined)
+ pData[property] = mapPData[property];
+ }
+};
+
+PlayerSettingControls.PlayerSettings.prototype.MapSettings = [
+ "StartingTechnologies",
+ "DisabledTechnologies",
+ "DisabledTemplates",
+ "StartingCamera"
+];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayerSettings.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlLabels.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlLabels.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlLabels.xml (revision 23413)
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlLabels.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.js (revision 23413)
@@ -0,0 +1,47 @@
+class CancelButton
+{
+ constructor(setupWindow, startGameButton, readyButton, gameSettingsControl)
+ {
+ this.setupWindow = setupWindow;
+ this.startGameButton = startGameButton;
+ this.readyButton = readyButton;
+ this.gameSettingsControl = gameSettingsControl;
+
+ 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);
+ }
+}
+
+CancelButton.prototype.Caption =
+ translate("Back");
+
+CancelButton.prototype.TooltipLobby =
+ translate("Return to the lobby.");
+
+CancelButton.prototype.TooltipMenu =
+ translate("Return to the main menu.");
+
+CancelButton.prototype.Margin = 0;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.js (revision 23413)
@@ -0,0 +1,19 @@
+class LobbyButton
+{
+ constructor()
+ {
+ this.lobbyButton = Engine.GetGUIObjectByName("lobbyButton");
+ this.lobbyButton.tooltip = this.Tooltip;
+ this.lobbyButton.onPress = this.onPress.bind(this);
+ this.lobbyButton.hidden = !Engine.HasXmppClient();
+ }
+
+ onPress()
+ {
+ if (Engine.HasXmppClient())
+ Engine.PushGuiPage("page_lobby.xml", { "dialog": true });
+ }
+}
+
+LobbyButton.prototype.Tooltip =
+ translate("Show the multiplayer lobby in a dialog window.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetCivsButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetCivsButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetCivsButton.js (revision 23413)
@@ -0,0 +1,36 @@
+class ResetCivsButton
+{
+ constructor(gameSettingsControl)
+ {
+ this.gameSettingsControl = gameSettingsControl;
+ this.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
+
+ this.civResetButton = Engine.GetGUIObjectByName("civResetButton");
+ this.civResetButton.tooltip = this.Tooltip;
+ this.civResetButton.onPress = this.onPress.bind(this);
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (g_GameAttributes.mapType)
+ this.civResetButton.hidden = g_GameAttributes.mapType == "scenario" || !g_IsController;
+ }
+
+ onPress()
+ {
+ if (!g_GameAttributes.settings || !g_GameAttributes.settings.PlayerData)
+ return;
+
+ for (let pData of g_GameAttributes.settings.PlayerData)
+ pData.Civ = this.RandomCivId;
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+}
+
+ResetCivsButton.prototype.Tooltip =
+ translate("Reset any civilizations that have been selected to the default (random).");
+
+ResetCivsButton.prototype.RandomCivId =
+ "random";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetCivsButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.xml (revision 23413)
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputAutocomplete.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputAutocomplete.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputAutocomplete.js (revision 23413)
@@ -0,0 +1,37 @@
+class ChatInputAutocomplete
+{
+ constructor(gameSettingControlManager, gameSettingsControl, playerAssignmentsControl)
+ {
+ this.gameSettingControlManager = gameSettingControlManager;
+ this.entries = undefined;
+
+ playerAssignmentsControl.registerPlayerAssignmentsChangeHandler(this.onAutocompleteChange.bind(this));
+ gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onAutocompleteChange.bind(this));
+ }
+
+ onAutocompleteChange()
+ {
+ this.entries = undefined;
+ }
+
+ // Collects all strings that can be autocompleted and
+ // sorts them by priority (so that playernames are always autocompleted first).
+ getAutocompleteEntries()
+ {
+ if (this.entries)
+ return this.entries;
+
+ // Maps from priority to autocompletable strings
+ let entries = { "0": [] };
+
+ this.gameSettingControlManager.addAutocompleteEntries(entries);
+
+ let allEntries = Object.keys(entries).sort((a, b) => +b - +a).reduce(
+ (all, priority) => all.concat(entries[priority]),
+ []);
+
+ this.entries = Array.from(new Set(allEntries));
+
+ return this.entries;
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputAutocomplete.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientKicked.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientKicked.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientKicked.js (revision 23413)
@@ -0,0 +1,25 @@
+ChatMessageEvents.ClientKicked = class
+{
+ constructor(chatMessagesPanel, netMessages)
+ {
+ this.chatMessagesPanel = chatMessagesPanel;
+
+ this.messageArgs = {};
+
+ netMessages.registerNetMessageHandler("kicked", this.onClientKicked.bind(this));
+ }
+
+ onClientKicked(message)
+ {
+ this.messageArgs.username = message.username;
+ this.chatMessagesPanel.addStatusMessage(sprintf(
+ message.banned ? this.BannedMessage : this.KickedMessage,
+ this.messageArgs));
+ }
+};
+
+ChatMessageEvents.ClientKicked.prototype.KickedMessage =
+ translate("%(username)s has been kicked");
+
+ChatMessageEvents.ClientKicked.prototype.BannedMessage =
+ translate("%(username)s has been banned");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientKicked.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.js (revision 23413)
@@ -0,0 +1,26 @@
+/**
+ * Properties of this prototype are classes that subscribe to one or more events and
+ * construct a formatted chat message to be displayed on that event.
+ *
+ * Important: Apply escapeText on player provided input to avoid players breaking the game for everybody.
+ */
+class ChatMessageEvents
+{
+}
+
+class ChatPanel
+{
+ constructor(gameSettingControlManager, gameSettingsControl, netMessages, playerAssignmentsControl, readyControl, gameSettingsPanel)
+ {
+ this.statusMessageFormat = new StatusMessageFormat();
+
+ this.chatMessagesPanel = new ChatMessagesPanel(gameSettingsPanel);
+ this.chatInputAutocomplete = new ChatInputAutocomplete(gameSettingControlManager, gameSettingsControl, playerAssignmentsControl);
+ this.chatInputPanel = new ChatInputPanel(netMessages, this.chatInputAutocomplete);
+
+ this.chatMessageEvents = [];
+ for (let name in ChatMessageEvents)
+ this.chatMessageEvents.push(new ChatMessageEvents[name](
+ this.chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl, readyControl));
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.js (revision 23413)
@@ -0,0 +1,27 @@
+class GameDescription
+{
+ constructor(mapCache, gameSettingTabs, gameSettingsControl)
+ {
+ this.mapCache = mapCache;
+
+ this.gameDescriptionFrame = Engine.GetGUIObjectByName("gameDescriptionFrame");
+ this.gameDescription = Engine.GetGUIObjectByName("gameDescription");
+
+ gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
+ gameSettingTabs.registerTabsResizeHandler(this.onTabsResize.bind(this));
+ }
+
+ onTabsResize(settingsTabButtonsFrame)
+ {
+ let size = this.gameDescriptionFrame.size;
+ size.top = settingsTabButtonsFrame.size.bottom + this.Margin;
+ this.gameDescriptionFrame.size = size;
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.gameDescription.caption = getGameDescription(this.mapCache);
+ }
+}
+
+GameDescription.prototype.Margin = 3;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayersPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayersPanel.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayersPanel.xml (revision 23413)
@@ -0,0 +1,55 @@
+
+
+
+
+
+ Player Name
+
+
+
+ Color
+
+
+
+ Player Placement
+
+
+
+ Civilization
+
+
+
+
+
+
+ Team
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/PerPlayer/PlayersPanel.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/VictoryConditionCheckbox.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/VictoryConditionCheckbox.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/VictoryConditionCheckbox.js (revision 23413)
@@ -0,0 +1,105 @@
+/**
+ * This is an abstract class instantiated per defined VictoryCondition.
+ */
+class VictoryConditionCheckbox extends GameSettingControlCheckbox
+{
+ constructor(victoryCondition, ...args)
+ {
+ super(...args);
+
+ this.victoryCondition = victoryCondition;
+
+ this.setTitle(this.victoryCondition.Title);
+ this.setTooltip(this.victoryCondition.Description);
+ }
+
+ onMapChange(mapData)
+ {
+ let mapIndex =
+ mapData &&
+ mapData.settings &&
+ mapData.settings.VictoryConditions &&
+ mapData.settings.VictoryConditions.indexOf(this.victoryCondition.Name);
+
+ if (mapIndex === undefined)
+ return;
+
+ let index =
+ g_GameAttributes.settings &&
+ g_GameAttributes.settings.VictoryConditions &&
+ g_GameAttributes.settings.VictoryConditions.indexOf(this.victoryCondition.Name);
+
+ if (index !== undefined && (mapIndex == -1) == (index == -1))
+ return;
+
+ if (!g_GameAttributes.settings.VictoryConditions)
+ g_GameAttributes.settings.VictoryConditions = [];
+
+ if (mapIndex == -1)
+ {
+ if (index !== undefined)
+ g_GameAttributes.settings.VictoryConditions.splice(index, 1);
+ }
+ else
+ g_GameAttributes.settings.VictoryConditions.push(this.victoryCondition.Name);
+
+ this.gameSettingsControl.updateGameAttributes();
+ }
+
+ onGameAttributesChange()
+ {
+ if (!g_GameAttributes.settings.VictoryConditions)
+ {
+ g_GameAttributes.settings.VictoryConditions = [];
+ for (let victoryCondition of g_VictoryConditions)
+ if (victoryCondition.Default)
+ g_GameAttributes.settings.VictoryConditions.push(victoryCondition.Name);
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ this.setEnabled(
+ g_GameAttributes.mapType != "scenario" &&
+ (!this.victoryCondition.DisabledWhenChecked ||
+ this.victoryCondition.DisabledWhenChecked.every(name =>
+ g_GameAttributes.settings.VictoryConditions.indexOf(name) == -1)));
+
+ this.setChecked(g_GameAttributes.settings.VictoryConditions.indexOf(this.victoryCondition.Name) != -1);
+ }
+
+ onPress(checked)
+ {
+ let victoryCondition = new Set(g_GameAttributes.settings.VictoryConditions);
+
+ if (checked)
+ {
+ victoryCondition.add(this.victoryCondition.Name);
+
+ if (this.victoryCondition.ChangeOnChecked)
+ for (let name in this.victoryCondition.ChangeOnChecked)
+ if (this.victoryCondition.ChangeOnChecked[name])
+ victoryCondition.add(name);
+ else
+ victoryCondition.delete(name);
+ }
+ else
+ victoryCondition.delete(this.victoryCondition.Name);
+
+ g_GameAttributes.settings.VictoryConditions = Array.from(victoryCondition);
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+
+ onGameAttributesFinalize()
+ {
+ if (!g_GameAttributes.settings.TriggerScripts)
+ g_GameAttributes.settings.TriggerScripts = [];
+
+ if (g_GameAttributes.settings.VictoryConditions.indexOf(this.victoryCondition.Name) != -1)
+ for (let script of this.victoryCondition.Scripts)
+ if (g_GameAttributes.settings.TriggerScripts.indexOf(script) == -1)
+ g_GameAttributes.settings.TriggerScripts.push(script);
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/VictoryConditionCheckbox.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.js (revision 23413)
@@ -0,0 +1,72 @@
+class StartGameButton
+{
+ constructor(setupWindow, startGameControl, netMessages, readyControl, playerAssignmentsControl)
+ {
+ this.startGameControl = startGameControl;
+ this.readyControl = readyControl;
+ this.gameStarted = false;
+
+ this.buttonHiddenChangeHandlers = new Set();
+
+ this.startGameButton = Engine.GetGUIObjectByName("startGameButton");
+ this.startGameButton.caption = this.Caption;
+ this.startGameButton.onPress = this.onPress.bind(this);
+
+ setupWindow.registerLoadHandler(this.onLoad.bind(this));
+ playerAssignmentsControl.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()
+ {
+ let isEveryoneReady = this.isEveryoneReady();
+ this.startGameButton.enabled = !this.gameStarted && isEveryoneReady;
+ this.startGameButton.tooltip =
+ !g_IsNetworked || isEveryoneReady ?
+ this.ReadyTooltip :
+ this.ReadyTooltipWaiting;
+ }
+
+ isEveryoneReady()
+ {
+ if (!g_IsNetworked)
+ return true;
+
+ for (let guid in g_PlayerAssignments)
+ if (g_PlayerAssignments[guid].player != -1 &&
+ g_PlayerAssignments[guid].status == this.readyControl.NotReady)
+ return false;
+
+ return true;
+ }
+
+ onPress()
+ {
+ if (this.gameStarted)
+ return;
+
+ this.gameStarted = true;
+ this.update();
+ this.startGameControl.launchGame();
+ }
+}
+
+StartGameButton.prototype.Caption =
+ translate("Start Game!");
+
+StartGameButton.prototype.ReadyTooltip =
+ translate("Start a new game with the current settings.");
+
+StartGameButton.prototype.ReadyTooltipWaiting =
+ translate("Start a new game with the current settings (disabled until all players are ready).");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.xml (revision 23413)
@@ -0,0 +1,11 @@
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/LobbyButton.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetTeamsButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetTeamsButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetTeamsButton.js (revision 23413)
@@ -0,0 +1,35 @@
+class ResetTeamsButton
+{
+ constructor(gameSettingsControl)
+ {
+ this.gameSettingsControl = gameSettingsControl;
+ this.gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
+
+ this.teamResetButton = Engine.GetGUIObjectByName("teamResetButton");
+ this.teamResetButton.tooltip = this.Tooltip;
+ this.teamResetButton.onPress = this.onPress.bind(this);
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.mapType)
+ return;
+
+ this.teamResetButton.hidden = g_GameAttributes.mapType == "scenario" || !g_IsController;
+ }
+
+ onPress()
+ {
+ if (!g_GameAttributes.settings || !g_GameAttributes.settings.PlayerData)
+ return;
+
+ for (let pData of g_GameAttributes.settings.PlayerData)
+ pData.Team = -1;
+
+ this.gameSettingsControl.updateGameAttributes();
+ this.gameSettingsControl.setNetworkGameAttributes();
+ }
+}
+
+ResetTeamsButton.prototype.Tooltip =
+ translate("Reset all teams to the default.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ResetTeamsButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.js (revision 23413)
@@ -0,0 +1,97 @@
+class GameSettingTabs
+{
+ constructor(setupWindow, lobbyButton)
+ {
+ this.lobbyButton = lobbyButton;
+
+ this.tabSelectHandlers = new Set();
+ this.tabsResizeHandlers = new Set();
+
+ this.settingsTabButtonsFrame = Engine.GetGUIObjectByName("settingTabButtonsFrame");
+
+ for (let tab in g_GameSettingsLayout)
+ g_GameSettingsLayout[tab].tooltip =
+ sprintf(this.ToggleTooltip, { "name": g_GameSettingsLayout[tab].label }) +
+ colorizeHotkey("\n" + this.HotkeyDownTooltip, this.ConfigNameHotkeyDown) +
+ colorizeHotkey("\n" + this.HotkeyUpTooltip, this.ConfigNameHotkeyUp);
+
+ setupWindow.registerLoadHandler(this.onLoad.bind(this));
+ Engine.SetGlobalHotkey("cancel", selectPanel);
+ }
+
+ registerTabsResizeHandler(handler)
+ {
+ this.tabsResizeHandlers.add(handler);
+ }
+
+ registerTabSelectHandler(handler)
+ {
+ this.tabSelectHandlers.add(handler);
+ }
+
+ onLoad()
+ {
+ placeTabButtons(
+ g_GameSettingsLayout,
+ this.TabButtonHeight,
+ this.TabButtonMargin,
+ this.onTabPress.bind(this),
+ this.onTabSelect.bind(this));
+
+ this.resize();
+
+ if (!g_IsController)
+ selectPanel();
+ }
+
+ resize()
+ {
+ let size = this.settingsTabButtonsFrame.size;
+ size.bottom = size.top + g_GameSettingsLayout.length * (this.TabButtonHeight + this.TabButtonMargin);
+
+ if (!this.lobbyButton.lobbyButton.hidden)
+ {
+ let lobbyButtonSize = this.lobbyButton.lobbyButton.parent.size;
+ size.right -= lobbyButtonSize.right - lobbyButtonSize.left + this.LobbyButtonMargin;
+ }
+ this.settingsTabButtonsFrame.size = size;
+
+ for (let handler of this.tabsResizeHandlers)
+ handler(this.settingsTabButtonsFrame);
+ }
+
+ onTabPress(category)
+ {
+ selectPanel(category == g_TabCategorySelected ? undefined : category);
+ }
+
+ onTabSelect()
+ {
+ for (let handler of this.tabSelectHandlers)
+ handler();
+ }
+}
+
+GameSettingTabs.prototype.ToggleTooltip =
+ translate("Toggle the %(name)s settings tab.");
+
+GameSettingTabs.prototype.HotkeyUpTooltip =
+ translate("Use %(hotkey)s to move a settings tab up.");
+
+GameSettingTabs.prototype.HotkeyDownTooltip =
+ translate("Use %(hotkey)s to move a settings tab down.");
+
+GameSettingTabs.prototype.ConfigNameHotkeyUp =
+ "tab.next";
+
+GameSettingTabs.prototype.ConfigNameHotkeyDown =
+ "tab.prev";
+
+GameSettingTabs.prototype.TabButtonHeight = 30;
+
+GameSettingTabs.prototype.TabButtonMargin = 4;
+
+/**
+ * Horizontal space between tab buttons and lobby button.
+ */
+GameSettingTabs.prototype.LobbyButtonMargin = 8;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputPanel.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputPanel.js (revision 23413)
@@ -0,0 +1,55 @@
+class ChatInputPanel
+{
+ constructor(netMessages, chatInputAutocomplete)
+ {
+ this.chatInputAutocomplete = chatInputAutocomplete;
+
+ this.chatInput = Engine.GetGUIObjectByName("chatInput");
+ this.chatInput.tooltip = colorizeAutocompleteHotkey(this.Tooltip);
+ this.chatInput.onPress = this.onPress.bind(this);
+ this.chatInput.onTab = this.onTab.bind(this);
+ this.chatInput.focus();
+
+ this.chatSubmitButton = Engine.GetGUIObjectByName("chatSubmitButton");
+ this.chatSubmitButton.onPress = this.onPress.bind(this);
+
+ netMessages.registerNetMessageHandler("netstatus", this.onNetStatusMessage.bind(this));
+ }
+
+ onNetStatusMessage(message)
+ {
+ if (message.status == "disconnected")
+ {
+ reportDisconnect(message.reason, true);
+ this.chatInput.hidden = true;
+ this.chatSubmitButton.hidden = true;
+ }
+ }
+
+ onTab()
+ {
+ autoCompleteText(
+ this.chatInput,
+ this.chatInputAutocomplete.getAutocompleteEntries());
+ }
+
+ onPress()
+ {
+ if (!g_IsNetworked)
+ return;
+
+ let text = this.chatInput.caption;
+ if (!text.length)
+ return;
+
+ this.chatInput.caption = "";
+
+ if (!executeNetworkCommand(text))
+ Engine.SendNetworkChat(text);
+
+ this.chatInput.focus();
+ }
+}
+
+ChatInputPanel.prototype.Tooltip =
+ translate("Press %(hotkey)s to autocomplete player names or settings.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatInputPanel.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientReady.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientReady.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientReady.js (revision 23413)
@@ -0,0 +1,30 @@
+ChatMessageEvents.ClientReady = class
+{
+ constructor(chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl, readyControl)
+ {
+ this.chatMessagesPanel = chatMessagesPanel;
+
+ this.args = {};
+
+ netMessages.registerNetMessageHandler("ready", this.onReadyMessage.bind(this));
+ }
+
+ onReadyMessage(message)
+ {
+ let playerAssignment = g_PlayerAssignments[message.guid];
+ if (!playerAssignment || playerAssignment.player == -1)
+ return;
+
+ let text = this.ReadyMessage[message.status] || undefined;
+ if (!text)
+ return;
+
+ this.args.username = playerAssignment.name;
+ this.chatMessagesPanel.addText(sprintf(text, this.args));
+ }
+};
+
+ChatMessageEvents.ClientReady.prototype.ReadyMessage = [
+ translate("* %(username)s is not ready."),
+ translate("* %(username)s is ready!")
+];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientReady.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.xml (revision 23413)
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+ Send
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatPanel.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.xml (revision 23413)
@@ -0,0 +1,4 @@
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameDescription.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.js (revision 23413)
@@ -0,0 +1,64 @@
+/**
+ * This class is implemented by gamesettings that are controlled by a dropdown.
+ */
+class GameSettingControlDropdown extends GameSettingControl
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.isInGuiUpdate = false;
+ this.dropdown.onSelectionChange = this.onSelectionChangeSuper.bind(this);
+ if (this.onHoverChange)
+ this.dropdown.onHoverChange = this.onHoverChange.bind(this);
+ }
+
+ setControl(gameSettingControlManager)
+ {
+ let row = gameSettingControlManager.getNextRow("dropdownSettingFrame");
+ this.frame = Engine.GetGUIObjectByName("dropdownSettingFrame[" + row + "]");
+ this.dropdown = Engine.GetGUIObjectByName("dropdownSettingControl[" + row + "]");
+
+ let labels = this.frame.children[0].children;
+ this.title = labels[0];
+ this.label = labels[1];
+ }
+
+ setControlTooltip(tooltip)
+ {
+ this.dropdown.tooltip = tooltip;
+ }
+
+ setControlHidden(hidden)
+ {
+ this.dropdown.hidden = hidden;
+ }
+
+ setSelectedValue(value)
+ {
+ let index = this.dropdown.list_data.indexOf(String(value));
+
+ this.isInGuiUpdate = true;
+ this.dropdown.selected = index;
+ this.isInGuiUpdate = false;
+
+ if (this.label)
+ this.label.caption = index == -1 ? this.UnknownValue : this.dropdown.list[index];
+ }
+
+ onSelectionChangeSuper()
+ {
+ if (!this.isInGuiUpdate)
+ this.onSelectionChange(this.dropdown.selected);
+ }
+}
+
+/**
+ * Highlight the "random" dropdownlist item.
+ */
+GameSettingControlDropdown.prototype.RandomItemTags = {
+ "color": "orange"
+};
+
+GameSettingControlDropdown.prototype.UnknownValue =
+ translateWithContext("settings value", "Unknown");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlDropdown.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.xml (revision 23413)
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CivInfoButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CivInfoButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CivInfoButton.js (revision 23413)
@@ -0,0 +1,48 @@
+class CivInfoButton
+{
+ constructor()
+ {
+ this.civInfo = {
+ "civ": "",
+ "page": "page_civinfo.xml"
+ };
+
+ let civInfoButton = Engine.GetGUIObjectByName("civInfoButton");
+ civInfoButton.onPress = this.onPress.bind(this);
+ civInfoButton.tooltip =
+ sprintf(translate(this.Tooltip), {
+ "hotkey_civinfo": colorizeHotkey("%(hotkey)s", "civinfo"),
+ "hotkey_structree": colorizeHotkey("%(hotkey)s", "structree")
+ });
+
+ Engine.SetGlobalHotkey("structree", this.openPage.bind(this, "page_structree.xml"));
+ Engine.SetGlobalHotkey("civinfo", this.openPage.bind(this, "page_civinfo.xml"));
+ }
+
+ onPress()
+ {
+ this.openPage(this.civInfo.page);
+ }
+
+ openPage(page)
+ {
+ Engine.PushGuiPage(
+ page,
+ { "civ": this.civInfo.civ },
+ this.storeCivInfoPage.bind(this));
+ }
+
+ storeCivInfoPage(data)
+ {
+ if (data.nextPage)
+ Engine.PushGuiPage(
+ data.nextPage,
+ { "civ": data.civ },
+ this.storeCivInfoPage.bind(this));
+ else
+ this.civInfo = data;
+ }
+}
+
+CivInfoButton.prototype.Tooltip =
+ translate("%(hotkey_civinfo)s / %(hotkey_structree)s: View History / Structure Tree\nLast opened will be reopened on click.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CivInfoButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.xml (revision 23413)
@@ -0,0 +1,8 @@
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.js (revision 23413)
@@ -0,0 +1,188 @@
+class GameSettingsPanel
+{
+ constructor(setupWindow, gameSettingTabs, gameSettingsControl, gameSettingControlManager)
+ {
+ this.centerRightPanel = Engine.GetGUIObjectByName("centerRightPanel");
+ this.settingTabButtonsFrame = Engine.GetGUIObjectByName("settingTabButtonsFrame");
+ this.settingsPanelFrame = Engine.GetGUIObjectByName("settingsPanelFrame");
+
+ this.gameSettingControlManager = gameSettingControlManager;
+ this.gameSettingsPanelResizeHandlers = new Set();
+
+ this.setupWindow = Engine.GetGUIObjectByName("setupWindow");
+ this.setupWindow.onWindowResized = this.onWindowResized.bind(this);
+
+ this.settingsPanel = Engine.GetGUIObjectByName("settingsPanel");
+
+ this.enabled = Engine.ConfigDB_GetValue("user", this.ConfigNameSlide) == "true";
+ this.slideSpeed = this.enabled ? this.SlideSpeed : Infinity;
+ this.lastTickTime = undefined;
+
+ gameSettingTabs.registerTabSelectHandler(this.updateSize.bind(this));
+ gameSettingsControl.registerGameAttributesBatchChangeHandler(this.updateSize.bind(this));
+ setupWindow.registerLoadHandler(this.triggerResizeHandlers.bind(this));
+ }
+
+ registerGameSettingsPanelResizeHandler(handler)
+ {
+ this.gameSettingsPanelResizeHandlers.add(handler);
+ }
+
+ triggerResizeHandlers()
+ {
+ for (let handler of this.gameSettingsPanelResizeHandlers)
+ handler(this.settingsPanelFrame);
+ }
+
+ onWindowResized()
+ {
+ this.updateSize();
+ this.triggerResizeHandlers();
+ }
+
+ updateSize()
+ {
+ this.gameSettingControlManager.updateSettingVisibility();
+ this.positionSettings();
+
+ this.lastTickTime = undefined;
+ this.settingsPanelFrame.onTick = this.onTick.bind(this);
+ }
+
+ onTick()
+ {
+ let now = Date.now();
+ let tickLength = now - this.lastTickTime;
+ let previousTime = this.lastTickTime;
+ this.lastTickTime = now;
+ if (previousTime === undefined)
+ return;
+
+ let distance = this.slideSpeed * tickLength;
+ let rightBorder = this.settingTabButtonsFrame.size.left;
+ let offset = 0;
+ if (g_TabCategorySelected === undefined)
+ {
+ let maxOffset = rightBorder - this.settingsPanelFrame.size.left;
+ if (maxOffset > 0)
+ offset = Math.min(distance, maxOffset);
+ }
+ else if (rightBorder > this.settingsPanelFrame.size.right)
+ {
+ offset = Math.min(distance, rightBorder - this.settingsPanelFrame.size.right);
+ }
+ else
+ {
+ let maxOffset = this.settingsPanelFrame.size.left - rightBorder + (this.settingsPanelFrame.size.right - this.settingsPanelFrame.size.left);
+ if (maxOffset > 0)
+ offset = -Math.min(distance, maxOffset);
+ }
+
+ if (offset)
+ this.changePanelWidth(offset);
+ else
+ {
+ delete this.settingsPanelFrame.onTick;
+ this.lastTickTime = undefined;
+ }
+ }
+
+ changePanelWidth(offset)
+ {
+ if (!offset)
+ return;
+
+ let size = this.settingsPanelFrame.size;
+ size.left += offset;
+ size.right += offset;
+ this.settingsPanelFrame.size = size;
+
+ this.triggerResizeHandlers();
+ }
+
+ /**
+ * Distribute the currently visible settings over the settings panel.
+ * First calculate the number of columns required, then place the setting frames.
+ */
+ positionSettings()
+ {
+ let setupWindowSize = this.setupWindow.getComputedSize();
+
+ let columnWidth = Math.min(
+ this.MaxColumnWidth,
+ (setupWindowSize.right - setupWindowSize.left + this.centerRightPanel.size.left) / 2);
+
+ let settingsPerColumn;
+ {
+ let settingPanelSize = this.settingsPanel.getComputedSize();
+ let maxSettingsPerColumn = Math.floor((settingPanelSize.bottom - settingPanelSize.top) / this.SettingHeight);
+ let settingCount = this.settingsPanel.children.filter(child => !child.children[0].hidden).length;
+ settingsPerColumn = settingCount / Math.ceil(settingCount / maxSettingsPerColumn);
+ }
+
+ let yPos = this.SettingMarginBottom;
+ let column = 0;
+ let settingsThisColumn = 0;
+
+ let selectedTab = g_GameSettingsLayout[g_TabCategorySelected];
+ if (!selectedTab)
+ return;
+
+ for (let name of selectedTab.settings)
+ {
+ let settingFrame = this.gameSettingControlManager.gameSettingControls[name].frame;
+ if (settingFrame.hidden)
+ continue;
+
+ if (settingsThisColumn >= settingsPerColumn)
+ {
+ yPos = this.SettingMarginBottom;
+ ++column;
+ settingsThisColumn = 0;
+ }
+
+ settingFrame.size = new GUISize(
+ columnWidth * column,
+ yPos,
+ columnWidth * (column + 1) - this.SettingMarginRight,
+ yPos + this.SettingHeight - this.SettingMarginBottom);
+
+ yPos += this.SettingHeight;
+ ++settingsThisColumn;
+ }
+
+ {
+ let size = this.settingsPanelFrame.size;
+ size.right = size.left + (column + 1) * columnWidth;
+ this.settingsPanelFrame.size = size;
+ }
+ }
+}
+
+GameSettingsPanel.prototype.ConfigNameSlide =
+ "gui.gamesetup.settingsslide";
+
+/**
+ * Maximum width of a column in the settings panel.
+ */
+GameSettingsPanel.prototype.MaxColumnWidth = 470;
+
+/**
+ * Pixels per millisecond the settings panel slides when opening/closing.
+ */
+GameSettingsPanel.prototype.SlideSpeed = 1.2;
+
+/**
+ * Vertical size of a setting frame.
+ */
+GameSettingsPanel.prototype.SettingHeight = 32;
+
+/**
+ * Horizontal space between two setting frames.
+ */
+GameSettingsPanel.prototype.SettingMarginRight = 10;
+
+/**
+ * Vertical space between two setting frames.
+ */
+GameSettingsPanel.prototype.SettingMarginBottom = 2;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsPanel.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.js (revision 23413)
@@ -0,0 +1,36 @@
+class MapPreview
+{
+ constructor(gameSettingsControl, mapCache)
+ {
+ this.gameSettingsControl = gameSettingsControl;
+ this.mapCache = mapCache;
+
+ this.mapInfoName = Engine.GetGUIObjectByName("mapInfoName");
+ this.mapPreview = Engine.GetGUIObjectByName("mapPreview");
+
+ gameSettingsControl.registerMapChangeHandler(this.onMapChange.bind(this));
+ gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
+ }
+
+ onMapChange(mapData)
+ {
+ let preview = mapData && mapData.settings && mapData.settings.Preview;
+ if (!g_GameAttributes.settings.Preview || g_GameAttributes.settings.Preview != preview)
+ {
+ g_GameAttributes.settings.Preview = preview;
+ this.gameSettingsControl.updateGameAttributes();
+ }
+ }
+
+ onGameAttributesBatchChange()
+ {
+ if (!g_GameAttributes.map || !g_GameAttributes.mapType)
+ return;
+
+ this.mapInfoName.caption = this.mapCache.translateMapName(
+ this.mapCache.getTranslatableMapName(g_GameAttributes.mapType, g_GameAttributes.map));
+
+ this.mapPreview.sprite =
+ this.mapCache.getMapPreview(g_GameAttributes.mapType, g_GameAttributes.map, g_GameAttributes);
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientConnection.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientConnection.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientConnection.js (revision 23413)
@@ -0,0 +1,30 @@
+ChatMessageEvents.ClientConnection = class
+{
+ constructor(chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl)
+ {
+ this.chatMessagesPanel = chatMessagesPanel;
+
+ playerAssignmentsControl.registerClientJoinHandler(this.onClientJoin.bind(this));
+ playerAssignmentsControl.registerClientLeaveHandler(this.onClientLeave.bind(this));
+
+ this.args = {};
+ }
+
+ onClientJoin(newGUID, newAssignments)
+ {
+ this.args.username = newAssignments[newGUID].name;
+ this.chatMessagesPanel.addStatusMessage(sprintf(this.JoinText, this.args));
+ }
+
+ onClientLeave(guid)
+ {
+ this.args.username = g_PlayerAssignments[guid].name;
+ this.chatMessagesPanel.addStatusMessage(sprintf(this.LeaveText, this.args));
+ }
+};
+
+ChatMessageEvents.ClientConnection.prototype.JoinText =
+ translate("%(username)s has joined");
+
+ChatMessageEvents.ClientConnection.prototype.LeaveText =
+ translate("%(username)s has left");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientConnection.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessagesPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessagesPanel.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessagesPanel.js (revision 23413)
@@ -0,0 +1,81 @@
+/**
+ * This class stores and displays the chat history since the login and
+ * displays timestamps if enabled.
+ */
+class ChatMessagesPanel
+{
+ constructor(gameSettingsPanel)
+ {
+ this.gameSettingsPanel = gameSettingsPanel;
+
+ this.chatHistory = "";
+
+ this.statusMessageFormat = new StatusMessageFormat();
+
+ if (Engine.ConfigDB_GetValue("user", this.ConfigTimestamp) == "true")
+ this.timestampWrapper = new TimestampWrapper();
+
+ this.chatText = Engine.GetGUIObjectByName("chatText");
+ this.chatPanel = Engine.GetGUIObjectByName("chatPanel");
+ this.chatPanel.onWindowResized = this.onWindowResized.bind(this);
+ gameSettingsPanel.registerGameSettingsPanelResizeHandler(this.onGameSettingsPanelResize.bind(this));
+
+ // TODO: Remove global requirements by gui/common/network.js
+ g_NetworkCommands["/list"] = () => { this.addText(getUsernameList()); };
+ g_NetworkCommands["/clear"] = this.clearChatMessages.bind(this);
+ global.kickError = () => {};
+ }
+
+ addText(text)
+ {
+ if (this.timestampWrapper)
+ text = this.timestampWrapper.format(text);
+
+ this.chatHistory += this.chatHistory ? "\n" + text : text;
+ this.chatText.caption = this.chatHistory;
+ }
+
+ addStatusMessage(text)
+ {
+ this.addText(this.statusMessageFormat.format(text));
+ }
+
+ clearChatMessages()
+ {
+ this.chatHistory = "";
+ this.chatText.caption = "";
+ }
+
+ updateHidden()
+ {
+ let size = this.chatPanel.getComputedSize();
+ this.chatPanel.hidden = !g_IsNetworked || size.right - size.left < this.MinimumWidth;
+ }
+
+ onWindowResized()
+ {
+ this.updateHidden();
+ }
+
+ onGameSettingsPanelResize(settingsPanel)
+ {
+ let size = this.chatPanel.size;
+ size.right = settingsPanel.size.left + this.gameSettingsPanel.MaxColumnWidth + this.Margin;
+ this.chatPanel.size = size;
+
+ this.updateHidden();
+ }
+}
+
+/**
+ * Minimum amount of pixels required for the chat panel to be visible.
+ */
+ChatMessagesPanel.prototype.MinimumWidth = 96;
+
+/**
+ * Horizontal space between the chat window and the settings panel.
+ */
+ChatMessagesPanel.prototype.Margin = 10;
+
+ChatMessagesPanel.prototype.ConfigTimestamp =
+ "chat.timestamp";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessagesPanel.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/TimestampWrapper.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/TimestampWrapper.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/TimestampWrapper.js (revision 23413)
@@ -0,0 +1,31 @@
+/**
+ * This class wraps a string with a timestamp dating to when the message was sent.
+ */
+class TimestampWrapper
+{
+ constructor()
+ {
+ this.timeArgs = {};
+ this.timestampArgs = {};
+ }
+
+ format(text)
+ {
+ this.timeArgs.time =
+ Engine.FormatMillisecondsIntoDateStringLocal(Date.now(), this.TimeFormat);
+
+ this.timestampArgs.time = sprintf(this.TimestampFormat, this.timeArgs);
+ this.timestampArgs.message = text;
+
+ return sprintf(this.TimestampedMessageFormat, this.timestampArgs);
+ }
+}
+
+TimestampWrapper.prototype.TimestampedMessageFormat =
+ translate("%(time)s %(message)s");
+
+TimestampWrapper.prototype.TimestampFormat =
+ translate("\\[%(time)s]");
+
+TimestampWrapper.prototype.TimeFormat =
+ translate("HH:mm");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/TimestampWrapper.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.xml (revision 23413)
@@ -0,0 +1,2 @@
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.js (revision 23413)
@@ -0,0 +1,60 @@
+/**
+ * This class is implemented by gamesettings that are controlled by a checkbox.
+ */
+class GameSettingControlCheckbox extends GameSettingControl
+{
+ constructor(...args)
+ {
+ super(...args);
+
+ this.isInGuiUpdate = false;
+ this.previousSelectedValue = undefined;
+ }
+
+ setControl(gameSettingControlManager)
+ {
+ let row = gameSettingControlManager.getNextRow("checkboxSettingFrame");
+ this.frame = Engine.GetGUIObjectByName("checkboxSettingFrame[" + row + "]");
+ this.checkbox = Engine.GetGUIObjectByName("checkboxSettingControl[" + row + "]");
+ this.checkbox.onPress = this.onPressSuper.bind(this);
+
+ let labels = this.frame.children[0].children;
+ this.title = labels[0];
+ this.label = labels[1];
+ }
+
+ setControlTooltip(tooltip)
+ {
+ this.checkbox.tooltip = tooltip;
+ }
+
+ setControlHidden(hidden)
+ {
+ this.checkbox.hidden = hidden;
+ }
+
+ setChecked(checked)
+ {
+ if (this.previousSelectedValue == checked)
+ return;
+
+ this.isInGuiUpdate = true;
+ this.checkbox.checked = checked;
+ this.isInGuiUpdate = false;
+
+ if (this.label)
+ this.label.caption = checked ? this.Checked : this.Unchecked;
+ }
+
+ onPressSuper()
+ {
+ if (!this.isInGuiUpdate)
+ this.onPress(this.checkbox.checked);
+ }
+}
+
+GameSettingControlCheckbox.prototype.Checked =
+ translate("Yes");
+
+GameSettingControlCheckbox.prototype.Unchecked =
+ translate("No");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSettings/GameSettingControlCheckbox.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.js (revision 23413)
@@ -0,0 +1,50 @@
+/**
+ * This class owns all handlers of the gamesetup page, excluding controllers that apply to all subpages and handlers for specific subpages.
+ */
+class GameSetupPage
+{
+ constructor(setupWindow, gameSettingsControl, playerAssignmentsControl, netMessages, gameRegisterStanza, mapCache, mapFilters, startGameControl, readyControl)
+ {
+ Engine.ProfileStart("GameSetupPage");
+
+ // This class instance owns all gamesetting GUI controls such as dropdowns and checkboxes visible in this page.
+ this.gameSettingControlManager =
+ new GameSettingControlManager(setupWindow, gameSettingsControl, mapCache, mapFilters, netMessages, playerAssignmentsControl);
+
+ // These classes manage GUI buttons.
+ {
+ let startGameButton = new StartGameButton(setupWindow, startGameControl, netMessages, readyControl, playerAssignmentsControl);
+ let readyButton = new ReadyButton(readyControl, netMessages, playerAssignmentsControl);
+ this.panelButtons = {
+ "cancelButton": new CancelButton(setupWindow, startGameButton, readyButton, gameRegisterStanza),
+ "civInfoButton": new CivInfoButton(),
+ "lobbyButton": new LobbyButton(),
+ "readyButton": readyButton,
+ "startGameButton": startGameButton
+ };
+ }
+
+ // These classes manage GUI Objects.
+ {
+ let gameSettingTabs = new GameSettingTabs(setupWindow, this.panelButtons.lobbyButton);
+ let gameSettingsPanel = new GameSettingsPanel(
+ setupWindow, gameSettingTabs, gameSettingsControl, this.gameSettingControlManager);
+
+ this.panels = {
+ "chatPanel": new ChatPanel(this.gameSettingControlManager, gameSettingsControl, netMessages, playerAssignmentsControl, readyControl, gameSettingsPanel),
+ "gameSettingWarning": new GameSettingWarning(gameSettingsControl, this.panelButtons.cancelButton),
+ "gameDescription": new GameDescription(mapCache, gameSettingTabs, gameSettingsControl),
+ "gameSettingsPanel": gameSettingsPanel,
+ "gameSettingsTabs": gameSettingTabs,
+ "mapPreview": new MapPreview(gameSettingsControl, mapCache),
+ "resetCivsButton": new ResetCivsButton(gameSettingsControl),
+ "resetTeamsButton": new ResetTeamsButton(gameSettingsControl),
+ "soundNotification": new SoundNotification(netMessages, playerAssignmentsControl),
+ "tipsPanel": new TipsPanel(gameSettingsPanel),
+ "tooltip": new Tooltip(this.panelButtons.cancelButton)
+ };
+ }
+
+ Engine.ProfileStop();
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/GameSetupPage.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.xml (revision 23413)
@@ -0,0 +1,8 @@
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/CancelButton.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.js (revision 23413)
@@ -0,0 +1,88 @@
+class ReadyButton
+{
+ constructor(readyControl, netMessages, playerAssignmentsControl)
+ {
+ this.readyControl = readyControl;
+
+ this.hidden = undefined;
+
+ this.buttonHiddenChangeHandlers = new Set();
+ this.readyButtonPressHandlers = new Set();
+
+ this.readyButton = Engine.GetGUIObjectByName("readyButton");
+ this.readyButton.onPress = this.onPress.bind(this);
+ this.readyButton.onPressRight = this.onPressRight.bind(this);
+
+ playerAssignmentsControl.registerPlayerAssignmentsChangeHandler(this.onPlayerAssignmentsChange.bind(this));
+ netMessages.registerNetMessageHandler("netstatus", this.onNetStatusMessage.bind(this));
+
+ if (g_IsController && g_IsNetworked)
+ this.readyControl.setReady(this.readyControl.StayReady, true);
+ }
+
+ registerButtonHiddenChangeHandler(handler)
+ {
+ this.buttonHiddenChangeHandlers.add(handler);
+ }
+
+ onNetStatusMessage(message)
+ {
+ if (message.status == "disconnected")
+ this.readyButton.enabled = false;
+ }
+
+ onPlayerAssignmentsChange()
+ {
+ let playerAssignment = g_PlayerAssignments[Engine.GetPlayerGUID()];
+ let hidden = g_IsController || !playerAssignment || playerAssignment.player == -1;
+
+ if (!hidden)
+ {
+ this.readyButton.caption = this.Caption[playerAssignment.status];
+ this.readyButton.tooltip = this.Tooltip[playerAssignment.status];
+ }
+
+ if (hidden == this.hidden)
+ return;
+
+ this.hidden = hidden;
+ this.readyButton.hidden = hidden;
+
+ for (let handler of this.buttonHiddenChangeHandlers)
+ handler(this.readyButton);
+ }
+
+ registerReadyButtonPressHandler(handler)
+ {
+ this.readyButtonPressHandlers.add(handler);
+ }
+
+ onPress()
+ {
+ let newState =
+ (g_PlayerAssignments[Engine.GetPlayerGUID()].status + 1) % (this.readyControl.StayReady + 1);
+
+ for (let handler of this.readyButtonPressHandlers)
+ handler(newState);
+
+ this.readyControl.setReady(newState, true);
+ }
+
+ onPressRight()
+ {
+ if (g_PlayerAssignments[Engine.GetPlayerGUID()].status != this.readyControl.NotReady)
+ this.readyControl.setReady(this.readyControl.NotReady, true);
+ }
+}
+
+ReadyButton.prototype.Caption = [
+ translate("I'm ready"),
+ translate("Stay ready"),
+ translate("I'm not ready!")
+];
+
+ReadyButton.prototype.Tooltip = [
+ translate("State that you are ready to play."),
+ translate("Stay ready even when the game settings change."),
+ translate("State that you are not ready to play.")
+];
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/ReadyButton.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.xml (revision 23413)
@@ -0,0 +1,8 @@
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Buttons/StartGameButton.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.js (revision 23413)
@@ -0,0 +1,45 @@
+/**
+ * The TipsPanel shows some hints to newcomers.
+ * It is only shown in Singleplayer mode since the chat is shown instead in multiplayer mode.
+ */
+class TipsPanel
+{
+ constructor(gameSettingsPanel)
+ {
+ let available = !g_IsNetworked && Engine.ConfigDB_GetValue("user", this.Config) == "true";
+
+ this.spTips = Engine.GetGUIObjectByName("spTips");
+ this.spTips.hidden = !available;
+ if (!available)
+ return;
+
+ this.displaySPTips = Engine.GetGUIObjectByName("displaySPTips");
+ this.displaySPTips.onPress = this.onPress.bind(this);
+
+ Engine.GetGUIObjectByName("aiTips").caption =
+ Engine.TranslateLines(Engine.ReadFile(this.File));
+
+ gameSettingsPanel.registerGameSettingsPanelResizeHandler(this.onGameSettingsPanelResize.bind(this));
+ }
+
+ onPress()
+ {
+ Engine.ConfigDB_CreateAndWriteValueToFile(
+ "user",
+ this.Config,
+ String(this.displaySPTips.checked),
+ "config/user.cfg");
+ }
+
+ onGameSettingsPanelResize(settingsPanel)
+ {
+ this.spTips.hidden =
+ this.spTips.getComputedSize().right > settingsPanel.getComputedSize().left;
+ }
+}
+
+TipsPanel.prototype.File =
+ "gui/gamesetup/Pages/GameSetupPage/Panels/Tips.txt";
+
+TipsPanel.prototype.Config =
+ "gui.gamesetup.enabletips";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientChat.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientChat.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientChat.js (revision 23413)
@@ -0,0 +1,53 @@
+ChatMessageEvents.ClientChat = class
+{
+ constructor(chatMessagesPanel, netMessages)
+ {
+ this.chatMessagesPanel = chatMessagesPanel;
+
+ netMessages.registerNetMessageHandler("chat", this.onClientChat.bind(this));
+ this.usernameArgs = {};
+ this.messageArgs = {};
+
+ // TODO: Remove this global required by gui/common/
+ global.colorizePlayernameByGUID = this.colorizePlayernameByGUID.bind(this);
+ }
+
+ onClientChat(message)
+ {
+ this.usernameArgs.username = this.colorizePlayernameByGUID(message.guid);
+ this.messageArgs.username = setStringTags(sprintf(this.SenderFormat, this.usernameArgs), this.SenderTags);
+ this.messageArgs.message = escapeText(message.text);
+ this.chatMessagesPanel.addText(sprintf(this.MessageFormat, this.messageArgs));
+ }
+
+ colorizePlayernameByGUID(guid)
+ {
+ // TODO: Controllers should have the moderator-prefix
+ let username = g_PlayerAssignments[guid] ? escapeText(g_PlayerAssignments[guid].name) : translate("Unknown Player");
+ let playerID = g_PlayerAssignments[guid] ? g_PlayerAssignments[guid].player : -1;
+
+ let color = "white";
+ if (playerID > 0)
+ {
+ color = g_GameAttributes.settings.PlayerData[playerID - 1].Color;
+
+ // Enlighten playercolor to improve readability
+ let [h, s, l] = rgbToHsl(color.r, color.g, color.b);
+ let [r, g, b] = hslToRgb(h, s, Math.max(0.6, l));
+
+ color = rgbToGuiColor({ "r": r, "g": g, "b": b });
+ }
+
+ return coloredText(username, color);
+ }
+};
+
+ChatMessageEvents.ClientChat.prototype.SenderFormat =
+ translate("<%(username)s>");
+
+ChatMessageEvents.ClientChat.prototype.MessageFormat =
+ translate("%(username)s %(message)s");
+
+ChatMessageEvents.ClientChat.prototype.SenderTags = {
+ "font": "sans-bold-13"
+};
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/ClientChat.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/GameSettingsChanged.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/GameSettingsChanged.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/GameSettingsChanged.js (revision 23413)
@@ -0,0 +1,22 @@
+/**
+ * The purpose of this message is to indicate to the local player when settings they had agreed on changed.
+ */
+ChatMessageEvents.GameSettingsChanged = class
+{
+ constructor(chatMessagesPanel, netMessages, gameSettingsControl, playerAssignmentsControl, readyControl)
+ {
+ this.readyControl = readyControl;
+ this.chatMessagesPanel = chatMessagesPanel;
+
+ readyControl.registerResetReadyHandler(this.onResetReady.bind(this));
+ }
+
+ onResetReady()
+ {
+ if (this.readyControl.getLocalReadyState() == this.readyControl.Ready)
+ this.chatMessagesPanel.addStatusMessage(this.MessageText);
+ }
+};
+
+ChatMessageEvents.GameSettingsChanged.prototype.MessageText =
+ translate("Game settings have been changed");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/ChatMessages/GameSettingsChanged.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/StatusMessageFormat.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/StatusMessageFormat.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/StatusMessageFormat.js (revision 23413)
@@ -0,0 +1,28 @@
+/**
+ * Status messages are textual event notifications triggered by multi-user chat room actions.
+ */
+class StatusMessageFormat
+{
+ constructor()
+ {
+ this.args = {};
+ }
+
+ /**
+ * escapeText is the responsibility of the caller.
+ */
+ format(text)
+ {
+ this.args.message = text;
+ return setStringTags(
+ sprintf(this.MessageFormat, this.args),
+ this.MessageTags);
+ }
+}
+
+StatusMessageFormat.prototype.MessageFormat =
+ translate("== %(message)s");
+
+StatusMessageFormat.prototype.MessageTags = {
+ "font": "sans-bold-13"
+};
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Chat/StatusMessageFormat.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.js (revision 23413)
@@ -0,0 +1,41 @@
+class GameSettingWarning
+{
+ constructor(gameSettingsControl, cancelButton)
+ {
+ if (!g_IsNetworked)
+ return;
+
+ this.gameSettingWarning = Engine.GetGUIObjectByName("gameSettingWarning");
+
+ gameSettingsControl.registerGameAttributesBatchChangeHandler(this.onGameAttributesBatchChange.bind(this));
+ cancelButton.registerCancelButtonResizeHandler(this.onCancelButtonResize.bind(this));
+ }
+
+ onGameAttributesBatchChange()
+ {
+ let caption =
+ g_GameAttributes.settings.CheatsEnabled ?
+ this.CheatsEnabled :
+ g_GameAttributes.settings.RatingEnabled ?
+ this.RatingEnabled :
+ "";
+
+ 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.");
+
+GameSettingWarning.prototype.RatingEnabled =
+ translate("Rated game.");
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingWarning.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.xml (revision 23413)
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/MapPreview.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.js (revision 23413)
@@ -0,0 +1,17 @@
+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;
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/SetupWindow.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/SetupWindow.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/SetupWindow.js (revision 23413)
@@ -0,0 +1,112 @@
+/**
+ * The SetupWindow is the root class owning all other class instances.
+ * The class shall be ineligible to perform any GUI object logic and shall defer that task to owned classes.
+ */
+class SetupWindow
+{
+ constructor(initData, hotloadData)
+ {
+ if (!g_Settings)
+ return;
+
+ Engine.ProfileStart("SetupWindow");
+
+ this.loadHandlers = new Set();
+ this.closePageHandlers = new Set();
+ this.getHotloadDataHandlers = new Set();
+
+ let netMessages = new NetMessages(this);
+ let startGameControl = new StartGameControl(netMessages);
+ let mapCache = new MapCache();
+ let mapFilters = new MapFilters(mapCache);
+ let gameSettingsControl = new GameSettingsControl(this, netMessages, startGameControl, mapCache);
+ let playerAssignmentsControl = new PlayerAssignmentsControl(this, netMessages);
+ let readyControl = new ReadyControl(netMessages, gameSettingsControl, startGameControl, playerAssignmentsControl);
+
+ // These class instances control central data and do not manage any GUI Object.
+ this.controls = {
+ "gameSettingsControl": gameSettingsControl,
+ "playerAssignmentsControl": playerAssignmentsControl,
+ "mapCache": mapCache,
+ "mapFilters": mapFilters,
+ "readyControl": readyControl,
+ "startGameControl": startGameControl
+ };
+
+ // These class instances are interfaces to networked messages and do not manage any GUI Object.
+ this.networkControls = {
+ "netMessages": netMessages,
+ "gameRegisterStanza":
+ Engine.HasXmppClient() &&
+ new GameRegisterStanza(
+ initData, this, netMessages, gameSettingsControl, playerAssignmentsControl, mapCache)
+ };
+
+ // These are the pages within the setup window that may use the controls defined above
+ this.pages = {
+ "loadingPage": new LoadingPage(netMessages),
+ "gameSetupPage": new GameSetupPage(this, gameSettingsControl, playerAssignmentsControl, netMessages, this.networkControls.gameRegisterStanza, mapCache, mapFilters, startGameControl, readyControl)
+ };
+
+ setTimeout(displayGamestateNotifications, 1000);
+ Engine.GetGUIObjectByName("setupWindow").onTick = updateTimers;
+
+ // This event is triggered after all classes have been instantiated and subscribed to each others events
+ for (let handler of this.loadHandlers)
+ handler(initData, hotloadData);
+
+ Engine.ProfileStop();
+
+ if (gameSettingsControl.autostart)
+ startGameControl.launchGame();
+ }
+
+ registerLoadHandler(handler)
+ {
+ this.loadHandlers.add(handler);
+ }
+
+ unregisterLoadHandler(handler)
+ {
+ this.loadHandlers.delete(handler);
+ }
+
+ registerClosePageHandler(handler)
+ {
+ this.closePageHandlers.add(handler);
+ }
+
+ unregisterClosePageHandler(handler)
+ {
+ this.closePageHandlers.delete(handler);
+ }
+
+ registerGetHotloadDataHandler(handler)
+ {
+ this.getHotloadDataHandlers.add(handler);
+ }
+
+ unregisterGetHotloadDataHandler(handler)
+ {
+ this.getHotloadDataHandlers.delete(handler);
+ }
+
+ getHotloadData()
+ {
+ let object = {};
+ for (let handler of this.getHotloadDataHandlers)
+ handler(object);
+ return object;
+ }
+
+ closePage()
+ {
+ for (let handler of this.closePageHandlers)
+ handler();
+
+ if (Engine.HasXmppClient())
+ Engine.SwitchGuiPage("page_lobby.xml", { "dialog": false });
+ else
+ Engine.SwitchGuiPage("page_pregame.xml");
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/SetupWindow.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.xml (revision 23413)
@@ -0,0 +1,5 @@
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/GameSettingsTabs.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.xml (revision 23413)
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+ Show this message in the future.
+
+
+
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/TipsPanel.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.xml (revision 23413)
@@ -0,0 +1,11 @@
+
+
+
+
+ Loading
+
+
+
+ Loading map data. Please wait…
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tips.txt
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tips.txt (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tips.txt (revision 23413)
@@ -0,0 +1 @@
+Although reasonably easy for an experienced player, the default AI level is quite challenging for new players yet to master the basic mechanisms of the game. Beginners are advised to start by playing against a lower level AI (Sandbox or Very Easy). Change the AI level by clicking the gear icon next to the player you want to modify in the selection panel above.
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tips.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.js (revision 23413)
@@ -0,0 +1,25 @@
+/**
+ * The purpose of this page is to display a placeholder in multiplayer until the settings from the server have been received.
+ * This is not technically necessary, but only performed to avoid confusion or irritation when showing the clients first the
+ * default settings and then switching to the server settings quickly thereafter.
+ */
+class LoadingPage
+{
+ constructor(netMessages)
+ {
+ if (g_IsNetworked)
+ netMessages.registerNetMessageHandler("gamesetup", this.hideLoadingPage.bind(this));
+ else
+ this.hideLoadingPage();
+ }
+
+ hideLoadingPage()
+ {
+ let loadingPage = Engine.GetGUIObjectByName("loadingPage");
+ if (loadingPage.hidden)
+ return;
+
+ loadingPage.hidden = true;
+ Engine.GetGUIObjectByName("setupWindow").hidden = false;
+ }
+}
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/LoadingPage/LoadingPage.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.xml (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.xml (revision 23413)
@@ -1,30 +1,31 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
Match Setup
-
-
-
+
+
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/SoundNotification.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/SoundNotification.js (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/SoundNotification.js (revision 23413)
@@ -0,0 +1,28 @@
+class SoundNotification
+{
+ constructor(netMessages, playerAssignmentsControl)
+ {
+ netMessages.registerNetMessageHandler("chat", this.onClientChat.bind(this));
+ playerAssignmentsControl.registerClientJoinHandler(this.onClientJoin.bind(this));
+ }
+
+ onClientJoin(guid)
+ {
+ if (guid != Engine.GetPlayerGUID())
+ soundNotification(this.ConfigJoinNotification);
+ }
+
+ onClientChat(message)
+ {
+ if (message.guid != Engine.GetPlayerGUID() &&
+ message.text.toLowerCase().indexOf(
+ splitRatingFromNick(g_PlayerAssignments[Engine.GetPlayerGUID()].name).nick.toLowerCase()) != -1)
+ soundNotification(this.ConfigNickNotification);
+ }
+}
+
+SoundNotification.prototype.ConfigJoinNotification =
+ "gamesetup.join";
+
+SoundNotification.prototype.ConfigNickNotification =
+ "nick";
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/SoundNotification.js
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.xml (nonexistent)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.xml (revision 23413)
@@ -0,0 +1,7 @@
+
+
Property changes on: ps/trunk/binaries/data/mods/public/gui/gamesetup/Pages/GameSetupPage/Panels/Tooltip.xml
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Index: ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js (revision 23412)
+++ ps/trunk/binaries/data/mods/public/gui/gamesetup/gamesetup.js (revision 23413)
@@ -1,50 +1,50 @@
// TODO: Remove these globals by rewriting gamedescription.js
const g_MapSizes = prepareForDropdown(g_Settings && g_Settings.MapSizes);
const g_MapTypes = prepareForDropdown(g_Settings && g_Settings.MapTypes);
const g_PopulationCapacities = prepareForDropdown(g_Settings && g_Settings.PopulationCapacities);
const g_StartingResources = prepareForDropdown(g_Settings && g_Settings.StartingResources);
const g_VictoryConditions = g_Settings && g_Settings.VictoryConditions;
/**
* Offer users to select playable civs only.
* Load unselectable civs as they could appear in scenario maps.
*/
const g_CivData = loadCivData(false, false);
/**
* Whether this is a single- or multiplayer match.
*/
const g_IsNetworked = Engine.HasNetClient();
/**
* Is this user in control of game settings (i.e. is a network server, or offline player).
*/
const g_IsController = !g_IsNetworked || Engine.HasNetServer();
/**
* Central data storing all settings relevant to the map generation and simulation.
*/
var g_GameAttributes = {};
/**
* Remembers which clients are assigned to which player slots and whether they are ready.
* The keys are GUIDs or "local" in single-player.
*/
var g_PlayerAssignments = {};
/**
* This instance owns all handlers that control the two synchronized states g_GameAttributes and g_PlayerAssignments.
*/
-var g_GamesetupPage;
+var g_SetupWindow;
// TODO: Remove these two global functions by specifying the JS class name in the XML of the GUI page.
function init(initData, hotloadData)
{
- g_GamesetupPage = new GamesetupPage(initData, hotloadData);
+ g_SetupWindow = new SetupWindow(initData, hotloadData);
}
function getHotloadData()
{
- return g_GamesetupPage.getHotloadData();
+ return g_SetupWindow.getHotloadData();
}