pastime/js/plugins/MouseInvalidate.js
2026-03-15 16:45:22 -05:00

67 lines
2.5 KiB
JavaScript
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*=============================================================================
MouseInvalidate.js
----------------------------------------------------------------------------
(C)2022 Triacontane
This software is released under the MIT License.
http://opensource.org/licenses/mit-license.php
----------------------------------------------------------------------------
Version
1.1.0 2025/06/16 指定したスイッチがONの時のみマウスやタッチ操作を無効化する機能を追加
1.0.0 2022/07/07 初版
----------------------------------------------------------------------------
[X] : https://x.com/triacontane/
[GitHub] : https://github.com/triacontane/
=============================================================================*/
/*:
* @plugindesc タッチ操作無効化プラグイン
* @target MZ
* @url https://github.com/triacontane/RPGMakerMV/tree/mz_master/MouseInvalidate.js
* @base PluginCommonBase
* @orderAfter PluginCommonBase
* @author トリアコンタン
*
* @param switchId
* @text 無効化スイッチID
* @desc 指定した場合、スイッチがONの時のみマウスやタッチ操作を無効化します。
* @default 0
* @type switch
*
* @help MouseInvalidate.js
* 
* ゲーム中の全ての局面でマウスやタッチ操作を完全に無効化します。
*
* このプラグインの利用にはベースプラグイン『PluginCommonBase.js』が必要です。
* 『PluginCommonBase.js』は、RPGツクールMZのインストールフォルダ配下の
* 以下のフォルダに格納されています。
* dlc/BasicResources/plugins/official
*
* 利用規約:
* 作者に無断で改変、再配布が可能で、利用形態商用、18禁利用等
* についても制限はありません。
* このプラグインはもうあなたのものです。
*/
(()=> {
'use strict';
const script = document.currentScript;
const param = PluginManagerEx.createParameter(script);
const switchId = param.switchId;
const _TouchInput_update = TouchInput.update;
TouchInput.update = function() {
if (this.isTouchInvalid()) {
if (this._wasValid) {
this.clear();
this._wasValid = false;
}
return;
}
this._wasValid = true;
_TouchInput_update.apply(this, arguments);
};
TouchInput.isTouchInvalid = function() {
return !switchId || $gameSwitches?.value(switchId);
};
})();