首页加挖矿、灰网、钱包入口卡片和图标

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-05 16:50:40 +08:00
1 parent 264252881c
commit e746024422
13 files changed
+67 -19

No files matched your search

+26 -11
View File
@@ -95,16 +95,17 @@ namespace Decentralized
if (CustomUIManager.Instance != null && CustomUIManager.Instance.IsOpen(Id)) Open();
}
private static void Entry(CustomUIBuilder b, string icon, string name, string line1, string line2, Page target) =>
Entry(b, icon, name, line1, line2, L.T("home.enter"), () => Go(target));
private static void Entry(CustomUIBuilder b, string icon, string name, string line1, string line2, Page target, bool compact, int perRow) =>
Entry(b, icon, name, line1, line2, L.T("home.enter"), () => Go(target), compact, perRow);
private static void Entry(CustomUIBuilder b, string icon, string name, string line1, string line2, string button, Action onEnter)
private static void Entry(CustomUIBuilder b, string icon, string name, string line1, string line2, string button, Action onEnter, bool compact, int perRow)
{
b.BeginPanel((ScreenW - 80f) / 4f, 250f + (ScreenH - 578f) * 0.25f, TextAnchor.UpperCenter, 10f, 6f);
float h = compact ? Mathf.Clamp((ScreenH - 190f) / 2f, 180f, 270f) : 250f + (ScreenH - 578f) * 0.25f, pic = compact ? 64f : 96f;
b.BeginPanel((ScreenW - 80f) / perRow, h, TextAnchor.UpperCenter, 10f, compact ? 4f : 6f);
var cardImg = b.Last.image;
cardImg.sprite = MachineryStyle.White;
cardImg.color = PledgerSkin.RowNormal;
b.AddImage(ModInfo.Id + ":" + icon, 96f, 96f);
b.AddImage(ModInfo.Id + ":" + icon, pic, pic);
b.AddHeader(name);
b.AddLabel(line1);
if (line2 != null) b.AddLabel(line2, "entry_l2_dim");
@@ -119,12 +120,26 @@ namespace Decentralized
double chain = d.ChainValue(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"), null, 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);
Entry(b, "ui_help", L.T("entry.help"), L.T("entry.help.l1"), null, L.T("home.open"), HandbookWindow.Open);
b.End();
var cards = new List<Action<bool, int>>
{
(two, n) => Entry(b, "ui_bank", L.T("entry.bank"), L.T("entry.bank.l1"), L.T("entry.bank.l2", PlayerStore.Instance.playerCash), Page.Bank, two, n),
(two, n) => Entry(b, "ui_poinbase", L.T("entry.poinbase"), L.T("entry.poinbase.l1"), null, Page.Poinbase, two, n),
(two, n) => Entry(b, "ui_web3", L.T("entry.web3"), L.T("entry.web3.l1"), L.T("entry.web3.l2", Fmt.Credits(chain)), Page.Web3, two, n),
(two, n) => Entry(b, "ui_mining", L.T("tab.mining"), L.T("entry.mining.l1"), null, Page.Mining, two, n),
};
if (GrayAvailable) cards.Add((two, n) => Entry(b, "ui_gray", L.T("tab.gray"), L.T("entry.gray.l1"), null, Page.Gray, two, n));
cards.Add((two, n) => Entry(b, "ui_wallets", L.T("tab.wallets"), L.T("entry.wallets.l1"), L.T("entry.wallets.l2", d.Wallets.Count, Tuning.WalletMax), Page.Wallets, two, n));
cards.Add((two, n) => Entry(b, "ui_help", L.T("entry.help"), L.T("entry.help.l1"), null, L.T("home.open"), HandbookWindow.Open, two, n));
// 一行四张;多于四张时分两行(每行尽量均分),卡片和图标相应缩小
bool twoRows = cards.Count > 4;
int first = twoRows ? (cards.Count + 1) / 2 : cards.Count;
for (int i = 0; i < cards.Count; i += first)
{
b.BeginRow(8f, TextAnchor.UpperCenter);
for (int j = i; j < Math.Min(cards.Count, i + first); j++) cards[j](twoRows, first);
b.End();
if (twoRows && i == 0) b.AddSpace(8f);
}
b.AddSpace(8f);
b.AddSeparator();
var r = d.LastNight;