protected UComponent GetComponent(uGUIBuilder context, IScWidget widget) { var entry = context.GetEntry(widget); if (entry.Obj == null) { return(default);
protected UComponent Create(uGUIBuilder context, IScWidget widget) { var parent = context.GetEntry(widget.Parent); var entry = context.GetEntry(widget); entry.Obj = new GameObject(widget.Name ?? widget.GetType().Name); entry.ChildRoot = entry.Obj.AddComponent <RectTransform>(); entry.ChildRoot.anchorMax = new Vector2(0, 1); entry.ChildRoot.anchorMin = new Vector2(0, 1); if (parent != null && parent.ChildRoot != null) { entry.Obj.transform.SetParent(parent.ChildRoot); } var ret = entry.Obj.AddComponent <UComponent>(); entry.Component = ret; return(ret); }
protected virtual void Prepare(uGUIBuilder context, T widget, UComponent component) { }
protected override void Prepare(uGUIBuilder context, T widget) { Prepare(context, widget, Create(context, widget)); }