Пример #1
0
        public async Task <bool> IsSatisfiedByAsync(TEntity entity, Execute execute)
        {
            var result = true;

            if (!Condition(entity))
            {
                return(result);
            }

            var executeInternal1 = new Execute();
            var executeInternal2 = new Execute();

            var result1 = await Spec1.IsSatisfiedByAsync(entity, executeInternal1);

            var result2 = await Spec2.IsSatisfiedByAsync(entity, executeInternal2);

            result = result1 || result2;

            if (!result && execute != null)
            {
                execute.AddMessage(executeInternal1);
                execute.AddMessage(executeInternal2);
            }

            return(result);
        }
Пример #2
0
        public void Where_Does_Not_Match_Inherited_Spec()
        {
            var spec = new Spec2();

            Assert.IsTrue(R.Where(spec, new { Y = 6 }));
            Assert.IsFalse(R.Where(spec, new { X = 5 }));
        }
Пример #3
0
        private void RbSpecChanged(object sender, EventArgs e)
        {
            Spec1.Enabled = RBSpec1.Checked;
            Spec2.Enabled = RBSpec2.Checked;
            Spec3.Enabled = RBSpec3.Checked;

            if (!Spec1.Enabled)
            {
                for (int i = 0; i < Spec1.Items.Count; i++)
                {
                    Spec1.SetItemChecked(i, false);
                }
            }

            if (!Spec2.Enabled)
            {
                for (int i = 0; i < Spec2.Items.Count; i++)
                {
                    Spec2.SetItemChecked(i, false);
                }
            }

            if (!Spec3.Enabled)
            {
                for (int i = 0; i < Spec3.Items.Count; i++)
                {
                    Spec3.SetItemChecked(i, false);
                }
            }
        }
Пример #4
0
 public bool Is(T candidate)
 {
     return(Spec1.IsSatisfiedBy(candidate) || Spec2.IsSatisfiedBy(candidate));
 }
Пример #5
0
 public new bool IsSatisfiedBy(T candidate)
 {
     return(Spec1.IsSatisfiedBy(candidate) && Spec2.IsSatisfiedBy(candidate));
 }
 public new bool IsSatisfiedBy(TEntity candidate)
 {
     return(Spec1.IsSatisfiedBy(candidate) || Spec2.IsSatisfiedBy(candidate));
 }
Пример #7
0
        private void BtnCreateClick(object sender, EventArgs e)
        {
            if (File.Exists(PVEBehaviorCombat.OurDirectory + "\\Behaviors\\" + TBName.Text + ".xml"))
            {
                DialogResult result = MessageBoxEx.Show("Behavior exist - overwrite?", "Behavior exist - overwrite?",
                                                        MessageBoxButtons.OKCancel);
                switch (result)
                {
                case DialogResult.Cancel:
                    return;
                }
            }
            var controller = new BehaviorController
            {
                SendPet           = false,
                UseAutoAttack     = true,
                PullDistance      = 9,
                PrePullDistance   = 30,
                CombatDistance    = 3,
                GlobalCooldown    = BeGlobalCooldown.Value,
                Name              = TBName.Text,
                BuffController    = new RuleController(),
                PrePullController = new RuleController(),
                PullController    = new RuleController(),
                RestController    = new RuleController(),
                CombatController  = new RuleController()
            };

            for (int i = 0; i < Normal.Items.Count; i++)
            {
                if (Normal.GetItemChecked(i))
                {
                    var addToBehavior = (AddToBehavior)Normal.Items[i];
                    AddToController(addToBehavior, controller);
                }
            }
            for (int i = 0; i < Spec1.Items.Count; i++)
            {
                if (Spec1.GetItemChecked(i))
                {
                    var addToBehavior = (AddToBehavior)Spec1.Items[i];
                    AddToController(addToBehavior, controller);
                }
            }
            for (int i = 0; i < Spec2.Items.Count; i++)
            {
                if (Spec2.GetItemChecked(i))
                {
                    var addToBehavior = (AddToBehavior)Spec2.Items[i];
                    AddToController(addToBehavior, controller);
                }
            }
            for (int i = 0; i < Spec3.Items.Count; i++)
            {
                if (Spec3.GetItemChecked(i))
                {
                    var addToBehavior = (AddToBehavior)Spec3.Items[i];
                    AddToController(addToBehavior, controller);
                }
            }
            AddToController((AddToBehavior)CBSelectSpecial.SelectedItem, controller);
            AddToController((AddToBehavior)CBSelectSpecial2.SelectedItem, controller);
            AddToController((AddToBehavior)CBSelectSpecial3.SelectedItem, controller);
            controller.Save();
            PveBehaviorSettings.LoadedBeharvior = TBName.Text;
            PveBehaviorSettings.SaveSettings();
            MessageBoxEx.Show("Created behavior, re-open the behavior settings window to load it");
        }