/// <summary>
        /// 注册状态机
        /// </summary>
        /// <param name="fsm">状态机</param>
        public void RegisterFSM(FSM fsm)
        {
            if (fsm == null)
            {
                return;
            }

            if (!FSMs.ContainsKey(fsm.Name))
            {
                FSMs.Add(fsm.Name, fsm);

                if (FSMGroups.ContainsKey(fsm.Group))
                {
                    FSMGroups[fsm.Group].Add(fsm);
                }
                else
                {
                    FSMGroups.Add(fsm.Group, new List <FSM>());
                    FSMGroups[fsm.Group].Add(fsm);
                }
            }
            else
            {
                Log.Warning("注册状态机失败:已存在状态机 " + fsm.Name + " !");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 注册状态机
        /// </summary>
        /// <param name="fsm">状态机</param>
        public void RegisterFSM(FSM fsm)
        {
            if (!FSMs.ContainsKey(fsm.Name))
            {
                FSMs.Add(fsm.Name, fsm);

                if (FSMGroups.ContainsKey(fsm.Group))
                {
                    FSMGroups[fsm.Group].Add(fsm);
                }
                else
                {
                    FSMGroups.Add(fsm.Group, new List <FSM>());
                    FSMGroups[fsm.Group].Add(fsm);
                }
            }
            else
            {
                throw new HTFrameworkException(HTFrameworkModule.FSM, "注册状态机失败:已存在状态机 " + fsm.Name + " !");
            }
        }