F6: scheda industria e schermata di connessione definitive
La scheda dell'industria e la schermata di connessione si allineano alle
immagini di riferimento 07 e 09. I dati che mancavano li calcola il Core
con una funzione pura, e viaggiano in blocchi compatibili del protocollo.
Il formato dei salvataggi non cambia (ADR 0021).
- IndustryOutlook calcola la scheda in sola lettura:
- fattori dell'efficienza e quello che la limita;
- ingressi e uscite al mese, con giorni di scorta o di magazzino;
- fornitori e clienti con prezzo, distanza e linea che li collega;
- forza lavoro dai contratti dei pendolari;
- punteggio di crescita del trimestre con le soglie;
- prezzo medio, utile annuo, stazioni che la servono, sblocco
dell'acquisto.
IndustryMath.GrowthScore è ora l'unica formula del punteggio e la usa
anche IndustrySystem: gli hash non cambiano. Nuovi parametri in
balance.json, industry.outlook.
- Protocollo:
- IndustryCard: blocco 1 IndustrySheetInfo;
- Welcome: blocco 1 ServerInfo (versione, sistema, Docker, tempo di
attività, passo del ciclo, client collegati);
- ClientWorld conserva lo stato del server e l'elenco dei salvataggi.
- Client:
- IndustryPanel a tutto schermo, con tre schede, il grafo della
catena, impianti e crescita, e i comandi del proprietario;
- ConnectScreen sostituisce MenuScreen: server locale o in rete,
stato del server, partite salvate, «Connetti e riprendi» e «Nuova
partita sul server» su una sessione di prova;
- testi in strings.csv;
- pilota automatico: schermate 19_scheda_industria e 20_connessione.
- Test:
- IndustryOutlookTests;
- scheda e stato del server via WebSocket;
- campioni del protocollo con i blocchi nuovi.
200 test, 181 senza i lenti.
Refs #42.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7eec322202
commit
45462bf9ec
28 files changed
+2810
-329
No files matched your search
@@ -198,6 +198,21 @@ public sealed class GameHost : IDisposable
|
||||
Summary = Projection.Summary(_world, _world.Companies[s.Company.Value], _speed),
|
||||
DataHash = _data.Hash,
|
||||
Difficulty = _world.Difficulty.Id,
|
||||
Server = ServerStatus(),
|
||||
};
|
||||
|
||||
/// <summary>Stato del server per la schermata di connessione (blocco 1 del Welcome, ADR 0021).</summary>
|
||||
private ServerInfo ServerStatus() => new()
|
||||
{
|
||||
Version = GameVersion,
|
||||
Os = System.Runtime.InteropServices.RuntimeInformation.OSDescription,
|
||||
// le immagini .NET ufficiali impostano DOTNET_RUNNING_IN_CONTAINER
|
||||
Container = string.Equals(Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER"), "true", StringComparison.OrdinalIgnoreCase),
|
||||
UptimeSeconds = NowMs / 1000,
|
||||
TickMs = _config.TickMs,
|
||||
Sessions = _sessions.Values.Count(x => x.Connected),
|
||||
MaxSessions = _config.MaxSessions,
|
||||
Local = _config.Local,
|
||||
};
|
||||
|
||||
private void Handle(Session s, IMessage message)
|
||||
@@ -653,7 +668,7 @@ public sealed class GameHost : IDisposable
|
||||
break;
|
||||
case DetailKind.Industry:
|
||||
if (m.Target >= 0 && m.Target < w.Industries.Count && !w.Industries[m.Target].Closed)
|
||||
s.Send(Projection.IndustryCard(w, w.Industries[m.Target]));
|
||||
s.Send(Projection.IndustryCard(w, w.Industries[m.Target], s.Company));
|
||||
break;
|
||||
case DetailKind.Chronicle:
|
||||
s.Send(Projection.Chronicle(w));
|
||||
|
||||
@@ -485,8 +485,8 @@ public static class Projection
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Scheda del proprietario di un'industria (sezione 11).</summary>
|
||||
public static IndustryCard IndustryCard(World w, Industry ind)
|
||||
/// <summary>Scheda del proprietario di un'industria (sezione 11) con la scheda dell'immagine 07 per la compagnia (blocco 1, ADR 0021).</summary>
|
||||
public static IndustryCard IndustryCard(World w, Industry ind, CompanyId company)
|
||||
{
|
||||
var m = w.Data.Balance.IndustryMaintenance;
|
||||
var budget = m.For(ind.Budget);
|
||||
@@ -502,6 +502,45 @@ public static class Projection
|
||||
PartsOrdered = ind.PartsOrdered, MachineryRequired = IndustryMath.MachineryRequired(ind, m), UpgradeCost = IndustryMaintenanceSystem.UpgradeCost(ind),
|
||||
Valuation = IndustryMath.Valuation(w, ind), Cash = ind.Cash, BreakdownChancePerYear = (float)perYear,
|
||||
Stops = ind.StopHistory.Select(h => new IndustryStopInfo { Day = h.Day, Days = h.Days, Kind = (byte)h.Kind }).ToList(),
|
||||
Sheet = IndustrySheet(IndustryOutlook.Build(w, ind, company)),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Scheda dell'industria dell'immagine 07 (IndustryOutlook, ADR 0021).</summary>
|
||||
public static IndustrySheetInfo IndustrySheet(IndustryOutlookReport r)
|
||||
{
|
||||
static IndustryFlowInfo Flow(IndustryFlow f) => new()
|
||||
{
|
||||
Good = f.Good, FullMonth = (float)f.FullMonth, CurrentMonth = (float)f.CurrentMonth, Stock = f.Stock, Storage = f.Storage, Days = (float)f.Days,
|
||||
Limiting = f.Limiting,
|
||||
Partners = f.Partners.Select(p => new ChainPartnerInfo
|
||||
{
|
||||
Kind = (byte)p.Kind, Target = p.Target, MonthlyUnits = (float)p.MonthlyUnits, Price = p.Price, Line = p.Line.Value, DistanceKm = (float)p.DistanceKm,
|
||||
}).ToList(),
|
||||
};
|
||||
static WorkforceInfo Work(WorkforceOutlook o) => new()
|
||||
{
|
||||
Jobs = o.Jobs, Present = (float)o.Present, OnSite = (float)o.OnSite, Coverage = (float)o.Coverage, Missing = o.Missing, Reason = (byte)o.Reason,
|
||||
ReasonLine = o.ReasonLine.Value, AverageMinutes = (float)o.AverageMinutes, SourceCount = o.SourceCount,
|
||||
Sources = o.Sources.Select(x => new WorkforceSourceInfo
|
||||
{
|
||||
Town = x.Town.Value, Headcount = x.Headcount, Coverage = (float)x.Coverage, Line = x.Line.Value, Carrier = x.Carrier.Value, Minutes = (float)x.Minutes, Walking = x.Walking,
|
||||
}).ToList(),
|
||||
};
|
||||
var g = r.Growth;
|
||||
return new IndustrySheetInfo
|
||||
{
|
||||
Level = (byte)Math.Clamp(r.Level, 0, 255), MaxLevel = (byte)Math.Clamp(r.MaxLevel, 0, 255), Efficiency = (float)r.Efficiency, Limit = (byte)r.Limit,
|
||||
CovInput = (float)r.CovInput, CovWorkers = (float)r.CovWorkers, CovStaff = (float)r.CovStaff, CoverageWindowDays = r.CoverageWindowDays,
|
||||
ProfitFactor = (float)r.ProfitFactor, Depletion = (float)r.Depletion, EventCapacity = (float)r.EventCapacity, ReserveFraction = (float)r.ReserveFraction,
|
||||
StorageDays = r.StorageDays, Inputs = r.Inputs.Select(Flow).ToList(), Outputs = r.Outputs.Select(Flow).ToList(),
|
||||
Workers = Work(r.Workers), Staff = Work(r.Staff), AveragePrice = r.AveragePrice, AnnualProfit = r.AnnualProfit,
|
||||
LastScore = (float)g.LastScore, Shipped = (float)g.Current.Shipped, Coverage = (float)g.Current.Coverage, Profit = (float)g.Current.Profit,
|
||||
Score = (float)g.Current.Score, UpgradeThreshold = (float)g.UpgradeThreshold, DowngradeThreshold = (float)g.DowngradeThreshold,
|
||||
UpgradeQuarters = (byte)Math.Clamp(g.UpgradeQuarters, 0, 255), QuartersAbove = (byte)Math.Clamp(g.QuartersAbove, 0, 255),
|
||||
QuarterDay = g.QuarterDay, QuarterDays = g.QuarterDays, Served = g.Served,
|
||||
ServingStations = r.ServingStations.Select(s => s.Value).ToList(), ServingLine = r.ServingLine.Value,
|
||||
ForSale = r.ForSale, BuyUnlocked = r.BuyUnlocked, BuyTier = (byte)Math.Clamp(r.BuyTier, 0, 255), BuyProgress = (float)r.BuyProgress,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user