using System;
using System.Collections.Generic;
using System.Drawing;
using LemonUI.Elements;
using LemonUI.Menus;
using GTA;
using System.Windows.Forms;
namespace MenuTemplate
{
public partial class ModMenu : Script
{
private static readonly LemonUI.ObjectPool pool = new LemonUI.ObjectPool();
private static readonly float MenuWidth = 512;
private static readonly float MenuHeight = 128;
private static readonly string BannerDictionary = "arcadeui_wizards_ruin"; // from \mods\update\update.rpf\x64\textures\script_txds.rpf\
private static readonly string BannerImage = "arcadeui_wizards_ruin"; // add your ytd in path above if desired
private static readonly NativeMenu Menu1 = new NativeMenu("", "Keep or remove this header", "", new ScaledTexture(PointF.Empty, new SizeF(MenuWidth, MenuHeight), BannerDictionary, BannerImage));
private static readonly NativeMenu SubMenu1 = new NativeMenu("Boring asF", "Submenu Header", "");
private Keys OpenMenuKey;
private static readonly List Menu1_Items = new List
{
new NativeItem("~r~Item 1", ""),
new NativeItem("~b~Item 2", ""),
new NativeSliderItem("Slider", 0, 50),
new NativeListItem("Select Colour", "", "White", "Red", "Blue", "Black", "Purple", "Orange"),
new NativeListItem("Select with Numbers", 1,2,3,4,5,6),
new NativeCheckboxItem("Checkbox On and Off", false),
new NativeItem("Open Submenu", ""),
};
private static readonly ListSubMenu1_Items = new List
{
new NativeItem("Submenu Item 1", ""),
new NativeItem("Submenu Item 2", ""),
};
public ModMenu()
{
Initialize();
//Add your own code if necessary
}
private void Initialize()
{
pool.Add(Menu1);
pool.Add(SubMenu1);
Tick += Basics_Tick;
KeyDown += Basics_KeyDown;
OpenMenuKey = Settings.GetValue("Settings", "MenuKey", Keys.F3);
ConfigureMenu();
AttachItemFunctions();
AddItemsToMenu(SubMenu1, SubMenu1_Items);
}
private void ConfigureMenu()
{
AddItemsToMenu(Menu1, Menu1_Items);
//OPTIONS SECTION
Menu1.Buttons.Visible = false; //removes back and select buttons
Menu1.MaxItems = 20; // items displayed
// Menu1.HeaderBehavior = HeaderBehavior.AlwaysHide; // removes the black header if desired
// Menu1.Width = 200; // Change width if desired
//ADVANCED OPTIONS
// Disable the thumping sound when you click on menu items
pool.ForEach(x =>
{
x.SoundOpened = null;
x.SoundClose = null;
x.SoundActivated = null;
x.SoundLeftRight = null;
x.SoundUpDown = null;
});
// Add Colours with solid background or transparency
pool.ForEach(MainMenu =>
{
foreach (NativeItem Item in MainMenu.Items)
{
Item.UseCustomBackground = true;
Item.Colors.BackgroundNormal = Color.FromArgb(255, 49, 49, 49); //first argument at 255 means solid background
Item.Colors.BackgroundHovered = Color.FromArgb(255, 39, 96, 36);
Item.UpdateColors();
}
});
}
private void Basics_Tick(object sender, EventArgs e)
{
pool.Process();
}
private void Basics_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == OpenMenuKey)
{
Menu1.Visible = !Menu1.Visible;
}
}
private void AddItemsToMenu(NativeMenu menu, List items)
{
foreach (var item in items)
{
menu.Add(item);
item.TitleFont = GTA.UI.Font.ChaletComprimeCologneNotGamerName;
}
}
private void AttachItemFunctions()
{
Menu1_Items[0].Activated += (sender, e) => Menu_Item1_Code();
Menu1_Items[1].Activated += (sender, e) => Menu_Item2_Code();
Menu1_Items[6].Activated += (sender, e) => {
Menu1.Visible = false;
SubMenu1.Visible = true;
};
SubMenu1_Items[0].Activated += (sender, e) => SubMenu_Item1_Code();
}
private void Menu_Item1_Code()
{
GTA.UI.Screen.ShowSubtitle("~r~Item 1 Code\n will be executed\n on this selection", 2500);
}
private void Menu_Item2_Code()
{
GTA.UI.Screen.ShowSubtitle("~b~Item 2 Code\n will be executed\n on this selection", 2500);
}
private void SubMenu_Item1_Code()
{
GTA.UI.Screen.ShowSubtitle("~b~SubMenu Item 1 Code\n will be executed\n on this selection", 2500);
}
}
}