using System; using UnityEngine; public class ToggleOption : OptionBehaviour { public TextRenderer TitleText; public SpriteRenderer CheckMark; private bool oldValue; public void OnEnable() { this.TitleText.Text = DestroyableSingleton.Instance.GetString(this.Title, Array.Empty()); 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; } }