Skip to content

Commit b831edb

Browse files
committed
Big Cleanup
1 parent b4338cc commit b831edb

25 files changed

+1067
-729
lines changed

ActionMenuApi/AMAPI.cs

Lines changed: 62 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,105 @@
11
using System;
22
using ActionMenuApi.Api;
3-
using ActionMenuApi.Managers;
43
using ActionMenuApi.Pedals;
54
using ActionMenuApi.Types;
6-
using MelonLoader;
7-
using UnhollowerRuntimeLib;
85
using UnityEngine;
9-
using UnityEngine.UI;
106
using PedalOptionTriggerEvent = PedalOption.MulticastDelegateNPublicSealedBoUnique; //Will this change?, ¯\_(ツ)_/¯
117
// ReSharper disable HeuristicUnreachableCode
128
#pragma warning disable 1591
139

1410
namespace ActionMenuApi
1511
{
16-
[Obsolete("This class is only here for compatibility reasons! Please use ActionMenuApi.Api.CustomSubMenu/VRCActionMenuPage/AMUtils for new updated methods to integrate with the action menu", false)]
12+
[Obsolete(
13+
"This class is only here for compatibility reasons! Please use ActionMenuApi.Api.CustomSubMenu/VRCActionMenuPage/AMUtils for new updated methods to integrate with the action menu",
14+
false)]
1715
public static class AMAPI
1816
{
19-
20-
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddButton()", false)]
21-
public static void AddButtonPedalToMenu(ActionMenuPageType pageType, string text, Action triggerEvent, Texture2D icon = null, Insertion insertion = Insertion.Post)
17+
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddButton()",
18+
false)]
19+
public static void AddButtonPedalToMenu(ActionMenuPageType pageType, string text, Action triggerEvent,
20+
Texture2D icon = null, Insertion insertion = Insertion.Post)
2221
{
23-
VRCActionMenuPage.AddPedalToList((ActionMenuPage)pageType, new PedalButton(text, icon, triggerEvent), insertion);
22+
VRCActionMenuPage.AddPedalToList((ActionMenuPage) pageType, new PedalButton(text, icon, triggerEvent),
23+
insertion);
2424
}
25-
25+
2626
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddButton()", false)]
2727
public static PedalOption AddButtonPedalToSubMenu(string text, Action triggerEvent, Texture2D icon = null)
2828
{
29-
return CustomSubMenu.AddButton(text, triggerEvent, icon, false);
29+
return CustomSubMenu.AddButton(text, triggerEvent, icon);
3030
}
31-
32-
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddRadialPuppet()", false)]
33-
public static void AddRadialPedalToMenu(ActionMenuPageType pageType, string text, Action<float> onUpdate, float startingValue = 0, Texture2D icon = null, Insertion insertion = Insertion.Post)
31+
32+
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddRadialPuppet()",
33+
false)]
34+
public static void AddRadialPedalToMenu(ActionMenuPageType pageType, string text, Action<float> onUpdate,
35+
float startingValue = 0, Texture2D icon = null, Insertion insertion = Insertion.Post)
3436
{
35-
VRCActionMenuPage.AddPedalToList((ActionMenuPage)pageType, new PedalRadial(text, startingValue, icon, onUpdate), insertion);
37+
VRCActionMenuPage.AddPedalToList((ActionMenuPage) pageType,
38+
new PedalRadial(text, startingValue, icon, onUpdate), insertion);
3639
}
3740

38-
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddRadialPuppet()", false)]
39-
public static PedalOption AddRadialPedalToSubMenu(string text, Action<float> onUpdate, float startingValue = 0, Texture2D icon = null)
41+
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddRadialPuppet()",
42+
false)]
43+
public static PedalOption AddRadialPedalToSubMenu(string text, Action<float> onUpdate, float startingValue = 0,
44+
Texture2D icon = null)
4045
{
41-
return CustomSubMenu.AddRadialPuppet(text, onUpdate, startingValue, icon, false);
46+
return CustomSubMenu.AddRadialPuppet(text, onUpdate, startingValue, icon);
4247
}
43-
44-
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddFourAxisPuppet()", false)]
45-
public static void AddFourAxisPedalToMenu(ActionMenuPageType pageType, string text, Action<Vector2> onUpdate,Texture2D icon = null, Insertion insertion = Insertion.Post, string topButtonText = "Up",
48+
49+
[Obsolete(
50+
"This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddFourAxisPuppet()",
51+
false)]
52+
public static void AddFourAxisPedalToMenu(ActionMenuPageType pageType, string text, Action<Vector2> onUpdate,
53+
Texture2D icon = null, Insertion insertion = Insertion.Post, string topButtonText = "Up",
4654
string rightButtonText = "Right", string downButtonText = "Down", string leftButtonText = "Left")
4755
{
48-
VRCActionMenuPage.AddPedalToList((ActionMenuPage)pageType, new PedalFourAxis(text, icon, onUpdate, topButtonText, rightButtonText, downButtonText, leftButtonText), insertion);
56+
VRCActionMenuPage.AddPedalToList((ActionMenuPage) pageType,
57+
new PedalFourAxis(text, icon, onUpdate, topButtonText, rightButtonText, downButtonText, leftButtonText),
58+
insertion);
4959
}
50-
51-
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddFourAxisPuppet()", false)]
52-
public static PedalOption AddFourAxisPedalToSubMenu(string text, Action<Vector2> onUpdate,Texture2D icon = null, string topButtonText = "Up",
60+
61+
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddFourAxisPuppet()",
62+
false)]
63+
public static PedalOption AddFourAxisPedalToSubMenu(string text, Action<Vector2> onUpdate,
64+
Texture2D icon = null, string topButtonText = "Up",
5365
string rightButtonText = "Right", string downButtonText = "Down", string leftButtonText = "Left")
5466
{
55-
return CustomSubMenu.AddFourAxisPuppet(text, onUpdate, icon, false, topButtonText, rightButtonText, downButtonText, leftButtonText);
67+
return CustomSubMenu.AddFourAxisPuppet(text, onUpdate, icon, false, topButtonText, rightButtonText,
68+
downButtonText, leftButtonText);
5669
}
57-
58-
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddSubMenu()", false)]
59-
public static void AddSubMenuToMenu(ActionMenuPageType pageType, string text, Action openFunc, Texture2D icon = null, Action closeFunc = null, Insertion insertion = Insertion.Post)
70+
71+
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddSubMenu()",
72+
false)]
73+
public static void AddSubMenuToMenu(ActionMenuPageType pageType, string text, Action openFunc,
74+
Texture2D icon = null, Action closeFunc = null, Insertion insertion = Insertion.Post)
6075
{
61-
VRCActionMenuPage.AddPedalToList((ActionMenuPage)pageType, new PedalSubMenu(openFunc, text, icon, closeFunc), insertion);
76+
VRCActionMenuPage.AddPedalToList((ActionMenuPage) pageType,
77+
new PedalSubMenu(openFunc, text, icon, closeFunc), insertion);
6278
}
63-
79+
6480
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddSubMenu()", false)]
65-
public static PedalOption AddSubMenuToSubMenu(string text, Action openFunc, Texture2D icon = null, Action closeFunc = null)
81+
public static PedalOption AddSubMenuToSubMenu(string text, Action openFunc, Texture2D icon = null,
82+
Action closeFunc = null)
6683
{
67-
return CustomSubMenu.AddSubMenu(text, openFunc, icon, false, closeFunc);
84+
return CustomSubMenu.AddSubMenu(text, openFunc, icon, false, closeFunc);
6885
}
69-
70-
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddToggle()", false)]
71-
public static void AddTogglePedalToMenu(ActionMenuPageType pageType, string text, bool startingState, Action<bool> onToggle, Texture2D icon = null, Insertion insertion = Insertion.Post)
86+
87+
[Obsolete("This method is only here for compatibility reasons! Please use VRCActionMenuPage.AddToggle()",
88+
false)]
89+
public static void AddTogglePedalToMenu(ActionMenuPageType pageType, string text, bool startingState,
90+
Action<bool> onToggle, Texture2D icon = null, Insertion insertion = Insertion.Post)
7291
{
73-
VRCActionMenuPage.AddPedalToList((ActionMenuPage)pageType, new PedalToggle(text, onToggle, startingState, icon), insertion);
92+
VRCActionMenuPage.AddPedalToList((ActionMenuPage) pageType,
93+
new PedalToggle(text, onToggle, startingState, icon), insertion);
7494
}
75-
95+
7696
[Obsolete("This method is only here for compatibility reasons! Please use CustomSubMenu.AddToggle()", false)]
77-
public static PedalOption AddTogglePedalToSubMenu(string text, bool startingState, Action<bool> onToggle, Texture2D icon = null)
97+
public static PedalOption AddTogglePedalToSubMenu(string text, bool startingState, Action<bool> onToggle,
98+
Texture2D icon = null)
7899
{
79-
return CustomSubMenu.AddToggle(text, startingState, onToggle, icon, false);
100+
return CustomSubMenu.AddToggle(text, startingState, onToggle, icon);
80101
}
81-
102+
82103
[Obsolete("This method is only here for compatibility reasons! Please use AMUtils.AddToModsFolder()", false)]
83104
public static void AddModFolder(string text, Action openFunc, Texture2D icon = null)
84105
{

ActionMenuApi/ActionMenuApi.cs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,23 @@
22
using System.Collections;
33
using ActionMenuApi.Managers;
44
using MelonLoader;
5+
56
#pragma warning disable 1591
6-
[assembly: MelonInfo(typeof(ActionMenuApi.ActionMenuApi), "ActionMenuApi", "0.3.0", "gompo", "https://github.com/gompocp/ActionMenuApi/releases")]
7+
[assembly:
8+
MelonInfo(typeof(ActionMenuApi.ActionMenuApi), "ActionMenuApi", "0.3.0", "gompo",
9+
"https://github.com/gompocp/ActionMenuApi/releases")]
710
[assembly: MelonGame("VRChat", "VRChat")]
811
[assembly: VerifyLoaderVersion(0, 4, 0, true)]
912

1013
namespace ActionMenuApi
1114
{
1215
public class ActionMenuApi : MelonMod
1316
{
17+
public ActionMenuApi()
18+
{
19+
LoaderIntegrityCheck.VibeCheck();
20+
}
21+
1422
public override void OnApplicationStart()
1523
{
1624
ResourcesManager.LoadTextures();
@@ -24,8 +32,8 @@ public override void OnApplicationStart()
2432
MelonLogger.Error($"Patching failed with exception: {e.Message}");
2533
}
2634
}
27-
28-
IEnumerator WaitForActionMenuInit()
35+
36+
private IEnumerator WaitForActionMenuInit()
2937
{
3038
while (ActionMenuDriver.prop_ActionMenuDriver_0 == null) //VRCUIManager Init is too early
3139
yield return null;
@@ -34,17 +42,12 @@ IEnumerator WaitForActionMenuInit()
3442
RadialPuppetManager.Setup();
3543
FourAxisPuppetManager.Setup();
3644
}
37-
45+
3846

3947
public override void OnUpdate()
4048
{
4149
RadialPuppetManager.OnUpdate();
4250
FourAxisPuppetManager.OnUpdate();
4351
}
44-
45-
public ActionMenuApi()
46-
{
47-
LoaderIntegrityCheck.VibeCheck();
48-
}
4952
}
5053
}

ActionMenuApi/Api/AMUtils.cs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,43 +8,44 @@ namespace ActionMenuApi.Api
88
public static class AMUtils
99
{
1010
/// <summary>
11-
/// Trigger a refresh for the action menus
11+
/// Trigger a refresh for the action menus
1212
/// </summary>
1313
public static void RefreshActionMenu()
1414
{
1515
try
1616
{
1717
Utilities.RefreshAM();
1818
}
19-
catch(Exception e)
19+
catch (Exception e)
2020
{
21-
MelonLogger.Warning($"Refresh failed (oops). This may or may not be an oof if another exception immediately follows after this exception: {e}");
21+
MelonLogger.Warning(
22+
$"Refresh failed (oops). This may or may not be an oof if another exception immediately follows after this exception: {e}");
2223
//This is semi-abusable if this fails so its probably a good idea to have a fail-safe to protect sensitive functions that are meant to be locked
2324
Utilities.ResetMenu();
2425
}
2526
}
26-
27+
2728
/// <summary>
28-
/// Trigger a complete reset for the action menus
29+
/// Trigger a complete reset for the action menus
2930
/// </summary>
3031
public static void ResetMenu()
3132
{
3233
Utilities.ResetMenu();
3334
}
3435

3536
/// <summary>
36-
/// Add a mod to a dedicated section of the action menu with other mods
37+
/// Add a mod to a dedicated section of the action menu with other mods
3738
/// </summary>
3839
/// <param name="text">Button text</param>
39-
/// <param name="openFunc">Function called when your mod page is opened. Add your methods calls to other AMAPI methods such AddRadialPedalToSubMenu to add buttons to the submenu it creates when clicked</param>
40+
/// <param name="openFunc">
41+
/// Function called when your mod page is opened. Add your methods calls to other AMAPI methods such
42+
/// AddRadialPedalToSubMenu to add buttons to the submenu it creates when clicked
43+
/// </param>
4044
/// <param name="icon">(optional) The Button Icon</param>
4145
/// <param name="locked">(optional) Starting state of pedal</param>
4246
public static void AddToModsFolder(string text, Action openFunc, Texture2D icon = null, bool locked = false)
4347
{
44-
ModsFolderManager.AddMod(() =>
45-
{
46-
CustomSubMenu.AddSubMenu(text, openFunc, icon, locked);
47-
});
48+
ModsFolderManager.AddMod(() => { CustomSubMenu.AddSubMenu(text, openFunc, icon, locked); });
4849
}
4950
}
5051
}

ActionMenuApi/Api/ActionMenuPage.cs

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,67 @@
11
namespace ActionMenuApi.Api
2-
{
2+
{
33
/// <summary>
4-
/// Supported existing vrchat pages that you can add pedals to
4+
/// Supported existing vrchat pages that you can add pedals to
55
/// </summary>
66
public enum ActionMenuPage
77
{
88
/// <summary>
9-
/// The more "advanced" options in the action menu. Can change menu opacity, size, position etc. here
9+
/// The more "advanced" options in the action menu. Can change menu opacity, size, position etc. here
1010
/// </summary>
1111
Config,
12-
12+
1313
/// <summary>
14-
/// The page that shows when you open the emojis page of the action menu
14+
/// The page that shows when you open the emojis page of the action menu
1515
/// </summary>
1616
Emojis,
17-
17+
1818
/// <summary>
19-
/// The page that shows when you open the expression page of the action menu using an sdk3 avatar
19+
/// The page that shows when you open the expression page of the action menu using an sdk3 avatar
2020
/// </summary>
2121
Expression,
22-
22+
2323
/// <summary>
24-
/// The page that shows when you open the expression page of the action menu using an sdk2 avatar. Has emotes 1-8
24+
/// The page that shows when you open the expression page of the action menu using an sdk2 avatar. Has emotes 1-8
2525
/// </summary>
2626
SDK2Expression,
27-
27+
2828
/// <summary>
29-
/// The default page that shows when you open the action menu
29+
/// The default page that shows when you open the action menu
3030
/// </summary>
3131
Main,
32-
32+
3333
/// <summary>
34-
/// The menu opacity page. Has 25%, 50%, 75%, 100%
34+
/// The menu opacity page. Has 25%, 50%, 75%, 100%
3535
/// </summary>
3636
MenuOpacity,
37-
37+
3838
/// <summary>
39-
/// The menu size page. Has Small, Medium, Large
39+
/// The menu size page. Has Small, Medium, Large
4040
/// </summary>
4141
MenuSize, //Not Implemented
42-
42+
4343
/// <summary>
44-
/// The nameplates config page of the action menu
44+
/// The nameplates config page of the action menu
4545
/// </summary>
4646
Nameplates,
47-
47+
4848
/// <summary>
49-
/// The nameplates opacity page 0%,20%,40%,60%,80%,100%
49+
/// The nameplates opacity page 0%,20%,40%,60%,80%,100%
5050
/// </summary>
5151
NameplatesOpacity,
52-
52+
5353
/// <summary>
54-
/// The nameplates visibility page shown,icons only,hidden
54+
/// The nameplates visibility page shown,icons only,hidden
5555
/// </summary>
5656
NameplatesVisibilty,
57-
57+
5858
/// <summary>
59-
/// The nameplates size page tiny,small,normal,medium,large
59+
/// The nameplates size page tiny,small,normal,medium,large
6060
/// </summary>
6161
NameplatesSize,
62-
62+
6363
/// <summary>
64-
/// The options page, toggle mic, close menu etc.
64+
/// The options page, toggle mic, close menu etc.
6565
/// </summary>
6666
Options
6767
}

0 commit comments

Comments
 (0)