Example #1
0
        public virtual void SetPos(IComponentGroup freeUI, float x, float y, int width, int height, int relative, int parent)
        {
            this.relative = relative;
            this.parent   = parent;
            this.group    = freeUI;
            this.x        = x;
            this.y        = y;
            this.width    = width;
            this.height   = height;


            var control = ToUI();

            control.width = width;

            control.height = height;


            float startX = 0;

            float startY = 0;

            var rW = 0;

            var rH = 0;

            if (parent <= 0)
            {
                rW = Screen.width;
                rH = Screen.height;
            }
            else
            {
                var fc = freeUI.GetComponent(parent - 1);
                rW = fc.ToUI().width;
                rH = fc.ToUI().height;

                startX = fc.ToUI().x;
                startY = fc.ToUI().y;
            }

            SetXy(control, relative, startX, startY, rW, rH, x, y);
            if (freeUI is FreeListComponent)
            {
                control.y = y;
            }
        }
Example #2
0
        public void NewSetPos(IComponentGroup freeUI, float x, float y, int width, int height, int relative, int parent)
        {
            this.group    = freeUI;
            this.relative = relative;
            this.parent   = parent;
            this.group    = freeUI;
            this.x        = x;
            this.y        = y;
            this.width    = width;
            this.height   = height;

            RectTransform parentTransform = null;

            if (parent > 0)
            {
                parentTransform = freeUI.GetComponent(parent - 1).ToUI().gameObject.GetComponent <RectTransform>();
            }
            FreeLayoutConverter.Convert(relative, x, y, width, height,
                                        _uiObject.gameObject.GetComponent <RectTransform>(), parentTransform);
        }