示例#1
0
        public XleGameControl(
            IXleScreen screen,
            IStatsDisplay statsDisplay,
            IXleWaiter waiter,
            IXleInput input,
            ISoundMan soundMan,
            ITextArea textArea,
            GameState gameState,
            XleSystemState systemState)
        {
            this.screen       = screen;
            this.statsDisplay = statsDisplay;
            this.waiter       = waiter;
            this.input        = input;
            this.soundMan     = soundMan;
            this.textArea     = textArea;
            this.gameState    = gameState;
            this.systemState  = systemState;

            soundMan.ErrorMessage += message =>
            {
                textArea.PrintLine();
                textArea.PrintLine(message);
            };

            textArea.Waiter += WaitAsync;
        }
示例#2
0
        public GamePlayScene(GraphicsDevice device,
                             IXleScreen screen,
                             IXleRunner gameRunner,
                             IXleInput xleInput,
                             IRectangleRenderer rects,
                             ICommandExecutor commandExecutor,
                             XleSystemState systemState,
                             XleRenderer renderer,
                             GameState gameState)
            : base(device, 680, 440)
        {
            this.device          = device;
            this.screen          = screen;
            this.gameRunner      = gameRunner;
            this.xleInput        = xleInput;
            this.rects           = rects;
            this.commandExecutor = commandExecutor;
            this.systemState     = systemState;
            this.renderer        = renderer;
            this.gameState       = gameState;

            this.spriteBatch = new SpriteBatch(device);

            keyboard = new KeyboardEvents();

            keyboard.KeyPress += (_, e) => xleInput.OnKeyPress(e);
            keyboard.KeyDown  += (_, e) => xleInput.OnKeyDown(e.Key);
            keyboard.KeyUp    += (_, e) => xleInput.OnKeyUp(e.Key);
        }
示例#3
0
        public CommandExecutor(
            GameState state,
            ICommandList commands,
            IXleGameControl gameControl,
            IXleInput input,
            ISoundMan soundMan,
            IPlayerDeathHandler deathHandler,
            IPlayerAnimator characterAnimator,
            ITextArea textArea)
        {
            gameState           = state;
            this.commands       = commands;
            this.gameControl    = gameControl;
            this.input          = input;
            this.textArea       = textArea;
            this.soundMan       = soundMan;
            this.playerAnimator = characterAnimator;
            this.deathHandler   = deathHandler;

            input.DoCommand += (sender, args) =>
            {
                DoCommand(args.Command, args.KeyString);
            };

            mDirectionMap[Keys.Right] = Direction.East;
            mDirectionMap[Keys.Up]    = Direction.North;
            mDirectionMap[Keys.Left]  = Direction.West;
            mDirectionMap[Keys.Down]  = Direction.South;

            mDirectionMap[Keys.OemOpenBrackets] = Direction.North;
            mDirectionMap[Keys.OemSemicolon]    = Direction.West;
            mDirectionMap[Keys.OemQuotes]       = Direction.East;
            mDirectionMap[Keys.OemQuestion]     = Direction.South;
        }
示例#4
0
 public XleRunner(
     XleSystemState systemState,
     ITextArea textArea,
     IXleInput input,
     ICommandExecutor commandExecutor,
     IMapLoader mapLoader,
     IMapChanger mapChanger,
     IXleGameFactory gameFactory,
     GameState gameState)
 {
     this.systemState     = systemState;
     this.textArea        = textArea;
     this.input           = input;
     this.commandExecutor = commandExecutor;
     this.mapLoader       = mapLoader;
     this.mapChanger      = mapChanger;
     this.gameFactory     = gameFactory;
     this.gameState       = gameState;
 }