Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/options/options.js
Show First 20 Lines • Show All 73 Lines • ▼ Show 20 Lines | "string": | ||||
"guiSetter": "onTextEdit" | "guiSetter": "onTextEdit" | ||||
}, | }, | ||||
"color": | "color": | ||||
{ | { | ||||
"configToValue": value => value, | "configToValue": value => value, | ||||
"valueToGui": (value, control) => { | "valueToGui": (value, control) => { | ||||
control.caption = value; | control.caption = value; | ||||
}, | }, | ||||
"initGUI": (option, control) => { | |||||
control.children[2].onPress = () => { | |||||
colorMixer( | |||||
control.caption, | |||||
(color) => { | |||||
if (color != control.caption) | |||||
{ | |||||
control.caption = color; | |||||
control.onTextEdit(); | |||||
} | |||||
} | |||||
); | |||||
}; | |||||
}, | |||||
"guiToValue": control => control.caption, | "guiToValue": control => control.caption, | ||||
"guiSetter": "onTextEdit", | "guiSetter": "onTextEdit", | ||||
"sanitizeValue": (value, control, option) => { | "sanitizeValue": (value, control, option) => { | ||||
let color = guiToRgbColor(value); | let color = guiToRgbColor(value); | ||||
let sanitized = rgbToGuiColor(color); | let sanitized = rgbToGuiColor(color); | ||||
if (control) | if (control) | ||||
{ | { | ||||
control.sprite = sanitized == value ? "ModernDarkBoxWhite" : "ModernDarkBoxWhiteInvalid"; | control.sprite = sanitized == value ? "ModernDarkBoxWhite" : "ModernDarkBoxWhiteInvalid"; | ||||
▲ Show 20 Lines • Show All 360 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator