summaryrefslogtreecommitdiff
path: root/Thronefall_1_0/Decompile/ChoiceUIFrameHelper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Thronefall_1_0/Decompile/ChoiceUIFrameHelper.cs')
-rw-r--r--Thronefall_1_0/Decompile/ChoiceUIFrameHelper.cs103
1 files changed, 0 insertions, 103 deletions
diff --git a/Thronefall_1_0/Decompile/ChoiceUIFrameHelper.cs b/Thronefall_1_0/Decompile/ChoiceUIFrameHelper.cs
deleted file mode 100644
index 220e26a..0000000
--- a/Thronefall_1_0/Decompile/ChoiceUIFrameHelper.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-using System.Collections.Generic;
-using I2.Loc;
-using TMPro;
-using UnityEngine;
-using UnityEngine.UI;
-
-public class ChoiceUIFrameHelper : MonoBehaviour
-{
- public UIFrame frame;
-
- public HorizontalLayoutGroup choicesParent;
-
- public TFUIUpgradeChoice upgradeChoiceButtonPrefab;
-
- public TextMeshProUGUI choiceTitle;
-
- public TextMeshProUGUI choiceDescription;
-
- private List<TFUIUpgradeChoice> choices = new List<TFUIUpgradeChoice>();
-
- public void OnShow()
- {
- choices.Clear();
- foreach (Transform item in choicesParent.transform)
- {
- Object.Destroy(item.gameObject);
- }
- foreach (Choice availableChoice in ChoiceManager.instance.availableChoices)
- {
- AddChoiceTFUI(choicesParent, availableChoice);
- }
- RecomputeNavigation();
- }
-
- private void AddChoiceTFUI(HorizontalLayoutGroup parent, Choice _choice)
- {
- TFUIUpgradeChoice component = Object.Instantiate(upgradeChoiceButtonPrefab, parent.transform).GetComponent<TFUIUpgradeChoice>();
- component.SetData(_choice);
- choices.Add(component);
- }
-
- private void RecomputeNavigation()
- {
- for (int i = 0; i < choices.Count; i++)
- {
- TFUIUpgradeChoice tFUIUpgradeChoice = choices[i];
- if (i <= 0)
- {
- tFUIUpgradeChoice.leftNav = choices[choices.Count - 1];
- }
- else
- {
- tFUIUpgradeChoice.leftNav = choices[i - 1];
- }
- if (i >= choices.Count - 1)
- {
- tFUIUpgradeChoice.rightNav = choices[0];
- }
- else
- {
- tFUIUpgradeChoice.rightNav = choices[i + 1];
- }
- }
- frame.firstSelected = choices[0];
- }
-
- public void UpdateSelectedChoice()
- {
- TFUIUpgradeChoice tFUIUpgradeChoice = null;
- if (frame.CurrentFocus != null)
- {
- tFUIUpgradeChoice = frame.CurrentFocus as TFUIUpgradeChoice;
- }
- if (tFUIUpgradeChoice == null && frame.CurrentSelection != null)
- {
- tFUIUpgradeChoice = frame.CurrentSelection as TFUIUpgradeChoice;
- }
- if (tFUIUpgradeChoice != null)
- {
- if (!tFUIUpgradeChoice.Locked)
- {
- BuildSlot currentOriginBuildSlot = ChoiceManager.instance.currentOriginBuildSlot;
- choiceTitle.text = LocalizationManager.GetTranslation(currentOriginBuildSlot.GET_LOCIDENTIFIER_CHOICENAME(tFUIUpgradeChoice.Data));
- choiceDescription.text = LocalizationManager.GetTranslation(currentOriginBuildSlot.GET_LOCIDENTIFIER_CHOICEDESCRIPTION(tFUIUpgradeChoice.Data));
- }
- else
- {
- choiceTitle.text = LocalizationManager.GetTranslation("Menu/Locked");
- choiceDescription.text = LocalizationManager.GetTranslation("Menu/Locked Choice Description");
- }
- }
- }
-
- public void OnApply()
- {
- TFUIUpgradeChoice tFUIUpgradeChoice = frame.LastApplied as TFUIUpgradeChoice;
- if (!(tFUIUpgradeChoice == null) && !tFUIUpgradeChoice.Locked)
- {
- ChoiceManager.instance.choiceToReturn = tFUIUpgradeChoice.Data;
- UIFrameManager.instance.CloseActiveFrame();
- }
- }
-}