示例#1
0
        private void OnEnable()
        {
            current = this;

            var tools = typeof(DependencyTool).Get().Derived();

            var removables = new List <DependencyTool>();

            for (int i = 0; i < this.tools.Count; i++)
            {
                if (!tools.Any((tool) => { return(tool == this.tools[i].GetType()); }))
                {
                    removables.Add(this.tools[i]);
                }
            }

            for (int i = 0; i < tools.Length; i++)
            {
                if (!this.tools.Any((tool) => { return(tool.GetType() == tools[i]); }))
                {
                    this.tools.Add(Activator.CreateInstance(tools[i]) as DependencyTool);
                }
            }

            for (int i = 0; i < removables.Count; i++)
            {
                this.tools.Remove(removables[i]);
            }

            for (int i = 0; i < this.tools.Count; i++)
            {
                this.tools[i].OnEnable();
            }
        }
示例#2
0
 public static void Open()
 {
     current = GetWindow <DependencyTools>();
     current.titleContent = new UnityEngine.GUIContent("Tools");
 }