Exemple #1
0
        public override void AddChild(EditorGUIElement child)
        {
            if (child != null)
            {
                elements.Add(child);

                Invalidate();
                child.SetParent(this);
            }
        }
Exemple #2
0
        public override bool RemoveChild(EditorGUIElement child)
        {
            if (flow_elements.RemoveFirst(e => e.GetElement() == child))
            {
                Invalidate();

                return(true);
            }

            return(false);
        }
Exemple #3
0
        public override bool RemoveChild(EditorGUIElement child)
        {
            if (elements.Remove(child))
            {
                Invalidate();

                return(true);
            }

            return(false);
        }
Exemple #4
0
        protected override void InitializeInternal()
        {
            if (element == null)
            {
                element = CreateElement();
                element.SetParent(this);

                element.AddAttachments(GetAttachments());
            }

            element.Initialize();
        }
Exemple #5
0
        protected override void InitializeInternal()
        {
            if (NeedRecreation())
            {
                element = Recreate();
                if (element != null)
                {
                    element.SetParent(this);
                    element.AddAttachments(GetAttachments());
                }
            }

            element.IfNotNull(e => e.Initialize());
        }
Exemple #6
0
        public override bool PrepareElementForAttachment(EditorGUIElement element)
        {
            element.RemoveAttachments(delegate(EditorGUIElementAttachment attachment) {
                EditorGUIElementAttachment_Singular cast;

                if (attachment.Convert <EditorGUIElementAttachment_Singular>(out cast))
                {
                    if (cast.singular_id == singular_id)
                    {
                        return(true);
                    }
                }

                return(false);
            });

            return(true);
        }
Exemple #7
0
 public void SetParent(EditorGUIElement p)
 {
     parent = p;
 }
Exemple #8
0
 public override bool RemoveChild(EditorGUIElement child)
 {
     return(row.Remove(child));
 }
Exemple #9
0
        static public EditorGUIElement InitilizeAndGet(this EditorGUIElement item)
        {
            item.Initialize();

            return(item);
        }
Exemple #10
0
 public abstract bool RemoveChild(EditorGUIElement child);
Exemple #11
0
 public EditorGUIFlowElement(EditorGUIElement e, EditorGUIElementDimension d)
 {
     element   = e;
     dimension = d;
 }
Exemple #12
0
 public void SetParent(EditorGUIElement p)
 {
     element.SetParent(p);
 }
Exemple #13
0
 public bool Remove(EditorGUIElement element)
 {
     return(elements.RemoveFirst(e => e.GetElement() == element));
 }
Exemple #14
0
 public abstract void AddChild(EditorGUIElement child);
Exemple #15
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);
        }
Exemple #16
0
 public virtual bool PrepareElementForAttachment(EditorGUIElement element)
 {
     return(true);
 }
Exemple #17
0
        public EditorGUIView(EditorGUIElement e)
        {
            element = e;

            next_draw_id = 1;
        }
Exemple #18
0
 static public T GetAttachment <T>(this EditorGUIElement item)
 {
     return(item.GetAttachments <T>().GetFirst());
 }
Exemple #19
0
 static public IEnumerable <T> GetAttachments <T>(this EditorGUIElement item)
 {
     return(item.GetAttachments().Convert <EditorGUIElementAttachment, T>());
 }