-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCore.cs
55 lines (51 loc) · 1.92 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
using Kingmaker.PubSubSystem;
using ModMaker;
using QuickCast.UI.QuickInventory;
using System;
using System.Reflection;
using UnityEngine;
using static QuickCast.Main;
using static QuickCast.Utilities.SetWrap;
namespace QuickCast
{
internal class Core : IModEventHandler
{
public Controllers.QuickInvUIController UI { get; internal set; }
public Controllers.SpellViewController SpellVUI { get; internal set; }
public Controllers.ItemViewController ItemVUI { get; internal set; }
public Controllers.FavoriteViewController FavoriteVUI { get; internal set; }
public Controllers.SpecialViewController SpecialVUI { get; internal set; }
public Controllers.SettingsViewController SettingsVUI { get; internal set; }
public int Priority => 200;
public void ResetSettings()
{
Mod.Debug(MethodBase.GetCurrentMethod());
Mod.ResetSettings();
Mod.Settings.lastModVersion = Mod.Version.ToString();
LocalizationFileName = Local.FileName;
Window_Pos = new Vector3(1f, 1f, 1f);
Window_Scale = new Vector3(.6f, .6f, .6f);
Maximized = true;
MinMaxKeyBind = new QCKeyBinding(KeyCode.Z, true, false, false);
}
public void HandleModEnable()
{
if (!string.IsNullOrEmpty(LocalizationFileName))
{
Local.Import(LocalizationFileName, e => Mod.Error(e));
LocalizationFileName = Local.FileName;
}
if (!Version.TryParse(Mod.Settings.lastModVersion, out Version version) || version < new Version(0, 0, 0))
ResetSettings();
else
{
Mod.Settings.lastModVersion = Mod.Version.ToString();
}
EventBus.Subscribe(this);
}
public void HandleModDisable()
{
EventBus.Unsubscribe(this);
}
}
}