F6: tooltip perché sui valori calcolati dal server
Ogni valore importante dei pannelli spiega al passaggio del mouse da dove viene: formula, termini con i valori di oggi e note, calcolati dal Core e mandati dal server, perché il client non deve rifare né ricomporre formule. - Core: modello comune Explanation ed Explanations, pure funzioni che chiamano le stesse funzioni del motore; estratte senza cambiare l'aritmetica (hash invariati) Market.NextPrice e LocalPriceTerms, Tariffs.FreightTerms e PassengerTerms, TownSystem.GrowthOf, Fleet.DailyHazard, GameClock.YearsAt; Industry.LastEfficiency transitorio (né salvato né nell'hash). - Protocollo: RequestDetail kind 11 con un blocco 1 (subject, arg) ed ExplanationReport 137; il server risponde sempre, anche con available falso. Nessun campo nei delta, formato dei salvataggi invariato. - Client: WhyTooltip comune (palette 05, apertura dopo 0,45 s, «in arrivo…» finché la spiegazione manca) su barra superiore, Mercato, Scalata, Finanze, scheda industria, Treni e Officine; testi in strings.csv. - ADR 0024, PROTOCOL.md, ARCHITECTURE.md, STATE.md; 10 test nuovi in Economy/ExplanationTests.cs con uguaglianza esatta ai valori del motore. Refs #44. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
767661957b
commit
19a3dd3af1
33 files changed
+2089
-64
No files matched your search
@@ -5,6 +5,8 @@ using RailEnterprise.Core.Common;
|
||||
using RailEnterprise.Protocol.Client;
|
||||
using RailEnterprise.Protocol.Messages;
|
||||
using static RailEnterprise.Client.App.Localization;
|
||||
using ExplainSubject = RailEnterprise.Core.Economy.ExplainSubject;
|
||||
using ExplainTarget = RailEnterprise.Core.Economy.ExplainTarget;
|
||||
|
||||
namespace RailEnterprise.Client.Panels;
|
||||
|
||||
@@ -102,6 +104,8 @@ public partial class MarketPanel : VBoxContainer
|
||||
_goodChange.HorizontalAlignment = HorizontalAlignment.Right;
|
||||
price.AddChild(_goodPrice);
|
||||
price.AddChild(_goodChange);
|
||||
// tooltip «perché» del prezzo globale del bene scelto (ADR 0024)
|
||||
WhyTooltip.Attach(_goodPrice, () => _selected >= 0 ? new ExplainTarget(ExplainSubject.GlobalPrice, _selected) : null);
|
||||
top.AddChild(price);
|
||||
center.AddChild(top);
|
||||
center.AddChild(_chart);
|
||||
@@ -424,6 +428,12 @@ public partial class MarketPanel : VBoxContainer
|
||||
var price = UiTheme.Text(PerUnit(w, g.Good, p.Price), 14, bold: true);
|
||||
price.CustomMinimumSize = new Vector2(110, 0);
|
||||
row.AddChild(price);
|
||||
// prezzo locale dell'industria spiegato dal server; gli hub comprano al prezzo mondiale meno il dazio
|
||||
if (p.Kind != SellPlaceInfo.Hub)
|
||||
{
|
||||
int good = g.Good, target = p.Target;
|
||||
WhyTooltip.Attach(price, () => new ExplainTarget(ExplainSubject.LocalPrice, good, target));
|
||||
}
|
||||
var line = UiTheme.Text(p.Line >= 0 ? LineName(w, p.Line) : T("non collegato"), 14, p.Line >= 0 ? Palette.TextSecondary : Palette.Amber);
|
||||
line.CustomMinimumSize = new Vector2(130, 0);
|
||||
line.ClipText = true;
|
||||
|
||||
Reference in new issue
Block a user