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:
Claude committed 2026-10-12 10:57:19 +00:00
1 parent 7879ac502d
commit ebf6163a4b
25 files changed
+2300 -25

No files matched your search

@@ -0,0 +1,220 @@
using Godot;
using ViaFerrea.Client.App;
using ViaFerrea.Client.Panels;
using ViaFerrea.Protocol.Client;
using ViaFerrea.Protocol.Messages;
using static ViaFerrea.Client.App.Localization;
namespace ViaFerrea.Client.Screens;
/// <summary>
/// Cronaca finale (12.3), a tutto schermo sopra la partita: storia della compagnia anno per anno
/// (patrimonio netto), primati, fatti salienti e prestigio, con «Continua come osservatore» e
/// «Nuova partita+». A partita in corso la stessa schermata è la Cronaca provvisoria.
/// Mostra solo ciò che manda il server (messaggio Chronicle).
/// </summary>
public partial class ChronicleScreen : Control
{
private readonly ClientWorld _world;
private readonly Chronicle _chronicle;
private readonly string _nextDifficulty;
/// <summary>Chiusura: continua come osservatore (o torna alla partita, se provvisoria).</summary>
public event Action? Closed;
/// <summary>Nuova partita+ con la difficoltà successiva.</summary>
public event Action? NewGamePlus;
public ChronicleScreen(ClientWorld world, Chronicle chronicle, string nextDifficulty)
{
_world = world;
_chronicle = chronicle;
_nextDifficulty = nextDifficulty;
}
public bool Final => _chronicle.GameOver;
public override void _Ready()
{
// già nell'albero: ancore e margini insieme, altrimenti resterebbe grande zero
SetAnchorsAndOffsetsPreset(LayoutPreset.FullRect);
UiTheme.Apply(this);
MouseFilter = MouseFilterEnum.Stop;
var bg = new ColorRect { Color = Palette.AppBackground };
bg.SetAnchorsPreset(LayoutPreset.FullRect);
AddChild(bg);
var margin = new MarginContainer();
margin.SetAnchorsPreset(LayoutPreset.FullRect);
foreach (string side in new[] { "left", "right" }) margin.AddThemeConstantOverride("margin_" + side, 48);
foreach (string side in new[] { "top", "bottom" }) margin.AddThemeConstantOverride("margin_" + side, 28);
AddChild(margin);
var root = PanelKit.Column(16);
margin.AddChild(root);
var c = _chronicle;
var header = PanelKit.Row(24);
var titles = PanelKit.Column(2);
titles.SizeFlagsHorizontal = SizeFlags.ExpandFill;
titles.AddChild(UiTheme.TitleLabel(c.GameOver ? T("Cronaca finale") : T("Cronaca provvisoria"), 60));
int lastYear = c.History.Count > 0 ? c.History[^1].Year : c.FoundedYear;
titles.AddChild(UiTheme.Text($"{c.Company} · {c.FoundedYear}–{lastYear} · {Fmt.Date(_world, c.Day)}", 20, Palette.TextSecondary, bold: true));
header.AddChild(titles);
var prestige = new PanelContainer { SizeFlagsVertical = SizeFlags.ShrinkCenter };
prestige.AddThemeStyleboxOverride("panel", UiTheme.Box(Palette.AmberDark, Palette.Amber, 10, 18));
var prestigeCol = PanelKit.Column(0);
prestigeCol.AddChild(UiTheme.Text(T("Prestigio"), 14, Palette.AmberLight));
prestigeCol.AddChild(UiTheme.TitleLabel(Fmt.Number(c.Prestige, 0), 48, Palette.AmberLight));
prestige.AddChild(prestigeCol);
header.AddChild(prestige);
root.AddChild(header);
if (c.GameOver)
{
var reason = new PanelContainer();
reason.AddThemeStyleboxOverride("panel", UiTheme.Box(new Color("3a1c16"), Palette.Danger, 8, 16));
var col = PanelKit.Column(2);
col.AddChild(UiTheme.Text(ReasonTitle(c.Reason) + (c.Winner >= 0 ? $" · {T("vincitore")}: {Fmt.Company(_world, c.Winner)}" : ""), 17, Palette.AmberLight, bold: true));
if (c.Text.Length > 0) col.AddChild(Wrapped(c.Text, 14, Palette.Text));
col.AddChild(Wrapped(T("Il mondo continua: le compagnie IA giocano e puoi guardarle come osservatore, ma il server non accetta più i tuoi comandi."), 13, Palette.TextSecondary));
reason.AddChild(col);
root.AddChild(reason);
}
else
{
root.AddChild(UiTheme.Notice(T("La partita è in corso: questa è la storia finora. La Cronaca finale arriva quando la tua compagnia esce di scena.")));
}
var body = PanelKit.Row(20);
body.SizeFlagsVertical = SizeFlags.ExpandFill;
root.AddChild(body);
// sinistra: grafico e tabella anno per anno
var left = Frame(body, 1.7f);
left.AddChild(UiTheme.Text(T("Patrimonio netto anno per anno"), 16, bold: true));
var chart = new SeriesChart(240);
chart.Show(c.History.Select(y => (double)y.NetWorth.Cents).ToList(), c.History.Select(y => $"{y.Year}").ToList(),
v => Core.Common.Money.FromCentsRounded(v).ToString("short"), SeriesChart.Style.Bars, Palette.Amber, T("Nessun anno registrato"));
left.AddChild(chart);
left.AddChild(YearTable(c.History));
// destra: primati e fatti salienti
var right = Frame(body, 1f);
right.AddChild(UiTheme.Text(T("Primati"), 16, bold: true));
var records = new GridContainer { Columns = 2, SizeFlagsHorizontal = SizeFlags.ExpandFill };
records.AddThemeConstantOverride("h_separation", 8);
records.AddThemeConstantOverride("v_separation", 8);
foreach (var r in c.Records)
{
var value = PanelKit.Value(r.Value);
value.ClipText = true;
value.TextOverrunBehavior = TextServer.OverrunBehavior.TrimEllipsis;
var stat = PanelKit.Stat($"{r.Title} ({r.Year})", value);
stat.TooltipText = $"{r.Title}: {r.Value} ({r.Year})";
records.AddChild(stat);
}
right.AddChild(records);
right.AddChild(PanelKit.Separator());
right.AddChild(UiTheme.Text(T("Fatti salienti"), 16, bold: true));
if (c.Highlights.Count == 0) right.AddChild(UiTheme.Text(T("Ancora nessun fatto da raccontare."), 13, Palette.TextSecondary));
foreach (string h in c.Highlights) right.AddChild(Wrapped("• " + h, 13, Palette.Text));
// pulsanti
var buttons = PanelKit.Row(12);
buttons.AddChild(new Control { SizeFlagsHorizontal = SizeFlags.ExpandFill });
if (c.GameOver)
{
var hint = UiTheme.Text($"{T("Nuova mappa con la difficoltà")} «{_nextDifficulty}»", 14, Palette.TextSecondary);
hint.SizeFlagsVertical = SizeFlags.ShrinkCenter;
buttons.AddChild(hint);
var observe = new Button { Text = T("Continua come osservatore"), CustomMinimumSize = new Vector2(0, 48) };
observe.Pressed += () => Closed?.Invoke();
buttons.AddChild(observe);
var again = UiTheme.Primary(T("Nuova partita+"));
again.CustomMinimumSize = new Vector2(200, 48);
again.Pressed += () => NewGamePlus?.Invoke();
buttons.AddChild(again);
}
else
{
var back = UiTheme.Primary(T("Torna alla partita"));
back.CustomMinimumSize = new Vector2(200, 48);
back.Pressed += () => Closed?.Invoke();
buttons.AddChild(back);
}
root.AddChild(buttons);
}
public override void _UnhandledKeyInput(InputEvent e)
{
if (e is InputEventKey { Pressed: true, Keycode: Key.Escape })
{
Closed?.Invoke();
GetViewport().SetInputAsHandled();
}
}
private static VBoxContainer Frame(HBoxContainer body, float ratio)
{
var frame = new PanelContainer { SizeFlagsHorizontal = SizeFlags.ExpandFill, SizeFlagsVertical = SizeFlags.ExpandFill, SizeFlagsStretchRatio = ratio };
frame.AddThemeStyleboxOverride("panel", UiTheme.Box(Palette.Panel, Palette.Border, 10, 18));
var scroll = new ScrollContainer { HorizontalScrollMode = ScrollContainer.ScrollMode.Disabled, SizeFlagsVertical = SizeFlags.ExpandFill };
frame.AddChild(scroll);
// margine destro: la barra di scorrimento non tocca i numeri allineati a destra
var margin = new MarginContainer { SizeFlagsHorizontal = SizeFlags.ExpandFill };
margin.AddThemeConstantOverride("margin_right", 12);
scroll.AddChild(margin);
var col = PanelKit.Column(10);
margin.AddChild(col);
body.AddChild(frame);
return col;
}
private static Control YearTable(List<CompanyYearInfo> history)
{
var grid = new GridContainer { Columns = 7, SizeFlagsHorizontal = SizeFlags.ExpandFill };
grid.AddThemeConstantOverride("h_separation", 18);
grid.AddThemeConstantOverride("v_separation", 4);
string[] heads = [T("Anno"), T("Patrimonio"), T("Cassa"), T("Ricavi"), T("Utile"), T("Treni"), T("Km di binari")];
for (int i = 0; i < heads.Length; i++)
{
var l = UiTheme.Text(heads[i], 12, Palette.TextSecondary);
l.HorizontalAlignment = i == 0 ? HorizontalAlignment.Left : HorizontalAlignment.Right;
l.SizeFlagsHorizontal = i == 0 ? SizeFlags.Fill : SizeFlags.ExpandFill;
grid.AddChild(l);
}
foreach (var y in Enumerable.Reverse(history).Take(12))
{
grid.AddChild(UiTheme.Text($"{y.Year}", 13, bold: true));
foreach (var (text, color) in new[]
{
(y.NetWorth.ToString("short"), Palette.Text),
(y.Cash.ToString("short"), Palette.Text),
(y.Revenue.ToString("short"), Palette.Text),
(y.Profit.ToString("short"), y.Profit.IsNegative ? Palette.Danger : Palette.Ok),
($"{y.Trains}", Palette.Text),
(Fmt.Number(y.TrackKm, 1), Palette.Text),
})
{
var l = UiTheme.Text(text, 13, color);
l.HorizontalAlignment = HorizontalAlignment.Right;
grid.AddChild(l);
}
}
return grid;
}
private static string ReasonTitle(byte reason) => reason switch
{
1 => T("Fallimento"),
2 => T("La compagnia è stata scalata"),
3 => T("Riscatto non riuscito in tempo"),
_ => T("Partita conclusa"),
};
private static Label Wrapped(string text, int size, Color color)
{
var l = UiTheme.Text(text, size, color);
l.AutowrapMode = TextServer.AutowrapMode.WordSmart;
return l;
}
}
@@ -0,0 +1 @@
uid://ck3hivvfy7bdr
@@ -21,7 +21,9 @@ public partial class ConnectScreen : Control
public override void _Ready()
{
SetAnchorsPreset(LayoutPreset.FullRect);
// già nell'albero: ancore e margini insieme, altrimenti la schermata resterebbe grande zero
SetAnchorsAndOffsetsPreset(LayoutPreset.FullRect);
UiTheme.Apply(this);
var bg = new ColorRect { Color = Palette.AppBackground };
bg.SetAnchorsPreset(LayoutPreset.FullRect);
AddChild(bg);
@@ -6,6 +6,7 @@ using ViaFerrea.Client.Net;
using ViaFerrea.Client.Panels;
using ViaFerrea.Core.Commands;
using ViaFerrea.Core.Common;
using ViaFerrea.Core.Data;
using ViaFerrea.Core.Rail;
using ViaFerrea.Protocol;
using ViaFerrea.Protocol.Messages;
@@ -38,6 +39,18 @@ public partial class GameScreen : Node
private LinesPanel? _linesPanel;
private InfoPanel? _info;
private MaintenancePanel? _maintenance;
private IndustryPanel? _industryPanel;
private CompaniesPanel? _companies;
// pannelli a tutto schermo (Compagnie e borsa): coprono mappa e pannello destro, la barra resta
private readonly PanelContainer _full = new() { SizeFlagsHorizontal = Control.SizeFlags.ExpandFill, Visible = false };
private Control? _mapArea;
private Control? _side;
// Cronaca finale (o provvisoria) sopra tutta la partita e avviso dell'osservatore
private readonly CanvasLayer _overlay = new() { Layer = 3 };
private readonly PanelContainer _observer = new() { Visible = false };
private ChronicleScreen? _chronicleScreen;
private Protocol.Messages.Chronicle? _seenChronicle;
private bool _wantChronicle, _finalShown;
private bool _heatMap;
private readonly List<Vector2> _trackPoints = [];
private Vector2? _mouse;
@@ -81,6 +94,29 @@ public partial class GameScreen : Node
_maintenance?.SelectDepot(depot);
}
/// <summary>Apre il pannello Industrie sull'industria indicata (scheda del proprietario).</summary>
public void OpenIndustry(int industry)
{
if (_tool != Tool.Industries) _toolbar.Select(Tool.Industries);
_industryPanel?.Select(industry);
}
/// <summary>Apre «Compagnie e borsa» a tutto schermo sulla compagnia indicata.</summary>
public void OpenCompanies(int company)
{
if (_tool != Tool.Companies) _toolbar.Select(Tool.Companies);
_companies?.Select(company);
}
/// <summary>Chiede al server la Cronaca (provvisoria a partita in corso) e la mostra all'arrivo.</summary>
public void OpenChronicle()
{
_wantChronicle = true;
_session.Send(new RequestDetail { Kind = DetailKind.Chronicle, Target = 0 });
}
public bool ChronicleVisible => _chronicleScreen is not null;
/// <summary>Mappa di calore della condizione dei treni.</summary>
public void SetHeatMap(bool on)
{
@@ -112,6 +148,7 @@ public partial class GameScreen : Node
var hud = new CanvasLayer { Layer = 2 };
AddChild(hud);
var root = new VBoxContainer { MouseFilter = Control.MouseFilterEnum.Ignore };
UiTheme.Apply(root);
root.SetAnchorsPreset(Control.LayoutPreset.FullRect);
root.AddThemeConstantOverride("separation", 0);
hud.AddChild(root);
@@ -122,6 +159,7 @@ public partial class GameScreen : Node
middle.AddChild(_toolbar);
var mapArea = new Control { SizeFlagsHorizontal = Control.SizeFlags.ExpandFill, MouseFilter = Control.MouseFilterEnum.Ignore };
middle.AddChild(mapArea);
_mapArea = mapArea;
_toasts.SetAnchorsPreset(Control.LayoutPreset.TopWide);
_toasts.OffsetLeft = 16;
_toasts.OffsetRight = -16;
@@ -131,11 +169,19 @@ public partial class GameScreen : Node
var side = new PanelContainer { CustomMinimumSize = new Vector2(440, 0) };
side.AddThemeStyleboxOverride("panel", UiTheme.Box(Palette.Panel, Palette.Border, 0, 18));
middle.AddChild(side);
_side = side;
_full.AddThemeStyleboxOverride("panel", UiTheme.Box(Palette.AppBackground, Palette.Border, 0, 20));
middle.AddChild(_full);
BuildObserverBanner(mapArea);
var sideCol = new VBoxContainer();
sideCol.AddThemeConstantOverride("separation", 12);
side.AddChild(sideCol);
sideCol.AddChild(_scroll);
_scroll.AddChild(_content);
// margine destro: la barra di scorrimento non copre i valori allineati a destra
var contentMargin = new MarginContainer { SizeFlagsHorizontal = Control.SizeFlags.ExpandFill };
contentMargin.AddThemeConstantOverride("margin_right", 12);
_scroll.AddChild(contentMargin);
contentMargin.AddChild(_content);
var miniHeader = new HBoxContainer();
var miniTitle = UiTheme.Text(T("Minimappa"), 13, Palette.TextSecondary);
miniTitle.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
@@ -146,6 +192,7 @@ public partial class GameScreen : Node
root.AddChild(_ticker);
BuildDisconnectedOverlay(hud);
AddChild(_overlay);
_map.Bind(_session);
_minimap.Bind(_session.World, _map);
@@ -165,9 +212,37 @@ public partial class GameScreen : Node
public override void _ExitTree() => _session.MessageApplied -= OnMessage;
/// <summary>Avviso permanente dopo la fine della partita: si guarda il mondo, la Cronaca resta a portata.</summary>
private void BuildObserverBanner(Control mapArea)
{
_observer.SetAnchorsPreset(Control.LayoutPreset.BottomWide);
_observer.OffsetLeft = 16;
_observer.OffsetRight = -16;
_observer.OffsetTop = -70;
_observer.OffsetBottom = -16;
_observer.AddThemeStyleboxOverride("panel", UiTheme.Box(Palette.AmberDark, Palette.Amber, 8, 14));
var row = new HBoxContainer();
row.AddThemeConstantOverride("separation", 14);
var text = UiTheme.Text(T("Partita conclusa: sei un osservatore. Il mondo va avanti e le compagnie IA continuano a giocare."), 14, Palette.AmberLight, bold: true);
text.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
text.SizeFlagsVertical = Control.SizeFlags.ShrinkCenter;
text.AutowrapMode = TextServer.AutowrapMode.WordSmart;
row.AddChild(text);
var open = UiTheme.Primary(T("Cronaca finale"));
open.Pressed += () =>
{
if (_session.World.Chronicle is { } c) ShowChronicle(c);
else OpenChronicle();
};
row.AddChild(open);
_observer.AddChild(row);
mapArea.AddChild(_observer);
}
private void BuildDisconnectedOverlay(CanvasLayer hud)
{
_disconnected.SetAnchorsPreset(Control.LayoutPreset.FullRect);
UiTheme.Apply(_disconnected);
_disconnected.Visible = false;
var shade = new ColorRect { Color = new Color(0, 0, 0, 0.55f) };
shade.SetAnchorsPreset(Control.LayoutPreset.FullRect);
@@ -202,7 +277,12 @@ public partial class GameScreen : Node
// nuova partita o caricamento: si ricomincia dalla copia locale vuota
_map.Bind(_session);
_minimap.Bind(_session.World, _map);
CloseChronicle();
_seenChronicle = null;
_wantChronicle = _finalShown = false;
_toolbar.Select(Tool.None);
SendViewport(force: true);
_session.Send(new RequestDetail { Kind = DetailKind.Employment, Target = 0 });
break;
case DailyDigest d:
foreach (var e in d.Events.Where(e => e.Severity >= 2)) _ticker.Add(e);
@@ -214,6 +294,7 @@ public partial class GameScreen : Node
{
_session.Poll();
_disconnected.Visible = !_session.IsOpen;
UpdateChronicle();
SendViewport(force: false);
_sincePreview += delta;
if (_previewDirty && _sincePreview > 0.12)
@@ -282,6 +363,13 @@ public partial class GameScreen : Node
_linesPanel = null;
_info = null;
_maintenance = null;
_industryPanel = null;
_companies = null;
foreach (var c in _full.GetChildren()) c.QueueFree();
bool full = tool == Tool.Companies;
_full.Visible = full;
if (_mapArea is not null) _mapArea.Visible = !full;
if (_side is not null) _side.Visible = !full;
Control panel;
switch (tool)
{
@@ -331,6 +419,16 @@ public partial class GameScreen : Node
case Tool.Employment:
panel = new EmploymentPanel(_session);
break;
case Tool.Industries:
panel = _industryPanel = new IndustryPanel(_session);
break;
case Tool.Companies:
_companies = new CompaniesPanel(_session);
_companies.CloseRequested += () => _toolbar.Select(Tool.None);
_companies.ChronicleRequested += OpenChronicle;
_full.AddChild(_companies);
panel = NewInfoPanel();
break;
case Tool.Market:
panel = new MarketPanel(_session);
break;
@@ -338,14 +436,21 @@ public partial class GameScreen : Node
panel = new FinancePanel(_session);
break;
default:
panel = _info = new InfoPanel(_session);
_info.MaintenanceRequested += OpenMaintenance;
panel = NewInfoPanel();
break;
}
panel.SizeFlagsHorizontal = Control.SizeFlags.ExpandFill;
_content.AddChild(panel);
}
private InfoPanel NewInfoPanel()
{
_info = new InfoPanel(_session);
_info.MaintenanceRequested += OpenMaintenance;
_info.IndustryRequested += OpenIndustry;
return _info;
}
private void OnMapHovered(Vector2 world)
{
_mouse = world;
@@ -394,6 +499,9 @@ public partial class GameScreen : Node
case Tool.Lines when _linesPanel is not null:
if (NearestStation(world) is { } station) _linesPanel.AddStop(station);
break;
case Tool.Industries when _industryPanel is not null:
if (IndustryAt(world) is { } industry) _industryPanel.Select(industry);
break;
default:
SelectAt(world);
break;
@@ -568,13 +676,10 @@ public partial class GameScreen : Node
_map.Entities.SelectedStation = -1;
_map.Entities.QueueRedraw();
double cs = w.Summary?.CellSizeM ?? 100;
foreach (var ind in w.Industries.Values)
if (IndustryAt(world) is { } industry)
{
if (MapScale.V(ind.Position).DistanceTo(world) < Math.Max(PickRadius, ind.FootprintCells * cs * 0.6))
{
_info.Select(InfoPanel.Kind.Industry, ind.Id);
return;
}
_info.Select(InfoPanel.Kind.Industry, industry);
return;
}
foreach (var town in w.Towns.Values)
{
@@ -587,6 +692,72 @@ public partial class GameScreen : Node
_info.Select(InfoPanel.Kind.None, -1);
}
private int? IndustryAt(Vector2 world)
{
double cs = _session.World.Summary?.CellSizeM ?? 100;
foreach (var ind in _session.World.Industries.Values)
{
if (MapScale.V(ind.Position).DistanceTo(world) < Math.Max(PickRadius, ind.FootprintCells * cs * 0.6)) return ind.Id;
}
return null;
}
// ------------------------------------------------------------------ Cronaca finale e osservatore
/// <summary>Mostra la Cronaca quando arriva: subito se la partita è finita, oppure se l'ha chiesta il giocatore.</summary>
private void UpdateChronicle()
{
var chronicle = _session.World.Chronicle;
if (!ReferenceEquals(chronicle, _seenChronicle))
{
_seenChronicle = chronicle;
if (chronicle is not null && ((chronicle.GameOver && !_finalShown) || _wantChronicle))
{
_wantChronicle = false;
if (chronicle.GameOver) _finalShown = true;
ShowChronicle(chronicle);
}
}
_observer.Visible = chronicle?.GameOver == true && _chronicleScreen is null;
}
private void ShowChronicle(Protocol.Messages.Chronicle chronicle)
{
CloseChronicle();
var next = NextDifficulty();
string name = TranslationServer.GetLocale().StartsWith("en") ? next.NameEn : next.NameIt;
var screen = new ChronicleScreen(_session.World, chronicle, name);
screen.Closed += CloseChronicle;
screen.NewGamePlus += StartNewGamePlus;
_overlay.AddChild(screen);
_chronicleScreen = screen;
}
private void CloseChronicle()
{
_chronicleScreen?.QueueFree();
_chronicleScreen = null;
}
/// <summary>Difficoltà successiva a quella della partita (l'ultima resta l'ultima).</summary>
private DifficultyDef NextDifficulty()
{
var file = _session.World.Data.Difficulty;
int i = file.Presets.FindIndex(p => p.Id == _session.Difficulty);
if (i < 0) i = file.Presets.FindIndex(p => p.Id == file.Default);
return file.Presets[Math.Clamp(i + 1, 0, file.Presets.Count - 1)];
}
/// <summary>Nuova partita+: mappa nuova (seme successivo, stessa dimensione) con la difficoltà superiore.</summary>
private void StartNewGamePlus()
{
var summary = _session.World.Summary;
var next = NextDifficulty();
_session.Send(new NewGame { Seed = (summary?.Seed ?? 0) + 1, SizeKm = summary?.SizeKm ?? 0, DifficultyPreset = next.Id });
CloseChronicle();
Toast($"{T("Nuova partita+ in preparazione")}: {(TranslationServer.GetLocale().StartsWith("en") ? next.NameEn : next.NameIt)}");
}
/// <summary>Messaggio temporaneo in alto sulla mappa.</summary>
private void Toast(string text, bool error = false)
{
@@ -14,7 +14,9 @@ public partial class MenuScreen : Control
public override void _Ready()
{
SetAnchorsPreset(LayoutPreset.FullRect);
// già nell'albero: ancore e margini insieme, altrimenti la schermata resterebbe grande zero
SetAnchorsAndOffsetsPreset(LayoutPreset.FullRect);
UiTheme.Apply(this);
var bg = new ColorRect { Color = Palette.AppBackground };
bg.SetAnchorsPreset(LayoutPreset.FullRect);
AddChild(bg);