Skip to content

Commit

Permalink
feat: starting NetworkObjectManager (#354)
Browse files Browse the repository at this point in the history
* change visibility to internal

* remove object from server interface

* remove object from client interface

* add client and server side of ObjectManager

* move object method out of client interface

* move object msg call to object interface

* hook connected instead of authenticated

* remove unused code

* add cleanup for client side
  • Loading branch information
uweeby committed Sep 24, 2020
1 parent 51127fe commit 01f3bb3
Show file tree
Hide file tree
Showing 7 changed files with 1,366 additions and 8 deletions.
639 changes: 639 additions & 0 deletions Assets/Mirror/Runtime/ClientObjectManager.cs

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Assets/Mirror/Runtime/ClientObjectManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 3 additions & 4 deletions Assets/Mirror/Runtime/INetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ public interface IClientObjectManager
void ClearSpawners();

void DestroyAllClientObjects();

void PrepareToSpawnSceneObjects();
}

public interface INetworkClient : IClientObjectManager
public interface INetworkClient
{
void Disconnect();

void Send<T>(T message, int channelId = Channels.DefaultReliable) where T : IMessageBase;

Task SendAsync<T>(T message, int channelId = Channels.DefaultReliable) where T : IMessageBase;

//Is this Scene or Object related?
void PrepareToSpawnSceneObjects();
}
}
6 changes: 3 additions & 3 deletions Assets/Mirror/Runtime/INetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace Mirror
{
public interface IServerObjectManager
{
void SendToClientOfPlayer<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase;

bool AddPlayerForConnection(INetworkConnection conn, GameObject player);

bool AddPlayerForConnection(INetworkConnection conn, GameObject player, Guid assetId);
Expand Down Expand Up @@ -36,7 +38,7 @@ public interface IServerSceneManager
void SetClientNotReady(INetworkConnection conn);
}

public interface INetworkServer : IServerObjectManager, IServerSceneManager
public interface INetworkServer : IServerSceneManager
{
void Disconnect();

Expand All @@ -49,7 +51,5 @@ public interface INetworkServer : IServerObjectManager, IServerSceneManager
void SendToReady<T>(NetworkIdentity identity, T msg, int channelId) where T : IMessageBase;

void SendToReady<T>(NetworkIdentity identity, T msg, bool includeOwner = true, int channelId = Channels.DefaultReliable) where T : IMessageBase;

void SendToClientOfPlayer<T>(NetworkIdentity identity, T msg, int channelId = Channels.DefaultReliable) where T : IMessageBase;
}
}
2 changes: 1 addition & 1 deletion Assets/Mirror/Runtime/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public class NetworkClient : MonoBehaviour, INetworkClient
/// <summary>
/// The host server
/// </summary>
NetworkServer hostServer;
internal NetworkServer hostServer;

/// <summary>
/// NetworkClient can connect to local server in host mode too
Expand Down

0 comments on commit 01f3bb3

Please sign in to comment.