Razor panel that draws the post-match report dialog for a career-mode football match. Shows the scoreboard with crests and names, penalty score, a two-column statistics table built from ClubMatchStatistics, and the final lineups, with Russian and English labels switched by GamePreferences.Russian.
@using Sandbox
@using Sandbox.UI
@using Socer
@using System
@using System.Linq
@inherits Panel
<root class="match-report-overlay localized-text">
<button class="match-report-scrim" onclick=@(()=>OnClose?.Invoke())></button>
<div class="match-report-dialog">
<div class="match-report-top"><label>@T($"Сезон {Report.Season} · {UiRussian.Translate(Report.Competition)} · Раунд {Report.Round}",$"Season {Report.Season} · {Report.Competition} · Round {Report.Round}")</label><button class="match-report-close" onclick=@(()=>OnClose?.Invoke())>✕</button></div>
<div class="match-report-scoreboard"><div><img src="@Report.HomeCrest"/><label>@Report.HomeName</label></div><div class="match-report-final"><label class="match-report-goals">@($"{Report.HomeGoals} : {Report.AwayGoals}")</label><label>@T("Матч завершён","Full time")</label>@if(Report.Penalties){<label>@T($"Пенальти {Report.HomePenalties}:{Report.AwayPenalties}",$"Penalties {Report.HomePenalties}:{Report.AwayPenalties}")</label>}</div><div><img src="@Report.AwayCrest"/><label>@Report.AwayName</label></div></div>
<div class="match-report-scroll">
@if(Report.Statistics==null){<label class="match-report-empty">@T("Статистика этой старой встречи не была сохранена.","Statistics were not recorded for this old match.")</label>}
else
{
var s=Report.Statistics;
<div class="match-report-stats">
@foreach(var row in Rows(s)){<div class="match-report-stat"><label class="match-report-value">@row.Home</label><label>@row.Name</label><label class="match-report-value">@row.Away</label></div>}
</div>
}
@if(Report.HomePlayers.Count>0 || Report.AwayPlayers.Count>0)
{
<label class="match-report-heading">@T("Составы на финальный свисток","Lineups at the final whistle")</label><div class="match-report-lineups">@foreach(var side in new[]{Report.HomePlayers,Report.AwayPlayers}){<div>@foreach(var p in side){<div class="match-report-player"><b>@p.Number</b><label>@p.Name</label><span>@p.Overall</span></div>}</div>}</div>
}
</div>
</div>
</root>
@code {
[Parameter] public ArchivedClubMatch Report {get;set;}
[Parameter] public Action OnClose {get;set;}
static string T(string ru,string en)=>GamePreferences.Russian?ru:en;
static string N(int[] values,int side)=>values?.Length>side?values[side].ToString():"—";
static string Rate(int[] completed,int[] attempts,int side)=>attempts?.Length>side && completed?.Length>side
?$"{completed[side]}/{attempts[side]}":"—";
static (string Name,string Home,string Away)[] Rows(ClubMatchStatistics s)
{
float total=s.Possession?.Sum()??0;
string Poss(int side)=>total>0 && s.Possession.Length>side?$"{s.Possession[side]*100/total:0}%":"—";
return new[]{
(T("Владение","Possession"),Poss(0),Poss(1)),
(T("Удары","Shots"),N(s.Shots,0),N(s.Shots,1)),(T("В створ","On target"),N(s.OnTarget,0),N(s.OnTarget,1)),
(T("Мимо / выше","Wide / over"),$"{N(s.ShotsWide,0)}/{N(s.ShotsOver,0)}",$"{N(s.ShotsWide,1)}/{N(s.ShotsOver,1)}"),
(T("Сейвы","Saves"),N(s.Saves,0),N(s.Saves,1)),
(T("Точные передачи","Completed passes"),Rate(s.Completed,s.Passes,0),Rate(s.Completed,s.Passes,1)),
(T("Потери","Possession losses"),N(s.Losses,0),N(s.Losses,1)),(T("Отборы","Tackles"),N(s.Tackles,0),N(s.Tackles,1)),
(T("Обводки","Successful dribbles"),Rate(s.DribblesWon,s.DribbleAttempts,0),Rate(s.DribblesWon,s.DribbleAttempts,1)),
(T("Угловые","Corners"),N(s.Corners,0),N(s.Corners,1)),(T("Фолы","Fouls"),N(s.Fouls,0),N(s.Fouls,1)),
(T("Жёлтые / красные","Yellow / red"),$"{N(s.Yellow,0)}/{N(s.Red,0)}",$"{N(s.Yellow,1)}/{N(s.Red,1)}"),
(T("Офсайды","Offsides"),N(s.Offsides,0),N(s.Offsides,1)),
(T("Стенки","Wall passes"),N(s.WallPasses,0),N(s.WallPasses,1)),
(T("Комбинации через третьего","Third-player combinations"),N(s.ThirdManPasses,0),N(s.ThirdManPasses,1))};
}
protected override int BuildHash()=>HashCode.Combine(Report?.Key,GamePreferences.Russian);
}