/// <summary> /// Add a lockable four axis puppet button pedal to a custom submenu /// </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="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> /// <param name="leftButtonText">(optional) Left Button Button text On Four Axis Puppet</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 AddFourAxisPuppet(string text, Action <Vector2> onUpdate, Texture2D icon = null, bool locked = false, string topButtonText = "Up", string rightButtonText = "Right", string downButtonText = "Down", string leftButtonText = "Left") { var actionMenuOpener = Utilities.GetActionMenuOpener(); if (actionMenuOpener == null) { return(null); } var pedalOption = actionMenuOpener.GetActionMenu().AddOption(); pedalOption.SetText(text); pedalOption.SetBackgroundIcon(icon); pedalOption.SetPedalTypeIcon(Utilities.GetExpressionsIcons().typeAxis); if (!locked) { pedalOption.SetPedalAction( delegate { FourAxisPuppetManager.OpenFourAxisMenu(text, onUpdate, pedalOption); FourAxisPuppetManager.current.GetButtonUp().SetButtonText(topButtonText); FourAxisPuppetManager.current.GetButtonRight().SetButtonText(rightButtonText); FourAxisPuppetManager.current.GetButtonDown().SetButtonText(downButtonText); FourAxisPuppetManager.current.GetButtonLeft().SetButtonText(leftButtonText); } ); } else { pedalOption.Lock(); } return(pedalOption); }
public static void ResetMenu(this ActionMenu actionMenu) { RadialPuppetManager.CloseRadialMenu(); FourAxisPuppetManager.CloseFourAxisMenu(); actionMenu.ClosePuppetMenus(true); for (var i = 0; i < actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0._items.Count; i++) { actionMenu.DestroyPage(actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0._items[i]); } actionMenu.field_Private_List_1_ObjectNPublicAcTeAcStGaUnique_0?.Clear(); actionMenu.field_Public_List_1_ObjectNPublicPaSiAcObUnique_0?.Clear(); }
private IEnumerator WaitForActionMenuInit() { while (ActionMenuDriver.prop_ActionMenuDriver_0 == null) //VRCUIManager Init is too early { yield return(null); } if (string.IsNullOrEmpty(ID)) { yield break; } ResourcesManager.InitLockGameObject(); RadialPuppetManager.Setup(); FourAxisPuppetManager.Setup(); }
public PedalFourAxis(string text, Texture2D icon, Action <Vector2> onUpdate, string topButtonText, string rightButtonText, string downButtonText, string leftButtonText, bool locked = false) { this.text = text; this.icon = icon; triggerEvent = delegate { FourAxisPuppetManager.OpenFourAxisMenu(text, onUpdate, pedal); FourAxisPuppetManager.current.GetButtonUp().SetButtonText(topButtonText); FourAxisPuppetManager.current.GetButtonRight().SetButtonText(rightButtonText); FourAxisPuppetManager.current.GetButtonDown().SetButtonText(downButtonText); FourAxisPuppetManager.current.GetButtonLeft().SetButtonText(leftButtonText); }; Type = PedalType.FourAxisPuppet; this.locked = locked; }
public PedalFourAxis(string text, Vector2 startingValue, Texture2D icon, Action <Vector2> onUpdate, string topButtonText, string rightButtonText, string downButtonText, string leftButtonText) { this.text = text; this.currentValue = startingValue; this.icon = icon; this.onUpdate = onUpdate; this.onClose = delegate(Vector2 v) { currentValue = v; //MelonLogger.Msg(v.ToString()); }; this.triggerEvent = delegate { FourAxisPuppetManager.OpenFourAxisMenu(startingValue, onClose, text, onUpdate); FourAxisPuppetManager.current.GetButtonUp().SetButtonText(topButtonText); FourAxisPuppetManager.current.GetButtonRight().SetButtonText(rightButtonText); FourAxisPuppetManager.current.GetButtonDown().SetButtonText(downButtonText); FourAxisPuppetManager.current.GetButtonLeft().SetButtonText(leftButtonText); }; this.Type = PedalType.FourAxisPuppet; }
public static PedalOption AddFourAxisPedalToSubMenu(string text, Vector2 startingValue, Action <Vector2> onUpdate, Texture2D icon = null, string topButtonText = "Up", string rightButtonText = "Right", string downButtonText = "Down", string leftButtonText = "Left") { ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener(); if (actionMenuOpener == null) { return(null); } PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption(); pedalOption.setText(text); pedalOption.setIcon(icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeAxis; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(new Action(delegate { FourAxisPuppetManager.OpenFourAxisMenu(startingValue, v => startingValue = v, text, onUpdate); FourAxisPuppetManager.current.GetButtonUp().SetButtonText(topButtonText); FourAxisPuppetManager.current.GetButtonRight().SetButtonText(rightButtonText); FourAxisPuppetManager.current.GetButtonDown().SetButtonText(downButtonText); FourAxisPuppetManager.current.GetButtonLeft().SetButtonText(leftButtonText); })); return(pedalOption); }
public override void OnUpdate() { RadialPuppetManager.OnUpdate(); FourAxisPuppetManager.OnUpdate(); }
public override void OnApplicationStart() { Patches.PatchAll(); RadialPuppetManager.Setup(); FourAxisPuppetManager.Setup(); }