Merge branch 'master' of github.com:Saltosion/Cyber
This commit is contained in:
commit
1231201390
@ -1,4 +1,5 @@
|
||||
using Cyber.Entities.SyncBases;
|
||||
using UnityEngine.Networking;
|
||||
|
||||
namespace Cyber.Networking.Serverside {
|
||||
|
||||
@ -11,7 +12,7 @@ namespace Cyber.Networking.Serverside {
|
||||
/// <summary>
|
||||
/// The player's connection ID.
|
||||
/// </summary>
|
||||
public readonly int ConnectionID;
|
||||
public readonly NetworkConnection Connection;
|
||||
|
||||
/// <summary>
|
||||
/// The player's controlled character
|
||||
@ -19,11 +20,11 @@ namespace Cyber.Networking.Serverside {
|
||||
public Character Character;
|
||||
|
||||
/// <summary>
|
||||
/// Create a connected player and give it a connection ID;
|
||||
/// Create a connected player and give it a connection;
|
||||
/// </summary>
|
||||
/// <param name="connectionID">The player's connection ID</param>
|
||||
public SConnectedPlayer(int connectionID) {
|
||||
ConnectionID = connectionID;
|
||||
/// <param name="connectionID">The player's connection</param>
|
||||
public SConnectedPlayer(NetworkConnection connectionID) {
|
||||
Connection = connectionID;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -194,11 +194,11 @@ namespace Cyber.Networking.Serverside {
|
||||
Controlled.Move(MoveCreature.Direction);
|
||||
|
||||
foreach (var Player in Players) {
|
||||
if (Player.Value.ConnectionID == msg.conn.connectionId) {
|
||||
if (Player.Value.Connection.connectionId == msg.conn.connectionId) {
|
||||
continue;
|
||||
}
|
||||
MoveCreature.Timestamp = NetworkHelper.GetCurrentSystemTime();
|
||||
NetworkServer.SendToClient(Player.Value.ConnectionID, PktType.MoveCreature, MoveCreature);
|
||||
NetworkServer.SendToClient(Player.Value.Connection.connectionId, PktType.MoveCreature, MoveCreature);
|
||||
}
|
||||
break;
|
||||
case PktType.Interact:
|
||||
@ -251,15 +251,15 @@ namespace Cyber.Networking.Serverside {
|
||||
int[] IdList = new int[Players.Count];
|
||||
int TempCounter = 0;
|
||||
foreach (SConnectedPlayer P in Players.Values) {
|
||||
IdList[TempCounter++] = P.ConnectionID;
|
||||
NetworkServer.SendToClient(P.ConnectionID, PktType.Identity, new IdentityPkt(Id, false));
|
||||
IdList[TempCounter++] = P.Connection.connectionId;
|
||||
NetworkServer.SendToClient(P.Connection.connectionId, PktType.Identity, new IdentityPkt(Id, false));
|
||||
}
|
||||
|
||||
// Then send the client a list of all other clients
|
||||
NetworkServer.SendToClient(Id, PktType.MassIdentity, new IntListPkt(IdList));
|
||||
|
||||
// Add the player to the list
|
||||
SConnectedPlayer Player = new SConnectedPlayer(msg.conn.connectionId);
|
||||
SConnectedPlayer Player = new SConnectedPlayer(msg.conn);
|
||||
Players.Add(Id, Player);
|
||||
|
||||
// Send the previously collected list to the player
|
||||
|
Loading…
Reference in New Issue
Block a user