Beispiel #1
0
        public ICommand FromBuffer(NetIncomingMessage message)
        {
            var type = (CommandType)message.ReadByte();

            switch (type)
            {
            case CommandType.ShootDebugParticleFromPlanet:
                return(ShootDebugParticleFromPlanet.Command(this.game, message));

            case CommandType.ParticlePlanetCollision:
                return(ParticlePlanetCollision.Command(this.game, message));

            case CommandType.ParticleUpdate:
                return(ParticleUpdate.Command(this.game, message));

            case CommandType.ShootProjectileFromPlanet:
                return(ShootProjectileFromPlanet.Command(this.game, message));

            case CommandType.EconomyUpdate:
                return(EconomyUpdate.Command(this.game, message));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #2
0
        public IRequest FromBuffer(NetIncomingMessage message)
        {
            var connection = message.SenderConnection;
            var type       = (RequestType)message.ReadByte();

            switch (type)
            {
            case RequestType.ShootDebugParticleFromPlanet:
                return(ShootDebugParticleFromPlanet.Request(this.game,
                                                            this.connections, connection, message));

            case RequestType.ShootProjectileFromPlanet:
                return(ShootProjectileFromPlanet.Request(this.game,
                                                         this.connections, connection, message));

            case RequestType.EconomyValueInvestmentChanged:
                return(EconomyValueInvestmentChanged.Request(this.game,
                                                             this.connections, connection, message));

            default:
                throw new ArgumentOutOfRangeException();
            }
        }