-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathCore.cs
98 lines (84 loc) · 2.69 KB
/
Core.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
95
96
97
98
using Il2Cpp;
using MelonLoader;
using UnityEngine;
using HarmonyLib;
using Il2CppTMPro;
using PVZ_Hyper_Fusion.AssetStore;
[assembly: MelonInfo(typeof(PVZ_Hyper_Fusion.Core), "PVZ Hyper Fusion", "0.0.3", "arifrios1st", null)]
[assembly: MelonGame("LanPiaoPiao", "PlantsVsZombiesRH")]
namespace PVZ_Hyper_Fusion
{
public class Core : MelonMod
{
private static DateTime dtStart;
private static DateTime? dtStartToast;
private static string toast_txt;
public const string MOD_DIRECTORY = "Mods";
#if USE_TEXTURE
object replaceTextureRoutine = null;
#endif
public override void OnEarlyInitializeMelon()
{
dtStart = DateTime.Now;
}
public override void OnInitializeMelon()
{
#if USE_TEXTURE
TextureStore.Init();
#endif
#if USE_TRANSLATE
StringStore.Init();
#endif
}
public override void OnLateInitializeMelon()
{
dtStart = DateTime.Now;
#if USE_TEXTURE
replaceTextureRoutine = MelonCoroutines.Start(TextureStore.ReplaceTexturesCoroutine());
#endif
}
public override void OnDeinitializeMelon()
{
#if USE_TEXTURE
MelonCoroutines.Stop(replaceTextureRoutine);
#endif
}
public static void ShowToast(string message)
{
toast_txt = message;
dtStartToast = new DateTime?(DateTime.Now);
}
public override void OnLateUpdate()
{
ModFeatures.OnLateUpdate();
}
public override void OnGUI()
{
if (ModFeatures.GetActive(ModFeatures.ModType.Help) || DateTime.Now - dtStart < new TimeSpan(0, 0, 0, 5))
{
string text = ModFeatures.GetFeatures();
int num = 0;
int num2 = 20;
foreach (string text2 in text.Split('\n', StringSplitOptions.None))
{
if (text2.Length > num2)
{
num2 = text2.Length;
}
num++;
}
bool flag4 = GUI.Button(new Rect(10f, 30f, (float)num2 * 10f, (float)num * 16f + 15f), text);
}
if (dtStartToast != null)
{
GUI.Button(new Rect(10f, 10f, 200f, 20f), "\n" + toast_txt + "\n");
TimeSpan? timeSpan = DateTime.Now - dtStartToast;
TimeSpan t = new TimeSpan(0, 0, 0, 2);
if (timeSpan > t)
{
dtStartToast = null;
}
}
}
}
}