示例#1
0
        static ActionManager()
        {
            EntityTypeManager.Init();
            List <ISystemAction>[] groupActions = new List <ISystemAction> [EntityTypeManager.TypeCount];
            for (int i = 0; i < groupActions.Length; i++)
            {
                groupActions[i] = new List <ISystemAction>();
            }
            //DateTime t0 = DateTime.Now;
            var types = LEType.GetTypes(t => t.GetInterfaces().Contains(typeof(ILE_Data)));

            foreach (var type in types)
            {
                if (type.IsClass && !type.IsAbstract)
                {
                    //Console.WriteLine(type.FullName);
                    Add(type, groupActions);
                }
            }
            for (int i = 0; i < groupActions.Length; i++)
            {
                //for (int j = 0; j < groupActions[i].Count; j++)
                //{
                //    Console.WriteLine(groupActions[i][j].Id);
                //}
                EntityTypeManager.GetEntityType(i).SetAction(groupActions[i].ToArray());
            }
            //Console.WriteLine((DateTime.Now - t0).TotalMilliseconds);
        }
示例#2
0
        private static void Add(Type type, List <ISystemAction>[] groupActions)
        {
            ISystemAction systemAction = GetSystemAction(type);

            LE_Log.Log.Info("ActionRegister", "ActionId: {0}  ActionName: {1}", systemAction.Id, systemAction.Name);

            if ((Attribute.GetCustomAttribute(type, typeof(EntityActionAttribute)) is EntityActionAttribute actionAttribute))
            {
                groupActions[EntityTypeManager.GetEntityTypeId(actionAttribute.Type)].Add(systemAction);
            }