ASTExtension: Fix for latest nightlies

This commit is contained in:
NotAKidoS 2024-12-02 20:04:47 -06:00
parent d0c8298074
commit db07d53971
3 changed files with 25 additions and 26 deletions

View file

@ -1,4 +1,5 @@
using ABI_RC.Core.Player; using ABI_RC.Core;
using ABI_RC.Core.Player;
using UnityEngine; using UnityEngine;
namespace NAK.ASTExtension.Extensions; namespace NAK.ASTExtension.Extensions;
@ -17,7 +18,7 @@ public static class PlayerSetupExtensions
Vector3 localScale = playerSetup._avatar.transform.localScale; Vector3 localScale = playerSetup._avatar.transform.localScale;
Vector3 initialScale = playerSetup.initialScale; Vector3 initialScale = playerSetup.initialScale;
float initialHeight = playerSetup._initialAvatarHeight; float initialHeight = playerSetup._initialAvatarHeight;
Vector3 scaleDifference = PlayerSetup.DivideVectors(localScale - initialScale, initialScale); Vector3 scaleDifference = CVRTools.DivideVectors(localScale - initialScale, initialScale);
return initialHeight + initialHeight * scaleDifference.y; return initialHeight + initialHeight * scaleDifference.y;
} }
} }

View file

@ -3,41 +3,41 @@ using BTKUILib;
using BTKUILib.UIObjects; using BTKUILib.UIObjects;
using BTKUILib.UIObjects.Components; 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(); Prepare_Icons();
Setup_PlayerSelectPage(); Setup_PlayerSelectPage();
} }
private static void Prepare_Icons() private static void Prepare_Icons()
{ {
QuickMenuAPI.PrepareIcon(ASTExtensionMod.ModName, "ASM_Icon_AvatarHeightCopy", QuickMenuAPI.PrepareIcon(ASTExtensionMod.ModName, "ASM_Icon_AvatarHeightCopy",
GetIconStream("ASM_Icon_AvatarHeightCopy.png")); 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; QuickMenuAPI.OnPlayerSelected += OnPlayerSelected;
Category category = QuickMenuAPI.PlayerSelectPage.AddCategory(ASTExtensionMod.ModName, ASTExtensionMod.ModName); Category category = QuickMenuAPI.PlayerSelectPage.AddCategory(ASTExtensionMod.ModName, ASTExtensionMod.ModName);
Button button = category.AddButton("Copy Height", "ASM_Icon_AvatarHeightCopy", "Copy selected players Eye Height."); Button button = category.AddButton("Copy Height", "ASM_Icon_AvatarHeightCopy", "Copy selected players Eye Height.");
button.OnPress += OnCopyPlayerHeight; button.OnPress += OnCopyPlayerHeight;
} }
private static void OnPlayerSelected(string _, string id) private static void OnPlayerSelected(string _, string id)
{ {
_selectedPlayer = id; _selectedPlayer = id;
} }
private static void OnCopyPlayerHeight() private static void OnCopyPlayerHeight()
{ {
if (string.IsNullOrEmpty(_selectedPlayer)) if (string.IsNullOrEmpty(_selectedPlayer))
return; return;
@ -51,6 +51,5 @@ namespace NAK.ASTExtension.Integrations
ASTExtensionMod.Instance.SetAvatarHeight(height); ASTExtensionMod.Instance.SetAvatarHeight(height);
} }
#endregion Player Select Page #endregion Player Select Page
}
} }

View file

@ -1,18 +1,17 @@
using System.Reflection; 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(); Assembly assembly = Assembly.GetExecutingAssembly();
string assemblyName = assembly.GetName().Name; string assemblyName = assembly.GetName().Name;
return assembly.GetManifestResourceStream($"{assemblyName}.Resources.{iconName}"); return assembly.GetManifestResourceStream($"{assemblyName}.Resources.{iconName}");
} }
#endregion Icon Utils #endregion Icon Utils
}
} }