Compare commits
12 Commits
7fb0248f55
...
3623140558
Author | SHA1 | Date | |
---|---|---|---|
3623140558 | |||
57a9a96e86 | |||
2b8e9d25b0 | |||
b2801fc1c6 | |||
|
56f466db86 | ||
7523611b87 | |||
|
119570953e | ||
9259cb901a | |||
8f596865bd | |||
d8d9809da6 | |||
|
63708720dc | ||
|
f5e5edc9d3 |
@ -952,6 +952,7 @@ action
|
||||
| removeMouse_s
|
||||
| drawWarning_s
|
||||
| addPop_s
|
||||
| over_s
|
||||
| playStereo_s
|
||||
| moveStereo_s
|
||||
| pass_s
|
||||
@ -1060,8 +1061,23 @@ if (block.isCollapsed() || !block.isEnabled() || pos || Int_0 || Bool_0) {
|
||||
return code+',\n';
|
||||
*/;
|
||||
|
||||
over_s
|
||||
: '旁白文字' ':' EvalString BGNL? Newline
|
||||
'背景' EvalString? '持续时长' Int? '渐入渐出时长' Int? '音频文件' EvalString? BGNL? Newline
|
||||
'文字颜色' ColorString? Colour '描边颜色' ColorString? Colour '字体信息' EvalString? Newline
|
||||
/*over_s
|
||||
tooltip : over:这段话将出现在屏幕中心
|
||||
helpUrl : /_docs/#/instruction
|
||||
allImages : ['EvalString_1']
|
||||
allSounds : ['EvalString_2']
|
||||
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;
|
||||
*/;
|
||||
|
||||
cgtext_s
|
||||
: '背景' EvalString? '移除对话框' Bool? '头像' EvalString?'名字' EvalString?'坐标PX' Number'打字间隔' Int? BGNL? Newline
|
||||
'音频文件(需在全塔属性——使用音效注册)'EvalString? BGNL? Newline
|
||||
EvalString? BGNL? Newline textcgDrawingList*? Newline
|
||||
|
||||
|
||||
@ -1069,10 +1085,11 @@ cgtext_s
|
||||
tooltip : cgtext:显示一段包含cg的文字(剧情)
|
||||
helpUrl : /_docs/#/instruction
|
||||
allImages : ['EvalString_0','EvalString_1']
|
||||
default : ["bg_5043.png","face_050445.png",false,"菲奥奈",-300,0,"这句话显示在对话框内",[{ "name":"tati_050145a.png" , "px": 100,"filter":false }]]
|
||||
allSounds : ['EvalString_3']
|
||||
default : ["bg_5043.png","face_050445.png",false,"菲奥奈",-300,0,"","这句话显示在对话框内",[{ "name":"tati_050145a.png" , "px": 100,"filter":false }]]
|
||||
var head ='{ "name": "'+EvalString_1+'", "px": '+Number_0+' }'
|
||||
var list=',"bodyList": [\n'+textcgDrawingList_0+'\n]'
|
||||
var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","WindowSkin":'+Bool_0+',"head":'+head+' ,"name":"'+EvalString_2+'","time":'+Int_0+',"text": "'+EvalString_3+'"'+list+' },\n';
|
||||
var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","WindowSkin":'+Bool_0+',"head":'+head+' ,"name":"'+EvalString_2+'","time":'+Int_0+',"sound":"'+EvalString_3+'","text": "'+EvalString_4+'"'+list+' },\n';
|
||||
return code;
|
||||
*/;
|
||||
textcgDrawingList
|
||||
@ -1285,6 +1302,7 @@ IdString_0 = IdString_0 && (', "icon": "' + IdString_0 + '"');
|
||||
var code = '{"type": "tip", "text": "'+EvalString_0+'"'+IdString_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
addPop_s
|
||||
: '弹出弹幕' ':' EvalString BGNL? Newline
|
||||
'出现像素位置px' Int 'py' Int '文字颜色' ColorString? Colour '描边颜色' ColorString? Colour BGNL? Newline
|
||||
|
@ -315,7 +315,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
return res;
|
||||
}
|
||||
this.next = MotaActionBlocks['cgtext_s'].xmlText([
|
||||
data.bg,data.WindowSkin,data.head.name, data.name||"", data.head.px||-300,data.time, data.text,buildcgDrawing(data.bodyList), this.next]);
|
||||
data.bg,data.WindowSkin,data.head.name, data.name||"", data.head.px||-300,data.time, data.sound,data.text,buildcgDrawing(data.bodyList), this.next]);
|
||||
|
||||
break;
|
||||
case "moveTextBox": // 移动对话框
|
||||
@ -352,6 +352,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['addPop_s'].xmlText([
|
||||
data.value,data.px, data.py, data.color,'rgba('+data.color+')', data.boldColor,'rgba('+data.boldColor+')', data.left, data.jump, data.time, data.show, data.font, data.speed,this.next]);
|
||||
break;
|
||||
case "over":
|
||||
this.next = MotaActionBlocks['over_s'].xmlText([
|
||||
data.text??"",data.image??"", data.time??3000, data.hidetime??100,data.sound??"", data.textColor,'rgba('+data.textColor+')', data.boldColor,'rgba('+data.boldColor+')', data.font??"bold 48px Verdana",this.next]);
|
||||
break;
|
||||
case "tip":
|
||||
this.next = MotaActionBlocks['tip_s'].xmlText([
|
||||
data.text,data.icon||"",this.next]);
|
||||
|
BIN
project/bgms/Blind_Alley.mp3
Normal file
BIN
project/bgms/Crawler.mp3
Normal file
@ -31,12 +31,16 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"bg_2011.png",
|
||||
"bg_2521.png",
|
||||
"bg_3042.png",
|
||||
"bg_3531.png",
|
||||
"bg_3551.png",
|
||||
"bg_3563.png",
|
||||
"bg_3571.png",
|
||||
"bg_3601.png",
|
||||
"bg_3721.png",
|
||||
"bg_5033.png",
|
||||
"bg_5043.png",
|
||||
"bg_5044.png",
|
||||
"bg_6004.png",
|
||||
"brave.png",
|
||||
"cao.png",
|
||||
"d.png",
|
||||
@ -101,6 +105,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
"maba.png",
|
||||
"now.png",
|
||||
"null.png",
|
||||
"other_0001.png",
|
||||
"other_0002.png",
|
||||
"other_0003.png",
|
||||
"other_0004.png",
|
||||
"r.png",
|
||||
"status.png",
|
||||
"statusBackground.jpg",
|
||||
@ -157,9 +165,22 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
|
||||
],
|
||||
"bgms": [
|
||||
"Asphodelus_Ceui.mp3",
|
||||
"Blind_Alley.mp3",
|
||||
"Crawler.mp3",
|
||||
"theme.mp3"
|
||||
],
|
||||
"sounds": [
|
||||
"aiy010000010.mp3",
|
||||
"aiy010000020.mp3",
|
||||
"aiy010000030.mp3",
|
||||
"aiy310000010.mp3",
|
||||
"aiy310000020.mp3",
|
||||
"aiy710000010.mp3",
|
||||
"aiy710000020.mp3",
|
||||
"aiy710000030.mp3",
|
||||
"aiy710000040.mp3",
|
||||
"aiy710000050.mp3",
|
||||
"aiy710000060.mp3",
|
||||
"attack.mp3",
|
||||
"bomb.mp3",
|
||||
"cancel.mp3",
|
||||
|
3242
project/events.js
@ -1,7 +1,7 @@
|
||||
main.floors.Caimhome=
|
||||
{
|
||||
"floorId": "Caimhome",
|
||||
"title": "主塔 11 层",
|
||||
"title": "主塔11层",
|
||||
"name": "11",
|
||||
"width": 13,
|
||||
"height": 13,
|
||||
|
@ -1,7 +1,7 @@
|
||||
main.floors.jiuguan=
|
||||
{
|
||||
"floorId": "jiuguan",
|
||||
"title": "主塔 11 层",
|
||||
"title": "主塔11层",
|
||||
"name": "11",
|
||||
"width": 13,
|
||||
"height": 13,
|
||||
@ -26,6 +26,29 @@ main.floors.jiuguan=
|
||||
],
|
||||
"direction": "down"
|
||||
}
|
||||
],
|
||||
"4,10": [
|
||||
{
|
||||
"type": "over",
|
||||
"text": "这段话将在屏幕中心",
|
||||
"image": "bg_5043.png",
|
||||
"time": 3000,
|
||||
"hidetime": 30,
|
||||
"sound": "",
|
||||
"textColor": [
|
||||
255,
|
||||
255,
|
||||
255,
|
||||
1
|
||||
],
|
||||
"boldColor": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1
|
||||
],
|
||||
"font": "bold 48px Verdana"
|
||||
}
|
||||
]
|
||||
},
|
||||
"changeFloor": {},
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
BIN
project/images/bg_3531.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
project/images/bg_3563.png
Normal file
After Width: | Height: | Size: 815 KiB |
BIN
project/images/bg_3601.png
Normal file
After Width: | Height: | Size: 1.4 MiB |
BIN
project/images/bg_6004.png
Normal file
After Width: | Height: | Size: 1.2 MiB |
BIN
project/images/other_0001.png
Normal file
After Width: | Height: | Size: 849 KiB |
BIN
project/images/other_0002.png
Normal file
After Width: | Height: | Size: 643 KiB |
BIN
project/images/other_0003.png
Normal file
After Width: | Height: | Size: 574 KiB |
BIN
project/images/other_0004.png
Normal file
After Width: | Height: | Size: 1.1 MiB |
@ -40,6 +40,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
}
|
||||
core.doAction()
|
||||
})
|
||||
core.registerEvent("over", function (data) {
|
||||
let image = data.image ?? "";
|
||||
let time = data.time ?? 3000;
|
||||
let sound = data.sound ?? "";
|
||||
let textColor = data.textColor ?? "#FFFFFF";
|
||||
let boldColor = data.boldColor ?? "#000000";
|
||||
let font = data.font ?? "bold 48px Verdana";
|
||||
let text = data.text ?? "";
|
||||
let hidetime = data.hidetime ?? 100;
|
||||
if (!main.replayChecking && !core.isReplaying()) {
|
||||
core.over(image, time, hidetime, sound, textColor, boldColor, font, text)
|
||||
} else {
|
||||
core.doAction()
|
||||
}
|
||||
})
|
||||
core.registerEvent("cgtext", function (data) {
|
||||
if (!main.replayChecking && !core.isReplaying()) {
|
||||
core.ui.cgText.image = data.bg;
|
||||
@ -48,8 +63,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
core.ui.cgText.text = data.text;
|
||||
core.ui.cgText.time = data.time;
|
||||
core.ui.cgText.WindowSkin = data.WindowSkin
|
||||
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 {
|
||||
@ -2005,6 +2022,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
main.dom.CGUI.style.height = obj.totalHeight + 'px';
|
||||
main.dom.cgText.style.width = obj.totalWidth + 'px';
|
||||
main.dom.cgText.style.height = obj.totalHeight + 'px';
|
||||
main.dom.over.style.width = obj.totalWidth + 'px';
|
||||
main.dom.over.style.height = obj.totalHeight + 'px';
|
||||
|
||||
const innerSize = (obj.canvasWidth * core.domStyle.scale) + "px";
|
||||
for (let i = 0; i < core.dom.gameCanvas.length; ++i)
|
||||
@ -2053,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)
|
||||
@ -2834,80 +2853,7 @@ 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层
|
||||
@ -2934,7 +2880,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
||||
data = { "type": "text", "text": data };
|
||||
// 该事件块已经被禁用
|
||||
if (data._disabled) return core.doAction();
|
||||
if (data.type !== 'cgtext') core.unregisterAnimationFrame("skip")
|
||||
if (data.type !== 'cgtext') {
|
||||
core.unregisterAnimationFrame("skip")
|
||||
core.setFlag("skip", false)
|
||||
}
|
||||
data.floorId = data.floorId || floorId;
|
||||
core.status.event.data.type = data.type;
|
||||
this.doEvent(data, x, y, prefix);
|
||||
@ -7350,6 +7299,7 @@ core.plugin.animate = {
|
||||
MotaActionBlocks['text_0_s'].xmlText(),
|
||||
MotaActionBlocks['text_1_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList("\t[小妖精,fairy]\f[fairy.png,0,0]欢迎使用事件编辑器(双击方块可直接预览)"),
|
||||
MotaActionBlocks['over_s'].xmlText(),
|
||||
MotaActionFunctions.actionParser.parseList([{
|
||||
"type": "cgtext",
|
||||
"bg": "bg_5043.png",
|
||||
@ -7357,6 +7307,7 @@ core.plugin.animate = {
|
||||
"head": { "name": "face_050445.png", "px": -300 },
|
||||
"name": "菲奥奈",
|
||||
"time": 0,
|
||||
"sound": "",
|
||||
"text": "这句话显示在对话框内",
|
||||
"bodyList": [
|
||||
{ "name": "tati_050145a.png", "px": 100, "filter": false }
|
||||
@ -8106,8 +8057,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扫,将所有连在一起的地图合并成一个区域
|
||||
@ -8133,6 +8083,10 @@ core.plugin.animate = {
|
||||
}
|
||||
})();
|
||||
}
|
||||
core.events.resetGame = function () {
|
||||
reset.apply(core.events, arguments);
|
||||
core.plugin.bfs()
|
||||
}
|
||||
/**
|
||||
* 广度优先搜索搜索地图路径
|
||||
* @param {string} center 中心地图的id
|
||||
@ -8233,6 +8187,7 @@ core.plugin.animate = {
|
||||
* @param {string[]} order 遍历顺序
|
||||
* @returns {MapDrawInfo} 地图的绘制信息
|
||||
*/
|
||||
|
||||
function getDrawInfo(map, center, order) {
|
||||
// 先根据地图id分类,从而确定每个地图连接哪些地图,同时方便处理
|
||||
const links = {};
|
||||
@ -8321,6 +8276,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 地图绘制信息
|
||||
@ -8353,6 +8339,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'))
|
||||
@ -8420,7 +8407,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))
|
||||
@ -8482,9 +8469,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)
|
||||
@ -8513,7 +8500,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)
|
||||
@ -8534,7 +8521,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
|
||||
@ -8578,6 +8565,7 @@ core.plugin.animate = {
|
||||
context.textAlign = 'center';
|
||||
|
||||
context.textBaseline = 'middle';
|
||||
context.lineWidth = 6
|
||||
|
||||
// 开始逐字绘制
|
||||
|
||||
@ -8585,18 +8573,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);
|
||||
// 旋转坐标系还原成初始态
|
||||
@ -8605,7 +8581,7 @@ core.plugin.animate = {
|
||||
|
||||
// 确定下一个字符的纵坐标位置
|
||||
|
||||
var letterWidth = arrWidth[index];
|
||||
var letterWidth = 54;
|
||||
|
||||
sy = sy + letterWidth;
|
||||
|
||||
@ -8618,7 +8594,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)
|
||||
};
|
||||
|
||||
////// 点击楼层传送器时的打开操作 //////
|
||||
@ -8741,7 +8717,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))
|
||||
@ -9759,7 +9735,17 @@ core.plugin.animate = {
|
||||
|
||||
cg.onmouseup = function (e) { //鼠标抬起
|
||||
try {
|
||||
if (!core.isPlaying()) return false;
|
||||
core.unregisterAnimationFrame("skip")
|
||||
let a = core.getFlag("skip", false)
|
||||
core.setFlag("skip", false)
|
||||
if (a) {
|
||||
const data = core.clone(core.status.event.data.current);
|
||||
|
||||
core.insertAction(data);
|
||||
core.unlockControl();
|
||||
core.doAction()
|
||||
}
|
||||
} catch (ee) {
|
||||
console.error(ee);
|
||||
}
|
||||
@ -9782,6 +9768,16 @@ core.plugin.animate = {
|
||||
|
||||
if (!core.isPlaying()) return false;
|
||||
core.unregisterAnimationFrame("skip")
|
||||
core.setFlag("skip", false)
|
||||
let a = core.getFlag("skip", false)
|
||||
core.setFlag("skip", false)
|
||||
if (a) {
|
||||
const data = core.clone(core.status.event.data.current);
|
||||
|
||||
core.insertAction(data);
|
||||
core.unlockControl();
|
||||
core.doAction()
|
||||
}
|
||||
} catch (ee) {
|
||||
console.error(ee);
|
||||
}
|
||||
@ -9799,6 +9795,7 @@ core.plugin.animate = {
|
||||
main.log(ee);
|
||||
}
|
||||
}
|
||||
let auto = false;
|
||||
class cgText {
|
||||
constructor() { //绘制需要的变量
|
||||
this.image = ""
|
||||
@ -9808,6 +9805,8 @@ core.plugin.animate = {
|
||||
this.text = ''
|
||||
this.time = 0;
|
||||
this.WindowSkin = false;
|
||||
this.sound = "";
|
||||
this.beforeSound = 0;
|
||||
}
|
||||
click(px, py) { //点击效果
|
||||
|
||||
@ -9828,47 +9827,76 @@ core.plugin.animate = {
|
||||
const saveboxVertical = makeBox([52, 1700], [96, 192])
|
||||
const skipbox = makeBox([1400, 1100], [192, 96]);
|
||||
const skipboxVertical = makeBox([52, 1400], [96, 192])
|
||||
const autobox = makeBox([1700, 900], [192, 96]);
|
||||
const autoboxVertical = makeBox([256, 1700], [96, 192])
|
||||
if ((core.domStyle.isVertical && inRect(pos, skipboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, skipbox))) {
|
||||
auto = false;
|
||||
let time = 0
|
||||
core.stopSound(this.beforeSound);
|
||||
core.registerAnimationFrame("skip", true, (timestamp) => {
|
||||
if (timestamp > time + 100) {
|
||||
time = timestamp
|
||||
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()
|
||||
}
|
||||
}
|
||||
})
|
||||
} else if ((core.domStyle.isVertical && inRect(pos, autoboxVertical) && !this.WindowSkin) || (!core.domStyle.isVertical && !this.WindowSkin && inRect(pos, autobox))) {
|
||||
auto = !auto;
|
||||
|
||||
const data = core.clone(core.status.event.data.current);
|
||||
data.showAll = true;
|
||||
data.time = 0
|
||||
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))) { //存档
|
||||
auto = false;
|
||||
if (core.status.event.animateUI) return;
|
||||
if (core.status.event.interval != null) return;
|
||||
const current = core.clone(core.status.event.data.current)
|
||||
current.showAll = true;
|
||||
current.time = 0
|
||||
current.sound = ""
|
||||
current.text = current.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除当前事件所有打字机效果
|
||||
cg.style.display = "none"
|
||||
const data = [{ 'type': 'callSave' }, current] //插入存档事件
|
||||
core.insertAction(data)
|
||||
core.unlockControl();
|
||||
core.doAction();
|
||||
|
||||
} else {
|
||||
|
||||
// 正在淡入淡出的话不执行
|
||||
if (core.status.event.animateUI) return;
|
||||
auto = false;
|
||||
const data = core.clone(core.status.event.data.current);
|
||||
|
||||
var data = core.clone(core.status.event.data.current);
|
||||
// 打字机效果显示全部文字
|
||||
if (core.status.event.interval != null) {
|
||||
data.showAll = true;
|
||||
data.time = 0
|
||||
data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果
|
||||
|
||||
data.sound = "";
|
||||
core.insertAction(data);
|
||||
core.unlockControl();
|
||||
core.doAction();
|
||||
return;
|
||||
} else {
|
||||
core.stopSound(this.beforeSound);
|
||||
}
|
||||
|
||||
cg.style.display = "none"
|
||||
core.ui._animateUI('hide', null, core.doAction);
|
||||
core.ui._animateUI('hide', null, () => {
|
||||
core.unlockControl();
|
||||
core.doAction()
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
@ -9965,12 +9993,26 @@ 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.unlockControl();
|
||||
core.doAction()
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
} else {
|
||||
clearInterval(core.status.event.interval);
|
||||
core.status.event.interval = setInterval(function () {
|
||||
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.unlockControl();
|
||||
core.doAction()
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
}, config.time);
|
||||
}
|
||||
@ -9983,6 +10025,7 @@ core.plugin.animate = {
|
||||
}
|
||||
background() {
|
||||
const img = core.material.images.images?.[this.image]
|
||||
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
@ -10018,9 +10061,25 @@ core.plugin.animate = {
|
||||
core.fillBoldText(ctx, '存 档', 1736, 1166, '#FFFFFF', '#000000', "bold 48px Verdana")
|
||||
core.drawWindowSkin("winskin.png", ctx, 1400, 1100, 192, 96)
|
||||
core.fillBoldText(ctx, '▶▶', 1456, 1166, '#FFFFFF', '#000000', "bold 48px Verdana")
|
||||
core.drawWindowSkin("winskin.png", ctx, 1700, 900, 192, 96)
|
||||
let autoText = "AUTO";
|
||||
if (auto) autoText = "STOP";
|
||||
core.fillBoldText(ctx, autoText, 1722, 966, '#FFFFFF', '#000000', "bold 48px Verdana")
|
||||
}
|
||||
if (this.name) core.fillBoldText(ctx, `【${this.name}】`, 500, 880, '#FFFFFF', '#000000', "bold 48px Verdana") //绘制名字
|
||||
if (this.text) { //绘制对话
|
||||
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.unlockControl();
|
||||
core.doAction()
|
||||
}
|
||||
}, 2000)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (this.text && !core.getFlag("skip", false)) { //绘制对话
|
||||
this.drawTextContent(ctx, this.text, {
|
||||
left: 500,
|
||||
top: 950,
|
||||
@ -10042,128 +10101,258 @@ core.plugin.animate = {
|
||||
|
||||
}
|
||||
core.ui.cgText = new cgText()
|
||||
|
||||
},
|
||||
"属性映射": function () {
|
||||
// 在此增加新插件
|
||||
this.statusEquip = function () {
|
||||
const hero = core.status.hero;
|
||||
//装备具体效果在这里写,道具填写道具类型为equip并选择装备类型,道具的装备属性中装备类型遵循以下填写方式:
|
||||
//固定装备孔的填写0/1/2/3,分别对应主手、副手、防具、饰品
|
||||
//主副手同时可使用的,填写 武器
|
||||
//具体的换装时装备切换操作写在新道具栏/物品栏插件
|
||||
//当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作
|
||||
//主武器效果
|
||||
if (core.getEquip[0]) {
|
||||
switch (core.getEquip[0]) {
|
||||
case "sword1":
|
||||
hero.atk = hero.str + hero.agi;
|
||||
hero.magic = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//副手效果
|
||||
if (core.getEquip[1]) {
|
||||
switch (core.getEquip[1]) {
|
||||
case "sword1":
|
||||
hero.atk += hero.agi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//防具效果
|
||||
if (core.getEquip[2]) {
|
||||
switch (core.getEquip[2]) {
|
||||
case "sword1":
|
||||
hero.def = hero.con + hero.agi;
|
||||
hero.hpmax = 2.5 * hero.con;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//饰品效果
|
||||
if (core.getEquip[3]) {
|
||||
switch (core.getEquip[3]) {
|
||||
case "sword1":
|
||||
hero.speed += 0.4 * hero.int + 0.6 * hero.agi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateStatus = function () {
|
||||
const hero = core.status.hero;
|
||||
//默认映射关系
|
||||
hero.hpmax = hero.str * 50 + hero.con * 50;
|
||||
hero.atk = hero.str * 0.5 + hero.int * 0.5;
|
||||
hero.manamax = hero.agi * 0.5 + hero.int * 0.5;
|
||||
hero.def = hero.con * 0.5 + hero.agi * 0.5;
|
||||
hero.mdef = hero.con * 0.5 + hero.int * 0.5;
|
||||
hero.speed = hero.str * 0.5 + hero.agi * 0.5;
|
||||
hero.magic = false;
|
||||
this.statusEquip(); //处理装备效果
|
||||
for (let v in hero) { //归整
|
||||
if (typeof hero[v] === 'number') {
|
||||
hero[v] = Math.floor(hero[v])
|
||||
}
|
||||
}
|
||||
hero.hp = Math.min(hero.hp, hero.hpmax)
|
||||
hero.mana = Math.min(hero.mana, hero.manamax)
|
||||
core.status.hero = hero
|
||||
"旁白": function () {
|
||||
// 在此增加新插件
|
||||
const over = document.createElement('canvas'); //over画布设置
|
||||
over.style.position = 'absolute';
|
||||
over.style.zIndex = 310;
|
||||
over.style.display = "none"
|
||||
over.id = 'over';
|
||||
main.dom.gameGroup.insertAdjacentElement('afterend', over)
|
||||
over.style.top = "50%"
|
||||
over.style.left = "50%"
|
||||
over.style.transform = "translate(-50%,-50%)"
|
||||
const ctx = over.getContext("2d");
|
||||
main.dom.over = over;
|
||||
|
||||
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, () => {
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"回合制boss战": function () {
|
||||
// 在此增加新插件
|
||||
const boss = document.createElement('canvas'); //boss战画布设置
|
||||
boss.style.position = 'absolute';
|
||||
boss.style.zIndex = 300;
|
||||
boss.style.display = "none"
|
||||
boss.id = 'boss';
|
||||
main.dom.gameGroup.insertAdjacentElement('afterend', boss)
|
||||
boss.style.top = "50%"
|
||||
boss.style.left = "50%"
|
||||
boss.style.transform = "translate(-50%,-50%)"
|
||||
const ctx = boss.getContext("2d");
|
||||
main.dom.boss = boss;
|
||||
boss.onclick = function (e) {
|
||||
try {
|
||||
e.preventDefault();
|
||||
if (core.isPlaying()) return false;
|
||||
const left = core.dom.gameGroup.offsetLeft;
|
||||
const top = core.dom.gameGroup.offsetTop;
|
||||
const px = Math.floor((e.clientX - left) / core.domStyle.scale),
|
||||
py = Math.floor((e.clientY - top) / core.domStyle.scale);
|
||||
core.ui.boss.onclick(px * 3, py * 3);
|
||||
} catch (ee) {
|
||||
main.log(ee);
|
||||
core.clearMap(ctx)
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.save(); //保存设置
|
||||
ctx.translate(1248, 0) //重新定位右上角为基准
|
||||
ctx.rotate(Math.PI / 2) //旋转90度
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
}
|
||||
}
|
||||
class boss1 {
|
||||
constructor() {
|
||||
this.bg = ""
|
||||
}
|
||||
cavans() {
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.globalAlpha = 1
|
||||
|
||||
core.setTextAlign(ctx, 'center');
|
||||
if (img) { //绘制背景
|
||||
ctx.drawImage(img, 0, 0, 2028, 1248)
|
||||
|
||||
} else {
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248)
|
||||
}
|
||||
globalAlpha++
|
||||
ctx.globalAlpha = globalAlpha / hidetime
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
|
||||
|
||||
ctx.restore();
|
||||
if (globalAlpha >= hidetime) {
|
||||
core.unregisterAnimationFrame("overshow")
|
||||
if (sound && core.material.sounds[sound] && core.musicStatus.soundStatus) {
|
||||
core.playSound(sound, null, () => {
|
||||
core.registerAnimationFrame("overhide", true, () => {
|
||||
|
||||
core.clearMap(ctx)
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.save(); //保存设置
|
||||
ctx.translate(1248, 0) //重新定位右上角为基准
|
||||
ctx.rotate(Math.PI / 2) //旋转90度
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
}
|
||||
ctx.globalAlpha = 1
|
||||
if (img) { //绘制背景
|
||||
ctx.drawImage(img, 0, 0, 2028, 1248)
|
||||
|
||||
} else {
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248)
|
||||
}
|
||||
globalAlpha--
|
||||
ctx.globalAlpha = globalAlpha / hidetime
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
|
||||
|
||||
ctx.restore();
|
||||
if (globalAlpha <= 0) {
|
||||
over.style.display = 'none'
|
||||
core.unregisterAnimationFrame("overhide")
|
||||
core.unlockControl();
|
||||
core.doAction()
|
||||
}
|
||||
})
|
||||
})
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
setTimeout(() => {
|
||||
core.registerAnimationFrame("overhide", true, () => {
|
||||
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.clearMap(ctx)
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
ctx.save(); //保存设置
|
||||
ctx.translate(1248, 0) //重新定位右上角为基准
|
||||
ctx.rotate(Math.PI / 2) //旋转90度
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
}
|
||||
ctx.globalAlpha = 1
|
||||
if (img) { //绘制背景
|
||||
ctx.drawImage(img, 0, 0, 2028, 1248)
|
||||
|
||||
} else {
|
||||
core.fillRect(ctx, 0, 0, 2028, 1248)
|
||||
}
|
||||
globalAlpha--
|
||||
ctx.globalAlpha = globalAlpha / hidetime
|
||||
core.setTextAlign(ctx, 'center');
|
||||
core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, font)
|
||||
|
||||
ctx.restore();
|
||||
|
||||
if (globalAlpha <= 0) {
|
||||
|
||||
over.style.display = 'none'
|
||||
core.unregisterAnimationFrame("overhide")
|
||||
core.unlockControl();
|
||||
core.doAction();
|
||||
}
|
||||
})
|
||||
}, time)
|
||||
}
|
||||
|
||||
}
|
||||
start() {
|
||||
})
|
||||
|
||||
}
|
||||
onclick(px, py) {
|
||||
|
||||
}
|
||||
},
|
||||
"属性映射": function () {
|
||||
// 在此增加新插件
|
||||
this.statusEquip = function () {
|
||||
const hero = core.status.hero;
|
||||
//装备具体效果在这里写,道具填写道具类型为equip并选择装备类型,道具的装备属性中装备类型遵循以下填写方式:
|
||||
//固定装备孔的填写0/1/2/3,分别对应主手、副手、防具、饰品
|
||||
//主副手同时可使用的,填写 武器
|
||||
//具体的换装时装备切换操作写在新道具栏/物品栏插件
|
||||
//当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作
|
||||
//主武器效果
|
||||
if (core.getEquip[0]) {
|
||||
switch (core.getEquip[0]) {
|
||||
case "sword1":
|
||||
hero.atk = hero.str + hero.agi;
|
||||
hero.magic = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
core.ui.boss = new boss1()
|
||||
//副手效果
|
||||
if (core.getEquip[1]) {
|
||||
switch (core.getEquip[1]) {
|
||||
case "sword1":
|
||||
hero.atk += hero.agi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//防具效果
|
||||
if (core.getEquip[2]) {
|
||||
switch (core.getEquip[2]) {
|
||||
case "sword1":
|
||||
hero.def = hero.con + hero.agi;
|
||||
hero.hpmax = 2.5 * hero.con;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//饰品效果
|
||||
if (core.getEquip[3]) {
|
||||
switch (core.getEquip[3]) {
|
||||
case "sword1":
|
||||
hero.speed += 0.4 * hero.int + 0.6 * hero.agi;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateStatus = function () {
|
||||
const hero = core.status.hero;
|
||||
//默认映射关系
|
||||
hero.hpmax = hero.str * 50 + hero.con * 50;
|
||||
hero.atk = hero.str * 0.5 + hero.int * 0.5;
|
||||
hero.manamax = hero.agi * 0.5 + hero.int * 0.5;
|
||||
hero.def = hero.con * 0.5 + hero.agi * 0.5;
|
||||
hero.mdef = hero.con * 0.5 + hero.int * 0.5;
|
||||
hero.speed = hero.str * 0.5 + hero.agi * 0.5;
|
||||
hero.magic = false;
|
||||
this.statusEquip(); //处理装备效果
|
||||
for (let v in hero) { //归整
|
||||
if (typeof hero[v] === 'number') {
|
||||
hero[v] = Math.floor(hero[v])
|
||||
}
|
||||
}
|
||||
hero.hp = Math.min(hero.hp, hero.hpmax)
|
||||
hero.mana = Math.min(hero.mana, hero.manamax)
|
||||
core.status.hero = hero
|
||||
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
"回合制boss战": function () {
|
||||
// 在此增加新插件
|
||||
const boss = document.createElement('canvas'); //boss战画布设置
|
||||
boss.style.position = 'absolute';
|
||||
boss.style.zIndex = 300;
|
||||
boss.style.display = "none"
|
||||
boss.id = 'boss';
|
||||
main.dom.gameGroup.insertAdjacentElement('afterend', boss)
|
||||
boss.style.top = "50%"
|
||||
boss.style.left = "50%"
|
||||
boss.style.transform = "translate(-50%,-50%)"
|
||||
const ctx = boss.getContext("2d");
|
||||
main.dom.boss = boss;
|
||||
boss.onclick = function (e) {
|
||||
try {
|
||||
e.preventDefault();
|
||||
if (core.isPlaying()) return false;
|
||||
const left = core.dom.gameGroup.offsetLeft;
|
||||
const top = core.dom.gameGroup.offsetTop;
|
||||
const px = Math.floor((e.clientX - left) / core.domStyle.scale),
|
||||
py = Math.floor((e.clientY - top) / core.domStyle.scale);
|
||||
core.ui.boss.onclick(px * 3, py * 3);
|
||||
} catch (ee) {
|
||||
main.log(ee);
|
||||
}
|
||||
}
|
||||
class boss1 {
|
||||
constructor() {
|
||||
this.bg = ""
|
||||
}
|
||||
cavans() {
|
||||
if (core.domStyle.isVertical) {
|
||||
ctx.canvas.width = 1248;
|
||||
ctx.canvas.height = 2028;
|
||||
|
||||
core.setTextAlign(ctx, 'center');
|
||||
} else {
|
||||
ctx.canvas.width = 2028;
|
||||
ctx.canvas.height = 1248;
|
||||
|
||||
core.setTextAlign(ctx, 'center');
|
||||
}
|
||||
|
||||
}
|
||||
start() {
|
||||
|
||||
}
|
||||
onclick(px, py) {
|
||||
|
||||
}
|
||||
}
|
||||
core.ui.boss = new boss1()
|
||||
|
||||
|
||||
}
|
||||
}
|