forked from keallu/CSL-HideIt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMod.cs
55 lines (47 loc) · 1.92 KB
/
Mod.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 com.github.TheCSUser.HideItBobby.Scripts;
using com.github.TheCSUser.HideItBobby.Properties;
using com.github.TheCSUser.HideItBobby.Settings;
using com.github.TheCSUser.HideItBobby.Settings.SettingsFiles;
using com.github.TheCSUser.Shared.Common;
using System;
using System.IO;
using com.github.TheCSUser.HideItBobby.Localization;
namespace com.github.TheCSUser.HideItBobby
{
using CurrentSettingsFile = File_1_21;
public sealed partial class Mod : ModBase
{
internal new CurrentSettingsFile Settings => (CurrentSettingsFile)base.Settings;
public override string Name => ModProperties.LongName;
public override string Description => ModProperties.Description;
public Mod() : base()
{
try
{
RegisterDependencies();
UseLateInit();
UseOnce(InitMigrations);
UseLogger(Paths.Logs.Directory, ModProperties.LongName);
Use(Migrate);
Use(Context.Resolve<LocaleFilesManager>().Unpack);
UseHarmony(ModProperties.HarmonyId);
UseLocalization(Paths.Translations.Directory, FallbackLanguage.Build);
UseSettings(new SettingsProvider(Context));
Use(() =>
{
if (Settings is null || Settings.UseGameLanguage) LocaleManager.ChangeToGameLanguage();
else LocaleManager.ChangeTo(Settings.SelectedLanguage);
});
UseMode(ApplicationMode.MainMenu)
.Add(Context.Resolve<MainMenuFeatures>());
UseMode(ApplicationMode.Game)
.Add(Context.Resolve<InGameFeatures>());
}
catch (Exception e)
{
Shared.Logging.Log.Shared.Error($"{ModProperties.ShortName}.{nameof(Mod)}.Constructor failed", e);
throw;
}
}
}
}