static void Startup()
        {
            container = new MultyFrameworkContaner();
            var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany((a) => { return(a.GetTypes()); });

            types
            .Where((type) => {
                return(!type.IsAbstract && type.IsSubclassOf(typeof(Framework)) &&
                       type.IsDefined(typeof(FrameworkAttribute), false) &&
                       (type.GetCustomAttributes(typeof(FrameworkAttribute), false).First() as FrameworkAttribute).env.HasFlag(EnvironmentType.Editor));
            })
            .Select((type) => {
                Framework f = Activator.CreateInstance(type) as Framework;
                f.env       = EnvironmentType.Editor;
                return(f);
            }).ToList()
            .ForEach((f) => {
                container.Subscribe(f);
            });
            EditorApplication.update += container.Update;
            UnityEditor.Compilation.CompilationPipeline.assemblyCompilationStarted += (str) => {
                container.Dispose();
                UnityEngine.Debug.Log("EditorFrameworks Dispose");
            };
            container.Startup();
            UnityEngine.Debug.Log("EditorFrameworks Start");
        }
Exemplo n.º 2
0
        /// <summary>
        /// 开启
        /// </summary>
        static void Startup()
        {
            container = new MultyFrameworkContaner();
            var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany((a) => { return(a.GetTypes()); });

            types
            .Where((type) => {
                return(!type.IsAbstract && type.IsSubclassOf(typeof(Framework)) &&
                       type.IsDefined(typeof(FrameworkAttribute), false) &&
                       (type.GetCustomAttributes(typeof(FrameworkAttribute), false).First() as FrameworkAttribute).env.HasFlag(EnvironmentType.Editor));
            })
            .Select((type) => {
                Framework f = Activator.CreateInstance(type) as Framework;
                f.env       = EnvironmentType.Editor;
                return(f);
            }).ToList()
            .ForEach((f) => {
                container.Subscribe(f);
            });
        }
Exemplo n.º 3
0
 public void OnDisable()
 {
     container.Dispose();
     container = null;
 }