fix: bugs & deprecate

This commit is contained in:
unanmed 2024-03-02 10:30:36 +08:00
parent ba4a52e4ab
commit de64c8e2bd
7 changed files with 45 additions and 9 deletions

View File

@ -400,10 +400,9 @@
<select id="selectFloor" style="margin-bottom: 5px;"></select> <select id="selectFloor" style="margin-bottom: 5px;"></select>
<input type="button" value="选层" id='selectFloorBtn' /> <input type="button" value="选层" id='selectFloorBtn' />
<input type="button" value="保存地图" id='saveFloor' /> <input type="button" value="保存地图" id='saveFloor' />
<input type="button" value="后退" id="undoFloor" style="display: none;" /> <input type="button" value="后退" id="undoFloor" />
<input type="button" style="display: none;" value="帮助文档" id="openDoc" /> <input type="button" value="帮助文档" id="openDoc" />
<input type="button" style="display: none;" value="前往游戏" <input type="button" value="前往游戏" onclick="window.open('./index.html', '_blank')" />
onclick="window.open('./index.html', '_blank')" />
</div> </div>
</div> </div>
<div id="mid2"> <div id="mid2">
@ -512,7 +511,7 @@
editor.mode_listen(); editor.mode_listen();
editor.mobile_listen(); editor.mobile_listen();
}); });
//main.listen(); //main.listen();
</script> </script>
<!-- hightlight textarea --> <!-- hightlight textarea -->

View File

@ -1684,7 +1684,9 @@ actions.prototype._clickSL = function (x, y) {
if (x >= this.LAST - 2 && y === core._HEIGHT_ - 1) { if (x >= this.LAST - 2 && y === core._HEIGHT_ - 1) {
core.playSound('取消'); core.playSound('取消');
if (core.events.recoverEvents(core.status.event.interval)) return; if (core.events.recoverEvents(core.status.event.interval)) return;
core.ui.closePanel(); setTimeout(() => {
core.ui.closePanel();
}, 0);
delete core.status.tempRoute; delete core.status.tempRoute;
if (!core.isPlaying()) document.getElementById('start').style.top = '0'; if (!core.isPlaying()) document.getElementById('start').style.top = '0';
return; return;
@ -2345,7 +2347,9 @@ actions.prototype._clickSettings = function (x, y) {
return core.confirmRestart(); return core.confirmRestart();
case 7: case 7:
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); setTimeout(() => {
core.ui.closePanel();
}, 0);
break; break;
} }
} }
@ -2356,7 +2360,9 @@ actions.prototype._clickSettings = function (x, y) {
actions.prototype._keyUpSettings = function (keycode) { actions.prototype._keyUpSettings = function (keycode) {
if (keycode == 27 || keycode == 88) { if (keycode == 27 || keycode == 88) {
core.playSound('取消'); core.playSound('取消');
core.ui.closePanel(); setTimeout(() => {
core.ui.closePanel();
}, 0);
return; return;
} }
this._selectChoices( this._selectChoices(

View File

@ -388,7 +388,7 @@ interface Control {
/** /**
* *
* @param canvasId ts的说法应该只能填数字 * @param canvasId ts的说法应该只能填数字
* *
* @param x * @param x
* @param y * @param y
@ -407,11 +407,13 @@ interface Control {
addGameCanvasTranslate(x: number, y: number): void; addGameCanvasTranslate(x: number, y: number): void;
/** /**
* @deprecated
* *
*/ */
updateViewport(): void; updateViewport(): void;
/** /**
* @deprecated
* *
* @param px * @param px
* @param py * @param py
@ -419,6 +421,7 @@ interface Control {
setViewport(px?: number, py?: number): void; setViewport(px?: number, py?: number): void;
/** /**
* @deprecated
* 西... + setViewport就完事了 * 西... + setViewport就完事了
* @param x * @param x
* @param y * @param y
@ -639,6 +642,7 @@ interface Control {
removeSave(index: number, callback?: () => void): void; removeSave(index: number, callback?: () => void): void;
/** /**
* @deprecated
* *
* @example core.setStatus('loc', {x : 0, y : 0, direction : 'up'}); // 设置主角位置为地图左上角,脸朝上 * @example core.setStatus('loc', {x : 0, y : 0, direction : 'up'}); // 设置主角位置为地图左上角,脸朝上
* @param name * @param name
@ -647,6 +651,7 @@ interface Control {
setStatus<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void; setStatus<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void;
/** /**
* @deprecated
* core.setStatus(name, core.getStatus(name) + value) * core.setStatus(name, core.getStatus(name) + value)
* @example core.addStatus('name', '酱'); // 在主角的名字后加一个“酱”字 * @example core.addStatus('name', '酱'); // 在主角的名字后加一个“酱”字
* @param name * @param name
@ -658,6 +663,7 @@ interface Control {
): void; ): void;
/** /**
* @deprecated
* *
* @example core.getStatus('loc'); // 读取主角的坐标和朝向 * @example core.getStatus('loc'); // 读取主角的坐标和朝向
* @param name * @param name
@ -666,6 +672,7 @@ interface Control {
getStatus<K extends keyof HeroStatus>(name: K): HeroStatus[K]; getStatus<K extends keyof HeroStatus>(name: K): HeroStatus[K];
/** /**
* @deprecated
* status中获得属性 * status中获得属性
* @param status * @param status
* @param name * @param name
@ -676,6 +683,7 @@ interface Control {
): HeroStatus[K]; ): HeroStatus[K];
/** /**
* @deprecated
* *
* @example core.getRealStatus('atk'); // 计算主角的攻击力,包括百分比修正。战斗使用的就是这个值 * @example core.getRealStatus('atk'); // 计算主角的攻击力,包括百分比修正。战斗使用的就是这个值
* @param name * @param name
@ -683,6 +691,7 @@ interface Control {
getRealStatus<K extends keyof NumbericHeroStatus>(name: K): number; getRealStatus<K extends keyof NumbericHeroStatus>(name: K): number;
/** /**
* @deprecated
* status中获得增幅后的属性 * status中获得增幅后的属性
* @param status * @param status
* @param name * @param name
@ -693,6 +702,7 @@ interface Control {
): number; ): number;
/** /**
* @deprecated
* *
* @param name * @param name
*/ */
@ -960,6 +970,7 @@ interface Control {
): void; ): void;
/** /**
* @deprecated
* flags.__bgm__ * flags.__bgm__
* @example core.playBgm('bgm.mp3', 30); // 播放bgm.mp3并跳过前半分钟 * @example core.playBgm('bgm.mp3', 30); // 播放bgm.mp3并跳过前半分钟
* @param bgm * @param bgm
@ -968,26 +979,31 @@ interface Control {
playBgm(bgm: BgmIds | NameMapIn<BgmIds>, startTime?: number): void; playBgm(bgm: BgmIds | NameMapIn<BgmIds>, startTime?: number): void;
/** /**
* @deprecated
* *
*/ */
pauseBgm(): void; pauseBgm(): void;
/** /**
* @deprecated
* *
*/ */
resumeBgm(resumeTime?: number): void; resumeBgm(resumeTime?: number): void;
/** /**
* @deprecated
* *
*/ */
setMusicBtn(): void; setMusicBtn(): void;
/** /**
* @deprecated
* *
*/ */
triggerBgm(): void; triggerBgm(): void;
/** /**
* @deprecated
* *
* @param sound * @param sound
* @param pitch 100 * @param pitch 100
@ -1001,18 +1017,21 @@ interface Control {
): number; ): number;
/** /**
* @deprecated
* *
* @param id * @param id
*/ */
stopSound(id?: number): void; stopSound(id?: number): void;
/** /**
* @deprecated
* id列表 * id列表
* @param name * @param name
*/ */
getPlayingSounds(name?: SoundIds | NameMapIn<SoundIds>): number[]; getPlayingSounds(name?: SoundIds | NameMapIn<SoundIds>): number[];
/** /**
* @deprecated
* bgm状态 * bgm状态
*/ */
checkBgm(): void; checkBgm(): void;

1
src/types/core.d.ts vendored
View File

@ -948,6 +948,7 @@ interface Core extends Pick<Main, CoreDataFromMain> {
readonly animateFrame: AnimateFrame; readonly animateFrame: AnimateFrame;
/** /**
* @deprecated
* *
*/ */
readonly musicStatus: Readonly<MusicStatus>; readonly musicStatus: Readonly<MusicStatus>;

View File

@ -428,6 +428,7 @@ interface Events extends EventData {
): void; ): void;
/** /**
* @deprecated
* *
* @example core.setEnemy('greenSlime', 'def', 0); // 把绿头怪的防御设为0 * @example core.setEnemy('greenSlime', 'def', 0); // 把绿头怪的防御设为0
* @param id id * @param id id
@ -447,6 +448,7 @@ interface Events extends EventData {
): void; ): void;
/** /**
* @deprecated
* *
* @param x * @param x
* @param y * @param y
@ -469,6 +471,7 @@ interface Events extends EventData {
): void; ): void;
/** /**
* @deprecated
* *
* @param x * @param x
* @param y * @param y
@ -483,6 +486,7 @@ interface Events extends EventData {
): void; ): void;
/** /**
* @deprecated
* *
* @param fromX * @param fromX
* @param fromY * @param fromY

View File

@ -1,5 +1,6 @@
interface ActionData { interface ActionData {
/** /**
* @deprecated
* *
* @param keyCode keyCode * @param keyCode keyCode
* @param altKey alt键 * @param altKey alt键

6
src/types/util.d.ts vendored
View File

@ -68,6 +68,7 @@ interface Utils {
decompress(value: string): any; decompress(value: string): any;
/** /**
* @deprecated
* *
* @param key * @param key
* @param value * @param value
@ -75,6 +76,7 @@ interface Utils {
setLocalStorage(key: string, value?: any): void; setLocalStorage(key: string, value?: any): void;
/** /**
* @deprecated
* *
* @param key * @param key
* @param defaultValue * @param defaultValue
@ -82,6 +84,7 @@ interface Utils {
getLocalStorage<T>(key: string, defaultValue?: T): T; getLocalStorage<T>(key: string, defaultValue?: T): T;
/** /**
* @deprecated
* *
* @param key * @param key
*/ */
@ -151,6 +154,7 @@ interface Utils {
): void; ): void;
/** /**
* @deprecated
* 适用于global:xxx * 适用于global:xxx
* @example core.setBlobal('一周目已通关', true); // 设置全局存储“一周目已通关”为true方便二周目游戏中的新要素。 * @example core.setBlobal('一周目已通关', true); // 设置全局存储“一周目已通关”为true方便二周目游戏中的新要素。
* @param key * @param key
@ -159,6 +163,7 @@ interface Utils {
setGlobal(key: string, value?: any): void; setGlobal(key: string, value?: any): void;
/** /**
* @deprecated
* 适用于global:xxx * 适用于global:xxx
* @example if (core.getGlobal('一周目已通关', false) === true) core.getItem('dagger'); // 二周目游戏进行到此处时会获得一把屠龙匕首 * @example if (core.getGlobal('一周目已通关', false) === true) core.getItem('dagger'); // 二周目游戏进行到此处时会获得一把屠龙匕首
* @param key * @param key
@ -334,6 +339,7 @@ interface Utils {
getCookie(name: string): string; getCookie(name: string): string;
/** /**
* @deprecated
* *
* @example * @example
* // 更新状态栏中的主角生命,使用加载画面的宣传色 * // 更新状态栏中的主角生命,使用加载画面的宣传色