Пример #1
0
        public GameServer(IGameTransport transport, IMonotonicClock clock)
        {
            this.transport = transport;
            this.clock     = clock;

            MaxTollerableMalus = 3;

            clientsTable     = new Dictionary <EndPoint, GameClient>();
            gameobjectsTable = new Dictionary <uint, GameObject>();

            clientsToRemove = new List <EndPoint>();

            /* DATI DEI COMANDI:
             * Join: 0;
             * Welcome : 1, ObjType, Id, X, Y, Z;
             * Spawn   : 2, ObjType, Id, X, Y, Z;
             * Update  : 3, Id, X, Y, Z;
             * Ack     : 255, Id;
             */

            commandsTable      = new Dictionary <byte, GameCommand>();
            commandsTable[0]   = Join;
            commandsTable[3]   = Update;
            commandsTable[255] = Ack;
        }
Пример #2
0
        public GameServer(IGameTransport transport, EndPoint serverEndPoint)
        {
            this.transport = transport;

            currentEndPoint = serverEndPoint;

            data = new byte[4096];
        }
Пример #3
0
        public MvsAServer(IGameTransport transport, EndPoint serverEndPoint, int minPacketSize, int maxRoomSize, int maxRoomNumber) : base(transport, serverEndPoint)
        {
            rooms        = new List <Room>();
            usersInRooms = new Dictionary <EndPoint, int>();

            this.maxRoomSize   = maxRoomSize;
            this.maxRoomNumber = maxRoomNumber;
            this.minPacketSize = minPacketSize;
        }
 public GameServer(IGameTransport gameTransport)
 {
     transport        = gameTransport;
     clientsTable     = new Dictionary <EndPoint, GameClient>();
     commandsTable    = new Dictionary <byte, GameCommand>();
     commandsTable[0] = Add;
     commandsTable[1] = Sub;
     commandsTable[2] = Moltiplier;
     commandsTable[3] = Divider;
 }
Пример #5
0
 public GameServer(IGameTransport gameTransport, IMonotonicClock clock)
 {
     transport          = gameTransport;
     this.clock         = clock;
     clientsTable       = new Dictionary <EndPoint, GameClient>();
     gameObjectsTable   = new Dictionary <uint, GameObject>();
     commandsTable      = new Dictionary <byte, GameCommand>();
     commandsTable[0]   = Join;
     commandsTable[3]   = Update;
     commandsTable[255] = Ack;
 }
Пример #6
0
 public GameServer(IGameTransport gameTransport, IMonotonicClock clock)
 {
     this.transport   = gameTransport;
     this.clock       = clock;
     clientsTable     = new Dictionary <EndPoint, GameClient>();
     commandsTable    = new Dictionary <byte, GameCommand>();
     commandsTable[0] = ReverseString;
     commandsTable[1] = Add;
     commandsTable[2] = Subtract;
     commandsTable[3] = Multiply;
     commandsTable[4] = Divide;
 }
        public GameServer(IGameTransport transport, IMonotonicClock clock)
        {
            clientsTab     = new Dictionary <EndPoint, GameClient>();
            gameObjectsTab = new Dictionary <uint, GameObject>();
            commandsTab    = new Dictionary <byte, GameCommand>();
            commandsTab[0] = Join;
            commandsTab[3] = Update;

            commandsTab[7] = Exit;

            commandsTab[255] = Ack;

            serverClock    = clock;
            this.transport = transport;
        }
Пример #8
0
 public GameServer(IGameTransport gameTransport, IMonotonicClock clock)
 {
     Rooms                        = new List <Room>();
     transport                    = gameTransport;
     this.clock                   = clock;
     clientsTable                 = new Dictionary <EndPoint, GameClient>();
     commandsTable                = new Dictionary <byte, GameCommand>();
     gameObjectToDelete           = new Dictionary <uint, GameObject>();
     GameObject.gameObjectCounter = 0;
     commandsTable[0]             = Join;
     //welcome [1]
     //spawn[2]
     commandsTable[3] = Update;
     //commandsTable[5] = JoinRoom;
     //commandsTable[6] = SpawnAsteroids;
     //commandsTable[7] = UpdateAsteroids;
     commandsTable[8] = Ready;
     //commandsTable[9] = DestroyAsteroid;
     //commandsTable[10] = SpaceShipCollision;
     commandsTable[253] = StatusServer;
     // commandsTable[255] = Ack;
 }
Пример #9
0
        public GameServer(IGameTransport transport, IMonotonicClock clock)
        {
            serverTransport = transport;
            serverClock     = clock;

            clientsTable = new Dictionary <EndPoint, GameClient>();
            serverRooms  = new Dictionary <uint, ServerRoom>();

            commandsTable    = new Dictionary <byte, GameCommand>();
            commandsTable[0] = Join;
            // commandsTable[1] = Welcome;
            commandsTable[2] = Spawn;
            // commandsTable[3] = Update;
            commandsTable[4] = Ready;
            //commandsTable[5] = GameStart;
            //commandsTable[6] = UIStart;

            commandsTable[7] = TurnCreation;
            commandsTable[8] = SetTurnParameter;
            //commandsTable[9] = ProcessTurn;
            commandsTable[10] = EndTurn;

            commandsTable[254] = StatusServer;
        }
Пример #10
0
 public static void Init(IGameTransport gameTransport)
 {
     transport = gameTransport;
 }