UI/BannerOverlay.razor

Razor UI Panel component that shows a banner overlay for the Breakout game. It renders when the provided BreakoutGame instance is valid and its BannerActive flag is true, displaying BannerText and optional BannerSub. It also supplies a BuildHash override based on the game's banner sequence and active state.

@using System
@using Sandbox
@using Sandbox.UI
@namespace Breakout
@inherits Panel

@if ( Game.IsValid() && Game.BannerActive )
{
    <root>
        <div class="banner">
            <div class="banner-title">@Game.BannerText</div>
            @if ( !string.IsNullOrEmpty( Game.BannerSub ) )
            {
                <div class="banner-sub">@Game.BannerSub</div>
            }
        </div>
    </root>
}

@code
{
    /// <summary>
    /// The game whose banner text this overlay shows.
    /// </summary>
    [Parameter] public BreakoutGame Game { get; set; }

    protected override int BuildHash() => System.HashCode.Combine( Game?.BannerSeq, Game?.BannerActive );
}