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");
        }
Пример #2
0
 public void OnDisable()
 {
     container.Dispose();
     container = null;
 }