Implement fluent for some Menu files (#3893)

This commit is contained in:
Visne
2021-05-21 15:39:33 +02:00
committed by GitHub
parent e9844e8c4c
commit d97dd4400d
15 changed files with 134 additions and 59 deletions

View File

@@ -56,7 +56,7 @@ namespace Content.Client.Arcade
public BlockGameMenu(BlockGameBoundUserInterface owner) public BlockGameMenu(BlockGameBoundUserInterface owner)
{ {
Title = Loc.GetString("Nanotrasen Block Game"); Title = Loc.GetString("blockgame-menu-title");
_owner = owner; _owner = owner;
MinSize = SetSize = (410, 490); MinSize = SetSize = (410, 490);
@@ -160,7 +160,7 @@ namespace Content.Client.Arcade
_newGameButton = new Button _newGameButton = new Button
{ {
Text = Loc.GetString("New Game"), Text = Loc.GetString("blockgame-menu-button-new-game"),
TextAlign = Label.AlignMode.Center TextAlign = Label.AlignMode.Center
}; };
_newGameButton.OnPressed += (e) => _newGameButton.OnPressed += (e) =>
@@ -172,7 +172,7 @@ namespace Content.Client.Arcade
_scoreBoardButton = new Button _scoreBoardButton = new Button
{ {
Text = Loc.GetString("Scoreboard"), Text = Loc.GetString("blockgame-menu-button-scoreboard"),
TextAlign = Label.AlignMode.Center TextAlign = Label.AlignMode.Center
}; };
_scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores); _scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores);
@@ -182,7 +182,7 @@ namespace Content.Client.Arcade
_unpauseButton = new Button _unpauseButton = new Button
{ {
Text = Loc.GetString("Unpause"), Text = Loc.GetString("blockgame-menu-button-unpause"),
TextAlign = Label.AlignMode.Center, TextAlign = Label.AlignMode.Center,
Visible = false Visible = false
}; };
@@ -230,7 +230,7 @@ namespace Content.Client.Arcade
VerticalAlignment = VAlignment.Center VerticalAlignment = VAlignment.Center
}; };
gameOverMenuContainer.AddChild(new Label{Text = Loc.GetString("Gameover!"),Align = Label.AlignMode.Center}); gameOverMenuContainer.AddChild(new Label{Text = Loc.GetString("blockgame-menu-msg-game-over"),Align = Label.AlignMode.Center});
gameOverMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); gameOverMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
@@ -240,7 +240,7 @@ namespace Content.Client.Arcade
_finalNewGameButton = new Button _finalNewGameButton = new Button
{ {
Text = Loc.GetString("New Game"), Text = Loc.GetString("blockgame-menu-button-new-game"),
TextAlign = Label.AlignMode.Center TextAlign = Label.AlignMode.Center
}; };
_finalNewGameButton.OnPressed += (e) => _finalNewGameButton.OnPressed += (e) =>
@@ -288,7 +288,7 @@ namespace Content.Client.Arcade
VerticalAlignment = VAlignment.Center VerticalAlignment = VAlignment.Center
}; };
menuContainer.AddChild(new Label{Text = Loc.GetString("Highscores")}); menuContainer.AddChild(new Label{Text = Loc.GetString("blockgame-menu-label-highscores")});
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
var highScoreBox = new HBoxContainer(); var highScoreBox = new HBoxContainer();
@@ -308,7 +308,7 @@ namespace Content.Client.Arcade
menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)});
_highscoreBackButton = new Button _highscoreBackButton = new Button
{ {
Text = Loc.GetString("Back"), Text = Loc.GetString("blockgame-menu-button-back"),
TextAlign = Label.AlignMode.Center TextAlign = Label.AlignMode.Center
}; };
_highscoreBackButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.Pause); _highscoreBackButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.Pause);
@@ -403,7 +403,7 @@ namespace Content.Client.Arcade
nextBlockPanel.AddChild(nextCenterContainer); nextBlockPanel.AddChild(nextCenterContainer);
grid.AddChild(nextBlockPanel); grid.AddChild(nextBlockPanel);
grid.AddChild(new Label{Text = Loc.GetString("Next"), Align = Label.AlignMode.Center}); grid.AddChild(new Label{Text = Loc.GetString("blockgame-menu-label-next"), Align = Label.AlignMode.Center});
return grid; return grid;
} }
@@ -441,7 +441,7 @@ namespace Content.Client.Arcade
holdBlockPanel.AddChild(holdCenterContainer); holdBlockPanel.AddChild(holdCenterContainer);
grid.AddChild(holdBlockPanel); grid.AddChild(holdBlockPanel);
grid.AddChild(new Label{Text = Loc.GetString("Hold"), Align = Label.AlignMode.Center}); grid.AddChild(new Label{Text = Loc.GetString("blockgame-menu-label-hold"), Align = Label.AlignMode.Center});
return grid; return grid;
} }
@@ -509,7 +509,7 @@ namespace Content.Client.Arcade
var globalPlacementText = globalPlacement == null ? "-" : $"#{globalPlacement}"; var globalPlacementText = globalPlacement == null ? "-" : $"#{globalPlacement}";
var localPlacementText = localPlacement == null ? "-" : $"#{localPlacement}"; var localPlacementText = localPlacement == null ? "-" : $"#{localPlacement}";
_finalScoreLabel.Text = _finalScoreLabel.Text =
Loc.GetString("blockgame-gameover-info", Loc.GetString("blockgame-menu-gameover-info",
("global", globalPlacementText), ("global", globalPlacementText),
("local", localPlacementText), ("local", localPlacementText),
("points", amount)); ("points", amount));
@@ -517,29 +517,29 @@ namespace Content.Client.Arcade
public void UpdatePoints(int points) public void UpdatePoints(int points)
{ {
_pointsLabel.Text = Loc.GetString("blockgame-points-label", ("points", points)); _pointsLabel.Text = Loc.GetString("blockgame-menu-label-points", ("points", points));
} }
public void UpdateLevel(int level) public void UpdateLevel(int level)
{ {
_levelLabel.Text = Loc.GetString("blockgame-level-label", ("level", level + 1)); _levelLabel.Text = Loc.GetString("blockgame-menu-label-level", ("level", level + 1));
} }
public void UpdateHighscores(List<BlockGameMessages.HighScoreEntry> localHighscores, public void UpdateHighscores(List<BlockGameMessages.HighScoreEntry> localHighscores,
List<BlockGameMessages.HighScoreEntry> globalHighscores) List<BlockGameMessages.HighScoreEntry> globalHighscores)
{ {
var localHighscoreText = new StringBuilder(Loc.GetString("Station\n")); var localHighscoreText = new StringBuilder(Loc.GetString("blockgame-menu-text-station") + "\n");
var globalHighscoreText = new StringBuilder(Loc.GetString("Nanotrasen:\n")); var globalHighscoreText = new StringBuilder(Loc.GetString("blockgame-menu-text-nanotrasen") + "\n");
for (var i = 0; i < 5; i++) for (var i = 0; i < 5; i++)
{ {
localHighscoreText.AppendLine(localHighscores.Count > i localHighscoreText.AppendLine(localHighscores.Count > i
? Loc.GetString("#{0}: {1} - {2}", i + 1, localHighscores[i].Name, localHighscores[i].Score) ? $"#{i + 1}: {localHighscores[i].Name} - {localHighscores[i].Score}"
: Loc.GetString("#{0}: ??? - 0", i + 1)); : $"#{i + 1}: ??? - 0");
globalHighscoreText.AppendLine(globalHighscores.Count > i globalHighscoreText.AppendLine(globalHighscores.Count > i
? Loc.GetString("#{0}: {1} - {2}", i + 1, globalHighscores[i].Name, globalHighscores[i].Score) ? $"#{i + 1}: {globalHighscores[i].Name} - {globalHighscores[i].Score}"
: Loc.GetString("#{0}: ??? - 0", i + 1)); : $"#{i + 1}: ??? - 0");
} }
_localHighscoresLabel.Text = localHighscoreText.ToString(); _localHighscoresLabel.Text = localHighscoreText.ToString();

View File

@@ -21,13 +21,13 @@ namespace Content.Client.Arcade
public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner)
{ {
MinSize = SetSize = (300, 225); MinSize = SetSize = (300, 225);
Title = Loc.GetString("Space Villain"); Title = Loc.GetString("spacevillain-menu-title");
Owner = owner; Owner = owner;
var grid = new GridContainer {Columns = 1}; var grid = new GridContainer {Columns = 1};
var infoGrid = new GridContainer {Columns = 3}; var infoGrid = new GridContainer {Columns = 3};
infoGrid.AddChild(new Label{ Text = Loc.GetString("Player"), Align = Label.AlignMode.Center }); infoGrid.AddChild(new Label{ Text = Loc.GetString("spacevillain-menu-label-player"), Align = Label.AlignMode.Center });
infoGrid.AddChild(new Label{ Text = "|", Align = Label.AlignMode.Center }); infoGrid.AddChild(new Label{ Text = "|", Align = Label.AlignMode.Center });
_enemyNameLabel = new Label{ Align = Label.AlignMode.Center}; _enemyNameLabel = new Label{ Align = Label.AlignMode.Center};
infoGrid.AddChild(_enemyNameLabel); infoGrid.AddChild(_enemyNameLabel);
@@ -49,15 +49,15 @@ namespace Content.Client.Arcade
var buttonGrid = new GridContainer {Columns = 3}; var buttonGrid = new GridContainer {Columns = 3};
_gameButtons[0] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack) _gameButtons[0] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack)
{Text = Loc.GetString("ATTACK")}; {Text = Loc.GetString("spacevillain-menu-button-attack")};
buttonGrid.AddChild(_gameButtons[0]); buttonGrid.AddChild(_gameButtons[0]);
_gameButtons[1] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal) _gameButtons[1] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal)
{Text = Loc.GetString("HEAL")}; {Text = Loc.GetString("spacevillain-menu-button-heal")};
buttonGrid.AddChild(_gameButtons[1]); buttonGrid.AddChild(_gameButtons[1]);
_gameButtons[2] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge) _gameButtons[2] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge)
{Text = Loc.GetString("RECHARGE")}; {Text = Loc.GetString("spacevillain-menu-button-recharge")};
buttonGrid.AddChild(_gameButtons[2]); buttonGrid.AddChild(_gameButtons[2]);
centerContainer = new CenterContainer(); centerContainer = new CenterContainer();
@@ -65,7 +65,7 @@ namespace Content.Client.Arcade
grid.AddChild(centerContainer); grid.AddChild(centerContainer);
var newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame) var newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame)
{Text = Loc.GetString("New Game")}; {Text = Loc.GetString("spacevillain-menu-button-new-game")};
grid.AddChild(newGame); grid.AddChild(newGame);
Contents.AddChild(grid); Contents.AddChild(grid);

View File

@@ -24,12 +24,12 @@ namespace Content.Client.Command
SetSize = MinSize = (600, 400); SetSize = MinSize = (600, 400);
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);
Title = Loc.GetString("Communications Console"); Title = Loc.GetString("communicationsconsole-menu-title");
Owner = owner; Owner = owner;
_messageInput = new LineEdit _messageInput = new LineEdit
{ {
PlaceHolder = Loc.GetString("Announcement"), PlaceHolder = Loc.GetString("communicationsconsole-menu-announcement-placeholder"),
HorizontalExpand = true, HorizontalExpand = true,
SizeFlagsStretchRatio = 1 SizeFlagsStretchRatio = 1
}; };
@@ -67,11 +67,11 @@ namespace Content.Client.Command
if (!Owner.CountdownStarted) if (!Owner.CountdownStarted)
{ {
_countdownLabel.SetMessage(""); _countdownLabel.SetMessage("");
EmergencyShuttleButton.Text = Loc.GetString("Call emergency shuttle"); EmergencyShuttleButton.Text = Loc.GetString("communicationsconsole-menu-call-shuttle");
return; return;
} }
EmergencyShuttleButton.Text = Loc.GetString("Recall emergency shuttle"); EmergencyShuttleButton.Text = Loc.GetString("communicationsconsole-menu-recall-shuttle");
_countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s"); _countdownLabel.SetMessage($"Time remaining\n{Owner.Countdown.ToString()}s");
} }

View File

@@ -164,7 +164,7 @@ namespace Content.Client.Construction
continue; continue;
} }
if (!string.IsNullOrEmpty(category) && category != Loc.GetString("All")) if (!string.IsNullOrEmpty(category) && category != Loc.GetString("construction-presenter-category-all"))
{ {
if (recipe.Category != category) if (recipe.Category != category)
continue; continue;
@@ -181,7 +181,7 @@ namespace Content.Client.Construction
var uniqueCategories = new HashSet<string>(); var uniqueCategories = new HashSet<string>();
// hard-coded to show all recipes // hard-coded to show all recipes
uniqueCategories.Add(Loc.GetString("All")); uniqueCategories.Add(Loc.GetString("construction-presenter-category-all"));
foreach (var prototype in _prototypeManager.EnumeratePrototypes<ConstructionPrototype>()) foreach (var prototype in _prototypeManager.EnumeratePrototypes<ConstructionPrototype>())
{ {
@@ -242,8 +242,8 @@ namespace Content.Client.Construction
if (firstNode) if (firstNode)
{ {
stepList.AddItem(prototype.Type == ConstructionType.Item stepList.AddItem(prototype.Type == ConstructionType.Item
? Loc.GetString($"{stepNumber++}. To craft this item, you need:") ? Loc.GetString($"construction-presenter-to-craft", ("step-number", stepNumber++))
: Loc.GetString($"{stepNumber++}. To build this, first you need:")); : Loc.GetString($"construction-presenter-to-build", ("step-number", stepNumber++)));
} }
foreach (var step in edge.Steps) foreach (var step in edge.Steps)
@@ -256,22 +256,37 @@ namespace Content.Client.Construction
stepList.AddItem( stepList.AddItem(
!firstNode !firstNode
? Loc.GetString( ? Loc.GetString(
"{0}. Add {1}x {2}.", stepNumber++, materialStep.Amount, materialStep.MaterialPrototype.Name) "construction-presenter-material-step",
: Loc.GetString(" {0}x {1}", materialStep.Amount, materialStep.MaterialPrototype.Name), icon); ("step-number", stepNumber++),
("amount", materialStep.Amount),
("material", materialStep.MaterialPrototype.Name))
: Loc.GetString(
"construction-presenter-material-first-step",
("amount", materialStep.Amount),
("material", materialStep.MaterialPrototype.Name)),
icon);
break; break;
case ToolConstructionGraphStep toolStep: case ToolConstructionGraphStep toolStep:
stepList.AddItem(Loc.GetString("{0}. Use a {1}.", stepNumber++, toolStep.Tool.GetToolName()), icon); stepList.AddItem(Loc.GetString(
"construction-presenter-tool-step",
("step-number", stepNumber++),
("tool", toolStep.Tool.GetToolName())),
icon);
break; break;
case ArbitraryInsertConstructionGraphStep arbitraryStep: case ArbitraryInsertConstructionGraphStep arbitraryStep:
stepList.AddItem(Loc.GetString("{0}. Add {1}.", stepNumber++, arbitraryStep.Name), icon); stepList.AddItem(Loc.GetString(
"construction-presenter-arbitrary-step",
("step-number", stepNumber++),
("name", arbitraryStep.Name)),
icon);
break; break;
case NestedConstructionGraphStep nestedStep: case NestedConstructionGraphStep nestedStep:
var parallelNumber = 1; var parallelNumber = 1;
stepList.AddItem(Loc.GetString("{0}. In parallel...", stepNumber++)); stepList.AddItem(Loc.GetString("construction-presenter-nested-step", ("step-number", stepNumber++)));
foreach (var steps in nestedStep.Steps) foreach (var steps in nestedStep.Steps)
{ {
@@ -284,15 +299,34 @@ namespace Content.Client.Construction
switch (subStep) switch (subStep)
{ {
case MaterialConstructionGraphStep materialStep: case MaterialConstructionGraphStep materialStep:
if (prototype.Type != ConstructionType.Item) stepList.AddItem(Loc.GetString(" {0}.{1}.{2}. Add {3}x {4}.", stepNumber, parallelNumber, subStepNumber++, materialStep.Amount, materialStep.MaterialPrototype.Name), icon); if (prototype.Type != ConstructionType.Item) stepList.AddItem(Loc.GetString(
"construction-presenter-material-substep",
("step-number", stepNumber),
("parallel-number", parallelNumber),
("substep-number", subStepNumber++),
("amount", materialStep.Amount),
("material", materialStep.MaterialPrototype.Name)),
icon);
break; break;
case ToolConstructionGraphStep toolStep: case ToolConstructionGraphStep toolStep:
stepList.AddItem(Loc.GetString(" {0}.{1}.{2}. Use a {3}.", stepNumber, parallelNumber, subStepNumber++, toolStep.Tool.GetToolName()), icon); stepList.AddItem(Loc.GetString(
"construction-presenter-tool-substep",
("step-number", stepNumber),
("parallel-number", parallelNumber),
("substep-number", subStepNumber++),
("tool", toolStep.Tool.GetToolName())),
icon);
break; break;
case ArbitraryInsertConstructionGraphStep arbitraryStep: case ArbitraryInsertConstructionGraphStep arbitraryStep:
stepList.AddItem(Loc.GetString(" {0}.{1}.{2}. Add {3}.", stepNumber, parallelNumber, subStepNumber++, arbitraryStep.Name), icon); stepList.AddItem(Loc.GetString(
"construction-presenter-arbitrary-substep",
("step-number", stepNumber),
("parallel-number", parallelNumber),
("substep-number", subStepNumber++),
("name", arbitraryStep.Name)),
icon);
break; break;
} }
} }

View File

@@ -26,7 +26,7 @@ namespace Content.Client.GameObjects.Components.Configuration
_inputs = new List<(string name, LineEdit input)>(); _inputs = new List<(string name, LineEdit input)>();
Title = Loc.GetString("Device Configuration"); Title = Loc.GetString("configuration-menu-device-title");
_baseContainer = new VBoxContainer _baseContainer = new VBoxContainer
{ {
@@ -48,7 +48,7 @@ namespace Content.Client.GameObjects.Components.Configuration
var confirmButton = new Button var confirmButton = new Button
{ {
Text = Loc.GetString("Confirm"), Text = Loc.GetString("configuration-menu-confirm"),
HorizontalAlignment = HAlignment.Center, HorizontalAlignment = HAlignment.Center,
VerticalAlignment = VAlignment.Center VerticalAlignment = VAlignment.Center
}; };

View File

@@ -147,14 +147,14 @@ namespace Content.Client.GameObjects.Components.Wires
{ {
(_nameLabel = new Label (_nameLabel = new Label
{ {
Text = Loc.GetString("Wires"), Text = Loc.GetString("wires-menu-name-label"),
FontOverride = font, FontOverride = font,
FontColorOverride = StyleNano.NanoGold, FontColorOverride = StyleNano.NanoGold,
VerticalAlignment = VAlignment.Center, VerticalAlignment = VAlignment.Center,
}), }),
(_serialLabel = new Label (_serialLabel = new Label
{ {
Text = Loc.GetString("DEAD-BEEF"), Text = "DEAD-BEEF",
FontOverride = fontSmall, FontOverride = fontSmall,
FontColorOverride = Color.Gray, FontColorOverride = Color.Gray,
VerticalAlignment = VAlignment.Center, VerticalAlignment = VAlignment.Center,

View File

@@ -23,7 +23,7 @@ namespace Content.Client.Research
{ {
Owner = owner; Owner = owner;
SetSize = MinSize = (300, 450); SetSize = MinSize = (300, 450);
Title = Loc.GetString("Lathe Queue"); Title = Loc.GetString("lathequeue-menu-title");
var vBox = new VBoxContainer(); var vBox = new VBoxContainer();

View File

@@ -0,0 +1,25 @@
### UI
# Current game score
blockgame-menu-label-points = Points: {$points}
# Current game level
blockgame-menu-label-level = Level: {$level}
# Game over information of your round
blockgame-menu-gameover-info = Global: {$global}
Local: {$local}
Points: {$points}
blockgame-menu-title = Nanotrasen Block Game
blockgame-menu-button-new-game = New Game
blockgame-menu-button-scoreboard = Scoreboard
blockgame-menu-button-unpause = Unpause
blockgame-menu-msg-game-over = Game over!
blockgame-menu-label-highscores = Highscores
blockgame-menu-button-back = Back
blockgame-menu-label-next = Next
blockgame-menu-label-hold = Hold
blockgame-menu-text-station = Station
blockgame-menu-text-nanotrasen = Nanotrasen

View File

@@ -0,0 +1,6 @@
spacevillain-menu-title = Space Villain
spacevillain-menu-label-player = Player
spacevillain-menu-button-attack = ATTACK
spacevillain-menu-button-heal = HEAL
spacevillain-menu-button-recharge = RECHARGE
spacevillain-menu-button-new-game = New Game

View File

@@ -1,13 +0,0 @@
### UI
# Current game score
blockgame-points-label = Points: {$points}
# Current game level
blockgame-level-label = Level: {$level}
# Game over information of your round
blockgame-gameover-info = Global: {$global}
Local: {$local}
Points: {$points}

View File

@@ -0,0 +1,15 @@
construction-presenter-category-all = All
construction-presenter-to-craft = {$step-number}. To craft this item, you need:
construction-presenter-to-build = {$step-number}. To build this, first you need:
construction-presenter-material-first-step = {$amount}x {$material}
construction-presenter-material-step = {$step-number}. Add {$amount}x {$material}.
construction-presenter-material-substep = {$step-number}.{$parallel-number}.{$substep-number}. Add {$amount}x {$material}.
construction-presenter-tool-step = {$step-number}. Use a {$tool}.
construction-presenter-tool-substep = {$step-number}.{$parallel-number}.{$substep-number}. Use a {$tool}.
construction-presenter-arbitrary-step = {$step-number}. Add {$name}.
construction-presenter-arbitrary-substep = {$step-number}.{$parallel-number}.{$substep-number}. Add {$name}.
construction-presenter-nested-step = {$step-number}. In parallel...

View File

@@ -0,0 +1,4 @@
communicationsconsole-menu-title = Communications Console
communicationsconsole-menu-announcement-placeholder = Announcement
communicationsconsole-menu-call-shuttle = Call emergency shuttle
communicationsconsole-menu-recall-shuttle = Recall emergency shuttle

View File

@@ -0,0 +1,2 @@
configuration-menu-confirm = Confirm
configuration-menu-device-title = Device Configuration

View File

@@ -0,0 +1 @@
lathequeue-menu-title = Lathe Queue

View File

@@ -0,0 +1 @@
wires-menu-name-label = Wires