summaryrefslogtreecommitdiff
path: root/Thronefall_1_0/GameCode/PauseUILoadoutHelper.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/PauseUILoadoutHelper.cs
parent8e13e7e2874adc8982e16d1d2ed2e28d7480b45f (diff)
* rename
Diffstat (limited to 'Thronefall_1_0/GameCode/PauseUILoadoutHelper.cs')
-rw-r--r--Thronefall_1_0/GameCode/PauseUILoadoutHelper.cs161
1 files changed, 0 insertions, 161 deletions
diff --git a/Thronefall_1_0/GameCode/PauseUILoadoutHelper.cs b/Thronefall_1_0/GameCode/PauseUILoadoutHelper.cs
deleted file mode 100644
index c51180c..0000000
--- a/Thronefall_1_0/GameCode/PauseUILoadoutHelper.cs
+++ /dev/null
@@ -1,161 +0,0 @@
-using System.Collections.Generic;
-using UnityEngine;
-using UnityEngine.UI;
-
-public class PauseUILoadoutHelper : MonoBehaviour
-{
- public ThronefallUIElement topmostButton;
-
- public ThronefallUIElement botmostButton;
-
- public GridLayoutGroup loadoutGroup;
-
- public TFUIEquippable equippableButtonPrefab;
-
- private List<TFUIEquippable> grid = new List<TFUIEquippable>();
-
- private const int maxRows = 4;
-
- public void Refresh()
- {
- if (SceneTransitionManager.instance.CurrentSceneState != SceneTransitionManager.SceneState.InGame)
- {
- return;
- }
- grid.Clear();
- foreach (Transform item in loadoutGroup.transform)
- {
- Object.Destroy(item.gameObject);
- }
- List<Equippable> list = new List<Equippable>();
- List<Equippable> list2 = new List<Equippable>();
- List<Equippable> list3 = new List<Equippable>();
- foreach (Equippable item2 in PerkManager.instance.CurrentlyEquipped)
- {
- if (item2 is EquippableWeapon)
- {
- list.Add(item2);
- }
- else if (item2 is EquippablePerk)
- {
- list2.Add(item2);
- }
- else if (item2 is EquippableMutation)
- {
- list3.Add(item2);
- }
- }
- foreach (Equippable item3 in list)
- {
- AddTFUIEquippable(loadoutGroup, item3);
- }
- foreach (Equippable item4 in list2)
- {
- AddTFUIEquippable(loadoutGroup, item4);
- }
- foreach (Equippable item5 in list3)
- {
- AddTFUIEquippable(loadoutGroup, item5);
- }
- AssignNavigationTargets();
- }
-
- private void AddTFUIEquippable(GridLayoutGroup parent, Equippable e)
- {
- TFUIEquippable component = Object.Instantiate(equippableButtonPrefab, parent.transform).GetComponent<TFUIEquippable>();
- component.SetDataSimple(e);
- grid.Add(component);
- }
-
- private void AssignNavigationTargets()
- {
- int num = grid.Count / 4;
- int num2 = grid.Count % 4;
- if (num2 > 0)
- {
- num++;
- }
- else
- {
- num2 = 4;
- }
- int num3 = 0;
- int num4 = 0;
- for (int i = 0; i < grid.Count; i++)
- {
- ThronefallUIElement thronefallUIElement = grid[i];
- if (num3 == 0)
- {
- thronefallUIElement.topNav = botmostButton;
- }
- else
- {
- thronefallUIElement.topNav = grid[i - 1];
- }
- if (num3 == 3 || (num == 1 && i == grid.Count - 1))
- {
- thronefallUIElement.botNav = topmostButton;
- }
- else if (num > 1 && i == grid.Count - 1)
- {
- thronefallUIElement.botNav = grid[4 * num4 - 1];
- }
- else
- {
- thronefallUIElement.botNav = grid[i + 1];
- }
- if (num > 1)
- {
- if (num4 == 0)
- {
- if (num3 <= num2 - 1)
- {
- thronefallUIElement.leftNav = grid[grid.Count - (num2 - num3)];
- }
- else if (i + 4 <= grid.Count - 1)
- {
- thronefallUIElement.leftNav = grid[i + 4];
- }
- }
- else
- {
- thronefallUIElement.leftNav = grid[i - 4];
- }
- if (num4 == num - 1)
- {
- thronefallUIElement.rightNav = grid[i - 4 * (num - 1)];
- }
- else
- {
- int num5 = i + 4;
- if (num5 <= grid.Count - 1)
- {
- thronefallUIElement.rightNav = grid[num5];
- }
- else
- {
- thronefallUIElement.rightNav = grid[i - 4 * num4];
- }
- }
- }
- num3++;
- if (num3 > 3)
- {
- num3 = 0;
- num4++;
- }
- }
- if (grid.Count > 0)
- {
- botmostButton.botNav = grid[0];
- if (num2 != 4 && num > 1)
- {
- topmostButton.topNav = grid[4 * (num - 1) - 1];
- }
- else
- {
- topmostButton.topNav = grid[grid.Count - 1];
- }
- }
- }
-}