Skip to content

Commit

Permalink
Additional Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gompocp committed Jun 11, 2021
1 parent 976b205 commit b4338cc
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
17 changes: 17 additions & 0 deletions ActionMenuApi/Api/VRCActionMenuPage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,23 @@ public static PedalRadial AddRadialPuppet(ActionMenuPage pageType, string text,
AddPedalToList(pageType, pedal, insertion);
return pedal;
}

/// <summary>
/// Add a restricted radial puppet button pedal to a specific ActionMenu page. Restricted meaning that you can't rotate past 100 to get to 0 and vice versa
/// </summary>
/// <param name="pageType">The page to add the button to</param>
/// <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="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 AddRestrictedRadialPuppet(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, true);
AddPedalToList(pageType, pedal, insertion);
return pedal;
}

/// <summary>
/// Add a four axis puppet button pedal to a specific ActionMenu page
Expand Down
6 changes: 4 additions & 2 deletions ActionMenuApi/Pedals/PedalRadial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ public sealed class PedalRadial : PedalStruct
{
public float currentValue;
public PedalOption pedal { get; set; }
public bool restricted { get; private set; }

public PedalRadial(string text, float startingValue, Texture2D icon, Action<float> onUpdate, bool locked = false)
public PedalRadial(string text, float startingValue, Texture2D icon, Action<float> onUpdate, bool locked = false, bool restricted = false)
{
this.text = text;
this.currentValue = startingValue;
Expand All @@ -22,10 +23,11 @@ public PedalRadial(string text, float startingValue, Texture2D icon, Action<floa
startingValue = f;
pedal.SetButtonPercentText($"{Math.Round(startingValue * 100)}%");
}), onUpdate);
RadialPuppetManager.OpenRadialMenu(startingValue, combinedAction, text, pedal);
RadialPuppetManager.OpenRadialMenu(startingValue, combinedAction, text, pedal, restricted);
};
this.Type = PedalType.RadialPuppet;
this.locked = locked;
this.restricted = restricted;
}
}
}
2 changes: 1 addition & 1 deletion ActionMenuApi/Stuff/LoaderIntegrityCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace ActionMenuApi
{
[HarmonyShield]
[PatchShield]
internal static class LoaderIntegrityCheck
{
//Credit to knah: https://github.com/knah/VRCMods/blob/master/UIExpansionKit/LoaderIntegrityCheck.cs
Expand Down

0 comments on commit b4338cc

Please sign in to comment.