Ejemplo n.º 1
0
 public void UpdateConfigs()
 {
     if (!isInit)
     {
         return;
     }
     LogModule.Log("Update configs");
 }
Ejemplo n.º 2
0
        static FrameworkEngine()
        {
            LogModule.Log("FrameworkEngine constructor");
            CachedAssemblies = new List <Assembly>
            {
                typeof(int).Assembly, typeof(List <>).Assembly
            };

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
            {
//                if (assembly.FullName.StartsWith("Assembly-CSharp") || assembly.FullName.StartsWith("Assembly-CSharp-Editor") || assembly.FullName.Contains("OhMyFramework"))
//                {
                CachedAssembly(assembly);
//                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  framework 初始化,可以多次调用
        /// </summary>
        public static void Init()
        {
            if (isInit)
            {
                return;
            }

            OmfConfigs.Instance.ResUrl    = OmfSettings.Instance.ResUrl;
            OmfConfigs.Instance.IsEnabled = OmfSettings.Instance.IsEnabled;
            LogModule.Log("ResUrl = " + OmfConfigs.Instance.ResUrl + ",isenable=" + OmfConfigs.Instance.IsEnabled);
//            var engineMono = new GameObject("OhMyFramework_Engine_DONOTDESTORY").AddComponent<EngineMono>();
//            engineMono.tag = "EngineGameObject";
//            _engineMono = EngineMono;

            LogModule.Log("ModuleManager.Container = " + ModuleManager.Container.ToString());
            LogModule.Log("ModuleManager = " + EngineMono.ModuleManager.ToString());
            isInit = true;
        }
Ejemplo n.º 4
0
        public static IEnumerable <Type> GetDerivedTypes <T>(bool includeAbstract = false, bool includeBase = true)
        {
            LogModule.Log($"GetDerivedTypes {typeof(T)}");
            var type = typeof(T);

            if (includeBase)
            {
                yield return(type);
            }
            if (includeAbstract)
            {
                foreach (var t in CachedAssemblies.SelectMany(assembly => assembly
                                                              .GetTypes()
                                                              .Where(x => type.IsAssignableFrom(x))))
                {
                    yield return(t);
                }
            }
            else
            {
                var items = new List <Type>();
                foreach (var assembly in CachedAssemblies)
                {
                    try
                    {
                        items.AddRange(assembly.GetTypes()
                                       .Where(x => type.IsAssignableFrom(x) && !x.IsAbstract));
                    }
                    catch (Exception ex)
                    {
                        LogModule.Log(ex.Message);
                    }
                }

                foreach (var item in items)
                {
                    yield return(item);
                }
            }
        }