fix: bugs

This commit is contained in:
unanmed 2024-03-02 00:00:41 +08:00
parent d7544b98c8
commit 314cf0626c
14 changed files with 48 additions and 36 deletions

View File

@ -9,3 +9,4 @@ public/_server/**/*.js
script/**/*.js script/**/*.js
public/editor.html public/editor.html
keyCodes.ts keyCodes.ts
*.md

View File

@ -9,6 +9,5 @@
"vueIndentScriptAndStyle": false, "vueIndentScriptAndStyle": false,
"arrowParens": "avoid", "arrowParens": "avoid",
"trailingComma": "none", "trailingComma": "none",
"endOfLine": "auto", "endOfLine": "auto"
"embeddedLanguageFormatting": "off"
} }

View File

@ -174,6 +174,7 @@ events.prototype._gameOver_confirmUpload = function (ending, norank) {
core.ui.drawConfirmBox( core.ui.drawConfirmBox(
'你想记录你的ID和成绩吗', '你想记录你的ID和成绩吗',
function () { function () {
console.log(2);
if (main.isCompetition) { if (main.isCompetition) {
core.events._gameOver_doUpload('', ending, norank); core.events._gameOver_doUpload('', ending, norank);
} else { } else {
@ -191,6 +192,7 @@ events.prototype._gameOver_confirmUpload = function (ending, norank) {
} }
}, },
function () { function () {
console.log(1);
if (main.isCompetition) if (main.isCompetition)
core.events._gameOver_confirmDownload(ending); core.events._gameOver_confirmDownload(ending);
else core.events._gameOver_doUpload(null, ending, norank); else core.events._gameOver_doUpload(null, ending, norank);
@ -627,7 +629,7 @@ events.prototype._openDoor_animate = function (block, x, y, callback) {
core.maps._removeBlockFromMap(core.status.floorId, block); core.maps._removeBlockFromMap(core.status.floorId, block);
if (!locked) core.unlockControl(); if (!locked) core.unlockControl();
core.status.replay.animate = false; core.status.replay.animate = false;
Mota.require('var', 'hook').emit('afterOpenDoor', block.event.id, x, y); core.events.afterOpenDoor(block.event.id, x, y);
if (callback) callback(); if (callback) callback();
}; };
@ -707,7 +709,7 @@ events.prototype.getItem = function (id, num, x, y, isGentleClick, callback) {
itemHint.push(id); itemHint.push(id);
} }
Mota.require('var', 'hook').emit('afterGetItem', id, x, y, isGentleClick); this.afterGetItem(id, x, y, isGentleClick);
if (callback) callback(); if (callback) callback();
}; };

View File

@ -918,9 +918,7 @@ ui.prototype.closePanel = function () {
this.clearUI(); this.clearUI();
core.maps.generateGroundPattern(); core.maps.generateGroundPattern();
core.updateStatusBar(true); core.updateStatusBar(true);
setTimeout(() => { core.unlockControl();
core.unlockControl();
}, 0);
core.status.event.data = null; core.status.event.data = null;
core.status.event.id = null; core.status.event.id = null;
core.status.event.selection = null; core.status.event.selection = null;

View File

@ -96,6 +96,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
core.drawText( core.drawText(
['\t[' + (reason || '结局1') + ']你死了。\n如题。'], ['\t[' + (reason || '结局1') + ']你死了。\n如题。'],
function () { function () {
console.log(core.status.lockControl);
core.events.gameOver(null, replaying); core.events.gameOver(null, replaying);
} }
); );
@ -241,7 +242,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
return true; return true;
}, },
afterGetItem: function () { afterGetItem: function (itemId, x, y, isGentleClick) {
// 获得一个道具后触发的事件 // 获得一个道具后触发的事件
// itemId获得的道具IDx和y是该道具所在的坐标 // itemId获得的道具IDx和y是该道具所在的坐标
// isGentleClick是否是轻按触发的 // isGentleClick是否是轻按触发的
@ -272,7 +273,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
if (todo.length > 0) core.insertAction(todo, x, y); if (todo.length > 0) core.insertAction(todo, x, y);
}, },
afterOpenDoor: function () { afterOpenDoor: function (x, y) {
// 开一个门后触发的事件 // 开一个门后触发的事件
const todo = []; const todo = [];
// 检查该点的获得开门后事件。 // 检查该点的获得开门后事件。

View File

@ -89,8 +89,6 @@ watch(width, n => emits('update:width', n));
watch(height, n => emits('update:height', n)); watch(height, n => emits('update:height', n));
async function click() { async function click() {
console.log(1);
moveSelected.value = true; moveSelected.value = true;
moveTimeout = window.setTimeout(() => { moveTimeout = window.setTimeout(() => {
moveSelected.value = false; moveSelected.value = false;

View File

@ -161,7 +161,7 @@ interface IndexedGameUi extends ShowableGameUi {
} }
interface HoldOnController { interface HoldOnController {
end(): void; end(noClosePanel?: boolean): void;
} }
export class UiController extends Focus<IndexedGameUi> { export class UiController extends Focus<IndexedGameUi> {
@ -180,7 +180,7 @@ export class UiController extends Focus<IndexedGameUi> {
v.ui.emit('close'); v.ui.emit('close');
}); });
if (this.stack.length === 0) { if (this.stack.length === 0) {
if (!this.hold) this.emit('end'); if (!this.hold) this.emit('end', false);
this.hold = false; this.hold = false;
} }
}); });
@ -225,8 +225,8 @@ export class UiController extends Focus<IndexedGameUi> {
this.hold = true; this.hold = true;
return { return {
end: () => { end: (noClosePanel: boolean = false) => {
this.emit('end'); this.emit('end', noClosePanel);
} }
}; };
} }

View File

@ -41,11 +41,13 @@ hook.once('mounted', () => {
ui.style.display = 'flex'; ui.style.display = 'flex';
core.lockControl(); core.lockControl();
}); });
mainUi.on('end', () => { mainUi.on('end', noClosePanel => {
ui.style.display = 'none'; ui.style.display = 'none';
try { if (!noClosePanel) {
core.closePanel(); try {
} catch {} core.closePanel();
} catch {}
}
}); });
fixedUi.on('start', () => { fixedUi.on('start', () => {
fixed.style.display = 'block'; fixed.style.display = 'block';

View File

@ -53,13 +53,16 @@ function _convertShop(shop: any) {
// 检测能否访问该商店 // 检测能否访问该商店
{ {
type: 'if', type: 'if',
condition: "core.isShopVisited('" + shop.id + "')", condition:
"Mota.Plugin.require('shop_g').isShopVisited('" +
shop.id +
"')",
true: [ true: [
// 可以访问,直接插入执行效果 // 可以访问,直接插入执行效果
{ {
type: 'function', type: 'function',
function: function:
"function() { core.plugin._convertShop_replaceChoices('" + "function() { Mota.Plugin.require('shop_g')._convertShop_replaceChoices('" +
shop.id + shop.id +
"', false) }" "', false) }"
} }
@ -84,7 +87,7 @@ function _convertShop(shop: any) {
{ {
type: 'function', type: 'function',
function: function:
"function() { core.plugin._convertShop_replaceChoices('" + "function() { Mota.Plugin.require('shop_g')._convertShop_replaceChoices('" +
shop.id + shop.id +
"', true) }" "', true) }"
} }
@ -101,7 +104,10 @@ function _convertShop(shop: any) {
]; ];
} }
function _convertShop_replaceChoices(shopId: string, previewMode: boolean) { export function _convertShop_replaceChoices(
shopId: string,
previewMode: boolean
) {
var shop = core.status.shops[shopId] as any; var shop = core.status.shops[shopId] as any;
var choices = (shop.choices || []) var choices = (shop.choices || [])
.filter(function (choice: any) { .filter(function (choice: any) {

View File

@ -23,7 +23,8 @@ export function getAddStatus(equip: Equip) {
{keys.map(v => { {keys.map(v => {
const value = Math.floor( const value = Math.floor(
(equip.value[v] ?? 0) * core.getBuff(v) + (equip.value[v] ?? 0) * core.getBuff(v) +
(core.status.hero[v] * (equip.percentage[v] ?? 0)) / 100 (core.status.hero[v] * (equip.percentage?.[v] ?? 0)) /
100
); );
return ( return (
@ -71,12 +72,12 @@ export function getNowStatus(nowEquip?: Equip, onCol: boolean = false) {
let add = 0; let add = 0;
if (has(nowEquip)) { if (has(nowEquip)) {
add += Math.floor( add += Math.floor(
(nowEquip.value[v] ?? 0) * core.getBuff(v) (nowEquip.value?.[v] ?? 0) * core.getBuff(v)
); );
const per = Math.floor( // const per = Math.floor(
(nowEquip.percentage[v] * core.getStatus(v)) / 100 // (nowEquip.percentage?.[v] * getHeroStatusOn(v)) / 100
); // );
add += isNaN(per) ? 0 : per; // add += isNaN(per) ? 0 : per;
} }
if (onCol) add = -add; if (onCol) add = -add;

View File

@ -312,10 +312,10 @@ export function getStatusLabel(name: string) {
hpmax: '生命回复', hpmax: '生命回复',
hp: '生命', hp: '生命',
manamax: '魔力上限', manamax: '魔力上限',
mana: '额外攻击', mana: '魔力',
atk: '攻击', atk: '攻击',
def: '防御', def: '防御',
mdef: '智慧', mdef: '护盾',
money: '金币', money: '金币',
exp: '经验', exp: '经验',
point: '加点', point: '加点',

View File

@ -56,7 +56,7 @@
:type="isMobile ? 'horizontal' : 'vertical'" :type="isMobile ? 'horizontal' : 'vertical'"
></a-divider> ></a-divider>
<div id="fly-right"> <div id="fly-right">
<canvas id="fly-thumbnail" @click="fly"></canvas> <canvas id="fly-thumbnail" @click="fly" @wheel="wheel"></canvas>
<div id="fly-tools"> <div id="fly-tools">
<double-left-outlined <double-left-outlined
@click="changeFloorByDelta(-10)" @click="changeFloorByDelta(-10)"
@ -472,6 +472,10 @@ function click(e: MouseEvent) {
} }
} }
function wheel(ev: WheelEvent) {
changeFloorByDelta(-Math.sign(ev.deltaY));
}
function changeAreaByFloor(id: FloorIds) { function changeAreaByFloor(id: FloorIds) {
nowArea.value = Object.keys(area).find(v => area[v].includes(id))!; nowArea.value = Object.keys(area).find(v => area[v].includes(id))!;
} }

View File

@ -184,7 +184,7 @@ function use(id: ShowItemIds) {
nextTick(() => { nextTick(() => {
core.useItem(id, false, () => { core.useItem(id, false, () => {
if (mainUi.stack.length === 0) { if (mainUi.stack.length === 0) {
hold.end(); hold.end(core.status.event.id !== 'toolbox');
} }
}); });
}); });

View File

@ -61,14 +61,14 @@ export default defineConfig({
target: FSHOST, target: FSHOST,
changeOrigin: true, changeOrigin: true,
rewrite(path) { rewrite(path) {
return path.replace(/^\/all/, ''); return './' + path.replace(/^\/all/, '');
}, },
}, },
'^/forceTem/.*': { '^/forceTem/.*': {
target: FSHOST, target: FSHOST,
changeOrigin: true, changeOrigin: true,
rewrite(path) { rewrite(path) {
return path.replace(/^\/forceTem/, ''); return './' + path.replace(/^\/forceTem/, '');
}, },
} }
}, },