forked from Fuar11/ImprovedLoadingScreens
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettings.cs
94 lines (68 loc) · 2.56 KB
/
Settings.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
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
using Il2CppSystem.Collections.Generic;
using JetBrains.Annotations;
using ModSettings;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace ImprovedLoadingScreens
{
public enum Active
{
Disabled, Enabled
}
class CustomSettings : JsonModSettings
{
[Section("Mod Options")]
[Name("Mod Active")]
[Description("Enable or Disable this mod")]
[Choice("Disabled", "Enabled")]
public Active active = Active.Enabled;
[Section("Backgrounds")]
[Name("Enable Backgrounds")]
[Description("Enable or Disable loading screen backgrounds altogether.")]
[Choice("Disabled", "Enabled")]
public bool backgrounds = true;
[Name("Enable Region Backgrounds")]
[Description("Enable or Disable region specific loading screen backgrounds.")]
[Choice("Disabled", "Enabled")]
public bool regionBackgrounds = true;
[Section("Hints")]
[Name("Enable Hints")]
[Description("Enable or Disable loading screen hints altogether.")]
[Choice("Disabled", "Enabled")]
public bool hints = true;
[Name("Custom Hints")]
[Description("Enabled or Disable custom loading screen hints from this mod.")]
[Choice("Disabled", "Enabled")]
public bool cHints = true;
protected override void OnChange(FieldInfo field, object oldValue, object newValue)
{
if (field.Name == nameof(active) ||
field.Name == nameof(hints) ||
field.Name == nameof(backgrounds) ||
field.Name == nameof(regionBackgrounds))
{
RefreshSections();
}
}
internal void RefreshSections()
{
SetFieldVisible(nameof(backgrounds), Settings.settings.active != Active.Disabled);
SetFieldVisible(nameof(regionBackgrounds), Settings.settings.active != Active.Disabled && backgrounds);
SetFieldVisible(nameof(hints), Settings.settings.active != Active.Disabled && backgrounds);
SetFieldVisible(nameof(cHints), Settings.settings.active != Active.Disabled && hints && backgrounds);
}
}
internal static class Settings
{
public static CustomSettings settings = new CustomSettings();
public static void onLoad()
{
settings.AddToModSettings("Improved Loading Screens", MenuType.Both);
settings.RefreshSections();
}
}
}