Menu integration

This commit is contained in:
SDraw 2022-08-07 17:57:49 +03:00
parent a417b41be7
commit b1c3c7f410
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
11 changed files with 223 additions and 12 deletions

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player;
using ABI_RC.Core.InteractionSystem;
using ABI_RC.Core.Player;
using ABI_RC.Core.UI;
using UnityEngine;
@ -59,6 +60,7 @@ namespace ml_lme
new HarmonyLib.HarmonyMethod(typeof(LeapMotionExtension).GetMethod(nameof(OnAvatarClear_Postfix), System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic))
);
MelonLoader.MelonCoroutines.Start(WaitForMainMenuView());
MelonLoader.MelonCoroutines.Start(CreateTrackingObjects());
}
@ -105,6 +107,21 @@ namespace ml_lme
OnSettingsHeadAttachChange(); // Includes offsets and parenting
}
System.Collections.IEnumerator WaitForMainMenuView()
{
while(ViewManager.Instance == null)
yield return null;
while(ViewManager.Instance.gameMenuView == null)
yield return null;
while(ViewManager.Instance.gameMenuView.Listener == null)
yield return null;
ViewManager.Instance.gameMenuView.Listener.FinishLoad += (_) =>
{
ViewManager.Instance.gameMenuView.View.ExecuteScript(Scripts.GetEmbeddedScript("menu.js"));
};
}
public override void OnUpdate()
{
if(Settings.Enabled)