任务标记,楼传、旁白适配

This commit is contained in:
草莓 2024-12-24 14:42:16 +08:00
parent b2801fc1c6
commit 2b8e9d25b0
6 changed files with 91 additions and 38 deletions

View File

@ -1070,7 +1070,7 @@ tooltip : over这段话将出现在屏幕中心
helpUrl : /_docs/#/instruction
allImages : ['EvalString_1']
allSounds : ['EvalString_2']
default : ["这段话将在屏幕中心","bg_5043.png",3000,100,"","255,255,255,1",'rgba(255,255,255,1)',"0,0,0,1",'rgba(0,0,0,1)','bold 48px Verdana']
default : ["这段话将在屏幕中心","bg_5043.png",3000,30,"","255,255,255,1",'rgba(255,255,255,1)',"0,0,0,1",'rgba(0,0,0,1)','bold 48px Verdana']
var code = '{"type": "over", "text": "'+EvalString_0+'","image":"'+EvalString_1+'","time":'+Int_0+',"hidetime":'+Int_1+',"sound":"'+EvalString_2+'","textColor": ['+ColorString_0+'], "boldColor": ['+ColorString_1+'], "font": "'+EvalString_3+'"},\n';
return code;
*/;

File diff suppressed because one or more lines are too long

View File

@ -1,7 +1,7 @@
main.floors.Caimhome=
{
"floorId": "Caimhome",
"title": "主塔 11 层",
"title": "主塔11层",
"name": "11",
"width": 13,
"height": 13,

View File

@ -1,7 +1,7 @@
main.floors.jiuguan=
{
"floorId": "jiuguan",
"title": "主塔 11 层",
"title": "主塔11层",
"name": "11",
"width": 13,
"height": 13,
@ -33,7 +33,7 @@ main.floors.jiuguan=
"text": "这段话将在屏幕中心",
"image": "bg_5043.png",
"time": 3000,
"hidetime": 100,
"hidetime": 30,
"sound": "",
"textColor": [
255,

View File

@ -177,6 +177,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (!core.hasVisitedFloor(floorId)) {
core.insertAction(core.floors[floorId].firstArrive);
core.visitFloor(floorId);
core.plugin.bfs();
}
}
},

View File

@ -66,6 +66,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.ui.cgText.sound = data.sound || "";
core.ui.cgText.bodyList = core.clone(data.bodyList);
main.dom.cgText.style.display = 'block';
core.lockControl();
core.ui.cgText.update()
} else {
@ -2071,7 +2072,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
globalAlphafloor += globalAlphafloorStatus;
if (globalAlphafloor === 100) globalAlphafloorStatus = -4
if (globalAlphafloor === 0) globalAlphafloorStatus = 4
if (core.status.event.id === 'viewMaps') { core.ui.statusBar._update_map(core.status.event.data.floorId) } else { core.ui.statusBar._update_map() }
if (core.domStyle.isVertical) {
core.clearMap(uictx, MAP_BLOCK_LEFT_VERTICAL, MAP_BLOCK_TOP_VERTICAL, 340, 360)
uictx.drawImage(floorVertical, 0, 0)
@ -7972,8 +7973,7 @@ core.plugin.animate = {
let allChangeEntries = Object.entries(defaultChange);
const reset = core.events.resetGame;
core.events.resetGame = function () {
reset.apply(core.events, arguments);
this.bfs = function () {
areas = [];
// 获取所有分区,使用异步函数,保证不会卡顿
// 原理是用bfs扫将所有连在一起的地图合并成一个区域
@ -7999,6 +7999,10 @@ core.plugin.animate = {
}
})();
}
core.events.resetGame = function () {
reset.apply(core.events, arguments);
core.plugin.bfs()
}
/**
* 广度优先搜索搜索地图路径
* @param {string} center 中心地图的id
@ -8099,6 +8103,7 @@ core.plugin.animate = {
* @param {string[]} order 遍历顺序
* @returns {MapDrawInfo} 地图的绘制信息
*/
function getDrawInfo(map, center, order) {
// 先根据地图id分类从而确定每个地图连接哪些地图同时方便处理
const links = {};
@ -8187,6 +8192,37 @@ core.plugin.animate = {
core.animateFrame.globalAlphaFloor = 0
core.animateFrame.globalAlphaFloorStatus = 1
const tesk = document.createElement('canvas')
tesk.width = 300;
tesk.height = 300;
const teskctx = tesk.getContext("2d");
let line = 50
teskctx.strokeStyle = 'green'
teskctx.fillStyle = 'green'
core.registerAnimationFrame('tesk', true, function () {
core.clearMap(teskctx)
teskctx.lineWidth = 150 - line;
if (line <= 150) {
teskctx.beginPath();
teskctx.arc(150, 150, line, 0, Math.PI * 2)
line += 2
teskctx.stroke()
} else {
teskctx.beginPath();
teskctx.arc(150, 150, line - 150, 0, Math.PI * 2)
line += 2
teskctx.fill()
if (line >= 250) line = 50
}
})
/**
* 绘制小地图
* @param {MapDrawInfo} info 地图绘制信息
@ -8219,6 +8255,7 @@ core.plugin.animate = {
core.drawImage(ctx, img, 0, 0, 60, 60, fx, fy, w, h)
const layer = info.upOrDown[id];
const min = Math.min(w, h);
if (core.getFlag("任务地点") && core.getFlag("任务地点") === id) ctx.drawImage(tesk, fx + min / 4, fy + min / 4, min / 2, min / 2)
if (layer?.includes('upFloor'))
core.drawIcon(ctx, defaultChange.upFloor, fx + min / 4, fy + min / 4, min / 2, min / 2);
if (layer?.includes('downFloor'))
@ -8286,7 +8323,7 @@ core.plugin.animate = {
let size = core.__PIXELS__ * 3 / 4; //312
const areas = core.getFlag('areas')
const i = areas.findIndex(v => v.name === core.status.maps[floorId].areas)
let i = areas.findIndex(v => v.maps.includes(floorId))
core.fillRoundRect('ui', 15 - 2, 15 - 2, 35 + 4, 35 + 4, 4, '#444444');
core.strokeRoundRect('ui', 15 - 4, 15 - 4, 35 + 8, 35 + 8, 4, "#444444", 1)
core.fillBoldText('ui', '当前', 13 + 20, 17 + 20, '#FFFFFF', '#000000', this._buildFont(18, true))
@ -8348,9 +8385,9 @@ core.plugin.animate = {
core.fillRoundRect('ui', 15 - 2, 60 - 2 + size - 4, 35 + 4, 35 + 4, 4, '#444444');
core.strokeRoundRect('ui', 15 - 4, 60 - 4 + size - 4, 35 + 8, 35 + 8, 4, "#444444", 1)
if (i === 0) {
core.fillBoldText('ui', '◀', 35, 17 + 65 + size - 4, '#909090', '#000000', this._buildFont(18, true))
core.fillBoldText('ui', '◀', 30, 17 + 65 + size - 4, '#909090', '#000000', this._buildFont(18, true))
} else {
core.fillBoldText('ui', '◀', 35, 17 + 65 + size - 4, '#FFFFFF', '#000000', this._buildFont(18, true))
core.fillBoldText('ui', '◀', 30, 17 + 65 + size - 4, '#FFFFFF', '#000000', this._buildFont(18, true))
}
core.fillRoundRect('ui', 15 - 2 + size - 4, 60 - 2 + size - 4, 35 + 4, 35 + 4, 4, '#444444');
core.strokeRoundRect('ui', 15 - 4 + size - 4, 60 - 4 + size - 4, 35 + 8, 35 + 8, 4, "#444444", 1)
@ -8379,7 +8416,7 @@ core.plugin.animate = {
core.strokeRoundRect('ui', 15 - 4 + size - 4 + 35 + 8, 60 - 4, 37 + 8, (size - 58) / 2 + 8, 4, "#444444", 1)
const title = core.status.maps[floorId].title
//const length = title.length
fillTextVertical("ui", title, 15 - 4 + size - 4 + 45, 85, '#FFFFFF', 18)
fillTextVertical("ui", title, 15 - 4 + size - 4 + 45, 85, '#FFFFFF', '#000000', 18)
//const uictx = main.dom.gameCanvas.ui.getContext('2d')
core.fillRoundRect('ui', 15 - 2 + size - 4 + 35 + 8, 60 - 2 + (size - 58) / 2 + 8, 37 + 4, 119 + 4, 4, '#444444');
core.strokeRoundRect('ui', 15 - 4 + size - 4 + 35 + 8, 60 - 4 + (size - 58) / 2 + 8, 37 + 8, 119 + 8, 4, "#444444", 1)
@ -8400,7 +8437,7 @@ core.plugin.animate = {
if (!ctx) return;
const canvas = document.createElement('canvas');
const context = canvas.getContext("2d");
fontsize *= 3;
const length = text.length
canvas.width = fontsize * 2
canvas.height = fontsize * length * 2
@ -8444,6 +8481,7 @@ core.plugin.animate = {
context.textAlign = 'center';
context.textBaseline = 'middle';
context.lineWidth = 6
// 开始逐字绘制
@ -8451,18 +8489,6 @@ core.plugin.animate = {
// 确定下一个字符的纵坐标位置
var letterWidth = arrWidth[index];
if (index > 0 && text.charCodeAt(index - 1) < 256) {
// y修正
sy = sy + arrWidth[index - 1] / 2;
}
context.strokeText(letter, sx, sy);
context.fillText(letter, sx, sy);
// 旋转坐标系还原成初始态
@ -8471,7 +8497,7 @@ core.plugin.animate = {
// 确定下一个字符的纵坐标位置
var letterWidth = arrWidth[index];
var letterWidth = 54;
sy = sy + letterWidth;
@ -8484,7 +8510,7 @@ core.plugin.animate = {
context.textBaseline = baseline;
//绘制到目标位置
ctx.drawImage(canvas, x, y - fontsize * length)
ctx.drawImage(canvas, x, y - fontsize / 3 * length, canvas.width / 3, canvas.height / 3)
};
////// 点击楼层传送器时的打开操作 //////
@ -8607,7 +8633,7 @@ core.plugin.animate = {
}
const areas = core.getFlag('areas')
let i = areas.findIndex(v => v.name === core.status.maps[floorId].areas)
let i = areas.findIndex(v => v.maps.includes(floorId))
if (px >= 11 && px <= 54 && py >= 11 && py <= 54) {
core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
@ -9633,7 +9659,7 @@ core.plugin.animate = {
const data = core.clone(core.status.event.data.current);
core.insertAction(data);
core.unlockControl();
core.doAction()
}
} catch (ee) {
@ -9665,7 +9691,7 @@ core.plugin.animate = {
const data = core.clone(core.status.event.data.current);
core.insertAction(data);
core.unlockControl();
core.doAction()
}
} catch (ee) {
@ -9729,6 +9755,7 @@ core.plugin.animate = {
if (core.status.event.id == 'action' && core.status.event.data.type == 'cgtext') {
core.setFlag("skip", true)
main.dom.cgText.style.display = "none"
core.unlockControl();
core.doAction()
}
}
@ -9742,6 +9769,7 @@ core.plugin.animate = {
data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果
data.sound = ""
core.insertAction(data);
core.unlockControl();
core.doAction()
} else if ((core.domStyle.isVertical && inRect(pos, saveboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, savebox))) { //存档
@ -9756,7 +9784,7 @@ core.plugin.animate = {
cg.style.display = "none"
const data = [{ 'type': 'callSave' }, current] //插入存档事件
core.insertAction(data)
core.unlockControl();
core.doAction();
} else {
@ -9773,6 +9801,7 @@ core.plugin.animate = {
data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果
data.sound = "";
core.insertAction(data);
core.unlockControl();
core.doAction();
return;
} else {
@ -9780,7 +9809,10 @@ core.plugin.animate = {
}
cg.style.display = "none"
core.ui._animateUI('hide', null, core.doAction);
core.ui._animateUI('hide', null, () => {
core.unlockControl();
core.doAction()
});
}
@ -9878,7 +9910,12 @@ core.plugin.animate = {
if (config.time == 0) {
while (_drawNext());
if (auto && !this.WindowSkin && !core.ui.cgText.sound || (core.ui.cgText.sound && !core.musicStatus.soundStatus)) {
setTimeout(() => { if (auto) core.doAction() }, 2000)
setTimeout(() => {
if (auto) {
core.unlockControl();
core.doAction()
}
}, 2000)
}
} else {
clearInterval(core.status.event.interval);
@ -9886,7 +9923,12 @@ core.plugin.animate = {
if (!_drawNext()) {
clearInterval(core.status.event.interval);
core.status.event.interval = null;
if (auto && !this.WindowSkin && !core.ui.cgText.sound || (core.ui.cgText.sound && !core.musicStatus.soundStatus)) setTimeout(() => { if (auto) core.doAction() }, 2000)
if (auto && !this.WindowSkin && !core.ui.cgText.sound || (core.ui.cgText.sound && !core.musicStatus.soundStatus)) setTimeout(() => {
if (auto) {
core.unlockControl();
core.doAction()
}
}, 2000)
}
}, config.time);
}
@ -9944,7 +9986,12 @@ core.plugin.animate = {
if (this.sound && core.material.sounds[this.sound] && !core.getFlag("skip", false) && core.musicStatus.soundStatus) {
this.beforeSound = core.playSound(this.sound, null, () => {
if (this.sound && auto && !this.WindowSkin && core.musicStatus.soundStatus) {
setTimeout(() => { if (auto) core.doAction() }, 2000)
setTimeout(() => {
if (auto) {
core.unlockControl();
core.doAction()
}
}, 2000)
}
})
}
@ -9989,6 +10036,7 @@ core.plugin.animate = {
this.over = function (image, time = 3000, hidetime = 100, sound = "", textColor = "#FFFFFF", boldColor = "#000000", font = "bold 48px Verdana", text = "") {
if (!core.isPlaying()) { return core.doAction() }
const img = core.material.images.images?.[image]
core.lockControl();
over.style.display = "block";
let globalAlpha = 0
core.registerAnimationFrame("overshow", true, () => {
@ -10049,8 +10097,9 @@ core.plugin.animate = {
ctx.restore();
if (globalAlpha <= 0) {
over.style.display = 'none'
core.unregisterAnimationFrame("overhide")
over.style.display = "none"
core.unlockControl();
core.doAction()
}
})
@ -10083,9 +10132,12 @@ core.plugin.animate = {
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
ctx.restore();
if (ctx.globalAlpha <= 0) {
if (globalAlpha <= 0) {
over.style.display = 'none'
core.unregisterAnimationFrame("overhide")
over.style.display = "none"
core.unlockControl();
core.doAction();
}
})