Esempio n. 1
0
            protected UComponent GetComponent(uGUIBuilder context, IScWidget widget)
            {
                var entry = context.GetEntry(widget);

                if (entry.Obj == null)
                {
                    return(default);
Esempio n. 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);
            }