From 47b3ed5cbffd37f645675184c12507d2aaffa516 Mon Sep 17 00:00:00 2001 From: tobspr Date: Sun, 21 Jun 2020 20:47:37 +0200 Subject: [PATCH] Add option to render info boxes compact --- src/css/ingame_hud/building_placer.scss | 13 +++++++++++++ src/js/changelog.js | 1 + src/js/game/hud/parts/building_placer.js | 4 ++++ src/js/profile/application_settings.js | 9 ++++++++- translations/base-en.yaml | 5 +++++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/css/ingame_hud/building_placer.scss b/src/css/ingame_hud/building_placer.scss index 99c4d654..e63868ab 100644 --- a/src/css/ingame_hud/building_placer.scss +++ b/src/css/ingame_hud/building_placer.scss @@ -75,6 +75,15 @@ @include StyleBelowWidth(700px) { display: none !important; } + + &.compact { + width: unset !important; + grid-template-columns: 1fr; + .buildingImage, + .description > .text { + display: none; + } + } } #ingame_HUD_PlacerVariants { @@ -86,6 +95,10 @@ flex-direction: column; align-items: flex-end; + &.compact { + @include S(top, 150px); + } + .explanation { text-transform: uppercase; grid-row: 1 / 2; diff --git a/src/js/changelog.js b/src/js/changelog.js index 0d980695..da5ec97c 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -9,6 +9,7 @@ export const CHANGELOG = [ "Automatically deselect area when selecting a new building", "Raise markers limit from 14 characters to 71 (by Joker-vD)", "Optimize performance by caching miner items (by Phlosioneer)", + "Added setting to enable compact building infos, which only show ratios and hide the image / description", "Apply dark theme to menu as well (by dengr1065)", "Fix belt planner not placing the last belt", "Fix buildings getting deleted when right clicking while placing a blueprint", diff --git a/src/js/game/hud/parts/building_placer.js b/src/js/game/hud/parts/building_placer.js index 3a8ed0db..5faec6ab 100644 --- a/src/js/game/hud/parts/building_placer.js +++ b/src/js/game/hud/parts/building_placer.js @@ -38,6 +38,10 @@ export class HUDBuildingPlacer extends HUDBuildingPlacerLogic { this.buildingInfoElements.tutorialImage = makeDiv(this.element, null, ["buildingImage"]); this.variantsElement = makeDiv(parent, "ingame_HUD_PlacerVariants"); + + const compact = this.root.app.settings.getAllSettings().compactBuildingInfo; + this.element.classList.toggle("compact", compact); + this.variantsElement.classList.toggle("compact", compact); } initialize() { diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index d1216c60..964fb885 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -200,6 +200,7 @@ export const allApplicationSettings = [ new BoolSetting("alwaysMultiplace", categoryGame, (app, value) => {}), new BoolSetting("enableTunnelSmartplace", categoryGame, (app, value) => {}), new BoolSetting("vignette", categoryGame, (app, value) => {}), + new BoolSetting("compactBuildingInfo", categoryGame, (app, value) => {}), ]; export function getApplicationSettingById(id) { @@ -223,6 +224,7 @@ class SettingsStorage { this.offerHints = true; this.enableTunnelSmartplace = true; this.vignette = true; + this.compactBuildingInfo = false; /** * @type {Object.} @@ -412,7 +414,7 @@ export class ApplicationSettings extends ReadWriteProxy { } getCurrentVersion() { - return 12; + return 13; } /** @param {{settings: SettingsStorage, version: number}} data */ @@ -459,6 +461,11 @@ export class ApplicationSettings extends ReadWriteProxy { data.version = 12; } + if (data.version < 13) { + data.settings.compactBuildingInfo = false; + data.version = 13; + } + return ExplainedResult.good(); } } diff --git a/translations/base-en.yaml b/translations/base-en.yaml index afe4907d..52f4ab3c 100644 --- a/translations/base-en.yaml +++ b/translations/base-en.yaml @@ -686,6 +686,11 @@ settings: description: >- Enables the vignette which darkens the screen corners and makes text easier to read. + compactBuildingInfo: + title: Compact Building Infos + description: >- + Shortens info boxes for buildings by only showing their ratios. Otherwise a description and image is shown. + keybindings: title: Keybindings hint: >-