45 lines
No EOL
1.5 KiB
JavaScript
45 lines
No EOL
1.5 KiB
JavaScript
/*:
|
||
* @plugindesc 指定スイッチがONの間、キャンセルキー(Esc/Bボタン/右クリック)を無効化します。
|
||
* @author みるきーうぇい
|
||
* @target MV
|
||
* @url
|
||
*
|
||
* @param Switch ID
|
||
* @type switch
|
||
* @desc このスイッチがONの間、キャンセルキーが無効化されます。
|
||
* @default 1
|
||
*
|
||
*/
|
||
|
||
(function() {
|
||
const parameters = PluginManager.parameters('MW_DisableCancel');
|
||
const switchId = Number(parameters['Switch ID'] || 1);
|
||
|
||
// Scene_Equipに入ったときスイッチON
|
||
const _Scene_Equip_start = Scene_Equip.prototype.start;
|
||
Scene_Equip.prototype.start = function() {
|
||
_Scene_Equip_start.call(this);
|
||
if ($gameSwitches) {
|
||
if(!$gameSwitches.value(162)){
|
||
$gameSwitches.setValue(switchId, true);
|
||
}
|
||
}
|
||
};
|
||
|
||
const _SceneManager_updateInputData = SceneManager.updateInputData;
|
||
SceneManager.updateInputData = function() {
|
||
if ($gameSwitches && $gameSwitches.value && !$gameSwitches.value(switchId)) {
|
||
_SceneManager_updateInputData.call(this);
|
||
} else {
|
||
Input.update();
|
||
TouchInput.update();
|
||
// キャンセル入力を強制的に無効化
|
||
if (Input.isTriggered('cancel') || Input.isPressed('cancel')) {
|
||
Input.clear();
|
||
}
|
||
if (TouchInput.isCancelled()) {
|
||
TouchInput.clear();
|
||
}
|
||
}
|
||
};
|
||
})(); |