Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/options/options.js
Show First 20 Lines • Show All 113 Lines • ▼ Show 20 Lines | "sanitizeValue": (value, control, option) => { | ||||
control.sprite = sanitized == value ? "ModernDarkBoxWhite" : "ModernDarkBoxWhiteInvalid"; | control.sprite = sanitized == value ? "ModernDarkBoxWhite" : "ModernDarkBoxWhiteInvalid"; | ||||
return sanitized; | return sanitized; | ||||
}, | }, | ||||
"tooltip": (value, option) => | "tooltip": (value, option) => | ||||
sprintf( | sprintf( | ||||
option.min !== undefined && option.max !== undefined ? | option.min !== undefined && option.max !== undefined ? | ||||
translateWithContext("option number", "Min: %(min)s, Max: %(max)s") : | translateWithContext("option number", "Min: %(min)s, Max: %(max)s") : | ||||
option.min !== undefined && option.max === undefined ? | option.min !== undefined && option.max === undefined ? | ||||
Lint: ESLintBear (indent): `Expected indentation of 5 tabs but found 4.` | |||||
translateWithContext("option number", "Min: %(min)s") : | translateWithContext("option number", "Min: %(min)s") : | ||||
Lint: ESLintBear (indent) Expected indentation of 6 tabs but found 5. Lint: ESLintBear (indent): `Expected indentation of 6 tabs but found 5.` | |||||
option.min === undefined && option.max !== undefined ? | option.min === undefined && option.max !== undefined ? | ||||
Lint: ESLintBear (indent) Expected indentation of 6 tabs but found 4. Lint: ESLintBear (indent): `Expected indentation of 6 tabs but found 4.` | |||||
translateWithContext("option number", "Max: %(max)s") : | translateWithContext("option number", "Max: %(max)s") : | ||||
Lint: ESLintBear (indent) Expected indentation of 7 tabs but found 5. Lint: ESLintBear (indent): `Expected indentation of 7 tabs but found 5.` | |||||
"", | "", | ||||
Lint: ESLintBear (indent) Expected indentation of 7 tabs but found 5. Lint: ESLintBear (indent): `Expected indentation of 7 tabs but found 5.` | |||||
{ | { | ||||
"min": option.min, | "min": option.min, | ||||
"max": option.max | "max": option.max | ||||
}) | }) | ||||
}, | }, | ||||
"dropdown": | "dropdown": | ||||
{ | { | ||||
"configToValue": value => value, | "configToValue": value => value, | ||||
Show All 15 Lines | var g_OptionType = { | ||||
{ | { | ||||
"configToValue": value => +value, | "configToValue": value => +value, | ||||
"valueToGui": (value, control) => { | "valueToGui": (value, control) => { | ||||
control.value = +value; | control.value = +value; | ||||
}, | }, | ||||
"guiToValue": control => control.value, | "guiToValue": control => control.value, | ||||
"guiSetter": "onValueChange", | "guiSetter": "onValueChange", | ||||
"initGUI": (option, control) => { | "initGUI": (option, control) => { | ||||
control.scale_type = option.scale_type || "linear"; | |||||
bbAuthorUnsubmitted Done Inline ActionsOne can nuke the default when setting it to all options bb: One can nuke the default when setting it to all options | |||||
control.max_value = option.max; | control.max_value = option.max; | ||||
control.min_value = option.min; | control.min_value = option.min; | ||||
}, | }, | ||||
"tooltip": (value, option) => | "tooltip": (value, option) => | ||||
sprintf(translateWithContext("slider number", "Value: %(val)s (min: %(min)s, max: %(max)s)"), { | sprintf(translateWithContext("slider number", "Value: %(val)s (min: %(min)s, max: %(max)s)"), { | ||||
"val": value.toFixed(2), | "val": value.toFixed(2), | ||||
"min": option.min.toFixed(2), | "min": option.min.toFixed(2), | ||||
"max": option.max.toFixed(2) | "max": option.max.toFixed(2) | ||||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | for (let i = 0; i < g_Options[g_TabCategorySelected].options.length; ++i) | ||||
control[optionType.guiSetter] = function() {}; | control[optionType.guiSetter] = function() {}; | ||||
optionType.valueToGui(value, control); | optionType.valueToGui(value, control); | ||||
if (optionType.sanitizeValue) | if (optionType.sanitizeValue) | ||||
optionType.sanitizeValue(value, control, option); | optionType.sanitizeValue(value, control, option); | ||||
control[optionType.guiSetter] = function() { | control[optionType.guiSetter] = function() { | ||||
let value = optionType.guiToValue(control); | let value = optionType.guiToValue(control); | ||||
Lint: ESLintBear (no-shadow) 'value' is already declared in the upper scope. Lint: ESLintBear (no-shadow): `'value' is already declared in the upper scope.` | |||||
if (optionType.sanitizeValue) | if (optionType.sanitizeValue) | ||||
optionType.sanitizeValue(value, control, option); | optionType.sanitizeValue(value, control, option); | ||||
control.tooltip = option.tooltip + (optionType.tooltip ? "\n" + optionType.tooltip(value, option) : ""); | control.tooltip = option.tooltip + (optionType.tooltip ? "\n" + optionType.tooltip(value, option) : ""); | ||||
Engine.ConfigDB_CreateValue("user", option.config, String(value)); | Engine.ConfigDB_CreateValue("user", option.config, String(value)); | ||||
Engine.ConfigDB_SetChanges("user", true); | Engine.ConfigDB_SetChanges("user", true); | ||||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Expected indentation of 5 tabs but found 4.