コード例 #1
0
ファイル: CommandReader.cs プロジェクト: tdav/syzygy
        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();
            }
        }
コード例 #2
0
ファイル: RequestReader.cs プロジェクト: tdav/syzygy
        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();
            }
        }