发布关卡编辑器独立离线版

This commit is contained in:
2026-11-23 19:01:21 +08:00
commit 7f83f146a4
16 changed files with 636931 additions and 0 deletions
+548
View File
@@ -0,0 +1,548 @@
'use strict';
const $ = id => document.getElementById(id);
const clone = value => JSON.parse(JSON.stringify(value));
const icons = () => window.lucide.createIcons();
const state = { mode: 'mainline', level: null, revision: '', baseline: '', definitions: [], selected: null, material: null,
kind: 'characters', view: 'source', history: [], future: [], result: null, sequence: 0,
zoom: 1, pan: { x: 0, y: 0 }, drag: null, hover: null, busy: false, draft: null };
const images = new Map();
const canvas = $('board'), ctx = canvas.getContext('2d');
let transform = null, validateTimer;
const layoutText = level => JSON.stringify([level.width, level.height, level.characters, level.aoes]);
const dirty = () => state.level && layoutText(state.level) !== state.baseline;
const selectedEntry = () => state.selected && state.level?.[state.selected.collection]?.[state.selected.index];
const definitionFor = entry => state.definitions.find(item => item.id === entry?.[0]);
const draftKey = () => 'level-editor:' + state.project + ':source:' + state.sourceLevel;
function message(text, error = false) { $('message').textContent = text; $('message').classList.toggle('error', error); }
function setBusy(value) { state.busy = value; document.body.classList.toggle('busy', value); $('save').disabled = value; $('open').disabled = value; }
async function api(url, body) {
if (state.mode === 'ghost-king') {
url = url.replace('/api/levels/', '/api/ghost-levels/');
if (url === '/api/validate') url = '/api/ghost-validate';
}
const adaptBootstrap = data => url === '/api/bootstrap' ? { ...data, mainlineCount: data.levelCount, levelCount: state.mode === 'ghost-king' ? data.ghostCount : data.levelCount } : data;
if (window.offlineEditor) return adaptBootstrap(await window.offlineEditor.api(url, body));
const response = await fetch(url, body === undefined ? {} : { method: 'POST',
headers: { 'Content-Type': 'application/json', 'X-Editor-Token': state.token }, body: JSON.stringify(body) });
const data = await response.json();
if (!response.ok) throw new Error(data.error || '请求失败');
return adaptBootstrap(data);
}
function guarded(action) { return (...args) => Promise.resolve().then(() => action(...args)).catch(error => message(error.message, true)); }
$('level-mode').onchange = guarded(async () => {
const previous = state.mode, next = $('level-mode').value;
if (state.busy || ((dirty() || pendingExtra()) && !confirm('当前关卡有未保存修改,是否切换模式?'))) { $('level-mode').value = previous; return; }
state.mode = next; state.sequence++; state.level = null; state.baseline = ''; state.selected = null;
state.levelCount = next === 'ghost-king' ? state.ghostCount : state.mainlineCount;
$('level-total').textContent = '/ ' + state.levelCount; $('level-number').max = state.levelCount;
$('mainline-manage').disabled = next === 'ghost-king';
await openLevel(1);
});
function imageFor(url) {
if (!url) return null;
if (!images.has(url)) {
const image = new Image();
image.onload = draw;
image.onerror = () => { image.failed = true; draw(); };
image.src = url;
images.set(url, image);
}
return images.get(url);
}
function makeThumbnail(definition, parent) {
parent.classList.toggle('has-overlay', Boolean(definition?.overlay));
if (definition?.image) {
const image = document.createElement('img'); image.src = definition.image; image.alt = definition.name;
parent.append(image);
if (definition.overlay) {
const overlay = document.createElement('img'); overlay.src = definition.overlay; overlay.alt = ''; overlay.className = 'entity-overlay';
parent.append(overlay);
}
} else {
const icon = document.createElement('i'); icon.dataset.lucide = 'fence'; icon.className = 'mechanism-symbol'; parent.append(icon);
}
}
function renderLibrary() {
const search = $('search').value.trim().toLowerCase();
const definitions = state.definitions.filter(item => item.collection === state.kind && (item.name.toLowerCase().includes(search) || String(item.id).includes(search)));
$('material-count').textContent = definitions.length + ' 项';
$('materials').replaceChildren();
definitions.forEach(definition => {
const button = document.createElement('button'); button.className = 'material'; button.title = definition.name;
button.classList.toggle('active', state.material?.id === definition.id);
const thumbnail = document.createElement('div'); thumbnail.className = 'thumbnail'; makeThumbnail(definition, thumbnail);
const name = document.createElement('strong'); name.textContent = definition.name;
const id = document.createElement('small'); id.textContent = definition.id;
button.append(thumbnail, name, id);
button.onclick = () => { if (state.busy) return; state.material = definition; state.selected = null; state.view = 'source'; state.hover = null; renderLibrary(); render(); message('已选择:' + definition.name); };
$('materials').append(button);
});
icons();
}
function renderInspector() {
const entry = selectedEntry(), definition = definitionFor(entry);
$('properties').hidden = !entry;
$('selection-empty').hidden = Boolean(entry);
document.querySelectorAll('#properties input,#properties select,#properties textarea,#properties button,.board-settings input').forEach(input => { input.disabled = state.view !== 'source'; });
$('selection-kind').textContent = entry ? (state.selected.collection === 'characters' ? '军械' : '机关') : '';
if (!entry || !definition) return;
$('selected-name').textContent = definition.name;
$('selected-id').textContent = '类型 ' + entry[0] + ' · 序号 ' + (state.selected.index + 1);
$('selected-image').replaceChildren(); makeThumbnail(definition, $('selected-image'));
const options = state.definitions.filter(item => item.collection === state.selected.collection);
$('object-type').replaceChildren(...options.map(item => { const option = document.createElement('option'); option.value = item.id; option.textContent = item.name; return option; }));
$('object-type').value = entry[0]; $('col').value = entry[1]; $('row').value = entry[2]; $('orientation').value = entry[3];
const footprint = definition.footprintsByOrientation[entry[3]];
$('footprint').textContent = footprint ? footprint.width + ' × ' + footprint.height : '无效';
const behaviors = { standard: '普通军械', collisionBomb: '碰撞炸弹', automaticExit: '自动离场', countdownBomb: '倒计时炸弹', movingHazard: '移动障碍', sealedUntilCollision: '碰撞唤醒', charmLeader: '牵引', bounceBack: '碰撞折返', fenceBreaker: '破栏', limitedStep: '步数限制', burrowingBlocker: '出入地面', teamLeader: '编队领队', teamMember: '编队成员', fence: '栏杆', cage: '封印锁' };
$('behavior').textContent = behaviors[definition.boardBehavior] || definition.boardBehavior;
$('sprite-facing').textContent = ['fence', 'cage'].includes(definition.boardBehavior)
? '随横竖布局调整' : definition.visual?.spriteRotationMode === 'directional' ? '随方向旋转' : '固定直立';
$('extra').value = JSON.stringify(entry[4] || {}, null, 2);
renderExtraFields(entry, definition);
icons();
}
function render() {
if (!state.level) return;
const level = state.level;
$('title').textContent = '第 ' + level.displayLevel + ' 关';
$('subtitle').textContent = level.width + ' × ' + level.height + ' · ' + level.sourceId;
$('level-number').value = level.displayLevel;
$('dirty').textContent = dirty() ? '未保存' : '已保存'; $('dirty').classList.toggle('modified', dirty());
$('counts').textContent = level.characters.length + ' 军械 / ' + level.aoes.length + ' 机关';
$('source-id').textContent = level.sourceId; $('scene').textContent = state.result?.scene || '-';
$('columns').value = level.width; $('rows').value = level.height;
$('undo').disabled = !state.history.length; $('redo').disabled = !state.future.length;
for (const id of ['rotate', 'duplicate', 'delete']) $(id).disabled = !selectedEntry() || state.view !== 'source';
$('select-tool').classList.toggle('active', !state.material);
document.querySelectorAll('[data-view]').forEach(button => button.classList.toggle('active', button.dataset.view === state.view));
$('view-state').textContent = state.view === 'source' ? (state.material ? '放置 · ' + state.material.name : '源布局') : '局内预览 · 只读';
$('zoom-label').textContent = Math.round(state.zoom * 100) + '%';
$('draft-actions').hidden = !state.draft;
renderInspector(); draw();
}
function draftSave() {
try {
if (dirty()) localStorage.setItem(draftKey(), JSON.stringify({ level: state.level, revision: state.revision, updated: Date.now() }));
else localStorage.removeItem(draftKey());
} catch { message('本地草稿存储失败,请及时保存或导出', true); }
}
function changed(before) {
if (JSON.stringify(before) === JSON.stringify(state.level)) return;
state.history.push(before); if (state.history.length > 80) state.history.shift(); state.future.length = 0;
state.sequence++; state.result = null; draftSave(); render(); scheduleValidation();
}
function mutate(action) {
if (!state.level || state.busy || state.view !== 'source') return;
const before = clone(state.level);
if (pendingExtra()) {
const value = readExtraInput(), problems = window.LevelExtraFields.validate(value);
if (problems.length) throw new Error(problems[0]);
selectedEntry()[4] = value;
}
action(); changed(before);
}
function localIssues(level) {
const occupied = new Set(), issues = [];
for (const collection of ['characters', 'aoes']) for (const [index, entry] of level[collection].entries()) {
const definition = definitionFor(entry), footprint = definition?.footprintsByOrientation[entry[3]];
if (!footprint || !entry.slice(0, 4).every(Number.isSafeInteger)) { issues.push('对象数据无效'); continue; }
for (const [dx, dy] of footprint.cells) {
const col = entry[1] + dx, row = entry[2] + dy, key = col + ',' + row;
if (col < 0 || row < 0 || col >= level.width || row >= level.height) issues.push('对象超出棋盘');
if (collection === 'characters') { if (occupied.has(key)) issues.push('军械占格重叠'); occupied.add(key); }
}
}
return issues;
}
function updateSelected(index, value) {
const entry = selectedEntry(); if (!entry) return;
if (!Number.isSafeInteger(value)) { renderInspector(); throw new Error('请输入整数'); }
mutate(() => { entry[index] = value; });
}
function applyExtra() {
const entry = selectedEntry(); if (!entry) return;
const value = readExtraInput();
const problems = window.LevelExtraFields.validate(value);
if (problems.length) throw new Error(problems[0]);
if (JSON.stringify(value) === JSON.stringify(entry[4] || {})) { if ($('extra-path')) $('extra-path').dataset.dirty = 'false'; return; }
mutate(() => { entry[4] = value; });
}
function pendingExtra() {
const entry = selectedEntry();
return entry && ($('extra').value !== JSON.stringify(entry[4] || {}, null, 2) || $('extra-path')?.dataset.dirty === 'true');
}
async function openLevel(number) {
if (state.busy) return;
if (!Number.isInteger(number) || number < 1 || number > state.levelCount) throw new Error('关卡编号超出范围');
if ((dirty() || pendingExtra()) && !confirm('当前关卡有未保存修改,是否切换?')) { render(); return; }
state.sequence++; clearTimeout(validateTimer); setBusy(true);
try {
const result = await api('/api/levels/' + number);
state.level = result.level; state.sourceLevel = result.sourceLevel; state.revision = result.revision; state.baseline = layoutText(result.level); state.result = result;
state.history = []; state.future = []; state.selected = null; state.material = null; state.drag = null;
state.view = 'source'; state.zoom = 1; state.pan = { x: 0, y: 0 }; state.draft = null;
try { const draft = JSON.parse(localStorage.getItem(draftKey())); if (draft?.level && layoutText(draft.level) !== state.baseline) { draft.level.displayLevel = number; state.draft = draft; } }
catch { message('本地草稿读取失败', true); }
renderLibrary(); render(); showValidation(result); message('已打开第 ' + number + ' 关');
} finally { setBusy(false); }
}
function showValidation(result) {
$('validation-status').textContent = result.issues.length ? result.issues.length + ' 个问题' : '通过';
$('validation-status').className = result.issues.length ? 'error' : 'ok';
$('issues').replaceChildren();
if (!result.issues.length) { $('issues').textContent = '源占格与游戏布局适配通过'; return; }
result.issues.forEach(issue => {
const button = document.createElement('button'); button.className = 'issue'; button.textContent = issue.message;
button.onclick = () => { if (issue.collection && Number.isInteger(issue.entryIndex)) { state.selected = { collection: issue.collection, index: issue.entryIndex }; state.material = null; state.view = 'source'; render(); } };
$('issues').append(button);
});
}
async function validate() {
if (!state.level) return;
const sequence = ++state.sequence, level = clone(state.level);
$('validation-status').textContent = '正在校验';
const result = await api('/api/validate', { level });
if (sequence !== state.sequence) return;
state.result = result; showValidation(result); $('scene').textContent = result.scene || '-'; refreshExtraEffective(); draw();
return result;
}
function scheduleValidation() { clearTimeout(validateTimer); $('validation-status').textContent = '待校验'; validateTimer = setTimeout(guarded(validate), 300); }
async function save() {
if (!state.level || state.busy) return;
if (pendingExtra()) applyExtra();
clearTimeout(validateTimer); state.sequence++; setBusy(true);
try {
const result = await api('/api/levels/' + state.level.displayLevel, { level: state.level, revision: state.revision });
state.revision = result.revision; state.baseline = layoutText(state.level); state.result = result; state.draft = null;
draftSave(); render(); showValidation(result); message('已保存;备份:' + result.backup);
} finally { setBusy(false); }
}
function displayedEntities() {
if (!state.level) return [];
if (state.view === 'preview') {
if (!state.result?.board) return [];
return [...state.result.board.units.map((unit, index) => ({ collection: 'characters', index,
entry: [unit.artifactId, unit.col, unit.row, unit.sourceOrientation, unit.sourceExtra] })),
...state.result.board.aoes.map((unit, index) => ({ collection: 'aoes', index,
entry: [unit.mechanismId, unit.col, unit.row, unit.sourceOrientation] }))];
}
return ['characters', 'aoes'].flatMap(collection => state.level[collection].map((entry, index) => ({ collection, index, entry })));
}
function spriteAngle(definition, direction) {
const footprint = definition.footprintsByOrientation[direction];
// 舞女图像保持直立,横竖占格仍由方向决定;机关的 Canvas 旋转正方向与 Cocos 相反。
if (definition.boardBehavior === 'movingHazard') return 0;
if (definition.collection === 'aoes') return (definition.boardBehavior === 'cage' && footprint.height > footprint.width)
|| (definition.boardBehavior === 'fence' && [2, 4].includes(Number(direction))) ? -90 : 0;
return definition.visual?.spriteRotationMode === 'directional' ? ({ 1: 180, 2: 90, 3: 0, 4: -90 }[direction] + Number(definition.visual?.spriteForwardOffsetDeg || 0)) : 0;
}
function drawEntity(entry, selected = false, ghost = false, invalid = false) {
const definition = definitionFor(entry), footprint = definition?.footprintsByOrientation[entry[3]];
if (!footprint) return;
const [id, col, row, direction] = entry;
ctx.save();
if (ghost) ctx.globalAlpha = 0.65;
const mechanism = definition.collection === 'aoes';
ctx.lineWidth = selected ? 0.045 : 0.018;
for (const [dx, dy] of footprint.cells) {
ctx.fillStyle = invalid ? '#fce0de' : selected ? '#cfebea' : mechanism ? '#f2e8d0' : '#e2ede6';
ctx.strokeStyle = invalid ? '#d5544b' : selected ? '#07858c' : mechanism ? '#c4a16c' : '#b8cfc0';
ctx.fillRect(col + dx + .035, row + dy + .035, .93, .93);
ctx.strokeRect(col + dx + .035, row + dy + .035, .93, .93);
}
const lowered = definition.boardBehavior === 'burrowingBlocker' && window.LevelExtraFields.down(entry[4]);
const stateImage = definition.stateImages?.underground || (definition.statePrefabIds?.underground ? '/assets/resources/Ynyk/Props/' + definition.statePrefabIds.underground + '.png' : null);
const image = imageFor(lowered && stateImage ? stateImage : definition.image);
if (image?.complete && image.naturalWidth && !image.failed) {
ctx.save(); ctx.translate(col + footprint.width / 2, row + footprint.height / 2);
if (lowered) ctx.globalAlpha *= 135 / 255;
// 项目图片朝上,和占格配置的朝右基准不同;沿用局内展示层的朝向约定。
const angle = spriteAngle(definition, direction);
ctx.rotate(angle * Math.PI / 180);
const sideways = Math.abs(Math.sin(angle * Math.PI / 180)) > .5;
const width = (sideways ? footprint.height : footprint.width) - .12;
const height = (sideways ? footprint.width : footprint.height) - .12;
const fit = Math.min(width / image.naturalWidth, height / image.naturalHeight);
ctx.drawImage(image, -image.naturalWidth * fit / 2, -image.naturalHeight * fit / 2, image.naturalWidth * fit, image.naturalHeight * fit);
ctx.restore();
} else {
ctx.fillStyle = mechanism ? '#8a6b39' : '#456b5b'; ctx.font = '0.22px "Microsoft YaHei"'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
ctx.fillText(definition.name, col + footprint.width / 2, row + footprint.height / 2, footprint.width - .12);
}
const overlay = imageFor(definition.overlay);
if (overlay?.complete && overlay.naturalWidth && !overlay.failed) {
ctx.save(); ctx.translate(col + footprint.width / 2, row + footprint.height / 2);
ctx.rotate(spriteAngle(definition, direction) * Math.PI / 180);
// 按对象库 52 × 44 缩略图中标记的占比绘制,保持相对箭身的大小一致。
const angle = spriteAngle(definition, direction);
const sideways = Math.abs(Math.sin(angle * Math.PI / 180)) > .5;
const availableWidth = (sideways ? footprint.height : footprint.width) - .12;
const availableHeight = (sideways ? footprint.width : footprint.height) - .12;
const arrowHeight = image?.naturalWidth && image.naturalHeight
? Math.min(availableWidth / image.naturalWidth, availableHeight / image.naturalHeight) * image.naturalHeight
: availableHeight;
const fit = Math.min(arrowHeight * 52 / 44 * .48 / overlay.naturalWidth, arrowHeight * .60 / overlay.naturalHeight);
ctx.drawImage(overlay, -overlay.naturalWidth * fit / 2, -overlay.naturalHeight * fit / 2, overlay.naturalWidth * fit, overlay.naturalHeight * fit);
ctx.restore();
}
ctx.fillStyle = invalid ? '#b84138' : selected ? '#007780' : '#5a7970';
ctx.font = 'bold 0.23px sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
if (definition.boardBehavior !== 'burrowingBlocker') ctx.fillText({ 1: '↓', 2: '→', 3: '↑', 4: '←' }[direction], col + footprint.width - .19, row + .2);
if (selected) {
ctx.lineWidth = .045; ctx.strokeStyle = '#07858c'; ctx.strokeRect(col + .018, row + .018, footprint.width - .036, footprint.height - .036);
}
ctx.restore();
}
function draw() {
const rect = $('viewport').getBoundingClientRect(), dpr = window.devicePixelRatio || 1;
const width = Math.max(1, rect.width), height = Math.max(1, rect.height);
if (canvas.width !== Math.round(width * dpr) || canvas.height !== Math.round(height * dpr)) {
canvas.width = Math.round(width * dpr); canvas.height = Math.round(height * dpr);
}
ctx.setTransform(dpr, 0, 0, dpr, 0, 0); ctx.clearRect(0, 0, width, height);
if (!state.level) return;
const preview = state.view === 'preview', board = state.result?.board;
$('canvas-empty').hidden = !preview || Boolean(board);
if (preview && !board) { transform = null; return; }
const columns = preview ? board.geometry.columns : state.level.width;
const rows = preview ? board.geometry.rows : state.level.height;
const angle = preview ? board.geometry.rotationDeg * Math.PI / 180 : 0;
const cosine = Math.cos(angle), sine = Math.sin(angle);
const boundsW = Math.abs(columns * cosine) + Math.abs(rows * sine);
const boundsH = Math.abs(columns * sine) + Math.abs(rows * cosine);
const scale = Math.min((width - 80) / (boundsW + 1), (height - 55) / (boundsH + 1), 65) * state.zoom;
const x = width / 2 + state.pan.x, y = height / 2 + state.pan.y;
transform = { columns, rows, angle, scale, x, y };
ctx.save(); ctx.translate(x, y); ctx.scale(scale, scale); ctx.rotate(angle); ctx.translate(-columns / 2, -rows / 2);
if (preview && state.result.boundary) {
ctx.beginPath();
state.result.boundary.forEach((point, index) => {
const dx = (point.x - board.geometry.center.x) / board.geometry.cellSize;
const dy = (point.y - board.geometry.center.y) / board.geometry.cellSize;
const px = dx * cosine + dy * sine + columns / 2, py = -dx * sine + dy * cosine + rows / 2;
if (index) ctx.lineTo(px, py); else ctx.moveTo(px, py);
});
ctx.closePath(); ctx.strokeStyle = '#9badb7'; ctx.lineWidth = .035; ctx.setLineDash([.1,.1]); ctx.stroke(); ctx.setLineDash([]);
}
const valid = preview ? new Set(board.validCells) : null;
for (let row = 0; row < rows; row++) for (let col = 0; col < columns; col++) {
if (valid && !valid.has(col + ',' + row)) continue;
ctx.fillStyle = (row + col) % 2 ? '#f9fbfa' : '#ffffff'; ctx.fillRect(col, row, 1, 1);
ctx.strokeStyle = '#dce5e4'; ctx.lineWidth = .012; ctx.strokeRect(col, row, 1, 1);
}
ctx.fillStyle = '#8d9ba4'; ctx.font = '0.21px Consolas,monospace'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
for (let col = 0; col < columns; col++) ctx.fillText(col, col + .5, -.38);
for (let row = 0; row < rows; row++) ctx.fillText(row, -.38, row + .5);
const entities = displayedEntities();
const invalidEntries = new Set((state.result?.issues || []).filter(issue => issue.collection).map(issue => issue.collection + ':' + issue.entryIndex));
for (const entity of entities) {
const selected = state.selected?.collection === entity.collection && state.selected?.index === entity.index;
if (state.drag?.type === 'object' && selected && !preview && state.drag.moved) continue;
drawEntity(entity.entry, selected, false, invalidEntries.has(entity.collection + ':' + entity.index));
}
if (!preview && state.drag?.type === 'object' && state.drag.moved) drawEntity(state.drag.candidate, true, true, !state.drag.valid);
if (!preview && state.material && state.hover) {
const entry = [state.material.id, state.hover.col, state.hover.row, 2];
const candidate = clone(state.level); candidate[state.material.collection].push(entry);
drawEntity(entry, false, true, Boolean(localIssues(candidate).length));
}
ctx.restore();
}
function gridPoint(event) {
if (!transform) return null;
const rect = canvas.getBoundingClientRect(), t = transform;
const dx = (event.clientX - rect.left - t.x) / t.scale, dy = (event.clientY - rect.top - t.y) / t.scale;
return { col: Math.floor(dx * Math.cos(t.angle) + dy * Math.sin(t.angle) + t.columns / 2),
row: Math.floor(-dx * Math.sin(t.angle) + dy * Math.cos(t.angle) + t.rows / 2) };
}
function hit(point) {
return displayedEntities().reverse().find(entity => {
const entry = entity.entry, footprint = definitionFor(entry)?.footprintsByOrientation[entry[3]];
return footprint?.cells.some(([dx, dy]) => entry[1] + dx === point.col && entry[2] + dy === point.row);
});
}
canvas.addEventListener('pointerdown', guarded(event => {
if (state.busy || !state.level) return;
if (pendingExtra()) applyExtra();
const point = gridPoint(event); if (!point) return;
canvas.focus();
if (state.material && state.view === 'source' && event.button === 0) {
const entry = [state.material.id, point.col, point.row, 2], candidate = clone(state.level);
candidate[state.material.collection].push(entry);
if (localIssues(candidate).length) { message('无法放置:对象越界或军械重叠', true); return; }
mutate(() => { state.level[state.material.collection].push(entry); }); return;
}
const entity = event.button === 0 ? hit(point) : null;
if (entity) {
state.selected = { collection: entity.collection, index: entity.index }; state.material = null;
if (state.view === 'source') state.drag = { type: 'object', start: point, before: clone(state.level), original: clone(entity.entry), moved: false };
render();
} else {
state.selected = null; state.drag = { type: 'pan', x: event.clientX, y: event.clientY, original: { ...state.pan } }; render();
}
canvas.setPointerCapture(event.pointerId);
}));
canvas.addEventListener('pointermove', event => {
const point = gridPoint(event); if (!point) return;
state.hover = point; $('coordinates').textContent = '列 ' + point.col + ' / 行 ' + point.row;
const drag = state.drag;
if (drag?.type === 'object') {
const dx = point.col - drag.start.col, dy = point.row - drag.start.row;
drag.candidate = clone(drag.original); shiftEntry(drag.candidate, dx, dy); drag.moved = dx !== 0 || dy !== 0;
const candidate = clone(state.level); candidate[state.selected.collection][state.selected.index] = drag.candidate;
drag.valid = !localIssues(candidate).length;
} else if (drag?.type === 'pan') state.pan = { x: drag.original.x + event.clientX - drag.x, y: drag.original.y + event.clientY - drag.y };
draw();
});
canvas.addEventListener('pointerup', event => {
const drag = state.drag; state.drag = null;
if (canvas.hasPointerCapture(event.pointerId)) canvas.releasePointerCapture(event.pointerId);
if (drag?.type === 'object' && drag.moved) {
if (drag.valid) { state.level[state.selected.collection][state.selected.index] = drag.candidate; changed(drag.before); }
else message('移动已取消:对象越界或军械重叠', true);
}
draw();
});
canvas.addEventListener('pointercancel', () => { state.drag = null; draw(); });
canvas.addEventListener('pointerleave', () => { state.hover = null; draw(); });
canvas.addEventListener('contextmenu', event => event.preventDefault());
canvas.addEventListener('wheel', event => { event.preventDefault(); setZoom(state.zoom * (event.deltaY < 0 ? 1.1 : 1 / 1.1)); }, { passive: false });
// 移动巡逻对象时同步平移其源路径,不改变其他扩展参数。
function shiftEntry(entry, dx, dy) {
entry[1] += dx; entry[2] += dy;
const clips = Array.isArray(entry[4]?.aiClips) ? entry[4].aiClips : [];
for (const clip of clips) for (const action of (Array.isArray(clip?.actions) ? clip.actions : [])) {
if (action.method === 'movePath' && Array.isArray(action.params)) action.params = action.params.map(point => {
const match = /^(-?\d+),(-?\d+)$/.exec(String(point));
return match ? (Number(match[1]) + dx) + ',' + (Number(match[2]) + dy) : point;
});
}
}
function setZoom(value) { state.zoom = Math.max(.4, Math.min(3, value)); $('zoom-label').textContent = Math.round(state.zoom * 100) + '%'; draw(); }
function rotate() { const entry = selectedEntry(); if (entry) mutate(() => { entry[3] = ({ 1: 4, 4: 3, 3: 2, 2: 1 })[entry[3]]; }); }
function remove() { if (state.selected) mutate(() => { state.level[state.selected.collection].splice(state.selected.index, 1); state.selected = null; }); }
function duplicate() {
const entry = selectedEntry(); if (!entry || state.view !== 'source') return;
for (let row = 0; row < state.level.height; row++) for (let col = 0; col < state.level.width; col++) {
const next = clone(entry); shiftEntry(next, col - entry[1], row - entry[2]);
const candidate = clone(state.level); candidate[state.selected.collection].push(next);
if (!localIssues(candidate).length) {
mutate(() => { state.level[state.selected.collection].push(next); state.selected.index = state.level[state.selected.collection].length - 1; }); return;
}
}
throw new Error('棋盘内没有可复制的空位');
}
function history(direction) {
if (state.busy || state.view !== 'source') return;
const source = direction === 'undo' ? state.history : state.future;
const target = direction === 'undo' ? state.future : state.history;
if (!source.length) return;
target.push(clone(state.level)); state.level = source.pop(); state.selected = null; state.drag = null;
state.sequence++; state.result = null; draftSave(); render(); scheduleValidation();
}
$('previous').onclick = guarded(() => openLevel(state.level.displayLevel - 1));
$('next').onclick = guarded(() => openLevel(state.level.displayLevel + 1));
$('open').onclick = guarded(() => openLevel(Number($('level-number').value)));
$('level-number').onkeydown = guarded(event => { if (event.key === 'Enter') return openLevel(Number($('level-number').value)); });
$('save').onclick = guarded(save);
$('validate').onclick = guarded(async () => { if (pendingExtra()) applyExtra(); const result = await validate(); if (result) message(result.issues.length ? '校验发现问题' : '布局校验通过', Boolean(result.issues.length)); });
$('undo').onclick = () => history('undo'); $('redo').onclick = () => history('redo');
$('rotate').onclick = guarded(rotate); $('delete').onclick = guarded(remove); $('duplicate').onclick = guarded(duplicate);
$('zoom-in').onclick = () => setZoom(state.zoom * 1.15); $('zoom-out').onclick = () => setZoom(state.zoom / 1.15);
$('fit').onclick = () => { state.pan = { x: 0, y: 0 }; setZoom(1); };
$('select-tool').onclick = () => { state.material = null; renderLibrary(); render(); };
$('search').oninput = renderLibrary;
$('library-tabs').onclick = event => {
const button = event.target.closest('[data-kind]'); if (!button) return;
state.kind = button.dataset.kind;
document.querySelectorAll('[data-kind]').forEach(item => item.classList.toggle('active', item === button)); renderLibrary();
};
$('view-tabs').onclick = guarded(async event => {
const button = event.target.closest('[data-view]'); if (!button || state.busy) return;
if (pendingExtra()) applyExtra();
state.view = button.dataset.view; state.material = null; state.drag = null; state.pan = { x: 0, y: 0 };
renderLibrary(); render();
if (state.view === 'preview' && !state.result) await validate();
});
for (const [id, position] of [['object-type', 0], ['col', 1], ['row', 2], ['orientation', 3]]) {
$(id).onchange = guarded(() => {
const entry = selectedEntry(); if (!entry) return;
const value = Number($(id).value);
if (position === 1 || position === 2) {
if (!Number.isSafeInteger(value)) throw new Error('请输入整数坐标');
mutate(() => shiftEntry(entry, position === 1 ? value - entry[1] : 0, position === 2 ? value - entry[2] : 0));
} else updateSelected(position, value);
});
}
$('properties').onsubmit = event => event.preventDefault();
$('apply-extra').onclick = guarded(applyExtra);
for (const [id, property] of [['columns', 'width'], ['rows', 'height']]) $(id).onchange = guarded(() => {
const value = Number($(id).value);
if (!Number.isInteger(value) || value < 1 || value > 64) { render(); throw new Error('棋盘行列数必须是 1 到 64 的整数'); }
mutate(() => { state.level[property] = value; });
});
$('restore-draft').onclick = guarded(() => {
if (!state.draft || state.busy) return;
const draft = state.draft;
if (draft.level.displayLevel !== state.level.displayLevel || !Array.isArray(draft.level.characters) || !Array.isArray(draft.level.aoes)) throw new Error('草稿格式无效');
const before = clone(state.level);
// 草稿保留原始版本号,磁盘已变化时仍由保存接口拦截覆盖。
state.level = { ...state.level, width: draft.level.width, height: draft.level.height,
characters: draft.level.characters, aoes: draft.level.aoes };
state.revision = draft.revision; state.draft = null; state.view = 'source'; changed(before); message('已恢复本地草稿');
});
$('discard-draft').onclick = () => { if (confirm('删除此关卡的本地草稿?')) { localStorage.removeItem(draftKey()); state.draft = null; render(); } };
$('export').onclick = guarded(() => {
if (!state.level) return;
if (pendingExtra()) applyExtra();
const url = URL.createObjectURL(new Blob([JSON.stringify(state.level, null, 2) + '\n'], { type: 'application/json' }));
const link = document.createElement('a'); link.href = url; link.download = (state.mode === 'ghost-king' ? '逐鹿关卡-' : '主线关卡-') + state.level.displayLevel + '.json'; link.click();
setTimeout(() => URL.revokeObjectURL(url), 1000); message('已导出第 ' + state.level.displayLevel + ' 关');
});
$('import').onclick = () => { if (!state.busy) $('import-file').click(); };
$('import-file').onchange = guarded(async event => {
const file = event.target.files[0]; event.target.value = ''; if (!file || !state.level || state.busy) return;
if (file.size > 2 * 1024 * 1024) throw new Error('导入文件不能超过 2MB');
const number = state.level.displayLevel, revision = state.revision, initialLayout = layoutText(state.level), mode = state.mode;
let imported;
try { imported = JSON.parse(await file.text()); } catch { throw new Error('导入文件不是有效的 JSON'); }
if (state.mode !== mode || state.level.displayLevel !== number || state.revision !== revision || layoutText(state.level) !== initialLayout) throw new Error('关卡已切换或修改,请重新导入');
if (!Array.isArray(imported.characters) || !Array.isArray(imported.aoes) || !Number.isInteger(imported.width) || !Number.isInteger(imported.height)) throw new Error('导入文件缺少棋盘尺寸或对象列表');
const candidate = { ...state.level, width: imported.width, height: imported.height, characters: imported.characters, aoes: imported.aoes };
const result = await api('/api/validate', { level: candidate });
if (state.mode !== mode || state.level.displayLevel !== number || state.revision !== revision || layoutText(state.level) !== initialLayout) throw new Error('关卡已切换或修改,请重新导入');
if (result.issues.length) throw new Error('导入校验失败:' + result.issues[0].message);
if (!confirm('将导入布局应用到当前第 ' + number + ' 关?')) return;
state.view = 'source'; state.selected = null;
mutate(() => { state.level = candidate; }); message('布局已导入,尚未保存');
});
document.addEventListener('keydown', guarded(event => {
if (state.busy) return;
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 's') { event.preventDefault(); return save(); }
if (event.target.matches('input,textarea,select')) return;
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'z') { event.preventDefault(); history(event.shiftKey ? 'redo' : 'undo'); }
if (event.key === 'Delete' || event.key === 'Backspace') { event.preventDefault(); remove(); }
if (event.key.toLowerCase() === 'r') rotate();
if (event.key === 'Escape') { state.material = null; state.drag = null; state.selected = null; renderLibrary(); render(); }
}));
// 切换选择或执行工具前提交参数;非法 JSON 留在原处,不静默丢弃。
function commitPendingExtra(event) {
if (event.target === $('extra') || event.target.closest('#extra-fields') || !pendingExtra()) return;
try { applyExtra(); }
catch (error) { event.preventDefault(); event.stopImmediatePropagation(); message(error.message, true); }
}
document.addEventListener('pointerdown', commitPendingExtra, true);
document.addEventListener('click', commitPendingExtra, true);
window.addEventListener('beforeunload', event => { if (dirty() || pendingExtra()) { event.preventDefault(); event.returnValue = ''; } });
new ResizeObserver(draw).observe($('viewport'));
guarded(async () => {
icons();
const bootstrap = await api('/api/bootstrap'); Object.assign(state, bootstrap);
$('project-path').textContent = bootstrap.project; $('project-path').title = bootstrap.project;
$('level-total').textContent = '/ ' + bootstrap.levelCount; $('level-number').max = bootstrap.levelCount;
await openLevel(Number(new URLSearchParams(location.search).get('level') || 1));
})();
+68
View File
@@ -0,0 +1,68 @@
(function (root, factory) {
const api = factory();
if (typeof module === 'object' && module.exports) module.exports = api;
else root.LevelExtraFields = api;
})(typeof globalThis !== 'undefined' ? globalThis : this, function () {
'use strict';
const copy = value => JSON.parse(JSON.stringify(value));
const buff = (extra, id) => (Array.isArray(extra?.addBuff) ? extra.addBuff : []).find(item => item?.buffId === id);
const down = extra => buff(extra, 'pop-down-up')?.buffParam?.down === true;
function setBuff(extra, id, key, value) {
const result = copy(extra || {});
if (result.addBuff != null && !Array.isArray(result.addBuff)) throw new Error('附加效果列表必须是数组');
const list = result.addBuff || [];
if (value === null) {
if (result.addBuff) result.addBuff = list.filter(item => item?.buffId !== id);
} else {
let item = list.find(item => item?.buffId === id);
if (!item) { item = { addStack: 1, buffId: id, duration: 0, durationSetTo: true, permanent: true }; list.push(item); }
item.buffParam = { ...item.buffParam, [key]: value }; result.addBuff = list;
}
return result;
}
function pathAction(extra) {
for (const clip of (Array.isArray(extra?.aiClips) ? extra.aiClips : [])) {
for (const action of (Array.isArray(clip?.actions) ? clip.actions : [])) if (action?.method === 'movePath') return action;
}
return null;
}
function setPath(extra, points) {
const result = copy(extra || {});
if (result.aiClips != null && !Array.isArray(result.aiClips)) throw new Error('行为指令列表必须是数组');
const action = pathAction(result);
if (action) action.params = points.map(point => point.join(','));
else {
result.aiClips ||= [];
result.aiClips.push({ id: 'move-by-path', actions: [{ method: 'movePath', params: points.map(point => point.join(',')) }], conditions: [{ method: 'alwaysTrue' }] });
}
return result;
}
function validate(extra) {
const issues = [];
if (extra == null) return issues;
if (typeof extra !== 'object' || Array.isArray(extra)) return ['扩展参数必须是 JSON 对象'];
if (extra.addBuff != null && !Array.isArray(extra.addBuff)) return ['附加效果列表必须是数组'];
if (extra.aiClips != null && !Array.isArray(extra.aiClips)) return ['行为指令列表必须是数组'];
for (const [id, key, label, allowZero] of [['speed', 'speed', '移动速度', false], ['cool-down', 'duration', '倒计时', true]]) {
const value = buff(extra, id)?.buffParam?.[key];
if (value != null && (typeof value !== 'number' || !Number.isFinite(value) || (allowZero ? value < 0 : value <= 0))) issues.push(label + (allowZero ? '必须是非负数' : '必须大于 0'));
}
const lowered = buff(extra, 'pop-down-up')?.buffParam?.down;
// 历史数据含 0/1;保留原值,读取时仍与玩法一样仅 true 代表降下。
if (lowered != null && typeof lowered !== 'boolean' && lowered !== 0 && lowered !== 1) issues.push('初始升降状态必须是布尔值');
if (extra.hp != null && (typeof extra.hp !== 'number' || !Number.isFinite(extra.hp) || extra.hp <= 0)) issues.push('封印锁血量必须大于 0');
for (const clip of extra.aiClips || []) {
if (clip?.actions != null && !Array.isArray(clip.actions)) { issues.push('行为动作列表必须是数组'); continue; }
for (const action of clip?.actions || []) if (action?.method === 'movePath') {
// 旧关卡路径带有空占位项,玩法会忽略;不能因为编辑器新增表单而拒绝旧数据。
const points = Array.isArray(action.params) ? action.params.filter(point => {
const values = String(point || '').split(',').map(Number);
return values.length === 2 && values.every(Number.isFinite);
}) : [];
if (points.length < 2) issues.push('巡逻路径至少包含两个有效坐标点');
}
}
return issues;
}
return { buff, down, setBuff, pathAction, setPath, validate };
});
+1
View File
File diff suppressed because one or more lines are too long
+111
View File
@@ -0,0 +1,111 @@
'use strict';
function readExtraInput() {
let extra;
try { extra = JSON.parse($('extra').value); } catch { throw new Error('扩展参数不是有效的 JSON'); }
if (!extra || typeof extra !== 'object' || Array.isArray(extra)) throw new Error('扩展参数必须是 JSON 对象');
const path = $('extra-path');
if (path?.dataset.dirty === 'true') {
const points = path.readPoints();
if (points.length < 2) throw new Error('巡逻路径至少需要两个点');
extra = window.LevelExtraFields.setPath(extra, points);
}
return extra;
}
function refreshExtraEffective() {
const output = $('extra-effective-countdown');
if (!output) return;
const effective = state.result?.board?.units?.find(unit => unit.id === 'u-' + String(state.selected?.index + 1).padStart(6, '0'))?.timer?.duration;
output.textContent = effective == null ? '实际初始倒计时:待校验' : '实际初始倒计时:' + effective + ' 秒';
}
function renderExtraFields(entry, definition) {
const host = $('extra-fields'), fields = window.LevelExtraFields, extra = entry[4] || {};
host.replaceChildren();
const heading = document.createElement('h2'); heading.textContent = '附加配置'; host.append(heading);
const editable = state.view === 'source';
function note(text) { const node = document.createElement('p'); node.className = 'extra-note'; node.textContent = text; host.append(node); }
function commit(change) {
if (!editable || state.busy) return;
// 高级 JSON 的未应用修改先进入同一次撤销记录,避免被控件覆盖。
const next = change(readExtraInput());
const problems = fields.validate(next);
if (problems.length) throw new Error(problems[0]);
mutate(() => { entry[4] = next; });
message('附加配置已更新,尚未保存');
}
function field(label, control) {
const wrapper = document.createElement('label'); wrapper.textContent = label;
control.disabled = !editable; wrapper.append(control); host.append(wrapper); return control;
}
function number(id, label, value, minimum, change, fallback) {
const input = document.createElement('input'); input.id = id; input.type = 'number'; input.step = 'any'; input.min = minimum;
input.value = value ?? ''; input.placeholder = fallback == null ? '默认' : '默认:' + fallback;
input.onchange = guarded(() => {
if (!input.checkValidity()) { input.reportValidity(); throw new Error(label + '数值无效'); }
const value = input.value === '' ? null : Number(input.value);
commit(extra => change(extra, value));
});
return field(label, input);
}
function inheritedValue(array, index) { return Array.isArray(array) && array[index] != null ? array[index] : null; }
if (definition.collection === 'characters') {
const current = fields.buff(extra, 'speed')?.buffParam?.speed;
number('extra-speed', '移动速度', current, 0.000001, (extra, value) => fields.setBuff(extra, 'speed', 'speed', value), definition.moveSpeed);
}
if (definition.boardBehavior === 'burrowingBlocker') {
const select = document.createElement('select'); select.id = 'extra-down';
for (const [value, text] of [['up', '升起 · 阻挡'], ['down', '降下 · 可穿过']]) { const option = document.createElement('option'); option.value = value; option.textContent = text; select.append(option); }
select.value = fields.down(extra) ? 'down' : 'up';
select.onchange = guarded(() => commit(extra => fields.setBuff(extra, 'pop-down-up', 'down', select.value === 'down')));
field('初始升降状态', select);
}
if (definition.boardBehavior === 'countdownBomb') {
const index = state.level.characters.map((entry, index) => ({ entry, index })).filter(item => definitionFor(item.entry)?.boardBehavior === 'countdownBomb')
.sort((a, b) => b.entry[2] - a.entry[2] || a.entry[1] - b.entry[1]).findIndex(item => item.index === state.selected.index);
const override = inheritedValue(state.level.progression?.boomTime, index);
number('extra-countdown', '附加倒计时(秒)', fields.buff(extra, 'cool-down')?.buffParam?.duration, 0, (extra, value) => fields.setBuff(extra, 'cool-down', 'duration', value), 180);
note(override === null ? '来源:附加配置或默认值;较长倒计时还会按难度限制。' : '当前优先使用关卡倒计时:' + override + ' 秒;附加倒计时仅作后备。');
note(''); host.lastElementChild.id = 'extra-effective-countdown'; refreshExtraEffective();
}
if (definition.boardBehavior === 'cage') {
const index = state.level.aoes.slice(0, state.selected.index).filter(item => definitionFor(item)?.boardBehavior === 'cage').length;
const override = inheritedValue(state.level.progression?.caveDesNum, index);
number('extra-hp', '附加血量', extra.hp, 0.000001, (extra, value) => { if (value === null) delete extra.hp; else extra.hp = value; return extra; }, definition.defaultHp || 3);
note(override === null ? '实际血量:' + (extra.hp ?? definition.defaultHp ?? 3) : '当前优先使用关卡血量:' + override + ';附加血量仅作后备。');
}
if (definition.boardBehavior === 'movingHazard') {
const path = fields.pathAction(extra)?.params || [];
const editor = document.createElement('div'); editor.className = 'path-editor'; editor.id = 'extra-path';
editor.dataset.dirty = 'false'; editor.readPoints = readRows;
editor.addEventListener('input', () => { editor.dataset.dirty = 'true'; });
const title = document.createElement('h3'); title.textContent = '巡逻路径'; editor.append(title);
const columns = document.createElement('div'); columns.className = 'path-columns';
for (const name of ['列', '行']) { const label = document.createElement('span'); label.textContent = name; columns.append(label); }
editor.append(columns);
const rows = document.createElement('div'); rows.className = 'path-rows'; editor.append(rows);
const points = path.map(point => String(point || '').split(',').map(Number)).filter(point => point.length === 2 && point.every(Number.isFinite));
function readRows() { return [...rows.children].map(row => [...row.querySelectorAll('input')].map(input => {
if (input.value === '' || !input.checkValidity()) throw new Error('路径坐标必须是棋盘内的整数');
return Number(input.value);
})); }
function addPoint(point) {
const row = document.createElement('div'); row.className = 'path-row';
for (const [axis, value] of point.entries()) {
const input = document.createElement('input'); input.type = 'number'; input.min = 0; input.max = (axis ? state.level.height : state.level.width) - 1;
input.step = 1; input.value = value; input.disabled = !editable; input.setAttribute('aria-label', '路径点' + (axis ? '行' : '列')); row.append(input);
}
const remove = document.createElement('button'); remove.type = 'button'; remove.title = '删除路径点'; remove.setAttribute('aria-label', '删除路径点'); remove.innerHTML = '<i data-lucide="trash-2"></i>'; remove.disabled = !editable;
remove.onclick = () => { row.remove(); editor.dataset.dirty = 'true'; }; row.append(remove); rows.append(row);
}
points.forEach(addPoint);
const actions = document.createElement('div'); actions.className = 'path-actions';
const add = document.createElement('button'); add.type = 'button'; add.id = 'extra-path-add'; add.innerHTML = '<i data-lucide="plus"></i>'; add.title = '添加路径点'; add.setAttribute('aria-label', '添加路径点'); add.disabled = !editable;
add.onclick = () => { addPoint([entry[1], entry[2]]); editor.dataset.dirty = 'true'; icons(); };
const apply = document.createElement('button'); apply.type = 'button'; apply.id = 'extra-path-apply'; apply.textContent = '应用路径'; apply.disabled = !editable;
apply.onclick = guarded(() => { const points = readRows(); if (points.length < 2) throw new Error('巡逻路径至少需要两个点'); commit(extra => fields.setPath(extra, points)); });
actions.append(add, apply); editor.append(actions); host.append(editor);
}
if (definition.collection !== 'characters' && definition.boardBehavior !== 'cage') note('此对象没有游戏当前支持的附加参数。');
}
+22744
View File
File diff suppressed because it is too large Load Diff
+173
View File
@@ -0,0 +1,173 @@
(() => {
'use strict';
const actions = document.querySelector('.file-actions');
function button(id, title, icon, text = '') {
const element = document.createElement('button'); element.id = id; element.title = element.ariaLabel = title;
element.innerHTML = '<i data-lucide="' + icon + '"></i>' + text; return element;
}
const manage = button('mainline-manage', '主线编排', 'list-ordered', '主线编排');
const importButton = button('package-import', '导入关卡数据包', 'folder-input');
const exportButton = button('package-export', '导出全部关卡数据包', 'package-open');
const projectExport = button('project-export', '导出项目文件包 ZIP', 'folder-down');
actions.insertBefore(manage, $('dirty')); actions.insertBefore(importButton, $('import')); actions.insertBefore(exportButton, $('export'));
actions.insertBefore(projectExport, exportButton);
const helpButton = button('editor-help', '使用说明', 'circle-help'); actions.append(helpButton);
helpButton.onclick = () => { const help = $('help-dialog'); if (!help.open) help.showModal(); };
const exportDialog = document.createElement('dialog'); exportDialog.id = 'project-export-dialog'; exportDialog.setAttribute('aria-labelledby', 'project-export-title');
exportDialog.innerHTML = '<form method="dialog"><div class="mainline-heading"><h2 id="project-export-title">导出项目 JSON</h2><button value="cancel" title="关闭" aria-label="关闭"><i data-lucide="x"></i></button></div>' +
'<div class="mainline-row"><button id="project-export-changes" value="changes"><i data-lucide="file-diff"></i>导出变更 JSON</button><button id="project-export-all" class="primary" value="all"><i data-lucide="files"></i>导出全部 JSON</button></div></form>';
document.body.append(exportDialog);
const input = document.createElement('input'); input.type = 'file'; input.accept = '.json'; input.hidden = true; document.body.append(input);
const dialog = document.createElement('dialog'); dialog.id = 'mainline-dialog'; dialog.setAttribute('aria-labelledby', 'mainline-title');
dialog.innerHTML = '<div class="mainline-heading"><h2 id="mainline-title">主线编排</h2><button id="mainline-close" aria-label="关闭" title="关闭"><i data-lucide="x"></i></button></div>' +
'<div class="mainline-summary"><strong id="mainline-count"></strong><span id="mainline-pending"></span></div>' +
'<input id="mainline-search" type="search" placeholder="搜索关卡号或来源 ID" aria-label="搜索主线关卡">' +
'<select id="mainline-list" size="12" aria-label="主线关卡列表"></select>' +
'<div class="mainline-row"><label>新增方式 <select id="mainline-kind"><option value="copy">复制选中关卡</option><option value="empty">空白布局</option></select></label>' +
'<button id="mainline-add"><i data-lucide="plus"></i>新增至末尾</button><button id="mainline-insert"><i data-lucide="list-plus"></i>插入选中关卡之后</button></div>' +
'<div class="mainline-row"><button id="mainline-up" title="上移一关" aria-label="上移一关"><i data-lucide="arrow-up"></i></button><button id="mainline-down" title="下移一关" aria-label="下移一关"><i data-lucide="arrow-down"></i></button>' +
'<label>移动到第 <input id="mainline-target" type="number" min="1" value="1" aria-label="目标关卡号"> 关</label><button id="mainline-move"><i data-lucide="arrow-right-to-line"></i>移动</button>' +
'<button id="mainline-undo" title="撤销编排" aria-label="撤销编排"><i data-lucide="undo-2"></i></button><button id="mainline-remove"><i data-lucide="trash-2"></i>从主线移除</button></div>' +
'<p id="mainline-error" role="alert"></p><div class="mainline-footer"><button id="mainline-cancel">取消</button><button id="mainline-apply" class="primary"><i data-lucide="check"></i>应用编排</button></div>';
document.body.append(dialog); icons();
let draft, revision, selected, history = [], modified = false, initialModified = false, submitting = false;
function redraw() {
draft.levels.forEach((level, index) => { level.displayLevel = index + 1; });
const search = $('mainline-search').value.trim().toLowerCase(), list = $('mainline-list'); list.replaceChildren();
draft.order.forEach((id, index) => {
const text = '第 ' + (index + 1) + ' 关 来源 ' + id + ' ' + draft.levels[index].characters.length + ' 军械 / ' + draft.levels[index].aoes.length + ' 机关';
if (search && !text.toLowerCase().includes(search)) return;
const option = document.createElement('option'); option.value = id; option.textContent = text; list.append(option);
});
list.value = selected; $('mainline-count').textContent = '共 ' + draft.order.length + ' 关';
requestAnimationFrame(() => { if (dialog.open) list.selectedOptions[0]?.scrollIntoView({ block: 'nearest' }); });
$('mainline-pending').textContent = modified ? '待应用' : '已同步'; $('mainline-target').max = draft.order.length;
const index = draft.order.indexOf(selected);
$('mainline-up').disabled = index <= 0; $('mainline-down').disabled = index < 0 || index === draft.order.length - 1;
$('mainline-remove').disabled = index < 0 || draft.order.length <= 1;
$('mainline-undo').disabled = !history.length; $('mainline-apply').disabled = !modified;
}
function remember() {
history.push({ draft: clone(draft), selected }); if (history.length > 20) history.shift(); modified = true; $('mainline-error').textContent = '';
}
function create(append) {
if (MainlineWorkspace.sourceOrder(draft).length >= 20000) throw new Error('来源库存最多支持 20000 关');
const index = draft.order.indexOf(selected); if (index < 0) throw new Error('请先选择模板关卡');
remember(); const id = Math.max(...MainlineWorkspace.sourceOrder(draft)) + 1, level = clone(draft.levels[index]);
if ($('mainline-kind').value === 'empty') { level.characters = []; level.aoes = []; }
const position = append ? draft.order.length : index + 1;
draft.templates[id] = draft.templates[selected]; draft.order.splice(position, 0, id); draft.levels.splice(position, 0, level);
selected = id; $('mainline-search').value = ''; $('mainline-target').value = position + 1; redraw();
}
function move(target) {
const index = draft.order.indexOf(selected);
if (!Number.isInteger(target) || target < 0 || target >= draft.order.length) throw new Error('目标关卡号超出范围');
if (index < 0 || index === target) return;
remember(); draft.order.splice(target, 0, draft.order.splice(index, 1)[0]); draft.levels.splice(target, 0, draft.levels.splice(index, 1)[0]); redraw();
}
const localGuard = action => () => { if (submitting) return; try { action(); } catch (error) { $('mainline-error').textContent = error.message; } };
function close() { if (!submitting && (!modified || confirm('编排尚未应用,确定放弃?'))) dialog.close(); }
$('mainline-close').onclick = close; $('mainline-cancel').onclick = close;
dialog.addEventListener('cancel', event => { event.preventDefault(); close(); });
dialog.addEventListener('keydown', event => event.stopPropagation());
$('mainline-list').onchange = () => { selected = Number($('mainline-list').value); $('mainline-target').value = draft.order.indexOf(selected) + 1; redraw(); };
$('mainline-search').oninput = redraw;
$('mainline-add').onclick = localGuard(() => create(true)); $('mainline-insert').onclick = localGuard(() => create(false));
$('mainline-up').onclick = localGuard(() => move(draft.order.indexOf(selected) - 1));
$('mainline-down').onclick = localGuard(() => move(draft.order.indexOf(selected) + 1));
$('mainline-move').onclick = localGuard(() => move(Number($('mainline-target').value) - 1));
$('mainline-remove').onclick = localGuard(() => {
const index = draft.order.indexOf(selected);
if (index < 0) throw new Error('请先选择要移除的关卡');
if (draft.order.length <= 1) throw new Error('主线至少保留一关');
if (!confirm('从主线移除第 ' + (index + 1) + ' 关(来源 ' + selected + ')?后续关卡前移,底层来源布局与逐鹿引用会保留。应用前可撤销。')) return;
remember(); draft.archivedLevels ||= {}; draft.archivedLevels[selected] = clone(draft.levels[index]);
draft.order.splice(index, 1); draft.levels.splice(index, 1);
selected = draft.order[Math.min(index, draft.order.length - 1)];
$('mainline-search').value = ''; $('mainline-target').value = draft.order.indexOf(selected) + 1; redraw();
});
$('mainline-undo').onclick = localGuard(() => { const previous = history.pop(); if (previous) { draft = previous.draft; selected = previous.selected; modified = initialModified || history.length > 0; redraw(); } });
async function refresh(number, text) {
try { localStorage.removeItem(draftKey()); } catch { /* 工作区已经保存,清理旧草稿失败不阻断打开。 */ }
state.baseline = layoutText(state.level); state.selected = null;
const bootstrap = await api('/api/bootstrap'); Object.assign(state, bootstrap);
$('level-total').textContent = '/ ' + state.levelCount; $('level-number').max = state.levelCount;
setBusy(false); await openLevel(Math.min(number, state.levelCount)); message(text);
}
async function snapshot() {
if (pendingExtra()) applyExtra();
const validation = await api(state.mode === 'ghost-king' ? '/api/ghost-validate' : '/api/validate', { level: state.level });
if (validation.issues.length) throw new Error('当前关卡校验失败:' + validation.issues[0].message);
const result = await api('/api/mainline');
const position = result.package.order.indexOf(state.sourceLevel);
if (state.mode === 'ghost-king') {
result.package.ghostLayouts[state.level.displayLevel] = Object.fromEntries(['width', 'height', 'characters', 'aoes'].map(field => [field, clone(state.level[field])]));
} else if (position >= 0) result.package.levels[position] = clone(state.level);
return result;
}
manage.onclick = guarded(async () => {
if (state.busy || !state.level || state.mode === 'ghost-king') return;
if (pendingExtra()) applyExtra();
setBusy(true);
try {
const result = await snapshot(); draft = result.package; revision = result.revision; selected = state.sourceLevel;
history = []; modified = initialModified = dirty(); $('mainline-search').value = ''; $('mainline-error').textContent = '';
$('mainline-target').value = state.level.displayLevel; redraw(); dialog.showModal();
} finally { setBusy(false); }
});
$('mainline-apply').onclick = async () => {
if (submitting) return;
if (!window.offlineEditor && !confirm('将写入项目主线顺序、布局和新增关卡配置,并创建备份。现有玩家存档不会自动迁移,请确认发布安排。继续?')) return;
submitting = true; setBusy(true); dialog.querySelectorAll('button,input,select').forEach(element => { element.disabled = true; });
try {
const number = draft.order.indexOf(selected) + 1;
const result = await api('/api/mainline', { package: draft, revision });
modified = false; dialog.close();
await refresh(number, '主线编排已应用,共 ' + draft.order.length + ' 关' + (result.backup ? ';备份:' + result.backup : ',请导出完整数据包交付'));
} catch (error) { $('mainline-error').textContent = error.message; }
finally { submitting = false; setBusy(false); dialog.querySelectorAll('button,input,select').forEach(element => { element.disabled = false; }); if (dialog.open) redraw(); }
};
function download(bundle) {
const url = URL.createObjectURL(new Blob([JSON.stringify(bundle, null, 2)], { type: 'application/json' }));
const link = document.createElement('a'); link.href = url; link.download = '主线关卡数据包.json'; link.click(); setTimeout(() => URL.revokeObjectURL(url), 1000);
}
exportButton.onclick = guarded(async () => {
if (state.busy || !state.level) return;
setBusy(true);
try { const result = await snapshot(); download(result.package); message('已导出完整数据包,包含主线顺序、新增关卡和当前布局'); }
finally { setBusy(false); }
});
projectExport.onclick = () => { if (!state.busy && state.level) { exportDialog.returnValue = 'cancel'; exportDialog.showModal(); } };
exportDialog.addEventListener('close', guarded(async () => {
const mode = exportDialog.returnValue;
if (!['changes', 'all'].includes(mode)) return;
if (state.busy || !state.level) return;
setBusy(true); projectExport.disabled = true;
try {
message('正在校验并生成项目文件包…');
const snapshotResult = await snapshot();
const prepared = await api('/api/project-export', snapshotResult);
const result = await ProjectExport.create(prepared, mode);
const url = URL.createObjectURL(new Blob([result.bytes], { type: 'application/zip' }));
const link = document.createElement('a'); link.href = url;
link.download = '关卡项目文件包-' + (mode === 'all' ? '全部-' : '变更-') + new Date().toISOString().replace(/[:.]/g, '-') + '.zip'; link.click();
setTimeout(() => URL.revokeObjectURL(url), 60000);
message('已下载' + (mode === 'all' ? '全部' : '变更') + '项目 JSON 包,共 ' + result.manifest.files.length + ' 个文件;请在浏览器下载记录中查看,覆盖前先备份');
} finally { projectExport.disabled = false; setBusy(false); }
}));
importButton.onclick = () => { if (!state.busy) input.click(); };
input.onchange = guarded(async () => {
const file = input.files[0]; input.value = ''; if (!file || state.busy) return;
if (file.size > 32 * 1024 * 1024) throw new Error('数据包不能超过 32MB');
setBusy(true);
try {
let bundle;
try { bundle = JSON.parse(await file.text()); } catch { throw new Error('数据包不是有效的 JSON'); }
const current = await api('/api/mainline');
if (![1, 2].includes(bundle?.formatVersion) || bundle.rulesVersion !== current.package.rulesVersion || bundle.dataVersion !== current.package.dataVersion) throw new Error('数据包版本不匹配,请使用对应版本的编辑器');
if (!confirm('导入将替换全部关卡工作区和主线顺序,并丢弃当前未保存编辑。' + (window.offlineEditor ? '' : '项目文件会先备份;玩家存档不自动迁移。') + '继续?')) return;
const result = await api('/api/mainline', { package: bundle, revision: current.revision });
await refresh(state.level.displayLevel, '完整关卡数据包已导入' + (result.backup ? ';备份:' + result.backup : '并保存到本机'));
} finally { setBusy(false); }
});
})();
+2516
View File
File diff suppressed because it is too large Load Diff
+51
View File
@@ -0,0 +1,51 @@
(() => {
'use strict';
const encode = text => new TextEncoder().encode(text);
async function sha256(text) {
if (!globalThis.crypto?.subtle) throw new Error('当前浏览器不支持文件校验,请使用 Chrome 或 Edge 打开编辑器');
const digest = await crypto.subtle.digest('SHA-256', encode(text));
return Array.from(new Uint8Array(digest), value => value.toString(16).padStart(2, '0')).join('');
}
async function create(prepared, mode = 'changes') {
if (!['changes', 'all'].includes(mode)) throw new Error('导出范围无效');
const { data, files, package: bundle } = prepared, hashes = new Map(), uuids = new Map();
const uuid = name => {
if (!uuids.has(name)) {
const bytes = crypto.getRandomValues(new Uint8Array(16)); bytes[6] = (bytes[6] & 15) | 64; bytes[8] = (bytes[8] & 63) | 128;
const hex = Array.from(bytes, value => value.toString(16).padStart(2, '0')).join('');
uuids.set(name, hex.slice(0, 8) + '-' + hex.slice(8, 12) + '-' + hex.slice(12, 16) + '-' + hex.slice(16, 20) + '-' + hex.slice(20));
}
return uuids.get(name);
};
// 首遍收集分块摘要输入,异步完成哈希后再生成最终索引,避免复制两套索引生成逻辑。
ProjectFiles.plan(data, files, bundle, text => { hashes.set(text, null); return ''; }, uuid);
await Promise.all([...hashes.keys()].map(async text => hashes.set(text, await sha256(text))));
const writes = Object.fromEntries(Object.entries(ProjectFiles.plan(data, files, bundle, text => hashes.get(text), uuid)).filter(([name]) => name.endsWith('.json')));
const changedCount = Object.keys(writes).length;
if (mode === 'all') {
for (const [name, text] of Object.entries(files)) {
if (name.endsWith('.json') && !writes[name]) writes[name] = { before: text, text };
}
}
if (!Object.keys(writes).length) throw new Error('没有变更的 JSON,请选择“导出全部 JSON”');
const manifest = { formatVersion: 1, createdAt: new Date().toISOString(), dataVersion: data.dataVersion,
rulesVersion: data.rulesVersion, levelCount: bundle.order.length, exportMode: mode, changedCount,
warning: '覆盖包不是自动合并。必须确认目标项目仍为该基线;不同策划的包不能直接连续覆盖。请先备份或提交 Git,再覆盖并在 Cocos 验收。玩家进度不会自动迁移。',
baselineFiles: {}, files: [] };
await Promise.all(Object.entries(files).map(async ([name, text]) => { manifest.baselineFiles[name] = await sha256(text); }));
const archive = {};
for (const [name, value] of Object.entries(writes)) {
archive[name] = encode(value.text);
manifest.files.push({ path: name, existed: value.before !== null, changed: value.before !== value.text, beforeSha256: value.before === null ? null : await sha256(value.before), sha256: await sha256(value.text) });
}
archive['交付信息/变更清单.json'] = encode(JSON.stringify(manifest, null, 2));
archive['交付信息/主线关卡数据包.json'] = encode(JSON.stringify(bundle, null, 2));
archive['交付信息/应用说明.md'] = encode('# 关卡项目文件包\n\n' +
'本包由关卡编辑器生成,assets/ 下为游戏实际使用的关卡 JSON。导出范围:' + (mode === 'all' ? '全部关卡配置(含未修改文件)' : '相对本版基线的变更文件') + '。全部导出不包含素材、游戏规则或其他非关卡配置,不能作为整个游戏资源目录的替代。\n\n' +
'## 应用步骤\n\n1. 先提交 Git 或备份项目。\n2. 核对变更清单中的基线版本与文件摘要。目标文件有后续修改,或本次新增路径已存在时,不要直接覆盖;改用项目内编辑器导入本目录的数据包,或由程序合并。\n3. 将本包 assets/ 合并到 nixingnishanglo-refactor 项目根目录的 assets/,只覆盖清单列出的文件,不要删除原目录。交付信息/ 无需放入游戏项目。\n4. 打开 Cocos 等待资源刷新,检查 Git 差异并运行相关关卡。\n5. 应用后由程序重新生成离线版,作为下一轮编辑基线。\n\n' +
'## 注意\n\n单个 Mainline JSON 通常包含 50 关,不能只按文件名理解成一关。涉及新增或调序时,务必一起应用 LevelSequence.json、索引和关联配置。逐鹿布局在 GhostKingLayouts.json 中,不会覆盖主线布局。策划交付的 assets/ 只包含 JSON,不包含 TypeScript 或 .meta。已有 .meta 必须保留,新分块由 Cocos 自动导入并生成 .meta,等待资源刷新完成后再运行或构建游戏。\n\n覆盖包不会自动备份、检测冲突或迁移玩家存档。不要混合不同基线或不同策划的覆盖包;自动校验不保证关卡可解。\n\n基线版本:`' + data.dataVersion + '`\n');
await new Promise(resolve => setTimeout(resolve, 0));
return { bytes: fflate.zipSync(archive, { level: 6 }), manifest };
}
window.ProjectExport = { create };
})();
+57
View File
@@ -0,0 +1,57 @@
(function (root) {
'use strict';
const model = typeof module !== 'undefined' && module.exports ? require('./workspace.cjs') : root.MainlineWorkspace;
const directory = 'assets/resources/Ynyk/Data/';
const sequence = directory + 'LevelSequence.json';
const json = value => JSON.stringify(value, null, 2) + '\n';
function plan(data, files, input, hash, uuid) {
const bundle = model.normalize(input, data), writes = {};
const read = name => JSON.parse(files[directory + name + '.json']);
const index = read('MainlineIndex'), difficulty = read('MainlineDifficulty'), encounters = read('MainlineEncounterConfig');
const positions = new Set(data.sourceOrder || data.order);
const schedule = (name, text) => { if (files[name] !== text) writes[name] = { before: files[name] ?? null, text }; };
const scheduleJson = (name, value) => {
if (files[name] && JSON.stringify(JSON.parse(files[name])) === JSON.stringify(value)) return;
schedule(name, json(value));
};
const metadata = name => {
if (!files[name + '.meta']) schedule(name + '.meta', json({ ver: '2.0.1', importer: name.endsWith('.json') ? 'json' : 'typescript',
imported: true, uuid: uuid(name), files: name.endsWith('.json') ? ['.json'] : [], subMetas: {}, userData: {} }));
};
const inventory = model.sourceOrder(bundle), count = inventory.length;
if (index.chunkSize !== 50 || count > 20000) throw new Error('项目分块规格不受支持');
const byId = new Map(inventory.map(id => [id, { ...model.sourceLevel(bundle, id), displayLevel: id }]));
const chunks = [];
for (let first = 1; first <= count; first += index.chunkSize) {
const chunkId = String(chunks.length + 1).padStart(3, '0'), last = Math.min(count, first + index.chunkSize - 1);
const name = directory + 'Chunks/Mainline' + chunkId + '.json';
const old = files[name] ? JSON.parse(files[name]) : { schemaVersion: 2, chunkId };
scheduleJson(name, { ...old, firstDisplayLevel: first, lastDisplayLevel: last,
levels: Array.from({ length: last - first + 1 }, (_, position) => byId.get(first + position)) });
const meta = index.chunks.find(item => item.chunkId === chunkId) || { chunkId,
json: 'chunks/mainline-' + chunkId + '.v1.json', script: 'js/data/sheep-mainline/v1/mainline-' + chunkId + '.v1.js' };
chunks.push({ ...meta, firstDisplayLevel: first, lastDisplayLevel: last, ...(writes[name] ? { sha256: hash(writes[name].text) } : {}) });
metadata(name);
}
const templates = { ...data.sourceTemplates };
for (const id of inventory) {
if (positions.has(id)) continue;
const template = bundle.templates[id];
difficulty.levels[id] = JSON.parse(JSON.stringify(difficulty.levels[template]));
encounters.levels[id] = JSON.parse(JSON.stringify(encounters.levels[template]));
templates[id] = data.sourceTemplates[template] ?? template;
}
difficulty.levelCount = count;
scheduleJson(directory + 'MainlineDifficulty.json', difficulty);
scheduleJson(directory + 'MainlineEncounterConfig.json', encounters);
scheduleJson(directory + 'MainlineIndex.json', { ...index, levelCount: count, chunks });
const sequenceConfig = JSON.parse(files[sequence]);
scheduleJson(sequence, { ...sequenceConfig, mainline: { ...sequenceConfig.mainline, order: bundle.order, templates,
...(count !== bundle.order.length || sequenceConfig.mainline.sourceCount !== undefined ? { sourceCount: count } : {}) } });
scheduleJson(directory + 'GhostKingLayouts.json', { schemaVersion: 1, levels: bundle.ghostLayouts });
return writes;
}
const api = { plan, directory, sequence };
if (typeof module !== 'undefined' && module.exports) module.exports = api;
else root.ProjectFiles = api;
})(globalThis);
+58
View File
@@ -0,0 +1,58 @@
:root{font-family:"Microsoft YaHei","PingFang SC",sans-serif;color:#242b32;background:#f7f8fa;font-size:13px;letter-spacing:0;color-scheme:light;--line:#e1e5e9;--muted:#7b858e;--accent:#087e88;--accent-bg:#e8f4f3}
*{box-sizing:border-box}body{margin:0}button,input,select,textarea{font:inherit}button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:32px;border:1px solid var(--line);border-radius:5px;padding:6px 11px;background:#fff;color:inherit;cursor:pointer;white-space:nowrap}button:hover{background:#f0f4f5;border-color:#bcc9ce}button:disabled{opacity:.38;cursor:default}button.active{background:var(--accent-bg);color:var(--accent);border-color:#8fc5c6}button.primary{background:var(--accent);border-color:var(--accent);color:#fff}button.primary:hover{background:#086b74}button:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible,canvas:focus-visible{outline:2px solid #31a8ae;outline-offset:2px}svg{width:17px;height:17px;stroke-width:1.7;flex-shrink:0}input,select,textarea{min-width:0;width:100%;border:1px solid #dce1e6;border-radius:4px;background:#fff;padding:8px;color:inherit}input[type=number]{padding-right:2px}textarea{resize:vertical;font-family:Consolas,monospace;font-size:12px;line-height:1.6}label{display:flex;flex-direction:column;gap:7px;font-size:12px;color:#68747d}h1,h2,p{margin:0}h1{font-size:19px;font-weight:600}h2{font-size:13px;font-weight:600;display:flex;align-items:center;gap:8px}[hidden]{display:none!important}
header{min-height:66px;padding:12px 22px;display:flex;align-items:center;gap:28px;border-bottom:1px solid var(--line);background:#fff}.brand{display:flex;gap:10px;align-items:center;white-space:nowrap}.brand>svg{color:var(--accent);width:23px;height:23px}.brand strong{font-size:17px}.brand span{padding:3px 7px;border-left:1px solid var(--line);color:var(--muted);font-size:12px}.level-picker{display:flex;align-items:center;gap:6px}.level-picker button{padding:6px;min-width:30px}.level-picker label{display:flex;flex-direction:row;align-items:center;gap:8px;white-space:nowrap}.level-picker input{width:68px;padding:6px}.level-picker>span{color:var(--muted);font-size:11px;white-space:nowrap;margin-left:3px}.file-actions{margin-left:auto;display:flex;align-items:center;gap:7px}#dirty{color:var(--muted);font-size:12px;margin-right:8px;white-space:nowrap}#dirty.modified{color:#b17820}
main{display:grid;grid-template-columns:220px minmax(330px,1fr) 258px;min-height:calc(100vh - 100px)}aside{background:#fff}.library{border-right:1px solid var(--line);padding:20px 14px;display:flex;flex-direction:column;gap:16px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:8px}.section-heading>span{color:var(--muted);font-size:11px}.search{display:flex;align-items:center;position:relative}.search svg{position:absolute;left:10px;color:#929ba3}.search input{padding-left:34px;font-size:12px}.segments{display:flex;gap:2px;background:#edf0f2;padding:3px;border-radius:5px}.segments button{border:0;background:none;min-height:29px;font-size:12px;flex:1;padding:5px 10px}.segments button.active{background:#fff;box-shadow:0 1px 3px #25343b15;color:#246d75}.materials{display:grid;grid-template-columns:1fr 1fr;gap:8px;align-content:start}.material{height:93px;min-width:0;flex-direction:column;padding:7px 3px;gap:5px;position:relative;white-space:normal}.material .thumbnail{height:44px;width:52px;display:flex;align-items:center;justify-content:center}.thumbnail img{max-width:100%;max-height:100%;object-fit:contain}.material strong{font-size:11px;font-weight:500;line-height:15px;text-align:center;overflow-wrap:anywhere}.material small{position:absolute;right:5px;top:4px;color:#a0a8af;font-size:9px}.material .mechanism-symbol{color:#a07436;width:30px;height:30px}.library-bottom{margin-top:auto;border-top:1px solid var(--line);padding-top:16px;display:flex;flex-direction:column;gap:7px;font-size:10px;color:var(--muted)}.library-bottom strong{font-size:11px;color:#59666f;font-weight:500;overflow-wrap:anywhere}
.workspace{min-width:0;display:flex;flex-direction:column;background:#f5f7f9}.toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:12px 18px;background:#fff;border-bottom:1px solid var(--line);flex-wrap:wrap}.tool-group{display:flex;align-items:center;gap:3px}.tool-group button{border-color:transparent;width:31px;padding:6px}.tool-group button.active{border-color:#a8cfd1}.divider{height:20px;width:1px;background:var(--line);margin:0 4px}#zoom-label{width:44px;text-align:center;font-size:11px;color:#66727d}.canvas-heading{display:flex;justify-content:space-between;align-items:center;padding:22px 28px 8px;gap:10px}.canvas-heading>div{display:flex;gap:12px;align-items:baseline;flex-wrap:wrap}#subtitle{color:var(--muted);font-size:11px}.badge{border:1px solid #d5e2e5;background:#fff;color:#66838b;padding:4px 8px;border-radius:4px;font-size:11px;white-space:nowrap}#viewport{position:relative;min-height:430px;height:calc(100vh - 320px);flex:1;overflow:hidden;background-image:radial-gradient(#cdd6dd 0.7px,transparent 0.7px);background-size:16px 16px}canvas{width:100%;height:100%;display:block;touch-action:none;outline:none}#canvas-empty{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--muted);pointer-events:none}.board-footer{display:flex;justify-content:space-between;gap:12px;padding:10px 27px;color:#7b8790;font-size:11px;border-top:1px solid #e8ecef;background:#f9fafb}.validation{background:#fff;border-top:1px solid var(--line);padding:16px 22px;min-height:105px}.validation h2 svg{color:var(--accent)}#issues{margin-top:12px;font-size:12px;color:#6c7c83;max-height:160px;overflow:auto}#issues .issue{display:block;border:0;border-left:2px solid #d76d67;padding:6px 10px;margin:5px 0;background:#fff5f4;white-space:normal;text-align:left;width:100%;color:#a24e49}.ok{color:#368370!important}.error{color:#b84840!important}
.inspector{border-left:1px solid var(--line);padding:20px 18px;min-width:0}.empty{padding:38px 0;display:flex;flex-direction:column;align-items:center;gap:12px;color:#9ba5ad}.empty>svg{width:28px;height:28px;stroke-width:1.2}#properties{display:flex;flex-direction:column;gap:17px;margin-top:21px}.object-summary{display:flex;align-items:center;gap:12px;padding-bottom:16px;border-bottom:1px solid var(--line)}#selected-image{width:48px;height:48px;display:flex;align-items:center;justify-content:center;background:#f1f5f6;border-radius:5px;flex-shrink:0}#selected-image img{max-width:42px;max-height:42px}.object-summary>div:last-child{display:flex;flex-direction:column;gap:6px;min-width:0}.object-summary strong{font-size:14px;overflow-wrap:anywhere}.object-summary span{font-size:10px;color:var(--muted)}.field-row{display:grid;grid-template-columns:1fr 1fr;gap:12px}.field-row>label{min-width:0}dl{display:grid;grid-template-columns:70px minmax(0,1fr);gap:9px;font-size:11px;margin:0}dt{color:var(--muted)}dd{margin:0;color:#596873;overflow-wrap:anywhere}.board-settings{margin-top:25px;padding-top:20px;border-top:1px solid var(--line)}.board-settings h2{margin-bottom:18px}.board-settings dl{margin-top:18px}#draft-actions{display:flex;gap:5px;flex-wrap:wrap;margin-top:20px}#draft-actions button{font-size:11px}footer{display:flex;justify-content:space-between;gap:20px;padding:9px 17px;border-top:1px solid var(--line);background:#fff;font-size:10px;color:#82909b;min-height:34px}#project-path{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:48%}#message{overflow-wrap:anywhere}body.busy main{pointer-events:none;opacity:.7}
canvas{position:absolute;inset:0}
main,.library{min-width:0}.materials{min-width:0;max-width:100%}
@media(max-width:760px){.file-actions,.board-footer{flex-wrap:wrap}.file-actions button{padding:6px 8px}.toolbar>.segments{max-width:100%}.board-footer>span{overflow-wrap:anywhere}}
@media(min-width:761px){main{height:calc(100vh - 100px);min-height:560px}.library,.inspector{overflow-y:auto}.workspace{min-height:0}#viewport{height:auto;min-height:220px;flex:1 1 0}.validation,.toolbar,.canvas-heading,.board-footer{flex-shrink:0}}
@media(min-width:1600px){main{grid-template-columns:245px minmax(330px,1fr) 280px}.library{padding:20px}.material{height:100px}}
@media(max-width:1100px){header{gap:12px;padding:12px}.brand span{display:none}main{grid-template-columns:174px minmax(300px,1fr) 226px}.library{padding:16px 10px}.inspector{padding:16px 13px}.toolbar{padding:9px;gap:6px}.canvas-heading{padding:18px 18px 8px}.file-actions{gap:4px}#dirty{margin-right:0}.brand strong{font-size:15px}}
@media(max-width:760px){header{flex-wrap:wrap;gap:12px}.brand{flex:1}.brand strong{font-size:16px}.file-actions{width:100%;justify-content:flex-end}#dirty{margin-right:auto}main{grid-template-columns:1fr}.library{border-right:0;border-bottom:1px solid var(--line);gap:10px;padding:14px}.library .section-heading,.library-bottom{display:none}.library .search{max-width:100%}#library-tabs{width:180px}.materials{display:flex;overflow-x:auto;padding:2px 0 5px;gap:7px}.material{min-width:76px;width:76px;flex-shrink:0;height:82px}.material .thumbnail{height:35px}.workspace{min-height:650px}#viewport{height:460px;min-height:360px;flex:auto}.inspector{border-left:0;border-top:1px solid var(--line);display:block;padding:18px}#properties{display:grid;grid-template-columns:1fr 1fr;align-items:start}#properties .object-summary,#properties>label:last-of-type{grid-column:1/-1}.empty{padding:20px}.board-settings{margin-top:20px}.toolbar{gap:6px}.canvas-heading{padding:18px 16px 8px}footer{font-size:10px}#project-path{display:none}.board-footer{padding:10px 16px}.validation{padding:16px}#subtitle{font-size:10px}}
dialog#mainline-dialog { width: min(720px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid #cbd5e1; border-radius: 8px; padding: 20px; color: #243047; background: #fff; }
dialog::backdrop { background: #18243466; }
.mainline-heading, .mainline-summary, .mainline-row, .mainline-footer { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mainline-heading, .mainline-summary { justify-content: space-between; margin-bottom: 12px; }
.mainline-heading h2 { margin: 0; font-size: 20px; }
.mainline-summary { color: #596579; font-size: 13px; }
#mainline-search, #mainline-list { width: 100%; margin-bottom: 12px; }
#mainline-list { display: block; height: 288px; border: 1px solid #d6dce5; border-radius: 4px; padding: 4px; font: inherit; font-size: 13px; color: #243047; background: #f8fafc; }
#mainline-list option { padding: 6px 8px; }
.mainline-row { margin-bottom: 12px; }
.mainline-row label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.brand select { width: 110px; flex-shrink: 0; font-size: 12px; padding: 6px; }
header { flex-wrap: wrap; }
#project-export-dialog { max-width: calc(100vw - 24px); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
#help-dialog { width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: 8px; color: inherit; }
.help-heading { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0; padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--line); }
.help-heading h2 { font-size: 17px; }
.help-heading button { width: 32px; padding: 6px; flex-shrink: 0; }
.help-content { padding: 0 20px 20px; line-height: 1.8; overflow-wrap: anywhere; }
.help-content section { padding-top: 18px; }
.help-content h3 { margin: 0 0 8px; font-size: 14px; }
.help-content p + p { margin-top: 8px; }
.help-files { display: block; margin: 0 0 12px; font-size: 13px; }
.help-files dt { display: flex; align-items: center; gap: 8px; margin-top: 12px; color: var(--accent); font-weight: 600; }
.help-files dd { margin-top: 4px; color: inherit; }
.has-overlay { position: relative; }
.extra-fields { display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; grid-column: 1 / -1; }
.extra-note { font-size: 11px; line-height: 1.6; color: var(--muted); overflow-wrap: anywhere; }
#extra-advanced { border-top: 1px solid var(--line); padding-top: 12px; grid-column: 1 / -1; }
#extra-advanced summary { cursor: pointer; color: #63747c; font-size: 12px; }
#extra-advanced label { margin-top: 12px; }
#extra-advanced button { margin-top: 8px; width: 100%; }
.path-editor { min-width: 0; }
.path-editor h3 { margin: 0 0 10px; font-size: 12px; font-weight: 500; }
.path-rows { display: flex; flex-direction: column; gap: 6px; }
.path-columns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 5px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.path-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 5px; }
.path-row button { width: 30px; padding: 4px; }
.path-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.has-overlay > img.entity-overlay { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 48%; height: 60%; object-fit: contain; pointer-events: none; }
.mainline-row label select { width: auto; max-width: 180px; }
#mainline-target { width: 80px; }
#mainline-error { font-size: 13px; color: #b42335; min-height: 18px; overflow-wrap: anywhere; }
.mainline-footer { justify-content: flex-end; border-top: 1px solid #e3e7ed; padding-top: 12px; }
@media (max-width: 600px) { dialog#mainline-dialog { padding: 14px; } #mainline-list { height: 240px; } .file-actions { flex-wrap: wrap; } }
+49
View File
@@ -0,0 +1,49 @@
(function (root) {
'use strict';
const copy = value => JSON.parse(JSON.stringify(value));
const fields = ['width', 'height', 'characters', 'aoes'];
function create(data) {
return { formatVersion: 2, rulesVersion: data.rulesVersion, dataVersion: data.dataVersion,
order: [...data.order], templates: Object.fromEntries((data.sourceOrder || data.order).map(id => [id, id])), levels: copy(data.levels), archivedLevels: copy(data.archivedLevels || {}), ghostLayouts: copy(data.ghostLayouts || {}) };
}
const sourceOrder = value => [...value.order, ...Object.keys(value.archivedLevels || {}).map(Number).sort((a, b) => a - b)];
const sourceLevel = (value, id) => { const position = value.order.indexOf(id); return position < 0 ? value.archivedLevels?.[id] : value.levels[position]; };
function normalize(input, data) {
if (!input || ![1, 2].includes(input.formatVersion) || input.rulesVersion !== data.rulesVersion || input.dataVersion !== data.dataVersion) throw new Error('数据包版本不匹配,请使用生成该数据包的编辑器版本');
const order = input.formatVersion === 1 ? data.order : input.order;
const templates = input.formatVersion === 1 ? create(data).templates : input.templates;
if (!Array.isArray(order) || order.length < 1 || order.length > 20000 || !Array.isArray(input.levels) || input.levels.length !== order.length) throw new Error('数据包关卡数量无效,主线至少保留一关');
if (input.archivedLevels !== undefined && (!input.archivedLevels || typeof input.archivedLevels !== 'object' || Array.isArray(input.archivedLevels))) throw new Error('保留来源布局无效');
const ids = new Set(order), base = new Map([...data.order.map((id, index) => [id, data.levels[index]]), ...Object.entries(data.archivedLevels || {}).map(([id, level]) => [Number(id), level])]);
if (ids.size !== order.length || order.some(id => !Number.isSafeInteger(id) || id < 1 || id > 20000)) throw new Error('来源 ID 必须唯一,且在 1 到 20000 范围内');
const archive = { ...Object.fromEntries([...base].filter(([id]) => !ids.has(id))), ...input.archivedLevels };
if (Object.keys(archive).some(id => !/^[1-9]\d*$/.test(id) || Number(id) > 20000 || ids.has(Number(id)))) throw new Error('保留来源 ID 无效或与主线重复');
const inventory = new Set([...order, ...Object.keys(archive).map(Number)]);
if (Math.max(...inventory) !== inventory.size) throw new Error('来源库存必须连续,移除主线时需要保留来源布局');
const result = create(data); result.order = [...order]; result.templates = {};
if (input.ghostLayouts !== undefined) {
if (!input.ghostLayouts || typeof input.ghostLayouts !== 'object' || Array.isArray(input.ghostLayouts)) throw new Error('逐鹿布局数据无效');
result.ghostLayouts = {};
for (const [id, level] of Object.entries(input.ghostLayouts)) {
if (!/^[1-9]\d*$/.test(id) || Number(id) > data.ghostSources.length || !level || fields.some(field => level[field] === undefined)) throw new Error('逐鹿布局编号或字段无效:' + id);
result.ghostLayouts[id] = Object.fromEntries(fields.map(field => [field, copy(level[field])]));
}
}
function normalizeLevel(id, incoming, number, active) {
const template = base.has(id) ? id : templates?.[id];
if (!base.has(template) || (base.has(id) && templates?.[id] !== id)) throw new Error('关卡模板 ID 无效:' + id);
result.templates[id] = template;
const original = base.get(template);
if (!incoming || (active && incoming.displayLevel !== number) || fields.some(field => incoming[field] === undefined)) throw new Error('显示编号或布局字段无效:' + number);
// 只接收布局字段;来源、难度与玩法元数据不能由数据包任意覆盖。
return { ...copy(original), ...(base.has(id) ? {} : { sourceId: 'editor_level_' + id, sourcePath: 'editor/level_' + id + '.json', sourceUuid: 'editor_level_' + id }),
...Object.fromEntries(fields.map(field => [field, copy(incoming[field])])), displayLevel: number };
}
result.levels = order.map((id, index) => normalizeLevel(id, input.levels[index], index + 1, true));
result.archivedLevels = Object.fromEntries(Object.entries(archive).map(([id, level]) => [id, normalizeLevel(Number(id), level, Number(id), false)]));
return result;
}
const api = { create, normalize, sourceOrder, sourceLevel };
if (typeof module !== 'undefined' && module.exports) module.exports = api;
else root.MainlineWorkspace = api;
})(globalThis);
+80
View File
@@ -0,0 +1,80 @@
# 离线关卡编辑器
将整个文件夹解压到本机,双击 `编辑器.html`,使用 Chrome 或 Edge 打开。无需安装 Cocos、Node.js,也不需要网络或游戏项目。
## 文件操作
- 上传箭头:导入单关 JSON,应用到当前关卡,仅替换布局。
- 下载箭头:导出当前单关 JSON,可交给程序在项目内编辑器中导入。
- 文件夹导入图标:导入完整关卡数据包,校验全部关卡后替换本机工作区。
- 包裹导出图标:导出全部关卡数据包,包含当前未保存布局;其他关卡取本机已保存值。
- 文件夹下载图标:导出项目文件包 ZIP,包含相对本版基线的实际项目文件、变更清单和应用说明;当前关卡未保存布局也会包含。不会修改项目或本机工作区。
- 存本机:保存到当前浏览器工作区,不会改写旁边的 JSON 文件。
浏览器下载位置由浏览器设置决定。交付、换电脑或升级编辑器前,务必导出 JSON 备份;浏览器工作区不是文件备份。移动文件夹、切换浏览器、无痕模式或清理浏览器数据都可能导致本机记录不可用。不要同时打开多个窗口编辑同一份离线工作区。
## 对象附加配置
选中棋盘对象后,在右侧属性面板配置对应参数:移动速度、木栅栏初始升降、巡逻路径、炸弹后备倒计时、封印锁后备血量。数字框留空恢复默认;路径点使用列、行整数坐标,可添加或删除,至少保留两点,点击“应用路径”。待修改路径也会在保存、单关导出或整包导出时应用。
木栅栏选择“降下”后,源布局和局内预览显示降下图片与半透明状态;预览仅反映初始状态,不模拟游戏中的后续升降。
关卡级倒计时 `progression.boomTime` 和封印锁血量 `progression.caveDesNum` 的优先级高于对象附加值,面板会提示当前来源;炸弹实际倒计时还可能受到难度限制,以校验后的实际值为准。这些控件不改变玩法的配置读取顺序。
高级附加配置 JSON 保留在折叠区,未识别字段和其他指令不会因表单修改而丢失。历史皮肤等当前玩法没有读取的字段只保留原数据,不提供生效控件。
## 数据版本
默认关卡、军械素材、占格规则和场景边界已随工具内置。`默认数据包.json` 可用于恢复默认关卡。整包导入要求格式、规则和数据来源版本一致,不执行 JSON 中的代码,不接受替换游戏规则。
修改配置、规则或场景后,由程序重新生成并发布整个文件夹,不要单独替换脚本或混用不同版本文件。
## 新增、插入与调整顺序
点击顶部“主线编排”,在列表中选择一关。可搜索显示关卡号或稳定来源 ID。
- 新增关卡:选择“复制选中关卡”或“空白布局”,点击“新增至末尾”。
- 在第 7 与第 8 关之间插入:选中第 7 关,选择新增方式,点击“插入选中关卡之后”,再点击“应用编排”。新关成为第 8 关,原第 8 关及之后的显示编号自动顺延。
- 调整顺序:选择一关,点击上移、下移,或输入目标关卡号并点击“移动”。
- 移除关卡:选择一关,点击“从主线移除”并确认,再应用编排。后续关卡编号自动前移,主线至少保留一关。底层来源布局、难度、敌人和逐鹿引用保留,不会物理删除;误操作可在应用前撤销或取消。
- 撤销按钮仅撤销当前编排窗口中的操作;取消会丢弃未应用的编排。应用后会打开当前选中的关卡,可继续编辑棋盘。
新关继承模板的棋盘尺寸、场景、难度、敌人和玩法元数据。“空白布局”只清空军械、机关;“复制”保留模板布局。新增关卡暂不提供独立难度、敌人或场景配置界面,也不加入群雄逐鹿独立关卡序列。
显示关卡号会变化,来源 ID 不变化,原关卡的布局、场景和难度随该关移动。来源库存最多支持 20000 关,移除的来源仍占库存,后续新增不会复用其 ID。当前关卡的未保存布局会随“应用编排”一起保存。整包导出只包含已应用的编排,不包含尚未应用的窗口操作。整包也保留已移除来源,用于逐鹿和再次导入。
支持移除的游戏读取代码需随本次编辑器升级一并合入;后续策划仍然只交付项目 JSON。`LevelSequence.json` 的 `mainline.order` 表示在用主线顺序,`sourceCount` 表示包含保留来源的库存数量;索引和分块按库存保存。修改顺序或移除关卡后,已上线玩家的进度迁移仍需程序另行处理。
## 回到项目
### 直接导出项目文件包
策划点击顶部“导出项目文件包 ZIP”(文件夹下载图标),选择“导出变更 JSON”或“导出全部 JSON”,等待校验和下载完成。未应用的编排必须先点击“应用编排”。没有修改也可以选择“导出全部 JSON”;“导出变更 JSON”在无变更时提示改选全部。
“全部”包含主线所有分块、索引、顺序、难度、敌人配置和逐鹿独立布局,不包含素材、游戏规则或其他非关卡配置,不是整个游戏资源目录的备份。完整包包含未修改文件,覆盖前同样需要核对基线,不能用于覆盖其他策划的修改。下载位置由浏览器设置决定,可按 Ctrl+J 查看下载记录。
ZIP 中的 `assets/` 与项目目录一致,只包含实际游戏 JSON,不包含 TypeScript。变更模式下,单关布局通常生成对应的 `Mainline*.json` 分块与索引;新增、插入或调序会按需包含 `LevelSequence.json`、难度和敌人配置;逐鹿布局写入 `GhostKingLayouts.json`。一个分块通常含 50 关,不要只复制其中一关或漏掉索引、顺序 JSON。保留项目已有 `.meta`,新增分块的 `.meta` 由 Cocos 导入时生成。
程序先提交 Git 或备份项目,核对 `交付信息/变更清单.json` 的基线版本和文件摘要,确认目标没有后续修改、本包新增路径尚不存在,再把 `assets/` 合并到项目根目录的 `assets/`,不要删除原目录。`交付信息/` 不需要复制进项目。随后在 Cocos 刷新资源、检查 Git 差异并验收关卡。
**直接覆盖没有自动备份或冲突检测。不同策划的覆盖包不能直接连续覆盖。** 如果程序侧已改动同一批数据,使用包内 `交付信息/主线关卡数据包.json` 走下方的项目内导入流程,或由程序合并,不能靠改版本号强行覆盖。每轮应用后重新生成离线版,再交付下一轮编辑。玩家存档不会自动迁移。
### 通过项目内编辑器导入
仅修改一关布局,可导出单关 JSON,由程序在项目内编辑器选择对应模式、打开目标关卡、导入、校验、保存。**走此导入流程时,涉及新增、插入或调序,必须导出完整关卡数据包**,单关 JSON 不包含主线编排信息。
程序在生成该离线版时使用的同一项目数据版本中启动项目内编辑器,点击“导入关卡数据包”,确认后会校验并写回顺序配置、关卡分块、索引以及新增关卡继承的难度和敌人配置。原文件备份在项目根目录 `.level-editor-backups/mainline-时间戳-随机值/`,包含中文清单。项目内的“主线编排”也可直接新增、插入和调序,应用前同样会确认和备份。
整包版本不一致时拒绝写入,避免覆盖程序侧后续修改;应先由程序合并数据,再重新生成离线版。项目成功应用整包后,重新生成离线版交付下一轮编辑。旧版工具请先导出备份,不要直接覆盖旧工作区。
**现有玩家存档不会随新顺序自动迁移。** 发布调序版本前需安排存档迁移策略;本工具不修改玩家进度,也不重排群雄逐鹿积分。现有历史版本的进度迁移保持原行为。
写回多个文件不是跨文件系统事务。进程被强制终止或断电时,先停止编辑器,按备份目录的 `清单.json` 恢复原文件,并移除清单中 `existed: false` 的本次新增文件,再重新启动、校验项目。正常写入异常会尝试回滚本次已写文件;检测到外部修改时不会覆盖外部新内容。
## 群雄逐鹿布局
顶部模式下拉框选择“群雄逐鹿”,输入逐鹿关卡号后编辑棋盘。保存与导入导出操作作用于该模式;完整数据包、项目文件包同时包含主线和逐鹿的修改。
未单独配置的逐鹿关卡继续继承其原主线来源;保存后只独立覆盖棋盘宽高、军械和机关,不改主线布局。主线调序按稳定来源 ID 保持逐鹿引用,不会改成引用顺延后的另一关。现有 800 关的编号、积分、倍率、限时与历史存档迁移保持原规则;暂不提供逐鹿增删或调序。
校验检查数据格式、占格和游戏布局适配,不保证关卡可解。完整战斗行为仍需在游戏中验收。JSON 替换后需刷新 Cocos 资源并重新运行或构建,不会热更新已运行的战斗。
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Arjun Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+15
View File
@@ -0,0 +1,15 @@
ISC License
Copyright (c) for portions of Lucide are held by Cole Bemis 2013-2022 as part of Feather (MIT). All other copyright (c) for Lucide are held by Lucide Contributors 2022.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+66
View File
File diff suppressed because one or more lines are too long
+610373
View File
File diff suppressed because it is too large Load Diff