-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #631 from kianzarrin/542-edit-selected-roads
added TMPE Road selection panel to Road World Info Panel. - hovering over one of the Road selection panel the panel renders green path on the selected road. - when changed the behavior when TMPE tool is set to none: clicking on roads opens the Road World Info Panel. - changed the behavior of default tool when TMPE tool is disabled. if mass edit overlay is active, TMPE `RenderoverlayImpl()` and `OnToolGUIImpl` are called. - Mass edit overlay is enabled for as long as Road World Info Panel is open or Road Adjust Info View is active. - the road selection panel disappears if Traffic routes info is active. - Tutorial for road selection panel shows up when Road World Info Panel opens. - clicking on any of the TMPE Road Selection Buttons (except Clear) activates them setting up appropriate traffic rules. Clicking them again deactivates them clearing the related traffic rules. Changes to Vanilla interface: - switching to Road Selection Info View shows Road World Info Panel. this means clicking Adjust Road button does not hide Road World Info Panel. - switching to Traffic Routes Info View or Junction Info View hides the Road World Info Panel. - changed the icon of Road World Info Panel to a road. Furthur changes: -Road selection util is an interface that exposes the list of selected segments. Also it provides an event that is invoked whenever selection changes. - Modified Prioirty Road to add support for for when the main road is not straight. - Modified Roundabout tool to add more support for semi-roundabout. - Fixed a bug in linear button to show disabled textures for disabled buttons.
- Loading branch information
Showing
33 changed files
with
1,309 additions
and
215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace TrafficManager.Patch._DefaultTool { | ||
using Harmony; | ||
using JetBrains.Annotations; | ||
using TrafficManager.UI; | ||
using UnityEngine; | ||
using static TrafficManager.UI.SubTools.PrioritySignsTool; | ||
|
||
[HarmonyPatch(typeof(DefaultTool), "OnToolGUI")] | ||
[UsedImplicitly] | ||
public static class OnToolGUIPatch { | ||
/// <summary> | ||
/// Renders mass edit overlay even when traffic manager is not current tool. | ||
/// </summary> | ||
[HarmonyPostfix] | ||
[UsedImplicitly] | ||
public static void Postfix(Event e) { | ||
if(ToolsModifierControl.toolController.CurrentTool.GetType() != typeof(TrafficManagerTool)) { | ||
if (MassEditOVerlay.IsActive) { | ||
ModUI.GetTrafficManagerTool(true).OnToolGUIImpl(e); | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
namespace TrafficManager.Patch._DefaultTool { | ||
using Harmony; | ||
using JetBrains.Annotations; | ||
using TrafficManager.UI; | ||
using static TrafficManager.UI.SubTools.PrioritySignsTool; | ||
|
||
[HarmonyPatch(typeof(DefaultTool), "RenderOverlay")] | ||
[UsedImplicitly] | ||
public static class RenderOverlayPatch { | ||
/// <summary> | ||
/// Renders mass edit overlay even when traffic manager is not current tool. | ||
/// </summary> | ||
[HarmonyPostfix] | ||
[UsedImplicitly] | ||
public static void Postfix(RenderManager.CameraInfo cameraInfo) { | ||
if (ToolsModifierControl.toolController.CurrentTool.GetType() != typeof(TrafficManagerTool)) { | ||
if (MassEditOVerlay.IsActive) { | ||
ModUI.GetTrafficManagerTool(true).RenderOverlayImpl(cameraInfo); | ||
} | ||
RoadSelectionPanels.Root.RenderOverlay(); | ||
} | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
namespace TrafficManager.Patch._InfoManager | ||
{ | ||
using ColossalFramework; | ||
using Harmony; | ||
using JetBrains.Annotations; | ||
using TrafficManager.Util; | ||
using TrafficManager.UI; | ||
using UnityEngine; | ||
using static InfoManager; | ||
|
||
[HarmonyPatch(typeof(InfoManager), "SetMode")] | ||
[UsedImplicitly] | ||
public static class SetModePatch | ||
{ | ||
[UsedImplicitly] | ||
public static void Prefix(InfoMode mode, SubInfoMode subMode) | ||
{ | ||
if (RoadSelectionPanels.Root?.RoadWorldInfoPanelExt != null) { | ||
RoadSelectionPanels.Root.RoadWorldInfoPanelExt.isVisible = | ||
mode == InfoMode.None || | ||
RoadSelectionUtil.IsNetAdjustMode(mode, (int)subMode); | ||
} | ||
if (RoadSelectionUtil.IsNetAdjustMode(mode,(int)subMode)) | ||
{ | ||
// UI to be handled by Default tool | ||
ModUI.instance_.Close(); | ||
|
||
SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(delegate () { | ||
DefaultTool.OpenWorldInfoPanel( | ||
Singleton<InstanceManager>.instance.GetSelectedInstance(), | ||
Input.mousePosition); | ||
}); | ||
} | ||
else | ||
{ | ||
SimulationManager.instance.m_ThreadingWrapper.QueueMainThread(RoadSelectionPanels.RoadWorldInfoPanel.Hide); | ||
} | ||
|
||
} | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
TLM/TLM/Patch/_RoadWorldInfoPanel/OnAdjustRoadButtonPatch.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
namespace TrafficManager.Patch._RoadWorldInfoPanel | ||
{ | ||
using ColossalFramework; | ||
using Harmony; | ||
using JetBrains.Annotations; | ||
|
||
[HarmonyPatch(typeof(RoadWorldInfoPanel), "OnAdjustRoadButton")] | ||
[UsedImplicitly] | ||
public static class OnAdjustRoadButtonPatch | ||
{ | ||
/// <summary> | ||
/// Prefixed to prevent call to Hide. | ||
/// </summary> | ||
/// <param name="mode"></param> | ||
/// <param name="subMode"></param> | ||
/// <returns></returns> | ||
[UsedImplicitly] | ||
public static bool Prefix() | ||
{ | ||
Singleton<InfoManager>.instance.SetCurrentMode(InfoManager.InfoMode.TrafficRoutes, InfoManager.SubInfoMode.WindPower); | ||
return false; | ||
} | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.