/// <summary> /// Bearbeitet falls ein Client Connected /// </summary> public static void OnClientConnectToServer(IPEndPoint _IPEndPoint) { //GameLibrary.Connection.Event.EventList.Add(new GameLibrary.Connection.Event(new UpdateChunkMessage(GameLibrary.Model.Map.World.World.world.getRegion(0).getChunk(0)), GameLibrary.Connection.GameMessageImportance.VeryImportant)); Client var_Client = new Client(_IPEndPoint); Configuration.networkManager.addClient(var_Client); //ServerNetworkManager.serverNetworkManager.SendMessageToClient(new UpdateRegionMessage(GameLibrary.Model.Map.World.World.world.getRegion(0)), var_Client); }
public override void SendMessageToClient(IGameMessage _IGameMessage, Client _Client) { NetOutgoingMessage om = netServer.CreateMessage(); om.Write((byte)_IGameMessage.MessageType); _IGameMessage.Encode(om); foreach (NetConnection connection in this.netServer.Connections) { if (connection.RemoteEndPoint == _Client.IPEndPoint) { this.netServer.SendMessage(om, connection, NetDeliveryMethod.ReliableOrdered); // ReliableUnordered // Unreliable break; } } }
public virtual void SendMessageToClient(IGameMessage _IGameMessage, Client _Client) { }
public void addClient(Client _Client) { serverClients.Add(_Client); }
public void removeClient(Client _Client) { serverClients.Remove(_Client); }