浏览器分栏与悬停提示;ASIC 状态栏;收款地址读档后刷新;加深市场深度
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7641336d60
commit
96cadfa411
14 files changed
+101
-30
No files matched your search
@@ -1,5 +1,12 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 未发布
|
||||||
|
|
||||||
|
- 浏览器:转出、转入分成两列,按列宽显示完整地址和名称,放不下时先去名称、再用缩写,鼠标悬停显示完整地址和名称。
|
||||||
|
- RatDigg 矿机的状态面板加了算力(GH/s)、耗电和成色(烧毁显示“已烧毁”),和矿架一致。
|
||||||
|
- 矿机、矿架状态面板里的收款地址在读档、睡觉之后会按标签重新读取,不再显示成“未设置”(地址本来就保存在物品标签里)。
|
||||||
|
- 市场深度:现货池基础深度 50,000 → 120,000,永续成交深度倍数 3 → 5。大额现货单和永续单的滑点明显变小(永续 20,000 名义价值的单边滑点约 3%,原来约 12%;现货买 20,000 价格约涨 36%,原来约 83%)。
|
||||||
|
|
||||||
## 1.0.0-rc9
|
## 1.0.0-rc9
|
||||||
|
|
||||||
- 终端刷新只重建页签栏、滚动内容和消息行,窗口框架和滚动视图保留:滚动位置不再回到顶部(换页或换子页签时才回顶);同一帧里的多次刷新合并成一次。
|
- 终端刷新只重建页签栏、滚动内容和消息行,窗口框架和滚动视图保留:滚动位置不再回到顶部(换页或换子页签时才回顶);同一帧里的多次刷新合并成一次。
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Decentralized.Domain
|
|||||||
public const double RefurbishHealth = 30;
|
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 DexFee = 0.003, ExchangeFee = 0.002;
|
||||||
public const double Revert = 0.15;
|
public const double Revert = 0.15;
|
||||||
public const double PscVol = 0.04;
|
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 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 PerpFundCoef = 0.10, PerpFundCap = 0.003;
|
||||||
/// <summary>永续的成交深度占现货主池的比例:开平仓的平均滑点 = 名义价值 / (深度倍数 × 池深),和现货一样大单更贵。</summary>
|
/// <summary>永续的成交深度占现货主池的比例:开平仓的平均滑点 = 名义价值 / (深度倍数 × 池深),和现货一样大单更贵。</summary>
|
||||||
public const double PerpDepthMult = 3.0;
|
public const double PerpDepthMult = 5.0;
|
||||||
/// <summary>开仓时按现价算权益至少要高出强平线多少(占名义价值的比例),否则拒绝(滑点太大,开了就被强平)。</summary>
|
/// <summary>开仓时按现价算权益至少要高出强平线多少(占名义价值的比例),否则拒绝(滑点太大,开了就被强平)。</summary>
|
||||||
public const double PerpOpenBuffer = 0.02;
|
public const double PerpOpenBuffer = 0.02;
|
||||||
public const double PerpDebtInterest = 0.02;
|
public const double PerpDebtInterest = 0.02;
|
||||||
|
|||||||
@@ -73,7 +73,10 @@ namespace Decentralized
|
|||||||
var battery = new GameSlotInventory();
|
var battery = new GameSlotInventory();
|
||||||
var modules = new GameGridInventory(MachineHelper.DEFAULT_MODULE_BAY_CONFIG, 7);
|
var modules = new GameGridInventory(MachineHelper.DEFAULT_MODULE_BAY_CONFIG, 7);
|
||||||
GameItem machine = null;
|
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,
|
var window = MachineHelper.CreateMachineryWindow(true,
|
||||||
MachineHelper.PowerPanel(battery),
|
MachineHelper.PowerPanel(battery),
|
||||||
MachineHelper.Panel(L.T("rig.label.modules"), modules, "module"),
|
MachineHelper.Panel(L.T("rig.label.modules"), modules, "module"),
|
||||||
@@ -81,6 +84,7 @@ namespace Decentralized
|
|||||||
var m = ItemDirectory.CreateEmptyItem(Id(spec.Model)).SetContentWindow(window);
|
var m = ItemDirectory.CreateEmptyItem(Id(spec.Model)).SetContentWindow(window);
|
||||||
machine = m;
|
machine = m;
|
||||||
Payout.Register(m, stAddr);
|
Payout.Register(m, stAddr);
|
||||||
|
RigStatus.Add(m, new[] { stHash, stPower, stCond });
|
||||||
m.SetSpriteAndShapeFromMod(ModInfo.Id, "asic_" + spec.Model.ToLowerInvariant());
|
m.SetSpriteAndShapeFromMod(ModInfo.Id, "asic_" + spec.Model.ToLowerInvariant());
|
||||||
m.name = L.T("item.asic.name", spec.Model);
|
m.name = L.T("item.asic.name", spec.Model);
|
||||||
m.unitValue = spec.Price;
|
m.unitValue = spec.Price;
|
||||||
@@ -105,6 +109,8 @@ namespace Decentralized
|
|||||||
int baseKj = (int)Math.Ceiling(u.Label.Kj);
|
int baseKj = (int)Math.Ceiling(u.Label.Kj);
|
||||||
m.ModifyTag("MACHINERY_DRAWN_POWER_BASE", s => s.Enable().SetInt(baseKj));
|
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))));
|
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);
|
Describe(m, u);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -620,6 +620,7 @@ namespace Decentralized
|
|||||||
int slots = SlotsOf(rig);
|
int slots = SlotsOf(rig);
|
||||||
rig.shortDescription = L.T("item.rig.desc", slots, Fmt.Num(hash * 10), kj);
|
rig.shortDescription = L.T("item.rig.desc", slots, Fmt.Num(hash * 10), kj);
|
||||||
RigStatus.Show(rig, Cards(cards).Count, slots, kj, hash * 10);
|
RigStatus.Show(rig, Cards(cards).Count, slots, kj, hash * 10);
|
||||||
|
Payout.Refresh(rig);
|
||||||
var next = RigSlots.Next(slots);
|
var next = RigSlots.Next(slots);
|
||||||
if (next != null)
|
if (next != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -904,7 +904,6 @@ explorer.search,Adresse
|
|||||||
explorer.all,Neueste
|
explorer.all,Neueste
|
||||||
explorer.none,Keine Überweisungen.
|
explorer.none,Keine Überweisungen.
|
||||||
explorer.col.block,Block
|
explorer.col.block,Block
|
||||||
explorer.col.flow,Von → An
|
|
||||||
explorer.col.amount,Betrag
|
explorer.col.amount,Betrag
|
||||||
explorer.mixer,Mixer
|
explorer.mixer,Mixer
|
||||||
cra.mint,Prägen
|
cra.mint,Prägen
|
||||||
@@ -950,3 +949,7 @@ explorer.day,Tag {0}
|
|||||||
explorer.pool,RatDigg-Pool
|
explorer.pool,RatDigg-Pool
|
||||||
explorer.desk,Ponero-Wechselstube
|
explorer.desk,Ponero-Wechselstube
|
||||||
black.fee.pay,Einstellgebühr zahlen
|
black.fee.pay,Einstellgebühr zahlen
|
||||||
|
explorer.col.from,Von
|
||||||
|
explorer.col.to,An
|
||||||
|
rig.st.cond,Zustand
|
||||||
|
asic.st.dead,Durchgebrannt
|
||||||
|
@@ -904,7 +904,6 @@ explorer.search,Address
|
|||||||
explorer.all,Latest
|
explorer.all,Latest
|
||||||
explorer.none,No transfers.
|
explorer.none,No transfers.
|
||||||
explorer.col.block,Block
|
explorer.col.block,Block
|
||||||
explorer.col.flow,From → To
|
|
||||||
explorer.col.amount,Amount
|
explorer.col.amount,Amount
|
||||||
explorer.mixer,Mixer
|
explorer.mixer,Mixer
|
||||||
cra.mint,Mint
|
cra.mint,Mint
|
||||||
@@ -950,3 +949,7 @@ explorer.day,Day {0}
|
|||||||
explorer.pool,RatDigg pool
|
explorer.pool,RatDigg pool
|
||||||
explorer.desk,Ponero desk
|
explorer.desk,Ponero desk
|
||||||
black.fee.pay,Pay listing fee
|
black.fee.pay,Pay listing fee
|
||||||
|
explorer.col.from,From
|
||||||
|
explorer.col.to,To
|
||||||
|
rig.st.cond,Condition
|
||||||
|
asic.st.dead,Burnt out
|
||||||
|
@@ -904,7 +904,6 @@ explorer.search,Dirección
|
|||||||
explorer.all,Recientes
|
explorer.all,Recientes
|
||||||
explorer.none,Sin transferencias.
|
explorer.none,Sin transferencias.
|
||||||
explorer.col.block,Bloque
|
explorer.col.block,Bloque
|
||||||
explorer.col.flow,De → A
|
|
||||||
explorer.col.amount,Cantidad
|
explorer.col.amount,Cantidad
|
||||||
explorer.mixer,Mezclador
|
explorer.mixer,Mezclador
|
||||||
cra.mint,Acuñar
|
cra.mint,Acuñar
|
||||||
@@ -950,3 +949,7 @@ explorer.day,Día {0}
|
|||||||
explorer.pool,pool de RatDigg
|
explorer.pool,pool de RatDigg
|
||||||
explorer.desk,mesa Ponero
|
explorer.desk,mesa Ponero
|
||||||
black.fee.pay,Pagar la tarifa de publicación
|
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
|
||||||
|
@@ -904,7 +904,6 @@ explorer.search,Adresse
|
|||||||
explorer.all,Récent
|
explorer.all,Récent
|
||||||
explorer.none,Aucun transfert.
|
explorer.none,Aucun transfert.
|
||||||
explorer.col.block,Bloc
|
explorer.col.block,Bloc
|
||||||
explorer.col.flow,De → Vers
|
|
||||||
explorer.col.amount,Montant
|
explorer.col.amount,Montant
|
||||||
explorer.mixer,Mixeur
|
explorer.mixer,Mixeur
|
||||||
cra.mint,Frapper
|
cra.mint,Frapper
|
||||||
@@ -950,3 +949,7 @@ explorer.day,Jour {0}
|
|||||||
explorer.pool,pool RatDigg
|
explorer.pool,pool RatDigg
|
||||||
explorer.desk,bureau Ponero
|
explorer.desk,bureau Ponero
|
||||||
black.fee.pay,Payer les frais de mise en vente
|
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é
|
||||||
|
@@ -904,7 +904,6 @@ explorer.search,アドレス
|
|||||||
explorer.all,最新
|
explorer.all,最新
|
||||||
explorer.none,送金履歴はありません。
|
explorer.none,送金履歴はありません。
|
||||||
explorer.col.block,ブロック
|
explorer.col.block,ブロック
|
||||||
explorer.col.flow,送信元 → 送信先
|
|
||||||
explorer.col.amount,数量
|
explorer.col.amount,数量
|
||||||
explorer.mixer,ミキサー
|
explorer.mixer,ミキサー
|
||||||
cra.mint,ミント
|
cra.mint,ミント
|
||||||
@@ -950,3 +949,7 @@ explorer.day,{0}日目
|
|||||||
explorer.pool,RatDiggプール
|
explorer.pool,RatDiggプール
|
||||||
explorer.desk,Ponero両替所
|
explorer.desk,Ponero両替所
|
||||||
black.fee.pay,出品手数料を支払う
|
black.fee.pay,出品手数料を支払う
|
||||||
|
explorer.col.from,送信元
|
||||||
|
explorer.col.to,送信先
|
||||||
|
rig.st.cond,コンディション
|
||||||
|
asic.st.dead,焼損
|
||||||
|
Can't render this file because it contains an unexpected character in line 488 and column 24.
|
@@ -904,7 +904,6 @@ explorer.search,Adres
|
|||||||
explorer.all,Najnowsze
|
explorer.all,Najnowsze
|
||||||
explorer.none,Brak transferów.
|
explorer.none,Brak transferów.
|
||||||
explorer.col.block,Blok
|
explorer.col.block,Blok
|
||||||
explorer.col.flow,Od → Do
|
|
||||||
explorer.col.amount,Kwota
|
explorer.col.amount,Kwota
|
||||||
explorer.mixer,Mikser
|
explorer.mixer,Mikser
|
||||||
cra.mint,Wybij
|
cra.mint,Wybij
|
||||||
@@ -950,3 +949,7 @@ explorer.day,Dzień {0}
|
|||||||
explorer.pool,pula RatDigg
|
explorer.pool,pula RatDigg
|
||||||
explorer.desk,kantor Ponero
|
explorer.desk,kantor Ponero
|
||||||
black.fee.pay,Zapłać opłatę za wystawienie
|
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
|
||||||
|
@@ -904,7 +904,6 @@ explorer.search,Адрес
|
|||||||
explorer.all,Последние
|
explorer.all,Последние
|
||||||
explorer.none,Переводов нет.
|
explorer.none,Переводов нет.
|
||||||
explorer.col.block,Блок
|
explorer.col.block,Блок
|
||||||
explorer.col.flow,От → Кому
|
|
||||||
explorer.col.amount,Сумма
|
explorer.col.amount,Сумма
|
||||||
explorer.mixer,Миксер
|
explorer.mixer,Миксер
|
||||||
cra.mint,Минт
|
cra.mint,Минт
|
||||||
@@ -950,3 +949,7 @@ explorer.day,День {0}
|
|||||||
explorer.pool,пул RatDigg
|
explorer.pool,пул RatDigg
|
||||||
explorer.desk,обменник Ponero
|
explorer.desk,обменник Ponero
|
||||||
black.fee.pay,Оплата комиссии за размещение
|
black.fee.pay,Оплата комиссии за размещение
|
||||||
|
explorer.col.from,От
|
||||||
|
explorer.col.to,Кому
|
||||||
|
rig.st.cond,Состояние
|
||||||
|
asic.st.dead,Сгорел
|
||||||
|
@@ -903,7 +903,6 @@ explorer.search,地址
|
|||||||
explorer.all,最近
|
explorer.all,最近
|
||||||
explorer.none,没有转账记录。
|
explorer.none,没有转账记录。
|
||||||
explorer.col.block,区块
|
explorer.col.block,区块
|
||||||
explorer.col.flow,转出 → 转入
|
|
||||||
explorer.col.amount,数额
|
explorer.col.amount,数额
|
||||||
explorer.mixer,混币器
|
explorer.mixer,混币器
|
||||||
cra.mint,铸造
|
cra.mint,铸造
|
||||||
@@ -949,3 +948,7 @@ explorer.day,第 {0} 天
|
|||||||
explorer.pool,RatDigg 矿池
|
explorer.pool,RatDigg 矿池
|
||||||
explorer.desk,Ponero 兑换处
|
explorer.desk,Ponero 兑换处
|
||||||
black.fee.pay,支付平台费
|
black.fee.pay,支付平台费
|
||||||
|
explorer.col.from,转出
|
||||||
|
explorer.col.to,转入
|
||||||
|
rig.st.cond,成色
|
||||||
|
asic.st.dead,已烧毁
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
namespace Decentralized
|
namespace Decentralized
|
||||||
{
|
{
|
||||||
@@ -16,5 +17,14 @@ namespace Decentralized
|
|||||||
t[1].SetStatus(L.T("rig.st.power"), L.T("rig.st.kj", kj));
|
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");
|
t[2].SetStatus(L.T("rig.st.hash"), $"{Fmt.Num(mhs)} MH/s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>RatDigg 矿机的状态面板:算力、耗电、成色(烧毁显示“已烧毁”)。</summary>
|
||||||
|
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) + "%");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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");
|
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);
|
b.BeginPanel(w, 26f * F, align, 0f, 0f);
|
||||||
_clear.Add(b.Last.image);
|
_clear.Add(b.Last.image);
|
||||||
|
if (!string.IsNullOrEmpty(tip)) b.WithTooltip(tip);
|
||||||
b.AddLabel(header ? "<b>" + text + "</b>" : text);
|
b.AddLabel(header ? "<b>" + text + "</b>" : text);
|
||||||
PledgerSkin.FitCurrent(b);
|
PledgerSkin.FitCurrent(b);
|
||||||
b.End();
|
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);
|
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 });
|
_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++)
|
for (int i = 0; i < widths.Length; i++)
|
||||||
{
|
{
|
||||||
var align = (aligns != null && i < aligns.Length) ? aligns[i] : (i == 0 ? TextAnchor.MiddleLeft : TextAnchor.MiddleRight);
|
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();
|
||||||
b.End();
|
b.End();
|
||||||
@@ -1487,26 +1488,42 @@ namespace Decentralized
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string _explorerQuery = "";
|
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 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>
|
/// <summary>地址的显示名:自己的钱包、Poinbase、混币器、全网矿池、黑市卖家,其余是缩写。</summary>
|
||||||
private static string AddressLabel(string a)
|
/// <summary>地址的名称:自己的钱包、矿池、Poinbase、混币器、灰网平台、兑换处、商家类型;没有名称返回 null。</summary>
|
||||||
|
private static string AddressName(string a)
|
||||||
{
|
{
|
||||||
var d = Session.Data;
|
var d = Session.Data;
|
||||||
if (string.IsNullOrEmpty(a)) return "—";
|
if (string.IsNullOrEmpty(a)) return null;
|
||||||
if (a == "network") a = d.Address("pool");
|
if (a == "network") a = d.Address("pool");
|
||||||
string name = null;
|
|
||||||
var own = d.Own(a);
|
var own = d.Own(a);
|
||||||
if (own != null) name = WalletWindow.NameOf(own);
|
if (own != null) return WalletWindow.NameOf(own);
|
||||||
else if (ChainAddress.Same(a, d.Address("pool"))) name = L.T("explorer.pool");
|
if (ChainAddress.Same(a, d.Address("pool"))) return L.T("explorer.pool");
|
||||||
else if (ChainAddress.Same(a, d.Address("poinbase"))) name = "Poinbase";
|
if (ChainAddress.Same(a, d.Address("poinbase"))) return "Poinbase";
|
||||||
else if (d.Addresses.TryGetValue("mixer", out var mx) && ChainAddress.Same(a, mx)) name = L.T("explorer.mixer");
|
if (d.Addresses.TryGetValue("mixer", out var mx) && ChainAddress.Same(a, mx)) return L.T("explorer.mixer");
|
||||||
else if (d.Addresses.TryGetValue("platform", out var pf) && ChainAddress.Same(a, pf)) name = L.T("merchant.Platform");
|
if (d.Addresses.TryGetValue("platform", out var pf) && ChainAddress.Same(a, pf)) return L.T("merchant.Platform");
|
||||||
else if (d.Addresses.TryGetValue("desk", out var dk) && ChainAddress.Same(a, dk)) name = L.T("explorer.desk");
|
if (d.Addresses.TryGetValue("desk", out var dk) && ChainAddress.Same(a, dk)) return 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); }
|
var sl = d.Black.Sellers.FirstOrDefault(x => ChainAddress.Same(x.Name, a));
|
||||||
return ChainAddress.Short(a) + (name != null ? " (" + name + ")" : "");
|
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>
|
/// <summary>浏览器:公共数据,不需要连接钱包。查任意地址的转账,只显示真实发生的。</summary>
|
||||||
@@ -1531,10 +1548,16 @@ namespace Decentralized
|
|||||||
b.AddSeparator();
|
b.AddSeparator();
|
||||||
var rows = d.Ledger.Of(_explorerQuery, Tuning.LedgerShow);
|
var rows = d.Ledger.Of(_explorerQuery, Tuning.LedgerShow);
|
||||||
if (rows.Count == 0) { b.AddLabel(L.T("explorer.none"), "explorer_none_dim"); return; }
|
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)
|
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 }
|
private enum BlackTab { Buy, Sell, Orders }
|
||||||
|
|||||||
Reference in new issue
Block a user