mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Add multiple performance settings
This commit is contained in:
@@ -19,6 +19,7 @@ const logger = createLogger("application_settings");
|
||||
export const enumCategories = {
|
||||
general: "general",
|
||||
userInterface: "userInterface",
|
||||
performance: "performance",
|
||||
advanced: "advanced",
|
||||
};
|
||||
|
||||
@@ -147,20 +148,6 @@ export const allApplicationSettings = [
|
||||
(app, id) => app.updateAfterUiScaleChanged(),
|
||||
}),
|
||||
|
||||
new BoolSetting(
|
||||
"fullscreen",
|
||||
enumCategories.general,
|
||||
/**
|
||||
* @param {Application} app
|
||||
*/
|
||||
(app, value) => {
|
||||
if (app.platformWrapper.getSupportsFullscreen()) {
|
||||
app.platformWrapper.setFullscreen(value);
|
||||
}
|
||||
},
|
||||
!IS_DEMO
|
||||
),
|
||||
|
||||
new BoolSetting(
|
||||
"soundsMuted",
|
||||
enumCategories.general,
|
||||
@@ -178,6 +165,20 @@ export const allApplicationSettings = [
|
||||
(app, value) => app.sound.setMusicMuted(value)
|
||||
),
|
||||
|
||||
new BoolSetting(
|
||||
"fullscreen",
|
||||
enumCategories.general,
|
||||
/**
|
||||
* @param {Application} app
|
||||
*/
|
||||
(app, value) => {
|
||||
if (app.platformWrapper.getSupportsFullscreen()) {
|
||||
app.platformWrapper.setFullscreen(value);
|
||||
}
|
||||
},
|
||||
!IS_DEMO
|
||||
),
|
||||
|
||||
new BoolSetting(
|
||||
"enableColorBlindHelper",
|
||||
enumCategories.general,
|
||||
@@ -187,7 +188,6 @@ export const allApplicationSettings = [
|
||||
(app, value) => null
|
||||
),
|
||||
|
||||
// GAME
|
||||
new BoolSetting("offerHints", enumCategories.userInterface, (app, value) => {}),
|
||||
|
||||
new EnumSetting("theme", {
|
||||
@@ -220,16 +220,6 @@ export const allApplicationSettings = [
|
||||
(app, id) => null,
|
||||
}),
|
||||
|
||||
new EnumSetting("refreshRate", {
|
||||
options: ["60", "75", "100", "120", "144", "165", "250", G_IS_DEV ? "10" : "500"],
|
||||
valueGetter: rate => rate,
|
||||
textGetter: rate => rate + " Hz",
|
||||
category: enumCategories.advanced,
|
||||
restartRequired: false,
|
||||
changeCb: (app, id) => {},
|
||||
enabled: !IS_DEMO,
|
||||
}),
|
||||
|
||||
new EnumSetting("scrollWheelSensitivity", {
|
||||
options: scrollWheelSensitivities.sort((a, b) => a.scale - b.scale),
|
||||
valueGetter: scale => scale.id,
|
||||
@@ -258,6 +248,20 @@ export const allApplicationSettings = [
|
||||
new BoolSetting("compactBuildingInfo", enumCategories.userInterface, (app, value) => {}),
|
||||
new BoolSetting("disableCutDeleteWarnings", enumCategories.advanced, (app, value) => {}),
|
||||
new BoolSetting("rotationByBuilding", enumCategories.advanced, (app, value) => {}),
|
||||
|
||||
new EnumSetting("refreshRate", {
|
||||
options: ["60", "75", "100", "120", "144", "165", "250", "500"],
|
||||
valueGetter: rate => rate,
|
||||
textGetter: rate => rate + " Hz",
|
||||
category: enumCategories.performance,
|
||||
restartRequired: false,
|
||||
changeCb: (app, id) => {},
|
||||
enabled: !IS_DEMO,
|
||||
}),
|
||||
|
||||
new BoolSetting("lowQualityMapResources", enumCategories.performance, (app, value) => {}),
|
||||
new BoolSetting("disableTileGrid", enumCategories.performance, (app, value) => {}),
|
||||
new BoolSetting("lowQualityTextures", enumCategories.performance, (app, value) => {}),
|
||||
];
|
||||
|
||||
export function getApplicationSettingById(id) {
|
||||
@@ -288,6 +292,10 @@ class SettingsStorage {
|
||||
|
||||
this.enableColorBlindHelper = false;
|
||||
|
||||
this.lowQualityMapResources = false;
|
||||
this.disableTileGrid = false;
|
||||
this.lowQualityTextures = false;
|
||||
|
||||
/**
|
||||
* @type {Object.<string, number>}
|
||||
*/
|
||||
@@ -487,7 +495,7 @@ export class ApplicationSettings extends ReadWriteProxy {
|
||||
}
|
||||
|
||||
getCurrentVersion() {
|
||||
return 18;
|
||||
return 21;
|
||||
}
|
||||
|
||||
/** @param {{settings: SettingsStorage, version: number}} data */
|
||||
@@ -565,6 +573,21 @@ export class ApplicationSettings extends ReadWriteProxy {
|
||||
data.version = 18;
|
||||
}
|
||||
|
||||
if (data.version < 19) {
|
||||
data.settings.lowQualityMapResources = false;
|
||||
data.version = 19;
|
||||
}
|
||||
|
||||
if (data.version < 20) {
|
||||
data.settings.disableTileGrid = false;
|
||||
data.version = 20;
|
||||
}
|
||||
|
||||
if (data.version < 21) {
|
||||
data.settings.lowQualityTextures = false;
|
||||
data.version = 21;
|
||||
}
|
||||
|
||||
return ExplainedResult.good();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user