Allow hiding kiwi clicker link - try 2

This commit is contained in:
tobspr 2022-06-22 16:18:36 +02:00
parent befd8a7877
commit d976245cc1
3 changed files with 19 additions and 9 deletions

View File

@ -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.<string, number>}
*/
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);

View File

@ -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 = `
<h3>${T.demoBanners.titleV2}</h3>
@ -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;
}

View File

@ -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;
}