diff --git a/project/plugins.js b/project/plugins.js index a9aa89f6..339ab3eb 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -3999,7 +3999,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = class Setting { /** - * @param {(ctx:string)=>void} draw + * @param {(ctx:string)=>void} [draw] */ constructor(name, effect, text, replay, draw) { /** 获取选项界面显示的名称 */ @@ -4013,7 +4013,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = */ this.replay = replay; /** 除名称外的绘制内容 - * @type {(ctx:string)=>void} + * @type {((ctx:string)=>void )| undefined} */ this.draw = draw; } @@ -4025,7 +4025,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const perform = { jumpBlock: maps.prototype.jumpBlock, - jumpHero: maps.prototype.jumpHero, + jumpHero: events.prototype.jumpHero, moveBlock: maps.prototype.moveBlock, drawAnimate: maps.prototype.drawAnimate, drawHeroAnimate: maps.prototype.drawHeroAnimate, @@ -4035,7 +4035,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; function instantMove(fromX, fromY, aimX, aimY, keep, callback) { - const [block, blockInfo] = _getAndRemoveBlock(fromX, fromY); + const [block, blockInfo] = core.maps._getAndRemoveBlock(fromX, fromY); if (keep) { core.setBlock(blockInfo.number, aimX, aimY); core.showBlock(aimX, aimY); @@ -4050,7 +4050,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return true; } core.maps.jumpBlock = perform.jumpBlock; - core.maps.jumpHero = perform.jumpHero; + core.events.jumpHero = perform.jumpHero; core.maps.moveBlock = perform.moveBlock; core.maps.drawAnimate = perform.drawAnimate; core.maps.drawHeroAnimate = perform.drawHeroAnimate; @@ -4060,7 +4060,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = function skipTextOff() { core.maps.jumpBlock = perform.jumpBlock; - core.maps.jumpHero = perform.jumpHero; + core.events.jumpHero = perform.jumpHero; core.maps.moveBlock = perform.moveBlock; core.maps.drawAnimate = perform.drawAnimate; 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) { 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('y', ey); core.clearMap('hero'); @@ -4095,7 +4098,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return -1; } - core.events.vibrate = function () { + core.events.vibrate = function (direction, time, speed, power, callback) { if (callback) callback(); return; } @@ -4707,7 +4710,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = class SettingButton extends ButtonBase { /** - * @param {unknown[]} eventArgs + * @param {string[]} [eventArgs] */ constructor(x, y, w, h, name, eventArgs) { super(x, y, w, h); diff --git a/runtime.d.ts b/runtime.d.ts index 3414ec96..7422ed33 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -843,7 +843,7 @@ interface control { * 需要接受一个action参数,代表录像回放时的下一个操作 * func返回true代表成功处理了此录像行为,false代表没有处理此录像行为。 */ - registerReplayAction(name: string, func: (action?: string) => boolean): void + registerReplayAction(name: string, func: ((action: string) => boolean) | (() => boolean)): void /** 注销一个录像行为 */ unregisterReplayAction(name: string): void @@ -976,6 +976,7 @@ interface events { _startGame_setHard(): void _eventMoveHero_moving(step: number, moveSteps: [direction | 'forward' | 'backward' | 'leftup' | 'leftdown' | 'rightup' | 'rightdown', number][]): boolean + __action_checkReplaying(): boolean /** * 开始新游戏 @@ -1644,6 +1645,7 @@ interface enemys { /** @file maps.js负责一切和地图相关的处理内容 */ interface maps { _loadFloor_doNotCopy(): string[] + _getAndRemoveBlock(x: number, y: number): [Block, any] /** * 获取初始core.maps.blockInfo的一个拷贝 @@ -2491,6 +2493,14 @@ interface ui { */ 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 @@ -2522,7 +2532,7 @@ interface ui { left?: number top?: number maxWidth?: number - color?: number + color?: number | string align?: 'left' | 'center' | 'right' fontSize: number lineHeight?: number