Example #1
0
        public override void Draw()
        {
            if (!RPGSettings.ShowUI)
            {
                return;
            }

            new UIRectangle(new Point(0, 0), new Size(UI.WIDTH, UI.HEIGHT), Color.FromArgb(180, 80, 80, 80)).Draw();
            new UIRectangle(new Point(0, (int)(UI.HEIGHT * 0.30f)), new Size(UI.WIDTH, 220 + PanelBorder * 2), Color.FromArgb(240, 28, 28, 28)).Draw();
            new UIText(_caption, new Point(UI.WIDTH / 2, (int)(UI.HEIGHT * 0.30f) - 80), 1.4f, Color.FromArgb(240, 200, 200, 200), Font.Monospace, true).Draw();
            new UIRectangle(new Point(UI.WIDTH - 212, UI.HEIGHT - 23), new Size(207, 14), Color.FromArgb(205, 8, 8, 8)).Draw();
            new UIText("[backspace] back [5] choose option [num4] left [num6] right", new Point(UI.WIDTH - 210, UI.HEIGHT - 23), 0.18f, Color.White, 0, false).Draw();


            var items         = _panels.Count;
            var startingPoint = new Point(UI.WIDTH / 2 - (items * (PanelWidth + 10)) / 2, (int)(UI.HEIGHT * 0.30f) + PanelBorder);

            for (int i = 0; i < _panels.Count; i++)
            {
                var panel      = _panels[i];
                var panelColor = panel == SelectedPanel ? panel.Color : Color.FromArgb(panel.Color.A / 2, panel.Color.R, panel.Color.G, panel.Color.B);
                new UIRectangle(new Point(startingPoint.X + (i * (PanelWidth + PanelBorder / 2)), startingPoint.Y), new Size(PanelWidth, PanelHeight), panelColor).Draw();
                var spriteColor = panel == SelectedPanel ? panel.Sprite.Color : Color.FromArgb(panel.Sprite.Color.A / 3, (panel.Sprite.Color.R + 155) / 2, (panel.Sprite.Color.G + 155) / 2, (panel.Sprite.Color.B + 155) / 2);;
                panel.Sprite.Draw(new Point(startingPoint.X + (i * (PanelWidth + PanelBorder / 2)), startingPoint.Y), PanelWidth, PanelHeight, spriteColor);
                var color = panel == SelectedPanel ? Color.White : Color.Gray;
                new UIText(panel.Caption, new Point(startingPoint.X + (i * (PanelWidth + PanelBorder / 2)) + PanelWidth / 2 + 2, startingPoint.Y + PanelHeight - 40 + 2), 0.8f, Color.FromArgb(60, 2, 2, 2), Font.Monospace, true).Draw();
                new UIText(panel.Caption, new Point(startingPoint.X + (i * (PanelWidth + PanelBorder / 2)) + PanelWidth / 2, startingPoint.Y + PanelHeight - 40), 0.8f, color, Font.Monospace, true).Draw();
            }


            new UIRectangle(new Point(UI.WIDTH / 2 - 190, (int)(UI.HEIGHT * 0.30f) + PanelBorder * 2 + PanelHeight + 15), new Size(380, 70), Color.FromArgb(120, 55, 55, 55)).Draw();
            var descPoint = new Point(UI.WIDTH / 2, (int)(UI.HEIGHT * 0.30f) + PanelBorder * 2 + PanelHeight + 15);
            var lines     = RPGUI.FormatText(SelectedPanel.Description, 75);

            for (int i = 0; i < lines.Length; i++)
            {
                new UIText(lines[i], new Point(descPoint.X, descPoint.Y + (i * 10)), 0.22f, Color.White, 0, true).Draw();
            }

            var point = new Point(UI.WIDTH / 2 - 190, (int)(UI.HEIGHT * 0.30f) + PanelBorder * 2 + PanelHeight + 15) + new Size(0, 74);

            for (int i = 0; i < SelectedPanel.ExtraInfo.Length; i++)
            {
                new UIRectangle(new Point(point.X, point.Y + (i * 18)), new Size(380, 14), Color.FromArgb(120, 55, 55, 55)).Draw();
                new UIText(SelectedPanel.ExtraInfo[i], new Point(UI.WIDTH / 2, point.Y + (i * 18)), 0.22f, Color.WhiteSmoke, 0, true).Draw();
            }
        }
Example #2
0
        public override void Draw(Size offset)
        {
            if (!RPGSettings.ShowUI)
            {
                return;
            }

            if (ExtendWindowHeight)
            {
                new UIRectangle(new Point(offset.Width, offset.Height - UI.HEIGHT), new Size(300, UI.HEIGHT), UnselectedItemColor).Draw();
            }

            var container = new UIContainer(new Point(UI.WIDTH / 2 - 300, UI.HEIGHT - 150), new Size(600, 140));

            new UIRectangle(new Point(0, UI.HEIGHT - 150), new Size(UI.WIDTH, 140), Color.FromArgb(70, 8, 8, 8)).Draw();
            var lines = RPGUI.FormatText(Caption, 90);

            container.Items.Add(new UIText(lines[0], new Point(301, 5 + 1), 0.42f, Color.Black, Font.ChaletComprimeCologne, true));
            container.Items.Add(new UIText(lines[0], new Point(300, 5), 0.42f, Color.White, Font.ChaletComprimeCologne, true));
            if (lines.Length > 1)
            {
                container.Items.Add(new UIText(lines[1], new Point(301, 25 + 1), 0.42f, Color.Black, Font.ChaletComprimeCologne, true));
                container.Items.Add(new UIText(lines[1], new Point(300, 25), 0.42f, Color.White, Font.ChaletComprimeCologne, true));
            }


            for (int i = 0; i < 4; i++)
            {
                if (i > Items.Count - 1)
                {
                    break;
                }

                var item         = Items[i];
                var color        = SelectedIndex == i ? Color.Orange : Color.White;
                var guessedWidth = (int)(6f * item.Caption.Length);
                guessedWidth -= item.Caption.Count(x => x == 'i' || x == 'l' || x == '!' || x == '\'' || x == ',' || x == '.' || x == 'I') * 4;
                guessedWidth -= item.Caption.Count(x => x == ' ') * 2;
                var pos = 268 - 10 - guessedWidth;
                switch (i)
                {
                case 3:
                    container.Items.Add(new UIText(item.Caption, new Point(pos + 1, 56), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(pos, 55), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;

                case 0:
                    container.Items.Add(new UIText(item.Caption, new Point(341, 56), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(340, 55), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;

                case 2:
                    container.Items.Add(new UIText(item.Caption, new Point(pos + 1, 86), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(pos, 85), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;

                case 1:
                    container.Items.Add(new UIText(item.Caption, new Point(341, 86), 0.4f, Color.FromArgb(180, 0, 0, 0), Font.ChaletComprimeCologne, false));
                    container.Items.Add(new UIText(item.Caption, new Point(340, 85), 0.4f, color, Font.ChaletComprimeCologne, false));
                    break;
                }
            }

            container.Draw();

            var colorA = SelectedIndex == 3 ? Color.Orange : Color.SteelBlue;
            var colorB = SelectedIndex == 0 ? Color.Orange : Color.SteelBlue;
            var colorC = SelectedIndex == 2 ? Color.Orange : Color.SteelBlue;
            var colorD = SelectedIndex == 1 ? Color.Orange : Color.SteelBlue;

            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 - 33, UI.HEIGHT - 100), 32, 32, colorA);           //1
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 + 1, UI.HEIGHT - 100), 32, 32, colorB, 90);        //2
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 - 33, UI.HEIGHT - 100 + 32), 32, 32, colorC, 270); //3
            new GTASprite("helicopterhud", "hud_corner").Draw(new Point(UI.WIDTH / 2 + 1, UI.HEIGHT - 100 + 32), 32, 32, colorD, 180);  //4

            if (Items.Count > 3)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 - 33 - 10, UI.HEIGHT - 84), 20, 3, colorA); //1
            }

            if (Items.Count > 2)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 - 33 - 10, UI.HEIGHT - 84 + 30), 20, 3, colorC); //3
            }

            if (Items.Count > 0)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 + 1 + 20, UI.HEIGHT - 84), 20, 3, colorB); //2
            }

            if (Items.Count > 1)
            {
                new GTASprite("helicopterhud", "hud_line").Draw(new Point(UI.WIDTH / 2 + 1 + 20, UI.HEIGHT - 84 + 30), 20, 3, colorD); //4
            }

            var bottomY = offset.Height + 70 + Items.Count * ItemHeight;

            if (HasFooter)
            {
                bottomY += FooterHeight;
            }
            bottomY += HeaderHeight;

            if (ExtendWindowHeight)
            {
                new UIRectangle(new Point(offset.Width, bottomY), new Size(300, UI.HEIGHT), UnselectedItemColor).Draw();
                new UIRectangle(new Point(offset.Width + 300, offset.Height - UI.HEIGHT), new Size(2, UI.HEIGHT * 2), Color.FromArgb(200, 8, 8, 8)).Draw();
            }
        }