示例#1
0
        private bool DrawTabButton(TabAttribute tabAttribute)
        {
            bool flag = false;

            if (tabAttribute != null)
            {
                using (new GUIHelper.BackgroundColor(
                           this.editorAttribute == null || !this.editorAttribute.Match((object)tabAttribute)
                        ? UnityEngine.Color.white
                        : this.selectionColor))
                {
                    using (new GUIHelper.ContentColor(CoreStyles.centeredMiniLabel.normal.textColor))
                        flag = GUILayout.Button(new GUIContent(tabAttribute.Title), IPanel <T> .tabButtonStyle,
                                                GUILayout.ExpandWidth(true));
                }

                if (this.editorAttribute != null && this.editorAttribute.Match((object)tabAttribute) &&
                    this.editorRender == null)
                {
                    flag = true;
                }
            }

            return(flag);
        }
示例#2
0
 /// <summary>
 /// 展示选中的功能界面
 /// </summary>
 /// <param name="editor"></param>
 public virtual void Show(IMetaEditor editor)
 {
     EditorGUI.FocusTextInControl("");
     if (!editor.Initialize())
     {
         return;
     }
     this.current_editor            = editor;
     this.save_CurrentEditor.String = editor.GetType().FullName;
     this.editorAttribute           =
         (TabAttribute)
         ((IEnumerable <object>)editor.GetType().GetCustomAttributes(true)).FirstOrDefault <object>(
             (Func <object, bool>)(x => x is TabAttribute));
     this.editorRender = new Action(this.current_editor.OnGUI);
 }
示例#3
0
 private void DrawTabs(string group)
 {
     if (!this.editors.ContainsKey(group))
     {
         return;
     }
     if (!string.IsNullOrEmpty(group))
     {
         this.DrawTabTitle(group);
     }
     foreach (System.Type type in this.editors[group])
     {
         TabAttribute tabAttribute =
             (TabAttribute)((IEnumerable <object>)type.GetCustomAttributes(true)).FirstOrDefault <object>(
                 (Func <object, bool>)(x => x is TabAttribute));
         if (tabAttribute != null && this.DrawTabButton(tabAttribute))
         {
             this.Show((IMetaEditor)Activator.CreateInstance(type));
         }
     }
 }