From 9e88512d2ab3fa1f1d225f0346d3a157537aa981 Mon Sep 17 00:00:00 2001 From: elexis Date: Wed, 4 Apr 2018 17:35:25 +0000 Subject: [PATCH] Disable some session buttons while in Atlas rather than spamming JS error stacks onTick. These three dialogs assume to be able to read the gameSettings, but Atlas doesn't provide them yet following the commits in #3143 and #3263. Refs #4199. git-svn-id: https://svn.wildfiregames.com/public/ps/trunk@21658 3db68df2-c116-0410-a063-a993310a9797 --- binaries/data/mods/public/gui/session/menu.js | 5 ++++- binaries/data/mods/public/gui/session/session.js | 4 ++-- binaries/data/mods/public/gui/session/top_panel/button_diplomacy.xml | 2 +- binaries/data/mods/public/gui/session/top_panel/button_trade.xml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/binaries/data/mods/public/gui/session/menu.js b/binaries/data/mods/public/gui/session/menu.js index 314fb2e732..b44f87989d 100644 --- a/binaries/data/mods/public/gui/session/menu.js +++ b/binaries/data/mods/public/gui/session/menu.js @@ -77,7 +77,10 @@ var g_FlushTributing = function() {}; function initMenu() { Engine.GetGUIObjectByName("menu").size = "100%-164 " + MENU_TOP + " 100% " + MENU_BOTTOM; - Engine.GetGUIObjectByName("menuExitButton").enabled = !Engine.IsAtlasRunning(); + + // TODO: Atlas should pass g_GameAttributes.settings + for (let button of ["menuExitButton", "summaryButton", "objectivesButton", "diplomacyButton"]) + Engine.GetGUIObjectByName(button).enabled = !Engine.IsAtlasRunning(); } function updateMenuPosition(dt) diff --git a/binaries/data/mods/public/gui/session/session.js b/binaries/data/mods/public/gui/session/session.js index b965f3ea83..2a295c6127 100644 --- a/binaries/data/mods/public/gui/session/session.js +++ b/binaries/data/mods/public/gui/session/session.js @@ -696,8 +696,8 @@ function updateTopPanel() resPop.size = resPopSize; Engine.GetGUIObjectByName("population").hidden = !isPlayer; - Engine.GetGUIObjectByName("diplomacyButton1").hidden = !isPlayer; - Engine.GetGUIObjectByName("tradeButton1").hidden = !isPlayer; + Engine.GetGUIObjectByName("diplomacyButton").hidden = !isPlayer; + Engine.GetGUIObjectByName("tradeButton").hidden = !isPlayer; Engine.GetGUIObjectByName("observerText").hidden = isPlayer; let alphaLabel = Engine.GetGUIObjectByName("alphaLabel"); diff --git a/binaries/data/mods/public/gui/session/top_panel/button_diplomacy.xml b/binaries/data/mods/public/gui/session/top_panel/button_diplomacy.xml index c4db8deac2..4050d8dc56 100644 --- a/binaries/data/mods/public/gui/session/top_panel/button_diplomacy.xml +++ b/binaries/data/mods/public/gui/session/top_panel/button_diplomacy.xml @@ -1,6 +1,6 @@