- Client Godot 4.7 .NET (Godot.NET.Sdk 4.7.2): menu, collegamento, partita locale con server figlio; mappa con terreno (fasce, ombreggiatura, rive curve con shader, curve di livello), opere, entità, alberi, treni interpolati con fumo; strumenti binari con profilo, stazione, deposito, segnali, demolizione; pannelli treni, linee, mercato, finanze, schede; barra superiore, minimappa, notiziario; italiano e inglese. - Pilota automatico del client e scripts/client-autopilot.sh: partita locale, linea con ponte, treni in moto e schermate (docs/screenshots). - Registro dei comandi del server (--record) e viaferrea-tools replay. - PROTOCOL.md normativo, ADR 0009, ARCHITECTURE, STATE e README aggiornati. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0191R7vXgtbAvSV4V8tj8uzL
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using Godot;
|
|
using ViaFerrea.Client.App;
|
|
using ViaFerrea.Protocol.Messages;
|
|
using static ViaFerrea.Client.App.Localization;
|
|
|
|
namespace ViaFerrea.Client.Hud;
|
|
|
|
/// <summary>Notiziario in basso (immagine 01): «Notizie» e gli ultimi eventi che scorrono.</summary>
|
|
public partial class Ticker : PanelContainer
|
|
{
|
|
private readonly List<string> _items = [];
|
|
private readonly Label _text = UiTheme.Text("", 14);
|
|
private readonly Control _clip = new() { ClipContents = true, SizeFlagsHorizontal = SizeFlags.ExpandFill, CustomMinimumSize = new Vector2(0, 22) };
|
|
private float _offset;
|
|
|
|
public override void _Ready()
|
|
{
|
|
AddThemeStyleboxOverride("panel", UiTheme.Box(Palette.Panel, Palette.Border, 0, 14));
|
|
var row = new HBoxContainer();
|
|
row.AddThemeConstantOverride("separation", 18);
|
|
AddChild(row);
|
|
row.AddChild(UiTheme.Text(T("Notizie"), 14, Palette.Amber, bold: true));
|
|
row.AddChild(_clip);
|
|
_clip.AddChild(_text);
|
|
}
|
|
|
|
public void Add(EventInfo e)
|
|
{
|
|
_items.Insert(0, e.Text);
|
|
if (_items.Count > 8) _items.RemoveAt(_items.Count - 1);
|
|
_text.Text = string.Join(" | ", _items);
|
|
}
|
|
|
|
public override void _Process(double delta)
|
|
{
|
|
if (_items.Count == 0) return;
|
|
_offset += (float)delta * 40f;
|
|
float width = _text.GetMinimumSize().X;
|
|
if (_offset > width) _offset = -_clip.Size.X;
|
|
_text.Position = new Vector2(-_offset, 0);
|
|
}
|
|
}
|