Skip to content

Commit

Permalink
Adjust some more method names and simplify difficulty select localiza…
Browse files Browse the repository at this point in the history
…tion key structure
  • Loading branch information
EliteAsian123 committed Jul 29, 2024
1 parent 8191357 commit 47a1506
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 25 deletions.
23 changes: 9 additions & 14 deletions Assets/Script/Menu/DifficultySelect/DifficultySelectMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ private void CreateMainMenu()
// Only show all these options if there are instruments available
if (_possibleInstruments.Count > 0)
{
CreateItem(CreateLocalizedHeader("Instrument"),
CreateItem(LocalizeHeader("Instrument"),
player.Profile.CurrentInstrument.ToLocalizedName(),
_lastMenuState == State.Instrument, () =>
{
_menuState = State.Instrument;
UpdateForPlayer();
});

CreateItem(CreateLocalizedHeader("Difficulty"),
CreateItem(LocalizeHeader("Difficulty"),
player.Profile.CurrentDifficulty.ToLocalizedName(),
_lastMenuState == State.Difficulty, () =>
{
Expand All @@ -191,7 +191,7 @@ private void CreateMainMenu()
// Harmony players must pick their harmony index
if (player.Profile.CurrentInstrument == Instrument.Harmony)
{
CreateItem(CreateLocalizedHeader("Harmony"),
CreateItem(LocalizeHeader("Harmony"),
(player.Profile.HarmonyIndex + 1).ToString(),
_lastMenuState == State.Harmony, () =>
{
Expand Down Expand Up @@ -225,7 +225,7 @@ private void CreateMainMenu()
modifierText = modifierText.Trim();
}

CreateItem(CreateLocalizedHeader("Modifiers"),
CreateItem(LocalizeHeader("Modifiers"),
modifierText, _lastMenuState == State.Modifiers, () =>
{
_menuState = State.Modifiers;
Expand All @@ -234,7 +234,7 @@ private void CreateMainMenu()
}

// Ready button
CreateItem(CreateLocalizedAction("Ready"), _lastMenuState == State.Main, _difficultyGreenPrefab, () =>
CreateItem(LocalizeHeader("Ready"), _lastMenuState == State.Main, _difficultyGreenPrefab, () =>
{
// If the player just selected vocal modifiers, don't show them again
if (player.Profile.CurrentInstrument.ToGameMode() == GameMode.Vocals &&
Expand All @@ -251,7 +251,7 @@ private void CreateMainMenu()
if (_possibleInstruments.Count <= 0 || PlayerContainer.Players.Count != 1)
{
// Sit out button
CreateItem(CreateLocalizedAction("SitOut"), _possibleInstruments.Count <= 0, _difficultyRedPrefab, () =>
CreateItem(LocalizeHeader("SitOut"), _possibleInstruments.Count <= 0, _difficultyRedPrefab, () =>
{
// If the user went back to sit out, and the vocal modifiers were selected,
// deselect them.
Expand Down Expand Up @@ -327,7 +327,7 @@ private void CreateModifierMenu()
}

// Create done button
CreateItem(CreateLocalizedAction("Done"), _difficultyGreenPrefab, () =>
CreateItem(LocalizeHeader("Done"), _difficultyGreenPrefab, () =>
{
_menuState = State.Main;
UpdateForPlayer();
Expand Down Expand Up @@ -555,14 +555,9 @@ private void CreateItem(string body, bool selected, UnityAction a)
CreateItem(null, body, selected, a);
}

private string CreateLocalizedHeader(string headerLocalizeKey)
private string LocalizeHeader(string key)
{
return Localize.Key("Menu.DifficultySelect.Header", headerLocalizeKey);
}

private string CreateLocalizedAction(string bodyLocalizeKey)
{
return Localize.Key("Menu.DifficultySelect.Action", bodyLocalizeKey);
return Localize.Key("Menu.DifficultySelect", key);
}

private bool HasPlayableInstrument(SongEntry entry, in Instrument instrument)
Expand Down
18 changes: 7 additions & 11 deletions Assets/StreamingAssets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,13 @@
"DontShowAgain": "Don't Show Again"
},
"DifficultySelect": {
"Header": {
"Instrument": "Instrument",
"Difficulty": "Difficulty",
"Harmony": "Harmony",
"Modifiers": "Modifiers"
},
"Action": {
"Ready": "Ready",
"SitOut": "Sit Out",
"Done": "Done"
}
"Instrument": "Instrument",
"Difficulty": "Difficulty",
"Harmony": "Harmony",
"Modifiers": "Modifiers",
"Ready": "Ready",
"SitOut": "Sit Out",
"Done": "Done"
},
"History": {
"Name": "History",
Expand Down

0 comments on commit 47a1506

Please sign in to comment.