koishi-plugin-vsinger-gacha 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/handbook.js CHANGED
@@ -209,7 +209,9 @@ async function render({ game, store, uid, displayName, outDir, tagsDir, thumbsDi
209
209
  const W = PAD * 2 + part.length * COLW + (part.length - 1) * GAP * 2;
210
210
  // 头部高度随图标自适应(避免标题压到第一个系列条)
211
211
  const _R = Math.max(26, Math.min(72, Math.round(W * 0.017)));
212
- const HEADY = Math.max(HEAD, 34 + _R * 2 + 40);
212
+ const _BW = Math.max(150, Math.min(400, Math.round(W * 0.13)));
213
+ const _BH = Math.round(_BW * 0.5);
214
+ const HEADY = Math.max(HEAD, 34 + Math.max(_R * 2, _BH) + 40);
213
215
  const H = HEADY + Math.max(...part.map((c) => c.reduce((a, b) => a + b.h, 0))) + 70;
214
216
  const canvas = Canvas.createCanvas(W, H);
215
217
  const g = canvas.getContext('2d');
package/lib/render/kit.js CHANGED
@@ -75,21 +75,36 @@ function header(g, o) {
75
75
  const y = o.y;
76
76
  const W = o.W;
77
77
 
78
- // 圆形图标(按画布宽度自适应,图鉴这种大图不至于看着小)
79
- const R = Math.max(26, Math.min(64, Math.round(W * 0.015)));
78
+ // 圆形图标:圆保持适中,音符用矢量画满圆内(避免字体 ♪ 上标很小)
79
+ const R = Math.max(24, Math.min(40, Math.round(W * 0.011)));
80
80
  const cx = x + R;
81
- const cy = y + R + 2;
81
+ const cy = y + R;
82
82
  g.save();
83
83
  g.beginPath();
84
84
  g.arc(cx, cy, R, 0, Math.PI * 2);
85
85
  g.fillStyle = COLOR.accent;
86
86
  g.fill();
87
- g.fillStyle = '#fff';
88
- g.font = `bold ${Math.round(R * 1.15)}px ${FONT}`;
89
- g.textAlign = 'center';
90
- g.textBaseline = 'middle';
91
- g.fillText('♪', cx, cy + Math.round(R * 0.04));
92
- g.textAlign = 'left';
87
+
88
+ // 音符:椭圆头 + 竖杆 + 旗
89
+ const k = R * 0.52; // 音符整体缩放
90
+ const hx = cx - k * 0.34; // 符头中心
91
+ const hy = cy + k * 0.52;
92
+ g.fillStyle = '#ffffff';
93
+ g.beginPath();
94
+ g.ellipse(hx, hy, k * 0.42, k * 0.32, -0.35, 0, Math.PI * 2);
95
+ g.fill();
96
+
97
+ // 竖杆
98
+ const sx = hx + k * 0.36;
99
+ g.fillRect(sx - k * 0.07, cy - k * 0.62, k * 0.14, hy - (cy - k * 0.62));
100
+
101
+ // 旗
102
+ g.beginPath();
103
+ g.moveTo(sx, cy - k * 0.62);
104
+ g.quadraticCurveTo(sx + k * 0.62, cy - k * 0.48, sx + k * 0.46, cy - k * 0.10);
105
+ g.quadraticCurveTo(sx + k * 0.52, cy - k * 0.40, sx, cy - k * 0.34);
106
+ g.closePath();
107
+ g.fill();
93
108
  g.restore();
94
109
 
95
110
  g.textBaseline = 'top';
@@ -106,26 +121,27 @@ function header(g, o) {
106
121
  g.fillText(o.subtitle, x + R * 2 + 18, y + Math.max(40, R * 2 - 8));
107
122
  }
108
123
 
109
- // 右侧徽章
124
+ // 右侧徽章(按画布宽度自适应)
110
125
  if (o.badge != null) {
111
- const bw = 118;
112
- const bh = 58;
126
+ const bw = Math.max(150, Math.min(400, Math.round(W * 0.13)));
127
+ const bh = Math.round(bw * 0.5);
113
128
  const bx = x + W - bw;
114
129
  panel(g, bx, y - 4, bw, bh, { radius: RADIUS.md, fill: 'rgba(255,255,255,0.95)' });
115
130
  g.fillStyle = COLOR.accent;
116
- g.font = `bold 26px ${FONT}`;
117
- g.fillText(String(o.badge), bx + 14, y + 6);
131
+ g.font = `bold ${Math.round(bh * 0.46)}px ${FONT}`;
132
+ g.fillText(String(o.badge), bx + bw * 0.1, y + bh * 0.06);
118
133
  g.fillStyle = COLOR.textSub;
119
- g.font = `12px ${FONT}`;
120
- g.fillText(String(o.badgeSub || ''), bx + 14, y + 36);
134
+ g.font = `${Math.round(bh * 0.2)}px ${FONT}`;
135
+ g.fillText(String(o.badgeSub || ''), bx + bw * 0.1, y + bh * 0.6);
121
136
  // 进度条
122
137
  const pct = Math.max(0, Math.min(1, Number(o.progress || 0)));
138
+ const pbH = Math.max(5, Math.round(bh * 0.08));
123
139
  g.fillStyle = 'rgba(74,144,217,0.15)';
124
- roundRect(g, bx + 10, y + bh - 6, bw - 20, 5, 3);
140
+ roundRect(g, bx + bw * 0.08, y + bh - pbH - 8, bw * 0.84, pbH, pbH / 2);
125
141
  g.fill();
126
142
  if (pct > 0) {
127
143
  g.fillStyle = COLOR.accent;
128
- roundRect(g, bx + 10, y + bh - 6, Math.max(4, (bw - 20) * pct), 5, 3);
144
+ roundRect(g, bx + bw * 0.08, y + bh - pbH - 8, Math.max(6, bw * 0.84 * pct), pbH, pbH / 2);
129
145
  g.fill();
130
146
  }
131
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "koishi-plugin-vsinger-gacha",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "VSinger 收藏集抽卡 / 签到积分 / 图鉴(Koishi 插件,一次性安装)",
5
5
  "main": "lib/index.js",
6
6
  "files": [