cortico-world-extra-actions 0.3.26 → 0.3.27

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/dist/webui.js CHANGED
@@ -195,7 +195,7 @@ const CSS = `<style>
195
195
  /* 首启一次性提示 */
196
196
  .ea-onboard{position:fixed;inset:0;z-index:40;display:flex;align-items:center;justify-content:center;
197
197
  background:rgba(0,0,0,.42);padding:20px}
198
- .ea-onboard[hidden]{display:none}
198
+ .ea-onboard[hidden]{display:none}
199
199
  .ea-onboard-box{max-width:420px;background:var(--ea-bg);border:1px solid var(--ea-line2);padding:16px 18px;
200
200
  box-shadow:0 24px 48px -20px rgba(0,0,0,.5)}
201
201
  .ea-onboard-box b{display:block;font-size:14px;margin-bottom:6px}
@@ -414,7 +414,8 @@ const panel = {
414
414
  <div class="ea-onboard" data-role="onboard" hidden>
415
415
  <div class="ea-onboard-box">
416
416
  <b>完整动作库还没下载</b>
417
- <p>插件自带 <b data-role="onboard-have">若干</b> 段示例动作。完整库有 <b data-role="onboard-count">105</b> 段(640×360,约 <span data-role="onboard-size">370</span> MB),下载并指给插件之后,面板里的动作才能全部勾选。</p>
417
+ <p>插件自带 <b data-role="onboard-have">若干</b> 段示例动作。完整库有 <b data-role="onboard-count">105</b> 段(640×360,约 <span data-role="onboard-size">370</span> MB)。</p>
418
+ <p>下载之前,列表里那些<b>灰色的行</b>就是还没装进动作库的段 —— 灰色只代表「没下载」,不是坏了;下载完就会变成可勾选。</p>
418
419
  <p class="ea-dim" data-role="onboard-note">下载地址由维护者提供,拿到后这里会出现「去下载」按钮;也可以自己放好库,用「动作库」菜单里的「选择动作库位置…」指过去。</p>
419
420
  <div class="ea-onboard-acts">
420
421
  <button class="ea-btn pri" type="button" data-act="download-library" data-role="onboard-dl" hidden>一键下载并安装</button>
@@ -549,7 +550,9 @@ const panel = {
549
550
  // 数字都从清单算,别写死(换库、加动作时不用改文案)
550
551
  const totalSeg = catalog?.count ?? 0;
551
552
  const haveSeg = catalog?.present ?? 0;
552
- const totalBytes = (catalog?.actions ?? []).reduce((sum, a) => sum + (a.bytes || 0), 0);
553
+ // 优先用后台给的分片总字节(准确);拿不到再退回清单求和
554
+ const totalBytes = state?.download?.bytes
555
+ || (catalog?.actions ?? []).reduce((sum, a) => sum + (a.bytes || 0), 0);
553
556
  const setTxt = (sel, v) => { const node = wrap.querySelector(sel); if (node) node.textContent = String(v); };
554
557
  if (totalSeg) setTxt('[data-role=onboard-count]', totalSeg);
555
558
  setTxt('[data-role=onboard-have]', haveSeg);
@@ -714,7 +717,8 @@ const panel = {
714
717
  const mounted = installed.has(a.id);
715
718
  const row = el('div', 'ea-row' + (on ? ' on' : '') + (isState || off ? ' off' : '') + (off ? ' miss' : ''));
716
719
  // 目录固定:悬停就能看到这段动作在库里的固定位置 actions/<分类>/<id>
717
- row.title = '固定目录:' + (a.dir || a.clip || `actions/${a.category}/${a.id}`) + (off ? '(库里还没有,补进来才能用)' : '');
720
+ row.title = '固定目录:' + (a.dir || a.clip || `actions/${a.category}/${a.id}`)
721
+ + (off ? '|这一段还没下载到动作库,所以是灰的、不能勾。点这一行右侧的「↓ 下载」只下这一段(约 3.5 MB),或点上面的「一键下载并安装」装完整 105 段。' : '');
718
722
  // 缩略图的 data URL 先不挂 src:等这一行进可视区再挂(见 mountThumbs)。
719
723
  // 尺寸由 CSS 的 64×36 定住,所以不挂 src 也不会让行跳动。
720
724
  row.__pickable = isSelectable(a) ? a : null; // 表头复选框要用:这一行到底算不算"可勾"
@@ -727,7 +731,7 @@ const panel = {
727
731
  <span class="tag">${esc(a.catZh)}</span>
728
732
  <span class="tag">${a.seconds.toFixed(1)}s</span>
729
733
  ${mounted ? '<span class="tag acc">已装</span>' : ''}
730
- ${off ? '<span class="tag warn">库里没有 · 缺帧</span>' : (isState ? '<span class="tag">状态 · 不用勾</span>' : '')}
734
+ ${off ? '<span class="tag warn">未下载</span>' : (isState ? '<span class="tag">状态 · 不用勾</span>' : '')}
731
735
  ${a.reaction ? '<span class="tag">点击</span>' : ''}
732
736
  ${a.noMirror ? '<span class="tag">带字</span>' : ''}
733
737
  ${a.random ? '' : '<span class="tag">不轮播</span>'}
@@ -899,7 +903,7 @@ const panel = {
899
903
  sumEl.innerHTML = `已勾选 <b>${n}</b> 段 · 约 <b>${mb(bytesOf(selected))}</b>`
900
904
  + (hiddenAll && !showAll ? ` | <b class="warn">另有 ${hiddenAll} 段未下载</b>(勾上「显示全部」可看)` : '')
901
905
  + ` | 清单 <b>${total}</b> 条:库里 <b>${have}</b>${miss ? ` · <b class="warn">缺 ${miss}</b>` : ''}`
902
- + (dead ? ` | <b class="warn">其中 ${dead} 段库里没有</b>(保存时跳过)` : '')
906
+ + (dead ? ` | <b class="warn">其中 ${dead} 段还没下载</b>(保存时会跳过)` : '')
903
907
  + (extra ? ` | 包里已有 ${extra} 段(${mb(p.extra.bytes || 0)})` : '');
904
908
  }
905
909
 
@@ -932,15 +936,19 @@ const panel = {
932
936
  if (!missSeg) return '';
933
937
  const names = (catalog?.actions ?? []).filter((a) => a.present === false).slice(0, 6).map((a) => a.zh || a.id);
934
938
  const more = names.length && missSeg > names.length ? '…' : '';
935
- return `<br>库里还缺 <b class="warn">${missSeg}</b> 段${names.length ? `(${esc(names.join('、'))}${more})` : ''}`
936
- + ' —— 这些勾了也写不进包;点上面的「动作库」菜单去补,或到 '
937
- + ' 到「动作库」菜单下载完整库。';
939
+ return `<br>列表里<b>灰色的行</b>就是还没下载到动作库的段 —— 现在缺 <b class="warn">${missSeg}</b> 段`
940
+ + (names.length ? `(${esc(names.join('、'))}${more})` : '')
941
+ + ';下载之后才会变成可勾选,现在勾了也写不进包。'
942
+ + '<div style="margin-top:6px;display:flex;gap:8px;align-items:center;flex-wrap:wrap">'
943
+ + '<button class="ea-btn pri" type="button" data-act="download-library">一键下载并安装</button>'
944
+ + '<span class="ea-dim">或者只补某一段:点那一行右侧的「↓ 下载」</span>'
945
+ + '</div>';
938
946
  };
939
947
  if (!state.library.ok) {
940
948
  noteEl.hidden = false;
941
949
  noteEl.className = 'ea-note bad';
942
950
  noteEl.innerHTML = `动作库目录没找到:<code>${esc(state.library.dir || '未设置')}</code> —— 点上面的「动作库」菜单:自动寻找,或手动选位置。`
943
- + `<br>清单里的 ${state.library.count ?? 105} 段现在都算「库里没有」。`;
951
+ + `<br>清单里的 ${state.library.count ?? 105} 段现在都算「还没下载」—— 先在上面选好动作库位置,再下载。`;
944
952
  return;
945
953
  }
946
954
  if (!p) {
@@ -1072,7 +1080,7 @@ const panel = {
1072
1080
  const skipped = Array.isArray(r.skipped) ? r.skipped : [];
1073
1081
  const names = skipped.slice(0, 5).map((id) => catalog.actions.find((a) => a.id === id)?.zh ?? id);
1074
1082
  const tail = skipped.length
1075
- ? `;库里没有的 ${skipped.length} 段已跳过${names.length ? `(${names.join('、')}${skipped.length > names.length ? '…' : ''})` : ''}`
1083
+ ? `;还没下载的 ${skipped.length} 段已跳过${names.length ? `(${names.join('、')}${skipped.length > names.length ? '…' : ''})` : ''}`
1076
1084
  : '';
1077
1085
  say(`已写入 ${r.count} 段,${mb(r.bytes)}${tail};词表 +${r.vocab.added.length} −${r.vocab.removed.length};去装扮页重新点一下这个形象才会生效`, !!skipped.length);
1078
1086
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cortico-world-extra-actions",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "勾选动作库里的动作,写进形象包的「额外动作拓展」文件夹,让桌宠照着做。自带入门形象包与示例动作;完整 105 段可一键下载安装(不用解压、不用选文件夹)。",
package/src/world.js CHANGED
@@ -594,6 +594,8 @@ export class ExtraActionsWorld {
594
594
  base,
595
595
  actionBase,
596
596
  libraryUrl: base ? libraryUrl(base) : FALLBACK_LIBRARY,
597
+ // 完整库的真实字节数(分片之和):面板提示里的「约 N MB」用它,别拿清单里的体积去猜
598
+ bytes: LIB_PARTS.reduce((sum, p) => sum + (p.bytes || 0), 0),
597
599
  // 完整库有 GitHub 兜底;单段必须有专门的前缀
598
600
  perAction: !!(actionBase || base),
599
601
  flat: !!actionBase,