private void UiManagerInit() { MelonLogger.Msg("BTK Standalone: Immersive Hud - Starting Up"); Instance = this; if (MelonHandler.Mods.Any(x => x.Info.Name.Equals("BTKCompanionLoader", StringComparison.OrdinalIgnoreCase))) { MelonLogger.Msg("Hold on a sec! Looks like you've got BTKCompanion installed, this mod is built in and not needed!"); MelonLogger.Error("BTKSAImmersiveHud has not started up! (BTKCompanion Running)"); return; } MelonPreferences.CreateCategory(SettingsCategory, "Immersive Hud"); MelonPreferences.CreateEntry(SettingsCategory, HUDEnable, true, "Immersive Hud Enable"); MelonPreferences.CreateEntry(SettingsCategory, HUDStayOnUntilClear, false, "Keep Hud Visible Until Notification Cleared"); MelonPreferences.CreateEntry(SettingsCategory, HUDTimeout, 10f, "Hud Appear Duration"); //Apply patches applyPatches(typeof(RoomManagerPatches)); //Register our MonoBehavior to let us use OnEnable ClassInjector.RegisterTypeInIl2Cpp <HudEvent>(); DefaultTalkController.Method_Public_Static_add_Void_Action_0(new Action(OnHudUpdateEvent)); hudContent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud"); gestureParent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/GestureToggleParent"); notificationParent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/NotificationDotParent"); afkParent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/AFK"); }
public override void VRChat_OnUiManagerInit() { MelonLogger.Msg("BTK Standalone: Immersive Hud - Starting Up"); instance = this; if (MelonHandler.Mods.Any(x => x.Info.Name.Equals("BTKCompanionLoader", StringComparison.OrdinalIgnoreCase))) { MelonLogger.Msg("Hold on a sec! Looks like you've got BTKCompanion installed, this mod is built in and not needed!"); MelonLogger.Error("BTKSAImmersiveHud has not started up! (BTKCompanion Running)"); return; } MelonPreferences.CreateCategory(settingsCategory, "Immersive Hud"); MelonPreferences.CreateEntry <bool>(settingsCategory, hudEnable, true, "Immersive Hud Enable"); MelonPreferences.CreateEntry <bool>(settingsCategory, hudStayOnUntilClear, false, "Keep Hud Visible Until Notification Cleared"); MelonPreferences.CreateEntry <float>(settingsCategory, hudTimeout, 10f, "Hud Appear Duration"); //Register our MonoBehavior to let us use OnEnable ClassInjector.RegisterTypeInIl2Cpp <HudEvent>(); harmony = HarmonyInstance.Create("BTKStandaloneIH"); //Mute/Unmute Hook foreach (MethodInfo method in typeof(DefaultTalkController).GetMethods(BindingFlags.Public | BindingFlags.Static)) { if (method.Name.Contains("Method_Public_Static_Void_Boolean_") && !method.Name.Contains("PDM")) { harmony.Patch(method, null, new HarmonyMethod(typeof(BTKSAImmersiveHud).GetMethod("OnHudUpdateEvent", BindingFlags.Public | BindingFlags.Static))); } } //World join hook to detect for first world join foreach (MethodInfo method in typeof(RoomManager).GetMethods(BindingFlags.Public | BindingFlags.Static)) { if (method.Name.Contains("Method_Public_Static_Boolean_ApiWorld_ApiWorldInstance_")) { harmony.Patch(method, null, new HarmonyMethod(typeof(BTKSAImmersiveHud).GetMethod("OnWorldJoin", BindingFlags.Static | BindingFlags.Public))); } } HudContent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud"); GestureParent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/GestureToggleParent"); NotificationParent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/NotificationDotParent"); AFKParent = GameObject.Find("/UserInterface/UnscaledUI/HudContent/Hud/AFK"); }