4 Commits
Author SHA1 Message Date
Diuse d5715c9f5a fixed # 修复状态列表异常的bug 2026-10-29 15:21:11 +08:00
Diuse 4036041819 fixed # 更新工作流 2026-10-29 14:45:51 +08:00
Diuse b9664de9bd fixed # 修正样式BUG 2026-10-29 14:28:19 +08:00
Diuse 59e62d22c9 fixed # 偷偷更新GM菜单内容 2026-10-29 12:07:48 +08:00
17 changed files with 568 additions and 77 deletions
+19 -7
View File
@@ -1,12 +1,12 @@
name: Release extension
on:
push:
branches:
- "**"
paths:
- "extension.js"
workflow_dispatch:
inputs:
version:
description: "版本号,例如 2.0.1.2 或 2.0.1.2-rc.1"
required: true
type: string
permissions:
contents: write
@@ -17,23 +17,33 @@ concurrency:
jobs:
release:
if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
runs-on: windows-latest
defaults:
run:
shell: pwsh
env:
RELEASE_VERSION: ${{ inputs.version }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
BEFORE_SHA: ${{ github.event.before }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Check out source
uses: actions/checkout@v4
with:
ref: ${{ github.event.repository.default_branch }}
ref: ${{ github.sha }}
fetch-depth: 0
- name: Read current version and detect change
id: version
run: |
./tools/resolve_release_version.ps1 `
-Root $env:GITHUB_WORKSPACE `
-EventName $env:GITHUB_EVENT_NAME `
-PreviousRef $env:BEFORE_SHA
- name: Generate manifest and create tag
if: steps.version.outputs.should_release == 'true'
run: |
$ErrorActionPreference = 'Stop'
$version = $env:RELEASE_VERSION
@@ -118,6 +128,7 @@ jobs:
Write-Host "已创建包含清单的标签:$tag"
- name: Build ZIP from tag
if: steps.version.outputs.should_release == 'true'
run: |
$ErrorActionPreference = 'Stop'
$version = $env:RELEASE_VERSION
@@ -179,6 +190,7 @@ jobs:
Write-Host "安装包:$package"
- name: Publish GitHub Release
if: steps.version.outputs.should_release == 'true'
run: |
$ErrorActionPreference = 'Stop'
if (!$env:GITHUB_TOKEN) {
+1 -1
View File
@@ -6,7 +6,7 @@ import { configureDiagnostics } from "./diagnostics/index.js";
export const type = "extension";
export let shuYing = new Object();
const shuYingLocalVersion = "2.0.2.3-rc.5";
const shuYingLocalVersion = "2.0.2.3-rc.8";
shuYing.name = "术樱包";
shuYing.editable = false;
+2
View File
@@ -842,6 +842,8 @@ const requestBattleFinish = outcome => {
recordBondDeath(player, _status.mengsanRun_shuying,
message => game.log(message));
}
// Capture the final HUD state while its battle session is still active.
current.hud?.refresh();
const accepted = current.flow.requestFinish({session:current.session, hp:game.me?.hp || 0, outcome, defeatedEnemies:current.director?.defeatedEnemies ?? 1});
if (accepted) {
current.pilesUI?.dispose();
+69 -4
View File
@@ -7,6 +7,20 @@ const app = path.resolve(__dirname, '../../../..');
const packages = process.env.CODEX_NODE_MODULES || 'C:/Users/Diuse/.cache/codex-runtimes/codex-primary-runtime/dependencies/node/node_modules';
const { chromium } = require(path.join(packages, 'playwright'));
const prefix = '/extension/' + encodeURIComponent('术樱包') + '/mengsan';
const holdStatus = async (page, locator, pointerType = 'mouse') => {
const box = await locator.boundingBox();
const point = {x:box.x + box.width / 2,y:box.y + box.height / 2};
if (pointerType === 'touch') {
await locator.dispatchEvent('pointerdown', {button:0,pointerId:44,
pointerType,clientX:point.x,clientY:point.y});
await page.waitForTimeout(550);
await page.evaluate(() => window.dispatchEvent(
new PointerEvent('pointerup', {pointerId:44,pointerType:'touch'})));
} else {
await page.mouse.move(point.x,point.y); await page.mouse.down();
await page.waitForTimeout(550); await page.mouse.up();
}
};
// Native themes use different button sizes. Drag onto an exposed point on the
// original player, rather than assuming its center is clear in the dense fixture.
const exposedTarget = (page,index) => page.evaluate(index => {
@@ -265,17 +279,68 @@ const server = http.createServer((req, res) => {
await page.evaluate(()=>{game.players[7].hp=0;hud.refresh();});
assert.equal(await page.evaluate(()=>game.players[7].style.cssText===originalEnemyPresentation[6].style&&!game.players[7].classList.contains('mengsan-hud-defeated-shuying')),true,'death keeps the original battlefield presentation');checks++;
await page.evaluate(()=>{game.players[7].hp=40;game.me.storage.mengsanVulnerable_shuying=3;hud.refresh();});
assert.match(await page.locator('.mengsan-hud-statuses-shuying').innerText(),/3/);checks++;
assert.equal(await page.locator('.mengsan-hud-statuses-shuying').innerText(),'','status chips contain icons only');checks++;
const heldStatus = page.locator('.mengsan-hud-statuses-shuying button').first();
await heldStatus.dispatchEvent('pointerdown', {button:0,pointerId:45,
pointerType:'touch',clientX:10,clientY:10});
await page.waitForTimeout(150);
await page.evaluate(() => {
game.me.storage.mengsanWeak_shuying=1; hud.refresh();
});
await page.waitForTimeout(450);
assert.equal(await page.locator('dialog.mengsan-hud-dialog-shuying').count(),1,'unrelated status update preserves an active hold');checks++;
await page.evaluate(() => window.dispatchEvent(
new PointerEvent('pointerup', {pointerId:45,pointerType:'touch'})));
await page.evaluate(() => {
game.me.storage.mengsanVulnerable_shuying=5; hud.refresh();
});
assert.match(await page.locator('dialog.mengsan-hud-dialog-shuying').innerText(),/易伤 5/,'open details show the current value');checks++;
await page.evaluate(() => {
delete game.me.storage.mengsanVulnerable_shuying; hud.refresh();
});
assert.match(await page.locator('dialog.mengsan-hud-dialog-shuying').innerText(),/已失效/,'removed state is explicitly expired');checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await page.evaluate(() => {
delete game.me.storage.mengsanWeak_shuying;
game.me.storage.mengsanVulnerable_shuying=3; hud.refresh();
});
await page.evaluate(()=>{for(const key of ['Weak','Frail','Artifact','Constrict','Tangled','Shrink','Plow','Slippery'])game.me.storage['mengsan'+key+'_shuying']=2;hud.refresh();});
assert.equal(await page.evaluate(()=>{const row=document.querySelector('.mengsan-hud-statuses-shuying').getBoundingClientRect();return [...document.querySelectorAll('.mengsan-hud-statuses-shuying button')].every(n=>{const r=n.getBoundingClientRect();return r.bottom<=row.bottom+1&&r.right<=row.right+1;});}),true,'matrix overflow keeps the visible statuses and more button inside the grid');checks++;
await page.getByRole('button',{name:'查看全部状态',exact:true}).click();
// Compact icon chips fit more states; register enough real display fields
// to exercise overflow on wide screens as well as phones.
await page.evaluate(async prefix => {
const {bindCombatStatusSource} = await import(prefix+'/battle/status-sources.js');
const keys=['turnStrength','turnEnergy','turnBlock','turnLoseHp',
'infernoLoseHp','lossDamage','lossStrength','vulnerableBonus',
'attackBlock','retaliation','colossus','freeAttack','noDraw',
'noEnergy','doubleTap','plating','exhaustBlock','exhaustDraw',
'vulnerableDraw','juggle','endAttack','retrieveAttack','bodyguard',
'autoStrike','firstBlock','blockDamage','barricade','corruption'];
bindCombatStatusSource(game.me,session,'overflow-test',() => ({
powers:Object.fromEntries(keys.map(key => [key,1])),
}));
hud.refresh();
},prefix);
await holdStatus(page,page.getByRole('button',{
name:'点击查看全部状态',exact:true}));
assert.ok(await page.getByRole('dialog').isVisible(),'overflow states remain available in the details');checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
assert.equal(await page.evaluate(()=>{const s=document.querySelector('.mengsan-hud-center-shuying').getBoundingClientRect(),p=game.me.getBoundingClientRect();return s.bottom<=p.top&&p.top-s.bottom<=13;}),true,'status chips automatically appear just above the portrait');checks++;
await page.locator('.mengsan-hud-statuses-shuying button').first().click();
await page.locator('.mengsan-hud-statuses-shuying button').first().tap();
assert.equal(await page.locator('dialog.mengsan-hud-dialog-shuying').count(),1,'short tap opens the status list');checks++;
const statusList = await page.locator('.mengsan-hud-detail-body-shuying').evaluate(body => ({
rows:body.querySelectorAll('details').length,
position:getComputedStyle(body).position,
minHeight:Math.min(...[...body.querySelectorAll('summary')].map(row=>row.getBoundingClientRect().height)),
height:body.getBoundingClientRect().height,
scrollable:body.scrollHeight>body.clientHeight,
}));
assert.ok(statusList.rows>20&&statusList.position!=='absolute'&&statusList.minHeight>=48&&statusList.height>0&&statusList.scrollable,'status list keeps all entries in normal flow with large tap targets: '+JSON.stringify(statusList));checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await holdStatus(page,page.locator('.mengsan-hud-statuses-shuying button').first());
assert.ok(await page.locator('dialog.mengsan-hud-dialog-shuying').isVisible());checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await page.locator('.mengsan-hud-statuses-shuying button').first().tap();
await holdStatus(page,page.locator('.mengsan-hud-statuses-shuying button').first(),'touch');
assert.ok(await page.locator('dialog.mengsan-hud-dialog-shuying').isVisible(),'touch opens the player status details');checks++;
await page.getByRole('button',{name:'关闭',exact:true}).click();
await page.evaluate(()=>game.uncheck());
+24 -3
View File
@@ -116,6 +116,7 @@ export function openCardLibrary(run, options = {}) {
const existing = document.querySelector("dialog.mengsan-deck-dialog-shuying[open]");
if (existing) { existing.focus(); return () => {}; }
const previousFocus = document.activeElement;
const selection = options.selection;
const dialog = element("dialog", "mengsan-deck-dialog-shuying", null);
dialog.setAttribute("aria-label", options.title || "卡牌库");
const header = element("header", "ms-deck-header", null, dialog);
@@ -143,12 +144,13 @@ export function openCardLibrary(run, options = {}) {
onClose?.(close);
};
button("关闭", header, close);
let view = !options.sections && options.view === "catalog" ? "catalog" : "deck";
let view = selection || (!options.sections && options.view === "catalog")
? "catalog" : "deck";
const navigation = element("nav", "ms-deck-tabs", null, dialog);
navigation.setAttribute("aria-label", "卡牌列表视图");
const deckTab = button("持有牌", navigation, () => { view = "deck"; render(); });
const catalogTab = button("图鉴", navigation, () => { view = "catalog"; render(); });
deckTab.hidden = catalogTab.hidden = Boolean(options.sections);
deckTab.hidden = catalogTab.hidden = Boolean(options.sections || selection);
let sectionIndex = 0;
const sectionTabs = options.sections ? options.sections().map((section, index) =>
button(section.title, navigation, () => { sectionIndex = index; render(); })) : [];
@@ -222,6 +224,24 @@ export function openCardLibrary(run, options = {}) {
element("p", "ms-deck-rules", details.description, copy);
if (!details.available) element("p", "ms-deck-warning", "该卡牌定义未加载;保留存档记录,不删除此牌。", copy);
for (const affix of details.affixes) element("p", "ms-deck-rules", affix, copy);
if (catalog && selection) {
const reason = !details.available ? "该卡牌定义未加载。" :
selection.unavailableReason?.(card) || "";
const feedback = element("p", "ms-deck-rules", reason, copy);
feedback.setAttribute("role", "status");
const confirm = button(selection.label, copy, () => {
if (closed || confirm.disabled) return;
confirm.disabled = true;
try {
selection.onSelect(card);
close();
} catch (error) {
feedback.textContent = error.message || "添加失败,请重试。";
confirm.disabled = false;
}
});
confirm.disabled = Boolean(reason);
}
body.scrollTop = 0; backButton.focus();
}
function fitCards() {
@@ -296,7 +316,8 @@ export function openCardLibrary(run, options = {}) {
summary.textContent = options.sections ? "剩余牌堆按从左到右、从上到下的顺序摸取;第 1 张为下一张。" :
`本次征程实际携带 · 共 ${current.length} 张 · 同名不同花色、点数分别展示`;
}
footer.textContent = catalog ? "图鉴仅供查阅,不会获得卡牌或改变征程牌组 · 点击卡牌查看完整介绍" :
if (catalog && selection) footer.textContent = selection.description;
else footer.textContent = catalog ? "图鉴仅供查阅,不会获得卡牌或改变征程牌组 · 点击卡牌查看完整介绍" :
"点击卡牌查看完整介绍 · 仅供查看,不改变牌组或抽牌顺序";
virtualGrid.setRecords(catalog || options.sections ? records : current.map(card => ({ card })));
if (!(catalog || options.sections ? records : current).length) {
+112 -4
View File
@@ -1,6 +1,21 @@
import { AFFIX_INFO } from "../cards/affixes.js";
import { hasCardAffix } from "../cards/intrinsic-affixes.js";
import { describeLibraryCard } from "./card-library.js";
import { describeLibraryCard, openCardLibrary } from "./card-library.js";
import { cardDefinitions } from "../cards/card-definitions.js";
import { createCardData } from "../cards/card-data.js";
import { DAZED_NAME, createDazedData } from "../cards/status-cards.js";
import { SLIMED_NAME, createSlimedData } from "../cards/slimed-card.js";
import { WOUND_NAME, createWoundData } from "../cards/wound-card.js";
import { INFECTION_NAME, createInfectionData } from "../cards/infection-card.js";
import { getDiagnostics } from "../../diagnostics/index.js";
import { _status } from "../../../../noname.js";
const statusFactories = {
[DAZED_NAME]: createDazedData,
[SLIMED_NAME]: createSlimedData,
[WOUND_NAME]: createWoundData,
[INFECTION_NAME]: createInfectionData,
};
const node = (tag, className, label, parent) => {
const element = document.createElement(tag);
@@ -20,6 +35,10 @@ const button = (label, parent, action) => {
// Keep the command battle-scoped; further GM actions can be added as panels here.
export function mountGMManager(session, owner, piles, battle, resources, game) {
let dialog = null, selected = null, previousFocus = null, disposed = false;
let closePicker = null, sequence = 0, message = "";
const diagnostics = getDiagnostics().scope("mengsan.gm", () => ({
sessionId: session.id,
}));
const available = () => !disposed && session.active && !battle.resolving;
const close = () => {
if (!dialog) return;
@@ -32,6 +51,7 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
};
const render = () => {
if (!dialog) return;
dialog.querySelector(".ms-gm-feedback").textContent = message;
const list = dialog.querySelector(".ms-gm-hand");
const editor = dialog.querySelector(".ms-gm-editor");
list.replaceChildren(); editor.replaceChildren();
@@ -60,9 +80,89 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
item.title = info.description;
}
};
const chooseTemporaryCard = () => {
if (!available() || closePicker) return;
close();
closePicker = openCardLibrary(null, {
title: "添加临时牌", eyebrow: "梦三 · GM",
view: "catalog",
selection: {
label: "加入手牌 · 仅本场战斗",
description: "选择卡牌查看详情并加入手牌;正常弃置和洗牌," +
"战斗结束清理。默认黑桃 A、未强化。",
unavailableReason: card =>
Object.hasOwn(cardDefinitions, card.name) ||
Object.hasOwn(statusFactories, card.name) ? "" :
"该卡牌尚无可用的战斗创建规则。",
onSelect(card) {
if (!available() || !owner.isAlive()) {
throw new Error("当前战斗已结束或角色已阵亡,无法添加。");
}
if (!describeLibraryCard(card).available) {
throw new Error("该卡牌定义未加载。");
}
const id = `mengsan_gm_${session.id}_${++sequence}`;
const factory = Object.hasOwn(statusFactories, card.name)
? statusFactories[card.name] : null;
const data = factory ? factory(id) : createCardData({
id, name: card.name, suit: "spade", number: 1,
nature: null, affixes: [], upgrade: 0,
}, { enemy: true });
// GM injection must not await the paused native event queue.
const created = piles.addToDiscard(data);
if (!created) throw new Error("当前战斗无法创建临时牌。");
try {
owner.directgain([created]);
if (!owner.getCards("h").includes(created)) {
throw new Error("临时牌未能加入手牌。");
}
} catch (error) {
created.remove();
diagnostics.error("temporaryCard.failed", error, {
cardName: data.name, cardId: id,
});
game.log("GM 临时牌添加失败", data.name, id,
error.message);
throw error;
}
selected = created;
message = `已将【${describeLibraryCard(data).name}】加入手牌,` +
"仅本场战斗有效。";
game.log("GM 添加临时牌", owner, data.name, id,
session.id);
diagnostics.info("temporaryCard.added", {
cardName: data.name, cardId: id,
});
try {
// check() reuses the choices from before directgain.
// Invalidate them without clearing the user's selection.
const event = _status.event;
if (event?.player === owner) {
delete event._cardChoice;
delete event._targetChoice;
delete event._skillChoice;
}
game.check();
}
catch (error) {
game.log("GM 临时牌已入手,选择状态刷新失败",
error.message);
}
},
},
onClose() {
closePicker = null;
if (available()) open();
},
});
};
const open = () => {
if (!available()) return false;
if (closePicker) return true;
if (dialog?.open) { render(); dialog.focus(); return true; }
const existing = document.querySelector(
"dialog.mengsan-deck-dialog-shuying[open]");
if (existing) { existing.focus(); return false; }
previousFocus = document.activeElement;
dialog = node("dialog", "mengsan-deck-dialog-shuying mengsan-gm-dialog-shuying", null);
dialog.setAttribute("aria-label", "梦三 GM 管理器");
@@ -70,8 +170,12 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
const header = node("header", "ms-deck-header", null, dialog);
node("h2", "ms-deck-title", "GM 管理器", header);
button("关闭", header, close);
node("p", "ms-deck-summary", "手牌词缀 · 仅本场战斗生效,不改永久牌组或存档。", dialog);
node("p", "ms-deck-summary",
"手牌词缀 / 添加临时牌 · 仅本场战斗生效,不改永久牌组或存档。", dialog);
button("添加临时牌", dialog, chooseTemporaryCard);
button("刷新手牌", dialog, render);
const feedback = node("p", "ms-gm-feedback", "", dialog);
feedback.setAttribute("role", "status");
node("div", "ms-gm-hand", null, dialog);
node("section", "ms-gm-editor", null, dialog);
const created = dialog;
@@ -85,7 +189,11 @@ export function mountGMManager(session, owner, piles, battle, resources, game) {
};
resources.field(globalThis, "mengsanGM_shuying", open);
resources.field(game, "mengsanGM_shuying", open);
const handle = { dispose: close };
session.ownResource(handle, () => { disposed = true; close(); });
const handle = { dispose() {
disposed = true;
closePicker?.(); closePicker = null;
close();
} };
session.ownResource(handle, handle.dispose);
return handle;
}
+43 -11
View File
@@ -69,7 +69,8 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
event.name !== "chooseToUse" || event.player !== player || !event.isMine?.() ||
event.skill || event.complexSelect || event.custom?.replace?.card || event.custom?.replace?.target || event.custom?.replace?.confirm ||
!env.isActiveCardUse(event, player) || !env.canPayCard?.(player, card) ||
ui.selected.cards.length || ui.selected.targets.length || ui.selected.buttons.length ||
(ui.selected.cards.length && (ui.selected.cards.length !== 1 || ui.selected.cards[0] !== card)) ||
ui.selected.targets.length || ui.selected.buttons.length ||
!card.classList.contains("selectable") || card.classList.contains("noclick") ||
status.mousedragging || status.dragged || status.paused2) return false;
const cards = get.select(event.selectCard);
@@ -81,19 +82,28 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
aim = document.createElementNS("http://www.w3.org/2000/svg", "svg");
aim.classList.add("mengsan-hand-aim-shuying");
aim.setAttribute("aria-hidden", "true");
aim.setAttribute("preserveAspectRatio", "none");
const path = document.createElementNS(aim.namespaceURI, "path");
aim.appendChild(path); document.body.appendChild(aim);
// Keep the SVG in the same zoom/transform space as the real hand.
// Android WebView can paint a body-fixed SVG in a different viewport.
aim.appendChild(path); ui.arena.appendChild(aim);
}
const rect = card.getBoundingClientRect();
const x = rect.left + rect.width / 2, y = rect.top + 12;
aim.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.innerHeight}`);
// clientX/Y 与卡牌矩形都是视口坐标,SVG 本身却可能受到 body zoom/transform 影响。
// 用 SVG 实际屏幕矩阵反变换,不能重复除 documentZoom 或假定 SVG 没有偏移。
const matrix = aim.getScreenCTM();
if (!matrix) { removeAim(); return; }
const inverse = matrix.inverse();
const start = new window.DOMPoint(x, y).matrixTransform(inverse);
const end = new window.DOMPoint(point.x, point.y).matrixTransform(inverse);
const width = ui.arena.clientWidth, height = ui.arena.clientHeight;
aim.setAttribute("viewBox", `0 0 ${width} ${height}`);
// Use painted bounds instead of relying on WebView CTM handling of zoom.
// With preserveAspectRatio=none, viewport-to-viewBox scaling is linear.
const bounds = aim.getBoundingClientRect();
if (!(bounds.width > 0 && bounds.height > 0)) {
removeAim(); return;
}
const scaleX = width / bounds.width;
const scaleY = height / bounds.height;
const start = { x: (x - bounds.left) * scaleX,
y: (y - bounds.top) * scaleY };
const end = { x: (point.x - bounds.left) * scaleX,
y: (point.y - bounds.top) * scaleY };
if (![start.x, start.y, end.x, end.y].every(Number.isFinite)) { removeAim(); return; }
// 十周年金色细线(本地 CONFIG.LINE_COLOR/LINE_WIDTH),不采用尖塔箭头/骨节造型。
aim.firstElementChild.setAttribute("d", `M ${start.x} ${start.y} L ${end.x} ${end.y}`);
@@ -157,7 +167,7 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
if (!state.moved && Math.hypot(point.x - state.x, point.y - state.y) < 9) return;
if (!state.moved) {
state.moved = true;
engineCall(() => ui.click.card.call(state.card));
if (!ui.selected.cards.includes(state.card)) engineCall(() => ui.click.card.call(state.card));
state.selected = ui.selected.cards.includes(state.card);
const targets = range(state.event);
if (!state.selected || !live(state) || !targets) { cleanup(true); return; }
@@ -229,6 +239,28 @@ export function createHandInput(player, session, adapter, fan, env, refresh, log
for (const type of ["mousedown", "mousemove", "mouseup", "click", "touchstart", "touchmove", "touchend"]) {
listen(window, type, compatibility, { capture: true, passive: false });
}
} else if (adapter.root && status && get) {
// Older Android WebViews expose TouchEvent but no PointerEvent.
// Route them through the same selection and drawing code.
const touchEvent = (event, touch, type) => ({
button: 0, isPrimary: true, pointerId: touch.identifier,
target: event.target, clientX: touch.clientX, clientY: touch.clientY,
type, preventDefault: () => event.preventDefault(),
stopImmediatePropagation: () => event.stopImmediatePropagation(),
});
const options = { capture: true, passive: false };
listen(window, "touchstart", event => {
if (event.touches.length !== 1) { cancel(); return; }
start(touchEvent(event, event.touches[0], "pointerdown"));
}, options);
for (const [type, handler] of [["touchmove", move], ["touchend", end], ["touchcancel", end]]) {
listen(window, type, event => {
const touch = Array.from(event.changedTouches).find(item => item.identifier === gesture?.id);
if (touch) handler(touchEvent(event, touch, type === "touchcancel" ? "pointercancel" : type));
}, options);
}
listen(window, "click", compatibility, options);
listen(window, "blur", cancel);
}
listen(adapter.root, "pointerover", hover);
listen(adapter.root, "pointerleave", () => { if (!gesture) fan.setHover(null); });
+3 -3
View File
@@ -77,10 +77,10 @@
transform-origin: 50% 50% !important;
}
.mengsan-hand-aim-shuying {
position: fixed;
position: absolute;
inset: 0;
width: 100vw;
height: 100vh;
width: 100%;
height: 100%;
z-index: 1000;
pointer-events: none;
overflow: visible;
+142 -24
View File
@@ -55,56 +55,171 @@ export function mountBattleHUD(player, battle, env) {
const statuses = create('div', 'mengsan-hud-statuses-shuying', center);
statuses.setAttribute('aria-label', '玩家当前状态');
const link = create('link', '', null); link.rel = 'stylesheet'; link.href = `${assetBase}/ui/hud/style.css`;
let detailTarget = null, detailId = null, detailBody = null;
let detailSignature = null;
const closeDialog = () => {
if (!dialog) return;
const current = dialog; dialog = null;
detailTarget = null; detailId = null; detailBody = null;
detailSignature = null;
if (current.open) current.close(); current.remove();
if (previousFocus?.isConnected) previousFocus.focus();
};
const openDetails = target => {
if (disposed || !battle.session.active) return;
closeDialog(); previousFocus = document.activeElement;
dialog = create('dialog', 'mengsan-hud-dialog-shuying', document.body);
const current = dialog;
create('h2', '', dialog, `${nameOf(target)} · 当前状态`);
const close = create('button', 'mengsan-hud-dialog-close-shuying', dialog, '关闭'); close.addEventListener('click', closeDialog);
const entries = collectCombatStatuses(target, battle);
const refreshDetails = () => {
if (!dialog || !detailBody) return;
const entries = collectCombatStatuses(detailTarget, battle);
const signature = JSON.stringify(entries);
if (signature === detailSignature) return;
const expanded = detailSignature === null ? new Set(detailId ? [detailId] : []) :
new Set([...detailBody.querySelectorAll('details[open]')].map(row => row.dataset.statusId));
detailSignature = signature; detailBody.replaceChildren();
if (detailId && !entries.some(entry => entry.id === detailId)) {
create('p', '', detailBody, '该状态已失效。');
}
for (const entry of entries) {
const row = create('section', 'mengsan-hud-detail-row-shuying', dialog);
create('strong', '', row, `${entry.name}${entry.value == null ? '' : ` ${entry.value}${entry.unit ? ` ${entry.unit}` : ''}`}`);
const row = create('details', 'mengsan-info-row-shuying',
detailBody);
row.dataset.statusId = entry.id;
row.open = expanded.has(entry.id);
const summary = create('summary', '', row);
if (entry.icon) {
const icon = create('img', 'mengsan-relic-icon-shuying', summary);
icon.src = `${assetBase}/assets/status/${entry.icon}`; icon.alt = '';
}
create('strong', '', summary, `${entry.name}${entry.value == null ? '' : ` ${entry.value}${entry.unit ? ` ${entry.unit}` : ''}`}`);
create('p', '', row, entry.detail);
}
if (!entries.length) create('p', '', dialog, '暂无已登记状态。');
if (!entries.length && !detailId) create('p', '', detailBody, '暂无已登记状态。');
};
const openDetails = (target, id = null) => {
if (disposed || frozen || !battle.session.active) return;
closeDialog(); previousFocus = document.activeElement;
dialog = create('dialog', 'mengsan-hud-dialog-shuying mengsan-deck-dialog-shuying mengsan-relic-dialog-shuying', document.body);
const current = dialog;
const header = create('header', 'ms-deck-header', dialog);
create('h2', '', header, `${nameOf(target)} · 当前状态`);
const close = create('button', 'ms-deck-button', header, '关闭'); close.addEventListener('click', closeDialog);
detailTarget = target; detailId = id;
detailBody = create('div', 'mengsan-hud-detail-body-shuying mengsan-relic-list-shuying', dialog);
refreshDetails();
// Unknown/native marks retain their engine intro and are never hidden by the HUD.
dialog.addEventListener('cancel', event => { event.preventDefault(); closeDialog(); });
dialog.addEventListener('close', () => { if (dialog === current) closeDialog(); });
for (const type of ['pointerdown', 'pointerup', 'click', 'touchstart', 'touchend', 'keydown']) dialog.addEventListener(type, event => event.stopPropagation());
dialog.showModal(); close.focus();
};
let statusHold = null, statusTimer = null;
const cancelStatusHold = () => {
if (statusTimer !== null) window.clearTimeout(statusTimer);
statusHold?.button.classList.remove('is-pressed');
statusHold = null; statusTimer = null;
};
const statusButton = event => {
const button = event.target.closest?.('.mengsan-hud-status-shuying');
return button && statuses.contains(button) ? button : null;
};
const statusDown = event => {
cancelStatusHold();
const button = statusButton(event);
if (!button || event.button !== 0 || disposed || frozen) return;
statusHold = { button, id: event.pointerId,
x: event.clientX, y: event.clientY };
button.classList.add('is-pressed');
statusTimer = window.setTimeout(() => {
cancelStatusHold();
if (button.isConnected) {
openDetails(player, button.dataset.statusId || null);
}
}, 500);
};
const statusMove = event => {
if (event.pointerId !== statusHold?.id) return;
if (Math.hypot(event.clientX - statusHold.x,
event.clientY - statusHold.y) > 8) cancelStatusHold();
};
const statusUp = event => {
if (event.pointerId === statusHold?.id) cancelStatusHold();
};
const statusListeners = [
[statuses, 'pointerdown', statusDown],
[statuses, 'scroll', cancelStatusHold],
[window, 'pointermove', statusMove, true],
[window, 'pointerup', statusUp, true],
[window, 'pointercancel', statusUp, true],
[window, 'blur', cancelStatusHold],
];
for (const args of statusListeners) {
args[0].addEventListener(...args.slice(1));
}
const stopStatusInput = () => {
cancelStatusHold();
for (const args of statusListeners) {
args[0].removeEventListener(...args.slice(1));
}
};
statuses.addEventListener('click', event => {
event.preventDefault();
const button = statusButton(event);
// Every entry opens the whole list; precise long presses are optional.
if (button && !dialog) {
openDetails(player, button.dataset.statusId || null);
}
});
statuses.addEventListener('contextmenu', event => event.preventDefault());
let statusSignature = null;
function renderStatuses() {
const entries = collectCombatStatuses(player, battle);
const columns = layout === 'narrow' ? 1 : 2;
const columns = Math.max(1,
Math.floor(((center.clientWidth || 76) + 6) / 38));
const rows = Math.max(1, Math.floor((statuses.clientHeight || 80) / 38));
const maximum = Math.max(0, columns * rows - (entries.length > columns * rows ? 1 : 0));
const signature = JSON.stringify([maximum, entries]);
if (signature !== statusSignature) {
statusSignature = signature; statuses.replaceChildren();
statusSignature = signature;
center.hidden = entries.length === 0;
const existing = new Map([...statuses.children].map(button =>
[button.dataset.statusId || null, button]));
const wantedButtons = [];
for (const entry of entries.slice(0, maximum)) {
const button = create('button', 'mengsan-hud-status-shuying', statuses);
button.setAttribute('aria-label', `${entry.name} ${entry.value ?? ''} ${entry.unit},查看状态详情`);
if (entry.icon) {
const image = create('img', '', button); image.src = `${assetBase}/assets/status/${entry.icon}`; image.alt = '';
image.addEventListener('error', () => image.remove(), { once: true });
const button = existing.get(entry.id) ||
create('button', 'mengsan-hud-status-shuying', null);
button.dataset.statusId = entry.id;
button.setAttribute('aria-label', `${entry.name} ${entry.value ?? ''} ${entry.unit},点击查看状态列表`);
button.setAttribute('aria-haspopup', 'dialog');
if (button.dataset.icon !== (entry.icon || '')) {
button.dataset.icon = entry.icon || '';
button.replaceChildren();
button.classList.remove('mengsan-hud-status-fallback-shuying');
if (entry.icon) {
const image = create('img', '', button);
image.src = `${assetBase}/assets/status/${entry.icon}`;
image.alt = '';
image.addEventListener('error', () => {
image.remove();
button.classList.add('mengsan-hud-status-fallback-shuying');
}, { once: true });
}
}
create('span', '', button, entry.name);
if (entry.value != null) create('b', '', button, entry.value);
button.addEventListener('click', () => openDetails(player));
wantedButtons.push(button);
}
if (entries.length > maximum) {
const more = create('button', 'mengsan-hud-status-shuying', statuses, `+${entries.length - maximum}`);
more.setAttribute('aria-label', '查看全部状态'); more.addEventListener('click', () => openDetails(player));
const more = existing.get(null) || create('button',
'mengsan-hud-status-shuying mengsan-hud-status-more-shuying',
null);
more.setAttribute('aria-label', '点击查看全部状态');
more.setAttribute('aria-haspopup', 'dialog');
wantedButtons.push(more);
}
if (statusHold && !wantedButtons.includes(statusHold.button)) {
cancelStatusHold();
}
for (const button of [...statuses.children]) {
if (!wantedButtons.includes(button)) button.remove();
}
for (const [index, button] of wantedButtons.entries()) {
if (statuses.children[index] !== button) {
statuses.insertBefore(button, statuses.children[index] || null);
}
}
}
const wanted = new Set();
@@ -236,7 +351,8 @@ export function mountBattleHUD(player, battle, env) {
text(name, nameOf(player)); text(hp, `生命 ${player.hp} / ${player.maxHp}`); text(block, `格挡 ${player.hujia || 0}`);
healthFill.style.width = `${Math.max(0, Math.min(100, player.maxHp > 0 ? player.hp / player.maxHp * 100 : 0))}%`;
text(energy, `费用 ${player.storage.mengsanEnergy_shuying ?? 0} / ${player.storage.mengsanMaxEnergy_shuying ?? 0}`);
syncActors(); syncExternalEquipment(); renderStatuses(); syncControls(); syncNotifications();
syncActors(); syncExternalEquipment(); renderStatuses();
refreshDetails(); syncControls(); syncNotifications();
overlays.refresh({ footerHeight:hudHeightFor(), status:_status });
}
function schedule() {
@@ -246,6 +362,7 @@ export function mountBattleHUD(player, battle, env) {
const timer = window.setInterval(schedule, 200);
function freeze() {
if(disposed || frozen)return;
stopStatusInput();
frozen=true;window.clearInterval(timer);
if(frame!==null){window.cancelAnimationFrame(frame);frame=null;}
observer?.disconnect();resize?.disconnect();closeDialog();overlays.dispose();
@@ -253,6 +370,7 @@ export function mountBattleHUD(player, battle, env) {
}
function dispose() {
if (disposed) return; disposed = true;
stopStatusInput();
window.clearInterval(timer); if (frame !== null) window.cancelAnimationFrame(frame);
observer?.disconnect(); resize?.disconnect(); window.removeEventListener('resize', schedule);
document.removeEventListener('visibilitychange', schedule);
+2 -2
View File
@@ -26,8 +26,8 @@ const effects = {
lossStrength: ['撕裂', 'rupture', '力量', '自身回合失去生命时获得力量。'],
vulnerableBonus: ['易伤增幅', 'vicious', '倍率加成', '对易伤敌人的伤害倍率额外加成。'],
attackBlock: ['狂怒', 'rage', '格挡', '本回合每打出一张攻击牌获得格挡。'],
retaliation: ['火焰屏障', 'flame_barrier', '伤害', '本回合受到攻击后反击。'],
colossus: ['巨像', 'colossus', '', '本回合受到易伤敌人的攻击伤害减少50%。'],
retaliation: ['火焰屏障', 'flame_barrier', '伤害', '至下个自身回合开始,受到攻击后反击。'],
colossus: ['巨像', 'colossus', '', '至下个自身回合开始,受到易伤敌人的攻击伤害减少50%。'],
freeAttack: ['免费攻击', 'free_attack', '', '下一张符合规则的攻击牌免费。'],
noDraw: ['不可抽牌', 'no_draw', '', '本回合不能继续抽牌。'],
noEnergy: ['无法获得费用', 'no_energy_gain', '', '本回合不能再获得费用。'],
+10 -6
View File
@@ -19,11 +19,16 @@
.mengsan-hud-health-track-shuying>span { height:100%;background:#9bb78d; }
.mengsan-hud-energy-shuying { color:#eacb87;font-size:16px;font-variant-numeric:tabular-nums;white-space:nowrap; }
.mengsan-hud-center-shuying { left:40px;right:auto;top:auto;bottom:var(--mengsan-side-dock-bottom);width:var(--mengsan-profile-width);height:var(--mengsan-status-height); }
.mengsan-hud-shuying .mengsan-hud-statuses-shuying { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:32px;align-content:end;gap:6px;overflow:hidden;white-space:nowrap;height:100%; }
.mengsan-hud-shuying .mengsan-hud-status-shuying { display:flex;align-items:center;gap:4px;max-width:100%;min-width:0;min-height:32px;padding:3px 6px;background:transparent;border-radius:10px; }
.mengsan-hud-status-shuying span { overflow:hidden;text-overflow:ellipsis;font-size:12px; }
.mengsan-hud-status-shuying b { font-variant-numeric:tabular-nums;font-size:13px; }
.mengsan-hud-status-shuying img { width:22px;height:22px;object-fit:contain; }
.mengsan-hud-shuying .mengsan-hud-statuses-shuying { display:grid;grid-template-columns:repeat(auto-fill,32px);grid-auto-rows:32px;align-content:end;gap:6px;overflow:hidden;white-space:nowrap;height:100%; }
.mengsan-hud-shuying .mengsan-hud-status-shuying { display:flex;align-items:center;justify-content:center;width:32px;height:32px;min-width:0;min-height:32px;padding:2px;background:transparent;border-radius:6px;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;touch-action:pan-y; }
.mengsan-hud-status-shuying img { width:26px;height:26px;object-fit:contain;pointer-events:none; }
.mengsan-hud-status-shuying.is-pressed { border-color:#dcc18e;background:#ffffff12; }
.mengsan-hud-status-more-shuying::after { content:'\2022\2022\2022';letter-spacing:1px; }
.mengsan-hud-status-fallback-shuying::after { content:'';width:12px;height:12px;border:2px solid #dcc18e;transform:rotate(45deg); }
/* Equipment Spine effects live on this body canvas (native z-index 7).
Keep them above the portrait (25) and below action controls (30).
Inline elevations used by awakening animations still take precedence. */
body.mengsan-hud-active-shuying>#decadeUI-canvas { z-index:28; }
.mengsan-hud-hand-shuying { position:absolute!important;left:var(--mengsan-hud-left)!important;right:var(--mengsan-hud-right)!important;bottom:68px!important;top:auto!important;width:calc(100% - var(--mengsan-hud-left) - var(--mengsan-hud-right))!important;height:calc(var(--mengsan-hud-height,274px) - 126px)!important;z-index:24!important;background:none!important;border:0!important;transform:none!important;pointer-events:none; }
.mengsan-hud-hand-shuying .handcards>.card { pointer-events:auto; }
.mengsan-hud-mebg-shuying,.mengsan-hud-hand-shuying>.fakeme.avatar { display:none!important; }
@@ -114,7 +119,6 @@ body.mengsan-hud-active-shuying #arena>.mengsan-hud-controls-shuying>.mengsan-hu
body.mengsan-hud-active-shuying #arena .mengsan-hud-native-skills-shuying>div { width:100%!important;min-width:0!important;box-sizing:border-box!important;padding:8px 10px!important;min-height:40px!important;font:14px/20px "Microsoft YaHei",sans-serif!important;white-space:normal!important; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-center-shuying { left:22px; }
[data-mengsan-hud-layout="short"] .mengsan-hud-shuying .mengsan-hud-statuses-shuying { height:100%; }
[data-mengsan-hud-layout="narrow"] .mengsan-hud-shuying .mengsan-hud-statuses-shuying { grid-template-columns:1fr; }
.mengsan-hud-prompt-shuying { box-sizing:border-box!important;height:auto!important;min-height:0!important;overflow:auto!important;padding:2px 6px!important;background:none!important;border:0!important;box-shadow:none!important;text-align:center!important;z-index:32!important;color:#f6edcb!important;text-shadow:0 1px 3px #000,0 0 6px #000!important; }
body.mengsan-hud-active-shuying .mengsan-hud-card-intro-shuying { box-sizing:border-box!important;z-index:90!important;height:auto!important;min-height:0!important;overflow:auto!important;border-radius:14px!important;background:#202020f5!important;box-shadow:0 8px 24px #0007!important;color:#f4f4f4!important;transition:none!important; }
body.mengsan-hud-active-shuying #window>.mengsan-hud-card-intro-shuying { z-index:90!important; }
+2 -3
View File
@@ -2,7 +2,7 @@ export function mountRelicStrip(root, getRelics, open, createIcon,
document, window) {
const strip = document.createElement("div");
strip.className = "mengsan-hand-relics-shuying";
strip.setAttribute("aria-label", "持有遗物,长按查看描述");
strip.setAttribute("aria-label", "持有遗物,点击查看列表");
const before = root.style.getPropertyValue("--mengsan-relic-space");
const priority = root.style.getPropertyPriority("--mengsan-relic-space");
let pending = null, timer = null, signature = null, disposed = false;
@@ -38,7 +38,6 @@ export function mountRelicStrip(root, getRelics, open, createIcon,
const click = event => {
stop(event);
event.preventDefault();
if (event.detail !== 0) return;
const button = event.target.closest?.("button");
const relic = getRelics().find(item => item.id === button?.dataset.relicId);
if (relic) open(relic);
@@ -71,7 +70,7 @@ export function mountRelicStrip(root, getRelics, open, createIcon,
const button = document.createElement("button");
button.type = "button";
button.dataset.relicId = relic.id;
button.setAttribute("aria-label", `${relic.name},长按查看描述`);
button.setAttribute("aria-label", `${relic.name},点击查看遗物列表`);
button.setAttribute("aria-haspopup", "dialog");
const fallback = document.createElement("span");
fallback.textContent = relic.name;
+14 -7
View File
@@ -26,22 +26,29 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
button.textContent = `遗物 ${relics.length}`;
strip?.refresh();
if (!list) return;
const expanded = new Set([...list.querySelectorAll('details[open]')].map(row => row.dataset.relicId));
if (!list.children.length && selected) expanded.add(selected);
list.replaceChildren();
if (!relics.length) {
const empty = document.createElement("p");
empty.textContent = "本次征程尚未获得遗物。";
list.appendChild(empty);
}
for (const relic of selected ? relics.filter(r => r.id === selected) : relics) {
const row = document.createElement("section");
const icon=createRelicIcon(relic.image);if(icon)row.appendChild(icon);
const name = document.createElement("h3");
for (const relic of relics) {
const row = document.createElement("details");
row.className = "mengsan-info-row-shuying";
row.dataset.relicId = relic.id;
row.open = expanded.has(relic.id);
const summary = document.createElement("summary");
const icon=createRelicIcon(relic.image);if(icon)summary.appendChild(icon);
const name = document.createElement("strong");
name.textContent = relic.name;
summary.appendChild(name);
const description = document.createElement("p");
description.textContent = relic.description;
const status = document.createElement("small");
status.textContent = `${relic.pool} · ${relic.tier}${relic.ancient ? ` · ${relic.ancient}` : ""} · ${battleRelics.status(relic)}`;
row.append(name, description, status);
row.append(summary, description, status);
list.appendChild(row);
}
};
@@ -53,11 +60,11 @@ export function mountRelics(session, run, battleRelics, { stripRoot = ui.me } =
const currentDialog = dialog;
dialog.className = "mengsan-deck-dialog-shuying " +
"mengsan-relic-dialog-shuying";
dialog.setAttribute("aria-label", relic?.name || "遗物(道具)");
dialog.setAttribute("aria-label", "遗物(道具)");
const header = document.createElement("header");
header.className = "ms-deck-header";
const title = document.createElement("h2");
title.textContent = relic?.name || "遗物(道具)";
title.textContent = "遗物(道具)";
const dismiss = document.createElement("button");
dismiss.type = "button";
dismiss.className = "ms-deck-button";
+7
View File
@@ -1434,6 +1434,13 @@ body.mengsan-battle-ui-shuying :is(
}
.mengsan-relic-dialog-shuying { max-width: 620px; }
.mengsan-relic-list-shuying { overflow-y: auto; padding: 12px 0; }
.mengsan-deck-dialog-shuying .mengsan-relic-list-shuying { position:relative;display:block;flex:1;min-height:0;overscroll-behavior:contain;touch-action:pan-y; }
.mengsan-info-row-shuying { display:block;border-bottom:1px solid #b9975d55;padding:8px 0; }
.mengsan-info-row-shuying>summary { display:list-item;min-height:48px;padding:8px 10px;cursor:pointer;touch-action:manipulation;color:#ffe0a1;line-height:32px; }
.mengsan-info-row-shuying>summary:focus-visible { outline:2px solid #ffe0a1;outline-offset:-2px; }
.mengsan-info-row-shuying>summary>.mengsan-relic-icon-shuying { width:32px;height:32px;vertical-align:middle;margin-right:12px; }
.mengsan-info-row-shuying>summary>strong { display:inline;vertical-align:middle;overflow-wrap:anywhere; }
.mengsan-info-row-shuying>p,.mengsan-info-row-shuying>small { display:block;padding:8px 12px;white-space:pre-line;overflow-wrap:anywhere; }
.mengsan-relic-list-shuying section {
padding: 14px 0;
border-bottom: 1px solid #b9975d55;
+10
View File
@@ -17,6 +17,16 @@
3. 发布工作流为每个模块生成独立清单,并将清单提交到发布标签。
4. 完整 ZIP 安装包仍包含所有模块,供离线或整包安装使用。
修改 `extension.js` 中的 `shuYingLocalVersion`,提交并推送到 GitHub
默认分支后,工作流会比较推送前后的版本号。版本号变化时自动生成和校验
清单、创建 `v版本号` 标签,并打包发布;同版本的代码修改不重复发布。
手动运行 GitHub 发布工作流也读取该次提交的版本号,无需再次填写版本。
版本格式为 `2.0.2.4` 或 `2.0.2.4-rc.1`;带 `-rc.N` 的 Release
标记为测试版,其他标记为正式版。已有同名标签时停止,避免覆盖旧发布。
Gitea 保持接收同一发布标签后打包的流程;使用 Gitea 更新源时,需将该
标签同步到 Gitea,单独推送分支代码不会触发 Gitea 发布。
客户端从标签的 raw 文件路径读取清单。因此 Gitea 发布必须使用已经包含
`dist/manifest.json` 和 `dist/modules/*.json` 的同一标签;当前 Gitea 工作流
会生成并上传附件,但不会改写触发它的标签。
+46
View File
@@ -0,0 +1,46 @@
param(
[Parameter(Mandatory = $true)][string]$Root,
[string]$EventName = 'workflow_dispatch',
[string]$PreviousRef = ''
)
$ErrorActionPreference = 'Stop'
function Read-Version([string]$Ref) {
$source = git show "${Ref}:extension.js"
if ($LASTEXITCODE -ne 0) { throw "Cannot read extension.js at $Ref" }
$matches = [regex]::Matches(($source -join "`n"),
'(?m)^\s*const\s+shuYingLocalVersion\s*=\s*"([^"\r\n]+)"\s*;')
if ($matches.Count -ne 1) { throw "Expected one version at $Ref" }
return $matches[0].Groups[1].Value
}
Push-Location -LiteralPath $Root
try {
$version = Read-Version 'HEAD'
if ($version -cnotmatch '^\d+\.\d+\.\d+\.\d+(-rc\.\d+)?$') {
throw "Invalid release version: $version"
}
$changed = $true
if ($EventName -eq 'push') {
if ($PreviousRef -notmatch '^[0-9a-fA-F]{40}$') {
throw 'Push event must provide its previous commit SHA'
}
if ($PreviousRef -notmatch '^0+$') {
$previous = Read-Version $PreviousRef
$changed = $previous -ne $version
}
}
if (!$env:GITHUB_OUTPUT -or !$env:GITHUB_ENV) {
throw 'Actions output and environment files are required'
}
$utf8 = New-Object System.Text.UTF8Encoding($false)
$release = $changed.ToString().ToLowerInvariant()
[IO.File]::AppendAllText($env:GITHUB_OUTPUT,
"should_release=$release`n", $utf8)
[IO.File]::AppendAllText($env:GITHUB_ENV,
"RELEASE_VERSION=$version`nRELEASE_TAG=v$version`n", $utf8)
Write-Host "Version: $version; release required: $release"
} finally {
Pop-Location
}
+62 -2
View File
@@ -12,6 +12,7 @@ let sessionVerified = new Set();
let verificationContext = null;
let verificationDirty = false;
let fullVerification = false;
const progressLayers = new WeakMap();
function cacheContext() {
if (lib.node?.fs && typeof window.__dirname == "string") return `node:${window.__dirname}`;
@@ -265,12 +266,69 @@ function setBusy(shuYing, busy) {
}
function ensureProgressNode(shuYing) {
if (!shuYing.text.parentNode) {
document.body.appendChild(shuYing.text);
const node = shuYing.text;
Object.assign(node.style, {
position: "fixed", inset: "14px auto auto 50%", margin: "0",
maxWidth: "calc(100vw - 28px)", zIndex: "2147483647",
});
// Native modal dialogs outrank every z-index. A manual popover is non-modal
// and joins their top layer without intercepting game input or focus.
if (typeof node.showPopover == "function") {
if (node.parentNode !== document.body) document.body.appendChild(node);
node.setAttribute("popover", "manual");
if (node.matches(":popover-open")) node.hidePopover();
node.showPopover();
} else {
// Old WebViews can display progress inside the active modal's top
// layer without opening another modal or making the game inert.
let layer = progressLayers.get(node);
if (!layer) {
layer = { dialogs: [], observer: null };
layer.sync = (records = []) => {
const initial = layer.dialogs.length === 0;
const dialogs = [...document.querySelectorAll('dialog[open]')]
.filter(dialog => {
try { return dialog.matches(':modal'); }
catch { return true; }
});
layer.dialogs = layer.dialogs.filter(dialog =>
dialogs.includes(dialog));
for (const dialog of dialogs) {
if (!layer.dialogs.includes(dialog)) layer.dialogs.push(dialog);
}
if (initial) {
const focused = document.activeElement?.closest('dialog');
if (dialogs.includes(focused)) {
layer.dialogs = layer.dialogs.filter(dialog =>
dialog !== focused);
layer.dialogs.push(focused);
}
}
for (const record of records) {
if (record.type !== 'attributes' ||
!dialogs.includes(record.target)) continue;
layer.dialogs = layer.dialogs.filter(dialog =>
dialog !== record.target);
layer.dialogs.push(record.target);
}
const host = layer.dialogs[layer.dialogs.length - 1] ||
document.body;
if (node.parentNode !== host) host.appendChild(node);
};
layer.observer = new MutationObserver(layer.sync);
layer.observer.observe(document.body, {
childList: true, subtree: true,
attributes: true, attributeFilter: ['open'],
});
progressLayers.set(node, layer);
}
layer.sync();
}
}
function removeProgressNode(shuYing) {
progressLayers.get(shuYing.text)?.observer.disconnect();
progressLayers.delete(shuYing.text);
if (shuYing.text.parentNode) {
shuYing.text.parentNode.removeChild(shuYing.text);
}
@@ -356,6 +414,8 @@ function setProgress(shuYing, options = {}) {
const now = Date.now();
if (!options.force && now - (shuYing._progressRendered || 0) < 120) return;
shuYing._progressRendered = now;
// Re-promote after any Mengsan modal opened since the previous update.
ensureProgressNode(shuYing);
const current = Math.max(0, Number(options.current) || 0);
const total = Math.max(0, Number(options.total) || 0);