A UI Razor component that renders a round progress bar showing zombies killed vs total for the current round. It conditionally displays when RoundBarState indicates it should be shown, draws a filled bar using RoundBarState.Percent and shows text "Kills / Total", and optimizes rebuilds by using a custom BuildHash tied to shown state, kills, left, and theme class.
@using Sandbox;
@using Sandbox.UI;
@using NZombies;
@inherits PanelComponent
@*
ROUND BAR — top centre: how many of this round's zombies are dead, of how many. Asked for as *"a completion bar on the top
middle of the screen, that shows how many zombies are left in this round, so how many were killed out of how many this
round"* (2026-09-27). It fills as they die, and is full as the round ends.
⚠️ KILLED OF KILLED-PLUS-LEFT, NOT OF THE WAVE'S SIZE. An ambient Shrieker holds a round open without being counted in its
wave, so the wave alone would read 41 of 40. "Left" is what the round still waits on — still to spawn, and alive — so the
bar is full exactly when the round can end (`RoundManager.RoundKills`, `ZombiesLeft`, both the host's on every screen).
⚠️ THE NUMBERS AND THE RULE FOR SHOWING IT ARE `RoundBarState`'s, where `nz_roundbar` prints the same: shown from round 1,
through the round and the break after it, full then; hidden before the first round, at a game over, and through basalt's
boss fight. `nz_roundbar 0` hides it.
⛔ AND ONLY WITH THE SCOREBOARD — *"make it only visible in the scoreboard — as in it only appears when im holding TAB"*
(2026-09-27). It sits above the board, which starts 90px down. `nz_roundbar 2` shows it without the key, to look at it.
⚠️ ITS OWN PanelComponent, mounted as the boss bar is (`SurvivalHud.OnUpdate`): no scene edit.
*@
<root class="@HudTheme.Class">
@if ( Shown )
{
<div class="round">
<div class="bar">
<div class="fill" style="width: @(RoundBarState.Percent)%"></div>
</div>
<div class="count">@RoundBarState.Kills / @RoundBarState.Total</div>
</div>
}
</root>
@code
{
static bool Shown => RoundBarState.HiddenBecause is null;
/// <summary>⚠️ REBUILDS ON A KILL OR A SPAWN, NOT EVERY FRAME.</summary>
protected override int BuildHash() => System.HashCode.Combine( Shown, RoundBarState.Kills, RoundBarState.Left, HudTheme.Class );
}