summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/ToggleOption.cs
blob: 25ffbe795835efd6b0ec05649bd4b5bf29cda1a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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;
	}
}