/// <summary>
        /// 创建游戏状态的环境
        /// </summary>
        /// <param name="assembly">重写游戏状态所在的程序集</param>
        public void CreateContext(Assembly assembly)
        {
            if (_stateContext != null)
            {
                return;
            }

            PEIState_Context stateContext = new PEIState_Context();
            List <PEIState>  listState    = new List <PEIState>();

            Type[] types = assembly.GetTypes();
            foreach (var item in types)
            {
                object[] attribute = item.GetCustomAttributes(typeof(PEIStateAttribute), false);
                if (attribute.Length <= 0 || item.IsAbstract)
                {
                    continue;
                }
                PEIStateAttribute stateAttribute = (PEIStateAttribute)attribute[0];
                if (stateAttribute.StateType == PEIState_Type.Ignore)
                {
                    continue;
                }
                object   obj = Activator.CreateInstance(item);
                PEIState gs  = obj as PEIState;
                if (gs != null)
                {
                    listState.Add(gs);
                    if (stateAttribute.StateType == PEIState_Type.Start)
                    {
                        _startState = gs;
                    }
                }
            }
            stateContext.SetAllState(listState.ToArray());
            _stateContext = stateContext;
        }
 public PEIState_ModuleEditor(string name, Color mainColor, PEIMEN_Entity gameMode)
     : base(name, mainColor, gameMode)
 {
     _listState = new List <string>();
     Type[] types = typeof(PEIMEN_Entity).Assembly.GetTypes();
     foreach (var item in types)
     {
         object[] attribute = item.GetCustomAttributes(typeof(PEIStateAttribute), false);
         if (attribute.Length <= 0 || item.IsAbstract)
         {
             continue;
         }
         PEIStateAttribute stateAttribute = (PEIStateAttribute)attribute[0];
         //if (stateAttribute.StateType == VirtualStateType.Ignore)
         //    continue;
         object   obj = Activator.CreateInstance(item);
         PEIState gs  = obj as PEIState;
         if (gs != null)
         {
             _listState.Add("[" + stateAttribute.StateType.ToString() + "]\t" + item.FullName);
         }
         //PEIKDE.Log("UDE", "_listState C " + gs);
     }
 }