Esempio n. 1
0
        public static void SortSmartNext()
        {
            Events.Pause("On Hierarchy Changed");
            int  index    = DataBehaviour.processIndex;
            var  sorting  = DataBehaviour.sorting;
            bool canceled = true;

            if (index < DataBehaviour.sorting.Length - 1)
            {
                var    current = DataBehaviour.sorting[index];
                float  total   = (float)index / sorting.Length;
                string message = index + " / " + sorting.Length + " -- " + current.GetPath();
                canceled = EditorUI.DrawProgressBar("Sorting All Components", message, total);
                current.PauseValidate();
                DataBehaviour.SortSmartTarget(current);
                current.ResumeValidate();
            }
            DataBehaviour.processIndex += 1;
            if (canceled || index + 1 > sorting.Length - 1)
            {
                EditorUI.ClearProgressBar();
                Events.Remove("On Editor Update", DataBehaviour.SortSmartNext);
                Events.Resume("On Hierarchy Changed");
            }
        }
Esempio n. 2
0
 public static void SortSmartSelected()
 {
     foreach (var target in Selection.gameObjects)
     {
         DataBehaviour.SortSmartTarget(target);
     }
 }
Esempio n. 3
0
 public static void ApplyPrefabSelected()
 {
     Debug.Log("[DataBehaviour] Applying prefab");
     foreach (var target in Selection.gameObjects)
     {
         DataBehaviour.ApplyPrefabTarget(target);
     }
 }
Esempio n. 4
0
        //===============
        // Shared
        //===============
        public static void SortSmartTarget(GameObject target)
        {
            Component[] components = target.GetComponents <Component>().ToList().OrderBy(x => x.GetAlias()).ToArray();
            DataBehaviour.Sort(components);
            var controller = components.Find(x => x.GetType().Name.Contains("State"));

            if (!controller.IsNull())
            {
                controller.MoveToTop();
            }
        }
Esempio n. 5
0
 public void ApplyPrefab()
 {
     DataBehaviour.ApplyPrefabTarget(this.gameObject);
 }
Esempio n. 6
0
 public void SortSmart()
 {
     DataBehaviour.SortSmartTarget(this.gameObject);
 }
Esempio n. 7
0
 public void SortByAlias()
 {
     Component[] components = this.GetComponents <Component>().ToList().OrderBy(x => x.GetAlias()).ToArray();
     DataBehaviour.Sort(components);
 }