UI/HUD/RoundBanner.razor
@namespace Sandbox.UI
@using System;
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent
<root>
<style>
RoundBanner {
position: absolute;
top: 15%;
left: 0;
right: 0;
align-items: center;
justify-content: center;
pointer-events: none;
z-index: 500;
}
.banner-box {
flex-direction: column;
align-items: center;
padding: 16px 64px;
background: radial-gradient(circle, rgba(14, 16, 22, 0.95) 0%, rgba(10, 11, 15, 0) 100%);
border-top: 1px solid rgba(229, 169, 60, 0.6);
border-bottom: 1px solid rgba(229, 169, 60, 0.6);
}
.banner-title {
font-size: 28px;
font-weight: 900;
color: #ffd57e;
letter-spacing: 6px;
text-transform: uppercase;
text-shadow: 0 0 20px rgba(229, 169, 60, 0.8);
text-align: center;
}
.banner-subtitle {
font-size: 13px;
font-weight: 700;
color: #cbd5e1;
letter-spacing: 3px;
margin-top: 6px;
text-transform: uppercase;
text-align: center;
}
</style>
@if ( _timeSinceBanner < 5.0f )
{
<div class="banner-box">
<span class="banner-title">@_mainTitle</span>
<span class="banner-subtitle">@_subTitle</span>
</div>
}
</root>
@code {
private string _mainTitle = "";
private string _subTitle = "";
private TimeSince _timeSinceBanner = 10f;
protected override void OnEnabled()
{
GameManager.OnPhaseChanged += HandlePhase;
}
protected override void OnDisabled()
{
GameManager.OnPhaseChanged -= HandlePhase;
}
private void HandlePhase( GamePhase phase )
{
if ( phase == GamePhase.RoundIntro )
{
var gm = GameManager.Instance;
int roundNum = (gm != null ? gm.CurrentRoundIndex : 0) + 1;
var round = gm?.CurrentRound;
string configTitle = round?.RoundTitle;
if ( string.IsNullOrWhiteSpace( configTitle ) || (roundNum > 1 && configTitle.Trim().Equals( "Manche 1", StringComparison.OrdinalIgnoreCase )) )
{
_mainTitle = $"ROUND {roundNum}";
}
else
{
_mainTitle = configTitle;
}
_subTitle = round?.EnableSuddenDeath == true ? "SUDDEN DEATH - ARCHERS IN POSITION" : "LET THE BLOOD FLOW";
_timeSinceBanner = 0f;
StateHasChanged();
}
else if ( phase == GamePhase.Victory )
{
_mainTitle = "CONGRATULATIONS";
_subTitle = "ROME IS AT YOUR FEET. EVEN THE EMPEROR FEARS YOU...";
_timeSinceBanner = 0f;
StateHasChanged();
}
else if ( phase == GamePhase.GameOver )
{
_mainTitle = "FALLEN IN THE DUST";
_subTitle = "THE EMPEROR HAS DECIDED HE HAS HAD ENOUGH OF YOU.";
_timeSinceBanner = 0f;
StateHasChanged();
}
}
protected override int BuildHash() => HashCode.Combine( _timeSinceBanner < 5.0f, _mainTitle );
}