Razor UI panel for the pause menu. Shows heading, prompt and buttons for Resume, Restart, Settings and Main Menu, and invokes Session methods and a SettingsRequested callback. Plays UI sounds on hover and click.
@using Sandbox; @using Sandbox.UI; @namespace Coilgarden @inherits Panel @attribute [StyleSheet( "/UI/GameUi.razor.scss" )] <root class="scrim"> <div class="card"> <div class="heading">Paused</div> <div class="prompt">P to resume, R to start over</div> <div class="menu"> <div [email protected] class="btn primary" onclick=@Resume>Resume</div> <div [email protected] class="btn" onclick=@Restart>Restart</div> <div [email protected] class="btn" onclick=@OpenSettingsClicked>Settings</div> <div [email protected] class="btn danger" onclick=@Menu>Main Menu</div> </div> </div> </root> @code { [Parameter] public GameSession Session { get; set; } [Parameter] public Action SettingsRequested { get; set; } private void Resume() { UiSound.Click(); Session?.SetPaused( false ); } private void Restart() { UiSound.Click(); Session?.Restart(); } private void OpenSettingsClicked() { UiSound.Click(); SettingsRequested?.Invoke(); } private void Menu() { UiSound.Click(); Session?.ReturnToMenu(); } // Nothing on this screen changes while it is up - the run underneath is frozen - so there // is nothing to key a rebuild off besides existing at all. protected override int BuildHash() => 1; }