Skip to content

Commit

Permalink
Fix web track monitor switch and reversal sprites.
Browse files Browse the repository at this point in the history
  • Loading branch information
YoRyan committed Jul 4, 2020
1 parent e40bb56 commit 803bc44
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ private static class Sprites
public static readonly Rectangle EndAuthoritySprite = new Rectangle(0, 0, 24, 24);
public static readonly Rectangle OppositeTrainForwardSprite = new Rectangle(24, 120, 24, 24);
public static readonly Rectangle OppositeTrainBackwardSprite = new Rectangle(0, 120, 24, 24);
public static readonly Rectangle LeftArrowSprite = new Rectangle(0, 168, 24, 24);
public static readonly Rectangle RightArrowSprite = new Rectangle(24, 168, 24, 24);
public static readonly Rectangle ReversalSprite = new Rectangle(0, 24, 24, 24);
public static readonly Rectangle InvalidReversalSprite = new Rectangle(24, 144, 24, 24);
public static readonly Dictionary<TrainPosition, Rectangle> TrainPositionSprite = new Dictionary<TrainPosition, Rectangle>
{
{ TrainPosition.AutoForwards, new Rectangle(0, 72, 24, 24) },
Expand Down Expand Up @@ -977,6 +981,7 @@ private class TrackSwitchItem : TrackItem
public override ListLabel TransformLabel(ListLabel dataCol)
{
dataCol.TrackCol = Item.IsRightSwitch ? Symbols.RightArrowWS : Symbols.LeftArrowWS;
dataCol.TrackColItem = Item.IsRightSwitch ? Sprites.RightArrowSprite : Sprites.LeftArrowSprite;
return dataCol;
}
}
Expand All @@ -993,16 +998,20 @@ private class TrackReversalItem : TrackItem
public override ListLabel TransformLabel(ListLabel dataCol)
{
string symbol;
Rectangle sprite;
if (Item.Valid)
{
Color color = Item.Enabled ? Color.LightGreen : Color.White;
symbol = $"{Symbols.ReversalWS}{ColorCode[color]}";
sprite = Sprites.ReversalSprite;
}
else
{
symbol = Symbols.InvalidReversalWS;
sprite = Sprites.InvalidReversalSprite;
}
dataCol.TrackCol = symbol;
dataCol.TrackColItem = sprite;
return dataCol;
}
}
Expand Down

0 comments on commit 803bc44

Please sign in to comment.