Beispiel #1
1
        /// <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<UIMenuItem, UIMenu>();
            WidthOffset = 0;

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

            _mainMenu = new UIContainer(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 UIResText(title, new Point(215 + _offset.X, 20 + _offset.Y), 1.15f, Color.White, Font.HouseScript, UIResText.Alignment.Centered));
            if (!String.IsNullOrWhiteSpace(subtitle))
            {
                _mainMenu.Items.Add(new UIResRectangle(new Point(0 + offset.X, 107 + _offset.Y), new Size(431, 37), Color.Black));
                _mainMenu.Items.Add(Subtitle = new UIResText(subtitle, new Point(8 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, UIResText.Alignment.Left));

                if (subtitle.StartsWith("~"))
                {
                    CounterPretext = subtitle.Substring(0, 3);
                }
                _counterText = new UIResText("", new Point(425 + _offset.X, 110 + _offset.Y), 0.35f, Color.WhiteSmoke, 0, UIResText.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 UIResRectangle(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 UIResRectangle(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 UIResRectangle(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 UIResText("Description", new Point(_offset.X + 5, 125), 0.35f, Color.FromArgb(255, 255, 255, 255), Font.ChaletLondon, UIResText.Alignment.Left);

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

            SetKey(MenuControls.Up, Control.PhoneUp);
            SetKey(MenuControls.Down, Control.PhoneDown);
            SetKey(MenuControls.Left, Control.PhoneLeft);
            SetKey(MenuControls.Right, Control.PhoneRight);
            SetKey(MenuControls.Select, Control.FrontendAccept);

            SetKey(MenuControls.Back, Control.PhoneCancel);
            SetKey(MenuControls.Back, Control.FrontendPause);
        }
Beispiel #2
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 UIMenuCheckboxItem(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;
 }
Beispiel #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 UIMenuListItem(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 UIResText("", new Point(290, y + 104), 0.35f, Color.White, Font.ChaletLondon,
         UIResText.Alignment.Left) {TextAlignment = UIResText.Alignment.Right};
     Index = index;
 }
Beispiel #4
0
        /// <summary>
        /// Basic menu button.
        /// </summary>
        /// <param name="text">Button label.</param>
        /// <param name="description">Description.</param>
        public UIMenuItem(string text, string description)
        {
            Text = text;
            _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0));
            _text = new UIResText(text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, false);
            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));
        }
        public UIMenuEditableNumericItem(string text, float defaultValue, float minimum, float maximum, float step, string description)
            : base(text, description)
        {
            Value = defaultValue;
            Minimum = minimum;
            Maximum = maximum;
            Step = step;
            _followingKeyEventNumber = 0;

            _valueText = new UIResText(defaultValue.ToString(), new Point(0, 0), 0.37f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.Alignment.Centered);
            _rightArrow = new Sprite("commonmenu", "arrowright", new Point(0, 0), new Size(30, 30));
            _leftArrow = new Sprite("commonmenu", "arrowleft", new Point(0, 0), new Size(30, 30));
        }
Beispiel #6
0
        /// <summary>
        /// Basic menu button.
        /// </summary>
        /// <param name="text">Button label.</param>
        /// <param name="description">Description.</param>
        public UIMenuItem(string text, string description)
        {
            Enabled = true;

            _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0));
            _text = new UIResText(text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.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 UIResText("", new Point(0, 0), 0.35f) {TextAlignment = UIResText.Alignment.Right};
        }
Beispiel #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(UIResRectangle rectangle)
 {
     _logo = null;
     _tmpRectangle = rectangle;
     _tmpRectangle.Position = new Point(_offset.X, _offset.Y);
     _tmpRectangle.Size = new Size(431 + WidthOffset, 107);
 }
Beispiel #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);
 }
Beispiel #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<UIMenuItem, UIMenu>();

            _mainMenu = new UIContainer(new Point(0 + Offset.X, 0 + Offset.Y), 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(new UIResText(title, new Point(215, 20), 1.15f, Color.White, Font.HouseScript, true));
            if (!String.IsNullOrWhiteSpace(subtitle))
            {
                _mainMenu.Items.Add(new UIResRectangle(new Point(0, 107), new Size(431, 37), Color.Black));
                _mainMenu.Items.Add(new UIResText(subtitle, new Point(8, 110), 0.35f, Color.WhiteSmoke, 0, false));

                if (subtitle.StartsWith("~"))
                {
                    CounterPretext = subtitle.Substring(0, 3);
                }
                _counterText = new UIResText("", new Point(360 + Offset.X, 110 + Offset.Y), 0.35f, Color.WhiteSmoke, 0, false);
                ExtraYOffset = 37;
            }
            Title = title;
            Subtitle = subtitle;

            _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 UIResRectangle(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 UIResRectangle(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 UIResRectangle(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 UIResText("Description", new Point(Offset.X + 5, 125), 0.33f, Color.FromArgb(255, 255, 255, 255), Font.ChaletLondon, false);

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

            SetKey(MenuControls.Up, GTA.Control.FrontendUp);
            SetKey(MenuControls.Down, GTA.Control.FrontendDown);
            SetKey(MenuControls.Left, GTA.Control.FrontendLeft);
            SetKey(MenuControls.Right, GTA.Control.FrontendRight);
            SetKey(MenuControls.Select, GTA.Control.FrontendAccept);

            SetKey(MenuControls.Back, GTA.Control.FrontendCancel);
            SetKey(MenuControls.Back, GTA.Control.FrontendPause);
            SetKey(MenuControls.Back, GTA.Control.Aim);

            MenuPool.Add(this);
        }
Beispiel #10
0
 public void SetBannerType(Sprite bannerType)
 {
     _menuList.ForEach(m => m.SetBannerType(bannerType));
 }
Beispiel #11
0
Datei: GUI.cs Projekt: Guad/NOOSE
        public static void DrawHUD(Teammate[] mates, int seconds = -1)
        {
            string[] photos = new[]
            {
                "hc_n_gus",
                "hc_n_kar",
                "hc_n_edd",
                "hc_n_pac",
            };

            SizeF res = UIMenu.GetScreenResolutionMantainRatio();
            Point safe = UIMenu.GetSafezoneBounds();
            new Sprite("heisthud", "main_gradient", new Point(Convert.ToInt32(res.Width) - safe.X - 300, Convert.ToInt32(res.Height) - safe.Y - (seconds == -1 ? 370 : 470)), new Size(400, (seconds == -1 ? 300 : 400)), 90f, Color.White).Draw();
            for (int i = 0; i < mates.Length; i++)
            {
                new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 110 - safe.Y - 100 * i), new Size(100, 20), Color.FromArgb(200, 57, 98, 116)).Draw();
                if (mates[i].Character.IsAlive)
                    new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 110 - safe.Y - 100 * i), new Size(Convert.ToInt32((mates[i].Character.Armor / 200f) * 100), 20), Color.FromArgb(200, 75, 140, 172)).Draw();

                new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 140 - safe.Y - 100*i), new Size(100, 20), Color.FromArgb(200, 60, 103, 52)).Draw();
                if(mates[i].Character.IsAlive)
                    new UIResRectangle(new Point(Convert.ToInt32(res.Width) - 100 - safe.X, Convert.ToInt32(res.Height) - 140 - safe.Y - 100 * i), new Size(Convert.ToInt32((mates[i].Character.Health/200f)*100), 20), Color.FromArgb(200, 90, 155, 85)).Draw();

                var photoSprite = new Sprite("heisthud", photos[i], new Point(Convert.ToInt32(res.Width) - 180 - safe.X, Convert.ToInt32(res.Height) - 150 - safe.Y - 100*i), new Size(70, 70));
                photoSprite.Draw();
                if (mates[i].Character.IsDead)
                {
                    new Sprite("heisthud", "kiaoverlay", new Point(Convert.ToInt32(res.Width) - 180 - safe.X, Convert.ToInt32(res.Height) - 130 - safe.Y - 100*i),
                        new Size(70, 50)).Draw();
                }
            }
            if(seconds != -1)
                DrawBombTimer(seconds);
        }
Beispiel #12
0
        protected void Init()
        {
            _selectedSprite = new Sprite("commonmenu", "gradient_nav", new Point(0, 0), new Size(431, 38), 0, HighlightColor);
            _rectangle = new UIResRectangle(new Point(0, 0), new Size(431, 38), Color.FromArgb(150, 0, 0, 0));
            _text = new UIResText(Text, new Point(8, 0), 0.33f, Color.WhiteSmoke, GTA.Font.ChaletLondon, UIResText.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 UIResText("", new Point(0, 0), 0.35f) { TextAlignment = UIResText.Alignment.Right };
        }