diff options
Diffstat (limited to 'Client/Assembly-CSharp/ToggleOption.cs')
-rw-r--r-- | Client/Assembly-CSharp/ToggleOption.cs | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/ToggleOption.cs b/Client/Assembly-CSharp/ToggleOption.cs new file mode 100644 index 0000000..25ffbe7 --- /dev/null +++ b/Client/Assembly-CSharp/ToggleOption.cs @@ -0,0 +1,45 @@ +using System; +using UnityEngine; + +public class ToggleOption : OptionBehaviour +{ + public TextRenderer TitleText; + + public SpriteRenderer CheckMark; + + private bool oldValue; + + public void OnEnable() + { + this.TitleText.Text = DestroyableSingleton<TranslationController>.Instance.GetString(this.Title, Array.Empty<object>()); + GameOptionsData gameOptions = PlayerControl.GameOptions; + StringNames title = this.Title; + if (title == StringNames.GameRecommendedSettings) + { + this.CheckMark.enabled = gameOptions.isDefaults; + return; + } + Debug.Log("Ono, unrecognized setting: " + this.Title); + } + + private void FixedUpdate() + { + bool @bool = this.GetBool(); + if (this.oldValue != @bool) + { + this.oldValue = @bool; + this.CheckMark.enabled = @bool; + } + } + + public void Toggle() + { + this.CheckMark.enabled = !this.CheckMark.enabled; + this.OnValueChanged(this); + } + + public override bool GetBool() + { + return this.CheckMark.enabled; + } +} |