Razor UI component for the Help screen in the Breakout game. It renders a BACK button and a grid of block entries showing an icon, name and description for each block type.
@using System
@using Sandbox
@using Sandbox.UI
@namespace Breakout
@inherits Panel
@*
HelpScreen is the "how to play" page you reach from the menu's HELP button. It shows a guide
of every block type and what it does. Pressing BACK runs the Back callback, which tells the
menu to show itself again.
*@
<root>
<div class="help">
<button class="back-btn" onclick=@(() => Back?.Invoke())>
<span class="back-icon">◀</span>
BACK
</button>
<div class="help-body">
<div class="help-title">HELP</div>
<div class="help-sub">Here is what each brick does when you hit it.</div>
<div class="block-grid">
@foreach ( var block in Blocks )
{
<div class="block-card">
<img class="block-icon" src="@block.Icon" />
<div class="block-info">
<div class="block-name">@block.Name</div>
<div class="block-desc">@block.Description</div>
</div>
</div>
}
</div>
</div>
</div>
</root>
@code
{
/// <summary>
/// Called when the player presses BACK, so the menu can show itself again.
/// </summary>
[Parameter] public Action Back { get; set; }
/// <summary>
/// One row in the block guide: the icon to show, the block's name, and a short description.
/// </summary>
private record BlockGuideEntry( string Icon, string Name, string Description );
// The list shown on the help page. Add a new line here to document another block type.
private static readonly BlockGuideEntry[] Blocks =
{
new( "textures/blocks/normal.png", "Brick", "Breaks in a single hit." ),
new( "textures/blocks/armoured.png", "Armoured", "Takes two hits to break." ),
new( "textures/blocks/unbreakable.png", "Unbreakable", "Can't be broken, so play around it." ),
new( "textures/blocks/explosion.png", "Explosive", "Blows up nearby bricks when it breaks." ),
new( "textures/blocks/speed.png", "Fast Ball", "Turns your ball into a faster one." ),
new( "textures/blocks/big_ball.png", "Big Ball", "Makes your ball big enough to smash armour in one hit." ),
new( "textures/blocks/fire_ball.png", "Fireball", "Turns your ball into a fireball that burns straight through bricks." ),
new( "textures/blocks/split.png", "Multi-Ball", "Drops a pickup that splits your ball into more." ),
new( "textures/blocks/expand.png", "Expand", "Drops a pickup that makes your paddle wider." ),
};
}