diff --git a/art/sprites.py b/art/sprites.py
index 1a83c01..49d4482 100644
--- a/art/sprites.py
+++ b/art/sprites.py
@@ -739,11 +739,20 @@ def hw_selected():
return c
+def hw_groove():
+ """PLEDGER 墨水屏输入框凹槽(12×12,九宫格边 2):浅色底、1 像素深墨边。"""
+ c = Canvas(12, 12)
+ c.rect(0, 0, 11, 11, 'n')
+ c.rect(1, 1, 10, 10, 'P')
+ return c
+
+
UI_ICONS = {'ui_bank': ui_bank, 'ui_poinbase': ui_poinbase, 'ui_web3': ui_web3}
UI_ICONS['ui_hw_shell'] = lambda: rounded(32, 7, 'K', 'E', 'z')
UI_ICONS['ui_hw_bezel'] = lambda: rounded(16, 4, 'n')
UI_ICONS['ui_hw_paper'] = lambda: rounded(12, 2, 'P')
UI_ICONS['ui_hw_sel'] = hw_selected
+UI_ICONS['ui_hw_groove'] = hw_groove
UI_ICONS['ui_hw_ok'] = lambda: hw_button('ok')
UI_ICONS['ui_hw_no'] = lambda: hw_button('no')
diff --git a/src/Decentralized/ModFiles/Textures/Items/ui_hw_groove.png b/src/Decentralized/ModFiles/Textures/Items/ui_hw_groove.png
new file mode 100644
index 0000000..163ef61
Binary files /dev/null and b/src/Decentralized/ModFiles/Textures/Items/ui_hw_groove.png differ
diff --git a/src/Decentralized/PledgerSkin.cs b/src/Decentralized/PledgerSkin.cs
index 737a478..19ed5ae 100644
--- a/src/Decentralized/PledgerSkin.cs
+++ b/src/Decentralized/PledgerSkin.cs
@@ -56,6 +56,35 @@ namespace Decentralized
img.color = Color.white;
}
+ /// 把输入框切片为墨水屏凹槽:浅色底、1 像素深墨边框(1:1 像素映射)。
+ public static void SliceGroove(Image img)
+ {
+ if (img == null) return;
+ if (!Sliced.TryGetValue("ui_hw_groove", out var sp))
+ {
+ var src = Items.ModSprite("ui_hw_groove");
+ if (src != null)
+ {
+ src.texture.filterMode = FilterMode.Point;
+ sp = Sprite.Create(src.texture, src.rect, new Vector2(0.5f, 0.5f), src.pixelsPerUnit, 0, SpriteMeshType.FullRect, new Vector4(2, 2, 2, 2));
+ }
+ else
+ {
+ var tex = new Texture2D(12, 12, TextureFormat.RGBA32, false) { filterMode = FilterMode.Point };
+ for (int y = 0; y < 12; y++)
+ for (int x = 0; x < 12; x++)
+ tex.SetPixel(x, y, (x == 0 || x == 11 || y == 0 || y == 11) ? Ink : Paper);
+ tex.Apply();
+ sp = Sprite.Create(tex, new Rect(0, 0, 12, 12), new Vector2(0.5f, 0.5f), 100f, 0, SpriteMeshType.FullRect, new Vector4(2, 2, 2, 2));
+ }
+ Sliced["ui_hw_groove"] = sp;
+ }
+ img.sprite = sp;
+ img.type = Image.Type.Sliced;
+ img.pixelsPerUnitMultiplier = 100f / sp.pixelsPerUnit;
+ img.color = Color.white;
+ }
+
/// 屏上的选择按钮(币种、档位、子页):选中的一个画成白底黑框黑字、四角带准星角标。
public static void Pick(CustomUIBuilder b, string text, bool selected, Action onClick, ICollection picked)
{
@@ -155,9 +184,11 @@ namespace Decentralized
t.color = t.gameObject.name.Contains("_note") ? Alert : t.gameObject.name.Contains("_dim") ? Dim : Ink;
}
- // 屏上输入框
+ // 屏上输入框:墨水屏凹槽样式(浅色底、深墨 1px 边、深墨文字、灰色占位符)
foreach (var inp in screen.GetComponentsInChildren(true))
{
+ var bg = inp.GetComponent() ?? inp.targetGraphic as Image;
+ if (bg != null) SliceGroove(bg);
if (inp.textComponent != null) inp.textComponent.color = Ink;
if (inp.placeholder is TextMeshProUGUI ph) ph.color = Dim;
}