Terminal: home with three entries (Bank, Poinbase, Web3) plus report; entry icons
Bank shows real credits, rent and deposits/withdrawals; Poinbase is the compliant exchange; Web3 is the wallet and decentralised trading. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
ce95ec923d
commit
9441d4d1bd
8 files changed
+211
-23
No files matched your search
@@ -18,8 +18,6 @@ item.gpu.desc,"Rated hashrate {0} MH/s. Rated draw {1} kJ per day. Condition: {2
|
||||
item.gpu.burnt.name,Burnt {0} {1}
|
||||
item.gpu.burnt.desc,This card no longer works.
|
||||
term.title,Trading Terminal
|
||||
tab.wallet,Wallet
|
||||
tab.trade,Trade
|
||||
tab.report,Report
|
||||
wallet.line,"{0}: {1} (about {2} credits)"
|
||||
wallet.empty,The wallet is empty.
|
||||
@@ -129,3 +127,24 @@ lbl.ev.print.1,"Print shows another model"
|
||||
lbl.ev.print.2,"Print was redone"
|
||||
news.prehalving.title,"PSC Halving Ahead"
|
||||
news.prehalving.desc,"Miners will receive half as many coins per night in three days. Holders expect the price to rise."
|
||||
tab.home,"Home"
|
||||
tab.bank,"Bank"
|
||||
tab.poinbase,"Poinbase"
|
||||
tab.web3,"Web3"
|
||||
home.enter,"Enter"
|
||||
home.summary,"Credits {0} | On-chain assets about {1} credits"
|
||||
home.lastnight,"Night of day {0}: mined {1} PSC, {2} / {3} rigs powered"
|
||||
entry.bank,"Bank"
|
||||
entry.bank.l1,"Deposits, withdrawals, rent"
|
||||
entry.bank.l2,"Credits {0}"
|
||||
entry.poinbase,"Poinbase"
|
||||
entry.poinbase.l1,"Compliant exchange"
|
||||
entry.poinbase.l2,"PSC {0} credits"
|
||||
entry.web3,"Web3"
|
||||
entry.web3.l1,"Wallet and decentralised trading"
|
||||
entry.web3.l2,"About {0} credits"
|
||||
bank.cash,"Credits: {0}"
|
||||
bank.rent,"Rent: {0} credits, due in {1} days"
|
||||
bank.crc,"Poinbase account (CRC): {0}"
|
||||
bank.hint,"Deposit turns credits into CRC; withdrawing turns CRC back into credits and passes compliance review."
|
||||
poin.account,"Poinbase account: CRC {0}, PSC {1}"
|
||||
|
@@ -17,8 +17,6 @@ item.gpu.desc,标称算力 {0} MH/s。标称耗电 {1} kJ/天。成色 {2}。
|
||||
item.gpu.burnt.name,烧毁的 {0} {1}
|
||||
item.gpu.burnt.desc,此显卡已无法工作。
|
||||
term.title,交易终端
|
||||
tab.wallet,钱包
|
||||
tab.trade,交易
|
||||
tab.report,报告
|
||||
wallet.line,{0}:{1}(约 {2} 信用点)
|
||||
wallet.empty,钱包为空。
|
||||
@@ -128,3 +126,24 @@ lbl.ev.print.1,"丝印印着另一个型号"
|
||||
lbl.ev.print.2,"丝印重印过"
|
||||
news.prehalving.title,"PSC 即将减半"
|
||||
news.prehalving.desc,"三天后矿工每晚获得的币减半。持币者预期币价上行。"
|
||||
tab.home,"首页"
|
||||
tab.bank,"银行"
|
||||
tab.poinbase,"Poinbase"
|
||||
tab.web3,"Web3"
|
||||
home.enter,"进入"
|
||||
home.summary,"信用点 {0} | 链上资产约 {1} 信用点"
|
||||
home.lastnight,"第 {0} 天夜间:挖出 {1} PSC,{2} / {3} 个矿架有电"
|
||||
entry.bank,"银行"
|
||||
entry.bank.l1,"信用点存取、房租"
|
||||
entry.bank.l2,"信用点 {0}"
|
||||
entry.poinbase,"Poinbase"
|
||||
entry.poinbase.l1,"合规交易所"
|
||||
entry.poinbase.l2,"PSC {0} 信用点"
|
||||
entry.web3,"Web3"
|
||||
entry.web3.l1,"钱包与去中心化交易"
|
||||
entry.web3.l2,"约 {0} 信用点"
|
||||
bank.cash,"信用点:{0}"
|
||||
bank.rent,"房租:{0} 信用点,{1} 天后支付"
|
||||
bank.crc,"Poinbase 账户(CRC):{0}"
|
||||
bank.hint,"存入把信用点换成 CRC,提取把 CRC 换回信用点,提取要过合规审查。"
|
||||
poin.account,"Poinbase 账户:CRC {0},PSC {1}"
|
||||
|
Binary file not shown.
|
After Width: | Height: | Size: 247 B |
Binary file not shown.
|
After Width: | Height: | Size: 260 B |
Binary file not shown.
|
After Width: | Height: | Size: 297 B |
@@ -6,13 +6,16 @@ using Decentralized.Domain;
|
||||
|
||||
namespace Decentralized
|
||||
{
|
||||
/// <summary>交易终端窗口:钱包、交易、报告三页。每次操作后按当前页重建窗口。</summary>
|
||||
/// <summary>
|
||||
/// 交易终端窗口:首页三个入口(银行、Poinbase、Web3)加报告。银行是真实的信用点(存取、房租);
|
||||
/// Poinbase 是合规交易所;Web3 是去中心化交易和链上钱包。每次操作后按当前页重建窗口。
|
||||
/// </summary>
|
||||
public static class TerminalWindow
|
||||
{
|
||||
public const string Id = "pd_terminal";
|
||||
private enum Page { Wallet, Trade, Report }
|
||||
private enum Page { Home, Bank, Poinbase, Web3, Report }
|
||||
|
||||
private static Page _page = Page.Wallet;
|
||||
private static Page _page = Page.Home;
|
||||
private static string _amount = "";
|
||||
private static string _message;
|
||||
|
||||
@@ -21,7 +24,7 @@ namespace Decentralized
|
||||
if (Session.Data == null) return;
|
||||
var b = CustomUIManager.Window(Id, L.T("term.title"));
|
||||
if (b == null) return;
|
||||
b.SetSize(620, 560).SetDraggable(true).SetCloseOnEscape(true).UseMachineryStyle();
|
||||
b.SetSize(640, 580).SetDraggable(true).SetCloseOnEscape(true).UseMachineryStyle();
|
||||
b.BeginRow();
|
||||
foreach (Page p in Enum.GetValues(typeof(Page)))
|
||||
{
|
||||
@@ -31,11 +34,13 @@ namespace Decentralized
|
||||
}
|
||||
b.End();
|
||||
b.AddSeparator();
|
||||
b.BeginScroll(440);
|
||||
b.BeginScroll(450);
|
||||
switch (_page)
|
||||
{
|
||||
case Page.Wallet: WalletPage(b); break;
|
||||
case Page.Trade: TradePage(b); break;
|
||||
case Page.Home: HomePage(b); break;
|
||||
case Page.Bank: BankPage(b); break;
|
||||
case Page.Poinbase: ExchangePage(b, Venue.Exchange); break;
|
||||
case Page.Web3: Web3Page(b); break;
|
||||
default: ReportPage(b); break;
|
||||
}
|
||||
b.End();
|
||||
@@ -43,32 +48,67 @@ namespace Decentralized
|
||||
b.Show();
|
||||
}
|
||||
|
||||
private static void WalletPage(CustomUIBuilder b)
|
||||
private static void Go(Page p) { _page = p; _message = null; Open(); }
|
||||
|
||||
private static void Entry(CustomUIBuilder b, string icon, string name, string line1, string line2, Page target)
|
||||
{
|
||||
var w = Session.Data.Hot;
|
||||
if (w.Balances.Count == 0) b.AddLabel(L.T("wallet.empty"));
|
||||
foreach (var kv in w.Balances.OrderBy(k => k.Key))
|
||||
b.AddLabel(L.T("wallet.line", kv.Key, Fmt.Num(kv.Value), Fmt.Credits(kv.Value * Session.Price(kv.Key))));
|
||||
b.AddSeparator();
|
||||
b.AddLabel(L.T("wallet.total", Fmt.Credits(w.Value(Session.Price))));
|
||||
if (w.Taint > 0.5) b.AddLabel(L.T("wallet.taint", Fmt.Credits(w.Taint)));
|
||||
b.BeginPanel(190f, 250f, TextAnchor.UpperCenter, 10f, 6f);
|
||||
b.AddImage(ModInfo.Id + ":" + icon, 96f, 96f);
|
||||
b.AddHeader(name);
|
||||
b.AddLabel(line1);
|
||||
b.AddLabel(line2);
|
||||
b.AddFlexibleSpace();
|
||||
b.AddButton(L.T("home.enter"), () => Go(target));
|
||||
b.End();
|
||||
}
|
||||
|
||||
private static void TradePage(CustomUIBuilder b)
|
||||
private static void HomePage(CustomUIBuilder b)
|
||||
{
|
||||
var d = Session.Data;
|
||||
double chain = d.Hot.Value(Session.Price);
|
||||
b.AddLabel(L.T("home.summary", PlayerStore.Instance.playerCash, Fmt.Credits(chain)));
|
||||
b.AddSpace(6f);
|
||||
b.BeginRow(8f, TextAnchor.UpperCenter);
|
||||
Entry(b, "ui_bank", L.T("entry.bank"), L.T("entry.bank.l1"), L.T("entry.bank.l2", PlayerStore.Instance.playerCash), Page.Bank);
|
||||
Entry(b, "ui_poinbase", L.T("entry.poinbase"), L.T("entry.poinbase.l1"), L.T("entry.poinbase.l2", Fmt.Num(d.Market.Price)), Page.Poinbase);
|
||||
Entry(b, "ui_web3", L.T("entry.web3"), L.T("entry.web3.l1"), L.T("entry.web3.l2", Fmt.Credits(chain)), Page.Web3);
|
||||
b.End();
|
||||
b.AddSpace(8f);
|
||||
b.AddSeparator();
|
||||
var r = d.LastNight;
|
||||
b.AddLabel(r == null ? L.T("report.none") : L.T("home.lastnight", r.Day, Fmt.Num(r.Mined), r.PoweredRigs, r.Rigs));
|
||||
}
|
||||
|
||||
private static void AmountRow(CustomUIBuilder b)
|
||||
{
|
||||
b.AddLabel(L.T("trade.hint"));
|
||||
b.BeginRow();
|
||||
b.AddLabel(L.T("trade.amount"));
|
||||
b.BeginPanel(240f, -1f, TextAnchor.MiddleCenter, 0f, 0f); // 给输入框一个固定宽度,容得下大额数字
|
||||
b.AddInput("0", _amount, s => _amount = s, "amount", s => _amount = s);
|
||||
b.End();
|
||||
b.End();
|
||||
}
|
||||
|
||||
/// <summary>银行:真实的信用点。现金、房租,以及信用点与 Poinbase 账户(CRC)之间的存取。</summary>
|
||||
private static void BankPage(CustomUIBuilder b)
|
||||
{
|
||||
var ps = PlayerStore.Instance;
|
||||
b.AddHeader(L.T("entry.bank"));
|
||||
b.AddLabel(L.T("bank.cash", ps.playerCash));
|
||||
b.AddLabel(L.T("bank.rent", Session.Rent(), ps.GetRentDayCounter()));
|
||||
b.AddLabel(L.T("bank.crc", Fmt.Num(Session.Data.Hot.Get(Assets.CRC))));
|
||||
b.AddSeparator();
|
||||
b.AddLabel(L.T("bank.hint"));
|
||||
AmountRow(b);
|
||||
b.BeginRow();
|
||||
b.AddButton(L.T("trade.deposit"), Deposit);
|
||||
b.AddButton(L.T("trade.withdraw"), Withdraw);
|
||||
b.End();
|
||||
b.AddSeparator();
|
||||
foreach (var pool in Session.Data.Market.Pools)
|
||||
}
|
||||
|
||||
private static void TradeRows(CustomUIBuilder b, Venue venue)
|
||||
{
|
||||
foreach (var pool in Session.Data.Market.Pools.Where(x => x.Venue == venue))
|
||||
{
|
||||
var p = pool;
|
||||
b.AddLabel(L.T("trade.pair", p.Base, p.Quote, L.T("venue." + p.Venue)) + " " + L.T("trade.price", Fmt.Num(p.Price)));
|
||||
@@ -79,6 +119,35 @@ namespace Decentralized
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Poinbase:合规交易所。账户余额与交易对;信用点的存取在银行。</summary>
|
||||
private static void ExchangePage(CustomUIBuilder b, Venue venue)
|
||||
{
|
||||
var w = Session.Data.Hot;
|
||||
b.AddHeader(L.T("entry.poinbase"));
|
||||
b.AddLabel(L.T("poin.account", Fmt.Num(w.Get(Assets.CRC)), Fmt.Num(w.Get(Assets.PSC))));
|
||||
b.AddLabel(L.T("trade.hint"));
|
||||
AmountRow(b);
|
||||
b.AddSeparator();
|
||||
TradeRows(b, venue);
|
||||
}
|
||||
|
||||
/// <summary>Web3:链上钱包与去中心化交易。</summary>
|
||||
private static void Web3Page(CustomUIBuilder b)
|
||||
{
|
||||
var w = Session.Data.Hot;
|
||||
b.AddHeader(L.T("entry.web3"));
|
||||
if (w.Balances.Count == 0) b.AddLabel(L.T("wallet.empty"));
|
||||
foreach (var kv in w.Balances.OrderBy(k => k.Key))
|
||||
b.AddLabel(L.T("wallet.line", kv.Key, Fmt.Num(kv.Value), Fmt.Credits(kv.Value * Session.Price(kv.Key))));
|
||||
b.AddLabel(L.T("wallet.total", Fmt.Credits(w.Value(Session.Price))));
|
||||
if (w.Taint > 0.5) b.AddLabel(L.T("wallet.taint", Fmt.Credits(w.Taint)));
|
||||
b.AddSeparator();
|
||||
b.AddLabel(L.T("trade.hint"));
|
||||
AmountRow(b);
|
||||
b.AddSeparator();
|
||||
TradeRows(b, Venue.Dex);
|
||||
}
|
||||
|
||||
private static void ReportPage(CustomUIBuilder b)
|
||||
{
|
||||
var r = Session.Data.LastNight;
|
||||
|
||||
Reference in new issue
Block a user