本文整理汇总了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;
}
示例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));
}
示例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 );
}
)
);
}
示例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.");
}
));
}
示例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;
}
)
);
}
示例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);
}
示例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());
}
示例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;
})
)
);
}
示例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);
}
示例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);
}
示例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())));
}
示例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));
}
示例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))
);
}
示例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())));
}
示例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) + "\")"))));
}