Exemplo n.º 1
0
        public void Update()
        {
            if (!Visible || TemporarilyHidden)
            {
                return;
            }
            ShowInstructionalButtons();
            Function.Call(Hash.HIDE_HUD_AND_RADAR_THIS_FRAME);
            Function.Call(Hash._SHOW_CURSOR_THIS_FRAME);


            var res  = UIMenu.GetScreenResolutionMaintainRatio();
            var safe = new PointF(300, 180);

            if (!HideTabs)
            {
                new UIResText(Title, new PointF(safe.X, safe.Y - 80), 1f, UnknownColors.White, Font.ChaletComprimeCologne,
                              UIResText.Alignment.Left)
                {
                    DropShadow = true,
                }.Draw();

                if (Photo == null)
                {
                    new Sprite("char_multiplayer", "char_multiplayer",
                               new PointF((int)res.Width - safe.X - 64, safe.Y - 80), new SizeF(64, 64)).Draw();
                }
                else
                {
                    Photo.Position = new PointF((int)res.Width - safe.X - 100, safe.Y - 80);
                    Photo.Size     = new SizeF(64, 64);
                    Photo.Draw();
                }

                new UIResText(Name, new PointF((int)res.Width - safe.X - 70, safe.Y - 95), 0.7f, UnknownColors.White,
                              Font.ChaletComprimeCologne, UIResText.Alignment.Right)
                {
                    DropShadow = true,
                }.Draw();

                string t = Money;
                if (string.IsNullOrEmpty(Money))
                {
                    t = DateTime.Now.ToString();
                }


                new UIResText(t, new PointF((int)res.Width - safe.X - 70, safe.Y - 60), 0.4f, UnknownColors.White,
                              Font.ChaletComprimeCologne, UIResText.Alignment.Right)
                {
                    DropShadow = true,
                }.Draw();

                string subt = MoneySubtitle;
                if (string.IsNullOrEmpty(MoneySubtitle))
                {
                    subt = "";
                }

                new UIResText(subt, new PointF((int)res.Width - safe.X - 70, safe.Y - 40), 0.4f, UnknownColors.White,
                              Font.ChaletComprimeCologne, UIResText.Alignment.Right)
                {
                    DropShadow = true,
                }.Draw();

                for (int i = 0; i < Tabs.Count; i++)
                {
                    var activeSize = res.Width - 2 * safe.X;
                    activeSize -= 4 * 5;
                    int tabWidth = (int)activeSize / Tabs.Count;

                    Game.EnableControlThisFrame(0, Control.CursorX);
                    Game.EnableControlThisFrame(0, Control.CursorY);

                    var hovering = UIMenu.IsMouseInBounds(safe.AddPoints(new PointF((tabWidth + 5) * i, 0)),
                                                          new SizeF(tabWidth, 40));

                    var tabColor = Tabs[i].Active
                        ? UnknownColors.White
                        : hovering?Color.FromArgb(100, 50, 50, 50) : UnknownColors.Black;

                    new UIResRectangle(safe.AddPoints(new PointF((tabWidth + 5) * i, 0)), new SizeF(tabWidth, 40),
                                       Color.FromArgb(Tabs[i].Active ? 255 : 200, tabColor)).Draw();

                    new UIResText(Tabs[i].Title.ToUpper(), safe.AddPoints(new PointF((tabWidth / 2) + (tabWidth + 5) * i, 5)),
                                  0.35f,
                                  Tabs[i].Active ? UnknownColors.Black : UnknownColors.White, Font.ChaletLondon, UIResText.Alignment.Centered)
                    .Draw();

                    if (Tabs[i].Active)
                    {
                        new UIResRectangle(safe.SubtractPoints(new PointF(-((tabWidth + 5) * i), 10)),
                                           new SizeF(tabWidth, 10), UnknownColors.DodgerBlue).Draw();
                    }

                    if (hovering && Game.IsControlJustPressed(0, Control.CursorAccept) && !Tabs[i].Active)
                    {
                        Tabs[Index].Active  = false;
                        Tabs[Index].Focused = false;
                        Tabs[Index].Visible = false;
                        Index = (1000 - (1000 % Tabs.Count) + i) % Tabs.Count;
                        Tabs[Index].Active     = true;
                        Tabs[Index].Focused    = true;
                        Tabs[Index].Visible    = true;
                        Tabs[Index].JustOpened = true;

                        if (Tabs[Index].CanBeFocused)
                        {
                            FocusLevel = 1;
                        }
                        else
                        {
                            FocusLevel = 0;
                        }

                        Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1);
                    }
                }
            }
            Tabs[Index].Draw();

            _sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);

            _sc.Render2D();
        }
Exemplo n.º 2
0
        public void Draw()
        {
            if (!Visible || TemporarilyHidden)
            {
                return;
            }
            ShowInstructionalButtons();
            API.HideHudAndRadarThisFrame();
            API.ShowCursorThisFrame();


            var safe = new PointF(300, SubTitle != null && SubTitle != ""? 205 : 195);

            if (!HideTabs)
            {
                /*
                 * new UIResText(Title, new PointF(safe.X, safe.Y - 80), 1f, Colors.White, Font.ChaletComprimeCologne, Alignment.Left)
                 * {
                 *  Shadow = true,
                 * }.Draw();
                 *
                 * if (Photo == null)
                 *  new Sprite("char_multiplayer", "char_multiplayer", new PointF((int)Resolution.Width - safe.X - 64, safe.Y - 90), new SizeF(75, 75)).Draw();
                 * else
                 * {
                 *  Photo.Position = new PointF((int)Resolution.Width - safe.X - 100, safe.Y - 90);
                 *  Photo.Size = new SizeF(75, 75);
                 *  Photo.Draw();
                 * }
                 *
                 * new UIResText(Name, new PointF((int)Resolution.Width - safe.X - 106, safe.Y - 98), 0.5f, Colors.White, Font.ChaletComprimeCologne, Alignment.Right)
                 * {
                 *  Shadow = true,
                 * }.Draw();
                 *
                 * string t = Money;
                 * if (string.IsNullOrEmpty(Money))
                 * {
                 *  t = DateTime.Now.ToString();
                 * }
                 *
                 *
                 * new UIResText(t, new PointF((int)Resolution.Width - safe.X - 106, safe.Y - 70), 0.5f, Colors.White,
                 *  Font.ChaletComprimeCologne, Alignment.Right)
                 * {
                 *  Shadow = true,
                 * }.Draw();
                 *
                 * string subt = MoneySubtitle;
                 * if (string.IsNullOrEmpty(MoneySubtitle))
                 * {
                 *  subt = "";
                 * }
                 *
                 * new UIResText(subt, new PointF((int)Resolution.Width - safe.X - 106, safe.Y - 44), 0.5f, Colors.White,
                 *  Font.ChaletComprimeCologne, Alignment.Right)
                 * {
                 *  Shadow = true,
                 * }.Draw();
                 */
                for (int i = 0; i < Tabs.Count; i++)
                {
                    var activeSize = Resolution.Width - 2 * safe.X;
                    activeSize -= 5;
                    float tabWidth = ((int)activeSize / Tabs.Count) - 1.95f;
                    Game.EnableControlThisFrame(0, Control.CursorX);
                    Game.EnableControlThisFrame(0, Control.CursorY);

                    var hovering = ScreenTools.IsMouseInBounds(safe.AddPoints(new PointF((tabWidth + 5) * i, 0)),
                                                               new SizeF(tabWidth, 40));

                    var tabColor = Tabs[i].Active ? Colors.White : hovering?Color.FromArgb(100, 50, 50, 50) : Colors.Black;

                    new UIResRectangle(safe.AddPoints(new PointF((tabWidth + 5) * i, 0)), new SizeF(tabWidth, 40), Color.FromArgb(Tabs[i].Active ? 255 : 200, tabColor)).Draw();
                    if (Tabs[i].Active)
                    {
                        new UIResRectangle(safe.SubtractPoints(new PointF(-((tabWidth + 5) * i), 10)), new SizeF(tabWidth, 10), Colors.DodgerBlue).Draw();
                    }

                    new UIResText(Tabs[i].Title.ToUpper(), safe.AddPoints(new PointF((tabWidth / 2) + (tabWidth + 5) * i, 5)), 0.3f, Tabs[i].Active ? Colors.Black : Colors.White, Font.ChaletLondon, Alignment.Center).Draw();

                    if (hovering && Game.IsControlJustPressed(0, Control.CursorAccept) && !Tabs[i].Active)
                    {
                        Tabs[Index].Active  = false;
                        Tabs[Index].Focused = false;
                        Tabs[Index].Visible = false;
                        Index = (1000 - (1000 % Tabs.Count) + i) % Tabs.Count;
                        Tabs[Index].Active     = true;
                        Tabs[Index].Focused    = true;
                        Tabs[Index].Visible    = true;
                        Tabs[Index].JustOpened = true;

                        if (Tabs[Index].CanBeFocused)
                        {
                            FocusLevel = 1;
                        }
                        else
                        {
                            FocusLevel = 0;
                        }

                        Game.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                    }
                }
            }
            Tabs[Index].Draw();

            _sc.CallFunction("DRAW_INSTRUCTIONAL_BUTTONS", -1);
            _sc.Render2D();
            if (DisplayHeader)
            {
                if (!_loaded)
                {
                    ShowHeader();
                }
                API.DrawScaleformMovie(_header.Handle, 0.501f, 0.162f, 0.6782f, 0.145f, 255, 255, 255, 255, 0);
            }
        }