直接上代码
首先定义二个变量
var message_auto = false; //是否启用自动跳过
var message_time = 60; //自动跳过计时
每帧开始计时 时间到了自动关闭消息框
const _Window_Message_prototype_update = Window_Message.prototype.update;
Window_Message.prototype.update = function(){
_Window_Message_prototype_update.call(this);
if(!message_auto){
return;
}
if(!this.pause){
return;
}
if(Input.isPressed("up") || Input.isPressed("down") || Input.isPressed("right") || Input.isPressed("left") || TouchInput.isTriggered()){
message_time = 0;
}
message_time = message_time - 1;
if(message_time > 0){
return;
}
this.pause = false;
this.terminateMessage();
};
核心代码如下
this.pause = false; 关闭窗口暂停
this.terminateMessage(); 清除窗口内容 关闭窗口
if(Input.isPressed("up") || Input.isPressed("down") || Input.isPressed("right") || Input.isPressed("left") || TouchInput.isTriggered()){
message_time = 0;
}
判断是否按下了某个键 这样可以快速跳过 适合采集事件 快速提示 快速跳过
定义函数 启用计时
function 启用文本自动(){
message_time = 60;
message_auto = true;
};
为了不冲突 在文本清除这里关闭自动跳过
const _Window_Message_prototype_terminateMessage = Window_Message.prototype.terminateMessage;
Window_Message.prototype.terminateMessage = function() {
_Window_Message_prototype_terminateMessage.call(this);
message_auto = false;
message_time = 60;
};
结尾总结
请Project1论坛的小圈子 离开