コード例 #1
0
        public override int getTopLeftX()
        {
            if (percentLeft != -1)
            {
                return((int)(percentLeft * Relative.getWidth() + Relative.getTopLeftX()));
            }
            else if (percentRight != -1)
            {
                return((int)(Relative.getBottomRightX() - percentRight * Relative.getWidth() - getWidth()));
            }
            else if (right != -1)
            {
                return((int)(Relative.getBottomRightX() - right - getWidth()));
            }

            return((int)(left + Relative.getTopLeftX()));
        }
コード例 #2
0
        public override int getTopLeftX()
        {
            if (Relative.GetType() == typeof(ViewScroll))
            {
                return(base.getTopLeftX());
            }

            if (percentLeft != -1)
            {
                return((int)(percentLeft * Relative.getWidth() + Relative.getTopLeftX()));
            }
            else if (percentRight != -1)
            {
                return((int)(Relative.getBottomRightX() - percentRight * Relative.getWidth() - getWidth()));
            }
            else if (right != -1)
            {
                return((int)(Relative.getBottomRightX() - right - getWidth()));
            }

            return((int)(left + Relative.getTopLeftX()));
        }
コード例 #3
0
        public override void paint()
        {
            GUI.contentColor = color;

            int bottomX = 0;
            int bottomY = 0;

            for (var i = 0; i < Components.ToArray().Length; i++)
            {
                ViewComponent Component = Components.ToArray()[i];
                if (Component.getBottomRightX() > bottomX)
                {
                    bottomX = Component.getBottomRightX();
                }

                if (Component.getBottomRightY() > bottomY)
                {
                    bottomY = Component.getBottomRightY();
                }
            }

            ScrollVector = GUI.BeginScrollView(
                new Rect(this.getTopLeftX(), this.getTopLeftY(), this.getWidth(), this.getHeight()),
                ScrollVector,
                new Rect(0, 0, bottomX, bottomY),
                HighLogic.Skin.horizontalScrollbar,
                HighLogic.Skin.verticalScrollbar
                );

            for (var i = 0; i < Components.ToArray().Length; i++)
            {
                ViewComponent Component = Components.ToArray()[i];
                Component.paint();
            }

            GUI.EndScrollView();
        }