-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
namespace GodSeekerPlus.Modules.Misc; | ||
|
||
[Hidden] | ||
internal sealed class InspectHelper : Module { | ||
private static readonly string GO_NAME = $"{nameof(GodSeekerPlus)} Inspect Helper"; | ||
|
||
private protected override void Load() => | ||
ModHooks.FinishedLoadingModsHook += CreateGameObject; | ||
|
||
private static void CreateGameObject() { | ||
if (ModHooks.GetMod("Unity Explorer", true) == null) { | ||
return; | ||
} | ||
|
||
if (GameObject.Find(GO_NAME) is not null and { | ||
scene.name: "DontDestroyOnLoad" | ||
}) { | ||
Logger.LogError("Inspect Helper GameObject already existed!"); | ||
|
||
return; | ||
} | ||
|
||
Logger.Log("Creating Inspect Helper GameObject"); | ||
var go = new GameObject(GO_NAME, typeof(Inspector)); | ||
UObject.DontDestroyOnLoad(go); | ||
} | ||
|
||
private sealed class Inspector : MonoBehaviour { | ||
public GodSeekerPlus Instance => GodSeekerPlus.UnsafeInstance; | ||
|
||
public Dictionary<string, Module> Modules => ModuleManager.Modules; | ||
|
||
public GlobalSettings GlobalSettings => GodSeekerPlus.GlobalSettings; | ||
public LocalSettings LocalSettings => GodSeekerPlus.LocalSettings; | ||
|
||
public Dictionary<string, Dictionary<string, string>> Dict => L11nUtil.Dict.Value; | ||
|
||
public Dictionary<string, string>? GetL11n(string lang) => | ||
L11nUtil.Dict.Value.TryGetValue(lang, out Dictionary<string, string>? dict) ? dict : null; | ||
|
||
public string Localize(string key) => L11nUtil.Localize(key); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters