Skip to content

Commit

Permalink
See commit desc.
Browse files Browse the repository at this point in the history
- Switch to float operations, doubles are unnecessary
- Restructed Solution so that its easier to build
  • Loading branch information
gompocp committed May 7, 2021
1 parent c38d5b7 commit 5357310
Show file tree
Hide file tree
Showing 15 changed files with 194 additions and 413 deletions.
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

*.dll
Libs/*.dll
Output
.idea

*.CopyComplete
ActionMenuApi/obj/*
ActionMenuTestMod/obj/*
*.user
*.cache
*.pdb

17 changes: 11 additions & 6 deletions ActionMenuApi.sln
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,27 @@ ProjectSection(SolutionItems) = preProject
README.md = README.md
LICENSE = LICENSE
.gitignore = .gitignore
Directory.Build.props = Directory.Build.props
EndProjectSection
EndProject

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionMenuApi", "ActionMenuApi\ActionMenuApi.csproj", "{8F74B60C-3E7F-409B-8245-61E16A4C34E7}"
Project("{DA3EF296-0E10-44D0-8EB4-A44CC02AAB15}") = "ActionMenuApi", "ActionMenuApi\ActionMenuApi.csproj", "{4F1AFCA6-F4AC-49B9-9FEE-3C83C4664835}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ActionMenuTestMod", "ActionMenuTestMod\ActionMenuTestMod.csproj", "{8F74B60C-3E7F-409B-8245-61E16A4C34E8}"
Project("{DA3EF296-0E10-44D0-8EB4-A44CC02AAB15}") = "ActionMenuTestMod", "ActionMenuTestMod\ActionMenuTestMod.csproj", "{7D1FA011-E981-48A0-9267-1C104B848AB8}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8F74B60C-3E7F-409B-8245-61E16A4C34E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8F74B60C-3E7F-409B-8245-61E16A4C34E8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8F74B60C-3E7F-409B-8245-61E16A4C34E8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8F74B60C-3E7F-409B-8245-61E16A4C34E8}.Release|Any CPU.Build.0 = Release|Any CPU
{4F1AFCA6-F4AC-49B9-9FEE-3C83C4664835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4F1AFCA6-F4AC-49B9-9FEE-3C83C46648358}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4F1AFCA6-F4AC-49B9-9FEE-3C83C4664835}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4F1AFCA6-F4AC-49B9-9FEE-3C83C4664835}.Release|Any CPU.Build.0 = Release|Any CPU
{7D1FA011-E981-48A0-9267-1C104B848AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7D1FA011-E981-48A0-9267-1C104B848AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7D1FA011-E981-48A0-9267-1C104B848AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7D1FA011-E981-48A0-9267-1C104B848AB8}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
2 changes: 0 additions & 2 deletions ActionMenuApi/.gitignore

This file was deleted.

158 changes: 1 addition & 157 deletions ActionMenuApi/AMAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static PedalOption AddRadialPedalToSubMenu(string text, Action<float> onU
pedalOption.SetPedalTriggerEvent(
DelegateSupport.ConvertDelegate<PedalOptionTriggerEvent>(new Action(delegate
{
Action<float> combinedAction = (Action<float>)Delegate.Combine(new Action<float>(delegate(float f)
var combinedAction = (Action<float>)Delegate.Combine(new Action<float>(delegate(float f)
{
startingValue = f;
pedalOption.SetButtonPercentText($"{Math.Round(startingValue*100)}%");
Expand Down Expand Up @@ -353,161 +353,5 @@ private static void AddPedalToList(ActionMenuPageType pageType, PedalStruct cust
return;
}
}
[Obsolete("This method is obsolete. Use the override AddButtonPedalToMenu(pageType, text, triggerEvent, icon, insertion)", true)]
public static void AddButtonPedalToMenu(ActionMenuPageType pageType, Action triggerEvent, string text = "Button Text", Texture2D icon = null, Insertion insertion = Insertion.Post)
{
AddPedalToList(
pageType,
new PedalButton(
text,
icon,
triggerEvent
),
insertion
);
}

[Obsolete("This method is obsolete. Use the override AddButtonPedalToSubMenu(text, triggerEvent, icon)", true)]
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;
}

[Obsolete("This method is obsolete. Use the override AddRadialPedalToMenu(pageType, text, onUpdate, startingValue, icon, insertion)", true)]
public static void AddRadialPedalToMenu(ActionMenuPageType pageType, Action<float> onUpdate, string text = "Button Text", float startingValue = 0, Texture2D icon = null, Insertion insertion = Insertion.Post)
{
AddPedalToList(
pageType,
new PedalRadial(
text,
startingValue,
icon,
onUpdate
),
insertion
);
}

[Obsolete("This method is obsolete. Use the override AddRadialPedalToSubMenu(text, onUpdate, startingValue, icon)", true)]
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, pedalOption);
}));
return pedalOption;
}

[Obsolete("This method is obsolete. Use the override AddFourAxisPedalToMenu(pageType, text, onUpdate, icon, insertion, topButtonText, rightButtonText, downButtonText, leftButtonText)", true)]
public static void AddFourAxisPedalToMenu(ActionMenuPageType pageType, string text, Vector2 startingValue, Action<Vector2> onUpdate,Texture2D icon = null, Insertion insertion = Insertion.Post, string topButtonText = "Up",
string rightButtonText = "Right", string downButtonText = "Down", string leftButtonText = "Left")
{
AddPedalToList(
pageType,
new PedalFourAxis(
text,
icon,
onUpdate,
topButtonText,
rightButtonText,
downButtonText,
leftButtonText
),
insertion
);
}

[Obsolete("This method is obsolete. Use the override AddFourAxisPedalToSubMenu(text, onUpdate, icon, topButtonText, rightButtonText, downButtonText, leftButtonText)", true)]
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(text, v => startingValue = v, pedalOption);
FourAxisPuppetManager.current.GetButtonUp().SetButtonText(topButtonText);
FourAxisPuppetManager.current.GetButtonRight().SetButtonText(rightButtonText);
FourAxisPuppetManager.current.GetButtonDown().SetButtonText(downButtonText);
FourAxisPuppetManager.current.GetButtonLeft().SetButtonText(leftButtonText);
}));
return pedalOption;
}

[Obsolete("This method is obsolete. Use the override AddSubMenuToMenu(pageType, text, openFunc, icon, closeFunc, insertion)", true)]
public static void AddSubMenuToMenu(ActionMenuPageType pageType, Action openFunc, string text = null,
Texture2D icon = null, Action closeFunc = null, Insertion insertion = Insertion.Post)
{
AddPedalToList(
pageType,
new PedalSubMenu(
openFunc,
text,
icon,
closeFunc
),
insertion
);
}

[Obsolete("This method is obsolete. Use the override AddTogglePedalToMenu(pageType, text, startingState, onToggle, icon, insertion)", true)]
public static void AddTogglePedalToMenu(ActionMenuPageType pageType,bool startingState, System.Action<bool> onToggle, string text, Texture2D icon = null, Insertion insertion = Insertion.Post)
{
AddPedalToList(
pageType,
new PedalToggle(
text,
onToggle,
startingState,
icon
),
insertion
);
}

[Obsolete("This method is obsolete. Use the override AddTogglePedalToSubMenu(text, startingState, onToggle, icon)", true)]
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;
}
}
}
11 changes: 3 additions & 8 deletions ActionMenuApi/ActionMenuApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
using Harmony;
using UnityEngine;

[assembly: MelonInfo(typeof(ActionMenuApi.ActionMenuApi), "ActionMenuApi", "0.1.2", "gompo", "https://github.com/gompocp/ActionMenuApi/releases")]
[assembly: MelonGame("VRChat", "VRChat")]

namespace ActionMenuApi
{
internal static class ModInfo
{
public const string Name = "ActionMenuApi";
public const string Author = "gompo";
public const string Version = "0.1.2";
public const string DownloadLink = "https://github.com/gompocp/ActionMenuApi/releases";
}

public class ActionMenuApi : MelonMod
{
public override void OnApplicationStart()
Expand Down
111 changes: 5 additions & 106 deletions ActionMenuApi/ActionMenuApi.csproj
Original file line number Diff line number Diff line change
@@ -1,109 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{8F74B60C-3E7F-409B-8245-61E16A4C34E7}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ActionMenuApi</RootNamespace>
<AssemblyName>ActionMenuApi</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFramework>net472</TargetFramework>
<VrcReferences>true</VrcReferences>
<Version>0.1.2.0</Version>
<LangVersion>9</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="Assembly-CSharp, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="Il2Cppmscorlib, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\Il2Cppmscorlib.dll</HintPath>
</Reference>
<Reference Include="MelonLoader, Version=0.3.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\MelonLoader.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnhollowerBaseLib, Version=0.4.13.0, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnhollowerBaseLib.dll</HintPath>
</Reference>
<Reference Include="Unity.TextMeshPro, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\Unity.TextMeshPro.dll</HintPath>
</Reference>
<Reference Include="UnityEngine, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.AssetBundleModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextCoreModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.TextCoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.VRModule, Version=3.7.1.6, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\..\..\..\..\Programs\Software\SteamLibrary\steamapps\common\VRChat\MelonLoader\Managed\UnityEngine.VRModule.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="ActionMenuAPI.cs" />
<Compile Include="Logger.cs" />
<Compile Include="Managers\FourAxisPuppetManager.cs" />
<Compile Include="Managers\RadialPuppetManager.cs" />
<Compile Include="ModMenu\ModsFolder.cs" />
<Compile Include="Pedals\PedalFourAxis.cs" />
<Compile Include="Pedals\PedalToggle.cs" />
<Compile Include="AMAPI.cs" />
<Compile Include="Patches.cs" />
<Compile Include="Pedals\PedalButton.cs" />
<Compile Include="Pedals\PedalRadial.cs" />
<Compile Include="Pedals\PedalStruct.cs" />
<Compile Include="Pedals\PedalSubMenu.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Stuff\Constants.cs" />
<Compile Include="Stuff\ExtensionMethods.cs" />
<Compile Include="Stuff\Utilities.cs" />
<Compile Include="Types\ActionMenuHand.cs" />
<Compile Include="Types\ActionMenuPageType.cs" />
<Compile Include="Types\InputAxes.cs" />
<Compile Include="Types\Insertion.cs" />
<Compile Include="Types\PedalType.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="actionmenuapi.icons" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>COPY "$(MSBuildProjectDirectory)\bin\ActionMenuApi.dll" "E:\Windows\Programs\Software\SteamLibrary\steamapps\common\VRChat\Mods"</PostBuildEvent>
</PropertyGroup>

</Project>
</Project>
Loading

0 comments on commit 5357310

Please sign in to comment.