public ULocalConnectionToClient(LocalClient localClient) : base("localClient") { this.localClient = localClient; // local player always has connectionId == 0 connectionId = 0; }
public static NetworkClient ConnectLocalServer() { LocalClient newClient = new LocalClient(); NetworkServer.ActivateLocalClientScene(); newClient.InternalConnectLocalServer(true); return newClient; }
// called by LocalClient to add itself. dont call directly. internal static int AddLocalClient(LocalClient localClient) { if (s_LocalConnection != null) { Debug.LogError("Local Connection already exists"); return(-1); } s_LocalConnection = new ULocalConnectionToClient(localClient); s_LocalConnection.connectionId = 0; AddConnection(s_LocalConnection); s_LocalConnection.InvokeHandlerNoData((short)MsgType.Connect); return(0); }
// called by LocalClient to add itself. dont call directly. internal static int AddLocalClient(LocalClient localClient) { if (s_LocalConnection != null) { Debug.LogError("Local Connection already exists"); return(-1); } s_LocalConnection = new ULocalConnectionToClient(localClient) { connectionId = 0 }; OnConnected(s_LocalConnection); return(0); }
/// <summary> /// This shuts down the server and disconnects all clients. /// </summary> public void Disconnect() { if (LocalClient != null) { OnStopHost.Invoke(); LocalClient.Disconnect(); } foreach (INetworkConnection conn in connections) { conn.Disconnect(); } if (transport != null) { transport.Disconnect(); } }
/// <summary> /// This shuts down the server and disconnects all clients. /// </summary> public void Disconnect() { if (LocalClient != null) { OnStopHost.Invoke(); LocalClient.Disconnect(); } // make a copy, during disconnect, it is possible that connections // are modified, so it throws // System.InvalidOperationException : Collection was modified; enumeration operation may not execute. var connectionscopy = new HashSet <INetworkConnection>(connections); foreach (INetworkConnection conn in connectionscopy) { conn.Disconnect(); } if (Transport != null) { Transport.Disconnect(); } }
public ULocalConnectionToClient(LocalClient localClient) : base("localClient") { this.localClient = localClient; }
public ULocalConnectionToClient(LocalClient localClient) { address = "localClient"; m_LocalClient = localClient; }