private WaypointEditor() { CreateWaypointMenu = new UIMenu("", "WAYPOINTS", new Point(0, -107)); _waypointPropertiesMenu = new UIMenu("", "EDIT WAYPOINT", new Point(0, -107)); _children = new List<UIMenu>(); CreateWaypointMenu.SetBannerType(new ResRectangle()); CreateWaypointMenu.MouseControlsEnabled = false; //CreateWaypointMenu.ResetKey(Common.MenuControls.Back); CreateWaypointMenu.ResetKey(Common.MenuControls.Up); CreateWaypointMenu.ResetKey(Common.MenuControls.Down); CreateWaypointMenu.SetKey(Common.MenuControls.Up, GameControl.CellphoneUp, 0); CreateWaypointMenu.SetKey(Common.MenuControls.Down, GameControl.CellphoneDown, 0); CreateWaypointMenu.OnMenuClose += sender => { IsInEditor = false; OnEditorExit?.Invoke(this, EventArgs.Empty); }; _waypointPropertiesMenu.SetBannerType(new ResRectangle()); _waypointPropertiesMenu.MouseControlsEnabled = false; _waypointPropertiesMenu.ResetKey(Common.MenuControls.Up); _waypointPropertiesMenu.ResetKey(Common.MenuControls.Down); _waypointPropertiesMenu.SetKey(Common.MenuControls.Up, GameControl.CellphoneUp, 0); _waypointPropertiesMenu.SetKey(Common.MenuControls.Down, GameControl.CellphoneDown, 0); BuildCreateWaypointMenu(); _waypointPropertiesMenu.OnMenuClose += sender => { CreateWaypointMenu.Visible = true; }; }
public CutsceneUi() { #region NativeUI Init { CutsceneMenus = new UIMenu("Cutscene Creator", "CUTSCENES"); CutsceneMenus.MouseControlsEnabled = false; CutsceneMenus.ResetKey(Common.MenuControls.Up); CutsceneMenus.ResetKey(Common.MenuControls.Down); CutsceneMenus.SetKey(Common.MenuControls.Up, GameControl.CellphoneUp, 0); CutsceneMenus.SetKey(Common.MenuControls.Down, GameControl.CellphoneDown, 0); MarkerMenu = new TimelineMarkerMenu(this); EditCutsceneMenu = new EditCutsceneMenu(this); EditCutsceneMenu.ParentMenu = CutsceneMenus; } #endregion _children = new List<UIMenu>(); }
public static void Main() { Game.FrameRender += Process; _menuPool = new MenuPool(); mainMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE"); mainMenu.SetKey(Common.MenuControls.Up, Keys.W); mainMenu.SetKey(Common.MenuControls.Down, Keys.S); mainMenu.SetKey(Common.MenuControls.Left, Keys.A); mainMenu.SetKey(Common.MenuControls.Right, Keys.D); _menuPool.Add(mainMenu); mainMenu.AddItem(ketchupCheckbox = new UIMenuCheckboxItem("Add ketchup?", false, "Do you wish to add ketchup?")); var foods = new List<dynamic> { "Banana", "Apple", "Pizza", "Quartilicious", 0xF00D, // Dynamic! }; mainMenu.AddItem(dishesListItem = new UIMenuListItem("Food", foods, 0)); mainMenu.AddItem(cookItem = new UIMenuItem("Cook!", "Cook the dish with the appropiate ingredients and ketchup.")); var menuItem = new UIMenuItem("Go to another menu."); mainMenu.AddItem(menuItem); cookItem.SetLeftBadge(UIMenuItem.BadgeStyle.Star); cookItem.SetRightBadge(UIMenuItem.BadgeStyle.Tick); var carsModel = new List<dynamic> { "Adder", "Bullet", "Police", "Police2", "Asea", "FBI", "FBI2", "Firetruk", "Ambulance", "Rhino", }; carsList = new UIMenuListItem("Cars Models", carsModel, 0); mainMenu.AddItem(carsList); spawnCar = new UIMenuItem("Spawn Car"); mainMenu.AddItem(spawnCar); coloredItem = new UIMenuColoredItem("Color!", System.Drawing.Color.Red, System.Drawing.Color.Blue); mainMenu.AddItem(coloredItem); mainMenu.RefreshIndex(); mainMenu.OnItemSelect += OnItemSelect; mainMenu.OnListChange += OnListChange; mainMenu.OnCheckboxChange += OnCheckboxChange; mainMenu.OnIndexChange += OnItemChange; newMenu = new UIMenu("RAGENative UI", "~b~RAGENATIVEUI SHOWCASE"); _menuPool.Add(newMenu); for (int i = 0; i < 35; i++) { newMenu.AddItem(new UIMenuItem("PageFiller " + i.ToString(), "Sample description that takes more than one line. Moreso, it takes way more than two lines since it's so long. Wow, check out this length!")); } newMenu.RefreshIndex(); mainMenu.BindMenuToItem(newMenu, menuItem); while (true) GameFiber.Yield(); }
public Editor() { Children = new List<INestedMenu>(); #region NativeUI Initialization _menuPool = new MenuPool(); #region Main Menu _mainMenu = new UIMenu("Mission Creator", "MAIN MENU"); _mainMenu.ResetKey(Common.MenuControls.Back); _mainMenu.ResetKey(Common.MenuControls.Up); _mainMenu.ResetKey(Common.MenuControls.Down); _mainMenu.SetKey(Common.MenuControls.Up, GameControl.CellphoneUp, 0); _mainMenu.SetKey(Common.MenuControls.Down, GameControl.CellphoneDown, 0); _menuPool.Add(_mainMenu); { var menuItem = new NativeMenuItem("Create a Mission", "Create a new mission."); menuItem.Activated += (sender, item) => { CreateNewMission(); EnterFreecam(); }; _mainMenu.AddItem(menuItem); } { var menuItem = new NativeMenuItem("Play Mission", "Play a mission."); menuItem.Activated += (sender, item) => { GameFiber.StartNew(delegate { DisableControlEnabling = true; var newMenu = new LoadMissionMenu(); _mainMenu.Visible = false; newMenu.RebuildMenu(); newMenu.ParentMenu = _mainMenu; newMenu.Visible = true; while (newMenu.Visible) { newMenu.ProcessControl(); newMenu.Draw(); GameFiber.Yield(); } DisableControlEnabling = false; if (newMenu.ReturnedData == null) return; LeaveEditor(); EntryPoint.MissionPlayer.Load(newMenu.ReturnedData); }); }; _mainMenu.AddItem(menuItem); } { var menuItem = new NativeMenuItem("Load Mission", "Load your mission for editing."); menuItem.Activated += (sender, item) => { GameFiber.StartNew(delegate { DisableControlEnabling = true; _mainMenu.Visible = false; var newMenu = new LoadMissionMenu(); newMenu.RebuildMenu(); newMenu.ParentMenu = _mainMenu; newMenu.Visible = true; while (newMenu.Visible) { newMenu.ProcessControl(); newMenu.Draw(); GameFiber.Yield(); } DisableControlEnabling = false; if (newMenu.ReturnedData == null) return; LoadMission(newMenu.ReturnedData); }); }; _mainMenu.AddItem(menuItem); } { var menuItem = new NativeMenuItem("Exit to Grand Theft Auto V", "Leave the Mission Creator"); menuItem.Activated += (sender, item) => { if(!EntryPoint.MissionPlayer.IsMissionPlaying) LeaveEditor(); else { GameFiber.StartNew(delegate { _mainMenu.Visible = false; EntryPoint.MissionPlayer.FailMission(reason: "You canceled the mission."); IsInMainMenu = false; _menuPool.CloseAllMenus(); BigMinimap = false; IsInFreecam = false; IsInEditor = false; }); } }; _mainMenu.AddItem(menuItem); } _menuPool.ToList().ForEach(menu => { menu.RefreshIndex(); menu.MouseControlsEnabled = false; menu.MouseEdgeEnabled = false; }); #endregion #region Editor Menu _missionMenu = new UIMenu("Mission Creator", "MISSION MAIN MENU"); _missionMenu.ResetKey(Common.MenuControls.Back); _missionMenu.MouseControlsEnabled = false; _missionMenu.ResetKey(Common.MenuControls.Up); _missionMenu.ResetKey(Common.MenuControls.Down); _missionMenu.SetKey(Common.MenuControls.Up, GameControl.CellphoneUp, 0); _missionMenu.SetKey(Common.MenuControls.Down, GameControl.CellphoneDown, 0); _menuPool.Add(_missionMenu); #endregion #endregion RingData = new RingData() { Display = true, Type = RingType.HorizontalCircleSkinny, Radius = 2f, Color = Color.Gray, }; MarkerData = new MarkerData() { Display = false, }; MarkerData.OnMarkerTypeChange += (sender, args) => { if (string.IsNullOrEmpty(MarkerData.MarkerType)) { if (_mainObject != null && _mainObject.IsValid()) _mainObject.Delete(); return; } var pos = Game.LocalPlayer.Character.Position; if (_mainObject != null && _mainObject.IsValid()) { pos = _mainObject.Position; _mainObject.Delete(); } GameFiber.StartNew(delegate { _mainObject = new Object(Util.RequestModel(MarkerData.MarkerType), pos); NativeFunction.CallByName<uint>("SET_ENTITY_COLLISION", _mainObject.Handle.Value, false, 0); }); }; _cutsceneUi = new CutsceneUi(); CameraClampMax = -30f; CameraClampMin = -85f; _blips = new List<Blip>(); _instructButts = new Scaleform(); if (!Directory.Exists(basePath)) { try { Directory.CreateDirectory(basePath); } catch (UnauthorizedAccessException) { Game.DisplayNotification("~r~~h~ERROR~h~~n~~w~Access denied for folder creation. Run as administrator."); } } }