1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-12 10:59:23 +00:00

change how debug settings are disabled

This commit is contained in:
Dimava 2020-05-29 17:16:56 +03:00
parent 480d5b22fd
commit dee2354ff3
2 changed files with 12 additions and 8 deletions

View File

@ -205,11 +205,15 @@ export const allApplicationSettings = [
/** @type {Array<BaseSetting>} */
export const allDebugSettings = [];
for (const k in globalConfig.debug) {
if (!IS_DEBUG) break;
allDebugSettings.push(
new BoolSetting("debug_" + k, categoryDebug, (app, value) => {
new BoolSetting(
"debug_" + k,
categoryDebug,
(app, value) => {
if (globalConfig.debug.enableDebugSettings) globalConfig.debug[k] = value;
})
},
IS_DEBUG
)
);
}
allApplicationSettings.push(...allDebugSettings);

View File

@ -41,20 +41,20 @@ export class SettingsState extends TextualGameState {
getSettingsHtml() {
let lastCategory = null;
let html = "";
const hideDebug = IS_DEBUG ? "" : " style='display:none'";
for (let i = 0; i < allApplicationSettings.length; ++i) {
const setting = allApplicationSettings[i];
const hidden = allDebugSettings.indexOf(setting) != -1 && !globalConfig.debug.enableDebugSettings;
if (setting.categoryId !== lastCategory) {
lastCategory = setting.categoryId;
const isHidden = setting.categoryId == categoryDebug && !IS_DEBUG;
if (i !== 0) {
html += "</div>";
}
html += `<strong class="categoryLabel"${lastCategory == categoryDebug ? hideDebug : ""}>${
html += `<strong class='categoryLabel'${isHidden ? " style='display:none'" : ""}>${
T.settings.categories[lastCategory]
}</strong>`;
html += `<div class="settingsContainer"${lastCategory == categoryDebug ? hideDebug : ""}>`;
html += `<div class='settingsContainer'${isHidden ? " style='display:none'" : ""}>`;
}
html += setting.getHtml();