mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-01 22:09:23 +00:00
ASTExtension: Fix for latest nightlies
This commit is contained in:
parent
d0c8298074
commit
db07d53971
3 changed files with 25 additions and 26 deletions
|
@ -1,4 +1,5 @@
|
|||
using ABI_RC.Core.Player;
|
||||
using ABI_RC.Core;
|
||||
using ABI_RC.Core.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.ASTExtension.Extensions;
|
||||
|
@ -17,7 +18,7 @@ public static class PlayerSetupExtensions
|
|||
Vector3 localScale = playerSetup._avatar.transform.localScale;
|
||||
Vector3 initialScale = playerSetup.initialScale;
|
||||
float initialHeight = playerSetup._initialAvatarHeight;
|
||||
Vector3 scaleDifference = PlayerSetup.DivideVectors(localScale - initialScale, initialScale);
|
||||
Vector3 scaleDifference = CVRTools.DivideVectors(localScale - initialScale, initialScale);
|
||||
return initialHeight + initialHeight * scaleDifference.y;
|
||||
}
|
||||
}
|
|
@ -3,41 +3,41 @@ using BTKUILib;
|
|||
using BTKUILib.UIObjects;
|
||||
using BTKUILib.UIObjects.Components;
|
||||
|
||||
namespace NAK.ASTExtension.Integrations
|
||||
namespace NAK.ASTExtension.Integrations;
|
||||
|
||||
public static partial class BtkUiAddon
|
||||
{
|
||||
public static partial class BtkUiAddon
|
||||
public static void Initialize()
|
||||
{
|
||||
public static void Initialize()
|
||||
{
|
||||
Prepare_Icons();
|
||||
Setup_PlayerSelectPage();
|
||||
}
|
||||
|
||||
private static void Prepare_Icons()
|
||||
{
|
||||
private static void Prepare_Icons()
|
||||
{
|
||||
QuickMenuAPI.PrepareIcon(ASTExtensionMod.ModName, "ASM_Icon_AvatarHeightCopy",
|
||||
GetIconStream("ASM_Icon_AvatarHeightCopy.png"));
|
||||
}
|
||||
|
||||
#region Player Select Page
|
||||
#region Player Select Page
|
||||
|
||||
private static string _selectedPlayer;
|
||||
private static string _selectedPlayer;
|
||||
|
||||
private static void Setup_PlayerSelectPage()
|
||||
{
|
||||
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)
|
||||
{
|
||||
private static void OnPlayerSelected(string _, string id)
|
||||
{
|
||||
_selectedPlayer = id;
|
||||
}
|
||||
|
||||
private static void OnCopyPlayerHeight()
|
||||
{
|
||||
private static void OnCopyPlayerHeight()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_selectedPlayer))
|
||||
return;
|
||||
|
||||
|
@ -51,6 +51,5 @@ namespace NAK.ASTExtension.Integrations
|
|||
ASTExtensionMod.Instance.SetAvatarHeight(height);
|
||||
}
|
||||
|
||||
#endregion Player Select Page
|
||||
}
|
||||
#endregion Player Select Page
|
||||
}
|
|
@ -1,18 +1,17 @@
|
|||
using System.Reflection;
|
||||
|
||||
namespace NAK.ASTExtension.Integrations
|
||||
namespace NAK.ASTExtension.Integrations;
|
||||
|
||||
public static partial class BtkUiAddon
|
||||
{
|
||||
public static partial class BtkUiAddon
|
||||
{
|
||||
#region Icon Utils
|
||||
#region Icon Utils
|
||||
|
||||
private static Stream GetIconStream(string iconName)
|
||||
{
|
||||
private static Stream GetIconStream(string iconName)
|
||||
{
|
||||
Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
string assemblyName = assembly.GetName().Name;
|
||||
return assembly.GetManifestResourceStream($"{assemblyName}.Resources.{iconName}");
|
||||
}
|
||||
|
||||
#endregion Icon Utils
|
||||
}
|
||||
#endregion Icon Utils
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue