alter-egoism/js/plugins/del_CBR_commonDisp.js
2025-11-01 14:17:42 -05:00

89 lines
2.6 KiB
JavaScript

/*:ja
* @plugindesc コモンイベントID表示
* @author COBRA
*
* @help
* 画面上に現在実行中のコモンイベントのIDを表示する
*/
var hai = [];
(function () {
const _Game_Interpreter_executeCommand = Game_Interpreter.prototype.executeCommand;
Game_Interpreter.prototype.executeCommand = function () {
const command = this.currentCommand();
if (command) {
if (command.code === 117) {
hai.push($dataCommonEvents[command.parameters[0]].name);
} else if (command.code === 0 || command.code === 115) {
hai.pop();
}
}
return _Game_Interpreter_executeCommand.call(this);
};
//表示関連
const _Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
Scene_Map.prototype.createAllWindows = function () {
_Scene_Map_createAllWindows.apply(this, arguments);
this._exVariableWindow1 = new Window_ExVariableWindow();
this.addWindow(this._exVariableWindow1);
};
const _Scene_Map_callMenu = Scene_Map.prototype.callMenu;
Scene_Map.prototype.callMenu = function () {
_Scene_Map_callMenu.apply(this, arguments);
this._exVariableWindow1.hide();
};
const _Scene_Map_terminate = Scene_Map.prototype.terminate;
Scene_Map.prototype.terminate = function () {
_Scene_Map_terminate.apply(this, arguments);
if (!SceneManager.isNextScene(Scene_Battle)) {
this._exVariableWindow1.hide();
}
};
const _Scene_Map_stop = Scene_Map.prototype.stop;
Scene_Map.prototype.stop = function () {
this._exVariableWindow1.hide();
_Scene_Map_stop.apply(this, arguments);
};
//ウィンドウ
function Window_ExVariableWindow() {
this.initialize(...arguments);
}
Window_ExVariableWindow.prototype = Object.create(Window_Base.prototype);
Window_ExVariableWindow.prototype.constructor = Window_ExVariableWindow;
Window_ExVariableWindow.prototype.initialize = function () {
const rect = new Rectangle(0, 0, Graphics.boxWidth, Graphics.boxHeight);
Window_Base.prototype.initialize.call(this, rect);
};
Window_ExVariableWindow.prototype.update = function () {
Window_Base.prototype.update.call(this);
this.refresh();
};
Window_ExVariableWindow.prototype.labelWidth = function () {
return 200;
};
Window_ExVariableWindow.prototype.refresh = function () {
if (hai[hai.length - 1]) {
this.width = 300;
this.height = 70;
this.x = 0;
this.y = 0;
this.contents.clear();
this.resetTextColor();
this.drawText(hai[hai.length - 1], this.itemPadding(), 0, this.innerWidth);
} else {
this.width = 0;
this.height = 0;
}
};
})();