Implement the new settings browser.
This commit is contained in:
@@ -8,8 +8,16 @@ namespace Cryville.Crtr.Config.UI {
|
||||
_property.ValueChanged += GetValue;
|
||||
GetValue();
|
||||
}
|
||||
protected bool SetMapped { get { return _property.SetMapped; } }
|
||||
protected object[] Range { get { return _property.Range; } }
|
||||
public object MappedValue { get; private set; }
|
||||
private object m_mappedValue;
|
||||
public object MappedValue {
|
||||
get { return m_mappedValue; }
|
||||
set {
|
||||
m_rawValue = _property.MapValueInverse(value);
|
||||
SetValue();
|
||||
}
|
||||
}
|
||||
private object m_rawValue;
|
||||
public object RawValue {
|
||||
get { return m_rawValue; }
|
||||
@@ -21,19 +29,19 @@ namespace Cryville.Crtr.Config.UI {
|
||||
protected abstract void OnValueUpdated();
|
||||
void GetValue() {
|
||||
if (_property.SetMapped) {
|
||||
MappedValue = _property.GetValue();
|
||||
m_rawValue = _property.MapValueInverse(MappedValue);
|
||||
m_mappedValue = _property.GetValue();
|
||||
m_rawValue = _property.MapValueInverse(m_mappedValue);
|
||||
}
|
||||
else {
|
||||
m_rawValue = _property.GetValue();
|
||||
MappedValue = _property.MapValue(m_rawValue);
|
||||
m_mappedValue = _property.MapValue(m_rawValue);
|
||||
}
|
||||
OnValueUpdated();
|
||||
}
|
||||
void SetValue() {
|
||||
var outRaw = RawValue;
|
||||
MappedValue = _property.MapValue(outRaw);
|
||||
_property.SetValue(_property.SetMapped ? MappedValue : outRaw);
|
||||
m_mappedValue = _property.MapValue(outRaw);
|
||||
_property.SetValue(_property.SetMapped ? m_mappedValue : outRaw);
|
||||
OnValueUpdated();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user