98 lines
3.0 KiBLFS
C#
98 lines
3.0 KiBLFS
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class OptionsMenu : MonoBehaviour
|
|
{
|
|
[SerializeField] private GameObject timeoutField;
|
|
[SerializeField] private TMPro.TMP_InputField timeoutInput;
|
|
[SerializeField] private Toggle expoModeToggle;
|
|
[SerializeField] private Toggle HighResToggle;
|
|
|
|
[SerializeField] private bool expoMode = false;
|
|
[SerializeField] private bool highRes = false;
|
|
[SerializeField] private int timeout = 300;
|
|
|
|
|
|
[SerializeField] private GameObject downloadVideosParent;
|
|
[SerializeField] private UnityEngine.UI.Button downloadVideosButton;
|
|
[SerializeField] private TMPro.TMP_Text downloadVideosButtonText;
|
|
|
|
[SerializeField] private bool allUnlocked = true;
|
|
[SerializeField] private Toggle allUnlockedToggle;
|
|
|
|
void Start()
|
|
{
|
|
expoMode = PlayerPrefs.GetString("expoMode", "false") == "true";
|
|
expoModeToggle.SetIsOnWithoutNotify(expoMode);
|
|
IdleCheck.singleton.IsEnabled = expoMode;
|
|
|
|
timeoutField.SetActive(expoMode);
|
|
timeout = PlayerPrefs.GetInt("timeout", 300);
|
|
IdleCheck.singleton.Timeout = timeout;
|
|
|
|
highRes = PlayerPrefs.GetString("highRes", "false") == "true";
|
|
HighResToggle.SetIsOnWithoutNotify(highRes);
|
|
VideoAsset.halfResOverride = !highRes;
|
|
|
|
allUnlocked = PlayerPrefs.GetString("allUnlocked", "true") == "true";
|
|
allUnlockedToggle.SetIsOnWithoutNotify(allUnlocked);
|
|
GameManager.singleton.AllUnlocked = allUnlocked;
|
|
}
|
|
|
|
public void CloseMenu()
|
|
{
|
|
gameObject.SetActive(false);
|
|
if (expoMode)
|
|
{
|
|
timeout = timeoutInput.text == "" ? 300 : int.Parse(timeoutInput.text);
|
|
IdleCheck.singleton.IsEnabled = true;
|
|
IdleCheck.singleton.Timeout = timeout;
|
|
PlayerPrefs.SetInt("timeout", timeout);
|
|
}
|
|
}
|
|
|
|
public void OpenMenu()
|
|
{
|
|
gameObject.SetActive(true);
|
|
timeoutInput.text = timeout.ToString();
|
|
downloadVideosParent.SetActive(false);
|
|
}
|
|
|
|
public bool ExpoModeEnabled => expoMode;
|
|
|
|
public void ToggleHighRes()
|
|
{
|
|
highRes = !highRes;
|
|
PlayerPrefs.SetString("highRes", highRes ? "true" : "false");
|
|
VideoAsset.halfResOverride = !highRes;
|
|
downloadVideosParent.SetActive(true);
|
|
downloadVideosButtonText.text = "Downloaded Videos?";
|
|
}
|
|
|
|
public void DownloadMissingVideos()
|
|
{
|
|
GameManager.singleton.VideoDownloader.ReDownloadVideos();
|
|
downloadVideosButtonText.text = "Downloading...";
|
|
}
|
|
|
|
public void EndDownloadedAllVideos()
|
|
{
|
|
downloadVideosButtonText.text = "Downloaded All Videos!";
|
|
downloadVideosButton.enabled = false;
|
|
}
|
|
|
|
public void ToggleExpoMode()
|
|
{
|
|
expoMode = !expoMode;
|
|
PlayerPrefs.SetString("expoMode", expoMode ? "true" : "false");
|
|
timeoutField.SetActive(expoMode);
|
|
}
|
|
|
|
public void ToggleAllUnlocked()
|
|
{
|
|
allUnlocked = !allUnlocked;
|
|
PlayerPrefs.SetString("allUnlocked", allUnlocked ? "true" : "false");
|
|
GameManager.singleton.AllUnlocked = allUnlocked;
|
|
}
|
|
}
|