鉴定改版:风扇数、供电口、丝印、序列号四项真伪依据在前,假卡依据各自独立(平均 1.5 项);指南去档次、去卖家说法
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a8d7bc3427
commit
f40436b7d2
57 files changed
+451
-261
No files matched your search
@@ -16,9 +16,9 @@ namespace Decentralized
|
||||
/// </summary>
|
||||
public sealed class GpuInspectView : MonoBehaviour
|
||||
{
|
||||
private const float RowH = 30f, CardScale = 3f, PanelTop = -112f, DetailH = 26f, GroupGap = 8f;
|
||||
private const int RowCount = 5;
|
||||
private TextMeshProUGUI detailText, priceText;
|
||||
private const float RowH = 26f, CardScale = 3f, PanelTop = -112f, DetailH = 26f, GroupGap = 7f;
|
||||
private static readonly int RowCount = CardLabels.Rows.Length;
|
||||
private TextMeshProUGUI priceText;
|
||||
private static GpuInspectView instance;
|
||||
private RectTransform root, cardRoot;
|
||||
private Button flip;
|
||||
@@ -28,9 +28,9 @@ namespace Decentralized
|
||||
private bool hidGlass;
|
||||
private Transform buttonTemplate;
|
||||
private TMP_FontAsset font;
|
||||
private readonly TextMeshProUGUI[] rowName = new TextMeshProUGUI[RowCount], rowText = new TextMeshProUGUI[RowCount];
|
||||
private readonly Button[] rowButton = new Button[RowCount];
|
||||
private readonly TextMeshProUGUI[] rowButtonText = new TextMeshProUGUI[RowCount];
|
||||
private readonly TextMeshProUGUI[] rowName = new TextMeshProUGUI[16], rowText = new TextMeshProUGUI[16];
|
||||
private readonly Button[] rowButton = new Button[16];
|
||||
private readonly TextMeshProUGUI[] rowButtonText = new TextMeshProUGUI[16];
|
||||
private TextMeshProUGUI serialText;
|
||||
|
||||
public static void Ensure()
|
||||
@@ -173,29 +173,33 @@ namespace Decentralized
|
||||
if (buttonTemplate == null) return;
|
||||
font = buttonTemplate.GetComponentInChildren<TextMeshProUGUI>()?.font;
|
||||
if (font != null) serialText.font = font;
|
||||
// 标签区:深色底加浅色边框,和上面的大图分开
|
||||
float panelH = RowCount * RowH + 10f + DetailH + GroupGap, panelY = PanelTop - panelH / 2;
|
||||
// 标签区:深色底加浅色边框,和上面的大图分开。三组:四项真伪依据、型号、四项成色,最下面一行是标签价
|
||||
float panelH = RowCount * RowH + 10f + DetailH + GroupGap * 2, panelY = PanelTop - panelH / 2;
|
||||
MakeRect(root, "LabelFrame", new Vector2(0, panelY), new Vector2(648, panelH + 8), new Color(0.78f, 0.68f, 0.45f, 1f));
|
||||
MakeRect(root, "LabelBack", new Vector2(0, panelY), new Vector2(640, panelH), new Color(0.10f, 0.11f, 0.14f, 0.96f));
|
||||
MakeRect(root, "LabelDivider", new Vector2(0, PanelTop - 5 - RowH * CardLabels.AuthRows - DetailH - GroupGap / 2), new Vector2(620, 2), new Color(0.78f, 0.68f, 0.45f, 0.8f));
|
||||
detailText = MakeText(root, "Detail", new Vector2(-90, PanelTop - 5 - RowH * CardLabels.AuthRows - DetailH / 2), new Vector2(450, DetailH), TextAlignmentOptions.Left, 17);
|
||||
priceText = MakeText(root, "LabelPrice", new Vector2(230, PanelTop - 5 - RowH * CardLabels.AuthRows - DetailH / 2), new Vector2(170, DetailH), TextAlignmentOptions.Right, 19);
|
||||
MakeRect(root, "LabelDivider1", new Vector2(0, GroupTop(CardLabels.AuthRows) + GroupGap / 2 + 1), new Vector2(620, 2), new Color(0.78f, 0.68f, 0.45f, 0.8f));
|
||||
MakeRect(root, "LabelDivider2", new Vector2(0, GroupTop(CardLabels.AuthRows + 1) + GroupGap / 2 + 1), new Vector2(620, 2), new Color(0.78f, 0.68f, 0.45f, 0.5f));
|
||||
MakeRect(root, "LabelDivider3", new Vector2(0, PanelTop - 5 - RowH * RowCount - GroupGap * 2 - 1), new Vector2(620, 2), new Color(0.78f, 0.68f, 0.45f, 0.8f));
|
||||
priceText = MakeText(root, "LabelPrice", new Vector2(165, PanelTop - 5 - RowH * RowCount - GroupGap * 2 - DetailH / 2 - 2), new Vector2(300, DetailH), TextAlignmentOptions.Right, 21);
|
||||
priceText.color = new Color(1f, 0.85f, 0.45f);
|
||||
PledgerSkin.Fit(priceText); PledgerSkin.Fit(detailText);
|
||||
PledgerSkin.Fit(priceText);
|
||||
flip = MakeButton(root, "Flip", new Vector2(0, PanelTop - panelH - 24), new Vector2(200, 30), out flipText);
|
||||
flip.onClick.AddListener(() => { if (shown != null) Items.Flip(shown); });
|
||||
for (int i = 0; i < RowCount; i++)
|
||||
{
|
||||
int row = CardLabels.Rows[i];
|
||||
float y = PanelTop - 5 - RowH * (i + 0.5f) - (i >= CardLabels.AuthRows ? DetailH + GroupGap : 0f);
|
||||
rowName[i] = MakeText(root, "RowName" + i, new Vector2(-255, y), new Vector2(110, RowH), TextAlignmentOptions.Left, 22);
|
||||
rowText[i] = MakeText(root, "RowText" + i, new Vector2(-30, y), new Vector2(330, RowH), TextAlignmentOptions.Left, 22);
|
||||
float y = GroupTop(i) - RowH / 2;
|
||||
rowName[i] = MakeText(root, "RowName" + i, new Vector2(-245, y), new Vector2(130, RowH), TextAlignmentOptions.Left, 20);
|
||||
rowText[i] = MakeText(root, "RowText" + i, new Vector2(-20, y), new Vector2(330, RowH), TextAlignmentOptions.Left, 20);
|
||||
rowButton[i] = MakeButton(root, "RowButton" + i, new Vector2(245, y), new Vector2(110, RowH - 3), out rowButtonText[i]);
|
||||
rowButton[i].onClick.AddListener(() => Log.Guard("标签栏", () => OnRowButton(row)));
|
||||
}
|
||||
}
|
||||
|
||||
private static string RowKey(int row) => row == CardLabels.RowSpec ? "spec" : row == CardLabels.RowBuild ? "build" : row == CardLabels.RowFan ? "fan" : row == CardLabels.RowFingers ? "fingers"
|
||||
/// <summary>第 i 行的上沿(三组之间各留一道间隔)。</summary>
|
||||
private static float GroupTop(int i) => PanelTop - 5 - RowH * i - (i >= CardLabels.AuthRows ? GroupGap : 0f) - (i >= CardLabels.AuthRows + 1 ? GroupGap : 0f);
|
||||
|
||||
private static string RowKey(int row) => row == CardLabels.RowSpec ? "spec" : row == CardLabels.RowCount ? "count" : row == CardLabels.RowPin ? "pin" : row == CardLabels.RowFan ? "fan" : row == CardLabels.RowFingers ? "fingers"
|
||||
: row == CardLabels.RowBracket ? "bracket" : row == CardLabels.RowPrint ? "print" : row == CardLabels.RowSerial ? "serial" : "seal";
|
||||
|
||||
private static string ValueText(int row, int value) => row == CardLabels.RowSpec ? "" : L.T("lbl." + RowKey(row) + "." + (row == CardLabels.RowSeal && value == 1 ? 0 : value));
|
||||
@@ -225,7 +229,7 @@ namespace Decentralized
|
||||
int row = CardLabels.Rows[i];
|
||||
rowName[i].text = RowName(row);
|
||||
rowName[i].color = i < CardLabels.AuthRows ? new Color(1f, 0.85f, 0.45f) : new Color(0.6f, 0.85f, 1f); // 真伪行金黄,成色行浅蓝
|
||||
rowName[i].fontSize = 22; PledgerSkin.Fit(rowName[i]);
|
||||
rowName[i].fontSize = 20; PledgerSkin.Fit(rowName[i]); PledgerSkin.Fit(rowText[i]);
|
||||
string text;
|
||||
Color color = new Color(0.96f, 0.98f, 1f);
|
||||
string Show(Claim c) => row == CardLabels.RowSpec ? DisplayModel(c.Model) : ValueText(row, c.Get(row));
|
||||
@@ -234,24 +238,16 @@ namespace Decentralized
|
||||
{
|
||||
text = Show(real);
|
||||
bool lied = row == CardLabels.RowSpec ? claim.Value.Model != real.Model : claim.Value.Get(row) != real.Get(row);
|
||||
if (lied) { color = new Color(1f, 0.45f, 0.4f); text += L.T("lbl.said", row == CardLabels.RowBuild ? L.T("lbl.tier." + claim.Value.Tier) : Show(claim.Value)); }
|
||||
if (lied) { color = new Color(1f, 0.45f, 0.4f); text += L.T("lbl.said", Show(claim.Value)); }
|
||||
else color = new Color(0.5f, 1f, 0.55f);
|
||||
}
|
||||
else text = Show(claim.Value);
|
||||
rowText[i].text = text;
|
||||
rowText[i].color = color;
|
||||
bool editable = row != CardLabels.RowBuild;
|
||||
bool editable = row != CardLabels.RowCount && row != CardLabels.RowPin;
|
||||
rowButton[i].gameObject.SetActive(canEdit ? editable : canPoint && (exposed & row) == 0);
|
||||
rowButtonText[i].text = L.T(canEdit ? "lbl.edit" : "lbl.point");
|
||||
}
|
||||
// 型号行:没拆穿之前不写依据;拆穿之后列出实际查到的问题
|
||||
if (detailText != null)
|
||||
{
|
||||
bool spec = (exposed & CardLabels.RowSpec) != 0;
|
||||
string detail = claim == null || !spec ? "" : Evidence(u, claim.Value, real);
|
||||
detailText.text = detail;
|
||||
detailText.color = spec ? new Color(1f, 0.7f, 0.6f) : new Color(0.75f, 0.78f, 0.85f);
|
||||
}
|
||||
if (priceText != null) priceText.text = L.T("lbl.price", item.unitValue);
|
||||
if (flipText != null) flipText.text = L.T(Items.IsBack(item) ? "inspect.flip.front" : "inspect.flip.back");
|
||||
// 贴纸上的序列号:只在背面显示
|
||||
@@ -264,16 +260,6 @@ namespace Decentralized
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>型号真伪的依据:实物与卖家说法对不上的地方(供电口与风扇数、序列号、背面丝印)。</summary>
|
||||
private static string Evidence(Unit u, Claim claim, Claim real)
|
||||
{
|
||||
var parts = new List<string>();
|
||||
if (claim.Tier != real.Tier) parts.Add(L.T("lbl.ev.build", L.T("lbl.tier." + real.Tier), Hardware.PowerPins[real.Tier], Hardware.FanCount[real.Tier]));
|
||||
if (real.Serial != 0) parts.Add(L.T("lbl.ev.serial." + real.Serial));
|
||||
if (real.Print != 0) parts.Add(L.T("lbl.ev.print." + real.Print));
|
||||
return parts.Count == 0 ? L.T("lbl.ev.none") : L.T("lbl.ev.prefix") + string.Join(";", parts);
|
||||
}
|
||||
|
||||
private static string DisplayModel(string model) => Items.DisplayModel(model);
|
||||
|
||||
private void OnRowButton(int row)
|
||||
|
||||
Reference in new issue
Block a user