From f4f2e93b5ef6bba999d648ae3eb70720ecc832bc Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Wed, 16 Dec 2020 08:40:42 +0000 Subject: [PATCH] fix cast --- QSB/QSBNetworkManager.cs | 4 ++-- QuantumUNET/QSBNetworkHash128.cs | 4 ++++ QuantumUNET/QSBNetworkSceneId.cs | 9 +++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/QSB/QSBNetworkManager.cs b/QSB/QSBNetworkManager.cs index 22a034f7..26aba99b 100644 --- a/QSB/QSBNetworkManager.cs +++ b/QSB/QSBNetworkManager.cs @@ -99,8 +99,8 @@ namespace QSB { var ident = go.AddComponent(); ident.LocalPlayerAuthority = true; - ident.SetValue("m_AssetId", playerPrefab.GetComponent().assetId); - ident.SetValue("m_SceneId", playerPrefab.GetComponent().sceneId); + ident.SetValue("m_AssetId", (QSBNetworkHash128)playerPrefab.GetComponent().assetId); + ident.SetValue("m_SceneId", (QSBNetworkSceneId)playerPrefab.GetComponent().sceneId); } private void SetupNetworkTransform(GameObject go) diff --git a/QuantumUNET/QSBNetworkHash128.cs b/QuantumUNET/QSBNetworkHash128.cs index b60370b3..b401b51c 100644 --- a/QuantumUNET/QSBNetworkHash128.cs +++ b/QuantumUNET/QSBNetworkHash128.cs @@ -1,4 +1,5 @@ using System; +using UnityEngine.Networking; namespace QuantumUNET { @@ -121,5 +122,8 @@ namespace QuantumUNET i15 }); } + + public static explicit operator QSBNetworkHash128(NetworkHash128 v) + => Parse(v.ToString()); } } diff --git a/QuantumUNET/QSBNetworkSceneId.cs b/QuantumUNET/QSBNetworkSceneId.cs index c9872960..ef8454fc 100644 --- a/QuantumUNET/QSBNetworkSceneId.cs +++ b/QuantumUNET/QSBNetworkSceneId.cs @@ -1,5 +1,6 @@ using System; using UnityEngine; +using UnityEngine.Networking; namespace QuantumUNET { @@ -32,5 +33,13 @@ namespace QuantumUNET => c1.m_Value != c2.m_Value; public override string ToString() => m_Value.ToString(); + + public static explicit operator QSBNetworkSceneId(NetworkSceneId v) + { + return new QSBNetworkSceneId + { + m_Value = v.Value + }; + } } }