快进剧情

This commit is contained in:
草莓 2024-12-12 18:49:01 +08:00
parent cfaf64aa63
commit 68da490685
2 changed files with 156 additions and 7 deletions

File diff suppressed because one or more lines are too long

View File

@ -2830,8 +2830,112 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
return;
}
actions.prototype._sys_keyDownCtrl = function () {
if (core.status.event.id == 'text') {
core.drawText();
return true;
}
if (core.status.event.id == 'action' && (core.status.event.data.type == 'text' || core.status.event.data.type == 'cgtext')) {
let time = 0
core.registerAnimationFrame("ctrlDown", true, (timestamp) => {
if (timestamp > time + 100) {
time = timestamp
if (core.status.event.id == 'action' && (core.status.event.data.type == 'text' || core.status.event.data.type == 'cgtext')) {
main.dom.cgText.style.display = "none"
core.doAction()
}
}
})
return true;
}
if (core.status.event.id == 'action' && core.status.event.data.type == 'sleep' &&
!core.status.event.data.current.noSkip) {
if (core.timeout.sleepTimeout && !core.hasAsync()) {
clearTimeout(core.timeout.sleepTimeout);
core.timeout.sleepTimeout = null;
core.doAction();
}
return true;
}
}
actions.prototype.keyDownCtrl = function () {
this.doRegisteredAction('keyDownCtrl');
}
core.registerAction('keyDownCtrl', '_sys_keyDownCtrl', core.actions._sys_keyDownCtrl, 0);
actions.prototype._keyUpAction = function (keycode) {
if (keycode == 17) {
core.unregisterAnimationFrame("ctrlDown")
return
}
if (core.status.event.data.type == 'text' && (keycode == 13 || keycode == 32 || keycode == 67)) {
return this._clickAction_text();
}
if (core.status.event.data.type == 'wait') {
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
core.setFlag('type', 0);
core.setFlag('keycode', keycode);
core.setFlag('timeout', timeout);
var executed = core.events.__action_wait_afterGet(core.status.event.data.current);
if (executed || !core.status.event.data.current.forceChild) {
core.status.route.push("input:" + (1e8 * timeout + keycode));
clearTimeout(core.status.event.interval);
delete core.status.event.timeout;
core.doAction();
}
return;
}
if (core.status.event.data.type == 'choices') {
var data = core.status.event.data.current;
var choices = data.choices;
if (choices.length > 0) {
this._selectChoices(choices.length, keycode, this._clickAction);
}
return;
}
if (core.status.event.data.type == 'confirm' && (keycode == 13 || keycode == 32 || keycode == 67)) {
var timeout = Math.max(0, core.status.event.timeout - new Date().getTime()) || 0;
delete core.status.event.timeout;
core.setFlag('timeout', timeout);
core.status.route.push("choices:" + (100 * timeout + core.status.event.selection));
if (core.status.event.selection == 0)
core.insertAction(core.status.event.ui.yes);
else core.insertAction(core.status.event.ui.no);
core.doAction();
return;
}
}
////// 执行当前自定义事件列表中的下一个事件 //////
events.prototype.doAction = function () {
// 清空boxAnimate和UI层
clearInterval(core.status.event.interval);
clearTimeout(core.status.event.interval);
clearInterval(core.status.event.animateUI);
core.status.event.interval = null;
delete core.status.event.aniamteUI;
if (core.status.gameOver || core.status.replay.failed) return;
// 判定是否执行完毕
if (this._doAction_finishEvents()) return;
core.clearUI();
var floorId = core.status.event.data.floorId || core.status.floorId;
// 当前点坐标和前缀
var x = core.status.event.data.x,
y = core.status.event.data.y;
var prefix = [floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
var current = core.status.event.data.list[0];
if (this._popEvents(current, prefix)) return;
// 当前要执行的事件
var data = current.todo.shift();
core.status.event.data.current = data;
if (typeof data == "string")
data = { "type": "text", "text": data };
// 该事件块已经被禁用
if (data._disabled) return core.doAction();
if (data.type !== 'cgtext') core.unregisterAnimationFrame("skip")
data.floorId = data.floorId || floorId;
core.status.event.data.type = data.type;
this.doEvent(data, x, y, prefix);
return;
}
},
"额外信息": function () {
/*
@ -9561,10 +9665,16 @@ core.plugin.animate = {
const ctx = cg.getContext("2d");
main.dom.cgText = cg;
cg.onclick = function (e) {
cg.onmouseup = function (e) {
try {
e.preventDefault();
core.unregisterAnimationFrame("skip")
} catch (ee) {
console.error(ee);
}
};
cg.onmousedown = function (e) {
try {
if (!core.isPlaying()) return false;
const left = core.dom.gameGroup.offsetLeft;
const top = core.dom.gameGroup.offsetTop;
@ -9575,6 +9685,28 @@ core.plugin.animate = {
main.log(ee);
}
}
cg.ontouchend = function (e) {
try {
if (!core.isPlaying()) return false;
core.unregisterAnimationFrame("skip")
} catch (ee) {
console.error(ee);
}
};
cg.ontouchstart = function (e) {
try {
if (!core.isPlaying()) return false;
const left = core.dom.gameGroup.offsetLeft;
const top = core.dom.gameGroup.offsetTop;
const px = Math.floor((e.targetTouches[0].clientX - left) / core.domStyle.scale),
py = Math.floor((e.targetTouches[0].clientY - top) / core.domStyle.scale);
core.ui.cgText.click(px * 3, py * 3);
} catch (ee) {
main.log(ee);
}
}
class cgText {
constructor() {
this.image = ""
@ -9602,7 +9734,20 @@ core.plugin.animate = {
const pos = [px, py];
const savebox = makeBox([1700, 1100], [192, 96]);
const saveboxVertical = makeBox([52, 1700], [96, 192])
if ((core.domStyle.isVertical && inRect(pos, saveboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, savebox))) {
const skipbox = makeBox([1400, 1100], [192, 96]);
const skipboxVertical = makeBox([52, 1400], [96, 192])
if ((core.domStyle.isVertical && inRect(pos, skipboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, skipbox))) {
let time = 0
core.registerAnimationFrame("skip", true, (timestamp) => {
if (timestamp > time + 100) {
time = timestamp
if (core.status.event.id == 'action' && core.status.event.data.type == 'cgtext') {
main.dom.cgText.style.display = "none"
core.doAction()
}
}
})
} else if ((core.domStyle.isVertical && inRect(pos, saveboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, savebox))) {
if (core.status.event.animateUI) return;
if (core.status.event.interval != null) return;
const current = core.clone(core.status.event.data.current)
@ -9636,6 +9781,8 @@ core.plugin.animate = {
}
}
drawTextContent(ctx, content, config) {
ctx = core.getContextByName(ctx);
@ -9777,6 +9924,8 @@ core.plugin.animate = {
if (core.isPlaying() && !this.WindowSkin) {
core.drawWindowSkin("winskin.png", ctx, 1700, 1100, 192, 96)
core.fillText(ctx, '存 档', 1736, 1166, '#FFFFFF', "bold 48px Verdana")
core.drawWindowSkin("winskin.png", ctx, 1400, 1100, 192, 96)
core.fillText(ctx, '▶▶', 1456, 1166, '#FFFFFF', "bold 48px Verdana")
}
if (this.name) core.fillText(ctx, `${this.name}`, 500, 880, '#FFFFFF', "bold 48px Verdana")
if (this.text) {