示例#1
0
        private void OnGUI()
        {
            EditorGUILayout.BeginVertical(StratusGUIStyles.box);
            globalExpanded = EditorGUILayout.Foldout(globalExpanded, "Global");
            if (globalExpanded)
            {
                EditorGUI.indentLevel++;
                SceneViewDisplay.InspectGlobal();
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.BeginVertical(StratusGUIStyles.box);
            foreach (var display in SceneViewDisplay.displays)
            {
                expanded[display] = EditorGUILayout.Foldout(expanded[display], display.name);
                if (expanded[display])
                {
                    EditorGUI.indentLevel++;
                    EditorGUILayout.BeginVertical(StratusGUIStyles.box);
                    display.Inspect();
                    EditorGUILayout.EndVertical();
                    EditorGUI.indentLevel--;
                }
            }
            EditorGUILayout.EndVertical();
        }
示例#2
0
        /// <summary>
        /// Constructs and initializes all declared non-abstract derived displays.
        /// This will add them to the editor's SceneView GUI delegate
        /// </summary>
        private static void ConstructAllDisplays()
        {
            // Get a list of all display classes, then construct them
            Type[] displayClasses = Reflection.GetSubclass <SceneViewDisplay>();
            foreach (var displayType in displayClasses)
            {
                SceneViewDisplay display = Activator.CreateInstance(displayType) as SceneViewDisplay;
                //SceneViewDisplay display = ScriptableObject.CreateInstance(displayType) as SceneViewDisplay;
                //display.name = displayType.Name;
                display.name = displayType.Name.FromCamelCase();
                displays.Add(display);
                displaysMap.Add(display.name, display);
            }

            // Now initialize them
            foreach (var display in displays)
            {
                display.loaded = display.Load();
                if (!display.loaded)
                {
                    display.OnReset();
                    display.Save();
                }

                display.InitializeDisplay();
            }
        }
示例#3
0
 /// <summary>
 /// Inspects the global properties of SceneViewDisplay
 /// </summary>
 public static void InspectGlobal()
 {
     EditorGUI.BeginChangeCheck();
     {
         global.enabled = EditorGUILayout.Toggle("Enabled", global.enabled);
     }
     if (EditorGUI.EndChangeCheck())
     {
         SceneViewDisplay.SaveGlobal();
         SceneView.RepaintAll();
     }
 }