56 lines
No EOL
1.7 KiB
JavaScript
56 lines
No EOL
1.7 KiB
JavaScript
//=============================================================================
|
||
// SZ_KeyWait
|
||
//=============================================================================
|
||
/*:
|
||
* @plugindesc キーの入力を待機できるようにするプラグイン
|
||
* @author suzu
|
||
*
|
||
* @help
|
||
* e.g. this.setWaitMode('key_ok');
|
||
*/
|
||
|
||
//20221114 timer変数追記(あまり要らない)クリックでも反応するように41・42行目を追加 24行目の条件を追記 銀河
|
||
|
||
(function(){
|
||
var _Game_Interpreter_updateWaitMode = Game_Interpreter.prototype.updateWaitMode;
|
||
var timer = 6;
|
||
Game_Interpreter.prototype.updateWaitMode = function(){
|
||
if(this.isWaitKey()){
|
||
if(this.isWaitKeyTransition()){
|
||
this.setWaitMode('');
|
||
return true;
|
||
}
|
||
var waiting = this.waitKey(this._waitMode.slice(4));
|
||
if(Input.isPressed('ok') || Input.isPressed('cancel') || TouchInput.isPressed()){
|
||
this.wait(timer/2)
|
||
}else if(Input.isPressed('control')){
|
||
this.wait(timer/3)
|
||
}else{
|
||
this.wait(timer);
|
||
}
|
||
if (!waiting) {
|
||
this.setWaitMode('key__');
|
||
return true;
|
||
}
|
||
return waiting;
|
||
}else{
|
||
timer = 6;
|
||
}
|
||
return _Game_Interpreter_updateWaitMode.call(this);
|
||
}
|
||
Game_Interpreter.prototype.waitKey = function(key){
|
||
var result = !key ? !Input.isPressed('ok') : !Input.isPressed(key);
|
||
if(result){result = !Input.isPressed('cancel')}
|
||
if(result){result = !Input.isPressed('control')}
|
||
if(result){result = !TouchInput.isPressed()}
|
||
return result;
|
||
}
|
||
|
||
Game_Interpreter.prototype.isWaitKey = function(){
|
||
return this._waitMode.indexOf('key_') >= 0;
|
||
}
|
||
|
||
Game_Interpreter.prototype.isWaitKeyTransition = function(){
|
||
return this._waitMode === 'key__'
|
||
}
|
||
})(); |