F5: client con i pannelli Industrie, Compagnie e borsa e la Cronaca finale
- Pannello «Industrie»: elenco, scheda del proprietario con condizione, resa degli impianti, fermi, ricambi e macchinari, budget, ricambi da ordinare, fermo programmato, ammodernamento e acquisto al prezzo chiesto. - Pannello a tutto schermo «Compagnie e borsa»: listino, offerte con difese, scheda della compagnia con libro dei soci e storico, compravendita, quotazione, dividendi, riacquisto, offerte pubbliche, fusione, aste; banner dell'amministrazione controllata. - Cronaca finale e provvisoria, modalità osservatore. - Tema applicato a ogni radice dell'interfaccia (prima non arrivava ai controlli), menu e connessione a tutta finestra, barra degli strumenti scorrevole; 228 nuove chiavi it/en. - Schermate docs/screenshots/f5-*.jpg dal pilota automatico. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
This commit is contained in:
25 files changed
+2300
-25
No files matched your search
@@ -14,7 +14,9 @@ namespace ViaFerrea.Client.App;
|
||||
/// <summary>
|
||||
/// Pilota automatico per il collaudo del client (<c>-- --autopilot cartella</c>): nella partita
|
||||
/// locale costruisce stazioni, deposito e una linea con ponte usando l'anteprima, compra un treno,
|
||||
/// lo mette in linea e salva schermate della mappa, del ponte, del treno e del profilo.
|
||||
/// lo mette in linea e salva schermate della mappa, del ponte, del treno e del profilo; poi apre
|
||||
/// officine e impieghi (F4), la scheda del proprietario di un'industria, «Compagnie e borsa» e la
|
||||
/// Cronaca provvisoria (F5).
|
||||
/// </summary>
|
||||
public partial class AutoPilot : Node
|
||||
{
|
||||
@@ -73,6 +75,18 @@ public partial class AutoPilot : Node
|
||||
return r.Created.Length > 0 ? r.Created[0] : -1;
|
||||
}
|
||||
|
||||
/// <summary>Attende una condizione al massimo per il tempo indicato, senza fallire.</summary>
|
||||
private async Task<bool> Wait(Func<bool> condition, double timeoutS)
|
||||
{
|
||||
ulong start = Time.GetTicksMsec();
|
||||
while (!condition())
|
||||
{
|
||||
if (Time.GetTicksMsec() - start > timeoutS * 1000) return false;
|
||||
await Frame();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task Shot(string name, int settleFrames = 30)
|
||||
{
|
||||
for (int i = 0; i < settleFrames; i++) await Frame();
|
||||
@@ -184,5 +198,46 @@ public partial class AutoPilot : Node
|
||||
_game.UseTool(Tool.Employment);
|
||||
await Until(() => World.Employment is not null, "registro degli impieghi", 30);
|
||||
await Shot("11_impieghi", 30);
|
||||
|
||||
await IndustriesAndMarket(site.A);
|
||||
}
|
||||
|
||||
/// <summary>F5: scheda del proprietario di un'industria, borsa con il libro dei soci, Cronaca provvisoria.</summary>
|
||||
private async Task IndustriesAndMarket(Vec2 near)
|
||||
{
|
||||
int me = World.Summary!.CompanyId;
|
||||
var anchor = MapScale.V(near);
|
||||
var industry = World.Industries.Values.Where(i => !i.Closed && i.Owner < 0 && i.Level > 0)
|
||||
.OrderBy(i => MapScale.V(i.Position).DistanceTo(anchor)).ThenBy(i => i.Id).First();
|
||||
_game.OpenIndustry(industry.Id);
|
||||
await Until(() => World.IndustryCards.ContainsKey(industry.Id), "scheda dell'industria", 30);
|
||||
// al livello iniziale il server rifiuta l'acquisto: il messaggio compare sulla mappa
|
||||
var buy = await Do(new BuyIndustryCommand(new IndustryId(industry.Id), World.IndustryCards[industry.Id].Valuation));
|
||||
GD.Print($"autopilot: acquisto di {industry.Name}: {buy.Message}");
|
||||
_game.Map.CenterOn(MapScale.V(industry.Position));
|
||||
_game.Map.SetZoom(0.3f);
|
||||
await Shot("12_industria", 40);
|
||||
_game.ScrollPanel(1);
|
||||
await Shot("12b_industria_scorte", 20);
|
||||
_game.ScrollPanel(0);
|
||||
|
||||
// borsa: azioni di una compagnia IA, qualche mese di prezzi, poi listino e libro dei soci
|
||||
var ai = World.Companies.Values.Where(c => !c.IsPlayer && c.Listed && !c.Bankrupt).OrderBy(c => c.Id).FirstOrDefault();
|
||||
if (ai is not null) await Ok(new BuySharesCommand(new CompanyId(ai.Id), 20_000, Money.Zero));
|
||||
_game.OpenCompanies(ai?.Id ?? me);
|
||||
Session.SetSpeed(8);
|
||||
bool history = await Wait(() => ai is null || (World.CompanyCards.TryGetValue(ai.Id, out var card) && card.PriceHistory.Count >= 3), 200);
|
||||
if (!history) GD.Print("autopilot: storico dei prezzi ancora corto");
|
||||
Session.SetSpeed(1);
|
||||
await Until(() => World.Tape is not null, "listino di borsa", 60);
|
||||
await Shot("13_compagnie", 60);
|
||||
_game.OpenCompanies(me);
|
||||
await Until(() => World.CompanyCards.ContainsKey(me), "scheda della compagnia del giocatore", 30);
|
||||
await Shot("14_compagnia_giocatore", 40);
|
||||
|
||||
// Cronaca provvisoria
|
||||
_game.OpenChronicle();
|
||||
await Until(() => _game.ChronicleVisible, "cronaca", 30);
|
||||
await Shot("15_cronaca", 30);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user