Esempio n. 1
0
        public int GetPanelAnchorOffset(UXAnchorSection anchorSection)
        {
            int     result  = 0;
            UIPanel uIPanel = this.GetRootPanel();

            if (uIPanel != null)
            {
                switch (anchorSection)
                {
                case UXAnchorSection.Top:
                    result = uIPanel.topAnchor.absolute;
                    break;

                case UXAnchorSection.Left:
                    result = uIPanel.leftAnchor.absolute;
                    break;

                case UXAnchorSection.Bottom:
                    result = uIPanel.bottomAnchor.absolute;
                    break;

                case UXAnchorSection.Right:
                    result = uIPanel.rightAnchor.absolute;
                    break;
                }
            }
            return(result);
        }
Esempio n. 2
0
        public int GetLabelAnchorOffset(UXAnchorSection anchorSection)
        {
            int     result    = 0;
            UILabel nGUILabel = this.component.NGUILabel;

            if (nGUILabel == null)
            {
                return(result);
            }
            switch (anchorSection)
            {
            case UXAnchorSection.Top:
                result = nGUILabel.topAnchor.absolute;
                break;

            case UXAnchorSection.Left:
                result = nGUILabel.leftAnchor.absolute;
                break;

            case UXAnchorSection.Bottom:
                result = nGUILabel.bottomAnchor.absolute;
                break;

            case UXAnchorSection.Right:
                result = nGUILabel.rightAnchor.absolute;
                break;
            }
            return(result);
        }
Esempio n. 3
0
        public void SetLabelAnchorOffset(UXAnchorSection anchorSection, int offsetValue)
        {
            UILabel nGUILabel = this.component.NGUILabel;

            if (nGUILabel == null)
            {
                return;
            }
            GameObject gameObject = null;

            if (nGUILabel.topAnchor.target != null)
            {
                gameObject = nGUILabel.topAnchor.target.gameObject;
            }
            else if (nGUILabel.leftAnchor.target != null)
            {
                gameObject = nGUILabel.leftAnchor.target.gameObject;
            }
            else if (nGUILabel.bottomAnchor.target != null)
            {
                gameObject = nGUILabel.bottomAnchor.target.gameObject;
            }
            else if (nGUILabel.rightAnchor.target != null)
            {
                gameObject = nGUILabel.rightAnchor.target.gameObject;
            }
            if (gameObject == null)
            {
                return;
            }
            int left   = nGUILabel.leftAnchor.absolute;
            int right  = nGUILabel.rightAnchor.absolute;
            int top    = nGUILabel.topAnchor.absolute;
            int bottom = nGUILabel.bottomAnchor.absolute;

            switch (anchorSection)
            {
            case UXAnchorSection.Top:
                top = offsetValue;
                break;

            case UXAnchorSection.Left:
                left = offsetValue;
                break;

            case UXAnchorSection.Bottom:
                bottom = offsetValue;
                break;

            case UXAnchorSection.Right:
                right = offsetValue;
                break;
            }
            nGUILabel.SetAnchor(gameObject, left, bottom, right, top);
        }