Skip to content

Commit

Permalink
Bump version and update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gompocp committed May 14, 2021
1 parent 80a48a5 commit 8a2fe05
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 36 deletions.
2 changes: 1 addition & 1 deletion ActionMenuApi/ActionMenuApi.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ActionMenuApi.Managers;
using MelonLoader;
#pragma warning disable 1591
[assembly: MelonInfo(typeof(ActionMenuApi.ActionMenuApi), "ActionMenuApi", "0.1.2", "gompo", "https://github.com/gompocp/ActionMenuApi/releases")]
[assembly: MelonInfo(typeof(ActionMenuApi.ActionMenuApi), "ActionMenuApi", "0.2.0", "gompo", "https://github.com/gompocp/ActionMenuApi/releases")]
[assembly: MelonGame("VRChat", "VRChat")]

namespace ActionMenuApi
Expand Down
14 changes: 8 additions & 6 deletions ActionMenuApi/Api/CustomSubMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@

namespace ActionMenuApi.Api
{
/// <summary>
/// Class for adding buttons,toggles,radial puppets inside of a custom submenu
/// </summary>
public static class CustomSubMenu
{
/// <summary>
/// Add a lockable button pedal to a custom submenu
/// </summary>
/// <param name="text">Button text</param>
/// <param name="triggerEvent">Button click action</param>
/// <param name="locked">The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <returns> PedalOption Instance (Note: 1. can be null if both action menus are open 2. The gameobject that it is attached to is destroyed when you change page on the action menu)</returns>
public static PedalOption AddButton(string text, Action triggerEvent, Texture2D icon = null, bool locked = false)
{
Expand All @@ -39,9 +42,9 @@ public static PedalOption AddButton(string text, Action triggerEvent, Texture2D
/// </summary>
/// <param name="text">Button text</param>
/// <param name="onUpdate">Calls action with a float between 0 - 1 depending on the current value of the radial puppet</param>
/// <param name="locked">The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="startingValue">(optional) Starting value for radial puppet 0-1</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <returns> PedalOption Instance (Note: the gameobject that it is attached to is destroyed when you change page on the action menu</returns>
public static PedalOption AddRadialPuppet(string text, Action<float> onUpdate, float startingValue = 0, Texture2D icon = null, bool locked = false)
{
Expand Down Expand Up @@ -72,8 +75,8 @@ public static PedalOption AddRadialPuppet(string text, Action<float> onUpdate, f
/// </summary>
/// <param name="text">Button text</param>
/// <param name="onUpdate">Calls action with a Vector2 with x and y being between -1 and 1 depending on the current value of the four axis puppet</param>
/// <param name="locked">The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="topButtonText">(optional) Top Button Button text On Four Axis Puppet</param>
/// <param name="rightButtonText">(optional) Right Button Button text On Four Axis Puppet</param>
/// <param name="downButtonText">(optional) Bottom Button Button text On Four Axis Puppet</param>
Expand Down Expand Up @@ -107,8 +110,8 @@ public static PedalOption AddFourAxisPuppet(string text, Action<Vector2> onUpdat
/// </summary>
/// <param name="text">Button text</param>
/// <param name="openFunc">Function called when page opened. Add your methods calls to other AMAPI methods such AddRadialPedalToSubMenu to add buttons to the submenu it creates when clicked</param>
/// <param name="locked">The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="closeFunc">(optional) Function called when page closes</param>
/// <returns> PedalOption Instance (Note: the gameobject that it is attached to is destroyed when you change page on the action menu</returns>
public static PedalOption AddSubMenu(string text, Action openFunc, Texture2D icon = null, bool locked = false, Action closeFunc = null)
Expand All @@ -135,12 +138,11 @@ public static PedalOption AddSubMenu(string text, Action openFunc, Texture2D ico
/// <param name="text">Button text</param>
/// <param name="startingState">Starting value of the toggle pedal everytime the pedal is created</param>
/// <param name="onToggle">Calls action with a bool depending on the current value of the toggle</param>
/// <param name="locked">The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <returns> PedalOption Instance (Note: the gameobject that it is attached to is destroyed when you change page on the action menu</returns>
public static PedalOption AddToggle(string text, bool startingState, Action<bool> onToggle, Texture2D icon = null, bool locked = false)
{

ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener();
if (actionMenuOpener == null) return null;
PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption();
Expand Down
15 changes: 10 additions & 5 deletions ActionMenuApi/Api/VRCActionMenuPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ public static class VRCActionMenuPage
/// <param name="text">Button text</param>
/// <param name="triggerEvent">Button click action</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="insertion">(optional) Determines whether or not the button is added before or after VRChat's buttons for the target page</param>
public static PedalButton AddButton(ActionMenuPage pageType, string text, Action triggerEvent, Texture2D icon = null, bool locked = false, Insertion insertion = Insertion.Post)
{
var pedal = new PedalButton(text, icon, triggerEvent, locked);
AddPedalToList(pageType, pedal, insertion);
return pedal;
}

/// <summary>
/// Add a radial puppet button pedal to a specific ActionMenu page
/// </summary>
Expand All @@ -31,14 +32,15 @@ public static PedalButton AddButton(ActionMenuPage pageType, string text, Action
/// <param name="onUpdate">Calls action with a float between 0 - 1 depending on the current value of the radial puppet</param>
/// <param name="startingValue">(optional) Starting value for radial puppet 0-1</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="insertion">(optional) Determines whether or not the button is added before or after VRChat's buttons for the target page</param>
public static PedalRadial AddRadialPuppet(ActionMenuPage pageType, string text, Action<float> onUpdate, float startingValue = 0, Texture2D icon = null, bool locked = false, Insertion insertion = Insertion.Post)
{
var pedal = new PedalRadial(text, startingValue, icon, onUpdate, locked);
AddPedalToList(pageType, pedal, insertion);
return pedal;
}

/// <summary>
/// Add a four axis puppet button pedal to a specific ActionMenu page
/// </summary>
Expand All @@ -47,6 +49,7 @@ public static PedalRadial AddRadialPuppet(ActionMenuPage pageType, string text,
/// <param name="onUpdate">Calls action with a Vector2 with x and y being between -1 and 1 depending on the current value of the four axis puppet</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="insertion">(optional) Determines whether or not the button is added before or after VRChat's buttons for the target page</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="topButtonText">(optional) Top Button Button text On Four Axis Puppet</param>
/// <param name="rightButtonText">(optional) Right Button Button text On Four Axis Puppet</param>
/// <param name="downButtonText">(optional) Bottom Button Button text On Four Axis Puppet</param>
Expand All @@ -58,14 +61,15 @@ public static PedalFourAxis AddFourAxisPuppet(ActionMenuPage pageType, string te
AddPedalToList(pageType, pedal, insertion);
return pedal;
}

/// <summary>
/// Add a submenu to an ActionMenu page
/// </summary>
/// <param name="pageType">The page to add the button to</param>
/// <param name="text">Button text</param>
/// <param name="openFunc">Function called when page opened. Add your methods calls to other AMAPI methods such AddRadialPedalToSubMenu to add buttons to the submenu it creates when clicked</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="closeFunc">(optional) Function called when page closes</param>
/// <param name="insertion">(optional) Determines whether or not the button is added before or after VRChat's buttons for the target page</param>
public static PedalSubMenu AddSubMenu(ActionMenuPage pageType, string text, Action openFunc, Texture2D icon = null, bool locked = false, Action closeFunc = null, Insertion insertion = Insertion.Post)
Expand All @@ -74,7 +78,7 @@ public static PedalSubMenu AddSubMenu(ActionMenuPage pageType, string text, Acti
AddPedalToList(pageType, pedal, insertion);
return pedal;
}

/// <summary>
/// Add a toggle button pedal to an ActionMenu page
/// </summary>
Expand All @@ -83,6 +87,7 @@ public static PedalSubMenu AddSubMenu(ActionMenuPage pageType, string text, Acti
/// <param name="startingState">Starting value of the toggle pedal everytime the pedal is created</param>
/// <param name="onToggle">Calls action with a bool depending on the current value of the toggle</param>
/// <param name="icon">(optional) The Button Icon</param>
/// <param name="locked">(optional)The starting state for the lockable pedal, true = locked, false = unlocked</param>
/// <param name="insertion">(optional) Determines whether or not the button is added before or after VRChat's buttons for the target page</param>
public static PedalToggle AddToggle(ActionMenuPage pageType, string text, bool startingState, Action<bool> onToggle, Texture2D icon = null, bool locked = false, Insertion insertion = Insertion.Post)
{
Expand All @@ -93,7 +98,7 @@ public static PedalToggle AddToggle(ActionMenuPage pageType, string text, bool s

internal static void AddPedalToList(ActionMenuPage pageType, PedalStruct customPedal, Insertion insertion)
{
Logger.Log($"Adding: {pageType.ToString()}, Text: {customPedal.text}, Locked: {customPedal.locked}");
Logger.Log($"Adding to page: {pageType.ToString()}, Text: {customPedal.text}, Locked: {customPedal.locked}");
switch (pageType)
{
case ActionMenuPage.SDK2Expression:
Expand Down
4 changes: 2 additions & 2 deletions ActionMenuApi/Stuff/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ public static void AddPedalsInList(List<PedalStruct> list, ActionMenu instance)
PedalOption pedalOption = instance.AddOption();
pedalOption.SetText(pedalStruct.text);
pedalOption.SetIcon(pedalStruct.icon);
pedalOption.SetPedalTriggerEvent(
DelegateSupport.ConvertDelegate<PedalOptionTriggerEvent>(pedalStruct.triggerEvent));
if(!pedalStruct.locked) pedalOption.SetPedalTriggerEvent(DelegateSupport.ConvertDelegate<PedalOptionTriggerEvent>(pedalStruct.triggerEvent));
else ResourcesManager.AddLockChildIcon(pedalOption.GetActionButton().gameObject.GetChild("Inner"));
//Additional setup for pedals
switch (pedalStruct.Type)
{
Expand Down
Loading

0 comments on commit 8a2fe05

Please sign in to comment.