summaryrefslogtreecommitdiff
path: root/Thronefall_1_0/GameCode/SettingsUIHelper.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-05-19 16:46:27 +0800
committerchai <215380520@qq.com>2024-05-19 16:46:27 +0800
commit8b1fc7063b387542803c6bc214ccf8acb32870bd (patch)
treed310eb99872c8215f1c1f67731ec21f0915cd778 /Thronefall_1_0/GameCode/SettingsUIHelper.cs
parent8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (diff)
* rename
Diffstat (limited to 'Thronefall_1_0/GameCode/SettingsUIHelper.cs')
-rw-r--r--Thronefall_1_0/GameCode/SettingsUIHelper.cs114
1 files changed, 0 insertions, 114 deletions
diff --git a/Thronefall_1_0/GameCode/SettingsUIHelper.cs b/Thronefall_1_0/GameCode/SettingsUIHelper.cs
deleted file mode 100644
index 1156f53..0000000
--- a/Thronefall_1_0/GameCode/SettingsUIHelper.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-using System;
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UI;
-
-public class SettingsUIHelper : MonoBehaviour
-{
- [Serializable]
- public class SettingsTab
- {
- public TFUITextButton parentElement;
-
- public VerticalLayoutGroup childContainer;
-
- public void ComputeNavigationForSettingsTab()
- {
- List<ThronefallUIElement> list = new List<ThronefallUIElement>();
- foreach (Transform item in childContainer.transform)
- {
- list.Add(item.GetComponent<ThronefallUIElement>());
- }
- parentElement.botNav = list[0];
- parentElement.topNav = list[list.Count - 1];
- for (int i = 0; i < list.Count; i++)
- {
- ThronefallUIElement thronefallUIElement = list[i];
- if (i == 0)
- {
- thronefallUIElement.topNav = parentElement;
- }
- else
- {
- thronefallUIElement.topNav = list[i - 1];
- }
- if (i == list.Count - 1)
- {
- thronefallUIElement.botNav = parentElement;
- }
- else
- {
- thronefallUIElement.botNav = list[i + 1];
- }
- }
- }
- }
-
- public UIFrame targetFrame;
-
- public SettingsTab videoTab;
-
- public SettingsTab audioTab;
-
- public SettingsTab gameplayTab;
-
- public SettingsTab controlsTab;
-
- public GameObject dimBG;
-
- private SettingsTab currentSelectedTab;
-
- private Dictionary<ThronefallUIElement, SettingsTab> allTabs = new Dictionary<ThronefallUIElement, SettingsTab>();
-
- private void Awake()
- {
- allTabs.Add(videoTab.parentElement, videoTab);
- allTabs.Add(audioTab.parentElement, audioTab);
- allTabs.Add(gameplayTab.parentElement, gameplayTab);
- allTabs.Add(controlsTab.parentElement, controlsTab);
- videoTab.childContainer.gameObject.SetActive(value: false);
- audioTab.childContainer.gameObject.SetActive(value: false);
- gameplayTab.childContainer.gameObject.SetActive(value: false);
- controlsTab.childContainer.gameObject.SetActive(value: false);
- RecomputeAllNavigation();
- }
-
- private void RecomputeAllNavigation()
- {
- videoTab.ComputeNavigationForSettingsTab();
- audioTab.ComputeNavigationForSettingsTab();
- gameplayTab.ComputeNavigationForSettingsTab();
- controlsTab.ComputeNavigationForSettingsTab();
- }
-
- public void OnShow()
- {
- if (SceneTransitionManager.instance.CurrentSceneState == SceneTransitionManager.SceneState.MainMenu)
- {
- dimBG.SetActive(value: false);
- }
- else
- {
- dimBG.SetActive(value: true);
- }
- }
-
- public void OnSelect()
- {
- SettingsTab value = null;
- if (allTabs.TryGetValue(targetFrame.CurrentSelection, out value))
- {
- if (currentSelectedTab != null)
- {
- currentSelectedTab.childContainer.gameObject.SetActive(value: false);
- currentSelectedTab.parentElement.applyOverrideStyle = false;
- }
- currentSelectedTab = value;
- currentSelectedTab.childContainer.gameObject.SetActive(value: true);
- }
- else if (currentSelectedTab != null)
- {
- currentSelectedTab.parentElement.applyOverrideStyle = true;
- }
- }
-}