private static void VibrateRadial(Toy toy, string text = "") { AMAPI.AddRadialPedalToSubMenu(text, f => { int roundedPercent = (int)Math.Round(f * 100); toy.setSpeed(roundedPercent / 5); //0-20 }, ((float)toy.lastSpeed) / 20, toy_icons[toy.name]); }
private static void EdgeRadials(Toy toy) { VibrateRadial(toy, $"{toy.name} 2"); AMAPI.AddRadialPedalToSubMenu($"{toy.name} 1", f => { int roundedPercent = (int)Math.Round(f * 100); toy.setEdgeSpeed(roundedPercent / 5); //0-20 }, ((float)toy.lastEdgeSpeed) / 20, toy_icons[toy.name]); }
private static void MaxRadials(Toy toy) { VibrateRadial(toy, $"{toy.name} Vibration"); AMAPI.AddRadialPedalToSubMenu($"{toy.name} Contraction", f => { int contractionLevel = (int)Math.Round(f * 100) / 33; if (toy.contraction != contractionLevel) { toy.setContraction(contractionLevel); } }, ((float)toy.lastSpeed / 20), toy_icons[toy.name]); }
#pragma warning restore 414 public override void OnApplicationStart() { using (var stream = Assembly.GetExecutingAssembly() .GetManifestResourceStream("ActionMenuTestMod.customicons")) using (var tempStream = new MemoryStream((int)stream.Length)) { stream.CopyTo(tempStream); iconsAssetBundle = AssetBundle.LoadFromMemory_Internal(tempStream.ToArray(), 0); iconsAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset; } radialIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/sound-full.png", Il2CppType.Of <Texture2D>()) .Cast <Texture2D>(); radialIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; toggleIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/zero.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); toggleIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; subMenuIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/file-transfer.png", Il2CppType.Of <Texture2D>()) .Cast <Texture2D>(); subMenuIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; buttonIcon = iconsAssetBundle .LoadAsset_Internal("Assets/Resources/Icons/cloud-data-download.png", Il2CppType.Of <Texture2D>()) .Cast <Texture2D>(); buttonIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; AMAPI.AddButtonPedalToMenu(ActionMenuPageType.Main, () => MelonLogger.Msg("Pressed Button"), "Button", buttonIcon); AMAPI.AddSubMenuToMenu(ActionMenuPageType.Options, delegate { MelonLogger.Msg("Sub Menu Opened"); AMAPI.AddFourAxisPedalToSubMenu("Reposition cube X/Y", testVector, (v) => RePositionCubeXY(v), toggleIcon); AMAPI.AddFourAxisPedalToSubMenu("Reposition cube Z/Y", testVector, (v) => RePositionCubeZY(v), toggleIcon); AMAPI.AddFourAxisPedalToSubMenu("Reposition cube X/Z", testVector, (v) => RePositionCubeXZ(v), toggleIcon); AMAPI.AddRadialPedalToSubMenu(f => RotateCubeX(f), "X", x, radialIcon); AMAPI.AddRadialPedalToSubMenu(f => RotateCubeY(f), "Y", y, radialIcon); AMAPI.AddRadialPedalToSubMenu(f => RotateCubeZ(f), "Z", z, radialIcon); AMAPI.AddButtonPedalToSubMenu(CreateCube, "Spawn Cube", buttonIcon); AMAPI.AddButtonPedalToSubMenu(() => controllingGameObject.transform.localPosition = VRCPlayer.field_Internal_Static_VRCPlayer_0.transform.localPosition, "Tp Cube To Player", buttonIcon); }, "Sub Menu", subMenuIcon ); }
private static void SetupButtons() { AMAPI.AddSubMenuToMenu(ActionMenuPageType.Main, "Vibrator Controller", delegate { foreach (Toy toy in Toy.toys) { try { if (toy.isActive) { ToysMenu(toy); } } catch (Exception e) { MelonLogger.Warning($"Error with toy {toy.name}: " + e.Message); throw; } } }, logo ); return; actionMenuApi.AddPedalToExistingMenu(ActionMenuAPI.ActionMenuPageType.Main, delegate { actionMenuApi.CreateSubMenu(delegate { //// Test displaying all existing toys icons // foreach (string toy_name in available_toys) // { // ToysMenu("Nora", toy_icons[toy_name]); // } foreach (Toy toy in Toy.toys) { if (toy.isActive) { ToysMenu(toy); } } }); }, "Vibrator Controller", logo); MelonLogger.Msg("ActionMenu Generated"); }
public override void OnApplicationStart() { m_fingersBends = new float[10]; m_fingersSpreads = new float[10]; // Patches var l_patchMethod = new Harmony.HarmonyMethod(typeof(MainClass), "VRCIM_ControllersType"); typeof(VRCInputManager).GetMethods().Where(x => x.Name.StartsWith("Method_Public_Static_Boolean_EnumNPublicSealedvaKeMoCoGaViOcViDaWaUnique_") ).ToList().ForEach(m => Harmony.Patch(m, l_patchMethod)); iconsAssetBundle = AssetBundle.LoadFromMemory_Internal(VRCBonesController.Properties.Resources.customicons, 0); iconsAssetBundle.hideFlags |= HideFlags.DontUnloadUnusedAsset; radialIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Icons/sound-full.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); radialIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; toggleIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Icons/zero.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); toggleIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; subMenuIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Icons/file-transfer.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); subMenuIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; buttonIcon = iconsAssetBundle.LoadAsset_Internal("Assets/Resources/Icons/cloud-data-download.png", Il2CppType.Of <Texture2D>()).Cast <Texture2D>(); buttonIcon.hideFlags |= HideFlags.DontUnloadUnusedAsset; try { AMUtils.AddToModsFolder( "BonesController", delegate { /*CustomSubMenu.AddButton("ShowBones", delegate () * { * foreach(var plr in UnityEngine.Object.FindObjectsOfType<VRCPlayer>()) * { * var obj = plr.gameObject.GetComponent<ShowBones>(); * if (obj != null) * UnityEngine.Object.Destroy(obj); * else * plr.gameObject.AddComponent<ShowBones>().InitForPlayer(plr); * } * });*/ CustomSubMenu.AddSubMenu("Hands", delegate() { CustomSubMenu.AddSubMenu("Right", delegate() { CustomSubMenu.AddFourAxisPuppet("Control pos", ChangeRightHandPos, radialIcon); CustomSubMenu.AddFourAxisPuppet("Control forward/backwards", ChangeRightHandFB, radialIcon, false, "Forward", "", "Backwards", ""); CustomSubMenu.AddButton("Reset", delegate() { rightHandPosition = new Vector3(-120f, 390f, 65.6f); }); }, radialIcon); CustomSubMenu.AddSubMenu("Both", delegate() { CustomSubMenu.AddFourAxisPuppet("Control pos", ChangeBothHandsPos, radialIcon); CustomSubMenu.AddFourAxisPuppet("Control forward/backwards", ChangeBothHandsFB, radialIcon, false, "Forward", "", "Backwards", ""); CustomSubMenu.AddButton("Reset", delegate() { leftHandPosition = new Vector3(120f, 390f, 65.6f); rightHandPosition = new Vector3(-120f, 390f, 65.6f); }); }, radialIcon); CustomSubMenu.AddSubMenu("Left", delegate() { CustomSubMenu.AddFourAxisPuppet("Control pos", ChangeLeftHandPos, radialIcon); CustomSubMenu.AddFourAxisPuppet("Control forward/backwards", ChangeLeftHandFB, radialIcon, false, "Forward", "", "Backwards", ""); CustomSubMenu.AddButton("Reset", delegate() { leftHandPosition = new Vector3(120f, 390f, 65.6f); }); }, radialIcon); }, radialIcon); CustomSubMenu.AddSubMenu("Legs", delegate() { CustomSubMenu.AddSubMenu("Right", delegate() { CustomSubMenu.AddFourAxisPuppet("Control bends", ChangeRightLegBends, radialIcon); CustomSubMenu.AddFourAxisPuppet("Control pos", ChangeRightLegPos, radialIcon); CustomSubMenu.AddButton("Reset", delegate() { l_solver.rightLeg.IKPosition = l_solver.headPosition; }); }, radialIcon); CustomSubMenu.AddSubMenu("Both", delegate() { CustomSubMenu.AddFourAxisPuppet("Control bends", ChangeBothLegsBends, radialIcon); CustomSubMenu.AddFourAxisPuppet("Control pos", ChangeBothLegsPos, radialIcon); CustomSubMenu.AddButton("Reset", delegate() { l_solver.rightLeg.IKPosition = l_solver.headPosition; l_solver.leftLeg.IKPosition = l_solver.headPosition; }); }, radialIcon); CustomSubMenu.AddSubMenu("Left", delegate() { CustomSubMenu.AddFourAxisPuppet("Control bends", ChangeLeftLegBends, radialIcon); CustomSubMenu.AddFourAxisPuppet("Control pos", ChangeLeftLegPos, radialIcon); CustomSubMenu.AddButton("Reset", delegate() { l_solver.rightLeg.IKPosition = l_solver.headPosition; }); }, radialIcon); }, radialIcon); CustomSubMenu.AddSubMenu("Fingers", delegate() { CustomSubMenu.AddSubMenu("Right", delegate() { CustomSubMenu.AddFourAxisPuppet("Control", ChangeFingersRight, radialIcon); CustomSubMenu.AddButton("Reset", delegate() { ResetFingers(); }); }, radialIcon); CustomSubMenu.AddSubMenu("Both", delegate() { CustomSubMenu.AddFourAxisPuppet("Control", ChangeFingersBoth, radialIcon); CustomSubMenu.AddButton("Reset", delegate() { ResetFingers(); }); }, radialIcon); CustomSubMenu.AddSubMenu("Left", delegate() { CustomSubMenu.AddFourAxisPuppet("Control", ChangeFingersLeft, radialIcon); CustomSubMenu.AddButton("Reset", delegate() { ResetFingers(); }); }, radialIcon); }, radialIcon); AMAPI.AddTogglePedalToSubMenu("Enable control", false, ChangeControlState, radialIcon); //CustomSubMenu.AddFourAxisPuppet("Head", ChangeHeadRot, radialIcon); }, subMenuIcon ); }catch (Exception) { MelonLogger.Msg("Failed to load ActionMenuAPI, not installed."); } OnPreferencesSaved(); }
private static void NoraRadials(Toy toy) { VibrateRadial(toy, $"{toy.name} Vibration"); AMAPI.AddButtonPedalToSubMenu($"{toy.name} Rotate", () => { toy.rotate(); }, toy_icons[toy.name]); }