UI/PauseGamePanel/PauseGamePanel.razor
@using Milaine.Managers;
@using Milaine.Settings;
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent
@namespace Sandbox
<root>
@if (PauseGameInstance.IsOpened) {
<div class="pause-container">
<header class="header">
<DropDown Options=@ModeOptions Value=@SelectedMode ValueChanged=@OnOptionChanged />
</header>
<main>
<div class="container">
<button [email protected]>
@TranslationsInstance.T("milaine.back")
</button>
<button onclick=@ExitGame>
@TranslationsInstance.T("milaine.quit")
</button>
</div>
<div class="credits">
<p>Credits</p>
<p>
Computer Keyboard by Luke (https://sbox.game/luke/office_keyboard)
</p>
<p>
Computer Monitor by Luke (https://sbox.game/luke/monitor_basic)
</p>
<p>
Computer Mouse by Luke (https://sbox.game/luke/computer_mouse)
</p>
<p>
Coffee_cup_01 by Small Box Studio (https://sbox.game/smallboxstudio/coffeecup01)
</p>
<p>
French_fries_02 by Small Box Studio (https://sbox.game/smallboxstudio/frenchfries02)
</p>
<p>
French_fries_02_empty by Small Box Studio (https://sbox.game/smallboxstudio/frenchfries02empty)
</p>
<p>
Stir_fried_noodles_01 by Small Box Studio (https://sbox.game/smallboxstudio/stirfriednoodles01)
</p>
<p>
Stir_fried_noodles_01_close by Small Box Studio (https://sbox.game/smallboxstudio/stirfriednoodles01close)
</p>
</div>>
</main>
</div>
<div class="version-manager">
<p>@("v" + VersionManagerInstance.Version.ToString())</p>
</div>
}
</root>
@code
{
[Property, Title("Translations")]
[Feature("Managers")]
public Translations TranslationsInstance { get; set; }
[Property, Title("VersionManager")]
[Feature("Managers")]
public VersionManager VersionManagerInstance { get; set; }
[Property]
[Feature("Settings")]
public PauseGame PauseGameInstance { get; set; }
public string SelectedMode { get; set; } = "en";
public List<UI.Option> ModeOptions { get; set; } = [
new Option{Title = "English", Value = "en"},
new Option{Title = "Español", Value = "es"},
];
protected override int BuildHash() => System.HashCode.Combine(PauseGameInstance.IsOpened, SelectedMode);
protected override void OnStart() {
base.OnStart();
SelectedMode = TranslationsInstance.language;
}
private void ExitGame() {
if (Application.IsStandalone) {
Game.Close();
return;
}
Game.Disconnect();
}
private void OnOptionChanged(object code) {
SelectedMode = (string)code;
TranslationsInstance.SetLanguage((string)code);
StateHasChanged();
}
}