mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 15:02:15 +01:00
Move the battery option to the depot as a consist property
It was a global preference that rewrote the trainset speed at launch, while what it really sets is whether this consist starts prepared or cold. Now a checkbox in the consist-scope section, acting on the consist being edited.
This commit is contained in:
@@ -555,7 +555,7 @@ public sealed class VehicleDetails
|
||||
if (_consist.Count == 0)
|
||||
return;
|
||||
|
||||
var buttons = Stack(
|
||||
var tools = Stack(
|
||||
LoadToolButton(App.Loc["ConsistRandomType"],
|
||||
() => { _cargo.RandomTypes(_consist); _redraw(); }, secondary: true),
|
||||
LoadToolButton(App.Loc["ConsistMaxAmount"],
|
||||
@@ -563,6 +563,8 @@ public sealed class VehicleDetails
|
||||
LoadToolButton(App.Loc["ConsistRandomAmount"],
|
||||
() => { _cargo.RandomAmounts(_consist); _redraw(); }, secondary: true));
|
||||
|
||||
var buttons = Stack(ReadyToGoRow(), tools);
|
||||
|
||||
var count = new TextBlock
|
||||
{
|
||||
Text = $"{App.Loc["VehicleCount"]}: {_consist.Count}",
|
||||
@@ -574,6 +576,29 @@ public sealed class VehicleDetails
|
||||
loadsPanel.Children.Add(Section(App.Loc["ConsistLoadTools"], buttons, count));
|
||||
}
|
||||
|
||||
private Control ReadyToGoRow()
|
||||
{
|
||||
var trainset = _consist.EditingTrainset;
|
||||
var ready = new CheckBox
|
||||
{
|
||||
Content = App.Loc["ConsistReady"],
|
||||
FontSize = 12,
|
||||
IsEnabled = trainset is not null,
|
||||
IsChecked = trainset?.ReadyToGo ?? false
|
||||
};
|
||||
ToolTip.SetTip(ready, App.Loc["ConsistReadyDesc"]);
|
||||
|
||||
ready.IsCheckedChanged += (_, _) =>
|
||||
{
|
||||
if (trainset is null)
|
||||
return;
|
||||
trainset.ReadyToGo = ready.IsChecked == true;
|
||||
_redraw();
|
||||
};
|
||||
|
||||
return Row(content: ready);
|
||||
}
|
||||
|
||||
private Button LoadToolButton(string text, Action onClick, bool secondary = false)
|
||||
{
|
||||
var b = new Button
|
||||
|
||||
Reference in New Issue
Block a user