diff --git a/Basis/Packages/com.basis.framework/Networking/BasisNetworkBehaviour/BasisNetworkBehaviour.cs b/Basis/Packages/com.basis.framework/Networking/BasisNetworkBehaviour/BasisNetworkBehaviour.cs index 6854efcfc..2e9a54913 100644 --- a/Basis/Packages/com.basis.framework/Networking/BasisNetworkBehaviour/BasisNetworkBehaviour.cs +++ b/Basis/Packages/com.basis.framework/Networking/BasisNetworkBehaviour/BasisNetworkBehaviour.cs @@ -29,7 +29,6 @@ public ushort NetworkID public bool IsOwnedLocallyOnClient = false; public ushort CurrentOwnerId; public BasisNetworkPlayer currentOwnedPlayer; - /// /// the reason its start instead of awake is to make sure progation occurs to everything no matter the net connect /// @@ -122,6 +121,8 @@ private void LowLevelOwnershipReleased(string uniqueEntityID) { if (uniqueEntityID == clientIdentifier) { + IsOwnedLocallyOnServer = false; + IsOwnedLocallyOnClient = false; OnServerOwnershipDestroyed(); } } @@ -142,6 +143,7 @@ private void LowLevelOwnershipTransfer(string uniqueEntityID, ushort NetIdNewOwn BasisUnInitalizedPlayer UnInitalizedPlayer = new BasisUnInitalizedPlayer(CurrentOwnerId); BasisDebug.LogError($"No Owner for Id {CurrentOwnerId} Creating Fake {nameof(BasisUnInitalizedPlayer)} this should only occur rarely"); UnInitalizedPlayer.Initialize(); + currentOwnedPlayer = UnInitalizedPlayer; OnOwnershipTransfer(UnInitalizedPlayer); } } @@ -302,6 +304,18 @@ public async Task RequestWhoIsOwnershipAsync(int Timout = BasisOwnershipResult Result = await BasisNetworkOwnership.RequestCurrentOwnershipAsync(clientIdentifier, Timout); return Result; } + + public bool TryGetOwnerId(out ushort OwnerId) + { + if (currentOwnedPlayer != null && currentOwnedPlayer.IsOwnerCached(clientIdentifier)) + { + OwnerId = currentOwnedPlayer.playerId; + return true; + } + OwnerId = 0; + return false; + } + public virtual void OnNetworkReady() { diff --git a/Basis/Packages/com.basis.shim/Shims/BasisNetworkShim.cs b/Basis/Packages/com.basis.shim/Shims/BasisNetworkShim.cs index 004eff59a..20b5108f4 100644 --- a/Basis/Packages/com.basis.shim/Shims/BasisNetworkShim.cs +++ b/Basis/Packages/com.basis.shim/Shims/BasisNetworkShim.cs @@ -9,6 +9,8 @@ namespace Basis.Shims { public class BasisNetworkShim : BasisNetworkBehaviour { + public DateTime NetworkTime => BasisNetworkManagement.RemoteUtcTime(); + public long NetworkDeltaTime => BasisNetworkManagement.RemoteTimeDelta(); public delegate void NetworkReadyEvent(); public delegate void ServerOwnershipDestroyedEvent(); public delegate void OwnershipTransferEvent(BasisNetworkPlayer NewOwner); diff --git a/Basis/Packages/com.basis.shim/Shims/CilboxPropBasis.cs b/Basis/Packages/com.basis.shim/Shims/CilboxPropBasis.cs index cbaf87c78..deff13666 100644 --- a/Basis/Packages/com.basis.shim/Shims/CilboxPropBasis.cs +++ b/Basis/Packages/com.basis.shim/Shims/CilboxPropBasis.cs @@ -70,6 +70,7 @@ public class CilboxPropBasis : Cilbox "UnityEngine.Collision", "UnityEngine.Events.UnityAction", "UnityEngine.Events.UnityEvent", + "UnityEngine.EventSystems.*", "UnityEngine.GameObject", // Hyper restrictive. "UnityEngine.Material", "UnityEngine.MaterialPropertyBlock", @@ -86,6 +87,7 @@ public class CilboxPropBasis : Cilbox "UnityEngine.Transform", "UnityEngine.Quaternion", "UnityEngine.Rigidbody", + "UnityEngine.RectTransform", "UnityEngine.RenderTexture", "UnityEngine.RenderTextureFormat", "UnityEngine.UI.*", @@ -107,6 +109,7 @@ public class CilboxPropBasis : Cilbox "UnityEngine.Vector*.y", "UnityEngine.Vector*.z", "UnityEngine.Vector*.w", + "UnityEngine.EventSystems.EventTrigger+Entry.*", // System fields "System.Array.*", @@ -118,7 +121,7 @@ public class CilboxPropBasis : Cilbox "Basis.Scripts.BasisSdk.Interactions.BasisInteractableObject.OnInteractStartEvent", "Basis.Scripts.BasisSdk.Interactions.BasisInteractableObject.OnInteractEndEvent", "Basis.BasisNetworkBehaviour.CurrentOwnerId", - "Basis.BasisNetworkBehaviour.IsOwnedLocallyOnServer", + "Basis.BasisNetworkBehaviour.IsOwnedLocally*", }; static public HashSet GetWhiteListTypes() { return whiteListType; } diff --git a/Basis/Packages/com.basis.shim/Shims/CilboxSceneBasis.cs b/Basis/Packages/com.basis.shim/Shims/CilboxSceneBasis.cs index 2dd50cf2f..0a573748b 100644 --- a/Basis/Packages/com.basis.shim/Shims/CilboxSceneBasis.cs +++ b/Basis/Packages/com.basis.shim/Shims/CilboxSceneBasis.cs @@ -88,11 +88,7 @@ public class CilboxSceneBasis : Cilbox "UnityEngine.DynamicGI", "UnityEngine.Events.UnityAction", "UnityEngine.Events.UnityEvent", - "UnityEngine.EventSystems.BaseEventData", - "UnityEngine.EventSystems.EventTrigger", - "UnityEngine.EventSystems.EventTrigger+Entry", - "UnityEngine.EventSystems.EventTrigger+TriggerEvent", - "UnityEngine.EventSystems.EventTriggerType", + "UnityEngine.EventSystems.*", "UnityEngine.GameObject", // Hyper restrictive. "UnityEngine.Gradient", "UnityEngine.LayerMask", @@ -107,6 +103,7 @@ public class CilboxSceneBasis : Cilbox "UnityEngine.ParticleSystem", "UnityEngine.Quaternion", "UnityEngine.Random", + "UnityEngine.RectTransform", "UnityEngine.Renderer", "UnityEngine.RenderTextureFormat", "UnityEngine.Rendering.AmbientMode", @@ -125,7 +122,7 @@ public class CilboxSceneBasis : Cilbox static HashSet whiteListFields = new HashSet(){ // Basis fields "Basis.BasisNetworkBehaviour.CurrentOwnerId", - "Basis.BasisNetworkBehaviour.IsOwnedLocallyOnServer", + "Basis.BasisNetworkBehaviour.IsOwnedLocally*", "Basis.Scripts.Networking.NetworkedAvatar.BasisNetworkPlayer.playerId", // Unity fields @@ -133,6 +130,7 @@ public class CilboxSceneBasis : Cilbox "UnityEngine.Vector*.y", "UnityEngine.Vector*.z", "UnityEngine.Vector*.w", + "UnityEngine.EventSystems.EventTrigger+Entry.*", // System fields "System.Array.*",