Example #1
0
 /// <summary>
 /// Checkbox item with a toggleable checkbox.
 /// </summary>
 /// <param name="text">Item label.</param>
 /// <param name="check">Boolean value whether the checkbox is checked.</param>
 /// <param name="description">Description for this item.</param>
 public MenuCheckboxItem(string text, bool check, string description)
     : base(text, description)
 {
     const int y = 0;
     _checkedSprite = new Sprite("commonmenu", "shop_box_blank", new Point(410, y + 95), new Size(50, 50));
     Checked = check;
 }
Example #2
0
 public TabItem(string name)
 {
     RockstarTile = new Sprite("pause_menu_sp_content", "rockstartilebmp", new Point(), new Size(64, 64), 0f, Color.FromArgb(40, 255, 255, 255));
     Title = name;
     DrawBg = true;
     UseDynamicPositionment = true;
 }
Example #3
0
 /// <summary>
 /// List item, with left/right arrows.
 /// </summary>
 /// <param name="text">Item label.</param>
 /// <param name="items">List that contains your items.</param>
 /// <param name="index">Index in the list. If unsure user 0.</param>
 /// <param name="description">Description for this item.</param>
 public MenuListItem(string text, List<dynamic> items, int index, string description)
     : base(text, description)
 {
     const int y = 0;
     _items = new List<dynamic>(items);
     _arrowLeft = new Sprite("commonmenu", "arrowleft", new Point(110, 105 + y), new Size(30, 30));
     _arrowRight = new Sprite("commonmenu", "arrowright", new Point(280, 105 + y), new Size(30, 30));
     _itemText = new ResText("", new Point(290, y + 104), 0.35f, Color.White, Common.EFont.ChaletLondon,
         ResText.Alignment.Left) {TextAlignment = ResText.Alignment.Right};
     Index = index;
 }
        protected void Init()
        {
            _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38), 0, HighlightColor);
            _rectangle = new ResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0));
            _text = new ResText(Text, new Point(8, 0), 0.33f, Color.WhiteSmoke, Common.EFont.ChaletLondon, ResText.Alignment.Left);
            Description = Description;

            _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40));
            _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40));

            _labelText = new ResText("", new Point(0, 0), 0.35f) { TextAlignment = ResText.Alignment.Right };
        }
        public TabMissionSelectItem(string name, IEnumerable<MissionInformation> list) : base(name)
        {
            base.FadeInWhenFocused = true;
            base.DrawBg = false;

            _noLogo = new Sprite("gtav_online", "rockstarlogo256", new Point(), new Size(512, 256));
            _maxItem = MaxItemsPerView;
            _minItem = 0;

            CanBeFocused = true;

            Heists = new List<MissionInformation>(list);
        }
Example #6
0
        /// <summary>
        /// Basic menu button.
        /// </summary>
        /// <param name="text">Button label.</param>
        /// <param name="description">Description.</param>
        public NativeMenuItem(string text, string description)
        {
            Enabled = true;

            _rectangle = new ResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0));
            _text = new ResText(text, new Point(8, 0), 0.33f, Color.WhiteSmoke, Common.EFont.ChaletLondon, ResText.Alignment.Left);
            Description = description;
            _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38));

            _badgeLeft = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40));
            _badgeRight = new Sprite("commonmenu", "", new Point(0, 0), new Size(40, 40));

            _labelText = new ResText("", new Point(0, 0), 0.35f) {TextAlignment = ResText.Alignment.Right};
        }
Example #7
0
 /// <summary>
 ///  Set the banner to your own Rectangle.
 /// </summary>
 /// <param name="rectangle">UIResRectangle object. Position and size does not matter.</param>
 public void SetBannerType(ResRectangle rectangle)
 {
     _logo = null;
     _tmpRectangle = rectangle;
     _tmpRectangle.Position = new Point(_offset.X, _offset.Y);
     _tmpRectangle.Size = new Size(431 + WidthOffset, 107);
 }
Example #8
0
 /// <summary>
 /// Set the banner to your own Sprite object.
 /// </summary>
 /// <param name="spriteBanner">Sprite object. The position and size does not matter.</param>
 public void SetBannerType(Sprite spriteBanner)
 {
     _logo = spriteBanner;
     _logo.Size = new Size(431 + WidthOffset, 107);
     _logo.Position = new Point(_offset.X, _offset.Y);
 }
Example #9
0
        /// <summary>
        /// Advanced Menu constructor that allows custom title banner.
        /// </summary>
        /// <param name="title">Title that appears on the big banner. Set to "" if you are using a custom banner.</param>
        /// <param name="subtitle">Subtitle that appears in capital letters in a small black bar.</param>
        /// <param name="offset">Point object with X and Y data for offsets. Applied to all menu elements.</param>
        /// <param name="spriteLibrary">Sprite library name for the banner.</param>
        /// <param name="spriteName">Sprite name for the banner.</param>
        public UIMenu(string title, string subtitle, Point offset, string spriteLibrary, string spriteName)
        {
            _offset = offset;
            Children = new Dictionary<NativeMenuItem, UIMenu>();
            WidthOffset = 0;

            _instructionalButtonsScaleform = new Scaleform(0);
            _instructionalButtonsScaleform.Load("instructional_buttons");
            UpdateScaleform();

            _mainMenu = new Container(new Point(0, 0), new Size(700, 500), Color.FromArgb(0, 0, 0, 0));
            _logo = new Sprite(spriteLibrary, spriteName, new Point(0 + _offset.X, 0 + _offset.Y), new Size(431, 107));
            _mainMenu.Items.Add(Title = new ResText(title, new Point(215 + _offset.X, 20 + _offset.Y), 1.15f, Color.White, Common.EFont.HouseScript, ResText.Alignment.Centered));
            if (!String.IsNullOrWhiteSpace(subtitle))
            {
                _mainMenu.Items.Add(new ResRectangle(new Point(0 + offset.X, 107 + _offset.Y), new Size(431, 37), Color.Black));
                _mainMenu.Items.Add(Subtitle = new ResText(subtitle, new Point(8 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, ResText.Alignment.Left));

                if (subtitle.StartsWith("~"))
                {
                    CounterPretext = subtitle.Substring(0, 3);
                }
                _counterText = new ResText("", new Point(425 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, ResText.Alignment.Right);
                _extraYOffset = 37;
            }

            _upAndDownSprite = new Sprite("commonmenu", "shop_arrows_upanddown", new Point(190 + _offset.X, 147 + 37 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(50, 50));
            _extraRectangleUp = new ResRectangle(new Point(0 + _offset.X, 144 + 38 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0));
            _extraRectangleDown = new ResRectangle(new Point(0 + _offset.X, 144 + 18 + 38 * (MaxItemsOnScreen + 1) + _offset.Y - 37 + _extraYOffset), new Size(431, 18), Color.FromArgb(200, 0, 0, 0));

            _descriptionBar = new ResRectangle(new Point(_offset.X, 123), new Size(431, 4), Color.Black);
            _descriptionRectangle = new Sprite("commonmenu", "gradient_bgd", new Point(_offset.X, 127), new Size(431, 30));
            _descriptionText = new ResText("Description", new Point(_offset.X + 5, 125), 0.35f, Color.FromArgb(255, 255, 255, 255), Common.EFont.ChaletLondon, ResText.Alignment.Left);

            _background = new Sprite("commonmenu", "gradient_bgd", new Point(_offset.X, 144 + _offset.Y - 37 + _extraYOffset), new Size(290, 25));

            SetKey(Common.MenuControls.Up, GameControl.CellphoneUp);
            SetKey(Common.MenuControls.Up, GameControl.CursorScrollUp);

            SetKey(Common.MenuControls.Down, GameControl.CellphoneDown);
            SetKey(Common.MenuControls.Down, GameControl.CursorScrollDown);

            SetKey(Common.MenuControls.Left, GameControl.CellphoneLeft);
            SetKey(Common.MenuControls.Right, GameControl.CellphoneRight);
            SetKey(Common.MenuControls.Select, GameControl.FrontendAccept);

            SetKey(Common.MenuControls.Back, GameControl.CellphoneCancel);
            SetKey(Common.MenuControls.Back, GameControl.FrontendPause);
        }
Example #10
0
 public void SetBannerType(Sprite bannerType)
 {
     _menuList.ForEach(m => m.SetBannerType(bannerType));
 }
        public override void Draw()
        {
            base.Draw();
            if (Heists.Count == 0) return;

            ProcessControls();

            var 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++)
            {
                new ResRectangle(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * counter)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Color.FromArgb(blackAlpha, Color.Black)).Draw();
                new ResText(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)).Draw();
                counter++;
            }

            if (Heists[Index].Logo == null || string.IsNullOrEmpty(Heists[Index].Logo.TextureName))
            {
                _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.TextureName != null && !Heists[Index].Logo.IsGameTexture)
            //{
            //    var target = Heists[Index].Logo.FileName;
            //    //Sprite.DrawTexture(target, new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y), new Size(512, 256));
            //}
            else if (Heists[Index].Logo != null && Heists[Index].Logo.TextureName != null/* &&
                     Heists[Index].Logo.IsGameTexture*/)
            {
                var newLogo = new Sprite(Heists[Index].Logo.DictionaryName, Heists[Index].Logo.TextureName, new Point(), new Size(512, 256));
                newLogo.Position = new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y);
                newLogo.Color = Color.FromArgb(blackAlpha, 0, 0, 0);
                newLogo.Draw();
            }

            new ResRectangle(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256), new Size(512, 40), Color.FromArgb(fullAlpha, Color.Black)).Draw();
            new ResText(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).Draw();

            for (int i = 0; i < Heists[Index].ValueList.Count; i++)
            {
                new ResRectangle(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)).Draw();
                var text = Heists[Index].ValueList[i].Item1;
                var label = Heists[Index].ValueList[i].Item2;


                new ResText(text, new Point((int)res.Width - SafeSize.X - 506, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Color.White)).Draw();
                new ResText(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).Draw();
            }

            if (!string.IsNullOrEmpty(Heists[Index].Description))
            {
                var propLen = Heists[Index].ValueList.Count;
                new ResRectangle(new Point((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 42 + 40 * propLen),
                    new Size(512, 2), Color.FromArgb(fullAlpha, Color.White)).Draw();
                new ResText(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))
                {
                    WordWrap = new Size(508, 0),
                }.Draw();

                new ResRectangle(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)).Draw();
            }
        }
 /// <summary>
 /// Create a mission logo from a game texture.
 /// </summary>
 /// <param name="textureDict">Name of the texture dictionary</param>
 /// <param name="textureName">Name of the texture.</param>
 public MissionLogo(string textureDict, string textureName)
 {
     Sprite = new Sprite(textureDict, textureName, Point.Empty, Size.Empty);
     IsGameSprite = true;
 }