Repository navigation
Expand file tree
/
Copy pathLibrary.cs
More file actions
117 lines (105 loc) · 3.56 KB
/
Copy pathLibrary.cs
File metadata and controls
117 lines (105 loc) · 3.56 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
using MelonLoader;
using UnityEngine;
namespace DNFC_Redux_Library
{
public class SharedData
{
public static bool IsInGame { get; set;}
public static bool IsInLoading { get; set;}
public static bool IsInMainMenu { get; set; }
public static bool IsInitialized { get; set; }
public static Component SettingsManager { get; set; }
}
public class Library : MelonMod
{
public override void OnEarlyInitializeMelon()
{
MelonLogger.Msg(@"
___ _ _ ___ ___ ___ _ _ _ _
| \| \| | __/ __| | _ \___ __| |_ ___ __ | | (_) |__ _ _ __ _ _ _ _ _
| |) | .` | _| (__ | / -_) _` | || \ \ / | |__| | '_ \ '_/ _` | '_| || |
|___/|_|\_|_| \___| |_|_\___\__,_|\_,_/_\_\ |____|_|_.__/_| \__,_|_| \_, |
|__/
From everyone at the DNFC Redux Project, we hope you enjoy
this mod and the work we've put into it. If you have any questions,
suggestions, or want to contribute, feel free to join our Discord server!
");
}
// Check if the player is in the game
public bool IsInGame()
{
return SharedData.IsInGame;
}
public bool SetIsInGame(bool inGame)
{
SharedData.IsInGame = inGame;
return SharedData.IsInGame;
}
public bool IsInLoading()
{
return SharedData.IsInLoading;
}
public bool SetIsInLoading(bool inLoading)
{
SharedData.IsInLoading = inLoading;
return SharedData.IsInLoading;
}
// Check if the player is in the main menu
public bool IsInMainMenu()
{
return SharedData.IsInMainMenu;
}
public bool SetIsInMainMenu(bool inMainMenu)
{
SharedData.IsInMainMenu = inMainMenu;
return SharedData.IsInMainMenu;
}
// Check if the mod has been initialized
public bool IsInitialized()
{
return SharedData.IsInitialized;
}
public void SetInitialized(bool initialized)
{
SharedData.IsInitialized = initialized;
}
public void FindSettingsManagerComponent()
{
try
{
MelonLogger.Msg("Attempting to find SettingsManager GameObject...");
Component settingsManager = GameObject.Find("SettingsManager")?.GetComponent("SettingsManager");
MelonLogger.Msg("SettingsManager GameObject found: " + (settingsManager != null));
SharedData.SettingsManager = settingsManager;
}
catch
{
MelonLogger.Msg("Error finding SettingsManager GameObject.");
}
}
public Component GetSettingsManagerComponent()
{
if (SharedData.SettingsManager != null)
{
return SharedData.SettingsManager;
}
else
{
MelonLogger.Msg("GetSettingsManager: SettingsManager GameObject is not set.");
return null;
}
}
public bool GetActiveInHierarchy(GameObject obj)
{
if (obj != null)
{
return obj.activeInHierarchy;
}
else
{
MelonLogger.Msg("GetActive: Provided GameObject is null.");
return false;
}
}
}
}