|
|
@ -8,6 +8,7 @@ import { createLogger } from "../core/logging";
|
|
|
|
import { ExplainedResult } from "../core/explained_result";
|
|
|
|
import { ExplainedResult } from "../core/explained_result";
|
|
|
|
import { THEMES, THEME, applyGameTheme } from "../game/theme";
|
|
|
|
import { THEMES, THEME, applyGameTheme } from "../game/theme";
|
|
|
|
import { IS_DEMO } from "../core/config";
|
|
|
|
import { IS_DEMO } from "../core/config";
|
|
|
|
|
|
|
|
import { T } from "../translations";
|
|
|
|
|
|
|
|
|
|
|
|
const logger = createLogger("application_settings");
|
|
|
|
const logger = createLogger("application_settings");
|
|
|
|
|
|
|
|
|
|
|
@ -18,27 +19,45 @@ export const uiScales = [
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: "super_small",
|
|
|
|
id: "super_small",
|
|
|
|
size: 0.6,
|
|
|
|
size: 0.6,
|
|
|
|
label: "Super small",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: "small",
|
|
|
|
id: "small",
|
|
|
|
size: 0.8,
|
|
|
|
size: 0.8,
|
|
|
|
label: "Small",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: "regular",
|
|
|
|
id: "regular",
|
|
|
|
size: 1,
|
|
|
|
size: 1,
|
|
|
|
label: "Regular",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: "large",
|
|
|
|
id: "large",
|
|
|
|
size: 1.2,
|
|
|
|
size: 1.2,
|
|
|
|
label: "Large",
|
|
|
|
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
{
|
|
|
|
id: "huge",
|
|
|
|
id: "huge",
|
|
|
|
size: 1.4,
|
|
|
|
size: 1.4,
|
|
|
|
label: "Huge",
|
|
|
|
},
|
|
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export const scrollWheelSensitivities = [
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
id: "super_slow",
|
|
|
|
|
|
|
|
scale: 0.25,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
id: "slow",
|
|
|
|
|
|
|
|
scale: 0.5,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
id: "regular",
|
|
|
|
|
|
|
|
scale: 1,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
id: "fast",
|
|
|
|
|
|
|
|
scale: 2,
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
id: "super_fast",
|
|
|
|
|
|
|
|
scale: 4,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
@ -47,7 +66,7 @@ export const allApplicationSettings = [
|
|
|
|
new EnumSetting("uiScale", {
|
|
|
|
new EnumSetting("uiScale", {
|
|
|
|
options: uiScales.sort((a, b) => a.size - b.size),
|
|
|
|
options: uiScales.sort((a, b) => a.size - b.size),
|
|
|
|
valueGetter: scale => scale.id,
|
|
|
|
valueGetter: scale => scale.id,
|
|
|
|
textGetter: scale => scale.label,
|
|
|
|
textGetter: scale => T.settings.labels.uiScale.scales[scale.id],
|
|
|
|
category: categoryApp,
|
|
|
|
category: categoryApp,
|
|
|
|
restartRequired: false,
|
|
|
|
restartRequired: false,
|
|
|
|
changeCb:
|
|
|
|
changeCb:
|
|
|
@ -56,6 +75,7 @@ export const allApplicationSettings = [
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
(app, id) => app.updateAfterUiScaleChanged(),
|
|
|
|
(app, id) => app.updateAfterUiScaleChanged(),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
|
|
new BoolSetting(
|
|
|
|
new BoolSetting(
|
|
|
|
"fullscreen",
|
|
|
|
"fullscreen",
|
|
|
|
categoryApp,
|
|
|
|
categoryApp,
|
|
|
@ -86,6 +106,18 @@ export const allApplicationSettings = [
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
(app, value) => app.sound.setMusicMuted(value)
|
|
|
|
(app, value) => app.sound.setMusicMuted(value)
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
new EnumSetting("scrollWheelSensitivity", {
|
|
|
|
|
|
|
|
options: scrollWheelSensitivities.sort((a, b) => a.scale - b.scale),
|
|
|
|
|
|
|
|
valueGetter: scale => scale.id,
|
|
|
|
|
|
|
|
textGetter: scale => T.settings.labels.scrollWheelSensitivity.sensitivity[scale.id],
|
|
|
|
|
|
|
|
category: categoryApp,
|
|
|
|
|
|
|
|
restartRequired: false,
|
|
|
|
|
|
|
|
changeCb:
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* @param {Application} app
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
(app, id) => app.updateAfterUiScaleChanged(),
|
|
|
|
|
|
|
|
}),
|
|
|
|
|
|
|
|
|
|
|
|
// GAME
|
|
|
|
// GAME
|
|
|
|
new EnumSetting("theme", {
|
|
|
|
new EnumSetting("theme", {
|
|
|
@ -132,6 +164,7 @@ class SettingsStorage {
|
|
|
|
this.musicMuted = false;
|
|
|
|
this.musicMuted = false;
|
|
|
|
this.theme = "light";
|
|
|
|
this.theme = "light";
|
|
|
|
this.refreshRate = "60";
|
|
|
|
this.refreshRate = "60";
|
|
|
|
|
|
|
|
this.scrollWheelSensitivity = "regular";
|
|
|
|
|
|
|
|
|
|
|
|
this.alwaysMultiplace = false;
|
|
|
|
this.alwaysMultiplace = false;
|
|
|
|
this.offerHints = true;
|
|
|
|
this.offerHints = true;
|
|
|
@ -207,6 +240,17 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|
|
|
return 1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
getScrollWheelSensitivity() {
|
|
|
|
|
|
|
|
const id = this.getAllSettings().scrollWheelSensitivity;
|
|
|
|
|
|
|
|
for (let i = 0; i < scrollWheelSensitivities.length; ++i) {
|
|
|
|
|
|
|
|
if (scrollWheelSensitivities[i].id === id) {
|
|
|
|
|
|
|
|
return scrollWheelSensitivities[i].scale;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
logger.error("Unknown scroll wheel sensitivity id:", id);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getIsFullScreen() {
|
|
|
|
getIsFullScreen() {
|
|
|
|
return this.getAllSettings().fullscreen;
|
|
|
|
return this.getAllSettings().fullscreen;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -293,7 +337,7 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
getCurrentVersion() {
|
|
|
|
getCurrentVersion() {
|
|
|
|
return 7;
|
|
|
|
return 8;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/** @param {{settings: SettingsStorage, version: number}} data */
|
|
|
|
/** @param {{settings: SettingsStorage, version: number}} data */
|
|
|
@ -315,6 +359,11 @@ export class ApplicationSettings extends ReadWriteProxy {
|
|
|
|
data.version = 7;
|
|
|
|
data.version = 7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (data.version < 8) {
|
|
|
|
|
|
|
|
data.settings.scrollWheelSensitivity = "regular";
|
|
|
|
|
|
|
|
data.version = 8;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return ExplainedResult.good();
|
|
|
|
return ExplainedResult.good();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|