From d976245cc18cfb7de698512b57ef7c128e06256d Mon Sep 17 00:00:00 2001 From: tobspr Date: Wed, 22 Jun 2022 16:18:36 +0200 Subject: [PATCH] Allow hiding kiwi clicker link - try 2 --- src/js/profile/application_settings.js | 14 ++++++++++++-- src/js/states/main_menu.js | 9 +++++---- src/js/states/settings.js | 5 ++--- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/js/profile/application_settings.js b/src/js/profile/application_settings.js index 33dd9e84..85156dc0 100644 --- a/src/js/profile/application_settings.js +++ b/src/js/profile/application_settings.js @@ -140,7 +140,7 @@ function initializeSettings() { options: Object.keys(LANGUAGES), valueGetter: key => key, textGetter: key => LANGUAGES[key].name, - category: enumCategories.general, + category: G_CHINA_VERSION || G_WEGAME_VERSION ? null : enumCategories.general, restartRequired: true, changeCb: (app, id) => null, magicValue: "auto-detect", @@ -286,7 +286,10 @@ function initializeSettings() { new BoolSetting("lowQualityMapResources", enumCategories.performance, (app, value) => {}), new BoolSetting("disableTileGrid", enumCategories.performance, (app, value) => {}), new BoolSetting("lowQualityTextures", enumCategories.performance, (app, value) => {}), + new BoolSetting("simplifiedBelts", enumCategories.performance, (app, value) => {}), + + new BoolSetting("showKiwiClicker", null, (app, value) => {}), ]; } @@ -331,6 +334,8 @@ class SettingsStorage { * @type {Object.} */ this.keybindingOverrides = {}; + + this.showKiwiClicker = true; } } @@ -547,7 +552,7 @@ export class ApplicationSettings extends ReadWriteProxy { } getCurrentVersion() { - return 31; + return 32; } /** @param {{settings: SettingsStorage, version: number}} data */ @@ -699,6 +704,11 @@ export class ApplicationSettings extends ReadWriteProxy { data.version = 31; } + if (data.version < 32) { + data.settings.showKiwiClicker = true; + data.version = 32; + } + // MODS if (!THEMES[data.settings.theme] || !this.app.restrictionMgr.getHasExtendedSettings()) { console.log("Resetting theme because its no longer available: " + data.settings.theme); diff --git a/src/js/states/main_menu.js b/src/js/states/main_menu.js index e925dd00..656446ff 100644 --- a/src/js/states/main_menu.js +++ b/src/js/states/main_menu.js @@ -42,7 +42,8 @@ export class MainMenuState extends GameState { const showLanguageIcon = !G_CHINA_VERSION && !G_WEGAME_VERSION; const showExitAppButton = G_IS_STANDALONE; const showPuzzleDLC = - !G_WEGAME_VERSION && (G_IS_STANDALONE || WEB_STEAM_SSO_AUTHENTICATED) && !G_IS_STEAM_DEMO; + G_IS_DEV || + (!G_WEGAME_VERSION && (G_IS_STANDALONE || WEB_STEAM_SSO_AUTHENTICATED) && !G_IS_STEAM_DEMO); const showWegameFooter = G_WEGAME_VERSION; const hasMods = MODS.anyModsActive(); @@ -74,7 +75,7 @@ export class MainMenuState extends GameState { !G_IS_STEAM_DEMO && /** @type { PlatformWrapperImplElectron}*/ (this.app.platformWrapper).dlcs.puzzle); - const showKiwiClicker = window.localStorage.getItem("hide_kiwi_clicker") !== "1"; + const showKiwiClicker = this.app.settings.getSetting("showKiwiClicker"); const bannerHtml = `

${T.demoBanners.titleV2}

@@ -581,9 +582,9 @@ export class MainMenuState extends GameState { } hideKiwiClicker() { - window.localStorage.setItem("hide_kiwi_clicker", "1"); + this.app.settings.updateSetting("showKiwiClicker", false); + this.app.settings.save(); this.htmlElement.querySelector(".kiwiClicker").remove(); - return STOP_PROPAGATION; } diff --git a/src/js/states/settings.js b/src/js/states/settings.js index 9ea38855..0927fbf9 100644 --- a/src/js/states/settings.js +++ b/src/js/states/settings.js @@ -88,8 +88,7 @@ export class SettingsState extends TextualGameState { for (let i = 0; i < this.app.settings.settingHandles.length; ++i) { const setting = this.app.settings.settingHandles[i]; - - if ((G_CHINA_VERSION || G_WEGAME_VERSION) && setting.id === "language") { + if (!setting.categoryId) { continue; } @@ -170,7 +169,7 @@ export class SettingsState extends TextualGameState { initSettings() { this.app.settings.settingHandles.forEach(setting => { - if ((G_CHINA_VERSION || G_WEGAME_VERSION) && setting.id === "language") { + if (!setting.categoryId) { return; }