Пример #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
        static EntityTypeManager()
        {
            Type bt    = typeof(EntityType);
            var  types = LEType.GetTypes(t => t.BaseType == bt);

            TypeCount = types.Length;
            for (int i = 0; i < TypeCount; i++)
            {
                Add(types[i], i);
            }
        }
Пример #3
0
        protected TAManager()
        {
            Type baseType = typeof(T);

            TemplateIdManager.RegiserBase <T>();
            var types = LEType.GetTypes(t => t.BaseType == baseType);

            actions = new T[types.Length];
            for (int i = 0; i < types.Length; i++)
            {
                actions[i] = LEType.CreateInstance <T>(types[i]);
                TemplateIdManager.Register <T>(types[i]);
            }
        }
Пример #4
0
        static TemplateManager()
        {
            Type baseType = typeof(T);
            var  types    = LEType.GetTypes(t => t.BaseType == baseType);

            datas = new T[types.Length];
            for (int i = 0; i < types.Length; i++)
            {
                datas[i] = LEType.CreateInstance <T>(types[i]);
                int id = IdManager.IdDeliverer <T> .GetNextId();

                var _id = types[i].GetField("id", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy);
                if (_id == null)
                {
                    //TODO: Exception
                    LE_Log.Log.Exception(new Exception(), "Template register fail", "template type:{0}", types[i].FullName);
                }
                _id.SetValue(datas[i], id);
                Console.WriteLine("{0}:{1}", types[i].Name, datas[i].Id);
            }
        }