UI panel for the Media League broadcast overlay in a soccer game. Shows a live coach card with match progress and a forfeit button, then a full time result screen with crests, score, and actions for preview, abandoned or completed matches.
@using Sandbox
@using Sandbox.UI
@using Socer
@using System
@using System.Globalization
@inherits Panel
<root class="media-league-hud localized-text">
@if(Game?.MediaLeagueActive==true)
{
@if(!M.Finished)
{
<div class="media-live-card">
<div class="media-live-heading"><span class="media-live-dot"></span><label>@Text("MEDIA LEAGUE","МЕДИА-ЛИГА")</label><label class="media-live-role">@Text("COACH","ТРЕНЕР")</label></div>
<label class="media-live-copy">@(Game.MediaLeaguePreview?Text("Demo match. Coach the amateurs with pings and orders.","Демонстрационный матч. Управляйте любителями пингами и командами."):Text("Coach the amateurs to full time to cancel the fine.","Доведите любителей до финального свистка — штраф отменится."))</label>
<div class="media-match-progress"><div style="@ProgressStyle"></div></div>
<button class="media-league-forfeit @(Game.MediaLeaguePreview?"media-preview-exit":"")" onclick=@(()=>{if(Game.MediaLeaguePreview)Game.ExitMediaLeaguePreview();else Game.OpenRelegationChoice();})>@(Game.MediaLeaguePreview?Text("End preview","Завершить просмотр"):Text("Withdraw → pay the fine","Отказаться → штраф"))</button>
</div>
}
else
{
<div class="media-result-shade">
<div class="media-result-card">
<label class="media-result-kicker">@(Game.MediaLeaguePreview?Text("MEDIA LEAGUE / DEMO MATCH","МЕДИА-ЛИГА / ДЕМОНСТРАЦИЯ"):M.Abandoned?Text("MEDIA LEAGUE / BROADCAST STOPPED","МЕДИА-ЛИГА / ЭФИР ОСТАНОВЛЕН"):Text("MEDIA LEAGUE / FULL TIME","МЕДИА-ЛИГА / ФИНАЛЬНЫЙ СВИСТОК"))</label>
<label class="media-result-title">@ResultTitle</label>
<div class="media-result-scoreline"><div><img src="@ClubIdentity.Crest(M.HomeName)" /><label>@M.HomeName</label></div><label class="media-result-score">@($"{M.Goals[0]} : {M.Goals[1]}")</label><div><img src="@ClubIdentity.Crest(M.AwayName)" /><label>@M.AwayName</label></div></div>
@if(Game.MediaLeaguePreview)
{
<div class="media-result-resolution"><img src="/ui-icons/ui-line-nav-ball.svg" /><div><label>@Text("Demo match complete","Демонстрация завершена")</label><label>@Text("Your season, cards and club balance are unchanged.","Сезон, карточки и бюджет клуба остаются без изменений.")</label></div></div>
<button class="media-league-complete media-preview-return" onclick=@(()=>Game.ExitMediaLeaguePreview())>@Text("Return to club →","Вернуться в клуб →")</button>
}
else if(M.Abandoned)
{
<div class="media-result-resolution abandoned"><img src="/ui-icons/ui-line-nav-ball.svg" /><div><label>@Text("The broadcast did not count","Эфир не засчитан")</label><label>@Text("One team has too few players to continue. The fine is still pending: replay the full match or choose the fine.","У одной команды осталось слишком мало игроков. Штраф ещё не отменён: сыграйте матч заново или выберите оплату.")</label></div></div>
<label class="media-result-quip">@Text("A replay keeps the same teams and conditions.","Повтор начнётся с теми же командами и условиями.")</label>
<div class="media-abandoned-actions"><button class="media-league-restart" onclick=@(()=>Game.RestartAbandonedMediaMatch())>@Text("Replay the broadcast →","Повторить эфир →")</button><button class="media-abandoned-fine" onclick=@(()=>Game.OpenRelegationChoice())>@Text("Choose the fine","Выбрать штраф")</button></div>
}
else
{
<div class="media-result-resolution"><img src="/ui-icons/ui-line-nav-coins.svg" /><div><label>@Text("The match replaces your fine","Матч вместо штрафа")</label><label>@Text("No coins or player cards will be deducted. The result does not change your league table.","Монеты и карточки не будут списаны. Этот результат не меняет таблицу лиги.")</label></div></div>
<label class="media-result-quip">@Text("The sponsors got their content. You got your club back.","Спонсоры получили контент. Тренер сохранил бюджет.")</label>
<button class="media-league-complete" onclick=@(()=>Game.CompleteMediaLeagueMatch())>@Text("Cancel the fine and return →","Отменить штраф и вернуться →")</button>
}
</div>
</div>
}
}
</root>
@code {
public MatchController Game {get;set;}
MatchSimulation M=>Game.Match;
static string Text(string en,string ru)=>GamePreferences.Russian?ru:en;
string ResultTitle=>M.Abandoned?Text("Match abandoned","Матч сорван"):M.Goals[0]>M.Goals[1]?Text("The crowd loved it","Публика в восторге"):
M.Goals[0]<M.Goals[1]?Text("At least it made good content","Зато контент получился"):Text("A draw worth broadcasting","Ничья тоже идёт в эфир");
string ProgressStyle=>FormattableString.Invariant($"width:{Math.Clamp(M.Minute/90f,0,1)*100:0.0}%;");
protected override int BuildHash()=>Game?.MediaLeagueActive!=true?0:
HashCode.Combine(Game.Revision,M.Finished,M.Abandoned,M.Minute,M.Goals[0],M.Goals[1],GamePreferences.Revision,Game.MediaLeaguePreview);
}