mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-10-16 23:49:19 +02:00
Explain the greyed-out ready box and count cars in the depot
A disabled checkbox shows no tooltip, so the settings override that greys out "ready to go" is now said under it. The consist vehicle count counted units, so a multi-unit was one vehicle; it now counts cars like the stats bar.
This commit is contained in:
@@ -21,6 +21,17 @@ public class ConsistTailTests
|
|||||||
_consist = new Consist(_catalog, new VehicleInfo(_catalog, installation.Physics));
|
_consist = new Consist(_catalog, new VehicleInfo(_catalog, installation.Physics));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void The_vehicle_count_counts_cars_not_units()
|
||||||
|
{
|
||||||
|
Append("b111-01");
|
||||||
|
var pair = Append("b111-02");
|
||||||
|
pair.Cars.Add(pair.Cars[0].Clone());
|
||||||
|
|
||||||
|
Assert.Equal(2, _consist.Count);
|
||||||
|
Assert.Equal(3, _consist.VehicleCount);
|
||||||
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void A_new_last_car_is_left_uncoupled_at_the_back()
|
public void A_new_last_car_is_left_uncoupled_at_the_back()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ public sealed class Consist : IReadOnlyList<ConsistItem>
|
|||||||
|
|
||||||
public int Count => _items.Count;
|
public int Count => _items.Count;
|
||||||
|
|
||||||
|
/// <summary>Every vehicle, a multi-unit counted car by car - <see cref="Count"/> counts units.</summary>
|
||||||
|
public int VehicleCount => _items.Sum(i => i.Cars.Count);
|
||||||
|
|
||||||
public ConsistItem this[int index]
|
public ConsistItem this[int index]
|
||||||
{
|
{
|
||||||
get => _items[index];
|
get => _items[index];
|
||||||
|
|||||||
@@ -568,7 +568,7 @@ public sealed class VehicleDetails
|
|||||||
|
|
||||||
var count = new TextBlock
|
var count = new TextBlock
|
||||||
{
|
{
|
||||||
Text = $"{App.Loc["VehicleCount"]}: {_consist.Count}",
|
Text = $"{App.Loc["VehicleCount"]}: {_consist.VehicleCount}",
|
||||||
FontSize = 12,
|
FontSize = 12,
|
||||||
Foreground = DimBrush,
|
Foreground = DimBrush,
|
||||||
VerticalAlignment = VerticalAlignment.Center
|
VerticalAlignment = VerticalAlignment.Center
|
||||||
@@ -593,9 +593,7 @@ public sealed class VehicleDetails
|
|||||||
? over == ConsistReadyOverride.AlwaysReady
|
? over == ConsistReadyOverride.AlwaysReady
|
||||||
: trainset?.ReadyToGo ?? false
|
: trainset?.ReadyToGo ?? false
|
||||||
};
|
};
|
||||||
ToolTip.SetTip(ready, overridden
|
ToolTip.SetTip(ready, App.Loc["ConsistReadyDesc"]);
|
||||||
? App.Loc["ConsistReadyOverridden"]
|
|
||||||
: App.Loc["ConsistReadyDesc"]);
|
|
||||||
|
|
||||||
ready.IsCheckedChanged += (_, _) =>
|
ready.IsCheckedChanged += (_, _) =>
|
||||||
{
|
{
|
||||||
@@ -605,7 +603,12 @@ public sealed class VehicleDetails
|
|||||||
_redraw();
|
_redraw();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A disabled box shows no tooltip, so why it is greyed out is said beside it.
|
||||||
|
if (!overridden)
|
||||||
return Row(content: ready);
|
return Row(content: ready);
|
||||||
|
var why = PanelNote(App.Loc["ConsistReadyOverridden"]);
|
||||||
|
why.Margin = new Thickness(0);
|
||||||
|
return Row(content: new StackPanel { Spacing = 2, Children = { ready, why } });
|
||||||
}
|
}
|
||||||
|
|
||||||
private Button LoadToolButton(string text, Action onClick, bool secondary = false)
|
private Button LoadToolButton(string text, Action onClick, bool secondary = false)
|
||||||
|
|||||||
Reference in New Issue
Block a user