forked from Agent3554/TrueTooltips
-
Notifications
You must be signed in to change notification settings - Fork 0
/
MyMod.cs
52 lines (40 loc) · 1.49 KB
/
MyMod.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
global using Microsoft.Xna.Framework;
global using Microsoft.Xna.Framework.Graphics;
global using System.Collections.Generic;
global using System.IO;
global using System.Text.Json;
global using Terraria;
global using Terraria.GameContent;
global using Terraria.ModLoader;
global using static Terraria.Main;
global using static Terraria.ModLoader.ModContent;
namespace TrueTooltips;
internal class MyMod : Mod
{
internal static MyMod Instance { get; private set; }
internal static ModKeybind ToggleTooltipKey { get; private set; }
internal static readonly string directory = Path.Combine(SavePath, "TrueTooltips");
internal static readonly string path = Path.Combine(directory, "blackList.json");
public override void Load()
{
if(File.Exists(path))
try
{
MyGlobalItem.blackList = JsonSerializer.Deserialize<List<int>>(File.ReadAllText(path)) ?? new List<int>();
}
catch
{
Logger.Error("Failed to load blacklist");
throw;
}
Instance = this;
ToggleTooltipKey = KeybindLoader.RegisterKeybind(this, "Toggle Tooltip", Microsoft.Xna.Framework.Input.Keys.T);
MyGlobalItem.LoadCorners();
Main.AssetSourceController.OnResourcePackChange += delegate
{
MyGlobalItem.LoadCorners();
};
SettingsEnabled_OpaqueBoxBehindTooltips = false;
}
public override void Unload() => ToggleTooltipKey = null;
}