手册完成,但性能略差,考虑webgl

This commit is contained in:
strawberry 2025-08-20 16:48:34 +08:00
parent 5a44ba3f28
commit 44ce844d2f

View File

@ -3821,7 +3821,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.isMoving()
)
return;
core.useItem("fly");
core.useFly(true);
return;
}
/*const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3])
@ -3839,7 +3839,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.isMoving()
)
return;
core.useItem("fly");
core.useFly(true);
return;
}
/*
@ -4001,37 +4001,38 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
x,
y,
floorId,
config={}
config = {}
) {
var mon_hp = info.mon_hp,
hero_atk = config.atk??core.status.hero.atk,
hero_atk = config.atk ?? core.status.hero.atk,
mon_def = info.mon_def,
pre = info.damage;
damage=info.damage
pre = info.mon_turn;
var list = [];
var start_atk = hero_atk;
if (info.__over__) {
start_atk += info.__overAtk__;
list.push([info.__overAtk__, -info.damage]);
}
var start=core.clone(config)
var mid=core.clone(config)
var end=core.clone(config)
var start = core.clone(config)
var mid = core.clone(config)
var end = core.clone(config)
var calNext = function (currAtk, maxAtk) {
start.atk = Math.floor(currAtk)
end.atk = Math.floor(maxAtk);
start.atk = Math.floor(currAtk)
end.atk = Math.floor(maxAtk);
if (start.atk > end.atk) return null;
while (start.atk < end.atk) {
mid.atk = Math.floor((start.atk + end.atk) / 2);
mid.atk = Math.floor((start.atk + end.atk) / 2);
if (mid.atk - start.atk > end.atk - mid.atk) mid.atk--;
var nextInfo = core.enemys.getDamageInfo(
enemy, mid ,
enemy, mid,
x,
y,
floorId
);
if (nextInfo == null || typeof nextInfo == "number") return null;
if (pre > nextInfo.damage) end.atk = mid.atk;
if (pre > nextInfo.mon_turn&&damage>nextInfo.damage) end.atk = mid.atk;
else start.atk = mid.atk + 1;
}
var nextInfo = core.enemys.getDamageInfo(
@ -4042,16 +4043,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
);
return nextInfo == null ||
typeof nextInfo == "number" ||
nextInfo.damage >= pre ?
null : [start.atk, nextInfo.damage];
nextInfo.mon_turn >= pre ||nextInfo.damage>=damage?
null : [start.atk, nextInfo.damage, nextInfo.mon_turn];
};
var currAtk = start_atk;
while (true) {
var next = calNext(currAtk + 1, Number.MAX_SAFE_INTEGER, pre);
var next = calNext(currAtk + 1, Number.MAX_SAFE_INTEGER,damage, pre);
if (next == null) break;
currAtk = next[0];
pre = next[1];
list.push([currAtk - hero_atk, info.damage - pre]);
damage=next[1];
pre = next[2];
list.push([currAtk - hero_atk, info.damage - damage]);
if (pre <= 0 && !core.flags.enableNegativeDamage) break;
if (list.length >= number) break;
}
@ -4155,7 +4157,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.fillStyle = style;
ctx.fillText(text, x, y);
}
events.prototype.battle = function (id, x, y, force, callback) {
core.saveAndStopAutomaticRoute();
id = id || core.getBlockId(x, y);
@ -4333,10 +4335,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.fillText('data', tip.text, tip.textX, 33 + 42 * k, '#FFFFFF');
core.setAlpha('data', 1);
}
let time=0
let time = 0
control.prototype._animateFrame_tip = function (timestamp) {
let delta
core.animateFrame.tip??=[]
core.animateFrame.tip ??= []
if (core.animateFrame.tip.length === 0) return;
if (timestamp - time <= 30) return;
@ -4395,7 +4397,7 @@ let time=0
}
}
core.animateFrame.tip.push(one)
if(core.animateFrame.tip.length>4)core.animateFrame.tip.shift()
if (core.animateFrame.tip.length > 4) core.animateFrame.tip.shift()
}
},
"额外信息": function () {
@ -21840,7 +21842,8 @@ let time=0
var mon_hp = info.mon_hp,
hero_speed = config.speed ?? core.status.hero.speed,
mon_def = info.mon_def,
pre = info.damage;
damage = info.damage
pre = info.mon_turn;
var list = [];
var start_speed = hero_speed;
var start = core.clone(config)
@ -21856,19 +21859,20 @@ let time=0
if (mid.speed - start.speed > end.speed - mid.speed) mid.speed--;
var nextInfo = core.enemys.getDamageInfo(enemy, mid, x, y, floorId);
if (nextInfo == null || (typeof nextInfo == 'number')) return null;
if (pre > nextInfo.damage) end.speed = mid.speed;
if (pre > nextInfo.mon_turn && damage > nextInfo.damage) end.speed = mid.speed;
else start.speed = mid.speed + 1;
}
var nextInfo = core.enemys.getDamageInfo(enemy, start, x, y, floorId);
return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.damage >= pre ? null : [start.speed, nextInfo.damage];
return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.mon_turn >= pre || nextInfo.damage >= damage ? null : [start.speed, nextInfo.damage, nextInfo.mon_turn];
}
var currSpeed = start_speed;
while (true) {
var next = calNext(currSpeed + 1, Number.MAX_SAFE_INTEGER, pre);
var next = calNext(currSpeed + 1, Number.MAX_SAFE_INTEGER, damage, pre);
if (next == null) break;
currSpeed = next[0];
pre = next[1];
list.push([currSpeed - hero_speed, info.damage - pre]);
damage = next[1]
pre = next[2];
list.push([currSpeed - hero_speed, info.damage - damage]);
if (pre <= 0 && !core.flags.enableNegativeDamage) break;
if (list.length >= number) break;
}
@ -21880,7 +21884,7 @@ let time=0
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
number = number || 1;
var info = core.getDamageInfo(enemy, null, x, y, floorId);
var info = core.getDamageInfo(enemy, config, x, y, floorId);
if (info == null) { // 如果未破防...
return [
['?', '?']
@ -21898,8 +21902,8 @@ let time=0
var mon_hp = info.mon_hp,
hero_spell = config.spell ?? core.status.hero.spell,
mon_def = info.mon_def,
turn = info.mon_turn,
pre = info.damage;
pre = info.mon_turn,
damage = info.damage;
var list = [];
var start_spell = hero_spell;
var start = core.clone(config)
@ -21915,19 +21919,20 @@ let time=0
if (mid.spell - start.spell > end.spell - mid.spell) mid.spell--;
var nextInfo = core.enemys.getDamageInfo(enemy, mid, x, y, floorId);
if (nextInfo == null || (typeof nextInfo == 'number')) return null;
if (turn > nextInfo.mon_turn) end.spell = mid.spell;
if (pre >= nextInfo.mon_turn & damage > nextInfo.damage) end.spell = mid.spell;
else start.spell = mid.spell + 1;
}
var nextInfo = core.enemys.getDamageInfo(enemy, start, x, y, floorId);
return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.mon_turn >= turn ? null : [start.spell, nextInfo.damage];
return nextInfo == null || (typeof nextInfo == 'number') || (nextInfo.mon_turn >= pre || nextInfo.damage >= damage) ? null : [start.spell, nextInfo.damage, nextInfo.mon_turn];
}
var currSpell = start_spell;
while (true) {
var next = calNext(currSpell + 1, Number.MAX_SAFE_INTEGER, pre, turn);
var next = calNext(currSpell + 1, Number.MAX_SAFE_INTEGER, damage, pre);
if (next == null) break;
currSpell = next[0];
pre = next[1];
list.push([currSpell - hero_spell, info.damage - pre]);
pre = next[2];
damage = next[1];
list.push([currSpell - hero_spell, info.damage - damag]);
if (pre <= 0 && !core.flags.enableNegativeDamage) break;
if (list.length >= number) break;
}
@ -22066,31 +22071,31 @@ let time=0
core.fillText(this.left, "无恶意目标", 150, 214, '#999999', core.ui._buildFont(34, true));
core.fillText(this.right, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true));
}
drawBoxAnimate(ctx, dir) {
const blockInfo = core.getBlockInfo(this.enemys[this.page + dir].id)
drawBoxAnimate(ctx, page, x, y) {
const blockInfo = core.getBlockInfo(this.enemys[page].id)
if (blockInfo.bigImage) {
core.status.boxAnimateObjs.push({
bigImage: blockInfo.bigImage,
face: blockInfo.face,
centerX: 150,
centerY: 50,
centerX: x ?? 150,
centerY: y ?? 50,
max_width: 60,
ctx: ctx,
nobackground: true
});
} else if (blockInfo.height >= 48) {
var originEnemy = core.material.enemys[this.enemys[this.page + dir]] || {};
var originEnemy = core.material.enemys[this.enemys[page]] || {};
if (originEnemy.is32x32 == null) {
originEnemy.is32x32 = core.ui._drawBook_is32x32(blockInfo);
}
if (originEnemy.is32x32) {
core.status.boxAnimateObjs.push({
'bgx': 134,
'bgy': 34,
'bgx': x ? x - 16 : 134,
'bgy': y ? y - 16 : 34,
'bgWidth': 32,
'bgHeight': 32,
'x': 134,
'y': 34,
'x': x ? x - 16 : 134,
'y': y ? y - 16 : 34,
'height': 32,
'animate': blockInfo.animate,
'image': blockInfo.image,
@ -22101,12 +22106,12 @@ let time=0
} else {
var drawWidth = 32 * 32 / blockInfo.height;
core.status.boxAnimateObjs.push({
'bgx': 134,
'bgy': 34,
'bgx': x ? x - 16 : 134,
'bgy': y ? y - 16 : 34,
'bgWidth': 32,
'bgHeight': 48,
'x': 134,
'y': 34,
'x': x ? x - 16 : 134,
'y': y ? y - 16 : 34,
'dw': 32,
'dh': 48,
'height': blockInfo.height,
@ -22119,12 +22124,12 @@ let time=0
}
} else {
core.status.boxAnimateObjs.push({
'bgx': 134,
'bgy': 34,
'bgx': x ? x - 16 : 134,
'bgy': y ? y - 16 : 34,
'bgWidth': 32,
'bgHeight': 32,
'x': 134,
'y': 34,
'x': x ? x - 16 : 134,
'y': y ? y - 16 : 34,
'height': 32,
'animate': blockInfo.animate,
'image': blockInfo.image,
@ -22136,9 +22141,9 @@ let time=0
}
drawTempLeft(dir) {
drawTempLeft(page) {
core.clearMap(this.tempLeft)
const enemy = this.enemys[this.page + dir]
const enemy = this.enemys[page]
core.setTextAlign(this.tempLeft, 'center')
core.fillText(this.tempLeft, enemy.name, 150, 120, "#000000", core.ui._buildFont(20, true))
core.fillText(this.tempLeft, "基础属性", 150, 150, "#000000", core.ui._buildFont(14, true))
@ -22170,11 +22175,40 @@ let time=0
lineHeight: 20,
color: "#000000"
});
if (this.enemys.length <= 8) {
for (let i = 0; i < this.enemys.length; i++) {
this.drawBoxAnimate(this.tempLeft, i, 167 - (this.enemys.length / 2 - i) * 34, 370)
}
core.strokeRect(this.tempLeft, 150 - (this.enemys.length / 2 - page) * 34 + 1, 354, 32, 32, "#FFFF00", 2)
} else {
this.tempLeft.beginPath()
this.tempLeft.moveTo(63, 354)
this.tempLeft.lineTo(29, 370)
this.tempLeft.lineTo(63, 386)
this.tempLeft.closePath()
this.tempLeft.fillStyle = page < 3 ? "#999999" : "#000000"
this.tempLeft.fill()
this.tempLeft.beginPath()
this.tempLeft.moveTo(237, 353)
this.tempLeft.lineTo(271, 370)
this.tempLeft.lineTo(237, 386)
this.tempLeft.closePath()
this.tempLeft.fillStyle = page > this.enemys.length - 4 ? "#999999" : "#000000"
this.tempLeft.fill()
this.drawBoxAnimate(this.tempLeft, core.clamp(page - 2, 0, this.enemys.length - 5), 80, 370)
this.drawBoxAnimate(this.tempLeft, core.clamp(page - 1, 1, this.enemys.length - 4), 114, 370)
this.drawBoxAnimate(this.tempLeft, core.clamp(page, 2, this.enemys.length - 3), 148, 370)
this.drawBoxAnimate(this.tempLeft, core.clamp(page + 1, 3, this.enemys.length - 2), 182, 370)
this.drawBoxAnimate(this.tempLeft, core.clamp(page + 2, 4, this.enemys.length - 1), 216, 370)
if (page < 2) core.strokeRect(this.tempLeft, 64 + 34 * page, 354, 32, 32, "#FFFF00", 2)
else if (page > this.enemys.length - 3) core.strokeRect(this.tempLeft, 234 - (this.enemys.length - page) * 34, 354, 32, 32, "#FFFF00", 2)
else core.strokeRect(this.tempLeft, 132, 354, 32, 32, "#FFFF00", 2)
}
this.drawBoxAnimate(bookInfo.tempLeft, page)
}
drawTempRight(dir) {
drawTempRight(page) {
core.clearMap(this.tempRight)
const enemy = this.enemys[this.page]
const enemy = this.enemys[page]
core.maps.drawThumbnail(this.floorId, null, { ctx: this.tempRight, size: 0.4, x: 10, y: 220, noEnabled: true })
enemy.locs.forEach(v => {
this.tempRight.beginPath()
@ -22191,8 +22225,9 @@ let time=0
core.fillText(this.tempRight, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true))
let color = "#FFFF00",
damage = enemy.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
if (damage == '???' || damage == null) {
damage = '杂鱼喵❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
@ -22201,7 +22236,9 @@ let time=0
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.tempRight, damage, 230, 50, color, core.ui._buildFont(12, true))
core.setTextAlign(this.tempRight, 'center');
core.fillText(this.tempRight, damage, 240, 50, color, core.ui._buildFont(12, true))
core.setTextAlign(this.tempRight, 'left');
core.fillText(this.tempRight, "攻击临界 " + enemy.criticalAtk[0], 30, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "速度临界 " + enemy.criticalSpeed[0], 120, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, '法强临界 ' + enemy.criticalSpell[0], 210, 70, "#000000", core.ui._buildFont(12, true))
@ -22219,9 +22256,9 @@ let time=0
core.fillText(this.tempRight, "出手次数 " + (getDamageInfo ? getDamageInfo.hero_turn : '???'), 30, 130, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 130, "#000000", core.ui._buildFont(12, true))
color = "#FFFF00"
damage = getDamageInfo.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
damage = getDamageInfo?.damage
if (damage == '???' || !getDamageInfo) {
damage = '杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
@ -22230,7 +22267,9 @@ let time=0
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.tempRight, damage, 230, 130, color, core.ui._buildFont(12, true))
core.setTextAlign(this.tempRight, 'center');
core.fillText(this.tempRight, damage, 240, 130, color, core.ui._buildFont(12, true))
core.setTextAlign(this.tempRight, 'left');
let atk = core.nextCriticals(enemy, null, null, null, null, config)
let speed = core.nextCriticals_speed(enemy, null, null, null, null, config)
let spell = core.nextCriticals_spell(enemy, null, null, null, null, config)
@ -22324,6 +22363,36 @@ let time=0
lineHeight: 16,
color: "#000000"
});
if (this.enemys.length <= 8) {
for (let i = 0; i < this.enemys.length; i++) {
this.drawBoxAnimate(this.left, i, 167 - (this.enemys.length / 2 - i) * 34, 370)
}
core.strokeRect(this.left, 150 - (this.enemys.length / 2 - this.page) * 34 + 1, 354, 32, 32, "#FFFF00", 2)
} else {
this.left.beginPath()
this.left.moveTo(63, 354)
this.left.lineTo(29, 370)
this.left.lineTo(63, 386)
this.left.closePath()
this.left.fillStyle = this.page < 3 ? "#999999" : "#000000"
this.left.fill()
this.left.beginPath()
this.left.moveTo(237, 354)
this.left.lineTo(271, 370)
this.left.lineTo(237, 386)
this.left.closePath()
this.left.fillStyle = this.page > this.enemys.length - 4 ? "#999999" : "#000000"
this.left.fill()
this.drawBoxAnimate(this.left, core.clamp(this.page - 2, 0, this.enemys.length - 5), 80, 370)
this.drawBoxAnimate(this.left, core.clamp(this.page - 1, 1, this.enemys.length - 4), 114, 370)
this.drawBoxAnimate(this.left, core.clamp(this.page, 2, this.enemys.length - 3), 148, 370)
this.drawBoxAnimate(this.left, core.clamp(this.page + 1, 3, this.enemys.length - 2), 182, 370)
this.drawBoxAnimate(this.left, core.clamp(this.page + 2, 4, this.enemys.length - 1), 216, 370)
if (this.page < 2) core.strokeRect(this.left, 64 + 34 * this.page, 354, 32, 32, "#FFFF00", 2)
else if (this.page > this.enemys.length - 3) core.strokeRect(this.left, 234 - (this.enemys.length - this.page) * 34, 354, 32, 32, "#FFFF00", 2)
else core.strokeRect(this.left, 132, 354, 32, 32, "#FFFF00", 2)
}
this.drawBoxAnimate(this.left, this.page)
}
drawRight() {
@ -22345,8 +22414,8 @@ let time=0
core.fillText(this.right, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true))
let color = "#FFFF00",
damage = enemy.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
if (damage == '???' || damage == null) {
damage = '杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
@ -22355,7 +22424,9 @@ let time=0
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.right, damage, 230, 50, color, core.ui._buildFont(12, true))
core.setTextAlign(this.left, 'center')
core.fillText(this.right, damage, 240, 50, color, core.ui._buildFont(12, true))
core.setTextAlign(this.left, 'left')
core.fillText(this.right, "攻击临界 " + enemy.criticalAtk[0], 30, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "速度临界 " + enemy.criticalSpeed[0], 120, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, '法强临界 ' + enemy.criticalSpell[0], 210, 70, "#000000", core.ui._buildFont(12, true))
@ -22373,9 +22444,9 @@ let time=0
core.fillText(this.right, "出手次数 " + (getDamageInfo ? getDamageInfo.hero_turn : '???'), 30, 130, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 130, "#000000", core.ui._buildFont(12, true))
color = "#FFFF00"
damage = getDamageInfo.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
damage = getDamageInfo?.damage
if (damage == '???' || !getDamageInfo) {
damage = '杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
@ -22384,7 +22455,9 @@ let time=0
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.right, damage, 230, 130, color, core.ui._buildFont(12, true))
core.setTextAlign(this.left, 'center')
core.fillText(this.right, damage, 240, 130, color, core.ui._buildFont(12, true))
core.setTextAlign(this.left, 'left')
let atk = core.nextCriticals(enemy, null, null, null, null, config)
let speed = core.nextCriticals_speed(enemy, null, null, null, null, config)
let spell = core.nextCriticals_spell(enemy, null, null, null, null, config)
@ -22467,7 +22540,7 @@ let time=0
}
this.drawLeft()
this.drawRight()
this.drawBoxAnimate(this.left, 0)
}
}
@ -22514,95 +22587,151 @@ let time=0
const speedchangebox = makeBox([606, 341], [25, 25])
const zerochangebox = makeBox([515, 365], [35, 35])
if (this.isAnimate) return
if (inRect(pos, atkupbox)) {
bookInfo.atk += bookInfo.atkStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, atkdownbox)) {
bookInfo.atk -= bookInfo.atkStep
if (bookInfo.atk < 0) bookInfo.atk = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, atkchangebox)) {
core.myprompt("请输入攻击调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.atkStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
let length = bookInfo.enemys.length
if (length > 0) {
if (length > 8 && inRect(pos, makeBox([66, 361], [238, 34]))) {
let num = core.clamp(Math.floor((x - 66) / 34), 0, 6)
}
});
} else if (inRect(pos, defupbox)) {
bookInfo.def += bookInfo.defStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, defdownbox)) {
bookInfo.def -= bookInfo.defStep
if (bookInfo.def < 0) bookInfo.def = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, defchangebox)) {
core.myprompt("请输入防御调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.defStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
if (num === 0) this.turnleft(this.page - 1)
}
});
} else if (inRect(pos, spellupbox)) {
bookInfo.spell += bookInfo.spellStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, spelldownbox)) {
bookInfo.spell -= bookInfo.spellStep
if (bookInfo.spell < 0) bookInfo.spell = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, spellchangebox)) {
core.myprompt("请输入法强调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.spellStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
else if (num === 1) {
const clamp = core.clamp(bookInfo.page - 2, 0, length - 5)
}
});
} else if (inRect(pos, speedupbox)) {
bookInfo.speed += bookInfo.speedStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, speeddownbox)) {
bookInfo.speed -= bookInfo.speedStep
if (bookInfo.speed < 0) bookInfo.speed = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, speedchangebox)) {
core.myprompt("请输入速度调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.speedStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
if (clamp < this.page - 1) this.turnleft(clamp + 1)
} else if (num === 2) {
const clamp = core.clamp(bookInfo.page - 1, 1, length - 4)
}
});
} else if (inRect(pos, zerochangebox)) {
bookInfo.clearEx()
bookInfo.drawRight()
this.update()
} else if (inRect(pos, exitbox)) {
if (clamp < this.page - 1) this.turnleft(clamp + 1)
else if (clamp > this.page - 1) this.turnright(clamp + 1)
} else if (num === 3) {
const clamp = core.clamp(bookInfo.page, 2, length - 3)
if (clamp < this.page - 1) this.turnleft(clamp + 1)
else if (clamp > this.page - 1) this.turnright(clamp + 1)
} else if (num === 4) {
const clamp = core.clamp(bookInfo.page + 1, 3, length - 2)
if (clamp < this.page - 1) this.turnleft(clamp + 1)
else if (clamp > this.page - 1) this.turnright(clamp + 1)
} else if (num === 5) {
const clamp = core.clamp(bookInfo.page + 2, 4, length - 1)
if (clamp < this.page - 1) this.turnleft(clamp + 1)
else if (clamp > this.page - 1) this.turnright(clamp + 1)
} else if (num === 6) this.turnright(this.page + 1)
} else if (length <= 8 && inRect(pos, makeBox([187 - length * 17, 361], [length * 34, 34]))) {
let num = core.clamp(Math.floor((x - 187 + length * 17) / 34), 0, length - 1)
if (num > this.page - 1) this.turnright(num + 1)
else if (num < this.page - 1) this.turnleft(num + 1)
} else if (inRect(pos, atkupbox)) {
bookInfo.atk += bookInfo.atkStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, atkdownbox)) {
bookInfo.atk -= bookInfo.atkStep
if (bookInfo.atk < 0) bookInfo.atk = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, atkchangebox)) {
core.myprompt("请输入攻击调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.atkStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, defupbox)) {
bookInfo.def += bookInfo.defStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, defdownbox)) {
bookInfo.def -= bookInfo.defStep
if (bookInfo.def < 0) bookInfo.def = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, defchangebox)) {
core.myprompt("请输入防御调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.defStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, spellupbox)) {
bookInfo.spell += bookInfo.spellStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, spelldownbox)) {
bookInfo.spell -= bookInfo.spellStep
if (bookInfo.spell < 0) bookInfo.spell = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, spellchangebox)) {
core.myprompt("请输入法强调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.spellStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, speedupbox)) {
bookInfo.speed += bookInfo.speedStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, speeddownbox)) {
bookInfo.speed -= bookInfo.speedStep
if (bookInfo.speed < 0) bookInfo.speed = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, speedchangebox)) {
core.myprompt("请输入速度调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.speedStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, zerochangebox)) {
bookInfo.clearEx()
bookInfo.drawRight()
this.update()
} else if (inRect(pos, exitbox)) {
core.playSound('取消');
core.book.close()
if (core.events.recoverEvents(core.status.event.interval)) {
return;
} else if (core.status.event.ui != null) {
core.status.boxAnimateObjs = [];
core.ui._drawViewMaps(core.status.event.ui);
} else core.ui.closePanel();
return;
} else if (inRect(pos, leftbox)) {
this.turnleft(this.page - 1)
} else if (inRect(pos, rightbox)) {
this.turnright(this.page + 1)
}
return
}
if (inRect(pos, exitbox)) {
core.playSound('取消');
core.book.close()
if (core.events.recoverEvents(core.status.event.interval)) {
@ -22613,20 +22742,13 @@ let time=0
} else core.ui.closePanel();
return;
} else if (inRect(pos, leftbox)) {
this.turnleft()
} else if (inRect(pos, rightbox)) {
this.turnright()
}
}
async turnleft() {
async turnleft(page) {
if (this.page <= 1) return
this.isAnimate = true
bookInfo.drawTempLeft(-1)
bookInfo.drawTempRight(-1)
bookInfo.drawBoxAnimate(bookInfo.tempLeft, -1)
bookInfo.drawTempLeft(page - 1)
bookInfo.drawTempRight(page - 1)
core.drawBoxAnimate()
await this.ani.time(1)
.absolute()
@ -23249,7 +23371,7 @@ let time=0
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
//绘制上一页左页
core.drawImage(ctx, this.paperpages[this.page - 2][0], 0, 0, this.ani.x / (this.width * 2) * 300, 400, dx, dy, this.ani.x / 2, this.height);
core.drawImage(ctx, this.paperpages[page - 1][0], 0, 0, this.ani.x / (this.width * 2) * 300, 400, dx, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "transparent";
core.drawImage(ctx, bookInfo.tempLeft.canvas, 0, 0, this.ani.x / (this.width * 2) * 300, 400, dx, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "rgba(0,0,0,0.5)";
@ -23257,7 +23379,7 @@ let time=0
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
//绘制翻起的右页
core.drawImage(ctx, this.paperpages[this.page - 2][1], 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, this.ani.x / 2 + dx, dy, this.ani.x / 2, this.height);
core.drawImage(ctx, this.paperpages[page - 1][1], 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, this.ani.x / 2 + dx, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "transparent";
core.drawImage(ctx, bookInfo.tempRight.canvas, 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, this.ani.x / 2 + dx, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "rgba(0,0,0,0.5)";
@ -23286,24 +23408,23 @@ let time=0
.move(this.width * 2, 0).n(1)
this.ani.ticker.clear()
this.isAnimate = false
this.page--
bookInfo.page--;
this.page = page
bookInfo.page = page - 1;
[bookInfo.left, bookInfo.tempLeft] = [bookInfo.tempLeft, bookInfo.left];
[bookInfo.right, bookInfo.tempRight] = [bookInfo.tempRight, bookInfo.right]
core.clearUI()
bookInfo.drawBoxAnimate(bookInfo.left, 0)
core.status.boxAnimateObjs = core.status.boxAnimateObjs.filter(v => v.ctx === bookInfo.left)
core.drawBoxAnimate()
this.update()
core.clearMap(bookInfo.tempLeft)
core.clearMap(bookInfo.tempRight)
}
async turnright() {
async turnright(page) {
if (this.page >= this.pagemax) return
this.isAnimate = true
bookInfo.drawTempLeft(1)
bookInfo.drawTempRight(1)
bookInfo.drawBoxAnimate(bookInfo.tempLeft, 1)
bookInfo.drawTempLeft(page - 1)
bookInfo.drawTempRight(page - 1)
core.drawBoxAnimate()
await this.ani.time(1)
.absolute()
@ -23926,7 +24047,7 @@ let time=0
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
//绘制翻起的左页
core.drawImage(ctx, this.paperpages[this.page][0], 0, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x, dy, this.ani.x / 2, this.height);
core.drawImage(ctx, this.paperpages[page - 1][0], 0, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "transparent";
core.drawImage(ctx, bookInfo.tempLeft.canvas, 0, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "rgba(0,0,0,0.5)";
@ -23934,7 +24055,7 @@ let time=0
ctx.shadowOffsetX = 0;
ctx.shadowOffsetY = 0;
//绘制下一页右页
core.drawImage(ctx, this.paperpages[this.page][1], 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x / 2, dy, this.ani.x / 2, this.height);
core.drawImage(ctx, this.paperpages[page - 1][1], 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x / 2, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "transparent";
core.drawImage(ctx, bookInfo.tempRight.canvas, 300 - this.ani.x / (this.width * 2) * 300, 0, this.ani.x / (this.width * 2) * 300, 400, 676 - dx - this.ani.x / 2, dy, this.ani.x / 2, this.height);
ctx.shadowColor = "rgba(0,0,0,0.5)";
@ -23965,12 +24086,11 @@ let time=0
.move(this.width * 2, 0).n(1)
this.ani.ticker.clear()
this.isAnimate = false
this.page++
bookInfo.page++;
this.page = page
bookInfo.page = page - 1;
[bookInfo.left, bookInfo.tempLeft] = [bookInfo.tempLeft, bookInfo.left];
[bookInfo.right, bookInfo.tempRight] = [bookInfo.tempRight, bookInfo.right]
core.clearUI()
bookInfo.drawBoxAnimate(bookInfo.left, 0)
core.status.boxAnimateObjs = core.status.boxAnimateObjs.filter(v => v.ctx === bookInfo.left)
core.drawBoxAnimate()
this.update()
core.clearMap(bookInfo.tempLeft)
@ -25277,9 +25397,11 @@ let time=0
ctx.shadowColor = "transparent";
core.drawImage(ctx, bookInfo.left.canvas, 0, 0, 300, 400, dx, dy, this.width, this.height)
core.drawImage(ctx, bookInfo.right.canvas, 0, 0, 300, 400, dx + this.width, dy, this.width, this.height)
ctx.restore();
}
setPage(num) {
if (num === 1) {
this.paperpages = [
[this.paperTexture('left'), this.paperTexture('right')]
@ -27566,7 +27688,7 @@ let time=0
centerX += core.bigmap.offsetX;
centerY += core.bigmap.offsetY;
}
var id = Symbol();
var id = setTimeout();
animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se };
tran.mode(linear()).time(1).absolute()
@ -27604,7 +27726,7 @@ let time=0
animate.se = animate.se || {};
if (typeof animate.se == 'string') animate.se = { 1: animate.se };
var id = id || Symbol();
var id = id || setTimeout();
tran.mode(linear()).time(1).absolute()
if (!hero) tran.value[id + name + "x"] = centerX
if (!hero) tran.value[id + name + "y"] = centerY
@ -27809,7 +27931,7 @@ let time=0
if (!flags["animate_" + name]) {
callback?.()
}
if (!id) id = Symbol()
if (!id) id = setTimeout()
tran.mode(linear()).time(1).absolute()
if (!hero) tran.value[id + name + "x"] = x
if (!hero) tran.value[id + name + "y"] = y