From 13137321c1f01119e15e6bce3a829955175d5827 Mon Sep 17 00:00:00 2001 From: maj00r Date: Sat, 22 Aug 2026 23:15:35 +0200 Subject: [PATCH] Gate Start on crew, pick starting vehicle, loading screen and help menu #16 and #12 Start is enabled only with crew/passenger (hold Ctrl to force); the chosen starting vehicle is carried through launch; loading-screen logo; help menu; runtime language picker. --- StarterNG/Classes/AppState.cs | 52 +++++++- StarterNG/MainWindow.axaml | 13 +- StarterNG/MainWindow.axaml.cs | 237 +++++++++++++++++++++++++++++++--- StarterNG/Views/MessageBox.cs | 56 ++++++++ 4 files changed, 329 insertions(+), 29 deletions(-) create mode 100644 StarterNG/Views/MessageBox.cs diff --git a/StarterNG/Classes/AppState.cs b/StarterNG/Classes/AppState.cs index fbbdf0a..624fc14 100644 --- a/StarterNG/Classes/AppState.cs +++ b/StarterNG/Classes/AppState.cs @@ -1,4 +1,6 @@ -namespace StarterNG.Classes; +using System; + +namespace StarterNG.Classes; /// /// Shared selection state across views: the scenery and trainset currently in @@ -10,6 +12,50 @@ public sealed class AppState { public static AppState Instance { get; } = new(); - public Scenery? CurrentScenery { get; set; } - public Trainset? CurrentTrainset { get; set; } + public event Action? Changed; + + private Scenery? _currentScenery; + private Trainset? _currentTrainset; + private string? _startingVehicleName; + + public Scenery? CurrentScenery + { + get => _currentScenery; + set + { + if (ReferenceEquals(_currentScenery, value)) return; + _currentScenery = value; + Changed?.Invoke(); + } + } + + public Trainset? CurrentTrainset + { + get => _currentTrainset; + set + { + if (ReferenceEquals(_currentTrainset, value)) return; + _currentTrainset = value; + Changed?.Invoke(); + } + } + + /// + /// Node name of the vehicle the player starts in (-v), like Pascal + /// SelVehicle. Updated when a consist car is clicked in the depot or a + /// trainset is picked in Scenarios. + /// + public string? StartingVehicleName + { + get => _startingVehicleName; + set + { + if (_startingVehicleName == value) return; + _startingVehicleName = value; + Changed?.Invoke(); + } + } + + /// Notify listeners after in-place edits that affect Start enablement. + public void NotifyChanged() => Changed?.Invoke(); } diff --git a/StarterNG/MainWindow.axaml b/StarterNG/MainWindow.axaml index 8cbddeb..80decfc 100644 --- a/StarterNG/MainWindow.axaml +++ b/StarterNG/MainWindow.axaml @@ -70,9 +70,9 @@ Tag="settings" IsCheckedChanged="Nav_OnCheckedChanged" Content="{Binding [NavSettings], Source={x:Static starterNg:App.Loc}}" /> -