浏览器分栏与悬停提示;ASIC 状态栏;收款地址读档后刷新;加深市场深度

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-05 22:25:48 +08:00
1 parent 7641336d60
commit 96cadfa411
14 files changed
+101 -30

No files matched your search

+42 -19
View File
@@ -226,16 +226,17 @@ namespace Decentralized
b.AddLabel(r == null ? L.T("report.none") : L.T("home.lastnight", r.Day, Fmt.Num(r.Mined), r.PoweredRigs, r.Rigs), "report_dim");
}
private static void Cell(CustomUIBuilder b, float w, string text, bool header = false, TextAnchor align = TextAnchor.MiddleLeft)
private static void Cell(CustomUIBuilder b, float w, string text, bool header = false, TextAnchor align = TextAnchor.MiddleLeft, string tip = null)
{
b.BeginPanel(w, 26f * F, align, 0f, 0f);
_clear.Add(b.Last.image);
if (!string.IsNullOrEmpty(tip)) b.WithTooltip(tip);
b.AddLabel(header ? "<b>" + text + "</b>" : text);
PledgerSkin.FitCurrent(b);
b.End();
}
private static void TableRow(CustomUIBuilder b, float totalW, float[] widths, TextAnchor[] aligns, string[] cells, bool selected = false, Action onClick = null)
private static void TableRow(CustomUIBuilder b, float totalW, float[] widths, TextAnchor[] aligns, string[] cells, bool selected = false, Action onClick = null, string[] tips = null)
{
b.BeginPanel(totalW, 28f * F, TextAnchor.MiddleLeft, 4f, 0f);
_rows.Add(new PledgerSkin.RowDef { Root = b.Last.root, Image = b.Last.image, Selected = selected, OnClick = onClick });
@@ -243,7 +244,7 @@ namespace Decentralized
for (int i = 0; i < widths.Length; i++)
{
var align = (aligns != null && i < aligns.Length) ? aligns[i] : (i == 0 ? TextAnchor.MiddleLeft : TextAnchor.MiddleRight);
Cell(b, widths[i], i < cells.Length ? cells[i] : "", false, align);
Cell(b, widths[i], i < cells.Length ? cells[i] : "", false, align, tips != null && i < tips.Length ? tips[i] : null);
}
b.End();
b.End();
@@ -1487,26 +1488,42 @@ namespace Decentralized
}
private static string _explorerQuery = "";
private static readonly float[] ExplWBase = new[] { 70f, 60f, 390f, 130f };
private static readonly float[] ExplWBase = new[] { 62f, 56f, 212f, 212f, 118f };
private static float[] ExplW => Sc(ExplWBase);
private static readonly TextAnchor[] ExplAligns = { TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, TextAnchor.MiddleRight };
private static readonly TextAnchor[] ExplAligns = { TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, TextAnchor.MiddleLeft, TextAnchor.MiddleRight };
/// <summary>地址的显示名:自己的钱包、Poinbase、混币器、全网矿池、黑市卖家,其余是缩写。</summary>
private static string AddressLabel(string a)
/// <summary>地址的名称:自己的钱包、矿池、Poinbase、混币器、灰网平台、兑换处、商家类型;没有名称返回 null。</summary>
private static string AddressName(string a)
{
var d = Session.Data;
if (string.IsNullOrEmpty(a)) return "—";
if (string.IsNullOrEmpty(a)) return null;
if (a == "network") a = d.Address("pool");
string name = null;
var own = d.Own(a);
if (own != null) name = WalletWindow.NameOf(own);
else if (ChainAddress.Same(a, d.Address("pool"))) name = L.T("explorer.pool");
else if (ChainAddress.Same(a, d.Address("poinbase"))) name = "Poinbase";
else if (d.Addresses.TryGetValue("mixer", out var mx) && ChainAddress.Same(a, mx)) name = L.T("explorer.mixer");
else if (d.Addresses.TryGetValue("platform", out var pf) && ChainAddress.Same(a, pf)) name = L.T("merchant.Platform");
else if (d.Addresses.TryGetValue("desk", out var dk) && ChainAddress.Same(a, dk)) name = L.T("explorer.desk");
else { var sl = d.Black.Sellers.FirstOrDefault(x => ChainAddress.Same(x.Name, a)); if (sl != null) name = L.T("merchant." + sl.Type); }
return ChainAddress.Short(a) + (name != null ? " (" + name + ")" : "");
if (own != null) return WalletWindow.NameOf(own);
if (ChainAddress.Same(a, d.Address("pool"))) return L.T("explorer.pool");
if (ChainAddress.Same(a, d.Address("poinbase"))) return "Poinbase";
if (d.Addresses.TryGetValue("mixer", out var mx) && ChainAddress.Same(a, mx)) return L.T("explorer.mixer");
if (d.Addresses.TryGetValue("platform", out var pf) && ChainAddress.Same(a, pf)) return L.T("merchant.Platform");
if (d.Addresses.TryGetValue("desk", out var dk) && ChainAddress.Same(a, dk)) return L.T("explorer.desk");
var sl = d.Black.Sellers.FirstOrDefault(x => ChainAddress.Same(x.Name, a));
return sl != null ? L.T("merchant." + sl.Type) : null;
}
private static string AddressFull(string a) => string.IsNullOrEmpty(a) ? "—" : a == "network" ? Session.Data.Address("pool") : ChainAddress.Normalize(a);
private static float TextPx(string t) => t.Sum(c => c > 0x2E80 ? 16f : 8.2f) * F;
/// <summary>按列宽选显示内容:完整地址加名称放得下就都显示;放不下先去掉名称,再用缩写;被省略的地方给悬停提示(完整地址和名称)。</summary>
private static void AddressCell(string a, float width, out string text, out string tip)
{
string full = AddressFull(a), name = AddressName(a);
string both = name != null ? full + " (" + name + ")" : full;
float avail = (width - 8f) * 1.15f;
tip = null;
if (TextPx(both) <= avail) { text = both; return; }
tip = both;
text = TextPx(full) <= avail ? full : ChainAddress.Short(full);
}
/// <summary>浏览器:公共数据,不需要连接钱包。查任意地址的转账,只显示真实发生的。</summary>
@@ -1531,10 +1548,16 @@ namespace Decentralized
b.AddSeparator();
var rows = d.Ledger.Of(_explorerQuery, Tuning.LedgerShow);
if (rows.Count == 0) { b.AddLabel(L.T("explorer.none"), "explorer_none_dim"); return; }
TableHeader(b, ExplW.Sum() + 8f, ExplW, ExplAligns, L.T("explorer.col.block"), L.T("explorer.col.day"), L.T("explorer.col.flow"), L.T("explorer.col.amount"));
TableHeader(b, ExplW.Sum() + 8f, ExplW, ExplAligns, L.T("explorer.col.block"), L.T("explorer.col.day"), L.T("explorer.col.from"), L.T("explorer.col.to"), L.T("explorer.col.amount"));
var ew = ExplW;
foreach (var e in rows)
TableRow(b, ExplW.Sum() + 8f, ExplW, ExplAligns,
new[] { "#" + e.Block, L.T("explorer.day", e.Day), AddressLabel(e.From) + " → " + AddressLabel(e.To), Fmt.Num(e.Amount) + " " + e.Asset });
{
AddressCell(e.From, ew[2], out string fromText, out string fromTip);
AddressCell(e.To, ew[3], out string toText, out string toTip);
TableRow(b, ew.Sum() + 8f, ew, ExplAligns,
new[] { "#" + e.Block, L.T("explorer.day", e.Day), fromText, toText, Fmt.Num(e.Amount) + " " + e.Asset },
false, null, new[] { null, null, fromTip, toTip, null });
}
}
private enum BlackTab { Buy, Sell, Orders }