F6: livelli e sblocchi visibili, pannello La tua scalata
I livelli esistevano dalla F5 ma il giocatore li vedeva solo come distintivo e come rifiuti con nomi scritti a mano. Ora il motore espone un quadro della scalata e il client lo mostra come l'immagine di riferimento 08. - ClimbOutlook (Core, sola lettura): livelli con gli sblocchi letti dai dati, giorno in cui sono stati raggiunti, requisiti del prossimo livello con valore, soglia, frazione e avanzamento (media delle tre frazioni, ora anche nel Mercato globale), stato patrimoniale, conto economico, prestiti, storico del patrimonio dalla Cronaca. - Stato patrimoniale con una sola fonte: FinanceSystem.BookValues scompone il valore contabile per voce e AssetBookValue ne e' la somma, cosi' il pannello somma al centesimo al patrimonio netto del motore. Le industrie possedute entrano nel patrimonio (impianti piu' cassa, senza avviamento): prima comprarle bruciava patrimonio. - Notizia di promozione con gli sblocchi ottenuti; rifiuti dei comandi bloccati con il livello che serve e il suo nome dai dati (compravendita, industrie, quotazione, scalate, concessioni, fido). - Salvataggio versione 6 (BalanceSheetSerializer) con voci e giorni dei livelli nell'hash; le versioni 1-5 si migrano con lo stesso patrimonio. - Protocollo: DetailKind.Climb (8) e ClimbReport (134), su richiesta. - Client: pannello ClimbPanel a tutto schermo, pulsante Scalata, livello e avanzamento nella barra superiore, schermata nel pilota automatico. - Test: Economy/ClimbTests.cs e quadro via WebSocket (170 test verdi). Decisioni in docs/adr/0018-scalata-e-livelli.md. Refs #38. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a61bf1dc27
commit
d473e21708
37 files changed
+2060
-70
No files matched your search
@@ -661,6 +661,9 @@ public sealed class GameHost : IDisposable
|
||||
case DetailKind.Market:
|
||||
s.Send(Projection.Market(w, s.Company));
|
||||
break;
|
||||
case DetailKind.Climb:
|
||||
if (s.Company.IsValid && s.Company.Value < w.Companies.Count) s.Send(Projection.Climb(w, s.Company));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -553,6 +553,42 @@ public static class Projection
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Quadro della scalata per la compagnia della sessione (ClimbOutlook, ADR 0018).</summary>
|
||||
public static ClimbReport Climb(World w, CompanyId company)
|
||||
{
|
||||
var report = ClimbOutlook.Build(w, company);
|
||||
var next = report.Next;
|
||||
var balance = report.Balance;
|
||||
var income = report.Income;
|
||||
return new ClimbReport
|
||||
{
|
||||
Day = report.Day, Company = report.Company.Value, FoundedDay = report.FoundedDay, InitialCapital = report.InitialCapital,
|
||||
Tier = (byte)report.Tier, NextTier = (byte)report.NextTier,
|
||||
Tiers = report.Tiers.Select(t => new TierInfo
|
||||
{
|
||||
Level = (byte)t.Level, NameIt = t.NameIt, NameEn = t.NameEn, NetWorthRequired = new Money(t.Requirements.NetWorth),
|
||||
TownsRequired = t.Requirements.ConnectedTownsOver.Count, TownPopulation = t.Requirements.ConnectedTownsOver.Population,
|
||||
RatingRequired = t.Requirements.CreditRating.ToString(), Reached = t.Reached, ReachedDay = t.ReachedDay,
|
||||
Unlocks = t.Unlocks.Select(u => new UnlockInfo { Kind = (byte)u.Kind, Value = u.Value }).ToList(),
|
||||
}).ToList(),
|
||||
NetWorth = next?.NetWorth ?? w.Company(company).NetWorth, NetWorthRequired = next?.NetWorthRequired ?? Money.Zero,
|
||||
NetWorthFraction = (float)(next?.NetWorthFraction ?? 1), NetWorthMet = next?.NetWorthMet ?? true,
|
||||
Towns = next?.Towns ?? 0, TownsRequired = next?.TownsRequired ?? 0, TownPopulation = next?.TownPopulation ?? 0,
|
||||
TownsFraction = (float)(next?.TownsFraction ?? 1), TownsMet = next?.TownsMet ?? true,
|
||||
Rating = w.Company(company).Rating.ToString(), RatingRequired = next?.RatingRequired.ToString() ?? "",
|
||||
RatingFraction = (float)(next?.RatingFraction ?? 1), RatingMet = next?.RatingMet ?? true, Progress = (float)(next?.Progress ?? 1),
|
||||
Assets = balance.Assets.Select(a => new AmountInfo { Kind = (byte)a.Category, Value = a.Value }).ToList(),
|
||||
Portfolio = balance.Portfolio, Cash = balance.Cash, TotalAssets = balance.TotalAssets, Loans = balance.Loans,
|
||||
LoansRate = (float)balance.LoansRate, Overdraft = balance.Overdraft, TotalLiabilities = balance.TotalLiabilities,
|
||||
BalanceNetWorth = balance.NetWorth,
|
||||
IncomeYear = income.Year, IncomePartial = income.Partial,
|
||||
Income = income.Lines.Select(l => new AmountInfo { Kind = (byte)l.Kind, Value = l.Value }).ToList(), Profit = income.Profit,
|
||||
LoanList = report.Loans.Select(l => new LoanInfo { Loan = l.Id.Value, Remaining = l.Remaining, AnnualRate = (float)l.AnnualRate, MonthsLeft = l.MonthsLeft }).ToList(),
|
||||
MaxLoan = report.MaxLoan, LoanAvailable = report.LoanAvailable, NewLoanRate = (float)report.NewLoanRate, LoansAllowed = report.LoansAllowed,
|
||||
History = report.History.Select(p => new NetWorthPointInfo { Day = p.Day, Value = p.Value }).ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Evento del mondo in corso → record del protocollo (ADR 0017).</summary>
|
||||
public static WorldEventInfo WorldEvent(ActiveWorldEvent e) => new()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user