-
Notifications
You must be signed in to change notification settings - Fork 4
/
VaultMod.cs
49 lines (48 loc) · 1.51 KB
/
VaultMod.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
using System.Collections.Generic;
using System.IO;
using Terraria;
using Terraria.ModLoader;
namespace InnoVault
{
/// <summary>
/// 模组的主类
/// </summary>
public class VaultMod : Mod
{
/// <summary>
/// 实时获取整个模组的实例
/// </summary>
public static VaultMod Instance => (VaultMod)ModLoader.GetMod("InnoVault");
/// <summary>
/// 所有继承了<see cref="IVaultLoader"/>接口的类的实例
/// </summary>
public static List<IVaultLoader> Loaders { get; private set; } = new List<IVaultLoader>();
/// <inheritdoc/>
public override void Load() {
Loaders = VaultUtils.GetSubInterface<IVaultLoader>();
foreach (var loader in Loaders) {
loader.LoadData();
}
}
/// <inheritdoc/>
public override void PostSetupContent() {
foreach (var loader in Loaders) {
loader.SetupData();
}
if (!Main.dedServ) {
foreach (var loader in Loaders) {
loader.LoadAsset();
}
}
}
/// <inheritdoc/>
public override void Unload() {
foreach (var loader in Loaders) {
loader.UnLoadData();
}
Loaders.Clear();
}
/// <inheritdoc/>
public override void HandlePacket(BinaryReader reader, int whoAmI) => VaultNetWork.HandlePacket(this, reader, whoAmI);
}
}