fix: fix some type

This commit is contained in:
ShakeFlower 2025-04-30 17:17:56 +08:00
parent ce8581f6e1
commit d93bee9865
2 changed files with 24 additions and 11 deletions

View File

@ -3999,7 +3999,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
class Setting { class Setting {
/** /**
* @param {(ctx:string)=>void} draw * @param {(ctx:string)=>void} [draw]
*/ */
constructor(name, effect, text, replay, draw) { constructor(name, effect, text, replay, draw) {
/** 获取选项界面显示的名称 */ /** 获取选项界面显示的名称 */
@ -4013,7 +4013,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
*/ */
this.replay = replay; this.replay = replay;
/** /**
* @type {(ctx:string)=>void} * @type {((ctx:string)=>void )| undefined}
*/ */
this.draw = draw; this.draw = draw;
} }
@ -4025,7 +4025,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
const perform = { const perform = {
jumpBlock: maps.prototype.jumpBlock, jumpBlock: maps.prototype.jumpBlock,
jumpHero: maps.prototype.jumpHero, jumpHero: events.prototype.jumpHero,
moveBlock: maps.prototype.moveBlock, moveBlock: maps.prototype.moveBlock,
drawAnimate: maps.prototype.drawAnimate, drawAnimate: maps.prototype.drawAnimate,
drawHeroAnimate: maps.prototype.drawHeroAnimate, drawHeroAnimate: maps.prototype.drawHeroAnimate,
@ -4035,7 +4035,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}; };
function instantMove(fromX, fromY, aimX, aimY, keep, callback) { function instantMove(fromX, fromY, aimX, aimY, keep, callback) {
const [block, blockInfo] = _getAndRemoveBlock(fromX, fromY); const [block, blockInfo] = core.maps._getAndRemoveBlock(fromX, fromY);
if (keep) { if (keep) {
core.setBlock(blockInfo.number, aimX, aimY); core.setBlock(blockInfo.number, aimX, aimY);
core.showBlock(aimX, aimY); core.showBlock(aimX, aimY);
@ -4050,7 +4050,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return true; return true;
} }
core.maps.jumpBlock = perform.jumpBlock; core.maps.jumpBlock = perform.jumpBlock;
core.maps.jumpHero = perform.jumpHero; core.events.jumpHero = perform.jumpHero;
core.maps.moveBlock = perform.moveBlock; core.maps.moveBlock = perform.moveBlock;
core.maps.drawAnimate = perform.drawAnimate; core.maps.drawAnimate = perform.drawAnimate;
core.maps.drawHeroAnimate = perform.drawHeroAnimate; core.maps.drawHeroAnimate = perform.drawHeroAnimate;
@ -4060,7 +4060,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
function skipTextOff() { function skipTextOff() {
core.maps.jumpBlock = perform.jumpBlock; core.maps.jumpBlock = perform.jumpBlock;
core.maps.jumpHero = perform.jumpHero; core.events.jumpHero = perform.jumpHero;
core.maps.moveBlock = perform.moveBlock; core.maps.moveBlock = perform.moveBlock;
core.maps.drawAnimate = perform.drawAnimate; core.maps.drawAnimate = perform.drawAnimate;
core.maps.drawHeroAnimate = perform.drawHeroAnimate; core.maps.drawHeroAnimate = perform.drawHeroAnimate;
@ -4073,7 +4073,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.maps.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) { core.maps.jumpBlock = function (sx, sy, ex, ey, time, keep, callback) {
return instantMove(sx, sy, ex, ey, keep, callback); return instantMove(sx, sy, ex, ey, keep, callback);
} }
core.maps.jumpHero = function (ex, ey, time, callback) { core.events.jumpHero = function (ex, ey, time, callback) {
const { x: sx, y: sy } = core.status.hero.loc;
if (ex == null) ex = sx;
if (ey == null) ey = sy;
core.setHeroLoc('x', ex); core.setHeroLoc('x', ex);
core.setHeroLoc('y', ey); core.setHeroLoc('y', ey);
core.clearMap('hero'); core.clearMap('hero');
@ -4095,7 +4098,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return -1; return -1;
} }
core.events.vibrate = function () { core.events.vibrate = function (direction, time, speed, power, callback) {
if (callback) callback(); if (callback) callback();
return; return;
} }
@ -4707,7 +4710,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
class SettingButton extends ButtonBase { class SettingButton extends ButtonBase {
/** /**
* @param {unknown[]} eventArgs * @param {string[]} [eventArgs]
*/ */
constructor(x, y, w, h, name, eventArgs) { constructor(x, y, w, h, name, eventArgs) {
super(x, y, w, h); super(x, y, w, h);

14
runtime.d.ts vendored
View File

@ -843,7 +843,7 @@ interface control {
* action参数 * action参数
* func返回true代表成功处理了此录像行为false代表没有处理此录像行为 * func返回true代表成功处理了此录像行为false代表没有处理此录像行为
*/ */
registerReplayAction(name: string, func: (action?: string) => boolean): void registerReplayAction(name: string, func: ((action: string) => boolean) | (() => boolean)): void
/** 注销一个录像行为 */ /** 注销一个录像行为 */
unregisterReplayAction(name: string): void unregisterReplayAction(name: string): void
@ -976,6 +976,7 @@ interface events {
_startGame_setHard(): void _startGame_setHard(): void
_eventMoveHero_moving(step: number, moveSteps: [direction | 'forward' | 'backward' | _eventMoveHero_moving(step: number, moveSteps: [direction | 'forward' | 'backward' |
'leftup' | 'leftdown' | 'rightup' | 'rightdown', number][]): boolean 'leftup' | 'leftdown' | 'rightup' | 'rightdown', number][]): boolean
__action_checkReplaying(): boolean
/** /**
* *
@ -1644,6 +1645,7 @@ interface enemys {
/** @file maps.js负责一切和地图相关的处理内容 */ /** @file maps.js负责一切和地图相关的处理内容 */
interface maps { interface maps {
_loadFloor_doNotCopy(): string[] _loadFloor_doNotCopy(): string[]
_getAndRemoveBlock(x: number, y: number): [Block, any]
/** /**
* core.maps.blockInfo的一个拷贝 * core.maps.blockInfo的一个拷贝
@ -2491,6 +2493,14 @@ interface ui {
*/ */
drawFailTip(text: string, id?: string, frame?: number): void drawFailTip(text: string, id?: string, frame?: number): void
/**
*
* @param text ${}
* @param id ID
* @param frame
*/
drawSuccessTip(text: string, id?: string, frame?: number): void
/** 地图中间绘制一段文字 */ /** 地图中间绘制一段文字 */
drawText(contents: string, callback?: () => any): void drawText(contents: string, callback?: () => any): void
@ -2522,7 +2532,7 @@ interface ui {
left?: number left?: number
top?: number top?: number
maxWidth?: number maxWidth?: number
color?: number color?: number | string
align?: 'left' | 'center' | 'right' align?: 'left' | 'center' | 'right'
fontSize: number fontSize: number
lineHeight?: number lineHeight?: number