private StateContainer(NetServer peer, GameState game, PlayerLookup players, IGameView view, PlayerConnectionLookup connections) : base(peer, game, players, view) { this.connections = connections; }
public ServerContinuousSynchronizer(GameState game, NetServer server, PlayerConnectionLookup connections) : base(game) { this.server = server; this.connections = connections; this.timeToNextObjectUpdate = TimeSpan.One; this.timeToNextEcoUpdate = TimeSpan.One; }
protected UnifiedRequestCommand(RequestType requestType, CommandType commandType, PlayerConnectionLookup connectionLookup, NetConnection connection, GameState game) { this.requestType = requestType; this.commandType = commandType; this.game = game; this.requester = game.Players[connectionLookup[connection]]; }
public RequestImplementation(PlayerConnectionLookup connectionLookup, NetConnection connection, NetBuffer buffer, GameState game) : base(RequestType.ShootDebugParticleFromPlanet, game, connectionLookup, connection) { var p = buffer.Read <RequestParameters>(); this.body = game.Bodies[p.BodyId]; this.direction = p.Direction; }
public BuildGameHandler(NetServer server, PlayerLookup players, PlayerConnectionLookup connections, Id <Player> ownID) : base(server, players, ownID, new ServerBehaviourProvider(server, connections)) { this.stateBuilder = new StateContainer.Builder { Server = server, Players = players, Connections = connections, }; var generator = new SimpleGenerator(); var instructions = generator.Generate(players.Select(p => p.ID).ToList()); // instructions may want to be spaced out in time in the future, // to prevent packet loss, and thus longer building time foreach (var instruction in instructions) { // build own game this.executeInstruction(instruction); if (connections.Count > 0) { // instruct clients how to build game var message = server.CreateMessage(); instruction.WriteMessage(message); server.SendMessage(message, connections, NetDeliveryMethod.ReliableOrdered, 0); } } // send finish message and finish this.finish(this.stateBuilder); if (connections.Count > 0) { var finishMessage = server.CreateMessage(); finishMessage.Write((byte)GenerationMessageType.FinishGenerating); server.SendMessage(finishMessage, connections, NetDeliveryMethod.ReliableOrdered, 0); } }
public ServerCommandSender(NetServer server, PlayerConnectionLookup connections) { this.server = server; this.connections = connections; }
protected BaseRequest(RequestType type, GameState game, PlayerConnectionLookup connectionLookup, NetConnection connection) { this.type = type; this.game = game; this.requester = game.Players[connectionLookup[connection]]; }
public Implementation(PlayerConnectionLookup connectionLookup, NetConnection connection, NetBuffer buffer, GameState game) : base(RequestType.EconomyValueInvestmentChanged, CommandType.EconomyValueInvestmentChanged, connectionLookup, connection, game) { this.p = buffer.Read <Parameters>(); }
public static IRequest Request(GameState game, PlayerConnectionLookup connectionLookup, NetConnection connection, NetBuffer buffer) { return(new Implementation(connectionLookup, connection, buffer, game)); }
public ServerBehaviourProvider(NetServer server, PlayerConnectionLookup connections) { this.server = server; this.connections = connections; this.commandSender = new ServerCommandSender(server, connections); }
public RequestReader(GameState game, PlayerConnectionLookup connections) { this.game = game; this.connections = connections; }