diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bd6f3e..88504d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## 未发布 + +- 浏览器:转出、转入分成两列,按列宽显示完整地址和名称,放不下时先去名称、再用缩写,鼠标悬停显示完整地址和名称。 +- RatDigg 矿机的状态面板加了算力(GH/s)、耗电和成色(烧毁显示“已烧毁”),和矿架一致。 +- 矿机、矿架状态面板里的收款地址在读档、睡觉之后会按标签重新读取,不再显示成“未设置”(地址本来就保存在物品标签里)。 +- 市场深度:现货池基础深度 50,000 → 120,000,永续成交深度倍数 3 → 5。大额现货单和永续单的滑点明显变小(永续 20,000 名义价值的单边滑点约 3%,原来约 12%;现货买 20,000 价格约涨 36%,原来约 83%)。 + ## 1.0.0-rc9 - 终端刷新只重建页签栏、滚动内容和消息行,窗口框架和滚动视图保留:滚动位置不再回到顶部(换页或换子页签时才回顶);同一帧里的多次刷新合并成一次。 diff --git a/src/Decentralized.Domain/Tuning.cs b/src/Decentralized.Domain/Tuning.cs index 80a22b8..c20afde 100644 --- a/src/Decentralized.Domain/Tuning.cs +++ b/src/Decentralized.Domain/Tuning.cs @@ -33,7 +33,7 @@ namespace Decentralized.Domain public const double RefurbishHealth = 30; // 市场 - public const double PoolDepth0 = 50000; + public const double PoolDepth0 = 120000; public const double DexFee = 0.003, ExchangeFee = 0.002; public const double Revert = 0.15; public const double PscVol = 0.04; @@ -203,7 +203,7 @@ namespace Decentralized.Domain public const double PerpFund0 = 10000, PerpFundDrift = 150, PerpFundShock = 2000, PerpShockFree = 0.06, PerpFeeToFund = 0.3, PerpAdlHaircut = 0.5; public const double PerpFundCoef = 0.10, PerpFundCap = 0.003; /// 永续的成交深度占现货主池的比例:开平仓的平均滑点 = 名义价值 / (深度倍数 × 池深),和现货一样大单更贵。 - public const double PerpDepthMult = 3.0; + public const double PerpDepthMult = 5.0; /// 开仓时按现价算权益至少要高出强平线多少(占名义价值的比例),否则拒绝(滑点太大,开了就被强平)。 public const double PerpOpenBuffer = 0.02; public const double PerpDebtInterest = 0.02; diff --git a/src/Decentralized/AsicItems.cs b/src/Decentralized/AsicItems.cs index d6f26d9..59d9c29 100644 --- a/src/Decentralized/AsicItems.cs +++ b/src/Decentralized/AsicItems.cs @@ -73,7 +73,10 @@ namespace Decentralized var battery = new GameSlotInventory(); var modules = new GameGridInventory(MachineHelper.DEFAULT_MODULE_BAY_CONFIG, 7); GameItem machine = null; - var addr = Payout.Build(() => machine, out var stAddr); + var stHash = new MachineryText("", 6, TMPro.HorizontalAlignmentOptions.Left, false); + var stPower = new MachineryText("", 6, TMPro.HorizontalAlignmentOptions.Left, false); + var stCond = new MachineryText("", 6, TMPro.HorizontalAlignmentOptions.Left, false); + var addr = new MachineryStack(true, 6).Add(stHash).Add(stPower).Add(stCond).Add(Payout.Build(() => machine, out var stAddr)); var window = MachineHelper.CreateMachineryWindow(true, MachineHelper.PowerPanel(battery), MachineHelper.Panel(L.T("rig.label.modules"), modules, "module"), @@ -81,6 +84,7 @@ namespace Decentralized var m = ItemDirectory.CreateEmptyItem(Id(spec.Model)).SetContentWindow(window); machine = m; Payout.Register(m, stAddr); + RigStatus.Add(m, new[] { stHash, stPower, stCond }); m.SetSpriteAndShapeFromMod(ModInfo.Id, "asic_" + spec.Model.ToLowerInvariant()); m.name = L.T("item.asic.name", spec.Model); m.unitValue = spec.Price; @@ -105,6 +109,8 @@ namespace Decentralized int baseKj = (int)Math.Ceiling(u.Label.Kj); m.ModifyTag("MACHINERY_DRAWN_POWER_BASE", s => s.Enable().SetInt(baseKj)); m.ModifyTag(MachineryHelper.MACHINERY_DRAWN_POWER, s => s.Enable().SetInt(u.Dead ? 0 : (int)Math.Ceiling(u.Kj(b)))); + RigStatus.ShowAsic(m, u.Dead ? 0 : u.Hash(b) * 10 / 1000, u.Dead ? 0 : (int)Math.Ceiling(u.Kj(b)), u.Health, u.Dead); + Payout.Refresh(m); Describe(m, u); } diff --git a/src/Decentralized/Items.cs b/src/Decentralized/Items.cs index df97589..e985d7d 100644 --- a/src/Decentralized/Items.cs +++ b/src/Decentralized/Items.cs @@ -620,6 +620,7 @@ namespace Decentralized int slots = SlotsOf(rig); rig.shortDescription = L.T("item.rig.desc", slots, Fmt.Num(hash * 10), kj); RigStatus.Show(rig, Cards(cards).Count, slots, kj, hash * 10); + Payout.Refresh(rig); var next = RigSlots.Next(slots); if (next != null) { diff --git a/src/Decentralized/ModFiles/Localization/de.csv b/src/Decentralized/ModFiles/Localization/de.csv index 105957c..fd1c1fa 100644 --- a/src/Decentralized/ModFiles/Localization/de.csv +++ b/src/Decentralized/ModFiles/Localization/de.csv @@ -904,7 +904,6 @@ explorer.search,Adresse explorer.all,Neueste explorer.none,Keine Überweisungen. explorer.col.block,Block -explorer.col.flow,Von → An explorer.col.amount,Betrag explorer.mixer,Mixer cra.mint,Prägen @@ -950,3 +949,7 @@ explorer.day,Tag {0} explorer.pool,RatDigg-Pool explorer.desk,Ponero-Wechselstube black.fee.pay,Einstellgebühr zahlen +explorer.col.from,Von +explorer.col.to,An +rig.st.cond,Zustand +asic.st.dead,Durchgebrannt diff --git a/src/Decentralized/ModFiles/Localization/en.csv b/src/Decentralized/ModFiles/Localization/en.csv index dd882f3..d02d50e 100644 --- a/src/Decentralized/ModFiles/Localization/en.csv +++ b/src/Decentralized/ModFiles/Localization/en.csv @@ -904,7 +904,6 @@ explorer.search,Address explorer.all,Latest explorer.none,No transfers. explorer.col.block,Block -explorer.col.flow,From → To explorer.col.amount,Amount explorer.mixer,Mixer cra.mint,Mint @@ -950,3 +949,7 @@ explorer.day,Day {0} explorer.pool,RatDigg pool explorer.desk,Ponero desk black.fee.pay,Pay listing fee +explorer.col.from,From +explorer.col.to,To +rig.st.cond,Condition +asic.st.dead,Burnt out diff --git a/src/Decentralized/ModFiles/Localization/es.csv b/src/Decentralized/ModFiles/Localization/es.csv index 2c2a52e..1c488ec 100644 --- a/src/Decentralized/ModFiles/Localization/es.csv +++ b/src/Decentralized/ModFiles/Localization/es.csv @@ -904,7 +904,6 @@ explorer.search,Dirección explorer.all,Recientes explorer.none,Sin transferencias. explorer.col.block,Bloque -explorer.col.flow,De → A explorer.col.amount,Cantidad explorer.mixer,Mezclador cra.mint,Acuñar @@ -950,3 +949,7 @@ explorer.day,Día {0} explorer.pool,pool de RatDigg explorer.desk,mesa Ponero black.fee.pay,Pagar la tarifa de publicación +explorer.col.from,De +explorer.col.to,A +rig.st.cond,Condición +asic.st.dead,Quemado diff --git a/src/Decentralized/ModFiles/Localization/fr.csv b/src/Decentralized/ModFiles/Localization/fr.csv index 2bee12f..c7bdca3 100644 --- a/src/Decentralized/ModFiles/Localization/fr.csv +++ b/src/Decentralized/ModFiles/Localization/fr.csv @@ -904,7 +904,6 @@ explorer.search,Adresse explorer.all,Récent explorer.none,Aucun transfert. explorer.col.block,Bloc -explorer.col.flow,De → Vers explorer.col.amount,Montant explorer.mixer,Mixeur cra.mint,Frapper @@ -950,3 +949,7 @@ explorer.day,Jour {0} explorer.pool,pool RatDigg explorer.desk,bureau Ponero black.fee.pay,Payer les frais de mise en vente +explorer.col.from,De +explorer.col.to,Vers +rig.st.cond,Condition +asic.st.dead,Grillé diff --git a/src/Decentralized/ModFiles/Localization/ja.csv b/src/Decentralized/ModFiles/Localization/ja.csv index ed6a564..c01a05c 100644 --- a/src/Decentralized/ModFiles/Localization/ja.csv +++ b/src/Decentralized/ModFiles/Localization/ja.csv @@ -904,7 +904,6 @@ explorer.search,アドレス explorer.all,最新 explorer.none,送金履歴はありません。 explorer.col.block,ブロック -explorer.col.flow,送信元 → 送信先 explorer.col.amount,数量 explorer.mixer,ミキサー cra.mint,ミント @@ -950,3 +949,7 @@ explorer.day,{0}日目 explorer.pool,RatDiggプール explorer.desk,Ponero両替所 black.fee.pay,出品手数料を支払う +explorer.col.from,送信元 +explorer.col.to,送信先 +rig.st.cond,コンディション +asic.st.dead,焼損 diff --git a/src/Decentralized/ModFiles/Localization/pl.csv b/src/Decentralized/ModFiles/Localization/pl.csv index 2f56130..9ecd258 100644 --- a/src/Decentralized/ModFiles/Localization/pl.csv +++ b/src/Decentralized/ModFiles/Localization/pl.csv @@ -904,7 +904,6 @@ explorer.search,Adres explorer.all,Najnowsze explorer.none,Brak transferów. explorer.col.block,Blok -explorer.col.flow,Od → Do explorer.col.amount,Kwota explorer.mixer,Mikser cra.mint,Wybij @@ -950,3 +949,7 @@ explorer.day,Dzień {0} explorer.pool,pula RatDigg explorer.desk,kantor Ponero black.fee.pay,Zapłać opłatę za wystawienie +explorer.col.from,Od +explorer.col.to,Do +rig.st.cond,Kondycja +asic.st.dead,Spalony diff --git a/src/Decentralized/ModFiles/Localization/ru.csv b/src/Decentralized/ModFiles/Localization/ru.csv index b152590..5bbb960 100644 --- a/src/Decentralized/ModFiles/Localization/ru.csv +++ b/src/Decentralized/ModFiles/Localization/ru.csv @@ -904,7 +904,6 @@ explorer.search,Адрес explorer.all,Последние explorer.none,Переводов нет. explorer.col.block,Блок -explorer.col.flow,От → Кому explorer.col.amount,Сумма explorer.mixer,Миксер cra.mint,Минт @@ -950,3 +949,7 @@ explorer.day,День {0} explorer.pool,пул RatDigg explorer.desk,обменник Ponero black.fee.pay,Оплата комиссии за размещение +explorer.col.from,От +explorer.col.to,Кому +rig.st.cond,Состояние +asic.st.dead,Сгорел diff --git a/src/Decentralized/ModFiles/Localization/zh.csv b/src/Decentralized/ModFiles/Localization/zh.csv index c7eab39..25e3009 100644 --- a/src/Decentralized/ModFiles/Localization/zh.csv +++ b/src/Decentralized/ModFiles/Localization/zh.csv @@ -903,7 +903,6 @@ explorer.search,地址 explorer.all,最近 explorer.none,没有转账记录。 explorer.col.block,区块 -explorer.col.flow,转出 → 转入 explorer.col.amount,数额 explorer.mixer,混币器 cra.mint,铸造 @@ -949,3 +948,7 @@ explorer.day,第 {0} 天 explorer.pool,RatDigg 矿池 explorer.desk,Ponero 兑换处 black.fee.pay,支付平台费 +explorer.col.from,转出 +explorer.col.to,转入 +rig.st.cond,成色 +asic.st.dead,已烧毁 diff --git a/src/Decentralized/RigStatus.cs b/src/Decentralized/RigStatus.cs index 3115cc7..0c37562 100644 --- a/src/Decentralized/RigStatus.cs +++ b/src/Decentralized/RigStatus.cs @@ -1,4 +1,5 @@ using System.Runtime.CompilerServices; +using UnityEngine; namespace Decentralized { @@ -16,5 +17,14 @@ namespace Decentralized t[1].SetStatus(L.T("rig.st.power"), L.T("rig.st.kj", kj)); t[2].SetStatus(L.T("rig.st.hash"), $"{Fmt.Num(mhs)} MH/s"); } + + /// RatDigg 矿机的状态面板:算力、耗电、成色(烧毁显示“已烧毁”)。 + public static void ShowAsic(GameItem m, double ghs, int kj, double health, bool dead) + { + if (!Table.TryGetValue(m, out var t) || t.Length < 3) return; + t[0].SetStatus(L.T("rig.st.hash"), $"{Fmt.Num(ghs)} GH/s"); + t[1].SetStatus(L.T("rig.st.power"), L.T("rig.st.kj", kj)); + t[2].SetStatus(L.T("rig.st.cond"), dead ? L.T("asic.st.dead") : Mathf.RoundToInt((float)health) + "%"); + } } } diff --git a/src/Decentralized/TerminalWindow.cs b/src/Decentralized/TerminalWindow.cs index 9061a6c..ab97b9f 100644 --- a/src/Decentralized/TerminalWindow.cs +++ b/src/Decentralized/TerminalWindow.cs @@ -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 ? "" + text + "" : 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 }; /// 地址的显示名:自己的钱包、Poinbase、混币器、全网矿池、黑市卖家,其余是缩写。 - private static string AddressLabel(string a) + /// 地址的名称:自己的钱包、矿池、Poinbase、混币器、灰网平台、兑换处、商家类型;没有名称返回 null。 + 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; + + /// 按列宽选显示内容:完整地址加名称放得下就都显示;放不下先去掉名称,再用缩写;被省略的地方给悬停提示(完整地址和名称)。 + 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); } /// 浏览器:公共数据,不需要连接钱包。查任意地址的转账,只显示真实发生的。 @@ -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 }