本文整理汇总了C#中CanRunDecoratorDelegate类的典型用法代码示例。如果您正苦于以下问题:C# CanRunDecoratorDelegate类的具体用法?C# CanRunDecoratorDelegate怎么用?C# CanRunDecoratorDelegate使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CanRunDecoratorDelegate类属于命名空间,在下文中一共展示了CanRunDecoratorDelegate类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: FindMultiDotTarget
/// <summary>
/// Finds a target that does not have the specified spell and applys it.
/// </summary>
/// <param name="cond">The conditions that must be true</param>
/// <param name="spell">The spell to be cast</param>
/// <returns>success we have aquired a target and failure if not.</returns>
public static Composite FindMultiDotTarget(CanRunDecoratorDelegate cond, string spell)
{
return new Decorator(
cond,
new Sequence(
// get a target
new Action(
delegate
{
if (!CLUSettings.Instance.EnableMultiDotting)
{
return RunStatus.Failure;
}
WoWUnit target = EnemyRangedUnits.FirstOrDefault(u => !u.HasAura(spell) && u.Distance2DSqr < 40 * 40);
if (target != null)
{
CLULogger.DiagnosticLog(target.Name);
target.Target();
return RunStatus.Success;
}
return RunStatus.Failure;
}),
new Action(a => StyxWoW.SleepForLagDuration()),
// if success, keep going. Else quit
new PrioritySelector(Buff.CastDebuff(spell, cond, spell))));
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:34,代码来源:Unit.cs
示例17: FindParty
/// <summary>
/// Finds a Party that needs healing
/// </summary>
/// <param name="cond">The conditions that must be true</param>
/// <param name="minAverageHealth">Minimum Average health of the Party Members</param>
/// <param name="maxAverageHealth">MaximumAverage health of the Party Members</param>
/// <param name="maxDistanceBetweenPlayers">The maximum distance between other party members from the targeted party member</param>
/// <param name="minUnits">Minumum units to be affected</param>
/// <param name="reason">text to indicate the reason for using this method </param>
/// <param name="children">Execute the child subroutines</param>
/// <returns>A party member</returns>
public Composite FindParty(CanRunDecoratorDelegate cond, int minAverageHealth, int maxAverageHealth, float maxDistanceBetweenPlayers, int minUnits, string reason, params Composite[] children)
{
return new Decorator(
cond,
new Sequence(
new PrioritySelector(
FindPartySubroutine(0, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 1 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(1, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 2 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(2, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 3 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(3, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 4 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(4, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 5 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(5, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 6 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(6, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 7 MEMBER: {0} REASON: " + reason),
FindPartySubroutine(7, minAverageHealth, maxAverageHealth, maxDistanceBetweenPlayers, minUnits, "[CLU TARGETING] " + CLU.Version + ": " + "Target PARTY 8 MEMBER: {0} REASON: " + reason)
),
new Action(a => StyxWoW.SleepForLagDuration()),
// if success, keep going. Else quit sub routine
new PrioritySelector(children)
)
);
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:32,代码来源:TargetBase.cs
示例18: CastStatus
public static Composite CastStatus(int spell, CanRunDecoratorDelegate conditions)
{
return new Decorator(ret => conditions(ret) && SpellManager.CanCast(spell),
new Action(context =>
{
if (SpellManager.Cast(spell))
{
LogSpell(spell);
return RunStatus.Success;
}
return RunStatus.Failure;
}));
}
开发者ID:LaoArchAngel,项目名称:RogueAssassin,代码行数:13,代码来源:Spells.cs
示例19: FindTarget
private static Composite FindTarget(CanRunDecoratorDelegate cond, TargetFilter filter, RefineFilter refineFilter, Comparison<HealableUnit> compare, string label, params Composite[] children)
{
return new Decorator(
cond,
new Sequence(
// get a target
new Action(
delegate
{
var targetPerformanceTimer = new Stopwatch(); // lets see if we can get some performance on this one.
targetPerformanceTimer.Start(); // lets see if we can get some performance on this one.
//CrabbyProfiler.Instance.Runs.Add(new Run("FindTarget"));
// Nothing to filter against
if (!UnitsFilter(filter).Any())
{
HealableUnit.HealTarget = null;
return RunStatus.Failure;
}
// Filter the Healable Units
var raid = UnitsFilter(filter).Where(x => x != null && (ObjectManager.ObjectList.Any(y => y.Guid == x.ToUnit().Guid) && refineFilter(x)) && x.ToUnit().Distance2DSqr < 40 * 40 && !x.ToUnit().ToPlayer().IsGhost && !x.ToUnit().HasAura("Deep Corruption")).ToList();
// Nothing to heal.
if (!IsPlayingWoW() || !raid.Any())
{
HealableUnit.HealTarget = null;
return RunStatus.Failure;
}
raid.Sort(compare);
var target = raid.FirstOrDefault();
if (target != null)
{
Log(
label,
CLULogger.SafeName(target.ToUnit()),
target.MaxHealth,
target.CurrentHealth,
target.MaxHealth - target.CurrentHealth,
targetPerformanceTimer.ElapsedMilliseconds); // lets see if we can get some performance on this one.
//target.ToUnit().Target();
HealableUnit.HealTarget = target;
return RunStatus.Success;
}
HealableUnit.HealTarget = null;
//CrabbyProfiler.Instance.EndLast();
return RunStatus.Failure;
}),
new Action(a => StyxWoW.SleepForLagDuration()),
// if success, keep going. Else quit sub routine
new PrioritySelector(children)));
}
开发者ID:Asphodan,项目名称:Alphabuddy,代码行数:55,代码来源:TargetBase.cs
示例20: DecoratorContinue
public DecoratorContinue(CanRunDecoratorDelegate func, Composite decorated)
: base(func, decorated)
{
}
开发者ID:mcdonnellv,项目名称:treesharp,代码行数:4,代码来源:DecoratorContinue.cs
注:本文中的CanRunDecoratorDelegate类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论