コード例 #1
0
        protected void AddAttack(Tile Tile, SingleAttackOrder NewAttack)
        {
            AttackOrder attack = null;

            if (_AttackBuilder == null ||
                _AttackBuilder.TargetTile != Tile ||
                !_AttackBuilder.IsCompatible(NewAttack))
            {
                attack = NewAttack.GenerateNewAttackOrder();
            }
            else
            {
                attack = _AttackBuilder;
            }
            var r = attack.AddAttacker(NewAttack);

            if (r == OrderInvalidReason.NONE)
            {
                if (attack != _AttackBuilder)
                {
                    _AttackBuilder = attack;
                    var attackPane = new AttackPane(_AttackBuilder);
                    attackPane.OnClose = CloseWindow;
                    attackPane.OnAttackTargetChanged += ChangeAttackTarget;
                    attackPane.OnExecute             += ExecuteAttack;

                    _Controller.SetPane(attackPane);
                }
            }
            else
            {
                _Controller.Alert(r);
            }
        }
コード例 #2
0
 void DescribeAttackFactorCalculation(
     SingleAttackOrder Attacker, AttackFactorCalculation AttackFactorCalculation)
 {
     _Description.Add(new Button("attack-part-box")
     {
         DisplayedString = string.Format(
             "+{0} {1}", AttackFactorCalculation.Attack, ObjectDescriber.Describe(Attacker.Attacker))
     });
     _Description.Add(new Button("attack-factor-box")
     {
         DisplayedString = string.Format(
             "{0} Base Attack Factor",
             Attacker.Attacker.Configuration.GetWeapon(Attacker.UseSecondaryWeapon).Attack)
     });
     foreach (AttackFactorCalculationFactor a in AttackFactorCalculation.Factors)
     {
         _Description.Add(new Button("attack-factor-box")
         {
             DisplayedString = ObjectDescriber.Describe(a)
         });
     }
 }
コード例 #3
0
 public OrderInvalidReason AddAttacker(SingleAttackOrder AttackOrder)
 {
     return(AddAttacker((T)AttackOrder));
 }
コード例 #4
0
 public bool IsCompatible(SingleAttackOrder AttackOrder)
 {
     return(AttackOrder.GetType() == typeof(T));
 }