Skip to content

Commit 94371ae

Browse files
committed
Automatic merge of T1.5.1-913-g91804456c and 16 pull requests
- Pull request #570 at 3539862: Experimental glTF 2.0 support with PBR lighting - Pull request #839 at d00beb9: First phase of https://blueprints.launchpad.net/or/+spec/additional-cruise-control-parameters - Pull request #876 at f92de76: docs: add source for documents previously on website to source Documentation folder - Pull request #882 at 1a5693d: Blueprint/train car operations UI window - Pull request #886 at 6c0785b: Scene viewer extension to TrackViewer - Pull request #892 at 1f5ba4c: Signal Function OPP_SIG_ID_TRAINPATH - Pull request #896 at 5866028: First implementation of https://blueprints.launchpad.net/or/+spec/specific-sounds-for-ai-trains - Pull request #903 at 9bead33: Downloading route content (Github, zip) - Pull request #910 at 97d4569: Allow building code using .NET 6 (Windows) - Pull request #911 at 6834af0: docs: Add refactoring as a special type of PR - Pull request #912 at f7b85e4: New Triple Valve Features Vol. 2 - Pull request #919 at e6c08a2: Added mouse wheel support for controls which can be moved by pressing t… - Pull request #920 at a94e403: Update RailDriver in Manual - Pull request #923 at e0f3c55: Add curve squeal to route - Pull request #924 at 6c2c3cd: Default Asset Improvements - Pull request #925 at e3b1688: Fix brakeshoe force bug
18 parents 6d20123 + 9180445 + 3539862 + d00beb9 + f92de76 + 1a5693d + 6c0785b + 1f5ba4c + 5866028 + 9bead33 + 97d4569 + 6834af0 + f7b85e4 + e6c08a2 + a94e403 + e0f3c55 + 6c2c3cd + e3b1688 commit 94371ae

File tree

2 files changed

+39
-25
lines changed

2 files changed

+39
-25
lines changed

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsViewerWindow.cs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,20 @@ public class TrainCarOperationsViewerWindow : Window
7474
internal static Texture2D ResetBrakesOff;
7575
internal static Texture2D ResetBrakesOn;
7676

77-
public int WindowHeightMin;
78-
public int WindowHeightMax;
79-
public int WindowWidthMin;
80-
public int WindowWidthMax;
81-
public string PowerSupplyStatus;
8277
public string BatteryStatus;
8378
string CircuitBreakerState;
84-
public int SpacerRowCount;
85-
public int SymbolsRowCount;
8679
public int LocoRowCount;
80+
public string PowerSupplyStatus;
8781
public int RowsCount;
82+
public int SpacerRowCount;
83+
public int SymbolsRowCount;
8884
const int SymbolWidth = 32;
8985
public static bool FontChanged;
9086
public static bool FontToBold;
87+
public int WindowHeightMin;
88+
public int WindowHeightMax;
89+
public int WindowWidthMin;
90+
public int WindowWidthMax;
9191
public int windowHeight { get; set; } //required by TrainCarWindow
9292
public int CarPosition
9393
{
@@ -132,10 +132,10 @@ public struct ListLabel
132132
public List<ListLabel> Labels = new List<ListLabel>();
133133

134134
Train PlayerTrain;
135-
int LastPlayerTrainCars;
136135
bool LastPlayerLocomotiveFlippedState;
136+
int LastPlayerTrainCars;
137137
int OldCarPosition;
138-
bool ResetAllSymbols = false;
138+
bool ResetAllSymbols;
139139
public TrainCarOperationsViewerWindow(WindowManager owner)
140140
: base(owner, Window.DecorationSize.X + CarListPadding + ((owner.TextFontDefault.Height + 12) * 20), Window.DecorationSize.Y + ((owner.TextFontDefault.Height + 12) * 2), Viewer.Catalog.GetString("Train Operations Viewer"))
141141
{
@@ -375,11 +375,19 @@ void buttonClose_Click(Control arg1, Point arg2)
375375
public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
376376
{
377377
base.PrepareFrame(elapsedTime, updateFull);
378+
if (UserInput.IsPressed(UserCommand.CameraCarNext) && CarPosition > 0)
379+
CarPosition--;
380+
else if (UserInput.IsPressed(UserCommand.CameraCarPrevious) && CarPosition < Owner.Viewer.PlayerTrain.Cars.Count - 1)
381+
CarPosition++;
382+
else if (UserInput.IsPressed(UserCommand.CameraCarFirst))
383+
CarPosition = 0;
384+
else if (UserInput.IsPressed(UserCommand.CameraCarLast))
385+
CarPosition = Owner.Viewer.PlayerTrain.Cars.Count - 1;
378386

379387
if (updateFull)
380388
{
381389
var carOperations = Owner.Viewer.CarOperationsWindow;
382-
var trainCarOperations = Owner.Viewer.TrainCarOperationsWindow;
390+
var trainCarOperations = Owner.Viewer.TrainCarOperationsWindow;
383391

384392
if (CouplerChanged || PlayerTrain != Owner.Viewer.PlayerTrain || Owner.Viewer.PlayerTrain.Cars.Count != LastPlayerTrainCars || (Owner.Viewer.PlayerLocomotive != null &&
385393
LastPlayerLocomotiveFlippedState != Owner.Viewer.PlayerLocomotive.Flipped))

Source/RunActivity/Viewer3D/Popups/TrainCarOperationsWindow.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,43 +71,44 @@ public class TrainCarOperationsWindow : Window
7171
internal static Texture2D RearAngleCockClosed;
7272
internal static Texture2D RearAngleCockOpened;
7373

74-
public int DisplaySizeY;
75-
public bool LayoutUpdated = false;
7674
public bool AllSymbolsMode = true;
75+
public int DisplaySizeY;
76+
public bool LayoutUpdated;
7777
public int LocoRowCount;
7878
public int RowsCount;
7979
public int SeparatorCount;
8080
public int SpacerRowCount;
8181
public int SymbolsRowCount;
8282

83-
public int CarPositionVisible;
8483
public ControlLayout Client;
84+
public bool CarPositionChanged;
85+
public int CarPositionVisible;
8586
public int CurrentCarPosition;
8687
public int LabelTop;
87-
public bool LastRowVisible = false;
88+
public bool LastRowVisible;
8889
public int LocalScrollPosition;
8990
public int SelectedCarPosition;
9091
const int SymbolSize = 16;
9192

93+
public int CurrentDisplaySizeY;
94+
public bool IsFullScreen;
95+
public int OldPositionHeight;
96+
public int RowHeight;
97+
public bool UpdateTrainCarOperation;
9298
public int WindowHeightMax;
9399
public int WindowHeightMin;
94100
public int WindowWidthMax;
95101
public int WindowWidthMin;
96-
public int CurrentDisplaySizeY;
97-
public bool IsFullScreen = false;
98-
public int RowHeight;
99-
public int OldPositionHeight;
100-
public bool UpdateTrainCarOperation = false;
101102
public List<int> LabelPositionTop = new List<int>();
102103

103104
//Rectangle carLabelPosition;
105+
public ControlLayoutVertical Vbox;
104106
public string CarLabelText;
105107
public int CarPosition;
106108
public int CarUIDLenght;
107109
public int DesiredHeight;
108110
public static bool FontChanged;
109111
public static bool FontToBold;
110-
public ControlLayoutVertical Vbox;
111112

112113
//Electrical power
113114
public string BatteryStatus;
@@ -116,10 +117,10 @@ public class TrainCarOperationsWindow : Window
116117
public string PowerSupplyStatus;
117118
public bool PowerSupplyUpdating;
118119
public bool SupplyStatusChanged;
119-
public bool UpdatingPowerSupply = false;
120+
public bool UpdatingPowerSupply;
120121

121-
public bool WarningEnabled = false;
122-
public bool CarIdClicked = false;
122+
public bool CarIdClicked;
123+
public bool WarningEnabled;
123124
public bool ModifiedSetting
124125
{
125126
set;
@@ -460,7 +461,7 @@ public void topCarPositionVisible()
460461
break;
461462
}
462463
}
463-
}
464+
}
464465
}
465466
}
466467
public void localScrollLayout(int selectedCarPosition)
@@ -502,6 +503,9 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
502503
{
503504
base.PrepareFrame(elapsedTime, updateFull);
504505

506+
if (UserInput.IsPressed(UserCommand.CameraCarNext) || UserInput.IsPressed(UserCommand.CameraCarPrevious) || UserInput.IsPressed(UserCommand.CameraCarFirst) || UserInput.IsPressed(UserCommand.CameraCarLast))
507+
CarPositionChanged = true;
508+
505509
if (updateFull)
506510
{
507511
var trainCarViewer = Owner.Viewer.TrainCarOperationsViewerWindow;
@@ -580,14 +584,16 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
580584
carOperations.CarOperationChanged = carOperations.Visible && carOperations.CarOperationChanged;
581585
}
582586

583-
if (trainCarWebpage != null && CarPosition != trainCarViewer.CarPosition && trainCarWebpage.Connections > 0)
587+
if (CarPositionChanged || (trainCarWebpage != null && CarPosition != trainCarViewer.CarPosition && trainCarWebpage.Connections > 0))
584588
{
585589
// Required to scroll the main window from the web version
586590
UpdateTrainCarOperation = true;
587591
CarPosition = trainCarViewer.CarPosition;
592+
SelectedCarPosition = CarPositionChanged ? CarPosition : SelectedCarPosition;
588593
LabelTop = LabelPositionTop[SelectedCarPosition];
589594
Layout();
590595
localScrollLayout(SelectedCarPosition);
596+
CarPositionChanged = false;
591597
}
592598
//Resize this window after the font has been changed externally
593599
else if (MultiPlayerWindow.FontChanged)

0 commit comments

Comments
 (0)