Skip to content

Commit

Permalink
Add client start & stop handling to Unity
Browse files Browse the repository at this point in the history
  • Loading branch information
veblush committed Dec 22, 2015
1 parent 415ec7e commit 0442dbd
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 2 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,32 @@ public override void OnStopServer()

if (_zone != null)
{
OnZoneStart(_zone);
OnZoneStop(_zone);

_zone = null;
_zoneChannelMap = null;
}
}

public override void OnStartClient(NetworkClient client)
{
Debug.Log("EntityNetworkManager.OnStartClient");
}

public override void OnStopClient()
{
Debug.Log("EntityNetworkManager.OnStopClient");

// Remove all client entity objects

var t = ClientEntityFactory.Default.RootTransform;
if (t != null)
{
for (var i = t.childCount - 1; i >= 0; i--)
Destroy(t.GetChild(i).gameObject);
}
}

public bool AddClientToZone(int clientId, EntityNetworkClient networkClient)
{
var channelDown = new ProtobufChannelToClientZoneOutbound()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,32 @@ public override void OnStopServer()

if (_zone != null)
{
OnZoneStart(_zone);
OnZoneStop(_zone);

_zone = null;
_zoneChannelMap = null;
}
}

public override void OnStartClient(NetworkClient client)
{
Debug.Log("EntityNetworkManager.OnStartClient");
}

public override void OnStopClient()
{
Debug.Log("EntityNetworkManager.OnStopClient");

// Remove all client entity objects

var t = ClientEntityFactory.Default.RootTransform;
if (t != null)
{
for (var i = t.childCount - 1; i >= 0; i--)
Destroy(t.GetChild(i).gameObject);
}
}

public bool AddClientToZone(int clientId, EntityNetworkClient networkClient)
{
var channelDown = new ProtobufChannelToClientZoneOutbound()
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 0442dbd

Please sign in to comment.