From 24f3c70474b31b8f2fb6c6f98b6b6af1fd0f4ae6 Mon Sep 17 00:00:00 2001 From: Rich Dunne Date: Thu, 20 Aug 2020 16:30:17 -0600 Subject: [PATCH] Extracted blip opacity code to new method within Path class as part of Path class refactor --- SceneManager/Menus/EditPathMenu.cs | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/SceneManager/Menus/EditPathMenu.cs b/SceneManager/Menus/EditPathMenu.cs index 1335bde..18462bb 100644 --- a/SceneManager/Menus/EditPathMenu.cs +++ b/SceneManager/Menus/EditPathMenu.cs @@ -40,33 +40,16 @@ namespace SceneManager { if (checkboxItem == togglePath) { + var currentPath = TrafficMenu.paths[TrafficMenu.editPath.Index]; if (togglePath.Checked) { - TrafficMenu.paths[TrafficMenu.editPath.Index].PathDisabled = true; - Game.LogTrivial($"Path {TrafficMenu.paths[TrafficMenu.editPath.Index].PathNum} disabled."); - - foreach (Waypoint wd in TrafficMenu.paths[TrafficMenu.editPath.Index].Waypoint) - { - wd.Blip.Alpha = 0.5f; - if (wd.CollectorRadiusBlip) - { - wd.CollectorRadiusBlip.Alpha = 0.25f; - } - } + currentPath.DisablePath(); + Game.LogTrivial($"Path {currentPath.PathNum} disabled."); } else { - TrafficMenu.paths[TrafficMenu.editPath.Index].PathDisabled = false; - Game.LogTrivial($"Path {TrafficMenu.paths[TrafficMenu.editPath.Index].PathNum} enabled."); - - foreach (Waypoint wd in TrafficMenu.paths[TrafficMenu.editPath.Index].Waypoint) - { - wd.Blip.Alpha = 1.0f; - if (wd.CollectorRadiusBlip) - { - wd.CollectorRadiusBlip.Alpha = 0.5f; - } - } + currentPath.EnablePath(); + Game.LogTrivial($"Path {currentPath.PathNum} enabled."); } } }