예제 #1
0
        public int BtnAddDog_Click(ComboBox comboBoxDogs, Label labelNotification, List <Image> dogImages)
        {
            ICommand newDogCommand = _commandInvoker.GetCommand(ActionCommandEnum.NewDogToRacetrack);
            var      notification  = newDogCommand.Execute(dogImages);

            if (notification.Items < 2)
            {
                labelNotification.Content    = notification.Description + "\nMin number of dogs for a race is 2";
                labelNotification.Foreground = NotificationColors.GetBrushColor(notification.Code);
            }
            else if (notification.Items >= 2)
            {
                labelNotification.Content    = notification.Description;
                labelNotification.Foreground = NotificationColors.GetBrushColor(notification.Code);
            }
            var allDogsNames = _racetrack.GetAllDogsInRacetrack().Select(a => a.Name).ToList();

            comboBoxDogs.ItemsSource = allDogsNames;
            return(notification.Items);
        }
예제 #2
0
        public KeyboardActionProcessorModel SelectCommandKey(KeyEventArgs e, IPlayer player, List <Image> weaponImages, List <Image> potionImages)
        {
            KeyboardActionProcessorModel KeyboardActionProcessor = null;

            if (e.Key == Key.Space)
            {
                // WEAPON Strike
                var selectedCommand = _commandInvoker.GetCommand(Enums.CommandsEnum.Key_StrikeEnemy);
                KeyboardActionProcessor = selectedCommand.Execute(e, player, weaponImages, potionImages);
                return(KeyboardActionProcessor);
            }
            if (e.Key == Key.LeftShift)
            {
                // ITEM Pickup
                var selectedCommand = _commandInvoker.GetCommand(Enums.CommandsEnum.Key_PickupItem);
                KeyboardActionProcessor = selectedCommand.Execute(e, player, weaponImages, potionImages);
                return(KeyboardActionProcessor);
            }
            if (e.Key == Key.LeftCtrl)
            {
                // ITEM Drop
                var selectedCommand = _commandInvoker.GetCommand(Enums.CommandsEnum.Key_DropItem);
                KeyboardActionProcessor = selectedCommand.Execute(e, player, weaponImages, potionImages);
                //NO MORE code required
                return(null);
            }
            if (e.Key == Key.Up || e.Key == Key.Down || e.Key == Key.Left || e.Key == Key.Right)
            {
                if (e.Key == Key.Left || e.Key == Key.Right)
                {
                    player.ShootingDirection_Player = e.Key;
                }

                //MOVEMENT Arrow Keys
                var selectedCommand = _commandInvoker.GetCommand(Enums.CommandsEnum.ArrowKeys_Movement);
                KeyboardActionProcessor = selectedCommand.Execute(e);
                return(KeyboardActionProcessor);
            }
            return(null);
        }