public override void Client_ReceiveMessage(ByteStream data, LLClient client) { try { int conId = data.PopInt32(); NetUser meUser = new NetUser() { ConnectionID = conId, UserName = client.UserName, TeamNumber = client.TeamNumber }; client.NetUsers[conId] = meUser; client.MyConnectionId = conId; data = new ByteStream(); data.Encode ( (byte)NetMessageType.USER_INFO, meUser.UserName, meUser.TeamNumber ); // Send USER_INFO message client.SendNetMessage(client.ReliableChannel, data.ToArray()); // Spawn own player instance and flag it client.PlayerInstances[meUser.ConnectionID] = NetSpawner.SpawnPlayer(Vector3.zero, Quaternion.identity); client.PlayerInstances[meUser.ConnectionID].IsMine = true; // Inject the client client.PlayerInstances[meUser.ConnectionID].SetClient(client); } catch (Exception e) { Debug.LogError($"@Client -> @ConnectionAck: [{e.Message}]"); } }
public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int teamNumber = msgData.PopInt32(); string message = msgData.PopString(); client.AddMessageToQ($"Team_{teamNumber} >> {message}"); }
public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { string userName = client.UserName; string message = msgData.PopString(); client.AddMessageToQ($"{userName} >> {message}"); }
/// <summary> /// Moves the character of the clients specified by its connectionID to the position sent by the server /// </summary> /// <param name="msgData"></param> /// <param name="client"></param> public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int connectionID = msgData.PopInt32(); Vector3 pos = msgData.PopVector3(); client.clientsCharacter[connectionID].MoveTo(pos); }
public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int sender = msgData.PopInt32(); string message = msgData.PopString(); string msg = $"< <[{client.NetUsers[sender].userName}]< < {message}"; client.AddMessageToQ(msg); }
public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int connectionID = msgData.PopInt32(); NetUser netUser = client.NetUsers[client.myConnectionID]; netUser.connectionID = connectionID; client.NetUsers[client.myConnectionID] = netUser; client.myConnectionID = connectionID; }
/// <summary> /// Tells the local client to remove the specified client by its connectionID /// </summary> /// <param name="msgData"></param> /// <param name="client"></param> public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int connectionID = msgData.PopInt32(); if (client.NetUsers.ContainsKey(connectionID)) { NetCharacterController netCharacterController = client.clientsCharacter[connectionID]; Destroy(netCharacterController.gameObject); client.clientsCharacter.Remove(connectionID); client.NetUsers.Remove(connectionID); } }
public override void Client_ReceiveMessage(ByteStream data, LLClient client) { try { string msg = data.PopString(); int sender = data.PopInt32(); client.AddMessageToQueue($"<<< TEAM [{client.NetUsers[sender].UserName}] {msg}"); } catch (Exception e) { Debug.LogError($"@Client -> @ChatMulticast: [{e.Message}]"); } }
public override void Client_ReceiveMessage(ByteStream data, LLClient client) { try { // Get the destination vector and set on the right player instance int conId = data.PopInt32(); Vector3 destination = data.PopVector3(); client.PlayerInstances[conId].SetDestination(destination); } catch (Exception e) { Debug.LogError($"@Client -> @ConnectionAck: [{e.Message}]"); } }
public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int connectionID = msgData.PopInt32(); string userName = msgData.PopString(); int teamNumber = msgData.PopInt32(); var netUser = new NetUser { connectionID = connectionID, userName = userName, teamNumber = teamNumber }; client.NetUsers[connectionID] = netUser; }
public override void Client_ReceiveMessage(ByteStream data, LLClient client) { try { int conId = data.PopInt32(); if (client.NetUsers.ContainsKey(conId) == false) { Debug.LogError("@Client -> @UserDisconnected: Trying to remove an Id that didn't exist"); return; } client.NetUsers.Remove(conId); NetPlayer pInstance = client.PlayerInstances[conId]; client.PlayerInstances.Remove(conId); Destroy(pInstance.gameObject); } catch (Exception e) { Debug.LogError($"@Client -> @UserDisconnected: [{e.Message}]"); } }
public override void Client_ReceiveMessage(ByteStream data, LLClient client) { try { int conId = data.PopInt32(); string userName = data.PopString(); int teamNum = data.PopInt32(); var newUser = new NetUser() { ConnectionID = conId, UserName = userName, TeamNumber = teamNum }; client.NetUsers[conId] = newUser; client.PlayerInstances[conId] = NetSpawner.SpawnPlayer(Vector3.zero, Quaternion.identity); } catch (Exception e) { Debug.LogError($"@Client -> @OnUserInfo: [{e.Message}]"); } }
public override void Client_ReceiveMessage(ByteStream data, LLClient client) { try { int conId = data.PopInt32(); string userName = data.PopString(); int teamNum = data.PopInt32(); Vector3 pos = data.PopVector3(); Quaternion rot = data.PopQuaternion(); var newUser = new NetUser() { ConnectionID = conId, UserName = userName, TeamNumber = teamNum }; client.NetUsers[newUser.ConnectionID] = newUser; client.PlayerInstances[newUser.ConnectionID] = NetSpawner.SpawnPlayer(pos, rot); } catch (Exception e) { Debug.LogError($"@Client -> @OnUserInfo_SpawnPosition: [{e.Message}]"); } }
public abstract void Client_ReceiveMessage(ByteStream msgData, LLClient client);
/// <summary> /// Tells the local client to spawn a character for the connection ID sent form the server /// </summary> /// <param name="msgData"></param> /// <param name="client"></param> public override void Client_ReceiveMessage(ByteStream msgData, LLClient client) { int connectionID = msgData.PopInt32(); client.SpawnClientCharacter(connectionID); }
public void SetClient(LLClient client) { _client = client; }