forked from Korzer420/TheHuntIsOn
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModule.cs
More file actions
60 lines (44 loc) · 1.2 KB
/
Module.cs
File metadata and controls
60 lines (44 loc) · 1.2 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
using System.Text;
namespace TheHuntIsOn;
internal abstract class Module
{
#region Member
private bool _active;
#endregion
#region Properties
public ModuleAffection Affection { get; set; }
public bool IsModuleUsed => Affection == ModuleAffection.All || (TheHuntIsOn.SaveData.IsHunter && Affection == ModuleAffection.OnlyHunter)
|| (!TheHuntIsOn.SaveData.IsHunter && Affection == ModuleAffection.OnlySpeedrunner);
public abstract string MenuDescription { get; }
#endregion
#region Methods
internal void Load()
{
if (_active)
return;
Enable();
_active = true;
}
internal void Unload()
{
if (!_active)
return;
Disable();
_active = false;
}
internal abstract void Enable();
internal abstract void Disable();
internal string GetModuleName()
{
string moduleName = GetType().Name;
StringBuilder builder = new();
foreach (char letter in moduleName)
{
if (char.IsUpper(letter))
builder.Append(" ");
builder.Append(letter);
}
return builder.ToString();
}
#endregion
}