-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSaveManagerFocusPatch.cs
52 lines (48 loc) · 2.34 KB
/
SaveManagerFocusPatch.cs
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
46
47
48
49
50
51
52
using GameManagement;
using HarmonyLib;
using UnityEngine;
namespace fro_mod
{
[HarmonyPatch(typeof(SaveManager), "OnApplicationFocus")]
class SaveManagerFocusPatch
{
static bool Prefix(SaveManager __instance, bool focus)
{
if (!PlayerController.Instance.respawn.respawning && GameStateMachine.Instance.CurrentState.GetType() == typeof(PlayState))
{
Time.timeScale = 1;
}
return false;
}
public static void HandleCustomMapChanges()
{
MonoBehaviourSingleton<LevelManager>.Instance.FetchCustomMaps();
if (MonoBehaviourSingleton<GameStateMachine>.Instance.CurrentState is LevelSelectionState)
{
GameStateMachine instance = MonoBehaviourSingleton<GameStateMachine>.Instance;
LevelSelectionController levelSelectionController;
if (instance == null)
{
levelSelectionController = null;
}
else
{
GameObject levelSelectionObject = instance.LevelSelectionObject;
levelSelectionController = ((levelSelectionObject != null) ? levelSelectionObject.GetComponent<LevelSelectionController>() : null);
}
if (levelSelectionController != null && levelSelectionController.enabled && MonoBehaviourSingleton<GameStateMachine>.Instance.CurrentState is LevelSelectionState && levelSelectionController != null && levelSelectionController.enabled)
{
levelSelectionController.UpdateList();
}
}
}
public static void HandleCustomGearChanges()
{
GearDatabase.Instance.FetchCustomGear();
if (MonoBehaviourSingleton<GameStateMachine>.Instance.CurrentState is GearSelectionState && GearSelectionController.Instance != null && GearSelectionController.Instance.initialized && GearSelectionController.Instance.enabled && MonoBehaviourSingleton<GameStateMachine>.Instance.CurrentState is GearSelectionState && GearSelectionController.Instance != null && GearSelectionController.Instance.initialized && GearSelectionController.Instance.enabled)
{
GearSelectionController.Instance.listView.UpdateList();
}
}
}
}