-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMod.cs
More file actions
55 lines (42 loc) · 1.65 KB
/
Copy pathMod.cs
File metadata and controls
55 lines (42 loc) · 1.65 KB
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 Il2CppSystem;
using PrimitierModdingFramework;
using UnityEngine;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using System.IO;
using PrimitierModdingFramework.Debugging;
namespace Seva167.LanguagesMod
{
public class Mod : PrimitierMod
{
public static string LocalizationsFolder { get; private set; }
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
base.OnSceneWasLoaded(buildIndex, sceneName);
InGameDebugTool.GetMenu("MainMenu").CreateButton("Dump localization", new System.Action(() =>
{
LocalizationDumper.DumpLocalization();
}));
if (LanguageManager.UnityLocales.Length > 0)
LanguangeSelectorFactory.CreateLanguageSelector(LanguageManager.UnityLocales[0]);
foreach (var locale in LanguageManager.UnityLocales)
{
if (locale.Identifier.Code == Config.Data.localeCode)
Localizer.OnLocaleChanged(locale);
}
}
public override void OnApplicationStart()
{
base.OnApplicationStart();
PMFSystem.EnableSystem<PMFHelper>();
PMFSystem.EnableSystem<InGameDebuggingSystem>();
ClassInjector.RegisterTypeInIl2Cpp<UI.LanguageSelector>(true);
ClassInjector.RegisterTypeInIl2CppWithInterfaces<UI.NextLanguageButton>(typeof(IButton));
ClassInjector.RegisterTypeInIl2CppWithInterfaces<UI.SelectLocaleButton>(typeof(IButton));
LocalizationsFolder = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + @"\Primitier\Localizations\";
if (!Directory.Exists(LocalizationsFolder))
Directory.CreateDirectory(LocalizationsFolder);
LanguageManager.LoadAllLocales();
}
}
}