-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show map preview in game preview #611
Show map preview in game preview #611
Conversation
Nightly build for this pull request:
|
@@ -126,9 +176,12 @@ public void SetInfo(GenericHostedGame game) | |||
lblHost.Text = "Host:".L10N("Client:Main:GameInfoHost") + " " + Renderer.GetSafeString(game.HostName, lblHost.FontIndex); | |||
lblHost.Visible = true; | |||
|
|||
lblPing.Text = game.Ping > 0 ? "Ping:".L10N("Client:Main:GameInfoPing") + " " + game.Ping.ToString() + " ms" : "Ping: Unknown".L10N("Client:Main:GameInfoPingUnknown"); | |||
lblPing.Text = "Ping:".L10N("Client: Main: GameInfoPing"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The L10N key name does not come with spaces after :
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -84,11 +119,21 @@ public override void Initialize() | |||
lblPlayerNames[(lblPlayerNames.Length / 2) + i] = lblPlayerName2; | |||
} | |||
|
|||
pingTextures = new Texture2D[5] | |||
{ | |||
AssetLoader.LoadTexture("ping0.png"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the client work normally when these assets are missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the same ping images used in the cncnetgamelobby
if (mapLoader != null) | ||
{ | ||
mapTexture = mapLoader.GameModeMaps.Find((m) => m.Map.Name == game.Map)?.Map.LoadPreviewTexture(); | ||
if (mapTexture == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use ?? operator if you want.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not necessarily exhaustive review, currently a bit exhausted to properly look at so may miss somehting
leftColumnPositionX = 10; | ||
rightColumnPositionX = Width / 2 - 10; | ||
topStartingPositionY = 30; | ||
mapPreviewPositionY = topStartingPositionY + (rowHeight * 2 + 15); // 2 Labels down, incase map name spills to next line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I smell magic numbers here and accross the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of one off padding, doesn't feel too bad
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still think it should be easy to get rid of the magic numbers accross the code and make them constants, minor stuff like this accumulates and makes the code less readable
|
||
private void RenderMapPreview() | ||
{ | ||
int maxPreviewHeight = 150; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be made a const
leftColumnPositionX = 10; | ||
rightColumnPositionX = Width / 2 - 10; | ||
topStartingPositionY = 30; | ||
mapPreviewPositionY = topStartingPositionY + (rowHeight * 2 + 15); // 2 Labels down, incase map name spills to next line |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still think it should be easy to get rid of the magic numbers accross the code and make them constants, minor stuff like this accumulates and makes the code less readable
Preview
2025-01-04.13-30-20.mp4