mirror of
https://github.com/Shu-Ying/noname-shuying.git
synced 2026-10-29 19:19:59 +08:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b423e17b6 |
@@ -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,33 +17,23 @@ 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.sha }}
|
||||
ref: ${{ github.event.repository.default_branch }}
|
||||
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
|
||||
@@ -128,7 +118,6 @@ jobs:
|
||||
Write-Host "已创建包含清单的标签:$tag"
|
||||
|
||||
- name: Build ZIP from tag
|
||||
if: steps.version.outputs.should_release == 'true'
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$version = $env:RELEASE_VERSION
|
||||
@@ -190,7 +179,6 @@ jobs:
|
||||
Write-Host "安装包:$package"
|
||||
|
||||
- name: Publish GitHub Release
|
||||
if: steps.version.outputs.should_release == 'true'
|
||||
run: |
|
||||
$ErrorActionPreference = 'Stop'
|
||||
if (!$env:GITHUB_TOKEN) {
|
||||
|
||||
Vendored
+11
-11
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"version": "2.0.2.3-rc.7",
|
||||
"generated_at": "2026-10-29T06:46:48.548759+00:00",
|
||||
"version": "2.0.2.3-rc.6",
|
||||
"generated_at": "2026-10-29T04:08:40.947987+00:00",
|
||||
"algorithm": "sha256",
|
||||
"update_channels": true,
|
||||
"file_count": 288,
|
||||
"size_bytes": 48048830,
|
||||
"folder_sha256": "54dd60f93ca565bb1f35b7b69a1b0d6bd0171cbe4245dd31d0907f55973b4705",
|
||||
"size_bytes": 48045889,
|
||||
"folder_sha256": "c1c22cf38893f208ab42a5b77d042fd7c623364d4871247f3729851adaae867f",
|
||||
"core": [
|
||||
"extension.js",
|
||||
"menu.js",
|
||||
@@ -439,7 +439,7 @@
|
||||
},
|
||||
"extension.js": {
|
||||
"size": 15731,
|
||||
"sha256": "eeb216122e613bc04b1764ae096920735b6970c3cf5ee9e83fa528e82d62ae29"
|
||||
"sha256": "0e801feff445e66a3ab9fade2e12b389019451e7dd203ac791d4409cc9076c2e"
|
||||
},
|
||||
"function.js": {
|
||||
"size": 38588,
|
||||
@@ -1350,8 +1350,8 @@
|
||||
"sha256": "bd89818b8f535c19b51f107ca2c75dec669852e4a604ed55f6fa945ecec8e6d6"
|
||||
},
|
||||
"update.js": {
|
||||
"size": 80395,
|
||||
"sha256": "faf3b894c872db201e9cf71a2c43fbc06ef9027270dd8b4c72f2668858d91702"
|
||||
"size": 77454,
|
||||
"sha256": "f2693e030c0008c788c3e1785e0d6b41dc1df1251624efc003ff0b51d4c2a9f0"
|
||||
},
|
||||
"update.txt": {
|
||||
"size": 4962,
|
||||
@@ -1696,7 +1696,7 @@
|
||||
"extension.js": {
|
||||
"type": "file",
|
||||
"size": 15731,
|
||||
"sha256": "eeb216122e613bc04b1764ae096920735b6970c3cf5ee9e83fa528e82d62ae29"
|
||||
"sha256": "0e801feff445e66a3ab9fade2e12b389019451e7dd203ac791d4409cc9076c2e"
|
||||
},
|
||||
"function.js": {
|
||||
"type": "file",
|
||||
@@ -2965,8 +2965,8 @@
|
||||
},
|
||||
"update.js": {
|
||||
"type": "file",
|
||||
"size": 80395,
|
||||
"sha256": "faf3b894c872db201e9cf71a2c43fbc06ef9027270dd8b4c72f2668858d91702"
|
||||
"size": 77454,
|
||||
"sha256": "f2693e030c0008c788c3e1785e0d6b41dc1df1251624efc003ff0b51d4c2a9f0"
|
||||
},
|
||||
"update.txt": {
|
||||
"type": "file",
|
||||
@@ -3116,7 +3116,7 @@
|
||||
"entry": "mengsan/register.js",
|
||||
"manifest": "dist/modules/mengsan.json",
|
||||
"file_count": 830,
|
||||
"size_bytes": 148049031,
|
||||
"size_bytes": 148043940,
|
||||
"legacy_manifest": "dist/modules/mengsan.legacy.json"
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+16
-16
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"version": "2.0.2.3-rc.7",
|
||||
"generated_at": "2026-10-29T06:46:48.550770+00:00",
|
||||
"version": "2.0.2.3-rc.6",
|
||||
"generated_at": "2026-10-29T04:08:40.950013+00:00",
|
||||
"algorithm": "sha256",
|
||||
"update_channels": true,
|
||||
"file_count": 830,
|
||||
"size_bytes": 148049031,
|
||||
"folder_sha256": "1695f657990a4f805ada4dfa4799aa88c60af09be675373571c15025028b7644",
|
||||
"size_bytes": 148043940,
|
||||
"folder_sha256": "f7d08826710e8bb0260488701afba4f73f4a9b28ce463735eaff398886b40392",
|
||||
"core": [
|
||||
"mengsan/register.js"
|
||||
],
|
||||
@@ -4092,8 +4092,8 @@
|
||||
"sha256": "4b804c1d42c6c1171d42a37136fcb903bfb3128beae6a357b52ef9cede54908f"
|
||||
},
|
||||
"mengsan/ui/hand/input.js": {
|
||||
"size": 12452,
|
||||
"sha256": "516b2082be54e9e3f2bd8f5d2cec2f2676817a69c3819528ff3919bcb324650f"
|
||||
"size": 12295,
|
||||
"sha256": "afd6bca628fe478dcc7dec217f8e4e0cdbccd8f29f55b77266793f61c7ee7087"
|
||||
},
|
||||
"mengsan/ui/hand/overlays.js": {
|
||||
"size": 3970,
|
||||
@@ -4104,8 +4104,8 @@
|
||||
"sha256": "d673f460b44db76148dea6b213f7e0fa5c310ae2d7bcf6b4e86fa9ce3e6f0e05"
|
||||
},
|
||||
"mengsan/ui/hud/index.js": {
|
||||
"size": 24222,
|
||||
"sha256": "82f446741af2d79e8406ed64dab5b0c432b6f90eeab6e7b7c7331bd6e90ea9b4"
|
||||
"size": 19710,
|
||||
"sha256": "671e9c691f172a70cc5ff7e4e721c8a966f6d53d5f760e2fd46e9ccc10871e43"
|
||||
},
|
||||
"mengsan/ui/hud/overlays.js": {
|
||||
"size": 7007,
|
||||
@@ -4116,8 +4116,8 @@
|
||||
"sha256": "b18ae987f451453f77a397093cd57d8a8bd1fc03dbe845e3fc5a943da0a8ff04"
|
||||
},
|
||||
"mengsan/ui/hud/style.css": {
|
||||
"size": 20187,
|
||||
"sha256": "9906a3727c492bf4bce8e6a1c10318e7dd2be77db9d9a4a98432231dfe4e2254"
|
||||
"size": 19765,
|
||||
"sha256": "7e2c39086ee8768e3eb9adc6fe244c6f19150ff0c60f73216a9d9b4743a3c007"
|
||||
},
|
||||
"mengsan/ui/intent-display.js": {
|
||||
"size": 13291,
|
||||
@@ -8374,8 +8374,8 @@
|
||||
},
|
||||
"input.js": {
|
||||
"type": "file",
|
||||
"size": 12452,
|
||||
"sha256": "516b2082be54e9e3f2bd8f5d2cec2f2676817a69c3819528ff3919bcb324650f"
|
||||
"size": 12295,
|
||||
"sha256": "afd6bca628fe478dcc7dec217f8e4e0cdbccd8f29f55b77266793f61c7ee7087"
|
||||
},
|
||||
"overlays.js": {
|
||||
"type": "file",
|
||||
@@ -8394,8 +8394,8 @@
|
||||
"children": {
|
||||
"index.js": {
|
||||
"type": "file",
|
||||
"size": 24222,
|
||||
"sha256": "82f446741af2d79e8406ed64dab5b0c432b6f90eeab6e7b7c7331bd6e90ea9b4"
|
||||
"size": 19710,
|
||||
"sha256": "671e9c691f172a70cc5ff7e4e721c8a966f6d53d5f760e2fd46e9ccc10871e43"
|
||||
},
|
||||
"overlays.js": {
|
||||
"type": "file",
|
||||
@@ -8409,8 +8409,8 @@
|
||||
},
|
||||
"style.css": {
|
||||
"type": "file",
|
||||
"size": 20187,
|
||||
"sha256": "9906a3727c492bf4bce8e6a1c10318e7dd2be77db9d9a4a98432231dfe4e2254"
|
||||
"size": 19765,
|
||||
"sha256": "7e2c39086ee8768e3eb9adc6fe244c6f19150ff0c60f73216a9d9b4743a3c007"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"version": "2.0.2.3-rc.7",
|
||||
"version": "2.0.2.3-rc.6",
|
||||
"module_id": "mengsan",
|
||||
"snapshot": "legacy",
|
||||
"files": [
|
||||
|
||||
+1
-1
@@ -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.7";
|
||||
const shuYingLocalVersion = "2.0.2.3-rc.6";
|
||||
|
||||
shuYing.name = "术樱包";
|
||||
shuYing.editable = false;
|
||||
|
||||
@@ -7,20 +7,6 @@ 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 => {
|
||||
@@ -279,59 +265,17 @@ 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.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();
|
||||
});
|
||||
assert.match(await page.locator('.mengsan-hud-statuses-shuying').innerText(),/3/);checks++;
|
||||
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++;
|
||||
// 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}));
|
||||
await page.getByRole('button',{name:'查看全部状态',exact:true}).click();
|
||||
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().tap();
|
||||
assert.equal(await page.locator('dialog.mengsan-hud-dialog-shuying').count(),0,'short tap does not open status details');checks++;
|
||||
await holdStatus(page,page.locator('.mengsan-hud-statuses-shuying button').first());
|
||||
await page.locator('.mengsan-hud-statuses-shuying button').first().click();
|
||||
assert.ok(await page.locator('dialog.mengsan-hud-dialog-shuying').isVisible());checks++;
|
||||
await page.getByRole('button',{name:'关闭',exact:true}).click();
|
||||
await holdStatus(page,page.locator('.mengsan-hud-statuses-shuying button').first(),'touch');
|
||||
await page.locator('.mengsan-hud-statuses-shuying button').first().tap();
|
||||
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());
|
||||
|
||||
@@ -81,25 +81,19 @@ 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);
|
||||
}
|
||||
const rect = card.getBoundingClientRect();
|
||||
const x = rect.left + rect.width / 2, y = rect.top + 12;
|
||||
aim.setAttribute("viewBox", `0 0 ${window.innerWidth} ${window.innerHeight}`);
|
||||
// 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 = window.innerWidth / bounds.width;
|
||||
const scaleY = window.innerHeight / 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 };
|
||||
// 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);
|
||||
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}`);
|
||||
|
||||
+22
-129
@@ -55,160 +55,56 @@ 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 refreshDetails = () => {
|
||||
if (!dialog || !detailBody) return;
|
||||
const entries = collectCombatStatuses(detailTarget, battle)
|
||||
.filter(entry => detailId === null || entry.id === detailId);
|
||||
const signature = JSON.stringify(entries);
|
||||
if (signature === detailSignature) return;
|
||||
detailSignature = signature; detailBody.replaceChildren();
|
||||
for (const entry of entries) {
|
||||
const row = create('section', 'mengsan-hud-detail-row-shuying',
|
||||
detailBody);
|
||||
create('strong', '', row, `${entry.name}${entry.value == null ? '' : ` ${entry.value}${entry.unit ? ` ${entry.unit}` : ''}`}`);
|
||||
create('p', '', row, entry.detail);
|
||||
}
|
||||
if (!entries.length) create('p', '', detailBody,
|
||||
detailId === null ? '暂无已登记状态。' : '该状态已失效。');
|
||||
};
|
||||
const openDetails = (target, id = null) => {
|
||||
if (disposed || frozen || !battle.session.active) return;
|
||||
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);
|
||||
detailTarget = target; detailId = id;
|
||||
detailBody = create('div', 'mengsan-hud-detail-body-shuying', dialog);
|
||||
refreshDetails();
|
||||
const entries = collectCombatStatuses(target, battle);
|
||||
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}` : ''}`}`);
|
||||
create('p', '', row, entry.detail);
|
||||
}
|
||||
if (!entries.length) create('p', '', dialog, '暂无已登记状态。');
|
||||
// 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);
|
||||
// Pointer clicks require a hold; keyboard activation stays accessible.
|
||||
if (button && event.detail === 0) {
|
||||
openDetails(player, button.dataset.statusId || null);
|
||||
}
|
||||
});
|
||||
statuses.addEventListener('contextmenu', event => event.preventDefault());
|
||||
let statusSignature = null;
|
||||
function renderStatuses() {
|
||||
const entries = collectCombatStatuses(player, battle);
|
||||
const columns = Math.max(1,
|
||||
Math.floor(((center.clientWidth || 76) + 6) / 38));
|
||||
const columns = layout === 'narrow' ? 1 : 2;
|
||||
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;
|
||||
statusSignature = signature; statuses.replaceChildren();
|
||||
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 = 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 });
|
||||
}
|
||||
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 });
|
||||
}
|
||||
wantedButtons.push(button);
|
||||
create('span', '', button, entry.name);
|
||||
if (entry.value != null) create('b', '', button, entry.value);
|
||||
button.addEventListener('click', () => openDetails(player));
|
||||
}
|
||||
if (entries.length > maximum) {
|
||||
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 more = create('button', 'mengsan-hud-status-shuying', statuses, `+${entries.length - maximum}`);
|
||||
more.setAttribute('aria-label', '查看全部状态'); more.addEventListener('click', () => openDetails(player));
|
||||
}
|
||||
}
|
||||
const wanted = new Set();
|
||||
@@ -340,8 +236,7 @@ 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();
|
||||
refreshDetails(); syncControls(); syncNotifications();
|
||||
syncActors(); syncExternalEquipment(); renderStatuses(); syncControls(); syncNotifications();
|
||||
overlays.refresh({ footerHeight:hudHeightFor(), status:_status });
|
||||
}
|
||||
function schedule() {
|
||||
@@ -351,7 +246,6 @@ 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();
|
||||
@@ -359,7 +253,6 @@ 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);
|
||||
|
||||
@@ -19,16 +19,11 @@
|
||||
.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(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-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-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; }
|
||||
@@ -119,6 +114,7 @@ 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; }
|
||||
|
||||
@@ -17,16 +17,6 @@
|
||||
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 工作流
|
||||
会生成并上传附件,但不会改写触发它的标签。
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -12,7 +12,6 @@ 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}`;
|
||||
@@ -266,69 +265,12 @@ function setBusy(shuYing, busy) {
|
||||
}
|
||||
|
||||
function ensureProgressNode(shuYing) {
|
||||
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();
|
||||
if (!shuYing.text.parentNode) {
|
||||
document.body.appendChild(shuYing.text);
|
||||
}
|
||||
}
|
||||
|
||||
function removeProgressNode(shuYing) {
|
||||
progressLayers.get(shuYing.text)?.observer.disconnect();
|
||||
progressLayers.delete(shuYing.text);
|
||||
if (shuYing.text.parentNode) {
|
||||
shuYing.text.parentNode.removeChild(shuYing.text);
|
||||
}
|
||||
@@ -414,8 +356,6 @@ 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);
|
||||
|
||||
Reference in New Issue
Block a user