diff --git a/MenuExample/MenuExample.cs b/MenuExample/MenuExample.cs index d8ef49d..3ad5ee4 100644 --- a/MenuExample/MenuExample.cs +++ b/MenuExample/MenuExample.cs @@ -238,7 +238,7 @@ public async void OpenCustomPauseMenu() string Txd = API.GetPedheadshotTxdString(mugshot); MenuContainer.Photo = new NativeUI.Sprite(Txd, Txd, PointF.Empty, SizeF.Empty); // Position and size can be empty.. they'll be handled by the TabView - //this will add our player smugshot to the pause menu + //this will add our player smugshot to the pause menu MenuContainer.Money = "1000"; // if money and moneySubtitle are empty or not used, the current datetime will be printed MenuContainer.MoneySubtitle = "Bank = 10"; @@ -267,7 +267,25 @@ public async void OpenCustomPauseMenu() }; TabInteractiveListItem Item4 = new TabInteractiveListItem("TabInteractiveListItem", items); - + List info = new List() + { + new MissionInformation("Mission 1", new List>() + { + new Tuple("item 1", "description 1"), + new Tuple("item 2", "description 2"), + new Tuple("item 3", "description 3"), + new Tuple("item 4", "description 4"), + new Tuple("item 5", "description 5"), + }), + new MissionInformation("Mission 2", new List>() + { + new Tuple("item 1", "description 1"), + new Tuple("item 2", "description 2"), + new Tuple("item 3", "description 3"), + new Tuple("item 4", "description 4"), + new Tuple("item 5", "description 5"), + }), + }; TabSubmenuItem Item5 = new TabSubmenuItem("TabSubmenuItem", new List() { new TabItem("simple TabItem"), @@ -281,13 +299,17 @@ public async void OpenCustomPauseMenu() ["Item 5"] = "subItem 5", ["Item 6"] = "subItem 6" }), + new TabMissionSelectItem("Mission tab", info), new TabInteractiveListItem("TabInteractiveListItem", items) }); + TabMissionSelectItem Item6 = new TabMissionSelectItem("Mission tab", info); + MenuContainer.AddTab(Item1); MenuContainer.AddTab(Item2); MenuContainer.AddTab(Item3); MenuContainer.AddTab(Item4); MenuContainer.AddTab(Item5); + MenuContainer.AddTab(Item6); // this way we can choose which tab is the defualt one Item1.Active = true; Item1.Focused = true; diff --git a/NativeUI/PauseMenu/TabItem.cs b/NativeUI/PauseMenu/TabItem.cs index 92a6a24..9a6fabf 100644 --- a/NativeUI/PauseMenu/TabItem.cs +++ b/NativeUI/PauseMenu/TabItem.cs @@ -48,14 +48,13 @@ public virtual void Draw() { if (!Visible) return; - var res = ScreenTools.ResolutionMaintainRatio; if (UseDynamicPositionment) { SafeSize = new PointF(300, 240); TopLeft = new PointF(SafeSize.X, SafeSize.Y); - BottomRight = new PointF((int)res.Width - SafeSize.X, (int)res.Height - SafeSize.Y); + BottomRight = new PointF((int)Resolution.Width - SafeSize.X, (int)Resolution.Height - SafeSize.Y); } var rectSize = new SizeF(BottomRight.SubtractPoints(TopLeft)); diff --git a/NativeUI/PauseMenu/TabMissionSelectItem.cs b/NativeUI/PauseMenu/TabMissionSelectItem.cs index 30ee1cc..e9157c4 100644 --- a/NativeUI/PauseMenu/TabMissionSelectItem.cs +++ b/NativeUI/PauseMenu/TabMissionSelectItem.cs @@ -62,6 +62,7 @@ public MissionLogo(string textureDict, string textureName) public class TabMissionSelectItem : TabItem { + protected internal float _add = 0; public TabMissionSelectItem(string name, IEnumerable list) : base(name) { base.FadeInWhenFocused = true; @@ -148,68 +149,69 @@ public override void Draw() base.Draw(); if (Heists.Count == 0) return; - var activeWidth = Resolution.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; - + Debug.WriteLine("_add = " + _add); + var activeWidth = Resolution.Width - SafeSize.X * 2; + var itemSize = new SizeF((int)activeWidth - (_add + 515), 40); + Debug.WriteLine("itemsize = " + itemSize); + Debug.WriteLine("activeWidth = " + activeWidth); 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, Colors.White) : Color.FromArgb(blackAlpha, Colors.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) ? Colors.Black : Colors.White)).Draw(); + 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, SafeSize.Y); + _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; + //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(), new SizeF(512, 256)) + 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)) { - Position = new PointF((int)Resolution.Width - SafeSize.X - 512, SafeSize.Y), Color = Color.FromArgb(blackAlpha, 0, 0, 0) }; newLogo.Draw(); } - new UIResRectangle(new PointF((int)Resolution.Width - SafeSize.X - 512, 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, SafeSize.Y + 260), 0.5f, Color.FromArgb(fullAlpha, Colors.White), + 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, SafeSize.Y + 256 + 40 + (40 * 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, 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, SafeSize.Y + 260 + 42 + (40 * i)), 0.35f, Color.FromArgb(fullAlpha, Colors.White), Font.ChaletLondon, Alignment.Right).Draw(); + 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, SafeSize.Y + 256 + 42 + 40 * propLen), + 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, SafeSize.Y + 256 + 45 + 40 * propLen + 4), 0.35f, - Color.FromArgb(fullAlpha, Colors.White)) { Wrap = 508 }.Draw(); - new UIResRectangle(new PointF((int)Resolution.Width - SafeSize.X - 512, SafeSize.Y + 256 + 44 + 40 * propLen), + 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(); } diff --git a/NativeUI/PauseMenu/TabSubmenuItem.cs b/NativeUI/PauseMenu/TabSubmenuItem.cs index 6ac944f..78da76c 100644 --- a/NativeUI/PauseMenu/TabSubmenuItem.cs +++ b/NativeUI/PauseMenu/TabSubmenuItem.cs @@ -147,6 +147,10 @@ public override void Draw() 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)Resolution.Width - SafeSize.X, (int)Resolution.Height - SafeSize.Y); + if (Items[Index] is TabMissionSelectItem it) + { + it._add = -420; + } Items[Index].Draw(); } }