80 lines
2.1 KiB
JavaScript
80 lines
2.1 KiB
JavaScript
/*:
|
|
* @target MZ
|
|
* @plugindesc クイックセーブ機能を実装します
|
|
* @author kn
|
|
*
|
|
* @help KN_QuickSave.js
|
|
* メニューのセーブ・ロードを即時クイックセーブ/ロードに置き換えます。
|
|
* 1つのセーブファイルを使用します。
|
|
*
|
|
* @command SUSPEND
|
|
*
|
|
* @command QUICK_SAVE
|
|
*
|
|
* @command QUICK_LOAD
|
|
*
|
|
*/
|
|
|
|
(() => {
|
|
"use strict";
|
|
const script = document.currentScript;
|
|
const param = PluginManagerEx.createParameter(script);
|
|
|
|
PluginManagerEx.registerCommand(script, "SUSPEND", args => {
|
|
console.log("suspend...");
|
|
SceneManager.push(Scene_QuickSave);
|
|
});
|
|
|
|
PluginManagerEx.registerCommand(script, "QUICK_SAVE", args => {
|
|
console.log("save...");
|
|
$gameSystem.onBeforeSave();
|
|
DataManager.saveGame(1)
|
|
.then(() => console.log("Success"))
|
|
.catch(() => console.warn("Failure"));
|
|
});
|
|
|
|
PluginManagerEx.registerCommand(script, "QUICK_LOAD", args => {
|
|
console.log("load...");
|
|
SceneManager.goto(Scene_QuickLoad);
|
|
});
|
|
|
|
// クイックセーブ
|
|
class Scene_QuickSave extends Scene_Save {
|
|
savefileId() {
|
|
return 1;
|
|
}
|
|
create() {
|
|
super.create();
|
|
this._listWindow.visible = false;
|
|
this._helpWindow.visible = false;
|
|
}
|
|
start() {
|
|
super.start();
|
|
this.onSavefileOk();
|
|
}
|
|
onSaveSuccess() {
|
|
SoundManager.playSave();
|
|
this.fadeOutAll();
|
|
SceneManager.goto(Scene_Title);
|
|
};
|
|
}
|
|
|
|
// クイックロード
|
|
// ロード後にフェードインされないバグあるので注意
|
|
class Scene_QuickLoad extends Scene_Load {
|
|
savefileId() {
|
|
return 1;
|
|
}
|
|
create() {
|
|
super.create();
|
|
this._listWindow.visible = false;
|
|
this._helpWindow.visible = false;
|
|
}
|
|
start() {
|
|
super.start();
|
|
this.onSavefileOk();
|
|
}
|
|
}
|
|
window.Scene_QuickLoad = Scene_QuickLoad;
|
|
|
|
})();
|