mirror of
https://github.com/thegeneralist01/Scene-Manager-DevRepo
synced 2026-01-11 23:50:29 +01:00
* Mouse can now be used to fully navigate menus * Added check for driver's current vehicle when releasing from Stop waypoint in case the ped is not in a vehicle. * Lines are now only drawn between waypoint markers under the same conditions that waypoint markers are drawn * Updated marker position to be player's mouse position * Version update * Added logic to update waypoint position during driving task if the waypoint position was changed before the driver arrived. * Removed unused usings. Refactored debug statements to use Game.LogTrivial instead of Logger.Log * Removed class * Removed Logger class * Consolidated all custom enums to this class. Added default waypoint settings from .ini * Modified a hint message * Fixed collector options not being enabled/disabled when Collector box is checked * Refactored AITasking into CollectedVehicle. * Updated reference to vehicle tasking based on AITasking refactor. Fixed speed zone radius not updating correctly. * Version update * Refactored AITasking into CollectedVehicle * Added check for CollectorRadius being more than SpeedZoneRadius. Added debug messages when values are reset to default. * Added hint message if player tries to edit waypoints while 3D waypoints are disabled * Fixed a bug where a 3D waypoint marker would be drawn even if 3D waypoints were disabled * Removed unnecessary property setting when a vehicle is being removed from a path. * Added a check for if the driver loses their task and reassigns it. * Fixed a bug where the 3D line between waypoints was still being drawn even though 3D waypoints were disabled in the settings menu. * Updated version * Added console command to show info about collected vehicles. * Added ConsoleCommand class, removed AITasking class. * Removed class after refactoring into CollectedVehicle * Update README.md * Update README.md * Added ini setting for Advanced Barrier Options. Added enum for TrafficLight state. Added debug message for invalid barriers. * Updated version * Added MousePositionInWorld and RNUIMouseInputHandler classes * Fixed a crash when a collected ped is arrested. * Refactored to implement RNUIMouseInputHandler class. * Removed unused method. * Updated version * Disabled deletion/creation of shadow barrier and re-enabled updating position based on mouse position. * Added check for Driver's current vehicle in driving loop in case the Driver exited Vehicle at some point. Adjusted some guard clause logic and log messages. * Removed unused variable * Renamed some methods to improve clarity * Updated version.
126 lines
No EOL
4.8 KiB
C#
126 lines
No EOL
4.8 KiB
C#
using Rage;
|
|
using RAGENativeUI;
|
|
using RAGENativeUI.Elements;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Windows.Forms;
|
|
|
|
namespace SceneManager
|
|
{
|
|
class SettingsMenu
|
|
{
|
|
internal static UIMenu settingsMenu = new UIMenu("Scene Manager", "~o~Plugin Settings");
|
|
internal static UIMenuCheckboxItem threeDWaypoints = new UIMenuCheckboxItem("Enable 3D Waypoints", Settings.Enable3DWaypoints),
|
|
mapBlips = new UIMenuCheckboxItem("Enable Map Blips", Settings.EnableMapBlips),
|
|
hints = new UIMenuCheckboxItem("Enable Hints", Settings.EnableHints);
|
|
private static SpeedUnits[] speedArray = {SpeedUnits.MPH, SpeedUnits.KPH };
|
|
internal static UIMenuListScrollerItem<SpeedUnits> speedUnits = new UIMenuListScrollerItem<SpeedUnits>("Speed Unit of Measure", "", new[] { SpeedUnits.MPH, SpeedUnits.KPH });
|
|
internal static UIMenuItem saveSettings = new UIMenuItem("Save settings to .ini", "Updates the plugin's .ini file with the current settings so the next time the plugin is loaded, it will use these settings.");
|
|
|
|
internal static void InstantiateMenu()
|
|
{
|
|
settingsMenu.ParentMenu = MainMenu.mainMenu;
|
|
MenuManager.menuPool.Add(settingsMenu);
|
|
settingsMenu.OnCheckboxChange += SettingsMenu_OnCheckboxChange;
|
|
settingsMenu.OnScrollerChange += SettingsMenu_OnScrollerChange;
|
|
settingsMenu.OnItemSelect += SettingsMenu_OnItemSelected;
|
|
settingsMenu.OnMenuOpen += SettingsMenu_OnMenuOpen;
|
|
}
|
|
|
|
internal static void BuildSettingsMenu()
|
|
{
|
|
settingsMenu.AddItem(threeDWaypoints);
|
|
settingsMenu.AddItem(mapBlips);
|
|
settingsMenu.AddItem(hints);
|
|
settingsMenu.AddItem(speedUnits);
|
|
speedUnits.Index = Array.IndexOf(speedArray, Settings.SpeedUnit);
|
|
settingsMenu.AddItem(saveSettings);
|
|
saveSettings.ForeColor = System.Drawing.Color.Gold;
|
|
}
|
|
|
|
private static void ToggleMapBlips()
|
|
{
|
|
if (mapBlips.Checked)
|
|
{
|
|
foreach (Path path in PathMainMenu.paths)
|
|
{
|
|
foreach (Waypoint wp in path.Waypoints)
|
|
{
|
|
wp.EnableBlip();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
foreach (Path path in PathMainMenu.paths)
|
|
{
|
|
foreach (Waypoint wp in path.Waypoints)
|
|
{
|
|
wp.DisableBlip();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private static void ToggleHints()
|
|
{
|
|
Hints.Enabled = hints.Checked ? true : false;
|
|
}
|
|
|
|
private static void ToggleSettings()
|
|
{
|
|
Settings.UpdateSettings(threeDWaypoints.Checked, mapBlips.Checked, hints.Checked, speedUnits.SelectedItem);
|
|
Game.DisplayHelp($"Scene Manager settings saved");
|
|
}
|
|
|
|
private static void SettingsMenu_OnItemSelected(UIMenu sender, UIMenuItem selectedItem, int index)
|
|
{
|
|
if(selectedItem == saveSettings)
|
|
{
|
|
Settings.UpdateSettings(threeDWaypoints.Checked, mapBlips.Checked, hints.Checked, speedUnits.SelectedItem);
|
|
Game.DisplayHelp($"Scene Manager settings saved");
|
|
}
|
|
}
|
|
|
|
private static void SettingsMenu_OnCheckboxChange(UIMenu sender, UIMenuCheckboxItem checkboxItem, bool @checked)
|
|
{
|
|
if (checkboxItem == mapBlips)
|
|
{
|
|
ToggleMapBlips();
|
|
}
|
|
|
|
if (checkboxItem == hints)
|
|
{
|
|
Hints.Enabled = hints.Checked ? true : false;
|
|
}
|
|
}
|
|
|
|
private static void SettingsMenu_OnScrollerChange(UIMenu sender, UIMenuScrollerItem scrollerItem, int oldIndex, int newIndex)
|
|
{
|
|
if (scrollerItem == speedUnits)
|
|
{
|
|
// Clear the menu and rebuild it to reflect the menu item text change
|
|
PathCreationMenu.pathCreationMenu.Clear();
|
|
PathCreationMenu.BuildPathCreationMenu();
|
|
}
|
|
}
|
|
|
|
private static void SettingsMenu_OnMenuOpen(UIMenu menu)
|
|
{
|
|
var scrollerItems = new List<UIMenuScrollerItem> { speedUnits };
|
|
var checkboxItems = new Dictionary<UIMenuCheckboxItem, RNUIMouseInputHandler.Function>()
|
|
{
|
|
{ threeDWaypoints, null},
|
|
{ mapBlips, ToggleMapBlips},
|
|
{ hints, ToggleHints}
|
|
};
|
|
var selectItems = new Dictionary<UIMenuItem, RNUIMouseInputHandler.Function>()
|
|
{
|
|
{ saveSettings, ToggleSettings }
|
|
};
|
|
|
|
RNUIMouseInputHandler.Initialize(menu, scrollerItems, checkboxItems, selectItems);
|
|
}
|
|
}
|
|
} |