From 4ee33193975ac8f234cb2d869256c2b12fd731f0 Mon Sep 17 00:00:00 2001 From: bijx Date: Sat, 20 Dec 2025 14:09:44 -0500 Subject: [PATCH] Feat: Added cursor price option to user and basic settings (#2655) ## Description: Following the hotkey cursor price textbox addition of #2650, this feature adds the option to enable and disable the visual feature via the User Settings menu or the Basic Settings modal in game. Also added a [new icon](https://thenounproject.com/icon/pay-per-click-2586454/) for the Basic Settings modal from the Noun Project and added credit for it to the `CREDITS.md` file. ### Video Demo https://github.com/user-attachments/assets/1667081e-45e3-4b11-9bda-3f00c341e03c ### User Settings Menu image ### Basic Settings Menu image ## 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 ## Please put your Discord username so you can be contacted if a bug or regression is found: bijx --- CREDITS.md | 1 + resources/images/CursorPriceIconWhite.svg | 113 ++++++++++++++++++ resources/lang/en.json | 2 + src/client/UserSettingModal.ts | 18 +++ src/client/graphics/layers/SettingsModal.ts | 31 +++++ .../graphics/layers/StructureDrawingUtils.ts | 2 + .../graphics/layers/StructureIconsLayer.ts | 17 ++- src/core/game/UserSettings.ts | 9 ++ 8 files changed, 188 insertions(+), 5 deletions(-) create mode 100644 resources/images/CursorPriceIconWhite.svg diff --git a/CREDITS.md b/CREDITS.md index 01de8a95b..e17b2b575 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -49,3 +49,4 @@ Copyright © opentopography.org. All Rights Reserved. [Terms of Use](https://ope ### [The Noun Project](https://thenounproject.com/) Stats icon by [Meko](https://thenounproject.com/mekoda/) – https://thenounproject.com/icon/stats-4942475/ +Pay Per Click icon by [Fauzan Adiima](https://thenounproject.com/creator/fauzan94/) – https://thenounproject.com/icon/pay-per-click-2586454/ diff --git a/resources/images/CursorPriceIconWhite.svg b/resources/images/CursorPriceIconWhite.svg new file mode 100644 index 000000000..edc28312d --- /dev/null +++ b/resources/images/CursorPriceIconWhite.svg @@ -0,0 +1,113 @@ + + + + + + + + + + + + + + + + pay per click, ppc, click, cost per click, mouse + + + + + Created by Fauzan Adiima + from the Noun Project + diff --git a/resources/lang/en.json b/resources/lang/en.json index 8a81345f3..ad8f421aa 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -376,6 +376,8 @@ "special_effects_desc": "Toggle special effects. Deactivate to improve performances", "structure_sprites_label": "Structure Sprites", "structure_sprites_desc": "Toggle structure sprites", + "cursor_cost_label_label": "Cursor Build Cost", + "cursor_cost_label_desc": "Show a cost pill under the build cursor icon", "anonymous_names_label": "Hidden Names", "anonymous_names_desc": "Hide real player names with random ones on your screen.", "lobby_id_visibility_label": "Hidden Lobby IDs", diff --git a/src/client/UserSettingModal.ts b/src/client/UserSettingModal.ts index 3fa54b34d..39f2967c7 100644 --- a/src/client/UserSettingModal.ts +++ b/src/client/UserSettingModal.ts @@ -143,6 +143,15 @@ export class UserSettingModal extends LitElement { console.log("🏠 Structure sprites:", enabled ? "ON" : "OFF"); } + private toggleCursorCostLabel(e: CustomEvent<{ checked: boolean }>) { + const enabled = e.detail?.checked; + if (typeof enabled !== "boolean") return; + + this.userSettings.set("settings.cursorCostLabel", enabled); + + console.log("💰 Cursor build cost:", enabled ? "ON" : "OFF"); + } + private toggleAnonymousNames(e: CustomEvent<{ checked: boolean }>) { const enabled = e.detail?.checked; if (typeof enabled !== "boolean") return; @@ -309,6 +318,15 @@ export class UserSettingModal extends LitElement { @change=${this.toggleStructureSprites} > + + + + +