/// <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 override void Draw() { base.Draw(); for (int i = 0; i < Buttons.Count; i++) { Buttons[i].Position = SafeSize.AddPoints(new Point(15, 15 + 55 * i)); Buttons[i].Size = new Size(BottomRight.X - TopLeft.X, 40); Buttons[i].Focused = Focused; Buttons[i].Active = Index == i; Buttons[i].Visible = true; var hovered = UIMenu.IsMouseInBounds(Buttons[i].Position, Buttons[i].Size); Buttons[i].Hovered = hovered && Index != i; if (hovered && Game.IsControlJustPressed(Control.CursorAccept)) { if (Index != i) { Index = i; } else { Buttons[i].OnActivated(); } } Buttons[i].Draw(); } }
public override void Draw() { base.Draw(); var alpha = (Focused || !CanBeFocused) ? 255 : 200; if (!string.IsNullOrEmpty(TextTitle)) { ResText.Draw(TextTitle, SafeSize.AddPoints(new Point(40, 20)), 1.5f, Color.FromArgb(alpha, Color.White), Common.EFont.ChaletLondon, false); } if (!string.IsNullOrEmpty(Text)) { var ww = WordWrap == 0 ? BottomRight.X - TopLeft.X - 40 : WordWrap; ResText.Draw(Text, SafeSize.AddPoints(new Point(40, 150)), 0.4f, Color.FromArgb(alpha, Color.White), Common.EFont.ChaletLondon, ResText.Alignment.Left, false, false, new Size((int)ww, 0)); } }
public override void Draw() { base.Draw(); var alpha = (Focused || !CanBeFocused) ? 255 : 200; if (!string.IsNullOrEmpty(TextTitle)) { new UIResText(TextTitle, SafeSize.AddPoints(new PointF(40, 20)), 1.5f, Color.FromArgb(alpha, Colors.White)).Draw(); } if (!string.IsNullOrEmpty(Text)) { var ww = WordWrap == 0 ? BottomRight.X - TopLeft.X - 40 : WordWrap; new UIResText(Text, SafeSize.AddPoints(new PointF(40, 150)), 0.4f, Color.FromArgb(alpha, Colors.White)) { Wrap = ww }.Draw(); } }
public override void Draw() { base.Draw(); var res = UIMenu.GetScreenResolutionMantainRatio(); var alpha = (Focused || !CanBeFocused) ? 255 : 200; if (!string.IsNullOrEmpty(TextTitle)) { new UIResText(TextTitle, SafeSize.AddPoints(new PointF(40, 20)), 1.5f, Color.FromArgb(alpha, UnknownColors.White)).Draw(); } if (!string.IsNullOrEmpty(Text)) { var ww = WordWrap == 0 ? BottomRight.X - TopLeft.X - 40 : WordWrap; new UIResText(Text, SafeSize.AddPoints(new PointF(40, 150)), 0.4f, Color.FromArgb(alpha, UnknownColors.White)) { WordWrap = new SizeF((int)ww, 0) }.Draw(); } }
public override void Draw() { if (!Visible) { return; } base.Draw(); ProcessControls(); var res = UIMenu.GetScreenResolutionMantainRatio(); var alpha = Focused ? 120 : 30; 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++) { new UIResRectangle(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Color.White) : Color.FromArgb(blackAlpha, Color.Black)).Draw(); new UIResText(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)).Draw(); } Items[Index].Visible = true; Items[Index].FadeInWhenFocused = true; Items[Index].CanBeFocused = true; Items[Index].Focused = Focused; 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 override void Draw() { base.Draw(); if (Heists.Count == 0) { return; } var res = UIMenu.GetScreenResolutionMaintainRatio(); var activeWidth = res.Width - SafeSize.X * 2; var itemSize = new SizeF((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 UIResRectangle(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * counter)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, UnknownColors.White) : Color.FromArgb(blackAlpha, UnknownColors.Black)).Draw(); new UIResText(Heists[i].Name, SafeSize.AddPoints(new PointF(6, 5 + (itemSize.Height + 3) * counter)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? UnknownColors.Black : UnknownColors.White)).Draw(); counter++; } if (Heists[Index].Logo == null || string.IsNullOrEmpty(Heists[Index].Logo.FileName)) { _noLogo.Position = new PointF((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.FileName != null && !Heists[Index].Logo.IsGameTexture) { var target = Heists[Index].Logo.FileName; //Sprite.DrawTexture(target, new PointF((int)res.Width - SafeSize.X - 512, SafeSize.Y), new SizeF(512, 256)); } else if (Heists[Index].Logo != null && Heists[Index].Logo.FileName != null && Heists[Index].Logo.IsGameTexture) { var newLogo = new Sprite(Heists[Index].Logo.DictionaryName, Heists[Index].Logo.FileName, new PointF(), new SizeF(512, 256)) { Position = new PointF((int)res.Width - SafeSize.X - 512, SafeSize.Y), Color = Color.FromArgb(blackAlpha, 0, 0, 0) }; newLogo.Draw(); } new UIResRectangle(new PointF((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256), new SizeF(512, 40), Color.FromArgb(fullAlpha, UnknownColors.Black)).Draw(); new UIResText(Heists[Index].Name, new PointF((int)res.Width - SafeSize.X - 4, SafeSize.Y + 260), 0.5f, Color.FromArgb(fullAlpha, UnknownColors.White), Font.HouseScript, UIResText.ScreenAlignment.Right).Draw(); for (int i = 0; i < Heists[Index].ValueList.Count; i++) { new UIResRectangle(new PointF((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 40 + (40 * i)), new SizeF(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 UIResText(text, new PointF((int)res.Width - SafeSize.X - 506, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, UnknownColors.White)).Draw(); new UIResText(label, new PointF((int)res.Width - SafeSize.X - 6, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, UnknownColors.White), Font.ChaletLondon, UIResText.ScreenAlignment.Right).Draw(); } if (!string.IsNullOrEmpty(Heists[Index].Description)) { var propLen = Heists[Index].ValueList.Count; new UIResRectangle(new PointF((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 42 + 40 * propLen), new SizeF(512, 2), Color.FromArgb(fullAlpha, UnknownColors.White)).Draw(); new UIResText(Heists[Index].Description, new PointF((int)res.Width - SafeSize.X - 508, SafeSize.Y + 256 + 45 + 40 * propLen + 4), 0.35f, Color.FromArgb(fullAlpha, UnknownColors.White)) { WordWrap = new SizeF(508, 0), }.Draw(); new UIResRectangle(new PointF((int)res.Width - SafeSize.X - 512, SafeSize.Y + 256 + 44 + 40 * propLen), new SizeF(512, 45 * (int)(StringMeasurer.MeasureString(Heists[Index].Description) / 500)), Color.FromArgb(blackAlpha, 0, 0, 0)).Draw(); } }
public override void Draw() { if (!Visible) { return; } base.Draw(); var res = UIMenu.GetScreenResolutionMaintainRatio(); var alpha = Focused ? 120 : 30; 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 SizeF((int)activeWidth - (submenuWidth + 3), 40); for (int i = 0; i < Items.Count; i++) { var hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize); new UIResRectangle(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, UnknownColors.White) : hovering && Focused ? Color.FromArgb(100, 50, 50, 50) : Color.FromArgb(blackAlpha, UnknownColors.Black)).Draw(); new UIResText(Items[i].Title, SafeSize.AddPoints(new PointF(6, 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? UnknownColors.Black : UnknownColors.White)).Draw(); if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept)) { Items[Index].Focused = false; Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1); 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; //Items[Index].CanBeFocused = true; if (!Items[Index].CanBeFocused) { Items[Index].Focused = Focused; } Items[Index].UseDynamicPositionment = false; Items[Index].SafeSize = SafeSize.AddPoints(new PointF((int)activeWidth - submenuWidth, 0)); Items[Index].TopLeft = SafeSize.AddPoints(new PointF((int)activeWidth - submenuWidth, 0)); Items[Index].BottomRight = new PointF((int)res.Width - SafeSize.X, (int)res.Height - SafeSize.Y); Items[Index].Draw(); }
public override void Draw() { if (!Visible) { return; } base.Draw(); var res = UIMenu.GetScreenResolutionMantainRatio(); var alpha = Focused ? 120 : 30; var blackAlpha = Focused ? 200 : 100; var fullAlpha = Focused ? 255 : 150; var submenuWidth = (BottomRight.X - TopLeft.X); var itemSize = new Size(submenuWidth, 40); int i = 0; for (int c = _minItem; c < Math.Min(Items.Count, _maxItem); c++) { var hovering = UIMenu.IsMouseInBounds(SafeSize.AddPoints(new Point(0, (itemSize.Height + 3) * i)), itemSize); var hasLeftBadge = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None; var hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None; var hasBothBadges = hasRightBadge && hasLeftBadge; var hasAnyBadge = hasRightBadge || hasLeftBadge; new UIResRectangle(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)).Draw(); new UIResText(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)).Draw(); if (hasLeftBadge && !hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge), UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw(); } if (!hasLeftBadge && hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge), UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw(); } if (hasLeftBadge && hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge), UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(-2, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw(); new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge), UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new Point(25, 1 + (itemSize.Height + 3) * i)), new Size(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw(); } if (!string.IsNullOrEmpty(Items[c].RightLabel)) { new UIResText(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), Font.ChaletLondon, UIResText.Alignment.Right).Draw(); } 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"; } new Sprite("commonmenu", textureName, SafeSize.AddPoints(new Point(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new Size(50, 50)).Draw(); } if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept)) { bool open = Index == c; Index = (1000 - (1000 % Items.Count) + c) % Items.Count; if (!open) { Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1); } else { if (Items[Index] is UIMenuCheckboxItem) { Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1); ((UIMenuCheckboxItem)Items[Index]).Checked = !((UIMenuCheckboxItem)Items[Index]).Checked; ((UIMenuCheckboxItem)Items[Index]).CheckboxEventTrigger(); } else { Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1); Items[Index].ItemActivate(null); } } } i++; } }
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)); } }
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++; } }
public override void Draw() { if (!Visible) { return; } base.Draw(); var res = ScreenTools.ResolutionMaintainRatio; var alpha = Focused ? 120 : 30; var blackAlpha = Focused ? 200 : 100; var fullAlpha = Focused ? 255 : 150; var submenuWidth = (BottomRight.X - TopLeft.X); var itemSize = new SizeF(submenuWidth, 40); int i = 0; for (int c = _minItem; c < Math.Min(Items.Count, _maxItem); c++) { var hovering = ScreenTools.IsMouseInBounds(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize); var hasLeftBadge = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None; var hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None; var hasBothBadges = hasRightBadge && hasLeftBadge; var hasAnyBadge = hasRightBadge || hasLeftBadge; new UIResRectangle(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Colors.White) : Focused && hovering ? Color.FromArgb(100, 50, 50, 50) : Color.FromArgb(blackAlpha, Colors.Black)).Draw(); new UIResText(Items[c].Text, SafeSize.AddPoints(new PointF((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White)).Draw(); if (hasLeftBadge && !hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge), UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw(); } if (!hasLeftBadge && hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge), UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw(); } if (hasLeftBadge && hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge), UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw(); new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge), UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(25, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw(); } if (!string.IsNullOrEmpty(Items[c].RightLabel)) { new UIResText(Items[c].RightLabel, SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White), Font.ChaletLondon, Alignment.Right).Draw(); } 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"; } new Sprite("commonmenu", textureName, SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)), new SizeF(50, 50)).Draw(); } else if (Items[c] is UIMenuListItem convItem) { var yoffset = 5; var basePos = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i)); var arrowLeft = new Sprite("commonmenu", "arrowleft", basePos, new SizeF(30, 30)); var arrowRight = new Sprite("commonmenu", "arrowright", basePos, new SizeF(30, 30)); var itemText = new UIResText("", basePos, 0.35f, Colors.White, Font.ChaletLondon, Alignment.Left) { TextAlignment = Alignment.Right }; string caption = convItem.Items[convItem.Index].ToString(); float offset = ScreenTools.GetTextWidth(caption, itemText.Font, itemText.Scale); var selected = c == Index && Focused; itemText.Color = convItem.Enabled ? selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); itemText.Caption = caption; arrowLeft.Color = convItem.Enabled ? selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); arrowRight.Color = convItem.Enabled ? selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); arrowLeft.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60 - (int)offset, yoffset + (itemSize.Height + 3) * i)); if (selected) { arrowLeft.Draw(); arrowRight.Draw(); itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i)); } else { itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i)); } itemText.Draw(); } if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept)) { bool open = Index == c; Index = (1000 - (1000 % Items.Count) + c) % Items.Count; if (!open) { Game.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET"); } else { if (Items[Index] is UIMenuCheckboxItem) { Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET"); ((UIMenuCheckboxItem)Items[Index]).Checked = !((UIMenuCheckboxItem)Items[Index]).Checked; ((UIMenuCheckboxItem)Items[Index]).CheckboxEventTrigger(); } else { Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET"); Items[Index].ItemActivate(null); } } } i++; } }
public override void Draw() { base.Draw(); if (Heists.Count == 0) { return; } var alpha = Focused ? 120 : 30; var blackAlpha = Focused ? 200 : 100; var fullAlpha = Focused ? 255 : 150; var activeWidth = Resolution.Width - SafeSize.X * 2; var itemSize = new SizeF((int)activeWidth - (_add + 515), 40); var counter = 0; for (int i = _minItem; i < Math.Min(Heists.Count, _maxItem); i++) { new UIResRectangle(SafeSize.AddPoints(new PointF(0, 43 * counter)), itemSize, (Index == i && Focused) ? Color.FromArgb(fullAlpha, Colors.White) : Color.FromArgb(blackAlpha, Colors.Black)).Draw(); new UIResText(Heists[i].Name, SafeSize.AddPoints(new PointF(6, 5 + 43 * counter)), 0.35f, Color.FromArgb(fullAlpha, (Index == i && Focused) ? Colors.Black : Colors.White)).Draw(); counter++; } if (Heists[Index].Logo == null || string.IsNullOrEmpty(Heists[Index].Logo.FileName)) { _noLogo.Position = new PointF((int)Resolution.Width - SafeSize.X - (512 + _add), SafeSize.Y); _noLogo.Color = Color.FromArgb(blackAlpha, 0, 0, 0); _noLogo.Draw(); } else if (Heists[Index].Logo != null && Heists[Index].Logo.FileName != null && !Heists[Index].Logo.IsGameTexture) { //var target = Heists[Index].Logo.FileName; //Sprite.DrawTexture(target, new PointF((int)Resolution.Width - SafeSize.X - 512, SafeSize.Y), new SizeF(512, 256)); } else if (Heists[Index].Logo != null && Heists[Index].Logo.FileName != null && Heists[Index].Logo.IsGameTexture) { var newLogo = new Sprite(Heists[Index].Logo.DictionaryName, Heists[Index].Logo.FileName, new PointF((int)Resolution.Width - SafeSize.X - (512 + _add), SafeSize.Y), new SizeF(512, 256)) { Color = Color.FromArgb(blackAlpha, 0, 0, 0) }; newLogo.Draw(); } new UIResRectangle(new PointF((int)Resolution.Width - SafeSize.X - (512 + _add), SafeSize.Y + 256), new SizeF(512, 40), Color.FromArgb(fullAlpha, Colors.Black)).Draw(); new UIResText(Heists[Index].Name, new PointF((int)Resolution.Width - SafeSize.X - (4 + _add), SafeSize.Y + 260), 0.5f, Color.FromArgb(fullAlpha, Colors.White), Font.HouseScript, Alignment.Right).Draw(); for (int i = 0; i < Heists[Index].ValueList.Count; i++) { new UIResRectangle(new PointF((int)Resolution.Width - SafeSize.X - (512 + _add), SafeSize.Y + 256 + 40 + (40 * i)), new SizeF(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 UIResText(text, new PointF((int)Resolution.Width - SafeSize.X - (506 + _add), SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Colors.White)).Draw(); new UIResText(label, new PointF((int)Resolution.Width - SafeSize.X - (6 + _add), SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Colors.White), Font.ChaletLondon, Alignment.Right).Draw(); } if (!string.IsNullOrEmpty(Heists[Index].Description)) { var propLen = Heists[Index].ValueList.Count; new UIResRectangle(new PointF((int)Resolution.Width - SafeSize.X - (512 + _add), SafeSize.Y + 256 + 42 + 40 * propLen), new SizeF(512, 2), Color.FromArgb(fullAlpha, Colors.White)).Draw(); new UIResText(Heists[Index].Description, new PointF((int)Resolution.Width - SafeSize.X - (508 + _add), SafeSize.Y + 256 + 45 + 40 * propLen + 4), 0.35f, Color.FromArgb(fullAlpha, Colors.White)) { Wrap = (508 + _add) }.Draw(); new UIResRectangle(new PointF((int)Resolution.Width - SafeSize.X - (512 + _add), SafeSize.Y + 256 + 44 + 40 * propLen), new SizeF(512, 45 * (int)(ScreenTools.GetTextWidth(Heists[Index].Description, Font.ChaletLondon, 0.35f) / 500)), Color.FromArgb(blackAlpha, 0, 0, 0)).Draw(); } }
public override void Draw() { if (!Visible) { return; } base.Draw(); var alpha = Focused ? 120 : 30; var blackAlpha = Focused ? 200 : 100; var fullAlpha = Focused ? 250 : 150; var submenuWidth = (BottomRight.X - TopLeft.X); var itemSize = new SizeF(submenuWidth, 40); int i = 0; for (int c = _minItem; c < Math.Min(Items.Count, _maxItem); c++) { var hovering = ScreenTools.IsMouseInBounds(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize); var hasLeftBadge = Items[c].LeftBadge != UIMenuItem.BadgeStyle.None; var hasRightBadge = Items[c].RightBadge != UIMenuItem.BadgeStyle.None; var hasBothBadges = hasRightBadge && hasLeftBadge; var hasAnyBadge = hasRightBadge || hasLeftBadge; new UIResRectangle(SafeSize.AddPoints(new PointF(0, (itemSize.Height + 3) * i)), itemSize, (Index == c && Focused) ? Color.FromArgb(fullAlpha, Colors.White) : Focused && hovering ? Color.FromArgb(100, 50, 50, 50) : Color.FromArgb(blackAlpha, Colors.Black)).Draw(); new UIResText(Items[c].Text, SafeSize.AddPoints(new PointF((hasBothBadges ? 60 : hasAnyBadge ? 30 : 6), 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White)).Draw(); if (hasLeftBadge && !hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge), UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw(); } if (!hasLeftBadge && hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge), UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw(); } if (hasLeftBadge && hasRightBadge) { new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].LeftBadge), UIMenuItem.BadgeToSpriteName(Items[c].LeftBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(-2, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].LeftBadge, (Index == c && Focused))).Draw(); new Sprite(UIMenuItem.BadgeToSpriteLib(Items[c].RightBadge), UIMenuItem.BadgeToSpriteName(Items[c].RightBadge, (Index == c && Focused)), SafeSize.AddPoints(new PointF(25, 1 + (itemSize.Height + 3) * i)), new SizeF(40, 40), 0f, UIMenuItem.BadgeToColor(Items[c].RightBadge, (Index == c && Focused))).Draw(); } if (!string.IsNullOrEmpty(Items[c].RightLabel)) { new UIResText(Items[c].RightLabel, SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, 5 + (itemSize.Height + 3) * i)), 0.35f, Color.FromArgb(fullAlpha, (Index == c && Focused) ? Colors.Black : Colors.White), Font.ChaletLondon, Alignment.Right).Draw(); } if (Items[c] is UIMenuCheckboxItem convItem) { convItem.Selected = c == Index && Focused; convItem._checkedSprite.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60, -5 + (itemSize.Height + 3) * i)); convItem._checkedSprite.TextureName = convItem.Selected ? (convItem.Checked ? (convItem.Style == UIMenuCheckboxStyle.Tick ? "shop_box_tickb" : "shop_box_crossb") : "shop_box_blankb") : convItem.Checked ? (convItem.Style == UIMenuCheckboxStyle.Tick ? "shop_box_tick" : "shop_box_cross") : "shop_box_blank"; convItem._checkedSprite.Draw(); } else if (Items[c] is UIMenuListItem listItem) { var yoffset = 5; var basePos = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i)); listItem._arrowLeft.Position = basePos; listItem._arrowRight.Position = basePos; listItem._itemText.Position = basePos; listItem._itemText.Color = Colors.White; listItem._itemText.Font = Font.ChaletLondon; listItem._itemText.Alignment = Alignment.Left; listItem._itemText.TextAlignment = Alignment.Right; string caption = listItem.Items[listItem.Index].ToString(); float offset = ScreenTools.GetTextWidth(caption, listItem._itemText.Font, listItem._itemText.Scale); var selected = c == Index && Focused; listItem.Selected = selected; listItem._itemText.Color = listItem.Enabled ? listItem.Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); listItem._itemText.Caption = caption; listItem._arrowLeft.Color = listItem.Enabled ? listItem.Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); listItem._arrowRight.Color = listItem.Enabled ? listItem.Selected ? Colors.Black : Colors.WhiteSmoke : Color.FromArgb(163, 159, 148); listItem._arrowLeft.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 60 - (int)offset, yoffset + (itemSize.Height + 3) * i)); if (listItem.Selected) { listItem._arrowLeft.Draw(); listItem._arrowRight.Draw(); listItem._itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 30, yoffset + (itemSize.Height + 3) * i)); } else { listItem._itemText.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 5, yoffset + (itemSize.Height + 3) * i)); } listItem._itemText.Draw(); } else if (Items[c] is UIMenuSliderItem sliderItem) { var yoffset = 15; var basePos = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 210, yoffset + (itemSize.Height + 3) * i)); sliderItem._rectangleBackground.Position = basePos; sliderItem._rectangleBackground.Size = new SizeF(200f, 10); sliderItem._rectangleSlider.Position = basePos; sliderItem._rectangleSlider.Size = new SizeF(100f, 10); sliderItem._rectangleDivider.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 110, (yoffset - 5) + (itemSize.Height + 3) * i)); sliderItem._rectangleDivider.Size = new SizeF(2, 20); if (sliderItem.Divider) { sliderItem._rectangleDivider.Color = Colors.WhiteSmoke; } sliderItem.Selected = c == Index && Focused; sliderItem._rectangleSlider.Position = new PointF(basePos.X + (sliderItem._value / (float)sliderItem._max * 100f), sliderItem._rectangleSlider.Position.Y); sliderItem._rectangleBackground.Draw(); sliderItem._rectangleSlider.Draw(); if (sliderItem.Divider) { sliderItem._rectangleDivider.Draw(); } } else if (Items[c] is UIMenuSliderProgressItem sliderProgressItem) { var yoffset = 15; var basePos = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 210, yoffset + (itemSize.Height + 3) * i)); sliderProgressItem._rectangleBackground.Position = basePos; sliderProgressItem._rectangleBackground.Size = new SizeF(200, 10); sliderProgressItem._rectangleSlider.Position = basePos; sliderProgressItem._rectangleDivider.Position = SafeSize.AddPoints(new PointF(BottomRight.X - SafeSize.X - 100, (yoffset - 5) + (itemSize.Height + 3f) * i)); sliderProgressItem._rectangleDivider.Size = new SizeF(2, 20); if (sliderProgressItem.Divider) { sliderProgressItem._rectangleDivider.Color = Colors.WhiteSmoke; } sliderProgressItem.Selected = c == Index && Focused; sliderProgressItem._rectangleBackground.Draw(); sliderProgressItem._rectangleSlider.Draw(); sliderProgressItem._rectangleDivider.Draw(); if (ScreenTools.IsMouseInBounds(new PointF(sliderProgressItem._rectangleBackground.Position.X, sliderProgressItem._rectangleBackground.Position.Y - 5), new SizeF(200f, sliderProgressItem._rectangleBackground.Size.Height))) { if (API.IsDisabledControlPressed(0, 24)) { if (!sliderProgressItem.Pressed) { sliderProgressItem.Pressed = true; sliderProgressItem.Audio.Id = API.GetSoundId(); API.PlaySoundFrontend(sliderProgressItem.Audio.Id, sliderProgressItem.Audio.Slider, sliderProgressItem.Audio.Library, true); } float CursorX = API.GetDisabledControlNormal(0, 239) * Resolution.Width; var Progress = CursorX - sliderProgressItem._rectangleSlider.Position.X; sliderProgressItem.Value = (int)Math.Round(sliderProgressItem._max * ((Progress >= 0f && Progress <= 200f) ? Progress : (Progress < 0) ? 0 : 200f) / 200f); sliderProgressItem.SliderProgressChanged(sliderProgressItem.Value); } else { API.StopSound(sliderProgressItem.Audio.Id); API.ReleaseSoundId(sliderProgressItem.Audio.Id); sliderProgressItem.Pressed = false; } } else { API.StopSound(sliderProgressItem.Audio.Id); API.ReleaseSoundId(sliderProgressItem.Audio.Id); sliderProgressItem.Pressed = false; } } if (Focused && hovering && Game.IsControlJustPressed(0, Control.CursorAccept)) { bool open = Index == c; Index = (1000 - (1000 % Items.Count) + c) % Items.Count; if (!open) { Game.PlaySound("NAV_UP_DOWN", "HUD_FRONTEND_DEFAULT_SOUNDSET"); } else { if (Items[Index] is UIMenuCheckboxItem) { Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET"); ((UIMenuCheckboxItem)Items[Index]).Checked = !((UIMenuCheckboxItem)Items[Index]).Checked; ((UIMenuCheckboxItem)Items[Index]).CheckboxEventTrigger(); } else { Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET"); Items[Index].ItemActivate(null); } } } i++; } }