/// <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); }
public PIMenu() { Tick += OnTick; KeyDown += OnKeyDown; Function.Call(Hash.REQUEST_CLIP_SET, "move_m@brave"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@confident"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@drunk"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@drunk@verydrunk"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@fat@a"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@shadyped@a"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@hurry@a"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@injured"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@intimidation@1h"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@quick"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@sad@a"); Function.Call(Hash.REQUEST_CLIP_SET, "move_m@tool_belt@a"); MenuColor = Color.Blue; MainMenu = new UIMenu(Game.Player.Name.ToString(), "INTERACTION MENU", new Point(0, 0)); MenuPool.Add(MainMenu); GlobalMenuBanner = new UIResRectangle(); GlobalMenuBanner.Color = MenuColor; MainMenu.SetBannerType(GlobalMenuBanner); MainMenu.Title.Font = GTA.Font.ChaletComprimeCologne; MainMenu.Title.Scale = 0.86f; MainMenu.Subtitle.Color = MenuColor; var QuickGPSList = new List<dynamic> { "None", "Ammu-Nation", "Convenience Store", "Mod Shop", "Clothes Store", }; MainMenu.AddItem(QuickGPSItem = new UIMenuListItem("Quick GPS", QuickGPSList, 0, "Select to place your waypoint at a set location.")); QuickGPSItem.Activated += (UIMenu sender, UIMenuItem selecteditem) => { var tmpList = (UIMenuListItem)selecteditem; switch (tmpList.Index) { case 0: Function.Call(Hash.SET_WAYPOINT_OFF); break; case 1: Vector3 NearestAmmunation = PointsOfInterest.GetClosestPoi(Game.Player.Character.Position, PointsOfInterest.Type.AmmuNation); Function.Call(Hash.SET_NEW_WAYPOINT, NearestAmmunation.X, NearestAmmunation.Y); break; } }; InventoryMenu = new UIMenu(Game.Player.Name.ToString(), "INVENTORY", new Point(0, 0)); MenuPool.Add(InventoryMenu); InventoryMenu.SetBannerType(GlobalMenuBanner); InventoryMenu.Title.Font = GTA.Font.ChaletComprimeCologne; InventoryMenu.Title.Scale = 0.86f; InventoryMenu.Subtitle.Color = MenuColor; var InventoryMenuItem = new UIMenuItem("Inventory", "Your inventory which contains clothing, ammo, and much more."); MainMenu.AddItem(InventoryMenuItem); MainMenu.BindMenuToItem(InventoryMenu, InventoryMenuItem); var PlayerMoodsList = new List<dynamic> { "None", "Normal", "Happy", "Angry", "Injured", "Stressed", }; MainMenu.AddItem(PlayerMoodItem = new UIMenuListItem("Player Mood", PlayerMoodsList, 0, "Sets your character's facial expression.")); var WalkStyleList = new List<dynamic> { "Normal", "Brave", "Confident", "Drunk", "Fat", "Gangster", "Hurry", "Injured", "Intimidated", "Quick ", "Sad", "Tough Guy" }; MainMenu.AddItem(WalkStyleItem = new UIMenuListItem("Walk Style", WalkStyleList, 0, "Sets your Character's walking style.")); var AimingStyleList = new List<dynamic> { "None", "Gangster", "Cowboy", }; MainMenu.AddItem(AimingStyleItem = new UIMenuListItem("Aiming Style", AimingStyleList, 0, "Sets your Character's pistol aiming style.")); PassiveModeItem = new UIMenuItem("Enable Passive Mode", "Passive Mode will prevent damage and wanted levels from police."); MainMenu.AddItem(PassiveModeItem); MenuOptionsMenu = new UIMenu(Game.Player.Name.ToString(), "MENU OPTIONS", new Point(0, 0)); MenuPool.Add(MenuOptionsMenu); MenuOptionsMenu.SetBannerType(GlobalMenuBanner); MenuOptionsMenu.Title.Font = GTA.Font.ChaletComprimeCologne; MenuOptionsMenu.Title.Scale = 0.86f; MenuOptionsMenu.Subtitle.Color = MenuColor; var MenuOptionsMenuItem = new UIMenuItem("Menu Options", ""); MainMenu.AddItem(MenuOptionsMenuItem); MainMenu.BindMenuToItem(MenuOptionsMenu, MenuOptionsMenuItem); AboutMenu = new UIMenu(Game.Player.Name.ToString(), "ABOUT", new Point(0, 0)); MenuPool.Add(AboutMenu); AboutMenu.SetBannerType(GlobalMenuBanner); AboutMenu.Title.Font = GTA.Font.ChaletComprimeCologne; AboutMenu.Title.Scale = 0.86f; AboutMenu.Subtitle.Color = MenuColor; var AboutOptionsMenuItem = new UIMenuItem("About", ""); MenuOptionsMenu.BindMenuToItem(AboutMenu, AboutOptionsMenuItem); var MenuColorList = new List<dynamic> { "Blue", "Red", "Green", "Orange", "Purple", "Yellow", }; MenuOptionsMenu.AddItem(MenuColorItem = new UIMenuListItem("Color", MenuColorList, 0, "Select interaction menu's color theme.")); MenuOptionsMenu.AddItem(AboutOptionsMenuItem); var VersionItem = new UIMenuItem("Version"); var AuthorItem = new UIMenuItem("Author"); AboutMenu.AddItem(VersionItem); AboutMenu.AddItem(AuthorItem); VersionItem.SetRightLabel("1.0"); AuthorItem.SetRightLabel("jedijosh920 & Guadmaz"); MainMenu.OnItemSelect += (UIMenu sender, UIMenuItem selectedItem, int index) => { switch (index) { case 5: if (!IsPassiveMode) { Game.Player.Character.IsInvincible = true; Game.Player.Character.Alpha = 200; Function.Call(Hash.SET_POLICE_IGNORE_PLAYER, Game.Player, true); Function.Call(Hash.SET_WANTED_LEVEL_MULTIPLIER, 0.0f); PassiveModeItem.Text = "Disable Passive Mode"; IsPassiveMode = true; } else if (IsPassiveMode) { Game.Player.Character.ResetAlpha(); Function.Call(Hash.SET_POLICE_IGNORE_PLAYER, Game.Player, false); Function.Call(Hash.SET_WANTED_LEVEL_MULTIPLIER, 1.0f); PassiveModeItem.Text = "Enable Passive Mode"; IsPassiveMode = false; } break; } }; MenuOptionsMenu.OnListChange += (UIMenu sender, UIMenuListItem listItem, int newIndex) => { if (listItem == MenuColorItem) { switch (newIndex) { case 0: MenuColor = Color.Blue; break; case 1: MenuColor = Color.Red; break; case 2: MenuColor = Color.Green; break; case 3: MenuColor = Color.Orange; break; case 4: MenuColor = Color.Purple; break; case 5: MenuColor = Color.Yellow; break; } } if (listItem == WalkStyleItem) { switch (newIndex) { case 0: Game.Player.Character.Task.ClearAll(); Function.Call(Hash.RESET_PED_MOVEMENT_CLIPSET, Game.Player.Character, 0x3E800000); break; case 1: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@brave", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 2: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@confident", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 3: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@drunk@verydrunk", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 4: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@fat@a", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 5: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@shadyped@a", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 6: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@hurry@a", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 7: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@injured", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 8: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@intimidation@1h", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 9: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@quick", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 10: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@sad@a", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; case 11: Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@tool_belt@a", 0x3E800000); Game.Player.Character.Task.ClearAll(); break; } } if (listItem == PlayerMoodItem) { switch (newIndex) { case 0: Function.Call(Hash.CLEAR_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character); break; case 1: Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "mood_normal_1", 0); break; case 2: Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "mood_happy_1", 0); break; case 3: Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Angry_1", 0); break; case 4: Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Injured_1", 0); break; case 5: Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Stressed_1", 0); break; } } if (listItem == AimingStyleItem) { switch (newIndex) { case 0: Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "default")); break; case 1: Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "Gang1H")); break; case 2: Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "Hillbilly")); break; } } }; var menu = new AmmoMenu(); var ammoItem = new UIMenuItem("Ammo"); InventoryMenu.AddItem(ammoItem); InventoryMenu.BindMenuToItem(menu, ammoItem); MenuPool.Add(menu); MainMenu.RefreshIndex(); InventoryMenu.RefreshIndex(); }
/// <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)); }
/// <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}; }
/// <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); }
/// <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); }
public void SetBannerType(UIResRectangle bannerType) { _menuList.ForEach(m => m.SetBannerType(bannerType)); }
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 }; }