71 lines
2.7 KiB
JavaScript
71 lines
2.7 KiB
JavaScript
// Copyright (c) 2017 Tsukimi
|
|
/*:
|
|
* @plugindesc
|
|
* @author Tsukimi
|
|
*
|
|
* @help
|
|
*/
|
|
var Imported = Imported || {};
|
|
(function(_global) {
|
|
var _Game_Timer_onExpire = Game_Timer.prototype.onExpire;
|
|
Game_Timer.prototype.onExpire = function() {
|
|
_Game_Timer_onExpire.call(this);
|
|
var cw = SceneManager._scene._messageWindow._choiceWindow;
|
|
if(!!cw._timeLimit && !!cw._TLStarted) {
|
|
cw._timeLimit = false;
|
|
cw._TLStarted = false;
|
|
cw.updateInputData();
|
|
cw.deactivate();
|
|
cw.callCancelHandler();
|
|
this.stop();
|
|
}
|
|
}
|
|
if(Imported.TKM_ChoiceList) {
|
|
var _Window_TKMChoiceList_oked = Window_TKMChoiceList.prototype.oked;
|
|
Window_TKMChoiceList.prototype.oked = function() {
|
|
_Window_TKMChoiceList_oked.call(this);
|
|
if(!!this._timeLimit) {
|
|
this._timeLimit = false;
|
|
this._TLStarted = false;
|
|
$gameTimer.stop();
|
|
}
|
|
};
|
|
} else {
|
|
var _Window_ChoiceList_callOkHandler = Window_ChoiceList.prototype.callOkHandler;
|
|
Window_ChoiceList.prototype.callOkHandler = function() {
|
|
_Window_ChoiceList_callOkHandler.call(this);
|
|
if(!!this._timeLimit) {
|
|
this._timeLimit = false;
|
|
this._TLStarted = false;
|
|
$gameTimer.stop();
|
|
}
|
|
}
|
|
}
|
|
var _Window_ChoiceList_start = Window_ChoiceList.prototype.start;
|
|
Window_ChoiceList.prototype.start = function() {
|
|
_Window_ChoiceList_start.call(this);
|
|
if(!!this._timeLimit) {
|
|
this._TLStarted = true;
|
|
$gameTimer.start(this._limitedTime || 300);
|
|
}
|
|
}
|
|
var _Window_ChoiceList_isCancelEnabled = Window_ChoiceList.prototype.isCancelEnabled;
|
|
Window_ChoiceList.prototype.isCancelEnabled = function() {
|
|
var normal = _Window_ChoiceList_isCancelEnabled.call(this);
|
|
if(!!this._timeLimit) return false;
|
|
else return normal;
|
|
}
|
|
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
|
Game_Interpreter.prototype.pluginCommand = function(command, args) {
|
|
_Game_Interpreter_pluginCommand.call(this, command, args);
|
|
switch(command) {
|
|
case "TLChoice":
|
|
var cw = SceneManager._scene._messageWindow._choiceWindow;
|
|
cw._timeLimit = true;
|
|
if(!args) cw._limitedTime = 300;
|
|
else if(parseInt(args[0]) == 0) cw._limitedTime = 300;
|
|
else cw._limitedTime = parseInt(args[0]);
|
|
break;
|
|
}
|
|
};
|
|
})(this);
|