Exemplo n.º 1
0
 protected void Link(FsmState from, FsmState to, int exitCode, ICondition condition, FsmState inverse,
                     params FsmState[] path)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 2
0
        //-----------------------------------
        // Link with exit code
        //-----------------------------------

        /// <summary>
        /// 用退出码和路径连接两个状态。
        /// </summary>
        /// <param name="from">起点状态。</param>
        /// <param name="to">终点状态。</param>
        /// <param name="exitCode">出口编号。</param>
        /// <param name="path">起点和终点状态之间的过渡路径。</param>
        protected void Link(FsmState from, FsmState to, int exitCode, params FsmState[] path)
        {
            Link(from, to, exitCode, true, graphExitConnections, path);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 用默认退出码(0)和路径连接两个状态。
 /// </summary>
 /// <param name="from">起点状态。</param>
 /// <param name="to">终点状态。</param>
 /// <param name="path">起点和终点状态之间的过渡路径。</param>
 protected void Link(FsmState from, FsmState to, params FsmState[] path)
 {
     Link(from, to, 0, path);
 }
Exemplo n.º 4
0
 protected void LinkBlackList(FsmState to, ICondition condition, FsmState inverse, params FsmState[] blackList)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 5
0
 /// <summary>
 /// 用事件和路径连接两个状态,当事件触发时中断当前状态并转移。
 /// </summary>
 /// <param name="from">起点状态。</param>
 /// <param name="to">终点状态。</param>
 /// <param name="eventListener">事件处理组件。</param>
 /// <param name="path">起点和终点状态之间的过渡路径。</param>
 protected void Link(FsmState from, FsmState to, EventListener eventListener, params FsmState[] path)
 {
     Link(from, to, eventListener, true, graphEventConnections, path);
     BookEventListener(from, eventListener);
 }
Exemplo n.º 6
0
 // 获取指定状态的 EventListeners,没有时为 null
 public EventListener[] GetEventListeners(FsmState state)
 {
     return(GetConnectionTypes(state, graphEventConnections));
 }
Exemplo n.º 7
0
 /// <summary>
 /// 用条件和路径连接两个状态,当条件满足时中断当前状态并转移。
 /// </summary>
 /// <param name="from">起点状态。</param>
 /// <param name="to">终点状态。</param>
 /// <param name="condition">条件类的实例。</param>
 /// <param name="path">起点和终点状态之间的过渡路径。</param>
 protected void Link(FsmState from, FsmState to, ICondition condition, bool inverse, params FsmState[] path)
 {
     Link(from, to, GetCondition(condition, inverse), true, graphConditionConnections, path);
 }
Exemplo n.º 8
0
 // 获取指定状态的独立 EventListener 列表,没有时为 null
 public IList <EventListener> GetBookedEventListeners(FsmState state)
 {
     return(GetBookedServices(state, graphEventListeners).AsReadOnly());
 }
Exemplo n.º 9
0
 public ToAndList(FsmState to, FsmState[] stateList)
 {
     To        = to;
     StateList = stateList;
 }
Exemplo n.º 10
0
 // 获取指定状态指定 ExitCode 的目标状态和路径
 public bool GetExitTo(FsmState state, int exitCode, out FsmState to, out FsmState[] path)
 {
     return(GetTo(state, exitCode, graphExitConnections, out to, out path));
 }
Exemplo n.º 11
0
 // 获取指定状态的独立 ServiceProvider 列表,没有时为 null
 public IList <ServiceProvider> GetBookedServiceProviders(FsmState state)
 {
     return(GetBookedServices(state, graphServiceProviders).AsReadOnly());
 }
Exemplo n.º 12
0
 // 获取指定状态指定 EventListener 的目标状态和路径
 public bool GetEventTo(FsmState state, EventListener eventListener, out FsmState to, out FsmState[] path)
 {
     return(GetTo(state, eventListener, graphEventConnections, out to, out path));
 }
Exemplo n.º 13
0
 // 获取指定状态指定 Condtion 的目标状态和路径
 public bool GetConditionTo(FsmState state, ICondition condition, out FsmState to, out FsmState[] path)
 {
     return(GetTo(state, condition, graphConditionConnections, out to, out path));
 }
Exemplo n.º 14
0
 // 获取指定状态的 ExitCodes,没有时为 null
 public int[] GetExitCodes(FsmState state)
 {
     return(GetConnectionTypes(state, graphExitConnections));
 }
Exemplo n.º 15
0
 /// <summary>
 /// 为指定状态预订一个独立服务。
 /// 该服务跟随状态启用和停用。
 /// </summary>
 /// <param name="state">状态。</param>
 /// <param name="serviceProvider">服务组件实例。</param>
 protected void BookServiceProvider(FsmState state, ServiceProvider serviceProvider)
 {
     BookService(state, serviceProvider, graphServiceProviders);
 }
Exemplo n.º 16
0
 /// <summary>
 /// 设置默认的入口状态。
 /// </summary>
 /// <param name="state">入口状态。</param>
 protected void SetEntry(FsmState state)
 {
     entry = state;
 }
Exemplo n.º 17
0
 /// <summary>
 /// 为指定状态预订一个事件侦听和处理服务。
 /// 该服务跟随状态启用和停用。
 /// </summary>
 /// <param name="state">预订服务的状态。</param>
 /// <param name="eventListener">事件侦听服务的实例。</param>
 protected void BookEventListener(FsmState state, EventListener eventListener)
 {
     BookService(state, eventListener, graphEventListeners);
 }
Exemplo n.º 18
0
        //--------------------------------------------------
        // 开放状态机结构数据,供测试用
        //--------------------------------------------------

        // 获取指定状态的 Conditions,没有时为 null
        public ICondition[] GetConditions(FsmState state)
        {
            return(GetConnectionTypes(state, graphConditionConnections));
        }