public override void OnApplicationStart() { Instance = this; try { //Adapted from knah's JoinNotifier mod found here: https://github.com/knah/VRCMods/blob/master/JoinNotifier/JoinNotifierMod.cs using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ActionMenuUtils.icons")) using (var tempStream = new MemoryStream((int)stream.Length)) { stream.CopyTo(tempStream); iconsAssetBundle = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0); iconsAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset; } respawnIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Refresh.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); respawnIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; helpIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Help.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); helpIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; goHomeIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Home.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); goHomeIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; resetAvatarIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Avatar.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); resetAvatarIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; rejoinInstanceIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Pin.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); rejoinInstanceIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; } catch (Exception e) { MelonLogger.Warning("Consider checking for newer version as mod possibly no longer working, Exception occured OnAppStart(): " + e.Message); } // Creates new Api instance and patches all required methods if found actionMenuApi = new ActionMenuAPI(); ModSettings.RegisterSettings(); ModSettings.Apply(); SetupButtons(); //_ = Utils.GetGoHomeDelegate; }
public override void OnApplicationStart() { ModPrefs.RegisterCategory("PortableMirror", "PortableMirror"); ModPrefs.RegisterPrefFloat("PortableMirror", "MirrorScaleX", 5f, "Mirror Scale X"); ModPrefs.RegisterPrefFloat("PortableMirror", "MirrorScaleY", 3f, "Mirror Scale Y"); ModPrefs.RegisterPrefBool("PortableMirror", "OptimizedMirror", false, "Optimized Mirror"); ModPrefs.RegisterPrefBool("PortableMirror", "CanPickupMirror", false, "Can Pickup Mirror"); ModPrefs.RegisterPrefString("PortableMirror", "MirrorKeybind", "Alpha1", "Toggle Mirror Keybind"); _mirrorScaleX = ModPrefs.GetFloat("PortableMirror", "MirrorScaleX"); _mirrorScaleY = ModPrefs.GetFloat("PortableMirror", "MirrorScaleY"); _optimizedMirror = ModPrefs.GetBool("PortableMirror", "OptimizedMirror"); _canPickupMirror = ModPrefs.GetBool("PortableMirror", "CanPickupMirror"); _mirrorKeybind = Utils.GetMirrorKeybind(); MelonModLogger.Log("Settings can be configured in UserData\\MelonPreferences.cfg"); MelonModLogger.Log($"[{_mirrorKeybind}] -> Toggle portable mirror"); MelonMod uiExpansionKit = MelonLoader.Main.Mods.Find(m => m.InfoAttribute.Name == "UI Expansion Kit"); if (uiExpansionKit != null) { uiExpansionKit.InfoAttribute.SystemType.Assembly.GetTypes().First(t => t.FullName == "UIExpansionKit.API.ExpansionKitApi").GetMethod("RegisterWaitConditionBeforeDecorating", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static).Invoke(null, new object[] { CreateQuickMenuButton() }); } }
public override void OnApplicationStart() { Instance = this; ModSettings.RegisterSettings(); ModSettings.Apply(); SocialMenuPatch.Setup(); WorldInfoPatch.Setup(); }
internal static void Init(MelonMod modInstance) { if (jsonPath != null) { throw new InvalidOperationException("Init called multiple times"); } jsonPath = Path.Combine(Path.GetDirectoryName(modInstance.Location), modInstance.Info.Name + ".json"); }
public override void OnApplicationStart() { Instance = this; ModSettings.RegisterSettings(); ModSettings.LoadSettings(); SocialMenuSetup.Patch(); WorldInfoSetup.Patch(); NotificationMoreActions.Patch(); ExpansionKitApi.OnUiManagerInit += UiManagerInit; }
public override void OnApplicationStart() { Instance = this; ModSettings.RegisterSettings(); ModSettings.Apply(); SocialMenuSetup.Patch(); WorldInfoSetup.Patch(); WorldDownloadListener.Patch(); NotificationMoreActions.Patch(); }
public override void OnApplicationStart() { MelonMod uiExpansionKit = MelonLoader.Main.Mods.Find(m => m.InfoAttribute.Name == "UI Expansion Kit"); if (uiExpansionKit != null) { uiExpansionKit.InfoAttribute.SystemType.Assembly.GetTypes().First(t => t.FullName == "UIExpansionKit.API.ExpansionKitApi").GetMethod("RegisterWaitConditionBeforeDecorating", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static).Invoke(null, new object[] { CreateQuickMenuButton() }); } }
public override void OnApplicationStart() { MelonCoroutines.Start(UiManagerInitializer()); Instance = this; try { toyActionMenu = new ToyActionMenu(); } catch (Exception e) { MelonLogger.Warning("You may be missing the ActionMenuAPI mod. See: https://github.com/gompocp/ActionMenuApi"); } XrefScanning.Main.Initialize(); string defaultSubMenu = "ShortcutMenu"; if (MelonHandler.Mods.Any(mod => mod.Info.Name == "UI Expansion Kit")) { defaultSubMenu = "UIExpansionKit"; } vibratorController = MelonPreferences.CreateCategory("VibratorController"); MelonPreferences.CreateEntry(vibratorController.Identifier, "lockButton", 0, "Button to lock speed"); MelonPreferences.CreateEntry(vibratorController.Identifier, "holdButton", 0, "Button to hold to use toy"); MelonPreferences.CreateEntry(vibratorController.Identifier, "Requirehold", false, "If enabled you will need to hold set button to use toy"); MelonPreferences.CreateEntry(vibratorController.Identifier, "subMenu", defaultSubMenu, "Menu to put the mod button on"); MelonPreferences.CreateEntry(vibratorController.Identifier, "buttonX", 0, "x position to put the mod button"); MelonPreferences.CreateEntry(vibratorController.Identifier, "buttonY", 1, "y position to put the mod button"); lockButton = (KeyCode)MelonPreferences.GetEntryValue <int>(vibratorController.Identifier, "lockButton"); holdButton = (KeyCode)MelonPreferences.GetEntryValue <int>(vibratorController.Identifier, "holdButton"); subMenu = MelonPreferences.GetEntryValue <string>(vibratorController.Identifier, "subMenu"); buttonX = MelonPreferences.GetEntryValue <int>(vibratorController.Identifier, "buttonX"); buttonY = MelonPreferences.GetEntryValue <int>(vibratorController.Identifier, "buttonY"); if (subMenu == "UIExpansionKit") { if (defaultSubMenu == "UIExpansionKit") { setupUIExpansion(); } else { subMenu = "ShortcutMenu"; MelonPreferences.SetEntryValue(vibratorController.Identifier, "subMenu", subMenu); MelonLogger.Msg("UIExpansionKit not found.. Moving menu button to 'ShortcutMenu'"); } } }
private bool HasCompatibleSongBrowser(MelonMod mod) { if (mod.Info.SystemType.Name == nameof(SongBrowser)) { string[] versionInfo = mod.Info.Version.Split('.'); int major = int.Parse(versionInfo[0]); int minor = int.Parse(versionInfo[1]); int patch = int.Parse(versionInfo[2]); if (major > 2 || (major == 2 && (minor > 4 || minor == 4 && patch >= 0))) { return(true); } } return(false); }