mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 23:09:22 +00:00
[AvatarScaleMod] Mod Network attempt 2.
I lost the first attempt when switching branches. Lot of this still needs to be redone, as it is just quickly slapped together atm.
This commit is contained in:
parent
69cb3b7804
commit
d599f57973
13 changed files with 850 additions and 544 deletions
45
AvatarScale/Networking/ModNetworkDebugger.cs
Normal file
45
AvatarScale/Networking/ModNetworkDebugger.cs
Normal file
|
@ -0,0 +1,45 @@
|
|||
using NAK.AvatarScaleMod.AvatarScaling;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.AvatarScaleMod.Networking;
|
||||
|
||||
public static class ModNetworkDebugger
|
||||
{
|
||||
public static void DoDebugInput()
|
||||
{
|
||||
// if (NetworkManager.Instance == null || NetworkManager.Instance.GameNetwork.ConnectionState != ConnectionState.Connected)
|
||||
// {
|
||||
// MelonLogger.Warning("Attempted to send a game network message without being connected to an online instance...");
|
||||
// return;
|
||||
// }
|
||||
|
||||
if (AvatarScaleManager.Instance == null)
|
||||
return;
|
||||
|
||||
float currentHeight = AvatarScaleManager.Instance.GetHeight();
|
||||
const float step = 0.1f;
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.Equals) || Input.GetKeyDown(KeyCode.KeypadPlus))
|
||||
{
|
||||
currentHeight += step;
|
||||
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
|
||||
ModNetwork.SendNetworkHeight(currentHeight);
|
||||
AvatarScaleManager.Instance.SetHeight(currentHeight);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Minus) || Input.GetKeyDown(KeyCode.KeypadMinus))
|
||||
{
|
||||
currentHeight -= step;
|
||||
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
|
||||
ModNetwork.SendNetworkHeight(currentHeight);
|
||||
AvatarScaleManager.Instance.SetHeight(currentHeight);
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.Backspace))
|
||||
{
|
||||
AvatarScaleManager.Instance.ResetHeight();
|
||||
currentHeight = AvatarScaleManager.Instance.GetHeight();
|
||||
|
||||
AvatarScaleMod.Logger.Msg($"Networking height: {currentHeight}");
|
||||
ModNetwork.SendNetworkHeight(currentHeight);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue