#pragma warning restore 414 public override void OnApplicationStart() { using (var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("ActionMenuTestMod.customicons")) using (var tempStream = new MemoryStream((int)stream.Length)) { stream.CopyTo(tempStream); iconsAssetBundle = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0); iconsAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset; } radialIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/sound-full.png", Il2CppType.Of <Texture2D>()) .Cast <Texture2D>(); radialIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; toggleIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/zero.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); toggleIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; subMenuIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/file-transfer.png", Il2CppType.Of <Texture2D>()) .Cast <Texture2D>(); subMenuIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; buttonIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/cloud-data-download.png", Il2CppType.Of <Texture2D>()) .Cast <Texture2D>(); buttonIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; AMAPI.AddButtonPedalToMenu(ActionMenuPageType.Main, () => MelonLogger.Msg("Pressed Button"), "Button", buttonIcon); AMAPI.AddSubMenuToMenu(ActionMenuPageType.Options, delegate { MelonLogger.Msg("Sub Menu Opened"); AMAPI.AddFourAxisPedalToSubMenu("Reposition cube X/Y", testVector, (v) => RePositionCubeXY(v), toggleIcon); AMAPI.AddFourAxisPedalToSubMenu("Reposition cube Z/Y", testVector, (v) => RePositionCubeZY(v), toggleIcon); AMAPI.AddFourAxisPedalToSubMenu("Reposition cube X/Z", testVector, (v) => RePositionCubeXZ(v), toggleIcon); AMAPI.AddRadialPedalToSubMenu(f => RotateCubeX(f), "X", x, radialIcon); AMAPI.AddRadialPedalToSubMenu(f => RotateCubeY(f), "Y", y, radialIcon); AMAPI.AddRadialPedalToSubMenu(f => RotateCubeZ(f), "Z", z, radialIcon); AMAPI.AddButtonPedalToSubMenu(CreateCube, "Spawn Cube", buttonIcon); AMAPI.AddButtonPedalToSubMenu(() => controllingGameObject.transform.localPosition = VRCPlayer.field_Internal_Static_VRCPlayer_0.transform.localPosition, "Tp Cube To Player", buttonIcon); }, "Sub Menu", subMenuIcon ); }
private static void SetupButtons() { AMAPI.AddSubMenuToMenu(ActionMenuPageType.Main, "Vibrator Controller", delegate { foreach (Toy toy in Toy.toys) { try { if (toy.isActive) { ToysMenu(toy); } } catch (Exception e) { MelonLogger.Warning($"Error with toy {toy.name}: " + e.Message); throw; } } }, logo ); return; actionMenuApi.AddPedalToExistingMenu(ActionMenuAPI.ActionMenuPageType.Main, delegate { actionMenuApi.CreateSubMenu(delegate { //// Test displaying all existing toys icons // foreach (string toy_name in available_toys) // { // ToysMenu("Nora", toy_icons[toy_name]); // } foreach (Toy toy in Toy.toys) { if (toy.isActive) { ToysMenu(toy); } } }); }, "Vibrator Controller", logo); MelonLogger.Msg("ActionMenu Generated"); }