private static void Apply(IEnumerable <ControlTemplate> controlTemplates, Layout child) { var controlTemplate = controlTemplates.SingleOrDefault(template => template.Target == child.GetType().Name); if (controlTemplate != null) { child.AddChild(controlTemplate.ApplyTo(child)); } }
public void RegisterChild(IReactComponent child, int index = -1) { if (child is IEditorComponent <VisualElement> u) { if (index >= 0) { Element.Insert(index, u.Element); Children.Insert(index, u); Layout.Insert(index, u.Layout); } else { Element.Add(u.Element); Children.Add(u); Layout.AddChild(u.Layout); } } }
public void RegisterChild(IReactComponent child, int index = -1) { if (child is ReactComponent u) { u.RectTransform.SetParent(Container, false); if (index >= 0) { u.RectTransform.SetSiblingIndex(index); Children.Insert(index, u); Layout.Insert(index, u.Layout); } else { Children.Add(u); Layout.AddChild(u.Layout); } } }