示例#1
0
        protected override void DrawUnifiedElementInternal(Rect rect, T old_value)
        {
            if (EditorGUIExtensions.DropdownButton(GetElementRect(), old_value.ToStringEX("None")))
            {
                List <T> options = GetOptions()
                                   .Sort(o => o.ToStringEX())
                                   .ToList();

                GenericMenuExtensions.Create <T>(options, o => GetProperty().SetContentValues(o))
                .DropDown(GetElementRect());
            }
        }
示例#2
0
        protected override void DrawUnifiedElementInternal(Rect rect, T old_value)
        {
            string old_text = old_value.ToStringEX("None");
            string new_text = EditorGUI.DelayedTextField(GetElementRect(), old_text);

            if (new_text != old_text)
            {
                List <T> options = GetOptions(new_text)
                                   .Sort(o => o.ToStringEX().Length)
                                   .ToList();

                if (options.HasOnlyOne())
                {
                    GetProperty().SetContentValues(options.GetOnly());
                }
                else
                {
                    GenericMenuExtensions.Create <T>(options.Prepend(default(T)), o => GetProperty().SetContentValues(o))
                    .DropDown(GetElementRect());
                }
            }
        }