Skip to content
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

Themed default speed signs #1320

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion TLM/TLM/Manager/Impl/LanePos.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,20 @@ public struct LanePos {
public float position;
public VehicleInfo.VehicleType vehicleType;
public NetInfo.LaneType laneType;
public NetInfo.Direction finalDirection;

public LanePos(uint laneId,
byte laneIndex,
float position,
VehicleInfo.VehicleType vehicleType,
NetInfo.LaneType laneType) {
NetInfo.LaneType laneType,
NetInfo.Direction finalDirection) {
this.laneId = laneId;
this.laneIndex = laneIndex;
this.position = position;
this.vehicleType = vehicleType;
this.laneType = laneType;
this.finalDirection = finalDirection;
}
}
}
4 changes: 4 additions & 0 deletions TLM/TLM/Manager/Impl/OptionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ int LoadBool(int idx, ILegacySerializableOption opt) {

index = LoadBool(index, OptionsVehicleRestrictionsTab.NoDoubleCrossings);
index = LoadBool(index, OptionsVehicleRestrictionsTab.DedicatedTurningLanes);

index = LoadBool(index, OptionsGeneralTab.DifferentiateDefaultSpeedsInNormalView);
return true;
}

Expand Down Expand Up @@ -311,6 +313,8 @@ public byte[] SaveData(ref bool success) {

OptionsVehicleRestrictionsTab.NoDoubleCrossings.Save(),
OptionsVehicleRestrictionsTab.DedicatedTurningLanes.Save(),

OptionsGeneralTab.DifferentiateDefaultSpeedsInNormalView.Save(),
};
}
}
Expand Down
3 changes: 3 additions & 0 deletions TLM/TLM/State/Options.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public class Options : MonoBehaviour {
public static bool PriorityRoad_EnterBlockedYeild = false;
public static bool PriorityRoad_StopAtEntry = false;

/// <summary>When <c>true</c>, default speeds will be depicted with green signs in normal speed limit override view.</summary>
public static bool differentiateDefaultSpeedsInNormalView = false;

/// <summary>
/// Invoked on options change to refresh the main menu and possibly update the labels for
/// a new language. Takes a second, very slow.
Expand Down
12 changes: 12 additions & 0 deletions TLM/TLM/State/OptionsTabs/OptionsGeneralTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ namespace TrafficManager.State {
using UI.WhatsNew;

public static class OptionsGeneralTab {
public static CheckboxOption DifferentiateDefaultSpeedsInNormalView =
new (nameof(Options.differentiateDefaultSpeedsInNormalView)) {
Label = "General.Checkbox:DifferentiateDefaultSpeedsInNormalView",
Handler = OnDifferentiateDefaultSpeedsInNormalViewChanged,
};

private static UICheckBox _instantEffectsToggle;

[UsedImplicitly]
Expand Down Expand Up @@ -201,6 +207,8 @@ string FormatThemeName(string themeName) {
eventCallback: OnRoadSignsThemeChanged) as UIDropDown;

_roadSignsThemeDropdown.width *= 2.0f;

DifferentiateDefaultSpeedsInNormalView.AddUI(generalGroup);
}

private static void OnLanguageChanged(int newLanguageIndex) {
Expand Down Expand Up @@ -424,6 +432,10 @@ private static void OnRoadSignsThemeChanged(int newThemeIndex) {
GlobalConfig.WriteConfig();
}

private static void OnDifferentiateDefaultSpeedsInNormalViewChanged(bool newVal) {
// ?
}

private static void OnSimulationAccuracyChanged(int newAccuracy) {
if (!Options.IsGameLoaded()) {
return;
Expand Down
Loading