1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-11 15:40:29 +01:00

Added option to add unassigned barriers to a designated path

This commit is contained in:
Rich Dunne 2021-05-15 09:40:54 -06:00
parent 13a448c855
commit 5b872b7c87

View file

@ -14,15 +14,15 @@ namespace SceneManager.Menus
{ {
private static List<TrafficLight> TrafficLightList { get; } = new List<TrafficLight>() { TrafficLight.Green, TrafficLight.Red, TrafficLight.Yellow, TrafficLight.None }; private static List<TrafficLight> TrafficLightList { get; } = new List<TrafficLight>() { TrafficLight.Green, TrafficLight.Red, TrafficLight.Yellow, TrafficLight.None };
internal static UIMenu Menu { get; } = new UIMenu("Scene Manager", "~o~Barrier Management"); internal static UIMenu Menu { get; } = new UIMenu("Scene Manager", "~o~Barrier Management");
internal static UIMenuListScrollerItem<string> BarrierList { get; } = new UIMenuListScrollerItem<string>("Spawn Barrier", "", Settings.Barriers.Keys); // Settings.barrierKeys internal static UIMenuListScrollerItem<string> BarrierList { get; } = new UIMenuListScrollerItem<string>("Spawn Barrier", "", Settings.BarrierModels.Keys); // Settings.barrierKeys
internal static UIMenuNumericScrollerItem<int> RotateBarrier { get; } = new UIMenuNumericScrollerItem<int>("Rotate Barrier", "", 0, 350, 10); internal static UIMenuNumericScrollerItem<int> RotateBarrier { get; } = new UIMenuNumericScrollerItem<int>("Rotate Barrier", "", 0, 350, 10);
// ADD CHECKBOX FOR BARRIER TO STOP TRAFFIC? ADD 3D MARKER TO SHOW WHERE TRAFFIC WILL STOP. ONLY NEED ONE CONE TO DO IT PER LANE
internal static UIMenuCheckboxItem Invincible { get; } = new UIMenuCheckboxItem("Indestructible", false, "If checked, the barrier will not break, or will be harder to break. The barrier will still able to be moved around."); internal static UIMenuCheckboxItem Invincible { get; } = new UIMenuCheckboxItem("Indestructible", false, "If checked, the barrier will not break, or will be harder to break. The barrier will still able to be moved around.");
internal static UIMenuCheckboxItem Immobile { get; } = new UIMenuCheckboxItem("Immobile", false, "If checked, the barrier will be frozen in place."); internal static UIMenuCheckboxItem Immobile { get; } = new UIMenuCheckboxItem("Immobile", false, "If checked, the barrier will be frozen in place.");
internal static UIMenuNumericScrollerItem<int> BarrierTexture { get; } = new UIMenuNumericScrollerItem<int>("Change Texture", "If the barrier has multiple textures, changing this value will apply them to the barrier.", 0, 15, 1); internal static UIMenuNumericScrollerItem<int> BarrierTexture { get; } = new UIMenuNumericScrollerItem<int>("Change Texture", "If the barrier has multiple textures, changing this value will apply them to the barrier.", 0, 15, 1);
internal static UIMenuCheckboxItem SetBarrierLights { get; } = new UIMenuCheckboxItem("Enable Barrier Lights", Settings.EnableBarrierLightsDefaultOn, "If the barrier has functional lights, checking this option will turn them on."); internal static UIMenuCheckboxItem SetBarrierLights { get; } = new UIMenuCheckboxItem("Enable Barrier Lights", Settings.EnableBarrierLightsDefaultOn, "If the barrier has functional lights, checking this option will turn them on.");
internal static UIMenuCheckboxItem BelongsToPath { get; } = new UIMenuCheckboxItem("Belongs to Path", false, "If checked, the barrier will be saved with the path when the path is exported."); internal static UIMenuCheckboxItem BelongsToPath { get; } = new UIMenuCheckboxItem("Belongs to Path", false, "If checked, the barrier will be saved with the path when the path is exported.");
internal static UIMenuListScrollerItem<string> AddToPath { get; private set; } internal static UIMenuListScrollerItem<string> AddToPath { get; private set; }
internal static UIMenuListScrollerItem<string> AddUnassignedToPath { get; private set; }
internal static UIMenuListScrollerItem<TrafficLight> SetBarrierTrafficLight { get; } = new UIMenuListScrollerItem<TrafficLight>("Set Barrier Traffic Light", "", TrafficLightList); internal static UIMenuListScrollerItem<TrafficLight> SetBarrierTrafficLight { get; } = new UIMenuListScrollerItem<TrafficLight>("Set Barrier Traffic Light", "", TrafficLightList);
internal static UIMenuListScrollerItem<string> RemoveBarrierOptions { get; } = new UIMenuListScrollerItem<string>("Remove Barrier", "", new[] { "Last Barrier", "Nearest Barrier", "All Barriers" }); internal static UIMenuListScrollerItem<string> RemoveBarrierOptions { get; } = new UIMenuListScrollerItem<string>("Remove Barrier", "", new[] { "Last Barrier", "Nearest Barrier", "All Barriers" });
internal static UIMenuItem ResetBarriers { get; } = new UIMenuItem("Reset Barriers", "Reset all spawned barriers to their original position and rotation"); internal static UIMenuItem ResetBarriers { get; } = new UIMenuItem("Reset Barriers", "Reset all spawned barriers to their original position and rotation");
@ -38,7 +38,7 @@ namespace SceneManager.Menus
Menu.OnMenuOpen += BarrierMenu_OnMenuOpen; Menu.OnMenuOpen += BarrierMenu_OnMenuOpen;
} }
internal static void BuildMenu() internal static void Build()
{ {
Menu.Clear(); Menu.Clear();
@ -63,10 +63,15 @@ namespace SceneManager.Menus
BelongsToPath.Enabled = PathManager.Paths.Count() > 0 ? true : false; BelongsToPath.Enabled = PathManager.Paths.Count() > 0 ? true : false;
BelongsToPath.Checked = false; BelongsToPath.Checked = false;
AddToPath = new UIMenuListScrollerItem<string>("Path", "The path the barrier will be saved with when the path is exported.", PathManager.Paths.Select(x => x.Name)); AddToPath = new UIMenuListScrollerItem<string>("Path", "The path the barrier will be saved with when the path is exported.", PathManager.Paths.Where(x => x != null).Select(x => x.Name));
Menu.AddItem(AddToPath); Menu.AddItem(AddToPath);
AddToPath.Enabled = BelongsToPath.Checked; AddToPath.Enabled = BelongsToPath.Checked;
AddUnassignedToPath = new UIMenuListScrollerItem<string>("Add Unassigned Barriers to Path", "The path to add all unassigned barriers to.", PathManager.Paths.Where(x => x != null).Select(x => x.Name));
Menu.AddItem(AddUnassignedToPath);
AddUnassignedToPath.ForeColor = Color.Gold;
AddUnassignedToPath.Enabled = BarrierManager.Barriers.Any(x => x.Path == null);
Menu.AddItem(RemoveBarrierOptions); Menu.AddItem(RemoveBarrierOptions);
RemoveBarrierOptions.ForeColor = Color.Gold; RemoveBarrierOptions.ForeColor = Color.Gold;
RemoveBarrierOptions.Enabled = BarrierManager.Barriers.Count() != 0; RemoveBarrierOptions.Enabled = BarrierManager.Barriers.Count() != 0;
@ -138,19 +143,21 @@ namespace SceneManager.Menus
{ {
if (selectedItem == BarrierList) if (selectedItem == BarrierList)
{ {
//SpawnBarrier();
BarrierManager.SpawnBarrier(); BarrierManager.SpawnBarrier();
} }
if (selectedItem == AddUnassignedToPath)
{
BarrierManager.AddBarrierToPath();
}
if (selectedItem == RemoveBarrierOptions) if (selectedItem == RemoveBarrierOptions)
{ {
//RemoveBarrier();
BarrierManager.RemoveBarrier(RemoveBarrierOptions.Index); BarrierManager.RemoveBarrier(RemoveBarrierOptions.Index);
} }
if (selectedItem == ResetBarriers) if (selectedItem == ResetBarriers)
{ {
//ResetBarriers();
BarrierManager.ResetBarriers(); BarrierManager.ResetBarriers();
} }
} }