コード例 #1
0
ファイル: Or.cs プロジェクト: marviobezerra/XCommon
        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
        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);
                }
            }
        }
コード例 #3
0
ファイル: ASpec.cs プロジェクト: ASbeletsky/NSpecifications
 public bool Is(T candidate)
 {
     return(Spec1.IsSatisfiedBy(candidate) || Spec2.IsSatisfiedBy(candidate));
 }
コード例 #4
0
ファイル: ASpec.cs プロジェクト: ASbeletsky/NSpecifications
 public new bool IsSatisfiedBy(T candidate)
 {
     return(Spec1.IsSatisfiedBy(candidate) && Spec2.IsSatisfiedBy(candidate));
 }
コード例 #5
0
 public new bool IsSatisfiedBy(TEntity candidate)
 {
     return(Spec1.IsSatisfiedBy(candidate) || Spec2.IsSatisfiedBy(candidate));
 }
コード例 #6
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");
        }