A UI panel that renders the quick match broadcast screen: scoreboard with crests, clock and goal counts, a live commentary feed, match stats and post-match reward or retry controls. Reads state from the MatchController and calls into it for retrying career round results and opening the match report.
@using Sandbox
@using Sandbox.UI
@using Socer
@using System
@using System.Linq
@inherits Panel
<root class="@(Game.QuickMatchRunning?"on-air":"full-time")">
<div class="broadcast-topline"><label>SOCER / LIVE TEXT</label><label>@(Game.IsRulesPreview?"PREVIEW MATCH":Game.QuickBroadcastCompetitive?Game.QuickBroadcastCup?"CUP MATCH":"LEAGUE MATCH":"FRIENDLY MATCH")</label><label>FAST BROADCAST</label></div>
<div class="broadcast-scoreboard">
<div class="broadcast-team home"><img class="broadcast-crest" src="@Socer.ClubIdentity.Crest(Game.Match.HomeName)" /><label>@Game.Match.HomeName</label></div>
<div class="broadcast-centre"><label class="broadcast-clock">@(Game.QuickMatchRunning?$"{Game.Match.ClockLabel}′": "FULL TIME")</label><div class="broadcast-score"><label>@Game.Match.Goals[0]</label><span>:</span><label>@Game.Match.Goals[1]</label></div><div class="broadcast-clock-track"><div style="@($"width:{Math.Clamp(Game.QuickBroadcastMinute*100f/90f,0,100):0}%;")"></div></div><label class="broadcast-half">@(Game.Match.Finished?"MATCH COMPLETE":Game.Match.SecondHalf?"SECOND HALF":"FIRST HALF")</label></div>
<div class="broadcast-team away"><img class="broadcast-crest" src="@Socer.ClubIdentity.Crest(Game.Match.AwayName)" /><label>@Game.Match.AwayName</label></div>
</div>
<div class="broadcast-main">
<div class="broadcast-feed-panel">
<div class="broadcast-section-heading"><div class="broadcast-live-dot"></div><label>LIVE COMMENTARY</label><label>@($"{Game.BroadcastLines.Count} UPDATES")</label></div>
<div class="broadcast-feed">
@foreach(var line in Game.BroadcastLines.Skip(Math.Max(0,Game.BroadcastLines.Count-10)))
{
<div class="broadcast-item kind-@LineClass(line.Kind) @(line==Game.FeaturedBroadcastLine?"featured":"") [email protected]"><label class="broadcast-item-time">@line.Clock</label><div><label class="broadcast-item-kind">@line.Kind</label><label class="broadcast-item-text">@line.Text</label></div></div>
}
</div>
</div>
<div class="broadcast-side">
<div class="broadcast-moment"><label class="eyeline">@((Game.FeaturedBroadcastLine??Game.BroadcastLines.LastOrDefault())?.Kind??"MATCHDAY")</label><label class="broadcast-moment-copy">@((Game.FeaturedBroadcastLine??Game.BroadcastLines.LastOrDefault())?.Text??"Awaiting kick-off")</label><div class="broadcast-moment-rays"></div></div>
<div class="broadcast-numbers"><label class="eyeline">@($"AT A GLANCE · {Game.Match.HomeName} / {Game.Match.AwayName}")</label><div><label>Shots</label><label>@($"{Game.Match.Shots[0]} : {Game.Match.Shots[1]}")</label></div><div><label>On target</label><label>@($"{Game.Match.Goals[0]+Game.Match.Saves[1]} : {Game.Match.Goals[1]+Game.Match.Saves[0]}")</label></div><div><label>Yellow cards</label><label>@($"{Game.Match.YellowCards[0]} : {Game.Match.YellowCards[1]}")</label></div></div>
@if(Game.QuickMatchRunning)
{
<div class="broadcast-status"><div class="broadcast-live-dot"></div><label>The match is playing. Key moments pause the feed.</label></div>
}
else if(Game.Career.Pending!=null && !Game.IsRulesPreview)
{
@if(Game.CareerRoundCalculationFailed)
{
<div class="broadcast-finish broadcast-round-error localized-text"><label>@(GamePreferences.Russian?"Не удалось рассчитать тур":"Could not finish the round")</label><label>@(GamePreferences.Russian?"Счёт вашего матча сохранён в этой сессии. Повторите расчёт остальных встреч, чтобы получить награды.":"Your score is kept in this session. Retry the other matches to collect your rewards.")</label><button class="retry-round-results" disabled="@(!Game.CanRetryCareerRoundResults)" onclick=@(()=>Game.RetryCareerRoundResults())>@(GamePreferences.Russian?"Повторить расчёт":"Retry calculation")</button></div>
}
else
{
<div class="broadcast-status"><div class="broadcast-live-dot"></div><label>@(Socer.GamePreferences.Russian?"Считаем остальные матчи тура…":"Finishing the other matches…")</label></div>
}
}
else
{
<div class="broadcast-finish"><label class="eyeline localized-text">@(Game.FinalCupVictoryMatch?(GamePreferences.Russian?"ВЫ ПОБЕДИЛИ В SOCER":"YOU WIN SOCER"):"FINAL WHISTLE")</label><label class="localized-text">@(Game.FinalCupVictoryMatch?(GamePreferences.Russian?"Кубок чемпионов ваш!":"Champions Cup winners!"):Outcome)</label><label class="broadcast-reward localized-text">@RewardText</label><button onclick=@(()=>Game.OpenBroadcastReport())>Match report & rewards →</button></div>
}
</div>
</div>
</root>
@code {
public MatchController Game {get;set;}
string RewardText
{
get
{
bool ru=Socer.GamePreferences.Russian;
if(Game.IsRulesPreview)return ru?"Тестовый матч · без наград":"Preview · no career rewards";
if(!Game.QuickBroadcastCompetitive)return ru?"Товарищеский матч · без наград":"Friendly match · no career rewards";
var receipt=Game.Settlement?.Match==Game.Match?Game.Settlement:null;
return $"+{receipt?.Coins??0} ◈"+(receipt?.CupTokens>0?$" · +{receipt.CupTokens} "+(ru?"кубков":"cup tokens"):"");
}
}
string Outcome=>Game.Settlement?.Match==Game.Match
?Game.Settlement.Won?"YOUR CLUB WINS":Game.Settlement.Draw?"DRAW":"DEFEAT"
:Game.Match.Goals[0]>Game.Match.Goals[1]?"YOUR CLUB WINS":Game.Match.Goals[0]==Game.Match.Goals[1]?"DRAW":"DEFEAT";
static string LineClass(string kind)=>kind switch{"GOAL"=>"goal","YELLOW CARD"=>"yellow","RED CARD"=>"red","CHANCE"=>"chance","FULL TIME"=>"fulltime",_=>"normal"};
protected override int BuildHash()=>HashCode.Combine(Game?.QuickMatchRunning,Game?.BroadcastLines.Count,Game?.Match.Goals[0],Game?.Match.Goals[1],(int)(Time.Now*10),Game?.CareerRoundCalculationFailed,Game?.CanRetryCareerRoundResults);
}