From 229299399549d06165252525a8a5cfa0fc7143f2 Mon Sep 17 00:00:00 2001 From: Aotumuri Date: Sat, 19 Jul 2025 00:55:55 +0900 Subject: [PATCH] bug fix?: Hide UnitDisplay frame when all unit types are disabled (#1392) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description: This PR updates the UnitDisplay component so that when all unit types (City, Factory, Port, Defense Post, Missile Silo, SAM Launcher) are disabled in the game config, the UI frame itself will also be hidden. This is a box that shows how many and what types of units the player currently owns. There’s a feature where, if unit types are disabled in the settings, the corresponding parts of the UI will disappear. However, if all unit types are disabled, for some reason the outer container still remains visible. While this might not be a critical issue, I feel it’s unnecessary and redundant, so I’d like to remove it. Alternatively, we could consider keeping the box as a kind of placeholder to indicate that some kind of menu might appear there. But since it serves no purpose during gameplay in that state, I think it would just be meaningless UI. before スクリーンショット 2025-07-10 12 49 37 スクリーンショット 2025-07-10 12 49 47 after スクリーンショット 2025-07-10 12 48 08 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: aotumuri --- src/client/graphics/layers/UnitDisplay.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/client/graphics/layers/UnitDisplay.ts b/src/client/graphics/layers/UnitDisplay.ts index 4ea0e629e..fbe79c955 100644 --- a/src/client/graphics/layers/UnitDisplay.ts +++ b/src/client/graphics/layers/UnitDisplay.ts @@ -24,12 +24,21 @@ export class UnitDisplay extends LitElement implements Layer { private _port = 0; private _defensePost = 0; private _samLauncher = 0; + private allDisabled = false; createRenderRoot() { return this; } init() { + const config = this.game.config(); + this.allDisabled = + config.isUnitDisabled(UnitType.City) && + config.isUnitDisabled(UnitType.Factory) && + config.isUnitDisabled(UnitType.Port) && + config.isUnitDisabled(UnitType.DefensePost) && + config.isUnitDisabled(UnitType.MissileSilo) && + config.isUnitDisabled(UnitType.SAMLauncher); this.requestUpdate(); } @@ -89,6 +98,10 @@ export class UnitDisplay extends LitElement implements Layer { return null; } + if (this.allDisabled) { + return null; + } + return html`