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);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,15 @@ public static class UiTheme
|
||||
public static Font BodyBold { get; private set; } = ThemeDB.FallbackFont;
|
||||
public static Font Title { get; private set; } = ThemeDB.FallbackFont;
|
||||
|
||||
/// <summary>
|
||||
/// Tema costruito da <see cref="Build"/>. Il tema della finestra non attraversa i nodi che non
|
||||
/// sono Control (Main, CanvasLayer): ogni radice dell'interfaccia lo riceve con <see cref="Apply"/>.
|
||||
/// </summary>
|
||||
public static Theme? Current { get; private set; }
|
||||
|
||||
/// <summary>Assegna il tema a una radice dell'interfaccia (figlia di un nodo che non è un Control).</summary>
|
||||
public static void Apply(Control root) => root.Theme = Current;
|
||||
|
||||
public static Theme Build()
|
||||
{
|
||||
Body = LoadFont("res://assets/fonts/IBMPlexSans-Regular.ttf");
|
||||
@@ -35,22 +44,44 @@ public static class UiTheme
|
||||
t.SetStylebox("pressed", "Button", Box(Palette.Amber, Palette.Amber, 8, 10));
|
||||
t.SetStylebox("disabled", "Button", Box(Palette.AppBackground, Palette.Border, 8, 10));
|
||||
t.SetStylebox("focus", "Button", Box(new Color(0, 0, 0, 0), Palette.AmberLight, 8, 10));
|
||||
// pulsanti in IBM Plex Sans 600 come nell'immagine 05
|
||||
t.SetFont("font", "Button", BodyBold);
|
||||
t.SetColor("font_pressed_color", "Button", Palette.AppBackground);
|
||||
t.SetColor("font_hover_color", "Button", Palette.Text);
|
||||
t.SetColor("font_disabled_color", "Button", Palette.TextSecondary);
|
||||
t.SetColor("font_hover_pressed_color", "Button", Palette.AppBackground);
|
||||
|
||||
// caselle e interruttori: niente riquadro da pulsante (altrimenti ereditano quello di Button)
|
||||
var plain = new StyleBoxEmpty { ContentMarginLeft = 4, ContentMarginRight = 4, ContentMarginTop = 2, ContentMarginBottom = 2 };
|
||||
foreach (string type in new[] { "CheckBox", "CheckButton" })
|
||||
{
|
||||
foreach (string state in new[] { "normal", "pressed", "hover", "hover_pressed", "disabled", "focus" }) t.SetStylebox(state, type, plain);
|
||||
t.SetColor("font_pressed_color", type, Palette.Text);
|
||||
t.SetColor("font_hover_color", type, Palette.Text);
|
||||
t.SetColor("font_hover_pressed_color", type, Palette.Text);
|
||||
t.SetFont("font", type, Body);
|
||||
}
|
||||
|
||||
t.SetStylebox("normal", "LineEdit", Box(Palette.Inner, Palette.Border, 8, 8));
|
||||
t.SetStylebox("focus", "LineEdit", Box(Palette.Inner, Palette.Amber, 8, 8));
|
||||
t.SetColor("caret_color", "LineEdit", Palette.Amber);
|
||||
t.SetStylebox("panel", "ItemList", Box(Palette.Inner, Palette.Border, 8, 6));
|
||||
t.SetColor("font_selected_color", "ItemList", Palette.AppBackground);
|
||||
t.SetStylebox("selected", "ItemList", Box(Palette.Amber, Palette.Amber, 4, 4));
|
||||
t.SetStylebox("selected_focus", "ItemList", Box(Palette.Amber, Palette.Amber, 4, 4));
|
||||
// selezione su ambra scuro: restano leggibili anche le voci colorate (condizione, proprietario)
|
||||
t.SetColor("font_selected_color", "ItemList", Palette.AmberLight);
|
||||
t.SetStylebox("selected", "ItemList", Box(Palette.AmberDark, Palette.Amber, 4, 4));
|
||||
t.SetStylebox("selected_focus", "ItemList", Box(Palette.AmberDark, Palette.Amber, 4, 4));
|
||||
|
||||
// cursori: binario vuoto e parte piena in ambra
|
||||
var track = Box(Palette.Border, Palette.Border, 3, 0);
|
||||
track.ContentMarginTop = track.ContentMarginBottom = 3;
|
||||
t.SetStylebox("slider", "HSlider", track);
|
||||
t.SetStylebox("grabber_area", "HSlider", Box(Palette.Amber, Palette.Amber, 3, 0));
|
||||
t.SetStylebox("grabber_area_highlight", "HSlider", Box(Palette.AmberLight, Palette.AmberLight, 3, 0));
|
||||
|
||||
t.SetStylebox("background", "ProgressBar", Box(Palette.Border, Palette.Border, 4, 0));
|
||||
t.SetStylebox("fill", "ProgressBar", Box(Palette.Workers, Palette.Workers, 4, 0));
|
||||
t.SetColor("font_color", "ProgressBar", Palette.Text);
|
||||
Current = t;
|
||||
return t;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user