Beispiel #1
0
 public static void Update()
 {
     if (CoreStyles.initialized)
     {
         return;
     }
     CoreStyles.Initialize();
 }
Beispiel #2
0
        private void OnGUI()
        {
            try
            {
                CoreStyles.Update();
                if (!IPanel <T> .style_IsInitialized)
                {
                    this.InitializeStyles();
                }

                EditorGUILayout.Space();
                if (this.editorRender == null || this.current_editor == null)
                {
                    this.editorRender   = (Action)null;
                    this.current_editor = (IMetaEditor)null;
                }

                this.defalutColor = GUI.backgroundColor;

                using (new GUIHelper.Horizontal(new GUILayoutOption[2]
                {
                    GUILayout.ExpandWidth(true),
                    GUILayout.ExpandHeight(true)
                }))
                {
                    using (new GUIHelper.Vertical(CoreStyles.tabArea, new GUILayoutOption[2]
                    {
                        GUILayout.Width(150f),
                        GUILayout.ExpandHeight(true)
                    }))
                    {
                        this.tabsScroll = EditorGUILayout.BeginScrollView(this.tabsScroll);
                        this.DrawTabs();
                        EditorGUILayout.EndVertical();
                        EditorGUILayout.EndScrollView();


                        Rect rect = EditorGUILayout.BeginVertical(CoreStyles.tabArea, GUILayout.ExpandWidth(true),
                                                                  GUILayout.ExpandHeight(true));
                        this.editorScroll = EditorGUILayout.BeginScrollView(this.editorScroll);
                        if (this.current_editor != null && this.editorRender != null)
                        {
                            if (this.editorAttribute != null)
                            {
                                this.DrawTitle(this.editorAttribute.Title);
                            }
                            try
                            {
                                if (EditorApplication.isCompiling)
                                {
                                    GUILayout.Label("Compiling...", CoreStyles.centeredMiniLabel,
                                                    GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
                                }
                                else
                                {
                                    if (Event.current.type == EventType.Repaint)
                                    {
                                        IPanel <T> .currectEditorRect = rect;
                                    }
                                    this.editorRender();
                                }
                            }
                            catch (Exception ex)
                            {
                                Debug.LogException(ex);
                                GUILayout.Label(ex.ToString(), IPanel <T> .style_Exeption);
                            }
                        }
                        else
                        {
                            GUILayout.Label("Nothing selected", CoreStyles.centeredMiniLabel,
                                            GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true));
                        }

                        EditorGUILayout.EndScrollView();
                    }
                }
            }
            catch (ArgumentException ex)
            {
                if (ex.Message.StartsWith("Getting control") && ex.Message.StartsWith("GUILayout"))
                {
                    return;
                }
                Debug.LogException((Exception)ex);
            }
        }