-
Notifications
You must be signed in to change notification settings - Fork 89
Api update #1577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Api update #1577
Changes from all commits
39cda82
5133f5e
0e940ec
551fe2e
c53f47b
8082ba2
e85a3ac
ea6b25e
280f971
2790471
ad1c5ed
cd1f632
009bb22
8f043ac
9c45c7e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace TrafficManager.UI { | ||
| using TrafficManager.API.UI; | ||
| using TrafficManager.UI.Textures; | ||
|
|
||
| public class UIFactory : IUIFactory { | ||
| public static IUIFactory Instance = new UIFactory(); | ||
|
|
||
| public ITheme ActiveTheme => RoadSignThemeManager.ActiveTheme; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,5 +2,23 @@ namespace TrafficManager.API.Manager { | |||||||||||||
| using TrafficManager.API.Traffic.Enums; | ||||||||||||||
|
|
||||||||||||||
| public interface ITrafficLightManager { | ||||||||||||||
| /// <summary> | ||||||||||||||
| /// returns if the node as any kind of traffic light (vanilla, manual, timed). | ||||||||||||||
| /// </summary> | ||||||||||||||
| public bool HasTrafficLight(ushort nodeId); | ||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
implicitly public so redundant
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @krzychu124 no that does not work But that is not necessary in this case.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might not be a bad idea to implicitly define all API implementations that we do not want to use internally. If we want to go that route we need to have a discussion about it and apply the rule consistently everywhere.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you get an error probably because you are explicitly implementing the interface and implementation you shown is private then making it explicit you force us to cast to the interface to use that method (is there another one with the same signature?). Explicit and implicit implementation are completely different things with some implications.
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What you said first does not work:
Suggested change
but this will work:
Suggested change
I understand how implicit/explicit works. |
||||||||||||||
|
|
||||||||||||||
| /// <summary> | ||||||||||||||
| /// Manual/timed traffic light cannot be toggled using <see cref="ITrafficLightManager"/>. | ||||||||||||||
| /// Use <see cref="ITrafficLightSimulationManager"/> to do that. | ||||||||||||||
| /// Also certain node types cannot have traffic light. | ||||||||||||||
| /// </summary> | ||||||||||||||
| bool CanToggleTrafficLight(ushort nodeId); | ||||||||||||||
|
|
||||||||||||||
| /// <summary> | ||||||||||||||
| /// if node has no traffic light, vanilla traffic light is set (if possible). | ||||||||||||||
| /// if node has vanilla traffic light, it is removed (if possible). | ||||||||||||||
| /// this method will fail if node has Manual/timed traffic light. | ||||||||||||||
| /// </summary> | ||||||||||||||
| bool ToggleTrafficLight(ushort nodeId); | ||||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace TrafficManager.API.Traffic.Enums { | ||
| public enum JunctionRestrictionFlags { | ||
| AllowUTurn = 1 << 0, | ||
| AllowNearTurnOnRed = 1 << 1, | ||
| AllowFarTurnOnRed = 1 << 2, | ||
| AllowForwardLaneChange = 1 << 3, | ||
| AllowEnterWhenBlocked = 1 << 4, | ||
| AllowPedestrianCrossing = 1 << 5, | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| namespace TrafficManager.API.UI { | ||
| using TrafficManager.API.Traffic.Enums; | ||
| using UnityEngine; | ||
|
|
||
| /// <summary> | ||
| /// gets the texture for overlay sprite for each traffic rule according to the current theme. | ||
| /// </summary> | ||
| public interface ITheme { | ||
| Texture2D JunctionRestriction(JunctionRestrictionFlags rule, bool allowed); | ||
|
|
||
| Texture2D Parking(bool allowed); | ||
|
|
||
| Texture2D Priority(PriorityType p); | ||
|
|
||
| Texture2D VehicleRestriction(ExtVehicleType type, bool allow); | ||
|
|
||
| Texture2D TrafficLightIcon(ushort nodeId); | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| namespace TrafficManager.API.UI { | ||
|
|
||
| /// <summary> | ||
| /// gets the texture for overlay sprite for each traffic rule according to the current theme. | ||
| /// </summary> | ||
| public interface IUIFactory { | ||
| ITheme ActiveTheme { get; } | ||
| } | ||
| } |


Uh oh!
There was an error while loading. Please reload this page.