mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-02 06:19:22 +00:00
ASTExtension: Removed need for Avatar Scale Tool
This commit is contained in:
parent
458d4b3987
commit
5c7f7ab265
7 changed files with 257 additions and 137 deletions
56
ASTExtension/Integrations/BTKUI/BtkUiAddon.cs
Normal file
56
ASTExtension/Integrations/BTKUI/BtkUiAddon.cs
Normal file
|
@ -0,0 +1,56 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using BTKUILib;
|
||||
using BTKUILib.UIObjects;
|
||||
using BTKUILib.UIObjects.Components;
|
||||
|
||||
namespace NAK.ASTExtension.Integrations
|
||||
{
|
||||
public static partial class BtkUiAddon
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
Prepare_Icons();
|
||||
Setup_PlayerSelectPage();
|
||||
}
|
||||
|
||||
private static void Prepare_Icons()
|
||||
{
|
||||
QuickMenuAPI.PrepareIcon(ASTExtensionMod.ModName, "ASM_Icon_AvatarHeightCopy",
|
||||
GetIconStream("ASM_Icon_AvatarHeightCopy.png"));
|
||||
}
|
||||
|
||||
#region Player Select Page
|
||||
|
||||
private static string _selectedPlayer;
|
||||
|
||||
private static void Setup_PlayerSelectPage()
|
||||
{
|
||||
QuickMenuAPI.OnPlayerSelected += OnPlayerSelected;
|
||||
Category category = QuickMenuAPI.PlayerSelectPage.AddCategory(ASTExtensionMod.ModName, ASTExtensionMod.ModName);
|
||||
Button button = category.AddButton("Copy Height", "ASM_Icon_AvatarHeightCopy", "Copy selected players Eye Height.");
|
||||
button.OnPress += OnCopyPlayerHeight;
|
||||
}
|
||||
|
||||
private static void OnPlayerSelected(string _, string id)
|
||||
{
|
||||
_selectedPlayer = id;
|
||||
}
|
||||
|
||||
private static void OnCopyPlayerHeight()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_selectedPlayer))
|
||||
return;
|
||||
|
||||
if (!CVRPlayerManager.Instance.GetPlayerPuppetMaster(_selectedPlayer, out PuppetMaster player))
|
||||
return;
|
||||
|
||||
if (player._avatar == null)
|
||||
return;
|
||||
|
||||
float height = player.netIkController.GetRemoteHeight();
|
||||
ASTExtensionMod.Instance.SetAvatarHeight(height);
|
||||
}
|
||||
|
||||
#endregion Player Select Page
|
||||
}
|
||||
}
|
18
ASTExtension/Integrations/BTKUI/BtkUiAddon_Utils.cs
Normal file
18
ASTExtension/Integrations/BTKUI/BtkUiAddon_Utils.cs
Normal file
|
@ -0,0 +1,18 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace NAK.ASTExtension.Integrations
|
||||
{
|
||||
public static partial class BtkUiAddon
|
||||
{
|
||||
#region Icon Utils
|
||||
|
||||
private static Stream GetIconStream(string iconName)
|
||||
{
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string assemblyName = assembly.GetName().Name;
|
||||
return assembly.GetManifestResourceStream($"{assemblyName}.Resources.{iconName}");
|
||||
}
|
||||
|
||||
#endregion Icon Utils
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue