Files
sbox-public/game/addons/menu/Code/Modals/PauseMenuModal/PauseMenuModal.razor

101 lines
2.2 KiB
Plaintext

@using Sandbox.Modals
@using Sandbox
@using Sandbox.UI
@using Sandbox.Menu
@using MenuProject.MenuUI.Components
@namespace MenuProject.Modals
@inherits MenuProject.Modals.BaseModal
<root>
<div class="inner">
@if(game is not null)
{
<MediaCardWide Image="@game.ThumbWide" OnPressImage="@( () => game.OpenModal() )">
<Content>
<div class="title clicky" onmousedown="@( ()=> game.OpenModal() )">@game.Title</div>
<div class="subtitle">@game.Summary</div>
<div class="meta">
<Meta Title="Likes" Icon="thumb_up" Value="@game.VotesUp.KiloFormat()" />
<Meta Title="Players" Icon="people" Value="@game.Usage.Total.Users.KiloFormat()" />
</div>
</Content>
</MediaCardWide>
}
<div class="body">
<div class="options">
<Button Icon="play_arrow" @onclick="@(() => this.Delete())">Resume</Button>
@if ( game is not null )
{
<Button Icon="info" @onclick="@(() => game.OpenModal() )">About</Button>
@if ( Networking.IsActive && game.GetValue<bool>( "ShowPlayerList", true ) )
{
<Button Icon="groups" @onclick="@(() => Game.Overlay.ShowPlayerList())">Players</Button>
}
@if ( CanChangeMap )
{
<Button Icon="map" onclick=@ChangeMap>Change Map</Button>
}
}
<Button Icon="gamepad" @onclick="@(() => Game.Overlay.ShowBinds() )">Controls</Button>
<Button Icon="settings" @onclick="@(() => Game.Overlay.ShowSettingsModal() )">Settings</Button>
<Button Icon="close" @onclick="@(() => MenuUtility.CloseGame())">Leave Game</Button>
</div>
</div>
</div>
</root>
@code
{
bool CanChangeMap
{
get
{
if ( Networking.IsActive && !Networking.IsHost ) return false;
return game.GetValue( "ShowChangeMap", false );
}
}
Package game;
void OnCreateGame( CreateGameResults x )
{
if ( Networking.IsActive && !Networking.IsHost )
return;
if ( !string.IsNullOrEmpty( x.MapIdent ) )
{
LaunchArguments.Map = x.MapIdent;
}
Game.Load( Game.Ident, true );
this.CloseModal( true );
}
void ChangeMap()
{
Game.Overlay.CreateGame( new CreateGameOptions( game, OnCreateGame ) );
}
public PauseMenuModal() : base()
{
game = MenuUtility.GamePackage;
}
}