예제 #1
0
            protected UComponent GetComponent(uGUIBuilder context, IScWidget widget)
            {
                var entry = context.GetEntry(widget);

                if (entry.Obj == null)
                {
                    return(default);
예제 #2
0
            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);
            }
예제 #3
0
 protected virtual void Prepare(uGUIBuilder context, T widget, UComponent component)
 {
 }
예제 #4
0
 protected override void Prepare(uGUIBuilder context, T widget)
 {
     Prepare(context, widget, Create(context, widget));
 }