矿架 5×4、拖电子元件升级、状态面板;型号鉴定统一为一个指出型号按钮

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
ZHU MINCHAOandClaude Sonnet 5.5 committed 2026-11-04 19:50:46 +08:00
1 parent f40436b7d2
commit ed7d2bd088
16 files changed
+109 -30

No files matched your search

+20
View File
@@ -0,0 +1,20 @@
using System.Runtime.CompilerServices;
namespace Decentralized
{
/// <summary>矿架窗口里的状态面板:显卡数、耗电、算力。每台矿架一组文字,更新矿架时一并刷新。</summary>
public static class RigStatus
{
private static readonly ConditionalWeakTable<GameItem, MachineryText[]> Table = new ConditionalWeakTable<GameItem, MachineryText[]>();
public static void Add(GameItem rig, MachineryText[] lines) { Table.Remove(rig); Table.Add(rig, lines); }
public static void Show(GameItem rig, int cards, int slots, int kj, double mhs)
{
if (!Table.TryGetValue(rig, out var t) || t.Length < 3) return;
t[0].SetStatus(L.T("rig.st.cards"), $"{cards}/{slots}");
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");
}
}
}