public bool Tick(IBehaviorHost host, RealmTime time) { Host = host; try { return TickCore(time); } catch (Exception e) { Console.Out.WriteLine(e); return true; } }
/// <inheritdoc /> public async Task ExecuteAsync <TArgument>(IBehaviorHost host, TArgument argument) where TArgument : IBehaviorArgument { if (host == null) { return; } Log.Debug($"Executing behaviours of [{host.GetType().FullName}]."); foreach (var behaviour in host.Behaviors.OrderByDescending(d => d.Priority)) { if (behaviour is IAsyncBehavior <TArgument> castedBehaviour) { Log.Debug($"Executing [{behaviour.GetType().FullName}] using [{argument.GetType().FullName}]"); await castedBehaviour.ExecuteAsync(argument); } } }
public async Task <bool> IsCancelledAsync(IBehaviorHost behaviorHost, IServiceProvider serviceProvider) { if (behaviorHost == null) { return(false); } var closeContext = new WindowClosingContext(behaviorHost, serviceProvider); var behaviourRunner = serviceProvider.GetRequiredService <IBehaviorRunner>(); await behaviourRunner.ExecuteAsync(behaviorHost, closeContext); if (closeContext.Cancelled) { CancelArgs.Cancel = true; return(true); } return(false); }
public bool Tick(IBehaviorHost host, RealmTime time) { this.Host = host; return TickCore(time); }
public bool ConditionMeet(IBehaviorHost host) { this.Host = host; return ConditionMeetCore(); }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state, string msg, Player player) { this.Host = host; BehaveCore(cond, time, state, msg, player); }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state) { this.Host = host; BehaveCore(cond, time, state); }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state, string msg) { Host = host; BehaveCore(cond, time, state, msg); }
public bool Tick(IBehaviorHost host, RealmTime time) { Host = host; try { return TickCore(time); } catch (Exception ex) { Logger.Error(ex); return true; } }
public void Behave(BehaviorCondition cond, IBehaviorHost host, RealmTime? time, object state, params Object[] args) { this.Host = host; BehaveCore(cond, time, state, args); }