Esempio n. 1
0
        public override int getTopLeftY()
        {
            if (percentTop != -1)
            {
                return((int)(percentTop * Relative.getHeight() + Relative.getTopLeftY()));
            }
            else if (percentBottom != -1)
            {
                return((int)(Relative.getBottomRightY() - percentBottom * Relative.getHeight() - getHeight()));
            }
            else if (bottom != -1)
            {
                return((int)(Relative.getBottomRightY() - bottom - getHeight()));
            }

            return((int)(top + Relative.getTopLeftY()));
        }
        public override int getTopLeftY()
        {
            if (Relative.GetType() == typeof(ViewScroll))
            {
                return(base.getTopLeftY());
            }

            if (percentTop != -1)
            {
                return((int)(percentTop * Relative.getHeight() + Relative.getTopLeftY()));
            }
            else if (percentBottom != -1)
            {
                return((int)(Relative.getBottomRightY() - percentBottom * Relative.getHeight() - getHeight()));
            }
            else if (bottom != -1)
            {
                return((int)(Relative.getBottomRightY() - bottom - getHeight()));
            }

            return((int)(top + Relative.getTopLeftY()));
        }
Esempio n. 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();
        }