コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            CommandsFactory.CreateCommandsFile(@"commands.json");

            CommandGroups = new List <ConfigurationGroup>
            {
                new ConfigurationGroup
                {
                    DisplayName = "Basic Config",
                    CommandKeys = new List <string>
                    {
                        "ChangeHostname",
                        "ChangeInterface"
                    }
                },
                new ConfigurationGroup
                {
                    DisplayName = "EIGRP"
                },
            };

            // Load in XAML
        }
コード例 #2
0
        public InitialMatchState(IAnarkanoidGame arkanoidGame, IKeysConfiguration keysConfiguration) : base(arkanoidGame, keysConfiguration)
        {
            //Components.SpaceShip.Reset();
            //Components.Ball.Reset();

            //BORRAR PREMIOS
            AnarkanoidGame.ComponentManager.RemovePrizes();

            _timer          = new Timer(Configuration.BallInitialHookedMiliseconds);
            _timer.Elapsed += (sender, e) =>
            {
                foreach (IBall currentBall in Components.Balls)
                {
                    currentBall.Unhook();
                }
                _timer.Stop();
                _timer.Dispose();
            };
            _timer.Start();

            CommandPerKey.Add(Keys.Left, CommandsFactory.GetMoveSpaceShipToLeftCommand());
            CommandPerKey.Add(Keys.Right, CommandsFactory.GetMoveSpaceShipToRightCommand());
            CommandPerKey.Add(Keys.Shoot, CommandsFactory.GetUnhookBallCommand());
        }
コード例 #3
0
 // constructor
 public MainWindowViewModel()
 {
     ShowDamageTakenCommand = CommandsFactory.CreateShowDamageTakenCommand(this);
 }
コード例 #4
0
        public IntroGameState(IAnarkanoidGame anarkanoidGame, IKeysConfiguration keys) : base(anarkanoidGame, keys)
        {
            KeyDelay      = KEY_DELAY;
            TOTAL_OPTIONS = OPTIONS_TEXTS.Length;
            AnarkanoidGame.CurrentStage = 0;

            var backgroundSize = new Size(
                AnarkanoidGame.ComponentManager.Configuration.ScreenSize.Width,
                AnarkanoidGame.ComponentManager.Configuration.ScreenSize.Height
                );

            _background = new CustomElement(AnarkanoidGame.ComponentManager.Configuration, backgroundSize)
            {
                Scale = new Vector2(BACKGROUND_SCALE, BACKGROUND_SCALE)
            };
            AnarkanoidGame.ComponentManager.AddComponentByAssetName(_background, "Title");

            var spaceInvaderSize = new Size(
                AnarkanoidGame.ComponentManager.Configuration.ScreenSize.Width / SPACE_INVADER_PERCENT_SCALE,
                AnarkanoidGame.ComponentManager.Configuration.ScreenSize.Height / SPACE_INVADER_PERCENT_SCALE
                );

            _spaceInvader = new CustomElement(AnarkanoidGame.ComponentManager.Configuration, spaceInvaderSize)
            {
                Position = SPACE_INVADER_POSITION
            };
            AnarkanoidGame.ComponentManager.AddComponentByAssetName(_spaceInvader, "SpaceInvader");

            var subtitle = new ShowText(AnarkanoidGame.ComponentManager.Configuration, OPTION_TEXT_SIZE)
            {
                Position    = SUBTITLE_POSITION,
                SpriteColor = Color.Red,
                Scale       = new Vector2(1.5f, 1.5f)
            };

            AnarkanoidGame.ComponentManager.AddText(subtitle, SUBTITLE_TEXT);

            //SUBTITLE_TEXT

            var textTopPosition = FIRST_OPTION_TEXT_POSITION.Y;

            _optionsText = new List <ShowText>();
            foreach (string optionText in OPTIONS_TEXTS)
            {
                var text = new ShowText(AnarkanoidGame.ComponentManager.Configuration, OPTION_TEXT_SIZE)
                {
                    Position    = new Vector2(FIRST_OPTION_TEXT_POSITION.X, textTopPosition),
                    SpriteColor = Color.Black
                };
                AnarkanoidGame.ComponentManager.AddText(text, optionText);
                _optionsText.Add(text);
                textTopPosition += text.Size.Height;
            }

            ACTIONS = new System.Action[]
            {
                NewGameSelected, ConfigureControlsSelected, ToggleFullScreenSelected, ExitGameSelected
            };

            AnarkanoidGame.ComponentManager.SpaceShip.Scale    = new Vector2(.8f, .8f);
            AnarkanoidGame.ComponentManager.SpaceShip.Position = new Vector2(
                _optionsText[0].Position.X - AnarkanoidGame.ComponentManager.SpaceShip.Size.Width,
                _optionsText[0].Position.Y + 10
                );
            AnarkanoidGame.ComponentManager.AddSpaceShip(AnarkanoidGame.ComponentManager.SpaceShip);

            CommandsFactory.GetDelayedActionCommand(ToggleSpceInvaderPosition, 1000).Execute();

            CommandPerKey.Add(Keys.Up, CommandsFactory.GetActionCommand(MoveUpOption));
            CommandPerKey.Add(Keys.Down, CommandsFactory.GetActionCommand(MoveDownOption));
            CommandPerKey.Add(Microsoft.Xna.Framework.Input.Keys.Enter, CommandsFactory.GetActionCommand(EnterPressed));

            _returnState = this;

            AnarkanoidGame.ComponentManager.PlaySound("Anarky");
        }
コード例 #5
0
        public CommandProcessor(CommandsFactory commandsFactory)
        {
            Guard.WhenArgument(commandsFactory, "CommandProcessor commandsFactory").IsNull().Throw();

            this.commandsFactory = commandsFactory;
        }
コード例 #6
0
 public CommandProcessor(CommandsFactory commandFactory)
 {
     this.commandFactory = commandFactory;
 }
コード例 #7
0
 public CommandParser(CommandsFactory factory)
 {
     this.factory = factory;
 }
コード例 #8
0
 public Engine(CommandsFactory factory)
 {
     this.factory = factory;
 }
コード例 #9
0
 public CommandProcessor(CommandsFactory factory)
 {
     this.factory = factory;
 }