-
-
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
Select & show preferred skill level when making a game #598
Conversation
Nightly build for this pull request:
|
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.
Does it come with the localization support?
Is there a way to have something like this but translated? If there is an example I can follow I can update it |
change it to something like:
|
ClientCore/ClientConfiguration.cs
Outdated
@@ -330,6 +330,8 @@ private List<TranslationGameFile> ParseTranslationGameFiles() | |||
|
|||
public string AllowedCustomGameModes => clientDefinitionsIni.GetStringValue(SETTINGS, "AllowedCustomGameModes", "Standard,Custom Map"); | |||
|
|||
public string OnlineGameDifficultyOptions => clientDefinitionsIni.GetStringValue(SETTINGS, "OnlineGameDifficultyOptions", "Any,Beginner,Intermediate,Pro (Competitive)"); |
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.
Pretty sure this should be an array or list of strings already.
Also I don't think you should be adding (competitive), just beginner/intermediate/pro is enough. Beginner games can be competitive too, and pro players can be playing casually for fun without any sweat.
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.
Localization questions remain. Others are fine.
@@ -132,6 +142,8 @@ public void SetInfo(GenericHostedGame game) | |||
{ | |||
lblPlayerNames[i].Visible = false; | |||
} | |||
|
|||
lblGameDifficulty.Text = "Preferred Skill Level:".L10N("Client:Main:GameInfoDifficulty") + " " + OnlineGameDifficultyOptions[game.GameDifficulty]; |
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.
Localization required
@@ -143,7 +143,8 @@ public void SetInfo(GenericHostedGame game) | |||
lblPlayerNames[i].Visible = false; | |||
} | |||
|
|||
lblGameDifficulty.Text = "Preferred Skill Level:".L10N("Client:Main:GameInfoDifficulty") + " " + OnlineGameDifficultyOptions[game.GameDifficulty]; | |||
lblGameDifficulty.Text = "Preferred Skill Level: ".L10N("Client:Main:GameInfoDifficulty") | |||
+ " ".L10N($"INI:ClientDefinitions:Difficulty:{game.GameDifficulty}"); |
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.
huh?
if (gd != null) | ||
{ | ||
txGameDifficultyIcons.Add(gd); | ||
} | ||
else | ||
{ | ||
Logger.Log($"Failed to load texture for game difficulty index {i}"); | ||
} |
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.
if (gd != null) | |
{ | |
txGameDifficultyIcons.Add(gd); | |
} | |
else | |
{ | |
Logger.Log($"Failed to load texture for game difficulty index {i}"); | |
} | |
if (gd != null) | |
txGameDifficultyIcons.Add(gd); | |
else | |
Logger.Log($"Failed to load texture for game difficulty index {i}"); |
@@ -332,6 +359,19 @@ public override void Draw(GameTime gameTime) | |||
height, txPasswordedGame.Width, txPasswordedGame.Height), | |||
Color.White); | |||
} | |||
else | |||
{ | |||
Logger.Log("GameDifficulty ** Drawing game difficulty icon: " + hostedGame.GameDifficulty); |
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.
DO NOT
Logger.Log("GameDifficulty ** Drawing game difficulty icon: " + hostedGame.GameDifficulty); |
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.
If you need an explanation -- you're logging every single frame, this will absolutely tank the performance.
DrawTexture(txGameDifficulty, | ||
new Rectangle(Width - txGameDifficulty.Width - TextBorderDistance - (scrollBarDrawn ? ScrollBar.Width : 0), | ||
height, txGameDifficulty.Width, txGameDifficulty.Height), | ||
Color.White); |
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.
How does this look with locked/passworded/incompatible game icons?
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.
For passworded games it doesn't show the icon. No need.
Incompatible/locked icons are on the left hand side.
The only icons on the right would be the difficulty icons OR password.
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.
Right, but in future we should generalize this like RA2/YR icons implementation I've told you about earlier. The one where a broadcasted game option could add an icon, and every game option including those ones could draw an icon not impacting other game options.
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.
"Any" should not have an icon at all IMO, it's "don't care" so shouldn't be the same as newbie icon.
GameCreated?.Invoke(this, | ||
new GameCreationEventArgs(gameName,int.Parse(ddMaxPlayers.SelectedItem.Text), | ||
tbPassword.Text,tunnelHandler.Tunnels[lbTunnelList.SelectedIndex], | ||
ddGameDifficulty.SelectedIndex) | ||
); |
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.
GameCreated?.Invoke(this, | |
new GameCreationEventArgs(gameName,int.Parse(ddMaxPlayers.SelectedItem.Text), | |
tbPassword.Text,tunnelHandler.Tunnels[lbTunnelList.SelectedIndex], | |
ddGameDifficulty.SelectedIndex) | |
); | |
GameCreated?.Invoke(this, | |
new GameCreationEventArgs(gameName, int.Parse(ddMaxPlayers.SelectedItem.Text), | |
tbPassword.Text, tunnelHandler.Tunnels[lbTunnelList.SelectedIndex], | |
ddGameDifficulty.SelectedIndex) | |
); |
|
||
string difficulty = OnlineGameDifficultyOptions[game.GameDifficulty]; | ||
string localizedDifficulty = difficulty.L10N($"INI:ClientDefinitions:Difficulty:{game.GameDifficulty}"); | ||
lblGameDifficulty.Text = "Preferred Skill Level: ".L10N("Client:Main:GameInfoDifficulty") + " " + localizedDifficulty; |
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.
lblGameDifficulty.Text = "Preferred Skill Level: ".L10N("Client:Main:GameInfoDifficulty") + " " + localizedDifficulty; | |
lblGameDifficulty.Text = "Preferred Skill Level:".L10N("Client:Main:GameInfoDifficulty") + " " + localizedDifficulty; |
{ | ||
Texture2D txGameDifficulty = txGameDifficultyIcons[hostedGame.GameDifficulty]; | ||
|
||
if (txGameDifficulty != null && hostedGame.GameDifficulty > 0) // Don't show GameDifficulty Any |
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.
No, why? You're making an assumption about what difficulties will be set by modder. You already have no image (or you should not have an image), why add an additional check?
if (txGameDifficulty != null && hostedGame.GameDifficulty > 0) // Don't show GameDifficulty Any | |
if (txGameDifficulty != 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.
@Rampastring and myself think all references to "game difficulty" should be replaced with "preferred skill level" or just "skill level" as they are already in the text itself, but this also should be reflected on the code level and the INI level to not be confusing. Game difficulty usually is relevant in "against AI" scenarios, and skill level is more universal.
Simple icon indicator to show preferred skill level when making online games
Screenshots
Select player skill preference when hosting
Beginner
Intermediate
Pro