当前位置: 首页>>代码示例>>C#>>正文


C# CanRunDecoratorDelegate类代码示例

本文整理汇总了C#中CanRunDecoratorDelegate的典型用法代码示例。如果您正苦于以下问题:C# CanRunDecoratorDelegate类的具体用法?C# CanRunDecoratorDelegate怎么用?C# CanRunDecoratorDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CanRunDecoratorDelegate类属于命名空间,在下文中一共展示了CanRunDecoratorDelegate类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DecoratorIfElse

 public DecoratorIfElse(CanRunDecoratorDelegate runFunc, params Composite []children)
     : base(children)
 {
     Debug.Assert(runFunc != null);
     Debug.Assert(children.Count() == 2);
     Runner = runFunc;
 }
开发者ID:aash,项目名称:Singular,代码行数:7,代码来源:Throttle.cs

示例2: CastFocus

 public static Composite CastFocus(int spell, CanRunDecoratorDelegate condition)
 {
     return new Decorator(
         ret =>
         condition(ret) && SpellManager.CanCast(spell, Helpers.Focus) && SpellManager.Cast(spell, Helpers.Focus),
         new SpellLog(spell, Helpers.Focus));
 }
开发者ID:LaoArchAngel,项目名称:RogueAssassin,代码行数:7,代码来源:Spells.cs

示例3: Cast

        public static Composite Cast(int spellId, CanRunDecoratorDelegate cond, WoWUnitDelegate target)
        {
            return new Decorator(ret => target != null && cond(ret) && CanCast(spellId),
                new Action(ret =>
                    {
                        SpellManager.Cast(spellId, target(ret));
                        Logging.Write(LogLevel.Diagnostic, Colors.White, "" + WoWSpell.FromId(spellId).Name);
                        string temp;
                        if (target(ret).IsPlayer)
                            temp = "Casting " + WoWSpell.FromId(spellId).Name + " on Player at " +
                                             Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                                             Rogue.mCurrentEnergy + " energy";
                        else
                            temp = "Casting " + WoWSpell.FromId(spellId).Name + " on " + target(ret).Name + " at " +
                                             Math.Round(target(ret).HealthPercent, 0) + " with " + Helpers.Rogue.me.ComboPoints + "CP and " +
                                             Rogue.mCurrentEnergy + " energy";

                        Logging.Write(LogLevel.Normal, temp );
                    }
                )
            );
        }
开发者ID:sycs,项目名称:kaihaider,代码行数:22,代码来源:Spells.cs

示例4: TargetAoEPummel

 public Composite TargetAoEPummel(CanRunDecoratorDelegate extra)
 {
     return new Decorator(ret => extra(ret) && Me.CurrentTarget != ((WoWUnit)AoECastingAdds().FirstOrDefault()),
                          new Action(delegate
                          {
                              ((WoWUnit)AoECastingAdds().FirstOrDefault()).Target();
                              Logging.Write("[DWCC]: Targeting AoE Pummel target.");
                          }
                              ));
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:10,代码来源:utils.cs

示例5: UseItem

 public static Composite UseItem(WoWItemDelegate item, CanRunDecoratorDelegate cond)
 {
     return new Decorator(ret => item(ret) != null && cond(ret) && ItemUsable(item(ret)),
         new Action(ret =>
             {
                 item(ret).Use();
                 Logging.Write(LogLevel.Normal, item(ret).Name);
                 return RunStatus.Failure;
             }
         )
     );
 }
开发者ID:sycs,项目名称:kaihaider,代码行数:12,代码来源:Specials.cs

示例6: Wait

 /// <summary>
 ///   Creates a new Wait decorator using the specified timeout, run delegate, and child composite.
 /// </summary>
 /// <param name = "timeoutSeconds"></param>
 /// <param name = "runFunc"></param>
 /// <param name = "child"></param>
 public Wait(int timeoutSeconds, CanRunDecoratorDelegate runFunc, Composite child)
     : base(runFunc, child)
 {
     Timeout =  TimeSpan.FromSeconds(timeoutSeconds);
 }
开发者ID:KoalaHuman,项目名称:TreeSharp-1,代码行数:11,代码来源:Wait.cs

示例7: CreateWaitForLagDuration

 /// <summary>
 /// Allows waiting for SleepForLagDuration() but ending sooner if condition is met
 /// </summary>
 /// <param name="orUntil">if true will stop waiting sooner than lag maximum</param>
 /// <returns></returns>
 public static Composite CreateWaitForLagDuration( CanRunDecoratorDelegate orUntil)
 {
     return new WaitContinue(TimeSpan.FromMilliseconds((StyxWoW.WoWClient.Latency * 2) + 150), orUntil, new ActionAlwaysSucceed());
 }
开发者ID:superkhung,项目名称:SingularMod3,代码行数:9,代码来源:Common.cs

示例8: BuffSelfAndWait

        public static Composite BuffSelfAndWait(SimpleStringDelegate name, SimpleBooleanDelegate requirements = null, int expirSecs = 0, CanRunDecoratorDelegate until = null, bool measure = false, HasGcd gcd = HasGcd.Yes)
        {
            if (requirements == null)
                requirements = req => true;

            if (until == null)
                until = u => StyxWoW.Me.HasAura(name(u));

            return new Sequence(
                BuffSelf(name, requirements, expirSecs, gcd),
                new PrioritySelector(
                    new DynaWait(
                        time => TimeSpan.FromMilliseconds(Me.Combat ? 500 : 1000),
                        until,
                        new ActionAlwaysSucceed(),
                        measure
                        ),
                    new Action(r =>
                    {
                        Logger.WriteDiagnostic("BuffSelfAndWait: buff of [{0}] failed", name(r));
                        return RunStatus.Failure;
                    })
                    )
                );
        }
开发者ID:aash,项目名称:Singular,代码行数:25,代码来源:Spell.cs

示例9: Wait

 /// <summary>
 ///   Creates a new Wait decorator using the specified timeout, run delegate, and child composite.
 /// </summary>
 /// <param name = "timeoutSeconds"></param>
 /// <param name = "runFunc"></param>
 /// <param name = "child"></param>
 public Wait(int timeoutSeconds, CanRunDecoratorDelegate runFunc, Composite child)
     : base(runFunc, child)
 {
     Timeout = new TimeSpan(0, 0, timeoutSeconds);
 }
开发者ID:mcdonnellv,项目名称:treesharp,代码行数:11,代码来源:Wait.cs

示例10: FindThreats

 public Composite FindThreats(CanRunDecoratorDelegate cond, RefineFilter filter, Comparison<HealableUnit> compare, string reason, params Composite[] children)
 {
     return FindTarget(cond, TargetFilter.Threats, filter, compare, "[CLU TARGETING] " + CLU.Version + ": " + "Targeting THREAT {0}:  Max {1}, Current {2}, Defecit {3}, TimeTaken: {4} ms, REASON: " + reason, children);
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:4,代码来源:TargetBase.cs

示例11: EnsureTarget

 /// <summary>Targeting myself when no target</summary>
 /// <param name="cond">The conditions that must be true</param>
 /// <returns>Target myself</returns>
 public static Composite EnsureTarget(CanRunDecoratorDelegate cond)
 {
     return new Decorator(
                cond,
                new Sequence(
                    new Action(a => CLULogger.TroubleshootLog("[CLU] " + CLU.Version + ": CLU targeting activated. I dont have a target, someone must have died. Targeting myself")),
                    new Action(a => Me.Target())));
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:11,代码来源:TargetBase.cs

示例12: Cast

 public static Composite Cast(int spell, WoWUnit target, CanRunDecoratorDelegate condition)
 {
     return new Decorator(
         ret => condition(ret) && SpellManager.CanCast(spell, target) && SpellManager.Cast(spell, target),
         new SpellLog(spell, target));
 }
开发者ID:LaoArchAngel,项目名称:RogueAssassin,代码行数:6,代码来源:Spells.cs

示例13: UseSpecialAbilities

        public static Composite UseSpecialAbilities(CanRunDecoratorDelegate cond)
        {
            return new PrioritySelector(
                UseItem(ret => mTrinket1, ret => cond(ret) && mTrinket1Usable),
                UseItem(ret => mTrinket2, ret => cond(ret) && mTrinket2Usable),
                UseItem(ret => mGloves, ret => cond(ret) && mGlovesUsable),

                new Decorator(ret => mRacialName != null && Helpers.Rogue.mCurrentEnergy < 65 && mRacialName.Equals("Arcane Torrent"),
                    Spells.CastSelf(mRacialName)),

                new Decorator(ret => mRacialName != null && mRacialName.Length > 3 && !mRacialName.Equals("Arcane Torrent"),
                    Spells.CastSelf(mRacialName))
            );
        }
开发者ID:sycs,项目名称:kaihaider,代码行数:14,代码来源:Specials.cs

示例14: UseBagItem

 /// <summary>Attempts to use the bag item provided it is usable and its not on cooldown</summary>
 /// <param name="name">the name of the bag item to use</param>
 /// <param name="cond">The conditions that must be true</param>
 /// <param name="label">A descriptive label for the clients GUI logging output</param>
 /// <returns>The use bag item.</returns>
 public static Composite UseBagItem(string name, CanRunDecoratorDelegate cond, string label)
 {
     WoWItem item = null;
     return new Decorator(
         delegate(object a) {
             if (!cond(a))
                 return false;
             item = Me.BagItems.FirstOrDefault(x => x.Name == name && x.Usable && x.Cooldown <= 0);
             return item != null;
     },
     new Sequence(
         new Action(a => CLULogger.Log(" [BagItem] {0} ", label)),
         new Action(a => item.UseContainerItem())));
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:19,代码来源:Item.cs

示例15: RunMacroText

 /// <summary>Runs Lua MacroText</summary>
 /// <param name="macro">the macro text to run</param>
 /// <param name="cond">The conditions that must be true</param>
 /// <param name="label">A descriptive label for the clients GUI logging output</param>
 /// <returns>The run macro text.</returns>
 public static Composite RunMacroText(string macro, CanRunDecoratorDelegate cond, string label)
 {
     return new Decorator(
                cond,
                new Sequence(
                    new Action(a => CLULogger.Log(" [RunMacro] {0} ", label)),
                    new Action(a => Lua.DoString("RunMacroText(\"" + Spell.RealLuaEscape(macro) + "\")"))));
 }
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:13,代码来源:Item.cs


注:本文中的CanRunDecoratorDelegate类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。