Example #1
0
 public EditProperty ForceProperty(string path)
 {
     return(EditProperty.New(
                this,
                target_type.GetVariableByPath(path)
                .AssertNotNull(() => new MissingFieldException("No property exists for type " + GetTargetType() + " and path " + path))
                ));
 }
Example #2
0
 public IEnumerable <EditProperty> GetParameters()
 {
     return(function.GetParameters().ConvertWithIndex(
                (i, p) => EditProperty.New(
                    STATIC_TARGET,
                    new Variable_Element(arguments, i).GetOverridenTypeAndNameVariable(p.Value, p.Key)
                    )
                ));
 }
Example #3
0
 public IEnumerable <EditProperty> GetAllPropertys()
 {
     return(target_type.GetFilteredInstanceFields(
                Filterer_Utility.Any(
                    Filterer_FieldInfo.HasCustomAttributeOfType <SerializeField>(),
                    Filterer_FieldInfo.HasCustomAttributeOfType <SerializeFieldEX>(),
                    Filterer_FieldInfo.IsPublicField(),
                    Filterer_FieldInfo.IsBackingFieldForPublicSetAndGet()
                    )
                ).Convert(f => f.CreateVariable())
            .Convert(v => EditProperty.New(this, v)));
 }
Example #4
0
 static public EditorGUIElement CreateBlockLabeledEditorGUIElement(this EditProperty item)
 {
     return(item.CreateEditorGUIElement().LabelWithGUIContentBlock(item.CreateGUIContentLabel()));
 }
Example #5
0
 public EditorGUIElement_UnhandledEditProperty(EditProperty p)
 {
     property = p;
 }
Example #6
0
        static public EditorGUIElement CreateBestEditorGUIElementForType(this Type item, EditProperty property)
        {
            EditorGUIElement element;

            element = item.CreateExplicitEditorGUIElementForType(property);
            if (element != null)
            {
                return(element);
            }

            if (item.IsTypicalIEnumerable())
            {
                return(new EditorGUIElement_Complex_EditPropertyArray_Generic((EditProperty_Array)property));
            }

            return(new EditorGUIElement_Composite_EditPropertySingleValue_Generic((EditProperty_Single_Value)property));
        }
Example #7
0
 public int GetIndexOfElement(EditProperty element)
 {
     return(elements_by_index.Values
            .FindFirst(e => e.GetProperty() == element)
            .IfNotNull(e => e.GetIndex(), -1));
 }
Example #8
0
        protected override EditorGUIElement PushState()
        {
            int number_elements;
            EditProperty_Array property = GetEditPropertyArray();
            EditorGUIElement_Container_Auto container = new EditorGUIElement_Container_Auto_Simple_VerticalStrip();

            Type array_type = property.GetPropertyType().GetIEnumerableType();

            if (property.TryGetNumberElements(out number_elements))
            {
                EditorGUIElement_Container_Flow_Line length_strip = container.AddChild(new EditorGUIElement_Container_Flow_Line())
                                                                    .LabelWithGUIContent("Length");

                length_strip.AddWeightedChild(0.6f, new EditorGUIElement_EditPropertyArray_ArraySize(property));
                length_strip.AddWeightedChild(0.4f, new EditorGUIElement_Button("+", delegate() {
                    property.InsertElement(0);
                }));

                if (number_elements <= 0)
                {
                    if (array_type.CanBeTreatedAs <UnityEngine.Object>())
                    {
                        length_strip.AddWeightedChild(0.6f, new EditorGUIElement_DropZone("Drag + Drop",
                                                                                          array_type,
                                                                                          l => property.ForceContentValues(l)
                                                                                          ));
                    }
                }
                else
                {
                    for (int i = 0; i < number_elements; i++)
                    {
                        EditProperty sub_property = property.GetElement(i);

                        EditorGUIElement control = sub_property.CreateEditorGUIElement();
                        EditorGUIElement_Container_Auto_Simple_HorizontalStrip buttons = new EditorGUIElement_Container_Auto_Simple_HorizontalStrip();

                        buttons.AddChild(new EditorGUIElement_Button("+v", delegate() {
                            property.InsertElementAfter(sub_property);
                        }));
                        buttons.AddChild(new EditorGUIElement_Button("+^", delegate() {
                            property.InsertElementBefore(sub_property);
                        }));
                        buttons.AddChild(new EditorGUIElement_Button("-", delegate() {
                            property.RemoveElement(sub_property);
                        }));

                        container.AddChild(new EditorGUIElement_Sideboard(
                                               new EditorGUIFlowElement(control, EditorGUIElementDimension.Weighted(1.0f)),
                                               new EditorGUIFlowElement(buttons, EditorGUIElementDimension.Fixed(100.0f))
                                               )).LabelWithIndex(property, i, () => ForceRecreation());
                    }
                }
            }
            else
            {
                container.AddChild(new EditorGUIElement_Text("--Disabled(Array lengths are not unified)--"));
            }

            return(container);
        }
Example #9
0
        static public EditorGUIElement CreateExplicitEditorGUIElementForType(this Type item, EditProperty property)
        {
            Type element_type = ForTypes.GetBestTypeForType <EditorGUIElementForTypeAttribute>(item);

            if (element_type != null)
            {
                return(element_type.CreateBestInstance <EditorGUIElement>(property, item) ??
                       element_type.CreateBestInstance <EditorGUIElement>(property));
            }

            return(null);
        }
Example #10
0
 static public void MoveElement(this EditProperty_Array item, EditProperty element, int dst)
 {
     item.MoveElement(item.GetIndexOfElement(element), dst);
 }
Example #11
0
 static public void RemoveElement(this EditProperty_Array item, EditProperty element)
 {
     item.RemoveElement(item.GetIndexOfElement(element));
 }
Example #12
0
 static public void InsertElementAfter(this EditProperty_Array item, EditProperty element)
 {
     item.InsertElement(item.GetIndexOfElement(element) + 1);
 }
Example #13
0
 static public void InsertElementBefore(this EditProperty_Array item, EditProperty element)
 {
     item.InsertElement(item.GetIndexOfElement(element));
 }
Example #14
0
 public EditPropertyArrayElement(EditTarget t, Variable v, int i)
 {
     variable = v.GetVariableElement(i);
     property = EditProperty.New(t, variable);
 }