F4: protocollo e client per manutenzione e impieghi, ADR 0010, stato dei lavori
- Protocollo: riepilogo di manutenzione nei record (blocco 1), RequestDetail, MaintenanceCard, WorkshopRegister, EmploymentReport con depositi, motivi e convenzioni, MaintenanceAlert. - Server: dettagli su richiesta, avvisi dalla manutenzione, registro dopo le convenzioni. - Client: pannelli Officine (cartella di manutenzione, Registro officina, scorta di ricambi, avvisi, mappa di calore) e Impieghi (Registro degli impieghi con convenzioni); schede di treno, industria e città aggiornate; pilota automatico con le nuove schermate. - ADR 0010, PROTOCOL, ARCHITECTURE e STATE aggiornati; 102 test verdi. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
28 files changed
+1618
-64
No files matched your search
@@ -17,6 +17,8 @@ public partial class InfoPanel : VBoxContainer
|
||||
private int _id = -1;
|
||||
private double _refresh;
|
||||
|
||||
public event Action<int>? MaintenanceRequested;
|
||||
|
||||
public InfoPanel(GameSession session)
|
||||
{
|
||||
_session = session;
|
||||
@@ -75,6 +77,17 @@ public partial class InfoPanel : VBoxContainer
|
||||
stats.AddChild(PanelKit.Stat(T("Condizione"), PanelKit.Value($"{condition:0}%")));
|
||||
stats.AddChild(PanelKit.Stat(T("Veicoli"), PanelKit.Value($"{t.Vehicles.Length}")));
|
||||
AddChild(stats);
|
||||
AddChild(PanelKit.Pair(T("Manutenzione"), PanelKit.Value(MaintenancePanel.StatusName(t.Maintenance) +
|
||||
(t.Reserve ? " · " + T("riserva") : ""))));
|
||||
if (t.NextIntervention.Length > 0)
|
||||
{
|
||||
string next = w.Data.Maintenance.Interventions.FirstOrDefault(i => i.Id == t.NextIntervention)?.NameIt ?? t.NextIntervention;
|
||||
AddChild(PanelKit.Pair(T("Prossimo intervento"), PanelKit.Value(t.NextDueDays <= 0 ? $"{next} · {T("scaduto")}" : $"{next} · {T("tra")} {t.NextDueDays} {T("giorni")}")));
|
||||
}
|
||||
int trainId = t.Id;
|
||||
var cardButton = new Button { Text = T("Cartella di manutenzione") };
|
||||
cardButton.Pressed += () => MaintenanceRequested?.Invoke(trainId);
|
||||
AddChild(cardButton);
|
||||
AddChild(PanelKit.Pair(T("Carico"), PanelKit.Value($"{t.Load} / {t.Capacity}")));
|
||||
var bar = new ProgressBar { MaxValue = Math.Max(1, t.Capacity), Value = t.Load, ShowPercentage = false, CustomMinimumSize = new Vector2(0, 10) };
|
||||
bar.AddThemeStyleboxOverride("fill", UiTheme.Box(Palette.Amber, Palette.Amber, 4, 0));
|
||||
@@ -128,6 +141,26 @@ public partial class InfoPanel : VBoxContainer
|
||||
AddChild(PanelKit.Pair(T("Produce"), PanelKit.Value(outputs)));
|
||||
}
|
||||
if (ind.Closed) AddChild(UiTheme.Notice(T("Chiusa")));
|
||||
// dal Registro degli impieghi: presenze, posti scoperti e provenienza dei pendolari
|
||||
if (w.Employment?.Rows.FirstOrDefault(r => r.Kind == 0 && r.Industry == ind.Id) is { } row)
|
||||
{
|
||||
AddChild(UiTheme.Text(T("Lavoratori e personale"), 14, bold: true));
|
||||
AddChild(PanelKit.Pair(T("Lavoratori"), PanelKit.Value($"{row.WorkersPresent:0} / {row.JobsWorkers}")));
|
||||
AddChild(PanelKit.Pair(T("Personale"), PanelKit.Value($"{row.StaffPresent:0} / {row.JobsStaff}")));
|
||||
foreach (string reason in new[] { EmploymentPanel.ReasonText(w, row.WorkersReason, row.WorkersReasonLine, false), EmploymentPanel.ReasonText(w, row.StaffReason, row.StaffReasonLine, true) })
|
||||
{
|
||||
if (reason.Length == 0) continue;
|
||||
var l = UiTheme.Text("⚠ " + reason, 13, Palette.Amber);
|
||||
l.AutowrapMode = TextServer.AutowrapMode.WordSmart;
|
||||
AddChild(l);
|
||||
}
|
||||
foreach (var src in row.Sources.OrderByDescending(x => x.Headcount).Take(6))
|
||||
{
|
||||
string town = w.Towns.TryGetValue(src.Town, out var tw) ? tw.Name : "?";
|
||||
string via = src.Line >= 0 && w.Lines.TryGetValue(src.Line, out var ln) ? ln.Name : T("a piedi");
|
||||
AddChild(UiTheme.Text($"• {src.Headcount} {T("da")} {town} · {via}", 13, src.Category == 1 ? Palette.Staff : Palette.Workers));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Kind.Town when w.Towns.TryGetValue(_id, out var town):
|
||||
@@ -136,6 +169,19 @@ public partial class InfoPanel : VBoxContainer
|
||||
AddChild(PanelKit.Pair(T("Abitanti"), PanelKit.Value(Money.GroupThousands((ulong)town.Population))));
|
||||
AddChild(PanelKit.Pair(T("Soddisfazione"), PanelKit.Value($"{town.Satisfaction * 100:0}%")));
|
||||
AddChild(PanelKit.Pair(T("Servizi"), PanelKit.Value($"{town.Services}")));
|
||||
// dove lavorano gli abitanti (posti serviti dai tuoi treni)
|
||||
if (w.Employment is { } report)
|
||||
{
|
||||
var jobs = report.Rows
|
||||
.Select(r => (Row: r, Count: r.Sources.Where(x => x.Town == town.Id).Sum(x => x.Headcount)))
|
||||
.Where(x => x.Count > 0).OrderByDescending(x => x.Count).ToList();
|
||||
if (jobs.Count > 0) AddChild(UiTheme.Text(T("Dove lavorano gli abitanti"), 14, bold: true));
|
||||
foreach (var (r, count) in jobs.Take(8))
|
||||
{
|
||||
string where = r.Kind == 1 ? (w.Depots.TryGetValue(r.Industry, out var d) ? d.Name : "?") : (w.Industries.TryGetValue(r.Industry, out var i2) ? i2.Name : "?");
|
||||
AddChild(UiTheme.Text($"• {count} · {where}", 13));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in new issue
Block a user