/// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyLayout(GUIContent label)
        {
            var property  = this.Property;
            var attribute = this.Attribute;

            if (this.TitleHelper.ErrorMessage != null)
            {
                SirenixEditorGUI.ErrorMessageBox(this.TitleHelper.ErrorMessage);
            }

            SirenixEditorGUI.BeginBox();
            SirenixEditorGUI.BeginBoxHeader();
            var content = GUIHelper.TempContent(this.TitleHelper.GetString(property));

            this.IsVisible.Value = SirenixEditorGUI.Foldout(this.IsVisible.Value, content);
            SirenixEditorGUI.EndBoxHeader();
            if (Event.current.type == EventType.Layout)
            {
                EditorTimeHelper.Time.Update();
                this.t = Mathf.MoveTowards(this.t, this.IsVisible.Value ? 1 : 0, EditorTimeHelper.Time.DeltaTime * (1f / SirenixEditorGUI.DefaultFadeGroupDuration));
            }

            if (SirenixEditorGUI.BeginFadeGroup(this.t))
            {
                for (int i = 0; i < property.Children.Count; i++)
                {
                    var child = property.Children[i];
                    child.Draw(child.Label);
                }
            }
            SirenixEditorGUI.EndFadeGroup();
            SirenixEditorGUI.EndBox();
        }
Example #2
0
    public void drawComponent(NodeIComponent component)
    {
        SirenixEditorGUI.BeginBoxHeader();

        component.style.unfolded = SirenixEditorGUI.Foldout(component.style.unfolded, component.component.GetType().ToString());
        Rect rect = GUILayoutUtility.GetLastRect();

        SirenixEditorGUI.EndBoxHeader();

        NodeEditorGUILayout.AddPortField(component.port);

        if (component.style.unfolded)
        {
            SirenixEditorGUI.BeginBox();
            if (component.tree == null)
            {
                GUILayout.Label("the tree is null somehow");
            }
            if (component.tree != null)
            {
                component.tree.Draw(false);
            }
            else
            {
                component.tree = PropertyTree.Create(component.component);
                component.tree.Draw(false);
            }
            //Debug.Log(component.tree.WeakTargets);
            SirenixEditorGUI.EndBox();
        }
    }
 private void OnStartList(int index)
 {
     SirenixEditorGUI.BeginBox();
     SirenixEditorGUI.BeginBoxHeader();
     EditorGUILayout.LabelField(((Stats)index).ToString());
     SirenixEditorGUI.EndBoxHeader();
 }
        private void MakeHeader(ref bool collectionChanged)
        {
            if (ColorUtility.TryParseHtmlString(this.Attribute.ColorHex, out Color color))
            {
                GUIHelper.PushColor(color, true);
            }
            else
            {
                GUIHelper.PushColor(Color.white, true);
            }

            SirenixEditorGUI.BeginBoxHeader();
            GUIHelper.PopColor();

            string title = string.IsNullOrEmpty(this.Attribute.Title) ? this.Property.NiceName : this.Attribute.Title;

            title = "[" + this.ValueEntry.SmartValue.Count + "] " + title;

            expanded.Value = SirenixEditorGUI.Foldout(expanded.Value, title);

            if (SirenixEditorGUI.IconButton(EditorIcons.Plus))
            {
                this.ValueEntry.SmartValue.Add(new TElement());
                collectionChanged = true;
            }

            SirenixEditorGUI.EndBoxHeader();
        }
 private void DrawColoredHeader()
 {
     if (!errorTip.IsNullOrWhitespace())
     {
         SirenixEditorGUI.BeginBoxHeader();
         GUIHelper.PushColor(Color.magenta);
         GUILayout.Label(errorTip);
         GUIHelper.PopColor();
         SirenixEditorGUI.EndBoxHeader();
     }
 }
Example #6
0
        public void Draw()
        {
            SirenixEditorGUI.BeginBox();
            SirenixEditorGUI.BeginBoxHeader();
            {
                Rect rect = GUILayoutUtility.GetRect(100, 500, 20, 20).AddY(2);
                if (this.Icon != null)
                {
                    EditorIcons.X.Draw(rect.AlignLeft(16).SetHeight(16).AddX(2), this.Icon);
                    rect.xMin += 20;
                }

                GUI.Label(rect, this.Name);

                if (string.IsNullOrEmpty(this.registration.DocumentationUrl) == false)
                {
                    GUILayout.FlexibleSpace();

                    if (GUILayout.Button("Documentation", SirenixGUIStyles.MiniButton))
                    {
                        Help.BrowseURL(this.registration.DocumentationUrl);
                    }
                }
            }
            SirenixEditorGUI.EndBoxHeader();

            if (string.IsNullOrEmpty(this.registration.Description) == false)
            {
                GUILayout.Label(this.registration.Description);
            }

            SirenixEditorGUI.EndBox();
            GUILayout.Space(15);

            if (this.examples.Length > 0)
            {
                this.tabGroup.BeginGroup();
                foreach (var example in this.examples)
                {
                    var tab = this.tabGroup.RegisterTab(example.ExampleInfo.Name);
                    if (tab.BeginPage())
                    {
                        example.Draw(this.DrawCodeExample);
                    }
                    tab.EndPage();
                }
                this.tabGroup.EndGroup();
            }
            else
            {
                GUILayout.Label("No examples available.");
            }
        }
Example #7
0
        /// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyLayout(IPropertyValueEntry <T> entry, GUIContent label)
        {
            if (entry.ValueState == PropertyValueState.Reference)
            {
                var isToggled  = entry.Context.GetPersistent(this, "is_Toggled", false);
                var targetProp = entry.Property.Tree.GetPropertyAtPath(entry.TargetReferencePath);

                SirenixEditorGUI.BeginBox();

                SirenixEditorGUI.BeginBoxHeader();
                EditorGUILayout.BeginHorizontal();

                isToggled.Value = label != null?SirenixEditorGUI.Foldout(isToggled.Value, label)
                                      : SirenixEditorGUI.Foldout(isToggled.Value, GUIHelper.TempContent(""));

                if (targetProp.Parent == null)
                {
                    EditorGUILayout.LabelField("Reference to " + targetProp.Path, SirenixGUIStyles.RightAlignedGreyMiniLabel);
                }
                else
                {
                    EditorGUILayout.LabelField("Reference to " + targetProp.Path, SirenixGUIStyles.RightAlignedGreyMiniLabel);
                }

                EditorGUILayout.EndHorizontal();
                SirenixEditorGUI.EndBoxHeader();

                if (SirenixEditorGUI.BeginFadeGroup(UniqueDrawerKey.Create(entry.Property, this), isToggled.Value))
                {
                    //EditorGUI.indentLevel++;
                    //GUIHelper.PushGUIEnabled(true);

                    var  isInReference = targetProp.Context.GetGlobal("is_in_reference", false);
                    bool previous      = isInReference.Value;
                    isInReference.Value = true;

                    InspectorUtilities.DrawProperty(targetProp);

                    isInReference.Value = previous;

                    //GUIHelper.PopGUIEnabled();
                    //EditorGUI.indentLevel--;
                }
                SirenixEditorGUI.EndFadeGroup();
                SirenixEditorGUI.EndBox();
            }
            else
            {
                this.CallNextDrawer(entry.Property, label);
            }
        }
        protected override void DrawPort(GUIContent label)
        {
            SirenixEditorGUI.BeginBox();
            SirenixEditorGUI.BeginBoxHeader();
            isUnfolded.Value = SirenixEditorGUI.Foldout(isUnfolded.Value, label == null ? GUIContent.none : label);
            NodePortDrawerHelper.DrawPortHandle(NodePortInfo);
            SirenixEditorGUI.EndBoxHeader();

            if (SirenixEditorGUI.BeginFadeGroup(this, isUnfolded.Value))
            {
                CallNextDrawer(null);
            }
            SirenixEditorGUI.EndFadeGroup();

            SirenixEditorGUI.EndBox();
        }
        /// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyLayout(IPropertyValueEntry <ColorPalette> entry, GUIContent label)
        {
            var isEditing = entry.Property.Context.Get(this, "isEditing", false);

            entry.SmartValue.Name = entry.SmartValue.Name ?? "Palette Name";

            SirenixEditorGUI.BeginBox();
            {
                SirenixEditorGUI.BeginBoxHeader();
                {
                    GUILayout.Label(entry.SmartValue.Name);
                    GUILayout.FlexibleSpace();
                    if (SirenixEditorGUI.IconButton(EditorIcons.Pen))
                    {
                        isEditing.Value = !isEditing.Value;
                    }
                }
                SirenixEditorGUI.EndBoxHeader();

                if (entry.SmartValue.Colors == null)
                {
                    entry.SmartValue.Colors = new List <Color>();
                }

                if (SirenixEditorGUI.BeginFadeGroup(entry.SmartValue, entry, isEditing.Value))
                {
                    this.CallNextDrawer(entry.Property, null);
                }
                SirenixEditorGUI.EndFadeGroup();

                if (SirenixEditorGUI.BeginFadeGroup(entry.SmartValue, entry.SmartValue, isEditing.Value == false))
                {
                    Color col = default(Color);

                    var stretch = ColorPaletteManager.Instance.StretchPalette;
                    var size    = ColorPaletteManager.Instance.SwatchSize;
                    var margin  = ColorPaletteManager.Instance.SwatchSpacing;
                    ColorPaletteAttributeDrawer.DrawColorPaletteColorPicker(entry, entry.SmartValue, ref col, entry.SmartValue.ShowAlpha, stretch, size, 20, margin);
                }
                SirenixEditorGUI.EndFadeGroup();
            }
            SirenixEditorGUI.EndBox();
        }
    protected override void DrawPropertyLayout(GUIContent label)
    {
        GUIHelper.PushColor(new Color(this.Attribute.R, this.Attribute.G, this.Attribute.B, this.Attribute.A));
        SirenixEditorGUI.BeginBox();
        SirenixEditorGUI.BeginBoxHeader();
        GUIHelper.PopColor();

        this.isOpen = SirenixEditorGUI.Foldout(this.isOpen, label);
        SirenixEditorGUI.EndBoxHeader();

        if (SirenixEditorGUI.BeginFadeGroup(this, isOpen))
        {
            for (int i = 0; i < this.Property.Children.Count; i++)
            {
                this.Property.Children[i].Draw();
            }
        }
        SirenixEditorGUI.EndFadeGroup();
        SirenixEditorGUI.EndBox();
    }
        protected override void DrawPropertyLayout(GUIContent label)
        {
            GUIHelper.PushColor(new Color(this.Attribute.r, this.Attribute.g, this.Attribute.b, this.Attribute.a));
            SirenixEditorGUI.BeginBox();
            SirenixEditorGUI.BeginBoxHeader();
            GUIHelper.PopColor();

            this.isExpanded.Value = SirenixEditorGUI.Foldout(this.isExpanded.Value, label);
            SirenixEditorGUI.EndBoxHeader();

            if (SirenixEditorGUI.BeginFadeGroup(this, this.isExpanded.Value))
            {
                for (int i = 0; i < this.Property.Children.Count; i++)
                {
                    this.Property.Children[i].Draw();
                }
            }
            SirenixEditorGUI.EndFadeGroup();
            SirenixEditorGUI.EndBox();
        }
Example #12
0
        protected override void DrawPort(GUIContent label)
        {
            SirenixEditorGUI.BeginBox();
            SirenixEditorGUI.BeginBoxHeader();
            if (label != null)
            {
                EditorGUILayout.LabelField(label);
            }
            NodePortDrawerHelper.DrawPortHandle(NodePortInfo);
            SirenixEditorGUI.EndBoxHeader();

            if (DrawValue)
            {
                CallNextDrawer(null);
            }
            else
            {
                GUILayout.Space(-3.5f);
            }

            SirenixEditorGUI.EndBox();
        }
        /// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyGroupLayout(InspectorProperty property, FoldoutGroupAttribute attribute, GUIContent label)
        {
            var context = property.Context.Get <FoldoutGroupContext>(this, "FoldoutGroupContext", (FoldoutGroupContext)null);

            if (context.Value == null)
            {
                context.Value = new FoldoutGroupContext()
                {
                    IsVisible   = property.Context.GetPersistent <bool>(this, "IsVisible", attribute.HasDefinedExpanded ? attribute.Expanded : SirenixEditorGUI.ExpandFoldoutByDefault),
                    TitleHelper = new StringMemberHelper(property.ParentType, attribute.GroupName)
                };
            }

            if (context.Value.TitleHelper.ErrorMessage != null)
            {
                SirenixEditorGUI.ErrorMessageBox(context.Value.TitleHelper.ErrorMessage);
            }

            SirenixEditorGUI.BeginBox();
            {
                SirenixEditorGUI.BeginBoxHeader();
                var content = GUIHelper.TempContent(context.Value.TitleHelper.GetString(property));
                var rect    = GUILayoutUtility.GetRect(content, SirenixGUIStyles.Label);
                context.Value.IsVisible.Value = SirenixEditorGUI.Foldout(rect, context.Value.IsVisible.Value, content);
                SirenixEditorGUI.EndBoxHeader();

                if (SirenixEditorGUI.BeginFadeGroup(context, context.Value.IsVisible.Value))
                {
                    for (int i = 0; i < property.Children.Count; i++)
                    {
                        InspectorUtilities.DrawProperty(property.Children[i]);
                    }
                }

                SirenixEditorGUI.EndFadeGroup();
            }
            SirenixEditorGUI.EndBox();
        }
Example #14
0
        protected override void DrawPropertyLayout(GUIContent label)
        {
            GUIHelper.PushColor(new Color(this.Attribute.R, this.Attribute.G, this.Attribute.B, this.Attribute.A));
            SirenixEditorGUI.BeginBox();
            if (this.Attribute.ShowLabel == true)
            {
                SirenixEditorGUI.BeginBoxHeader();
                GUIHelper.PopColor();
                GUILayout.Label(label);
                SirenixEditorGUI.EndBoxHeader();
            }
            else
            {
                GUIHelper.PopColor();
            }

            for (int i = 0; i < this.Property.Children.Count; i++)
            {
                this.Property.Children[i].Draw();
            }

            SirenixEditorGUI.EndBox();
        }
        private void DrawElements(IPropertyValueEntry <TDictionary> entry, GUIContent label, Context context)
        {
            for (int i = context.Paging.StartIndex; i < context.Paging.EndIndex; i++)
            {
                var keyValuePairProperty = entry.Property.Children[i];
                var keyValuePairEntry    = (PropertyDictionaryElementValueEntry <TDictionary, TKey, TValue>)keyValuePairProperty.BaseValueEntry;

                Rect rect = SirenixEditorGUI.BeginListItem(false, context.ListItemStyle);
                {
                    if (context.AttrSettings.DisplayMode != DictionaryDisplayOptions.OneLine)
                    {
                        bool defaultExpanded;
                        switch (context.AttrSettings.DisplayMode)
                        {
                        case DictionaryDisplayOptions.CollapsedFoldout:
                            defaultExpanded = false;
                            break;

                        case DictionaryDisplayOptions.ExpandedFoldout:
                            defaultExpanded = true;
                            break;

                        default:
                            defaultExpanded = SirenixEditorGUI.ExpandFoldoutByDefault;
                            break;
                        }
                        var isExpanded = keyValuePairProperty.Context.Get(this, "Expanded", defaultExpanded);

                        SirenixEditorGUI.BeginBox();
                        SirenixEditorGUI.BeginBoxHeader();
                        {
                            if (keyValuePairEntry.HasTempInvalidKey)
                            {
                                GUIHelper.PushColor(Color.red);
                            }
                            var btnRect = GUIHelper.GetCurrentLayoutRect().AlignLeft(HeaderMargin.margin.left);
                            btnRect.y += 1;
                            GUILayout.BeginVertical(HeaderMargin);
                            GUIHelper.PushIsDrawingDictionaryKey(true);

                            GUIHelper.PushLabelWidth(10);

                            InspectorUtilities.DrawProperty(keyValuePairProperty.Children[0], null);

                            GUIHelper.PopLabelWidth();

                            GUIHelper.PopIsDrawingDictionaryKey();
                            GUILayout.EndVertical();
                            if (keyValuePairEntry.HasTempInvalidKey)
                            {
                                GUIHelper.PopColor();
                            }
                            isExpanded.Value = SirenixEditorGUI.Foldout(btnRect, isExpanded.Value, GUIHelper.TempContent("Key"));
                        }
                        SirenixEditorGUI.EndBoxHeader();

                        if (SirenixEditorGUI.BeginFadeGroup(isExpanded, isExpanded.Value))
                        {
                            InspectorUtilities.DrawProperty(keyValuePairProperty.Children[1], null);
                        }
                        SirenixEditorGUI.EndFadeGroup();

                        SirenixEditorGUI.EndBox();
                    }
                    else
                    {
                        GUILayout.BeginHorizontal();
                        GUILayout.BeginVertical(GUILayoutOptions.Width(context.KeyWidthOffset));
                        {
                            var keyProperty = keyValuePairProperty.Children[0];

                            if (keyValuePairEntry.HasTempInvalidKey)
                            {
                                GUIHelper.PushColor(Color.red);
                            }

                            if (context.AttrSettings.IsReadOnly)
                            {
                                GUIHelper.PushGUIEnabled(false);
                            }

                            GUIHelper.PushIsDrawingDictionaryKey(true);
                            GUIHelper.PushLabelWidth(10);

                            InspectorUtilities.DrawProperty(keyProperty, null);

                            GUIHelper.PopLabelWidth();
                            GUIHelper.PopIsDrawingDictionaryKey();

                            if (context.AttrSettings.IsReadOnly)
                            {
                                GUIHelper.PopGUIEnabled();
                            }

                            if (keyValuePairEntry.HasTempInvalidKey)
                            {
                                GUIHelper.PopColor();
                            }
                        }
                        GUILayout.EndVertical();
                        GUILayout.BeginVertical(OneLineMargin);
                        {
                            var valueEntry = keyValuePairProperty.Children[1];
                            var tmp        = GUIHelper.ActualLabelWidth;
                            EditorGUIUtility.labelWidth = 150;
                            InspectorUtilities.DrawProperty(valueEntry, null);
                            EditorGUIUtility.labelWidth = tmp;
                        }
                        GUILayout.EndVertical();
                        GUILayout.EndHorizontal();
                    }

                    if (entry.IsEditable && !context.AttrSettings.IsReadOnly && SirenixEditorGUI.IconButton(new Rect(rect.xMax - 24 + 5, rect.y + 2 + ((int)rect.height - 23) / 2, 14, 14), EditorIcons.X))
                    {
                        context.DictionaryHandler.Remove(context.DictionaryHandler.GetKey(0, i));
                        EditorApplication.delayCall += () => context.NewKewIsValid = null;
                        GUIHelper.RequestRepaint();
                    }
                }
                SirenixEditorGUI.EndListItem();
            }

            if (context.Paging.IsOnLastPage && entry.ValueState == PropertyValueState.CollectionLengthConflict)
            {
                SirenixEditorGUI.BeginListItem(false);
                GUILayout.Label(GUIHelper.TempContent("------"), EditorStyles.centeredGreyMiniLabel);
                SirenixEditorGUI.EndListItem();
            }
        }
Example #16
0
        void OnGUI()
        {
            if (EditorApplication.isCompiling)
            {
                Debug.Log("[行为窗口]脚本正在编译,所以自动关闭窗口!");
                Close();
                return;
            }

            SirenixEditorGUI.BeginBox();
            {
                SirenixEditorGUI.BeginBoxHeader();
                GUILayout.Label(_selfModelEditor.ModelName, _nameStyle);
                SirenixEditorGUI.EndBoxHeader();
                switch (_modelAction.ActState)
                {
                case ModelActionEditor.ActionState.New:
                    _actionName = EditorGUILayout.TextField("动作行为", _actionName);
                    break;

                case ModelActionEditor.ActionState.Inherit:
                case ModelActionEditor.ActionState.Override:
                    GUILayout.Label("动作行为");
                    GUILayout.Label(_actionName, EditorStyles.textField, GUILayout.Width(EditorGUIUtility.fieldWidth));
                    break;
                }

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("动画来源", GUILayout.Width(145));
                    if (GUILayout.Button("自己", _isFromOther ? SirenixGUIStyles.ButtonLeft : SirenixGUIStyles.ButtonLeftSelected))
                    {
                        _clipIndex   = -1;
                        _isFromOther = false;
                        _otherModel  = string.Empty;
                        _actClipList = _selfModelEditor.GetActionClips();
                    }
                    if (GUILayout.Button("其他", _isFromOther ? SirenixGUIStyles.ButtonRightSelected : SirenixGUIStyles.ButtonRight))
                    {
                        _isFromOther = true;
                        _clipIndex   = -1;
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (_isFromOther)
                {
                    GUIHelper.PushGUIEnabled(!string.IsNullOrEmpty(_otherModel));
                }
                EditorGUILayout.BeginHorizontal();
                {
                    _clipIndex = EditorGUILayout.Popup("动画文件", _clipIndex, _actClipList);
                    if (GUILayout.Button("X", GUILayout.Width(20), GUILayout.Height(EditorGUIUtility.singleLineHeight)))
                    {
                        _clipIndex = -1;
                    }
                }
                EditorGUILayout.EndHorizontal();
                if (_isFromOther)
                {
                    GUIHelper.PopGUIEnabled();
                }

                if (_isFromOther)
                {
                    EditorGUILayout.BeginHorizontal();
                    {
                        GUIHelper.PushColor(_color);
                        GUILayout.Label("其他角色", SirenixGUIStyles.BoldLabel, GUILayout.Width(147));
                        GUILayout.Label(_otherModel, EditorStyles.textField);
                        if (GUILayout.Button("修改", GUILayout.Width(45)))
                        {
                            var list = HomeConfigPreview.Instance.GetAllModelList();
                            list.Remove(_selfModelEditor.ModelName);
                            SimplePopupCreator.ShowDialog(list, (name) =>
                            {
                                _otherModel       = name;
                                _otherModelEditor = HomeConfigPreview.Instance.GetModelEditor(name);
                                _actClipList      = _otherModelEditor.GetActionClips();
                            });
                        }
                        if (GUILayout.Button("X", GUILayout.Width(20), GUILayout.Height(EditorGUIUtility.singleLineHeight)))
                        {
                            _otherModel = string.Empty;
                        }
                        GUIHelper.PopColor();
                    }
                    EditorGUILayout.EndHorizontal();
                }

                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("修改行为", GUILayout.Height(50)))
                    {
                        _modelAction.ActionName  = _actionName;
                        _modelAction.IsFromOther = _isFromOther;
                        bool hasClip = !(_clipIndex < 0 || _actClipList.Length == 0);
                        _modelAction.ActionClip     = hasClip ? _actClipList[_clipIndex] : string.Empty;
                        _modelAction.OtherModelName = _otherModel;

                        bool hasSame = false;
                        if (!_modelAction.IsSkillAction)
                        {
                            foreach (var item in _selfModelEditor.ModelActions)
                            {
                                if (item.ActionName.Equals(_actionName))
                                {
                                    hasSame = true;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            foreach (var item in _selfModelEditor.SkillActions)
                            {
                                if (item.ActionName.Equals(_actionName))
                                {
                                    hasSame = true;
                                    break;
                                }
                            }
                        }
                        if (!hasSame)
                        {
                            if (_result != null)
                            {
                                _result(_modelAction);
                            }
                            Close();
                        }
                        else
                        {
                            EditorUtility.DisplayDialog("动作配置错误", "动作名重复,请重新配置!!!", "确定");
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndHorizontal();
        }
Example #17
0
        protected override void OnGUI()
        {
            base.OnGUI();
            if (EditorApplication.isCompiling)
            {
                Debug.Log("[行为窗口]脚本正在编译,所以自动关闭窗口!");
                Close();
                return;
            }

            SirenixEditorGUI.BeginBox();
            {
                SirenixEditorGUI.BeginBoxHeader();
                GUILayout.Label(_selfActorEditor.ModelName, _nameStyle);
                SirenixEditorGUI.EndBoxHeader();
                bool isNew = _modelAction.ActState == ModelActionEditor.ActionState.New;
                if (!isNew)
                {
                    GUIHelper.PushGUIEnabled(false);
                }
                _actionName = EditorGUILayout.TextField("动作行为", _actionName);
                if (!isNew)
                {
                    GUIHelper.PushGUIEnabled(true);
                }


                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("其他角色", SirenixGUIStyles.BoldLabel, GUILayout.Width(142));
                    if (GUILayout.Button(_otherModelName, EditorStyles.textField))
                    {
                        var list = HomeConfig.Instance.GetAllActorList();
                        list.Remove(_selfActorEditor.ModelName);
                        SimplePopupCreator.ShowDialog(list, (name) => LoadOtherAction(name));
                    }
                    if (GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(20), GUILayout.Height(EditorGUIUtility.singleLineHeight)))
                    {
                        LoadSelfAction();
                    }
                }
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("动画文件", SirenixGUIStyles.BoldLabel, GUILayout.Width(142));
                    if (GUILayout.Button(_clipName, SirenixGUIStyles.Popup))
                    {
                        SimplePopupCreator.ShowDialog(_actClipList, (name) => _clipName = name);
                    }
                    if (GUILayout.Button("X", EditorStyles.miniButton, GUILayout.Width(20), GUILayout.Height(EditorGUIUtility.singleLineHeight)))
                    {
                        _clipName = string.Empty;
                    }
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();
                EditorGUILayout.BeginHorizontal();
                {
                    if (GUILayout.Button("修改行为", GUILayout.Height(50)))
                    {
                        if (_isAddAction)
                        {
                            bool hasSame = false;
                            if (!_modelAction.IsSkillAction)
                            {
                                hasSame = _selfActorEditor.GeneralActions.Exists(a => a.ActionName.Equals(_actionName));
                            }
                            else
                            {
                                hasSame = _selfActorEditor.SkillActions.Exists(a => a.ActionName.Equals(_actionName));
                            }

                            if (!hasSame)
                            {
                                _modelAction.ActionName     = _actionName;
                                _modelAction.ActionClip     = _clipName;
                                _modelAction.OtherModelName = _otherModelName;
                                _selfActorEditor.SetChildAction(_modelAction);
                                if (_result != null)
                                {
                                    _result(_modelAction);
                                }
                                Close();
                            }
                            else
                            {
                                EditorUtility.DisplayDialog("动作配置错误", "动作名重复,请重新配置!!!", "确定");
                            }
                        }
                        else
                        {
                            _modelAction.ActionName     = _actionName;
                            _modelAction.ActionClip     = _clipName;
                            _modelAction.OtherModelName = _otherModelName;
                            if (_result != null)
                            {
                                _result(_modelAction);
                            }
                            Close();
                        }
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndHorizontal();
        }
        /// <summary>
        /// Not yet documented.
        /// </summary>
        protected override void DrawPropertyLayout(IPropertyValueEntry <Color> entry, ColorPaletteAttribute attribute, GUIContent label)
        {
            SirenixEditorGUI.BeginIndentedHorizontal();
            {
                var hideLabel = label == null;
                if (hideLabel == false)
                {
                    GUILayout.Label(label, GUILayoutOptions.Width(EditorGUIUtility.labelWidth - 4).ExpandWidth(false));
                }
                else
                {
                    GUILayout.Space(5);
                }

                PropertyContext <PaletteContext> contextBuffer;
                if (entry.Context.Get(this, "ColorPalette", out contextBuffer))
                {
                    contextBuffer.Value = new PaletteContext()
                    {
                        PaletteIndex = 0,
                        CurrentName  = attribute.PaletteName,
                        ShowAlpha    = attribute.ShowAlpha,
                        Names        = ColorPaletteManager.Instance.ColorPalettes.Select(x => x.Name).ToArray(),
                    };

                    // Get persistent context value
                    if (attribute.PaletteName == null)
                    {
                        contextBuffer.Value.PersistentName = entry.Context.GetPersistent <string>(this, "ColorPaletteName", null);
                        var list = contextBuffer.Value.Names.ToList();
                        contextBuffer.Value.CurrentName = contextBuffer.Value.PersistentName.Value;

                        if (contextBuffer.Value.CurrentName != null && list.Contains(contextBuffer.Value.CurrentName))
                        {
                            contextBuffer.Value.PaletteIndex = list.IndexOf(contextBuffer.Value.CurrentName);
                        }
                    }
                    else
                    {
                        contextBuffer.Value.NameGetter = new StringMemberHelper(entry.ParentType, attribute.PaletteName);
                    }
                }

                var context = contextBuffer.Value;

                //var colorPaletDropDown = entry.Context.Get(this, "colorPalette", 0);
                //var currentName = entry.Context.Get(this, "currentName", attribute.PaletteName);
                //var showAlpha = entry.Context.Get(this, "showAlpha", attribute.ShowAlpha);
                //var names = ColorPaletteManager.Instance.GetColorPaletteNames();

                ColorPalette colorPalette;
                var          rect = EditorGUILayout.BeginHorizontal();
                {
                    rect.x    -= 3;
                    rect.width = 25;

                    entry.SmartValue = SirenixEditorGUI.DrawColorField(rect, entry.SmartValue, false, context.ShowAlpha);
                    bool openInEditorShown = false;
                    GUILayout.Space(28);
                    SirenixEditorGUI.BeginInlineBox();
                    {
                        if (attribute.PaletteName == null || ColorPaletteManager.Instance.ShowPaletteName)
                        {
                            SirenixEditorGUI.BeginBoxHeader();
                            {
                                if (attribute.PaletteName == null)
                                {
                                    var newValue = EditorGUILayout.Popup(context.PaletteIndex, context.Names, GUILayoutOptions.ExpandWidth(true));
                                    if (context.PaletteIndex != newValue)
                                    {
                                        context.PaletteIndex         = newValue;
                                        context.CurrentName          = context.Names[newValue];
                                        context.PersistentName.Value = context.CurrentName;
                                        GUIHelper.RemoveFocusControl();
                                    }
                                }
                                else
                                {
                                    GUILayout.Label(context.CurrentName);
                                    GUILayout.FlexibleSpace();
                                }
                                openInEditorShown = true;
                                if (SirenixEditorGUI.IconButton(EditorIcons.SettingsCog))
                                {
                                    ColorPaletteManager.Instance.OpenInEditor();
                                }
                            }
                            SirenixEditorGUI.EndBoxHeader();
                        }

                        if (attribute.PaletteName == null)
                        {
                            colorPalette = ColorPaletteManager.Instance.ColorPalettes.FirstOrDefault(x => x.Name == context.Names[context.PaletteIndex]);
                        }
                        else
                        {
                            colorPalette = ColorPaletteManager.Instance.ColorPalettes.FirstOrDefault(x => x.Name == context.NameGetter.GetString(entry));
                        }

                        if (colorPalette == null)
                        {
                            GUILayout.BeginHorizontal();
                            {
                                if (attribute.PaletteName != null)
                                {
                                    if (GUILayout.Button("Create color palette: " + context.NameGetter.GetString(entry)))
                                    {
                                        ColorPaletteManager.Instance.ColorPalettes.Add(new ColorPalette()
                                        {
                                            Name = context.NameGetter.GetString(entry)
                                        });
                                        ColorPaletteManager.Instance.OpenInEditor();
                                    }
                                }
                            }
                            GUILayout.EndHorizontal();
                        }
                        else
                        {
                            context.CurrentName = colorPalette.Name;
                            context.ShowAlpha   = attribute.ShowAlpha && colorPalette.ShowAlpha;
                            if (openInEditorShown == false)
                            {
                                GUILayout.BeginHorizontal();
                            }
                            var color   = entry.SmartValue;
                            var stretch = ColorPaletteManager.Instance.StretchPalette;
                            var size    = ColorPaletteManager.Instance.SwatchSize;
                            var margin  = ColorPaletteManager.Instance.SwatchSpacing;
                            if (DrawColorPaletteColorPicker(entry, colorPalette, ref color, colorPalette.ShowAlpha, stretch, size, 20, margin))
                            {
                                entry.SmartValue = color;
                                //entry.ApplyChanges();
                            }
                            if (openInEditorShown == false)
                            {
                                GUILayout.Space(4);
                                if (SirenixEditorGUI.IconButton(EditorIcons.SettingsCog))
                                {
                                    ColorPaletteManager.Instance.OpenInEditor();
                                }
                                GUILayout.EndHorizontal();
                            }
                        }
                    }
                    SirenixEditorGUI.EndInlineBox();
                }
                EditorGUILayout.EndHorizontal();
            }

            SirenixEditorGUI.EndIndentedHorizontal();
        }
        /// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyLayout(IPropertyValueEntry <T> entry, GUIContent label)
        {
            var isToggled = entry.Property.Context.GetPersistent <bool>(this, "Toggled", SirenixEditorGUI.ExpandFoldoutByDefault);

            if (entry.ValueState == PropertyValueState.NullReference)
            {
                GUIHelper.PushGUIEnabled(GUI.enabled && entry.IsEditable);

                try
                {
                    if (typeof(UnityEngine.Object).IsAssignableFrom(entry.TypeOfValue))
                    {
                        entry.WeakSmartValue = label == null?
                                               EditorGUILayout.ObjectField((UnityEngine.Object) entry.WeakSmartValue, entry.TypeOfValue, entry.Property.Info.GetAttribute <AssetsOnlyAttribute>() == null) :
                                                   EditorGUILayout.ObjectField(label, (UnityEngine.Object)entry.WeakSmartValue, entry.TypeOfValue, entry.Property.Info.GetAttribute <AssetsOnlyAttribute>() == null);
                    }
                    else
                    {
                        if (entry.SerializationBackend == SerializationBackend.Unity && entry.IsEditable && Event.current.type == EventType.Layout)
                        {
                            Debug.LogError("Unity-backed value is null. This should already be fixed by the FixUnityNullDrawer!");
                        }
                        else
                        {
                            bool drawWithBox  = ShouldDrawReferenceObjectPicker(entry);
                            bool contextValue = isToggled.Value;

                            if (drawWithBox)
                            {
                                SirenixEditorGUI.BeginBox();
                                SirenixEditorGUI.BeginBoxHeader();
                                {
                                    DrawObjectField(entry, label, ref contextValue);
                                }
                                SirenixEditorGUI.EndBoxHeader();
                                SirenixEditorGUI.EndBox();
                            }
                            else
                            {
                                DrawObjectField(entry, label, ref contextValue, false);
                            }

                            isToggled.Value = contextValue;
                        }
                    }
                }
                finally
                {
                    GUIHelper.PopGUIEnabled();
                }
            }
            else
            {
                if (ShouldDrawReferenceObjectPicker(entry))
                {
                    SirenixEditorGUI.BeginBox();
                    SirenixEditorGUI.BeginBoxHeader();
                    {
                        GUIHelper.PushGUIEnabled(GUI.enabled && entry.IsEditable);
                        bool contextValue = isToggled.Value;
                        DrawObjectField(entry, label, ref contextValue);
                        isToggled.Value = contextValue;
                        GUIHelper.PopGUIEnabled();
                    }
                    SirenixEditorGUI.EndBoxHeader();
                    if (SirenixEditorGUI.BeginFadeGroup(UniqueDrawerKey.Create(entry, this), isToggled.Value))
                    {
                        this.CallNextDrawer(entry.Property, null);
                    }
                    SirenixEditorGUI.EndFadeGroup();
                    SirenixEditorGUI.EndBox();
                }
                else
                {
                    this.CallNextDrawer(entry.Property, label);
                }
            }

            var objectPicker = ObjectPicker.GetObjectPicker(entry, entry.BaseValueType);

            if (objectPicker.IsReadyToClaim)
            {
                var obj = objectPicker.ClaimObject();
                entry.Property.Tree.DelayActionUntilRepaint(() => entry.WeakSmartValue = obj);
            }
        }