private static void handleRequestBlockMessage(NetIncomingMessage _Im) { var message = new RequestBlockMessage(_Im); var timeDelay = (float)(NetTime.Now - _Im.SenderConnection.GetLocalTime(message.MessageTime)); Client var_Client = Configuration.networkManager.getClient(_Im.SenderEndPoint); //GameLibrary.Model.Map.Chunk.Chunk var_Chunk = GameLibrary.Model.Map.World.World.world.getChunkAtPosition(message.Position.X, message.Position.Y); GameLibrary.Map.Block.Block var_Block = GameLibrary.Map.World.World.world.getDimensionById(message.DimensionId).getBlockAtCoordinate(message.Position); //GameLibrary.Logger.Logger.LogDeb("Client Requested Block at X: " + message.Position.X + " Y: " + message.Position.Y); if (var_Block != null) { //Configuration.networkManager.SendMessageToClient(new UpdateChunkMessage((GameLibrary.Model.Map.Chunk.Chunk)var_Block.Parent), var_Client); Configuration.networkManager.SendMessageToClient(new UpdateBlockMessage(var_Block, message.DimensionId), var_Client); List <GameLibrary.Object.Object> var_Copy = new List <GameLibrary.Object.Object>(var_Block.Objects); foreach (AnimatedObject var_AnimatedObject in var_Copy) { Configuration.networkManager.SendMessageToClient(new UpdateObjectMessage(var_AnimatedObject), var_Client); } var_Copy = new List <GameLibrary.Object.Object>(var_Block.ObjectsPreEnviorment); foreach (AnimatedObject var_AnimatedObject in var_Copy) { Configuration.networkManager.SendMessageToClient(new UpdatePreEnvironmentObjectMessage(var_AnimatedObject), var_Client); } } else { GameLibrary.Logger.Logger.LogErr("ServerIGameMessageManager->handleRequestBlockMessage(...): Block an Position X: " + message.Position.X + " Y: " + message.Position.Y + " existiert nicht!"); } }
private static void handleUpdateBlockMessage(NetIncomingMessage _Im) { var message = new UpdateBlockMessage(_Im); GameLibrary.Map.Block.Block var_Block = message.Block; if (var_Block != null) { if (var_Block.IsRequested) { } var_Block.IsRequested = false; } var timeDelay = (float)(NetTime.Now - _Im.SenderConnection.GetLocalTime(message.MessageTime)); }