public static void AddPedalsInList(List <PedalStruct> list, ActionMenu instance) { foreach (var pedalStruct in list) { PedalOption pedalOption = instance.AddOption(); switch (pedalStruct.Type) { case PedalType.Button: pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.SubMenu: pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeFolder; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.RadialPuppet: PedalRadial pedalRadial = (PedalRadial)pedalStruct; pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeRadial; pedalOption.field_Public_ActionButton_0.prop_String_1 = $"{Math.Round(pedalRadial.currentValue)}%"; pedalRadial.pedal = pedalOption; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.Toggle: PedalToggle pedalToggle = (PedalToggle)pedalStruct; pedalOption.setText(pedalStruct.text); if (pedalToggle.toggled) { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOn; } else { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeToggleOff; } pedalOption.setIcon(pedalToggle.icon); pedalToggle.pedal = pedalOption; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; case PedalType.FourAxisPuppet: pedalOption.setText(pedalStruct.text); pedalOption.setIcon(pedalStruct.icon); pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = GetExpressionsIcons().typeAxis; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); break; } } }
public static PedalOption AddRadialPedalToSubMenu(Action <float> onUpdate, string text = "Button Text", float startingValue = 0, Texture2D icon = null) { 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_String_1 = $"{Math.Round(startingValue)}%"; pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeRadial; pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(new Action(delegate { Action <float> combinedAction = (System.Action <float>) Delegate.Combine(new Action <float>(delegate(float f) { startingValue = f; pedalOption.field_Public_ActionButton_0.prop_String_1 = $"{Math.Round(startingValue)}%"; }), onUpdate); RadialPuppetManager.OpenRadialMenu(startingValue, combinedAction, text); })); return(pedalOption); }
public static PedalOption AddTogglePedalToSubMenu(Action <bool> onToggle, bool startingState, string text, Texture2D icon = null) { ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener(); if (actionMenuOpener == null) { return(null); } PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption(); pedalOption.setText(text); pedalOption.setIcon(icon); if (startingState) { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOn; } else { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOff; } pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(new Action(delegate { startingState = !startingState; if (startingState) { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOn; } else { pedalOption.field_Public_ActionButton_0.prop_Texture2D_2 = Utilities.GetExpressionsIcons().typeToggleOff; } onToggle.Invoke(startingState); })); return(pedalOption); }
private static void AddPedalsInList(List <PedalStruct> pedalStructs, ActionMenu instance) { foreach (PedalStruct pedalStruct in pedalStructs) { PedalOption pedalOption = instance.AddOption(); pedalOption.setText(pedalStruct.text); // VVV pedalOption.setIcon(pedalStruct.icon); //Pretty self explanatory pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(pedalStruct.triggerEvent); } }
public static PedalOption AddButtonPedalToSubMenu(Action triggerEvent, string text = "Button Text", Texture2D icon = null) { ActionMenuOpener actionMenuOpener = Utilities.GetActionMenuOpener(); if (actionMenuOpener == null) { return(null); } PedalOption pedalOption = actionMenuOpener.GetActionMenu().AddOption(); pedalOption.setText(text); pedalOption.setIcon(icon); pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(triggerEvent); return(pedalOption); }
/// <summary> /// If you create a custom Submenu you can use this to add your pedals to it /// </summary> /// <param name="triggerEvent">Called on pedal click</param> /// <param name="text">Pedal Text</param> /// <param name="icon">Pedal Icon</param> public PedalOption AddPedalToCustomMenu(System.Action triggerEvent, string text = "Button Text", Texture2D icon = null) { ActionMenuOpener actionMenuOpener = GetActionMenuOpener(); if (actionMenuOpener == null) { return(null); } PedalOption pedalOption = actionMenuOpener.field_Public_ActionMenu_0.AddOption(); pedalOption.setText(text); // VVV pedalOption.setIcon(icon); //Pretty self explanatory pedalOption.field_Public_MulticastDelegateNPublicSealedBoUnique_0 = DelegateSupport.ConvertDelegate <PedalOptionTriggerEvent>(triggerEvent); return(pedalOption); }
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); }