Пример #1
0
        public static void Activate(ActionTypes.ActionType actionType, BattleEngine battleEngine)
        {
            Character currentCharacter = battleEngine.Characters[TurnSystem.CurrentCharIndex];

            ActionGrid.Children.Clear();

            List <Action> actions = currentCharacter.CharacterStats.Actions
                                    .Where(action => action.ActionType == actionType).ToList();
            List <AnimatedButtonController> animatedButtonControllers = new List <AnimatedButtonController>();

            ActionGrid.Width = actions.Count * 40;
            int left = 0;

            actions.ForEach(action =>
            {
                AnimatedButton animatedButton = new AnimatedButton
                {
                    Width = 40,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    Margin       = new Thickness(left, 0, 0, 0),
                    Button       = { Width = 40 },
                    Action       = action,
                    BattleEngine = battleEngine
                };
                animatedButton.Button.PreviewMouseDown += InitiateFight;
                animatedButtonControllers.Add(new AnimatedButtonController(action.Icon, animatedButton,
                                                                           action.ActionType, battleEngine));
                ActionGrid.Children.Add(animatedButton);
                left += 40;
            });
        }
 public AnimatedButtonController(ButtonStatesImages buttonStatesImages, AnimatedButton animatedButton, ActionTypes.ActionType actionType, BattleEngine battleEngine)
 {
     this.ButtonStatesImages   = buttonStatesImages;
     this.AnimatedButton       = animatedButton;
     this.ActionType           = actionType;
     AnimatedButton.ActionType = actionType;
     this.BattleEngine         = battleEngine;
     SetImageSourcesForAnimatedButton();
 }
Пример #3
0
 public Action(ButtonStatesImages actionIcons, string actionEffect, int damage, int apCost, int mpCost,
               ActionTypes.ActionType actionType)
 {
     Icon       = actionIcons;
     Effect     = actionEffect;
     Damage     = damage;
     ApCost     = apCost;
     MpCost     = mpCost;
     ActionType = actionType;
 }
Пример #4
0
 private void Button_MouseDown(object sender, System.Windows.Input.MouseEventArgs e)
 {
     ActionTypes.ActionType actionType = AnimatedButtonController.ActionType;
     ActionGridController.Activate(actionType, AnimatedButtonController.BattleEngine);
 }
Пример #5
0
        //private void ScrollBar_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        //{

        //}


        //public int SelectedCharacterIndex;

        //private void SelectChar(object sender, MouseButtonEventArgs e)
        //{


        //    Rectangle senderImage = sender as Rectangle;
        //    SelectChar((sender as Rectangle).Name,true);
        //    int enemy = (senderImage.Name.Contains("e") ? 1 : 0);

        //    SelectedCharacterIndex = senderImage.Name.Last() - '1' + enemy * 3;
        //}

        private void ShowAvailableActions(object sender, MouseEventArgs e)
        {
            System.Windows.Controls.Button button = sender as System.Windows.Controls.Button;
            ActionTypes.ActionType         action = (ActionTypes.ActionType)Enum.Parse(typeof(ActionTypes.ActionType), button.Name);
            //GenerateActionButtons(_currentBattleEngine.Characters[TurnSystem.CurrentCharIndex].CharacterStats, action);
        }