Example #1
0
        /// <summary>
        /// Draws this instance.
        /// </summary>
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }
            base.Draw();

            var res = UIMenu.GetScreenResolutionMantainRatio();

            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 255 : 150;

            var activeWidth  = res.Width - SafeSize.X * 2;
            var submenuWidth = (int)(activeWidth * 0.6818f);
            var itemSize     = new Size((int)activeWidth - (submenuWidth + 3), 40);

            for (int i = 0; i < Items.Count; i++)
            {
                //bool hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize);

                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Items[i].Title, SafeSize.AddPoints(new Point(6, 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);

                //if (Focused && hovering && Common.IsDisabledControlJustPressed(0, GameControl.CursorAccept))
                //{
                //    Items[Index].Focused = false;
                //    Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //    bool open = Index == i;
                //    Index = (1000 - (1000 % Items.Count) + i) % Items.Count;
                //    if (open)
                //    {
                //        if (Items[Index].CanBeFocused && !Items[Index].Focused)
                //        {
                //            Parent.FocusLevel = 2;
                //            Items[Index].JustOpened = true;
                //            Items[Index].Focused = true;
                //        }
                //        else
                //        {
                //            Items[Index].OnActivated();
                //        }
                //    }
                //    else
                //    {
                //        Parent.FocusLevel = 1;
                //    }
                //}
            }

            Items[Index].Visible           = true;
            Items[Index].FadeInWhenFocused = true;
            //if (Items[Index].CanBeFocused)
            //    Items[Index].Focused = true;
            Items[Index].UseDynamicPositionment = false;
            Items[Index].SafeSize    = SafeSize.AddPoints(new Point((int)activeWidth - submenuWidth, 0));
            Items[Index].TopLeft     = SafeSize.AddPoints(new Point((int)activeWidth - submenuWidth, 0));
            Items[Index].BottomRight = new Point((int)res.Width - SafeSize.X, (int)res.Height - SafeSize.Y);
            Items[Index].Draw();
        }
        public void CameraShutterAnimation()
        {
            GameFiber.StartNew(delegate
            {
                var orig = UIMenu.GetScreenResolutionMantainRatio();
                var res  = new Size((int)orig.Width, (int)orig.Height);

                var upperRect = new ResRectangle(new Point(0, 0), new Size(res.Width, 0), Color.Black);
                var lowerRect = new ResRectangle(new Point(0, res.Height), new Size(res.Width, 0), Color.Black);

                var middle = res.Height / 2;

                var startTime       = Game.GameTime;
                const uint duration = 200;
                while (Game.GameTime < startTime + duration)
                {
                    var lerp = (int)Util.LinearLerp(Game.GameTime - startTime, 0, middle, duration);

                    upperRect.Size = new Size(res.Width, lerp);

                    lowerRect.Position = new Point(0, res.Height - lerp);
                    lowerRect.Size     = new Size(res.Width, lerp);

                    upperRect.Draw();
                    lowerRect.Draw();
                    GameFiber.Yield();
                }

                startTime = Game.GameTime;
                while (Game.GameTime < startTime + duration)
                {
                    var lerp       = (int)Util.LinearLerp(Game.GameTime - startTime, middle, 0, duration);
                    upperRect.Size = new Size(res.Width, lerp);

                    lowerRect.Position = new Point(0, res.Height - lerp);
                    lowerRect.Size     = new Size(res.Width, lerp);

                    upperRect.Draw();
                    lowerRect.Draw();
                    GameFiber.Yield();
                }
            });
        }
        internal void Process()
        {
            if (Menu.Visible)
            {
                if (Game.IsKeyDown(Keys.C))
                {
                    copiedSequence = getSelectedSequence()?.ItemValue;
                    Common.PlaySound(Menu.AUDIO_SELECT, Menu.AUDIO_LIBRARY);
                }
                else if (Game.IsKeyDown(Keys.V) && copiedSequence != null)
                {
                    var s = getSelectedSequence();
                    if (s != null)
                    {
                        s.ItemValue = copiedSequence;
                        Common.PlaySound(Menu.AUDIO_SELECT, Menu.AUDIO_LIBRARY);
                    }
                }
                else if (Game.IsControlJustPressed(13, GameControl.FrontendLeft))
                {
                    shiftSelectedSequence(-1);
                }
                else if (Game.IsControlJustPressed(13, GameControl.FrontendRight))
                {
                    shiftSelectedSequence(1);
                }
                else if (Game.IsKeyDown(Keys.PageDown))
                {
                    shiftSelectedItem(1);
                }
                else if (Game.IsKeyDown(Keys.PageUp))
                {
                    shiftSelectedItem(-1);
                }
                else if (Game.IsKeyDown(Keys.R))
                {
                    invertSelectedSequence();
                }
                else if (Game.IsKeyDown(Keys.E))
                {
                    extendSelectedSequence();
                }

                if (!string.IsNullOrEmpty(copiedSequence))
                {
                    string seqDisp = "Copied sequence " + UIMenuSequenceItemSelector.FormatSequence(copiedSequence);
                    Point  p       = new Point(Menu.WidthOffset + 500, 30);
                    ResText.Draw(seqDisp, p, 0.4f, Color.White, Common.EFont.Monospace, false);
                    int rectW = (int)ResText.MeasureStringWidth(seqDisp, Common.EFont.Monospace, 0.4f);
                    ResRectangle.Draw(new Point(p.X - 10, p.Y - 1), new Size(rectW + 20, 31), Color.FromArgb(180, Color.Black));
                }
            }
        }
Example #4
0
        public override void Draw()
        {
            base.Draw();

            var alpha      = (Focused || !CanBeFocused) ? 180 : 60;
            var blackAlpha = (Focused || !CanBeFocused) ? 200 : 90;
            var fullAlpha  = (Focused || !CanBeFocused) ? 255 : 150;

            var rectSize = (int)(BottomRight.X - TopLeft.X);

            for (int i = 0; i < Dictionary.Count; i++)
            {
                ResRectangle.Draw(new Point(TopLeft.X, TopLeft.Y + (40 * i)), new Size(rectSize, 40), i % 2 == 0 ? Color.FromArgb(alpha, 0, 0, 0) : Color.FromArgb(blackAlpha, 0, 0, 0));

                var item = Dictionary.ElementAt(i);

                ResText.Draw(item.Key, new Point(TopLeft.X + 6, TopLeft.Y + 5 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, false);
                ResText.Draw(item.Value, new Point(BottomRight.X - 6, TopLeft.Y + 5 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
            }
        }
Example #5
0
        public virtual void Draw()
        {
            if (!Visible)
            {
                return;
            }

            var res = UIMenu.GetScreenResolutionMantainRatio();

            if (UseDynamicPositionment)
            {
                SafeSize = new Point(300, 240);

                TopLeft     = new Point(SafeSize.X, SafeSize.Y);
                BottomRight = new Point((int)res.Width - SafeSize.X, (int)res.Height - SafeSize.Y);
            }

            var rectSize = new Size(BottomRight.SubtractPoints(TopLeft));

            DrawInstructionalButtons?.Invoke(this, EventArgs.Empty);

            if (DrawBg)
            {
                ResRectangle.Draw(TopLeft, rectSize, Color.FromArgb((Focused || !FadeInWhenFocused) ? 200 : 120, 0, 0, 0));

                var tileSize = 100;
                RockstarTile.Size = new Size(tileSize, tileSize);

                var cols = rectSize.Width / tileSize;
                var fils = 4;

                for (int i = 0; i < cols * fils; i++)
                {
                    RockstarTile.Position = TopLeft.AddPoints(new Point(tileSize * (i % cols), tileSize * (i / cols)));
                    RockstarTile.Color    = Color.FromArgb((int)MiscExtensions.LinearFloatLerp(40, 0, i / cols, fils), 255, 255, 255);
                    RockstarTile.Draw();
                }
            }
        }
Example #6
0
        private static void GameOnFrameRender(object sender, GraphicsEventArgs e)
        {
            //Checks if the option for the on screen text is set to true
            if (Globals.Application.AvailableForCalloutsText)
            {
                _availableRect.Draw();
            }

            //Checks if the option for the on screen text is set to true
            if (Globals.Application.AvailableForCalloutsText)
            {
                _availableText.Draw();
            }
            //Checks if the player is available for calls or not, if the player is available it draws the on screen text
            if (Functions.IsPlayerAvailableForCalls())
            {
                _availableText.Caption = _availableText.Caption = "Available for calls: Yes";
            }
            else
            {
                _availableText.Caption = _availableText.Caption = "Available for calls: No";
            }
        }
Example #7
0
        public void DrawPedInfo(Ped ped, ulong ticksToDraw)
        {
            ulong        tickCount  = Game.TickCount;
            SizeF        res        = RAGENativeUI.UIMenu.GetScreenResolutionMantainRatio();
            ResRectangle background = new ResRectangle(new Point((int)res.Width - 350, (int)res.Height - 600), new Size((int)res.Width, (int)res.Height - 571), Color.FromArgb(170, Color.Black));

            Persona persona       = Functions.GetPersonaForPed(ped);
            ResText nameText      = new ResText("NAME:  ~b~" + persona.FullName.ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 550), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText genderText    = new ResText("GENDER:  ~b~" + persona.Gender, new Point((int)res.Width - 320, (int)res.Height - 500), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText birthdayText  = new ResText("BIRTHDAY:  ~b~" + persona.BirthDay.ToShortDateString(), new Point((int)res.Width - 320, (int)res.Height - 450), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText citationsText = new ResText("CITATIONS:  ~b~" + persona.Citations, new Point((int)res.Width - 320, (int)res.Height - 400), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText wantedText    = new ResText("EXTRA INFO:  ~b~" + (persona.Wanted ? "~r~WANTED" : "NONE"), new Point((int)res.Width - 320, (int)res.Height - 350), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);

            _canOverrideDrawInfo = false;
            while (true)
            {
                if ((Game.TickCount - tickCount) > ticksToDraw)
                {
                    break;
                }
                if (Camera == null || !Camera.Exists())
                {
                    break;
                }
                if (_canOverrideDrawInfo)
                {
                    break;
                }
                background.Draw();
                nameText.Draw();
                genderText.Draw();
                birthdayText.Draw();
                citationsText.Draw();
                wantedText.Draw();
                GameFiber.Yield();
            }
        }
Example #8
0
        public void DrawVehicleInfo(Vehicle vehicle, ulong ticksToDraw)
        {
            ulong        tickCount  = Game.TickCount;
            SizeF        res        = RAGENativeUI.UIMenu.GetScreenResolutionMantainRatio();
            ResRectangle background = new ResRectangle(new Point((int)res.Width - 350, (int)res.Height - 600), new Size((int)res.Width, (int)res.Height - 571), Color.FromArgb(170, Color.Black));

            ResText plateText          = new ResText("PLATE:  ~b~" + vehicle.LicensePlate.ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 550), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText ownerText          = new ResText("OWNER:  ~b~" + Functions.GetVehicleOwnerName(vehicle), new Point((int)res.Width - 320, (int)res.Height - 500), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText modelText          = new ResText("MODEL:  ~b~" + vehicle.Model.Name.ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 450), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText primaryColorText   = new ResText("PRIMARY COLOR:  ~b~" + vehicle.GetPrimaryColor().ToFriendlyName().ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 400), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);
            ResText secondaryColorText = new ResText("SECONDARY COLOR:  ~b~" + vehicle.GetSecondaryColor().ToFriendlyName().ToUpper(), new Point((int)res.Width - 320, (int)res.Height - 350), 0.3225f, Color.White, RAGENativeUI.Common.EFont.ChaletLondon, ResText.Alignment.Left);

            _canOverrideDrawInfo = false;
            while (true)
            {
                if ((Game.TickCount - tickCount) > ticksToDraw)
                {
                    break;
                }
                if (Camera == null || !Camera.Exists())
                {
                    break;
                }
                if (_canOverrideDrawInfo)
                {
                    break;
                }
                background.Draw();
                plateText.Draw();
                ownerText.Draw();
                modelText.Draw();
                primaryColorText.Draw();
                secondaryColorText.Draw();
                GameFiber.Yield();
            }
        }
Example #9
0
        public override void Draw()
        {
            base.Draw();
            if (Heists.Count == 0)
            {
                return;
            }

            res = UIMenu.GetScreenResolutionMantainRatio();

            var activeWidth = res.Width - SafeSize.X * 2;
            var itemSize    = new Size((int)activeWidth - 515, 40);

            var alpha      = Focused ? 120 : 30;
            var blackAlpha = Focused ? 200 : 100;
            var fullAlpha  = Focused ? 255 : 150;

            var counter = 0;

            for (int i = _minItem; i < Math.Min(Heists.Count, _maxItem); i++)
            {
                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * counter)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Heists[i].Name, SafeSize.AddPoints(new Point(6, 5 + (itemSize.Height + 3) * counter)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);
                counter++;
            }

            if (Heists[Index].Logo == null || (Heists[Index].Logo.Sprite == null && Heists[Index].Logo.Texture == null))
            {
                drawTexture      = false;
                _noLogo.Position = new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y);
                _noLogo.Color    = Color.FromArgb(blackAlpha, 0, 0, 0);
                _noLogo.Draw();
            }
            else if (Heists[Index].Logo != null && Heists[Index].Logo.Texture != null && !Heists[Index].Logo.IsGameSprite)
            {
                drawTexture = true;
            }
            else if (Heists[Index].Logo != null && Heists[Index].Logo.Sprite != null && Heists[Index].Logo.IsGameSprite)
            {
                drawTexture = false;
                Sprite sprite = Heists[Index].Logo.Sprite;
                sprite.Position = new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y);
                sprite.Color    = Color.FromArgb(blackAlpha, 0, 0, 0);
                sprite.Draw();
            }
            else
            {
                drawTexture = false;
            }

            ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256), new Size(512, 40), Color.FromArgb(fullAlpha, Color.Black));
            ResText.Draw(Heists[Index].Name, new Point((int)res.Width - SafeSize.X - 4, SafeSize.Y + 260), 0.5f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.HouseScript, ResText.Alignment.Right, false, false, Size.Empty);

            for (int i = 0; i < Heists[Index].ValueList.Count; i++)
            {
                ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 40 + (40 * i)), new Size(512, 40), i % 2 == 0 ? Color.FromArgb(alpha, 0, 0, 0) : Color.FromArgb(blackAlpha, 0, 0, 0));
                var text  = Heists[Index].ValueList[i].Item1;
                var label = Heists[Index].ValueList[i].Item2;


                ResText.Draw(text, new Point((int)res.Width - SafeSize.X - 506, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, false);
                ResText.Draw(label, new Point((int)res.Width - SafeSize.X - 6, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
            }

            if (!string.IsNullOrEmpty(Heists[Index].Description))
            {
                var propLen = Heists[Index].ValueList.Count;
                ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 42 + 40 * propLen), new Size(512, 2), Color.FromArgb(fullAlpha, Color.White));
                ResText.Draw(Heists[Index].Description, new Point((int)res.Width - SafeSize.X - 508, SafeSize.Y + 256 + 45 + 40 * propLen + 4), 0.35f, Color.FromArgb(fullAlpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Left, false, false, new Size(508, 0));

                ResRectangle.Draw(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 44 + 40 * propLen), new Size(512, 45 * (StringMeasurer.MeasureString(Heists[Index].Description) / 500)), Color.FromArgb(blackAlpha, 0, 0, 0));
            }
        }
Example #10
0
        public override void Draw()
        {
            if (!Visible)
            {
                return;
            }

            base.Draw();

            int blackAlpha = Focused ? 200 : 100;
            int fullAlpha  = Focused ? 255 : 150;

            int  subMenuWidth = (BottomRight.X - TopLeft.X);
            Size itemSize     = new Size(subMenuWidth, 40);

            int i = 0;

            for (int c = minItem; c < Math.Min(Items.Count, maxItem); c++)
            {
                //bool hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize);

                bool hasLeftBadge  = Items[c].LeftBadgeInfo != null;
                bool hasRightBadge = Items[c].RightBadgeInfo != null;

                bool hasBothBadges = hasRightBadge && hasLeftBadge;
                bool hasAnyBadge   = hasRightBadge || hasLeftBadge;

                ResRectangle.Draw(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Color.White) : /*Focused && hovering ? Color.FromArgb(100, 50, 50, 50) :*/ Color.FromArgb(blackAlpha, Color.Black));
                ResText.Draw(Items[c].Text, SafeSize.AddPoints(new Point((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White), Common.EFont.ChaletLondon, false);

                bool selected = (Index == c && Focused);
                if (hasLeftBadge && !hasRightBadge && !Items[c].LeftBadgeInfo.IsBlank &&
                    BadgeToSprite(Items[c].LeftBadgeInfo, selected, out string badgeTxd, out string badgeTex))
                {
                    Sprite.Draw(badgeTxd, badgeTex,
                                SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                BadgeToColor(Items[c].LeftBadgeInfo, selected));
                }

                if (!hasLeftBadge && hasRightBadge && !Items[c].RightBadgeInfo.IsBlank &&
                    BadgeToSprite(Items[c].RightBadgeInfo, selected, out badgeTxd, out badgeTex))
                {
                    Sprite.Draw(badgeTxd, badgeTex,
                                SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                BadgeToColor(Items[c].RightBadgeInfo, selected));
                }

                if (hasLeftBadge && hasRightBadge)
                {
                    if (!Items[c].LeftBadgeInfo.IsBlank && BadgeToSprite(Items[c].LeftBadgeInfo, selected, out badgeTxd, out badgeTex))
                    {
                        Sprite.Draw(badgeTxd, badgeTex,
                                    SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                    BadgeToColor(Items[c].LeftBadgeInfo, selected));
                    }

                    if (!Items[c].RightBadgeInfo.IsBlank && BadgeToSprite(Items[c].RightBadgeInfo, selected, out badgeTxd, out badgeTex))
                    {
                        Sprite.Draw(badgeTxd, badgeTex,
                                    SafeSize.AddPoints(new Point(25, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f,
                                    BadgeToColor(Items[c].RightBadgeInfo, selected));
                    }
                }

                if (!String.IsNullOrEmpty(Items[c].RightLabel))
                {
                    ResText.Draw(Items[c].RightLabel,
                                 SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)),
                                 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Color.Black : Color.White),
                                 Common.EFont.ChaletLondon, ResText.Alignment.Right, false, false, Size.Empty);
                }

                if (Items[c] is UIMenuCheckboxItem)
                {
                    string textureName;
                    if (c == Index && Focused)
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tickb" : "shop_box_blankb";
                    }
                    else
                    {
                        textureName = ((UIMenuCheckboxItem)Items[c]).Checked ? "shop_box_tick" : "shop_box_blank";
                    }
                    Sprite.Draw("commonmenu", textureName, SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new Size(50, 50), 0f, Color.White);
                }
                else if (Items[c] is UIMenuListItem)
                {
                    var convItem = (UIMenuListItem)Items[c];

                    var yoffset = 5;
                    var basePos =
                        SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));

                    var arrowLeft  = new Sprite("commonmenu", "arrowleft", basePos, new Size(30, 30));
                    var arrowRight = new Sprite("commonmenu", "arrowright", basePos, new Size(30, 30));
                    var itemText   = new ResText("", basePos, 0.35f, Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Right);

                    string caption = (convItem.Collection == null ? convItem.IndexToItem(convItem.Index) : convItem.Collection[convItem.Index]).ToString();
                    {
                        // prepare text style for TextCommands.GetWidth
                        int         screenw = Game.Resolution.Width;
                        int         screenh = Game.Resolution.Height;
                        const float height  = 1080f;
                        float       ratio   = (float)screenw / screenh;
                        var         width   = height * ratio;
                        float       x       = (itemText.Position.X) / width;
                        N.SetTextFont((int)itemText.FontEnum);
                        N.SetTextScale(0.0f, itemText.Scale);
                        N.SetTextRightJustify(true);
                        N.SetTextWrap(0.0f, x);
                    }
                    int offset = (int)(TextCommands.GetWidth(caption) * Game.Resolution.Width);

                    itemText.Color = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    itemText.Caption = caption;

                    arrowLeft.Color  = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);
                    arrowRight.Color = convItem.Enabled ? selected ? Color.Black : Color.WhiteSmoke : Color.FromArgb(163, 159, 148);

                    arrowLeft.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60 - offset, yoffset + (itemSize.Height + 3) * i));
                    if (selected)
                    {
                        arrowLeft.Draw();
                        arrowRight.Draw();
                        itemText.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i));
                    }
                    else
                    {
                        itemText.Position = SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i));
                    }

                    itemText.Draw();
                }

                //if (Focused && hovering && (Common.IsDisabledControlJustPressed(0, GameControl.CursorAccept) || Game.IsControlJustPressed(0, GameControl.CursorAccept)))
                //{
                //    bool open = Index == c;
                //    Index = (1000 - (1000 % Items.Count) + c) % Items.Count;
                //    if (!open)
                //        Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //    else
                //    {
                //        if (Items[Index] is UIMenuCheckboxItem)
                //        {
                //            Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //            UIMenuCheckboxItem cb = (UIMenuCheckboxItem)Items[Index];
                //            cb.Checked = !cb.Checked;
                //            cb.CheckboxEventTrigger();
                //        }
                //        else
                //        {
                //            Common.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                //            Items[Index].ItemActivate(null);
                //        }
                //    }
                //}

                i++;
            }
        }
Example #11
0
        public void Update()
        {
            if (!Visible || TemporarilyHidden)
            {
                return;
            }

            ShowInstructionalButtons();
            NativeFunction.Natives.HideHudAndRadarThisFrame();
            //NativeFunction.CallByHash<uint>(0xaae7ce1d63167423); // _SHOW_CURSOR_THIS_FRAME

            ProcessControls();

            var res  = UIMenu.GetScreenResolutionMantainRatio();
            var safe = new Point(300, 180);

            if (!HideTabs)
            {
                ResText.Draw(Title, new Point(safe.X, safe.Y - 80), 1f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Left, true, false, Size.Empty);

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

                ResText.Draw(Name, new Point((int)res.Width - safe.X - 70, safe.Y - 95), 0.7f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Right, true, false, Size.Empty);

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


                ResText.Draw(subt, new Point((int)res.Width - safe.X - 70, safe.Y - 60), 0.4f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Right, true, false, Size.Empty);

                ResText.Draw(MoneySubtitle, new Point((int)res.Width - safe.X - 70, safe.Y - 40), 0.4f, Color.White, Common.EFont.ChaletComprimeCologne, ResText.Alignment.Right, true, false, Size.Empty);

                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.DisableControlAction(0, GameControl.CursorX, false);
                    //Game.DisableControlAction(0, GameControl.CursorY, false);

                    //bool hovering = UIMenu.IsMouseInBounds(safe.AddPoints(new Point((tabWidth + 5) * i, 0)), new Size(tabWidth, 40));

                    var tabColor = Tabs[i].Active ? Color.White : /*hovering ? Color.FromArgb(100, 50, 50, 50) :*/ Color.Black;
                    ResRectangle.Draw(safe.AddPoints(new Point((tabWidth + 5) * i, 0)), new Size(tabWidth, 40), Color.FromArgb(Tabs[i].Active ? 255 : 200, tabColor));

                    ResText.Draw(Tabs[i].Title.ToUpper(), safe.AddPoints(new Point((tabWidth / 2) + (tabWidth + 5) * i, 5)), 0.35f, Tabs[i].Active ? Color.Black : Color.White, Common.EFont.ChaletLondon, ResText.Alignment.Centered, false, false, Size.Empty);

                    if (Tabs[i].Active)
                    {
                        ResRectangle.Draw(safe.SubtractPoints(new Point(-((tabWidth + 5) * i), 10)), new Size(tabWidth, 10), Color.DodgerBlue);
                    }

                    //if (hovering && Common.IsDisabledControlJustPressed(0, GameControl.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;

                    //    FocusLevel = Tabs[Index].CanBeFocused ? 1 : 0;

                    //    Common.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET");
                    //}
                }
            }

            Tabs[Index].Draw();

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

            _sc.Render2D();
        }