mirror of
https://github.com/amevarashi/RJW-Sexperience.git
synced 2024-08-14 23:54:08 +00:00
36 lines
647 B
C#
36 lines
647 B
C#
|
using Verse;
|
|||
|
|
|||
|
namespace RJWSexperience.Settings
|
|||
|
{
|
|||
|
public class SettingHandle<T> : ISettingHandle
|
|||
|
{
|
|||
|
public T Value { get; set; }
|
|||
|
public readonly string XmlLabel;
|
|||
|
public readonly T DefaultValue;
|
|||
|
|
|||
|
public SettingHandle(string xmlLabel, T defaultValue)
|
|||
|
{
|
|||
|
XmlLabel = xmlLabel;
|
|||
|
DefaultValue = defaultValue;
|
|||
|
Value = defaultValue;
|
|||
|
}
|
|||
|
|
|||
|
public void Reset()
|
|||
|
{
|
|||
|
Value = DefaultValue;
|
|||
|
}
|
|||
|
|
|||
|
public void Scribe()
|
|||
|
{
|
|||
|
T value = Value;
|
|||
|
Scribe_Values.Look(ref value, XmlLabel, DefaultValue);
|
|||
|
Value = value;
|
|||
|
}
|
|||
|
|
|||
|
public static implicit operator T(SettingHandle<T> settingHandle)
|
|||
|
{
|
|||
|
return settingHandle.Value;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|