-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemoveRain.cs
More file actions
88 lines (78 loc) · 1.77 KB
/
Copy pathRemoveRain.cs
File metadata and controls
88 lines (78 loc) · 1.77 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityModManagerNet;
using System.Reflection;
using static UnityModManagerNet.UnityModManager;
using System.IO;
using System.Collections;
using UnityEngine.Video;
using System.Reflection.Emit;
namespace RemoveRain
{
static class Main
{
// Send a response to the mod manager about the launch status, success or not.
static bool Load(ModEntry modEntry)
{
modEntry.OnToggle = OnToggle;
modEntry.OnUpdate = OnUpdate;
if (modEntry.GameVersion != gameVersion)
{
UnityModManager.Logger.Log($"{modEntry.Info.DisplayName} expects {modEntry.GameVersion} but found {gameVersion}.");
}
return true; // If false the mod will show an error.
}
static bool OnToggle(UnityModManager.ModEntry modEntry, bool value /* active or inactive */)
{
if (NotNullCheck)
{
if (value)
{
if (RainManager.Instance.m_IsEnabled)
{
if (RainManager.Instance.GetIsRaining())
{
RainManager.Instance.ToggleRain();
}
RainManager.Instance.SetEnabled(false);
}
}
else
{
if (!RainManager.Instance.m_IsEnabled)
{
RainManager.Instance.SetEnabled(true);
RainManager.Instance.StartRainingNow();
}
}
}
modEntry.Enabled = value;
return true;
}
static void OnUpdate(UnityModManager.ModEntry modEntry, float dt)
{
if (NotNullCheck)
{
if (RainManager.Instance.m_IsEnabled)
{
if (RainManager.Instance.GetIsRaining())
{
RainManager.Instance.ToggleRain();
}
RainManager.Instance.SetEnabled(false);
}
}
}
static bool NotNullCheck
{
get
{
return RainManager.Instance != null
&& GameStateManager.Instance != null;
}
}
}
}