public override void OnChildDone(CommandBase child) { if (child == this._selectWork) { if (this._selectWork.State == CmdExecuteState.Success) { if (_succeedWork != null) { _succeedWork.Execute(_context); } else { this.OnExecuteDone(CmdExecuteState.Success); } } else { if (_failWork != null) { _failWork.Execute(_context); } else { this.OnExecuteDone(CmdExecuteState.Success); } } } else { this.OnExecuteDone(child.State); } }
protected virtual void Next() { if (_children.Count > 0) { _executeChild = _children.First.Value; _children.RemoveFirst(); _executeChild.Execute(this._context); } else { this.OnExecuteDone(CmdExecuteState.Success); } }
/// <summary> /// 添加子命令并直接执行 /// </summary> /// <param name="command">Command.</param> public virtual void AddSubCommand(CommandBase command) { command.Parent = this; _children.AddLast(command); command.Execute(_context); }
public override void Execute(ICommandContext context) { base.Execute(context); _selectWork.Execute(context); }