-
Notifications
You must be signed in to change notification settings - Fork 292
[ADD]Софт-крит и обновленный энд-раунд #3364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
59ecf2a
6b61f37
fcf337e
1e5e581
ccfdc5b
27c71cf
88f78f7
c33bc0a
da3ea78
4a0922f
8652ab8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -8,21 +8,28 @@ | |||||||||||||||||||
| using static Robust.Client.UserInterface.Controls.BoxContainer; | ||||||||||||||||||||
| // Goob Station - End of Round Screen | ||||||||||||||||||||
| using Content.Client.Stylesheets; | ||||||||||||||||||||
| using Content.Shared.ADT.RoundEnd; // ADT-Tweak | ||||||||||||||||||||
| using Content.Shared.Mobs; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| namespace Content.Client.RoundEnd | ||||||||||||||||||||
| { | ||||||||||||||||||||
| public sealed class RoundEndSummaryWindow : DefaultWindow | ||||||||||||||||||||
| { | ||||||||||||||||||||
| private readonly IEntityManager _entityManager; | ||||||||||||||||||||
| public int RoundId; | ||||||||||||||||||||
| private readonly IEntityManager _entityManager; | ||||||||||||||||||||
| private readonly List<RoundEndStatEntry> _roundReport; | ||||||||||||||||||||
| private readonly Dictionary<string, int> _speciesCensus; | ||||||||||||||||||||
|
Comment on lines
+18
to
+20
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Добавьте маркеры ADT вокруг изменений конструктора. Оберните новые поля, параметры, размер окна и новые вкладки в As per path instructions: «Все изменения вне папок /ADT/ должны быть прокомментированы». Also applies to: 24-32, 46-47 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||
| public int RoundId; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, int roundId, | ||||||||||||||||||||
| RoundEndMessageEvent.RoundEndPlayerInfo[] info, IEntityManager entityManager) | ||||||||||||||||||||
| RoundEndMessageEvent.RoundEndPlayerInfo[] info, IEntityManager entityManager, | ||||||||||||||||||||
| List<RoundEndStatEntry>? roundReport = null, | ||||||||||||||||||||
| Dictionary<string, int>? speciesCensus = null) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| _entityManager = entityManager; | ||||||||||||||||||||
| _roundReport = roundReport ?? new List<RoundEndStatEntry>(); | ||||||||||||||||||||
| _speciesCensus = speciesCensus ?? new Dictionary<string, int>(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| MinSize = SetSize = new Vector2(520, 580); | ||||||||||||||||||||
| MinSize = SetSize = new Vector2(560, 620); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Title = Loc.GetString("round-end-summary-window-title"); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -36,6 +43,8 @@ public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, | |||||||||||||||||||
| var roundEndTabs = new TabContainer(); | ||||||||||||||||||||
| roundEndTabs.AddChild(MakeRoundEndSummaryTab(gm, roundEnd, roundTimeSpan, roundId)); | ||||||||||||||||||||
| roundEndTabs.AddChild(MakePlayerManifestTab(info)); | ||||||||||||||||||||
| roundEndTabs.AddChild(MakeCrewTableTab(info)); // ADT-Tweak | ||||||||||||||||||||
| roundEndTabs.AddChild(MakeStatsTab(gm, roundTimeSpan, roundId)); // ADT-Tweak | ||||||||||||||||||||
|
|
||||||||||||||||||||
| ContentsContainer.AddChild(roundEndTabs); | ||||||||||||||||||||
|
|
||||||||||||||||||||
|
|
@@ -92,7 +101,7 @@ private BoxContainer MakeRoundEndSummaryTab(string gamemode, string roundEnd, Ti | |||||||||||||||||||
| return roundEndSummaryTab; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| //ADT-tweak-start | ||||||||||||||||||||
| // ADT-Tweak-start | ||||||||||||||||||||
| //всё в этом регионе сильно модифицировано | ||||||||||||||||||||
| [Obsolete("This is only used for the end of round summary, and is not intended to be used for anything else. It will be removed once we have a better way to track this information.")] | ||||||||||||||||||||
| private BoxContainer MakePlayerManifestTab(RoundEndMessageEvent.RoundEndPlayerInfo[] playersInfo) | ||||||||||||||||||||
|
|
@@ -328,11 +337,248 @@ private BoxContainer MakePlayerManifestTab(RoundEndMessageEvent.RoundEndPlayerIn | |||||||||||||||||||
| playerInfoContainer.AddChild(panel); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| playerInfoContainerScrollbox.AddChild(playerInfoContainer); | ||||||||||||||||||||
| playerManifestTab.AddChild(playerInfoContainerScrollbox); | ||||||||||||||||||||
| playerInfoContainerScrollbox.AddChild(playerInfoContainer); | ||||||||||||||||||||
| playerManifestTab.AddChild(playerInfoContainerScrollbox); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return playerManifestTab; | ||||||||||||||||||||
| return playerManifestTab; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // ADT-Tweak-start | ||||||||||||||||||||
| private BoxContainer MakeStatsTab(string gamemode, TimeSpan roundDuration, int roundId) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var statsTab = new BoxContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Orientation = LayoutOrientation.Vertical, | ||||||||||||||||||||
| Name = Loc.GetString("round-end-report-tab-title") | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var scroll = new ScrollContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| VerticalExpand = true, | ||||||||||||||||||||
| Margin = new Thickness(10) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var container = new BoxContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Orientation = LayoutOrientation.Vertical, | ||||||||||||||||||||
| SeparationOverride = 2 | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddReportLine(container, Loc.GetString("round-end-report-round-id", ("roundId", roundId))); | ||||||||||||||||||||
| AddReportLine(container, Loc.GetString("round-end-report-gamemode", ("gamemode", gamemode))); | ||||||||||||||||||||
| AddReportLine(container, Loc.GetString("round-end-report-duration", | ||||||||||||||||||||
| ("hours", roundDuration.Hours), | ||||||||||||||||||||
| ("minutes", roundDuration.Minutes), | ||||||||||||||||||||
| ("seconds", roundDuration.Seconds))); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddReportCategory(container, RoundEndStatCategory.Summary, "round-end-report-category-summary"); | ||||||||||||||||||||
| AddReportCategory(container, RoundEndStatCategory.FirstDeath, "round-end-report-category-first-death"); | ||||||||||||||||||||
| AddReportCategory(container, RoundEndStatCategory.Economy, "round-end-report-category-economy"); | ||||||||||||||||||||
| AddReportCategory(container, RoundEndStatCategory.Misc, "round-end-report-category-misc"); | ||||||||||||||||||||
| AddSpeciesCensus(container); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| scroll.AddChild(container); | ||||||||||||||||||||
| statsTab.AddChild(scroll); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return statsTab; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private void AddReportCategory(BoxContainer container, RoundEndStatCategory category, string headerLocId) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var entries = _roundReport | ||||||||||||||||||||
| .Where(e => e.Category == category) | ||||||||||||||||||||
| .OrderBy(e => e.Order) | ||||||||||||||||||||
| .ToArray(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| if (entries.Length == 0) | ||||||||||||||||||||
| return; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddCategoryHeader(container, headerLocId); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| foreach (var entry in entries) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| AddReportLine(container, FormatReportEntry(entry), 8); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private void AddReportLine(BoxContainer container, string markup, int indent = 0) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var label = new RichTextLabel { Margin = new Thickness(indent, 0, 0, 0) }; | ||||||||||||||||||||
| label.SetMarkup(markup); | ||||||||||||||||||||
| container.AddChild(label); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private void AddCategoryHeader(BoxContainer container, string headerLocId) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var label = new Label | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Text = Loc.GetString(headerLocId), | ||||||||||||||||||||
| StyleClasses = { StyleNano.StyleClassLabelHeading }, | ||||||||||||||||||||
| Margin = new Thickness(0, 8, 0, 2) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| container.AddChild(label); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||
| /// Resolves a report line, translating any locale-id arguments client-side. | ||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||
| private static string FormatReportEntry(RoundEndStatEntry entry) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var args = new List<(string, object)>(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| foreach (var (key, value) in entry.Args) | ||||||||||||||||||||
| args.Add((key, value)); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| foreach (var (key, locId) in entry.LocArgs) | ||||||||||||||||||||
| args.Add((key, Loc.GetString(locId))); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return Loc.GetString(entry.LocId, args.ToArray()); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| private void AddSpeciesCensus(BoxContainer container) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| if (_speciesCensus.Count == 0) | ||||||||||||||||||||
| return; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddCategoryHeader(container, "round-end-report-category-census"); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddReportLine(container, Loc.GetString("round-end-report-species-header", | ||||||||||||||||||||
| ("count", _speciesCensus.Count)), 8); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| foreach (var (species, count) in _speciesCensus.OrderByDescending(p => p.Value)) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var name = Loc.TryGetString($"species-name-{species.ToLowerInvariant()}", out var localized) | ||||||||||||||||||||
| ? localized | ||||||||||||||||||||
| : species; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddReportLine(container, Loc.GetString("round-end-report-species-line", | ||||||||||||||||||||
| ("species", name), ("count", count)), 16); | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
| //ADT-tweak-end | ||||||||||||||||||||
| // ADT-Tweak-end | ||||||||||||||||||||
|
|
||||||||||||||||||||
| // ADT-Tweak-start | ||||||||||||||||||||
| private BoxContainer MakeCrewTableTab(RoundEndMessageEvent.RoundEndPlayerInfo[] playersInfo) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var crewTab = new BoxContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Orientation = LayoutOrientation.Vertical, | ||||||||||||||||||||
| Name = Loc.GetString("round-end-summary-window-crew-tab-title") | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var scroll = new ScrollContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| VerticalExpand = true, | ||||||||||||||||||||
| Margin = new Thickness(10) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var container = new BoxContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Orientation = LayoutOrientation.Vertical | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var crew = playersInfo.Where(p => !p.Observer).ToArray(); | ||||||||||||||||||||
| var observers = playersInfo.Where(p => p.Observer).ToArray(); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var alive = crew.Count(p => p.EntMobState != MobState.Dead && p.EntMobState != MobState.Invalid); | ||||||||||||||||||||
| var dead = crew.Count(p => p.EntMobState == MobState.Dead); | ||||||||||||||||||||
| var escaped = crew.Count(p => p.Escaped && p.EntMobState != MobState.Dead); | ||||||||||||||||||||
|
Comment on lines
+483
to
+485
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Не учитывайте эвакуировавшихся в двух категориях.
Возможное исправление- var alive = crew.Count(p => p.EntMobState != MobState.Dead && p.EntMobState != MobState.Invalid);
+ var alive = crew.Count(p =>
+ !p.Escaped &&
+ p.EntMobState != MobState.Dead &&
+ p.EntMobState != MobState.Invalid);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
|
|
||||||||||||||||||||
| var summaryLabel = new RichTextLabel { Margin = new Thickness(0, 0, 0, 8) }; | ||||||||||||||||||||
| summaryLabel.SetMarkup(Loc.GetString("round-end-summary-window-crew-summary", | ||||||||||||||||||||
| ("alive", alive), ("dead", dead), ("escaped", escaped), ("total", crew.Length))); | ||||||||||||||||||||
| container.AddChild(summaryLabel); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var grid = new GridContainer | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Columns = 3, | ||||||||||||||||||||
| HorizontalExpand = true | ||||||||||||||||||||
| }; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| void AddHeader(string text) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var label = new Label | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Text = text, | ||||||||||||||||||||
| StyleClasses = { StyleNano.StyleClassLabelHeading }, | ||||||||||||||||||||
| Margin = new Thickness(4, 2) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| grid.AddChild(label); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| AddHeader(Loc.GetString("round-end-summary-window-crew-name-header")); | ||||||||||||||||||||
| AddHeader(Loc.GetString("round-end-summary-window-crew-role-header")); | ||||||||||||||||||||
| AddHeader(Loc.GetString("round-end-summary-window-crew-status-header")); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var sorted = crew | ||||||||||||||||||||
| .OrderBy(p => p.EntMobState == MobState.Dead) | ||||||||||||||||||||
| .ThenBy(p => p.PlayerICName ?? p.PlayerOOCName) | ||||||||||||||||||||
| .Concat(observers.OrderBy(p => p.PlayerICName ?? p.PlayerOOCName)); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| foreach (var player in sorted) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| var name = player.PlayerICName ?? player.PlayerOOCName; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var nameLabel = new Label | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Text = player.Antag ? $"{name} [?]" : name, | ||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Перенесите маркер антагониста в локализацию. Строка As per path instructions: «твёрдо вписанный текст в переменных должен быть в ftl файлах, а в .cs использовать Loc.GetString». 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||
| FontColorOverride = player.Antag ? Color.Red : (player.Observer ? Color.Gray : Color.White), | ||||||||||||||||||||
| Margin = new Thickness(4, 1) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| grid.AddChild(nameLabel); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var roleLabel = new Label | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Text = Loc.GetString(player.Role), | ||||||||||||||||||||
| FontColorOverride = player.Observer ? Color.Gray : Color.LightGray, | ||||||||||||||||||||
| Margin = new Thickness(4, 1) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| grid.AddChild(roleLabel); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| string status; | ||||||||||||||||||||
| Color statusColor; | ||||||||||||||||||||
| if (player.Observer) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| status = Loc.GetString("round-end-summary-window-crew-status-observer"); | ||||||||||||||||||||
| statusColor = Color.Gray; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| else if (player.EntMobState == MobState.Dead) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| status = Loc.GetString("round-end-summary-window-crew-status-dead"); | ||||||||||||||||||||
| statusColor = Color.Red; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| else if (player.EntMobState == MobState.Invalid) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| status = Loc.GetString("round-end-summary-window-crew-status-nobody"); | ||||||||||||||||||||
| statusColor = Color.Gray; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| else if (player.Escaped) | ||||||||||||||||||||
| { | ||||||||||||||||||||
| status = Loc.GetString("round-end-summary-window-crew-status-escaped"); | ||||||||||||||||||||
| statusColor = Color.Green; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| else | ||||||||||||||||||||
| { | ||||||||||||||||||||
| status = Loc.GetString("round-end-summary-window-crew-status-alive"); | ||||||||||||||||||||
| statusColor = Color.Yellow; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| var statusLabel = new Label | ||||||||||||||||||||
| { | ||||||||||||||||||||
| Text = status, | ||||||||||||||||||||
| FontColorOverride = statusColor, | ||||||||||||||||||||
| Margin = new Thickness(4, 1) | ||||||||||||||||||||
| }; | ||||||||||||||||||||
| grid.AddChild(statusLabel); | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| container.AddChild(grid); | ||||||||||||||||||||
| scroll.AddChild(container); | ||||||||||||||||||||
| crewTab.AddChild(scroll); | ||||||||||||||||||||
|
|
||||||||||||||||||||
| return crewTab; | ||||||||||||||||||||
| } | ||||||||||||||||||||
| // ADT-Tweak-end | ||||||||||||||||||||
| } | ||||||||||||||||||||
| // ADT-Tweak-end | ||||||||||||||||||||
| } | ||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Оберните изменение маркером ADT-Tweak.
Вызов конструктора
RoundEndSummaryWindowполучил новые аргументыmessage.RoundReport, message.SpeciesCensus. Файл находится вне каталога /ADT/. Оберните добавленные аргументы в// ADT-Tweak-Start/// ADT-Tweak-End.✏️ Предложенное исправление
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Path instructions