/// <summary> /// Adds a custom Pedal to an already existing menu in vrchat. Options are in enum ActionMenuPageType /// </summary> /// <param name="pageType">The page type you want to add your pedal to</param> /// <param name="triggerEvent">Called on pedal click</param> /// <param name="text">Pedal Text</param> /// <param name="icon">Pedal Icon</param> /// <param name="insertion">Whether to place your pedal before or after vrchat places its own</param> public PedalStruct AddPedalToExistingMenu(ActionMenuPageType pageType, System.Action triggerEvent, string text = "Button Text", Texture2D icon = null, Insertion insertion = Insertion.Post) { PedalStruct customPedal = new PedalStruct(text, icon, triggerEvent); switch (pageType) { case ActionMenuPageType.Config: if (insertion == Insertion.Pre) { configPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { configPagePost.Add(customPedal); } break; case ActionMenuPageType.Emojis: if (insertion == Insertion.Pre) { emojisPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { emojisPagePost.Add(customPedal); } break; case ActionMenuPageType.Expression: if (insertion == Insertion.Pre) { expressionPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { expressionPagePost.Add(customPedal); } break; case ActionMenuPageType.Main: if (insertion == Insertion.Pre) { mainPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { mainPagePost.Add(customPedal); } break; case ActionMenuPageType.MenuOpacity: if (insertion == Insertion.Pre) { menuOpacityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { menuOpacityPagePost.Add(customPedal); } break; case ActionMenuPageType.MenuSize: if (insertion == Insertion.Pre) { menuSizePagePre.Add(customPedal); } else if (insertion == Insertion.Post) { menuSizePagePost.Add(customPedal); } break; case ActionMenuPageType.Nameplates: if (insertion == Insertion.Pre) { nameplatesPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { nameplatesPagePost.Add(customPedal); } break; case ActionMenuPageType.NameplatesOpacity: if (insertion == Insertion.Pre) { nameplatesOpacityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { nameplatesOpacityPagePost.Add(customPedal); } break; case ActionMenuPageType.NameplatesSize: if (insertion == Insertion.Pre) { nameplatesSizePagePre.Add(customPedal); } else if (insertion == Insertion.Post) { nameplatesSizePagePost.Add(customPedal); } break; case ActionMenuPageType.NameplatesVisibilty: if (insertion == Insertion.Pre) { nameplatesVisibilityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { nameplatesVisibilityPagePost.Add(customPedal); } break; case ActionMenuPageType.Options: if (insertion == Insertion.Pre) { optionsPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { optionsPagePost.Add(customPedal); } break; } return(customPedal); }
private static void AddPedalToList(ActionMenuPageType pageType, PedalStruct customPedal, Insertion insertion) { switch (pageType) { case ActionMenuPageType.SDK2Expression: if (insertion == Insertion.Pre) { Patches.sdk2ExpressionPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.sdk2ExpressionPagePost.Add(customPedal); } break; case ActionMenuPageType.Config: if (insertion == Insertion.Pre) { Patches.configPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.configPagePost.Add(customPedal); } break; case ActionMenuPageType.Emojis: if (insertion == Insertion.Pre) { Patches.emojisPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.emojisPagePost.Add(customPedal); } break; case ActionMenuPageType.Expression: if (insertion == Insertion.Pre) { Patches.expressionPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.expressionPagePost.Add(customPedal); } break; case ActionMenuPageType.Main: if (insertion == Insertion.Pre) { Patches.mainPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.mainPagePost.Add(customPedal); } break; case ActionMenuPageType.MenuOpacity: if (insertion == Insertion.Pre) { Patches.menuOpacityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.menuOpacityPagePost.Add(customPedal); } break; case ActionMenuPageType.MenuSize: if (insertion == Insertion.Pre) { Patches.menuSizePagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.menuSizePagePost.Add(customPedal); } break; case ActionMenuPageType.Nameplates: if (insertion == Insertion.Pre) { Patches.nameplatesPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesPagePost.Add(customPedal); } break; case ActionMenuPageType.NameplatesOpacity: if (insertion == Insertion.Pre) { Patches.nameplatesOpacityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesOpacityPagePost.Add(customPedal); } break; case ActionMenuPageType.NameplatesSize: if (insertion == Insertion.Pre) { Patches.nameplatesSizePagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesSizePagePost.Add(customPedal); } break; case ActionMenuPageType.NameplatesVisibilty: if (insertion == Insertion.Pre) { Patches.nameplatesVisibilityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesVisibilityPagePost.Add(customPedal); } break; case ActionMenuPageType.Options: if (insertion == Insertion.Pre) { Patches.optionsPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.optionsPagePost.Add(customPedal); } break; } }
internal static void AddPedalToList(ActionMenuPage pageType, PedalStruct customPedal, Insertion insertion) { Logger.Log( $"Adding to page: {pageType.ToString()}, Text: {customPedal.text}, Locked: {customPedal.locked}"); switch (pageType) { case ActionMenuPage.SDK2Expression: if (insertion == Insertion.Pre) { Patches.sdk2ExpressionPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.sdk2ExpressionPagePost.Add(customPedal); } return; case ActionMenuPage.Config: if (insertion == Insertion.Pre) { Patches.configPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.configPagePost.Add(customPedal); } return; case ActionMenuPage.Emojis: if (insertion == Insertion.Pre) { Patches.emojisPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.emojisPagePost.Add(customPedal); } return; case ActionMenuPage.Expression: if (insertion == Insertion.Pre) { Patches.expressionPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.expressionPagePost.Add(customPedal); } return; case ActionMenuPage.Main: if (insertion == Insertion.Pre) { Patches.mainPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.mainPagePost.Add(customPedal); } return; case ActionMenuPage.MenuOpacity: if (insertion == Insertion.Pre) { Patches.menuOpacityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.menuOpacityPagePost.Add(customPedal); } return; case ActionMenuPage.MenuSize: MelonLogger.Warning( "Adding to the MenuSize page hasn't been implemented yet. Please use a different page"); return; if (insertion == Insertion.Pre) { Patches.menuSizePagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.menuSizePagePost.Add(customPedal); } return; case ActionMenuPage.Nameplates: if (insertion == Insertion.Pre) { Patches.nameplatesPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesPagePost.Add(customPedal); } return; case ActionMenuPage.NameplatesOpacity: if (insertion == Insertion.Pre) { Patches.nameplatesOpacityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesOpacityPagePost.Add(customPedal); } return; case ActionMenuPage.NameplatesSize: MelonLogger.Warning( "Adding to the Nameplates size page isn't supported currently. Please use a different page"); return; if (insertion == Insertion.Pre) { Patches.nameplatesSizePagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesSizePagePost.Add(customPedal); } return; case ActionMenuPage.NameplatesVisibilty: if (insertion == Insertion.Pre) { Patches.nameplatesVisibilityPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.nameplatesVisibilityPagePost.Add(customPedal); } return; case ActionMenuPage.Options: if (insertion == Insertion.Pre) { Patches.optionsPagePre.Add(customPedal); } else if (insertion == Insertion.Post) { Patches.optionsPagePost.Add(customPedal); } return; } }