示例#1
0
        //状态机发送消息,从状态列表中检测,如果包含注册了该消息的状态机,返回需要切换的状态机名字,切换状态
        public void post(string msg)
        {
            FSMMsg evt = new FSMMsg();

            evt.msg = msg;
            this.postEvent(evt);
        }
示例#2
0
        //提交事件消息,如果事件列表有当前消息,返回对应事件列表的状态名字
        public override string PostEvent(FSMMsg evt)
        {
            string ret = "";

            if (actionMap.ContainsKey(evt.msg))
            {
                ret = actionMap[evt.msg](evt);
            }
            return(ret);
        }
示例#3
0
 public void postEvent(FSMMsg evt)
 {
     for (int i = 0; i < this.currState.Count; ++i)
     {
         State  state     = this.currState[i] as State;
         string stateName = state.PostEvent(evt) as string;
         if (stateName != "")
         {
             this.translation(stateName);
             break;
         }
     }
 }