Merge pull request 'CG' (#6) from CG into main

Reviewed-on: #6
This commit is contained in:
草莓 2024-12-08 10:12:35 +08:00
commit 7ca2ffbc86
67 changed files with 770 additions and 42 deletions

View File

@ -1 +1 @@
N4IgZgNg9lBOCSATEAuEBZAKgZhAGhAAsBTWKVUASwFsBDAc2NSNKgDoAHAO3vxFq41aAFyYowtCAGdiBLrWpiQAHQCuATgBs2bGoCsARgAs6vhABuqAwUIc6AD1Trn6mxysAGLwTryHqAFprEF9aVA8CEQBrTwiQRGIwWJ8EpJQ46iguYgBPcIJie3d0goBHVUo7Yi5hVABtAF0CSlFqKQoQAGMsqWEBYXaUUAAjGBiUYMg8iYBfAmEYaQo5kGJyysHgGZXoTo7HFFcQac0CREpYYk7hSizmCETalcgGTZAW4moAEWI+yghUMJYKpZCBVDIAEK/ADuxGqABlKPRCLUUECQQQAPqYmTERDYqzYdTYPTqIwADj02CxmNgAnxmMJxNJFKpNlosGQExphA5iAAwlBoLACWhYPRhrQABSaIx4ABMej0eEpeAMAEo+NiPtQABKUGqixo0h60czEeFQTqi0BYDwdc6Xa63LjMWBIlF8A4GeUEE7bAjDGFwrgAQWEfU6US+IjCKC4qggEBp5koUg+DI6dsBwNBWFwaNzAfAQugsNgg2NIF6xA4g2p1b6N16lE6bwWfQgmBoYnJWhMRj0RjY8pcAHYh3KuqpYLBu4pUCTnGwp7Z8iBJRGHuvMtlpnFCsU4pvhA8Y3RGOuOFA01lzwwxAf7EDaPfLyUQlBzV8LldT9NlXeeguDgYgAGVRDrVB5V9RsOVRTQPFJNhsGLXlOWYABRWgpDyHxaCgoYVjIVRRGYeEkHoAANUNhlDeB6EwdBQ06ABNTB6OhUMAC0AGkOG40MwKkUMuAAKVDfkjFDHJWIARVDABeRS+HMSQQU2FZzQrF1mDUdRiGwRB9GGPQPDUMdaHUYyNA8eVzNUPRKSMfROg8MB9M0AwkgIegKi5EBNGGIxiGGRAx3JTEDFoIxaExIwwDHdRMXJRBsGGTEqT0eVEiMRBEDAMk+BuBcJjHbBRxJTQlTHCKZiAA===
N4IgZgNg9lBOCSATEAuEBZAKgZhAGhAAsBTWKVUASwFsBDAc2NSNKgDoAHAO3vxFq41aAFyYowtCAGdiBLrWpiQAHQCuATgBs2bGoCsARgAs6vhABuqAwUIc6AD1Trn6mxysAGLwTryHqAFprEF9aVA8CEQBrTwiQRGIwWJ8EpJQ46iguYgBPcIJie3d0goBHVUo7Yi5hVABtAF0CSlFqKQoQAGMsqWEBYXaUUAAjGBiUYMg8iYBfAmEYaQo5kGJyysHgGZXoTo7HFAB2AmnNAkRKWGJO4Uos5lhKekJalcgGTZAW4moAEWI+pQIKhhLBVLIQKoZAAhAEAd2I1QAMk8XiCwRCAPqYmTERDY1AADk0miMhz0RmMBGxsAE+MxRJJZIpVP4V1ogzqoD8SjUhwATJp+Xz+WADHw6BxORhMB4+FhcAQsOKlZh+fLMEYNXoQA05tyFLzVIdCcY+bRDpo1EKjHKfLQpfUZZpdfqQDzmGojMQPMN9J0jOr7Y6UHUZYcNYSNaZVQY7TKDOK9XgDYpPapvb7/YGJQ7pQBhWg0QhQNPJ1NGzN+1R6ANBkJ5p0AK0oqnoqgErqaRFosGQJRA2MIvcQ+ag0FgBLQV2Q1Mx32oAAlKDUp405xBiLRzMQkVBOlPQFg5UN4pdrrd7tPUbUCAcDPyTqhNNsCMN4YiuABBYR9TpRX4RDCFAuFUCAIDncxKCkb56Q6Y90XBVVcBQUFwVfcBx2gBFYE5btemIEMjAIXoRGg25Ok+BY+ggTAaDEflCQFYlDnJNg9HUQU9A8Y4ulUWBYDotMUCMPRDiMNh+RcaTpLcfIQGGERhE3eTMmyaY4kKYo4kU39N0AuhGHkjgoGgrIDIYMRNPsUFaAsoyB0yHdfnPG4IGmR8vnoLg4GIABlUQQzjEi+lgWojmwdRsEkjDhz7ZhcxDLYCDIVRRGYJF4AAJXoX4vwADS/YYvz8+hMHQL9YAAOWIAqAHEAFF6AAXj4cxJHBTYVh3XC7i4dN1GIbBEH0YZuPNdQRo0Dx+Q8fRCQpf0PDANQtAMJICHbSh+xATRhm9YZEBNTEDFoIxaExIwwEOdRMUJRBsGGTE9GwPR+USIxEEQMB1C1eZ6KsQ4dD0TQbqMQkPBBmYgA=

View File

@ -949,7 +949,10 @@ action
| function_s
| changeMouse_s
| removeMouse_s
| drawWarning_s
| addPop_s
| playStereo_s
| moveStereo_s
| pass_s
;
@ -1827,6 +1830,20 @@ var code = '{"type": "sleep", "time": '+Int_0+Bool_0+'},\n';
return code;
*/;
drawWarning_s
: '警告坐标x' PosString 'y' PosString '警告内容' EvalString? '副标题' EvalString? '不播放音效' Bool? Newline
/* drawWarning_s
tooltip : drawWarning: 绘制warning警告并拉进镜头,本事件为异步事件,下一事件将在3100ms后执行
helpUrl : /_docs/#/instruction
default : [0, 0,"这里是提示内容","绿色史莱姆",false]
colour : this.soundColor
selectPoint : ["PosString_0", "PosString_1"]
var code = '{"type": "drawWarning", "x": '+PosString_0+', "y": '+PosString_1+', "text": "'+EvalString_0+'", "text2": "'+EvalString_1+'", "warning": '+Bool_0+'},\n';
return code;
*/;
changeMouse_s
: '鼠标指针变更为' EvalString '在' Div_List? BGNL? Newline
'画布偏移X' Number? '画布偏移Y' Number? 'X轴缩放' Number? 'Y轴缩放' Number '顺时针转角' Number '点击X偏移' Number '点击Y偏移' Number Newline
@ -2652,6 +2669,39 @@ var code = '{"type": "playSound", "name": "'+EvalString_0+'"'+Bool_0+IntString_0
return code;
*/;
playStereo_s
: '播放音效(立体音)' EvalString '左声道音量' Int '右声道音量' Int '启用立体音' Bool? Newline
/* playStereo_s
tooltip : playSound: 播放音效(立体音)
helpUrl : /_docs/#/instruction
default : ["item.mp3",1,1,true]
colour : this.imageColor
allSounds : ['EvalString_0']
material : ["./project/sounds/", "EvalString_0"]
var code = '{"type": "playStereo", "name": "'+EvalString_0+'", "left": '+Int_0+', "right": '+Int_1+', "split": '+Bool_0+'},\n';
return code;
*/;
moveStereo_s
: '播放渐变音效(立体音)' EvalString '左声道音量' Int '右声道音量' Int '启用立体音' Bool? BGNL? Newline
'左声道目标音量' Int '右声道目标音量' Int '渐变时长'Int Newline
/* moveStereo_s
tooltip : playSound: 播放渐变音效(立体音)
helpUrl : /_docs/#/instruction
default : ["item.mp3",1,1,true,10,10,1000]
colour : this.imageColor
allSounds : ['EvalString_0']
material : ["./project/sounds/", "EvalString_0"]
var code = '{"type": "moveStereo", "name": "'+EvalString_0+'", "left": '+Int_0+', "right": '+Int_1+', "split": '+Bool_0+', "leftTo": '+Int_2+', "rightTo": '+Int_3+', "time": '+Int_4+'},\n';
return code;
*/;
playSound_1_s
: '播放系统音效' NameMap_List '停止之前音效' Bool? '音调' IntString? '等待播放完毕' Bool? Newline

View File

@ -706,6 +706,14 @@ ActionParser.prototype.parseAction = function() {
data.loc[0],data.loc[1],data.which,data.floorId||'',data.args||"",this.next]);
}
break;
case "playStereo":
this.next = MotaActionBlocks['playStereo_s'].xmlText([
data.name, data.left, data.right, data.split||true,this.next]);
break
case "moveStereo":
this.next = MotaActionBlocks['moveStereo_s'].xmlText([
data.name, data.left, data.right, data.split||true,data.leftTo, data.rightTo, data.time,this.next]);
break
case "playSound":
var knownItems = MotaActionBlocks['NameMap_List'].options.map(function (one) {return one[1];});
if (knownItems.indexOf(data.name) >= 0) {
@ -980,6 +988,11 @@ ActionParser.prototype.parseAction = function() {
this.next = MotaActionBlocks['stopAsync_s'].xmlText([
this.next]);
break;
case "drawWarning":
this.next = MotaActionBlocks['drawWarning_s'].xmlText([
data.x,data.y,data?.text,data?.text2,data?.warning,this.next]);
break;
case "changeMouse":
this.next = MotaActionBlocks['changeMouse_s'].xmlText([

File diff suppressed because one or more lines are too long

View File

@ -32,13 +32,68 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"bear.png",
"bg.jpg",
"bg2.jpg",
"bg_1511.png",
"bg_1521.png",
"bg_2010.png",
"bg_2011.png",
"bg_2521.png",
"bg_3042.png",
"bg_3551.png",
"bg_3571.png",
"bg_3721.png",
"bg_5033.png",
"bg_5043.png",
"bg_5044.png",
"brave.png",
"d.png",
"dl.png",
"dlr.png",
"dr.png",
"dragon.png",
"eve_010102.png",
"eve_010203.png",
"eve_010304.png",
"eve_010501.png",
"eve_010601.png",
"eve_010701.png",
"eve_010801.png",
"eve_010902.png",
"eve_011001.png",
"eve_011101.png",
"eve_011202.png",
"eve_011302.png",
"eve_011402.png",
"eve_020102.png",
"eve_020201.png",
"eve_020301.png",
"eve_020401.png",
"eve_020501.png",
"eve_020605.png",
"eve_020701.png",
"eve_020801.png",
"eve_030101.png",
"eve_030206.png",
"eve_030302.png",
"eve_030508.png",
"eve_030601.png",
"eve_030801.png",
"eve_030901.png",
"eve_031002.png",
"eve_031101.png",
"eve_040201.png",
"eve_040401.png",
"eve_040501.png",
"eve_040601.png",
"eve_040702.png",
"eve_040801.png",
"eve_050101.png",
"eve_050201.png",
"eve_050401.png",
"eve_050501.png",
"eve_050601.png",
"eve_050704.png",
"eve_050801.png",
"eve_070101.png",
"green.png",
"h25.png",
"hero.png",
@ -79,6 +134,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"3.png",
"2.png",
"1.png",
"11.png",
"6.png",
"12.png",
"Outside_B.png",
@ -118,6 +174,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"gem.mp3",
"icePickaxe.mp3",
"item.mp3",
"jingbao.mp3",
"jump.mp3",
"load.mp3",
"open_ui.mp3",

View File

@ -63,5 +63,11 @@ main.floors.MT2=
"fgmap": [
],
"areas": "牢狱"
"areas": "牢狱",
"bg2map": [
],
"fg2map": [
]
}

View File

@ -59,5 +59,11 @@ main.floors.MT6=
"fgmap": [
],
"areas": "研究所"
"areas": "研究所",
"bg2map": [
],
"fg2map": [
]
}

View File

@ -15,7 +15,47 @@ main.floors.jiuguan=
"firstArrive": [],
"eachArrive": [],
"parallelDo": "",
"events": {},
"events": {
"4,6": [
{
"type": "drawWarning",
"x": 9,
"y": 5,
"text": "本区域领袖",
"text2": "绿色史莱姆",
"warning": false
},
{
"type": "playStereo",
"name": "item.mp3",
"left": 1,
"right": 6,
"split": true
},
{
"type": "move",
"loc": [
9,
5
],
"time": 500,
"keep": true,
"steps": [
"up:1"
]
},
{
"type": "moveStereo",
"name": "jingbao.mp3",
"left": 4,
"right": 10,
"split": true,
"leftTo": 10,
"rightTo": 4,
"time": 2000
}
]
},
"changeFloor": {},
"beforeBattle": {},
"afterBattle": {},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

After

Width:  |  Height:  |  Size: 3.5 MiB

BIN
project/images/bg_1511.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
project/images/bg_1521.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
project/images/bg_2010.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

BIN
project/images/bg_2011.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
project/images/bg_2521.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

BIN
project/images/bg_3042.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
project/images/bg_3551.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
project/images/bg_3571.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
project/images/bg_3721.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
project/images/bg_5033.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

BIN
project/images/bg_5044.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 992 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@ -16,6 +16,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.addPop(data.value, data.px, data.py, data.color, data.boldColor, data.left, data.jump, data.time, data.show, data.font, data.speed)
core.doAction()
})
core.registerEvent("drawWarning", function (data) {
core.drawWarning(data.x, data.y, data?.text, data?.text2, data?.warning)
setTimeout(() => core.doAction(), 3100)
})
core.registerEvent("playStereo", function (data) {
core.playStereo(data.name, data.left, data.right, data.split)
core.doAction()
})
core.registerEvent("moveStereo", function (data) {
const id = core.playStereo(data.name, data.left, data.right, data.split)
core.moveStereo(id, data.leftTo, data.rightTo, data.time)
core.doAction()
})
}
},
"drawLight": function () {
@ -2502,19 +2515,32 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
return;
}
const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3])
const mapBox = makeBox([MAP_BLOCK_LEFT_VERTICAL, MAP_BLOCK_TOP_VERTICAL], [350, 350])
if (inRect(pos, mapBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
return;
}
/*const equipBox = makeBox([EQUIP_BLOCK_LEFT_VERTICAL, EQUIP_BLOCK_TOP_VERTICAL], [90 * 3, 130 * 3])
if (inRect(pos, equipBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.openEquipbox(true)
return;
}
}*/
} else {
const equipBox = makeBox([EQUIP_BLOCK_LEFT, EQUIP_BLOCK_TOP], [130, 95])
if (inRect(pos, equipBox)) {
const mapBox = makeBox([MAP_BLOCK_LEFT, MAP_BLOCK_TOP], [350, 350])
if (inRect(pos, mapBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.openEquipbox(true)
core.ui._drawViewMaps(core.floorIds.indexOf(core.status.floorId))
return;
}
/*
const equipBox = makeBox([EQUIP_BLOCK_LEFT, EQUIP_BLOCK_TOP], [130, 95])
if (inRect(pos, equipBox)) {
if (core.isReplaying() || core.status.lockControl || core.isMoving()) return;
core.openEquipbox(true)
return;
}*/
const itemBox = makeBox([ITEM_BOX_LEFT, ITEM_BOX_TOP], [31 * 4 * 3, 30 * 6 * 3]);
if (inRect(pos, itemBox)) {
const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [31 * 3, 30 * 3]);
@ -7208,6 +7234,7 @@ core.plugin.animate = {
}),
MotaActionBlocks['waitAsync_s'].xmlText(),
MotaActionBlocks['stopAsync_s'].xmlText(),
MotaActionBlocks['drawWarning_s'].xmlText(),
MotaActionBlocks['changeMouse_s'].xmlText(),
MotaActionBlocks['removeMouse_s'].xmlText(),
MotaActionBlocks['vibrate_s'].xmlText(),
@ -7240,6 +7267,8 @@ core.plugin.animate = {
MotaActionBlocks['scaleImage_s'].xmlText(),
MotaActionBlocks['showGif_s'].xmlText(),
MotaActionBlocks['playBgm_s'].xmlText(),
MotaActionBlocks['playStereo_s'].xmlText(),
MotaActionBlocks['moveStereo_s'].xmlText(),
MotaActionBlocks['pauseBgm_s'].xmlText(),
MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['loadBgm_s'].xmlText(),
@ -8074,7 +8103,7 @@ core.plugin.animate = {
core.fillRect(ctx, sx, sy, sw, sh, '#000')
core.strokeRect(ctx, sx, sy, sw, sh, '#fff', 5)
core.setTextAlign('outerUI', 'center')
core.fillText(ctx, core.status.maps[center].areas, sx + sw / 2, sy - 20, '#FFFFFF', 'bold 42px Verdana')
core.fillText(ctx, core.status.maps[center].areas, sx + sw * 3 / 8, sy - 10, '#FFFFFF', 'bold 42px Verdana')
const locs = info.locs
for (const id in locs) {
const loc = locs[id];
@ -8663,8 +8692,8 @@ core.plugin.animate = {
CGUI.style.transform = "translate(-50%,-50%)"
const ctx = CGUI.getContext("2d");
main.dom.CGUI = CGUI;
let page = 0; // 当前页面变量
let select = 'view'; // 'view'为浏览模式,'zoom'为放大模式
let page = 0; //初始页面
let show = false; //展示状态
CGUI.onclick = function (e) {
try {
e.preventDefault();
@ -8765,10 +8794,43 @@ core.plugin.animate = {
constructor() {
//cg列表
this.UIMx = [ //空位用none填充当前ui至多4列6行
["none", "none", 'none'],
["none", "none", "none"],
["none", "none", "none"],
];
[
["eve_010102.png", "eve_010203.png", 'eve_010304.png'],
["eve_010501.png", "eve_010601.png", "eve_010701.png"]
],
[
["eve_010801.png", "eve_010902.png", 'eve_011001.png'],
["eve_011101.png", "eve_011202.png", "eve_011302.png"]
],
[
["eve_011402.png", "eve_020102.png", 'eve_020201.png'],
["eve_020301.png", "eve_020401.png", "eve_020501.png"]
],
[
["eve_020605.png", "eve_020701.png", 'eve_020801.png'],
["eve_030101.png", "eve_030206.png", "eve_030302.png"]
],
[
["eve_030508.png", "eve_030601.png", 'eve_030801.png'],
["eve_030901.png", "eve_031002.png", "eve_031101.png"]
],
[
["eve_040201.png", "eve_040401.png", 'eve_040501.png'],
["eve_040601.png", "eve_040702.png", "eve_040801.png"]
],
[
["eve_050101.png", "eve_050201.png", 'eve_050401.png'],
["eve_050501.png", "eve_050601.png", "eve_050704.png"]
],
[
["eve_050801.png", "eve_070101.png", 'bg_1511.png'],
["bg_1521.png", "bg_2011.png", "bg_2521.png"]
],
[
["bg_3042.png", "bg_3551.png", 'bg_3571.png'],
["bg_3721.png", "bg_5033.png", "bg_5044.png"]
]
]
}
//更新
@ -8792,20 +8854,197 @@ core.plugin.animate = {
}
onclick(px, py) { //点击
console.log([px, py])
if (px >= 33 && px <= 177 && py >= 33 && py <= 177) { //离开按钮是一致的,其余的记区分横竖屏
if (show) {
show = !show
core.clearMap(ctx);
this.update();
return
}
console.log([px, py]);
const makeBox = ([x, y], [w, h]) => {
return [
[x, y],
[x + w, y + h]
];
}
const inRect = ([x, y], [
[sx, sy],
[dx, dy]
]) => {
return sx <= x && x <= dx && sy <= y && y <= dy;
};
const pos = [px, py];
const backbox = makeBox([33, 33], [144, 144])
if (inRect(pos, backbox)) { //离开按钮是一致的,其余的记区分横竖屏
CGUI.style.display = "none"
core.clearMap(ctx)
core.restart();
return
}
if (select === 'view') {
// 浏览模式,点击切换页面
page = (page + 1) % main.core.ui.CG.UIMx.length;
main.core.ui.CG.update();
} else if (select === 'zoom') {
// 放大模式,点击清空画布重绘当前页面
core.clearMap(ctx);
main.core.ui.CG.drawUI();
if (core.domStyle.isVertical) {
//竖屏
const pageupbox = makeBox([30, 380], [144, 144])
const pagedownbox = makeBox([30, 1080], [144, 144])
const imagebox0 = makeBox([200, 300], [480, 320])
const imagebox1 = makeBox([200, 750], [480, 320])
const imagebox2 = makeBox([200, 1200], [480, 320])
const imagebox3 = makeBox([700, 300], [480, 320])
const imagebox4 = makeBox([700, 850], [480, 320])
const imagebox5 = makeBox([700, 1300], [480, 320])
if (inRect(pos, pagedownbox)) {
//2代表当前最大页数-1
if (page < this.UIMx.length - 1) {
page++;
core.clearMap(ctx);
this.update();
}
} else if (inRect(pos, pageupbox)) {
if (page > 0) {
page--;
core.clearMap(ctx);
this.update();
}
} else if (inRect(pos, imagebox0)) {
const img = core.material.images.images[this.UIMx[page][0][0]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox1)) {
const img = core.material.images.images[this.UIMx[page][0][1]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox2)) {
const img = core.material.images.images[this.UIMx[page][0][2]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox3)) {
console.log(3)
const img = core.material.images.images[this.UIMx[page][1][0]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox4)) {
const img = core.material.images.images[this.UIMx[page][1][1]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox5)) {
const img = core.material.images.images[this.UIMx[page][1][2]]
if (img) {
ctx.save(); //保存设置
ctx.translate(1248, 0) //重新定位右上角为基准
ctx.rotate(Math.PI / 2) //旋转90度
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
}
} else {
const pageupbox = makeBox([30, 340], [144, 144])
const pagedownbox = makeBox([30, 840], [144, 144])
const imagebox0 = makeBox([300, 300], [480, 320])
const imagebox1 = makeBox([800, 300], [480, 320])
const imagebox2 = makeBox([1300, 300], [480, 320])
const imagebox3 = makeBox([300, 750], [480, 320])
const imagebox4 = makeBox([800, 750], [480, 320])
const imagebox5 = makeBox([1300, 750], [480, 320])
if (inRect(pos, pageupbox)) {
if (page < this.UIMx.length - 1) {
page++;
core.clearMap(ctx);
this.update();
}
} else if (inRect(pos, pagedownbox)) {
if (page > 0) {
page--;
core.clearMap(ctx);
this.update();
}
} else if (inRect(pos, imagebox0)) {
const img = core.material.images.images[this.UIMx[page][0][0]]
if (img) {
ctx.save(); //保存设置
ctx.translate(0, 0) //重新定位右上角为基准
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox1)) {
const img = core.material.images.images[this.UIMx[page][0][1]]
if (img) {
ctx.save(); //保存设置
ctx.translate(0, 0) //重新定位右上角为基准
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox2)) {
const img = core.material.images.images[this.UIMx[page][0][2]]
if (img) {
ctx.save(); //保存设置
ctx.translate(0, 0) //重新定位右上角为基准
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox3)) {
const img = core.material.images.images[this.UIMx[page][1][0]]
if (img) {
ctx.save(); //保存设置
ctx.translate(0, 0) //重新定位右上角为基准
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox4)) {
const img = core.material.images.images[this.UIMx[page][1][1]]
if (img) {
ctx.save(); //保存设置
ctx.translate(0, 0) //重新定位右上角为基准
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
} else if (inRect(pos, imagebox5)) {
const img = core.material.images.images[this.UIMx[page][1][2]]
if (img) {
ctx.save(); //保存设置
ctx.translate(0, 0) //重新定位右上角为基准
ctx.drawImage(img, 0, 0, 2028, 1248)
ctx.restore(); //重置画布设置
show = !show;
}
}
}
}
drawUI() {
@ -8815,31 +9054,38 @@ core.plugin.animate = {
//core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028);
core.fillRect(ctx, 0, 0, 1248, 2028, "#000000") //黑色背景
ctx.globalAlpha = 0.5 //透明度
drawImage(ctx, "backgroundvertical.png", 0, 0, 1280, 1500, 0, 0, 1248, 2028) //绘制半透明背景图片
drawImage(ctx, "bg_2010.png", 0, 0, 1280, 1500, 0, 0, 1248, 2028) //绘制半透明背景图片
ctx.globalAlpha = 1 //恢复为不透明
core.setTextAlign(ctx, 'center');
core.fillRoundRect(ctx, 45 - 6, 45 - 6, 120 + 12, 80 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 45 - 12, 45 - 12, 120 + 24, 80 + 24, 12, "#444444", 3);
core.fillText(ctx, '离开', 100, 110, '#FFFFFF', core.ui._buildFont(33, true));
/*
// 添加向上翻页和向下翻页的按钮
core.fillRoundRect(ctx, 100 - 6, 100 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 100 - 12, 100 - 12, 120 + 24, 120 + 120, 12, "#444444", 3);
core.fillText(ctx, '向上翻页', 100, 250, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, '向下翻页', 100, 1500, '#FFFFFF', core.ui._buildFont(24, true));
core.fillRoundRect(ctx, 45 - 6, 400 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 45 - 12, 400 - 12, 120 + 24, 120 + 12, 12, "#444444", 3);
core.fillRoundRect(ctx, 45 - 6, 1100 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 45 - 12, 1100 - 12, 120 + 24, 120 + 12, 12, "#444444", 3);
core.fillText(ctx, '向上翻页', 100, 450, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, '向下翻页', 100, 1150, '#FFFFFF', core.ui._buildFont(24, true));
// 添加3*2个4:3的画框
// 添加3*2个4:3的画框,及图片
for (let i = 0; i < 3; i++) {
for (let j = 0; j < 2; j++) {
core.strokeRect(ctx, 200 + j * 200, 300 + i * 300, 160, 120, "#FFFFFF", 2);
core.fillRect(ctx, 200 + j * 200, 300 + i * 300, 160, 120, '#FFFFFF');
const img = core.material.images.images[this.UIMx[page][j][i]]
core.strokeRect(ctx, 200 + j * 500, 300 + i * 450, 480, 320, "#444444", 5);
if (img) ctx.drawImage(img, 200 + j * 500 + 15, 300 + i * 450 + 15, 480 - 30, 320 - 30)
}
}
// 添加浏览模式和CG模式的字样
/*
core.fillRoundRect(ctx, 350 - 6, 120 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 350 - 12, 120 - 12, 120 + 24, 120 + 12, 12, "#444444", 3);
core.fillRoundRect(ctx, 950 - 6, 120 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 950 - 12, 120 - 12, 120 + 24, 120 + 12, 12, "#444444", 3);
core.fillText(ctx, '浏览模式', 400, 180, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, 'CG模式', 1200, 180, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, 'CG模式', 1000, 180, '#FFFFFF', core.ui._buildFont(24, true));
*/
} else { //横屏
core.fillRect(ctx, 0, 0, 2028, 1248, "#000000") //黑色背景
@ -8862,19 +9108,22 @@ core.plugin.animate = {
// 添加3*2个4:3的画框
for (let i = 0; i < 2; i++) {
for (let j = 0; j < 6; j++) {
core.fillRect(ctx, 200 + j * 300, 350 + i * 450, 240, 160, '#FFFFFF');
core.strokeRect(ctx, 200 + j * 300, 350 + i * 450, 240, 160, "#444444", 2);
for (let j = 0; j < 3; j++) {
core.strokeRect(ctx, 300 + j * 500, 300 + i * 450, 480, 320, "#444444", 2);
const img = core.material.images.images[this.UIMx[page][i][j]]
if (img) ctx.drawImage(img, 300 + j * 500 + 15, 300 + i * 450 + 15, 480 - 30, 320 - 30)
}
}
// 添加浏览模式和CG模式的字样
/*
core.fillRoundRect(ctx, 550 - 6, 45 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 550 - 12, 45 - 12, 120 + 24, 120 + 24, 12, "#444444", 3);
core.fillText(ctx, '浏览模式', 600, 100, '#FFFFFF', core.ui._buildFont(24, true));
core.fillRoundRect(ctx, 1150 - 6, 45 - 6, 120 + 12, 120 + 12, 6, '#444444');
core.strokeRoundRect(ctx, 1150 - 12, 45 - 12, 120 + 24, 120 + 24, 12, "#444444", 3);
core.fillText(ctx, 'CG模式', 1200, 100, '#FFFFFF', core.ui._buildFont(24, true));
core.fillText(ctx, 'CG模式', 1200, 100, '#FFFFFF', core.ui._buildFont(24, true))
*/
}
@ -8884,7 +9133,7 @@ core.plugin.animate = {
core.ui.CG = new CG();
main.dom.CGMode.onclick = function () {
main.core.control.checkBgm();
page = 0
CGUI.style.display = "block"
main.core.ui.CG.update()
}
@ -8966,5 +9215,288 @@ core.plugin.animate = {
if (!core.status.pop) core.status.pop = [data];
else core.status.pop.push(data);
}
},
"warning": function () {
// 在此增加新插件
// 默认音效名
var defaultSound = 'jingbao.mp3';
// 默认字体名
var defaultFont = 'Verdana';
var timeout;
/** warning
* @param {number} x 横坐标
* @param {number} y 纵坐标
* @param {string} text 显示的文字
*/
this.drawWarning = function (x, y, text, text2, warning) {
if (timeout) return;
x = x ?? 6;
y = y ?? 6;
text = text || 'boss';
text += '</br>';
for (var i = 0; i < 10; i++) text += ' ';
text += text2;
// 生成文字
var elements = document.querySelectorAll('.gameCanvas');
var t = document.createElement('p');
t.innerHTML = text;
t.style.position = 'absolute';
t.style.fontSize = '4em';
t.style.left = -(300 * core.domStyle.scale) + 'px';
t.style.top = (parseInt(elements[0].style.height) / 2 - 100) + 'px';
t.style.zIndex = '300';
t.style.color = '#f11';
t.style.fontFamily = defaultFont;
t.style.overflow = 'none';
t.style.width = '100%';
t.classList.add('warning');
core.dom.gameDraw.appendChild(t);
setTimeout(function () { t.style.left = (416 * core.domStyle.scale) + 'px' }, 50);
// 计算偏移量
var px = (6 - x) / 12 * 50;
var py = (6 - y) / 12 * 50;
// 修改画布的scale和transform
elements.forEach(function (v) {
if (v instanceof HTMLCanvasElement) {
v.style.transform = 'scale(2)translate(' + px + '%, ' + py + '%)';
}
});
if (!warning) core.playSound(defaultSound);
// 拉回镜头
timeout = setTimeout(function () {
timeout = setTimeout(function () {
timeout = void 0;
core.dom.gameDraw.removeChild(t);
}, 1500);
elements.forEach(function (v) {
if (v instanceof HTMLCanvasElement) {
v.style.transform = 'none';
}
});
}, 1600);
}
},
"立体声音效": function () {
// 在此增加新插件
// 音效双声道播放
var can = true;
if (!AudioContext) {
console.warn('该浏览器不支持AudioContext无法播放立体声');
can = false
}
if (can) var ac = new AudioContext();
var datas = {};
/** 播放立体声 参考https://developer.mozilla.org/zh-CN/docs/Web/API/BaseAudioContext/createChannelSplitter
* @param {number} name 音效名
* @param {number} left 左声道音量默认为1
* @param {number} right 右声道音量默认为1
* @param {boolean} split 音效为双声道请填true为单声道请填false或不填
* @returns 该音效的唯一id
*/
this.playStereo = function (name, left, right, split) {
if (!can) return core.playSound(name);
var sound = core.getMappedName(name);
if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound]) return;
if (!core.status.stereo) core.status.stereo = {};
var buffer = core.material.sounds[sound];
var source = ac.createBufferSource();
source.buffer = buffer;
var splitter = ac.createChannelSplitter(2);
source.connect(splitter);
var merger = ac.createChannelMerger(2);
/*
gain(L)
/ \
source ---- splitter merger ---- destination
\ /
gain(R)
*/
var L = ac.createGain();
var R = ac.createGain();
L.gain.value = left * core.musicStatus.userVolume;
R.gain.value = right * core.musicStatus.userVolume;
splitter.connect(L, 0, 0);
if (!split) splitter.connect(R, 0, 0);
else splitter.connect(R, 1, 0);
var id = setTimeout(null);
core.status.stereo[id] = { source: source, L: L, R: R };
L.connect(merger, 0, 0);
R.connect(merger, 0, 1);
var dest = ac.destination;
source.onended = function () {
delete datas[id];
source = void 0;
}
merger.connect(dest);
source.start(0);
return id;
}
/**
* @param {number} id 为playStereo返回的id
* @param {number} left 要渐变到的左声道音量
* @param {number} right 要渐变到的右声道音量
* @param {number} time 渐变时间
*/
this.moveStereo = function (id, left, right, time) {
if (!can) return;
if (main.mode != 'play' || !core.musicStatus.soundStatus) return;
var stereo = core.status.stereo[id];
datas[id] = {
time: time,
curr: 0,
dL: (left - stereo.L.gain.value) / time * 10 * core.musicStatus.userVolume,
dR: (right - stereo.R.gain.value) / time * 10 * core.musicStatus.userVolume
};
var interval = setInterval(function () {
var data = datas[id];
if (!data) return clearInterval(interval);
data.curr += 10;
if (data.curr >= data.time) {
clearInterval(interval);
datas[id] = void 0;
}
stereo.L.gain.value += data.dL;
stereo.R.gain.value += data.dR;
}, 10);
}
},
"滑动转场": function () {
// 在此增加新插件
const defaultChange = {
left: 'leftPortal', // 左箭头
up: 'upPortal', // 上箭头
right: 'rightPortal', // 右箭头
down: 'downPortal', // 下箭头
upFloor: 'upFloor', // 上楼
downFloor: 'downFloor' // 下楼
};
const dirData = {
up: [-1, 0],
down: [1, 0],
left: [0, -1],
right: [0, 1],
upFloor: [0, 0],
downFloor: [0, 0]
}
let allChangeEntries = Object.entries(defaultChange)
const move = document.createElement('canvas');
const speed = 12;
let modedata = 0;
move.width = 1248;
move.height = 1248;
const ctx = move.getContext("2d");
events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback) {
let block = core.getBlock(hero.loc.x, hero.loc.y)
var info = this._changeFloor_getInfo(floorId, stair, heroLoc, time);
if (info == null) {
if (callback) callback();
return;
}
floorId = info.floorId;
info.locked = core.status.lockControl;
core.dom.floorNameLabel.innerText = core.status.maps[floorId].title;
core.lockControl();
core.stopAutomaticRoute();
core.clearContinueAutomaticRoute();
core.status.replay.animate = true;
clearInterval(core.interval.onDownInterval);
core.interval.onDownInterval = 'tmp';
this._changeFloor_beforeChange(info, block, callback);
}
events.prototype._changeFloor_beforeChange = function (info, block, callback) {
this._changeFloor_playSound();
if (block && block?.event) {
const dirEntries = allChangeEntries.find(v => v[1] === block.event.id);
if (block?.event?.trigger === 'changeFloor' && dirEntries) {
const toFloorId = block.event.data.floorId;
const dir = dirEntries[0];
const data = core.ui._drawViewMaps_buildData(core.floorIds.indexOf(core.status.floorId))
const dataTo = core.ui._drawViewMaps_buildData(core.floorIds.indexOf(toFloorId))
const v = dirData[dir][1], // 水平数值
h = dirData[dir][0]; //竖直数值
ctx.clearRect(0, 0, 1248, 1248)
core.drawThumbnail(core.status.floorId, null, { damage: data.damage, ctx: ctx, x: 416, y: 416, size: 1, all: data.all })
if (dir !== "upFloor" && dir !== "downFloor") {
core.drawThumbnail(toFloorId, null, { damage: dataTo.damage, ctx: ctx, x: 416 + 416 * v, y: 416 + 416 * h, size: 1, all: dataTo.all })
var _run = function () {
var cb = function () {
modedata = 0
core.clearUI();
core.clearMap('data')
core.events._changeFloor_changing(info, callback)
}
var animate = window.setInterval(function () {
if (modedata >= 416) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
cb();
} else {
core.clearUI();
core.clearMap('data')
core.canvas.data.drawImage(move, 416 + modedata * v, 416 + modedata * h, 416, 416, 0, 0, 416, 416)
let status = "leftFoot";
if (modedata > 208) {
status = "rightFoot";
}
const img = core.material.images.hero;
const heroIconArr = core.material.icons.hero;
const width = core.material.icons.hero.width || 32;
const height = core.material.icons.hero.height;
const heroIcon = heroIconArr[dir];
core.canvas.data.drawImage(img, heroIcon[status] % 4 * width, heroIcon.loc * height, width, height, core.status.hero.loc.x * 32 - core.bigmap.offsetX - (modedata - modedata * 32 / 416) * v, core.status.hero.loc.y * 32 - 16 - (modedata - modedata * 32 / 416) * h, width, height)
modedata += speed
clearInterval(animate);
delete core.animateFrame.asyncId[animate];
_run();
}
}, core.status.replay.speed == 24 ? 1 : 10 / core.status.replay.speed);
core.animateFrame.lastAsyncId = animate;
core.animateFrame.asyncId[animate] = cb;
}
_run();
return
}
}
}
// 需要 setTimeout 执行,不然会出错
window.setTimeout(function () {
if (info.time == 0)
core.events._changeFloor_changing(info, callback);
else
core.showWithAnimate(core.dom.floorMsgGroup, info.time / 2, function () {
core.events._changeFloor_changing(info, callback);
});
}, 25)
}
}
}

BIN
project/sounds/jingbao.mp3 Normal file

Binary file not shown.

View File

@ -508,3 +508,27 @@ p#name {
.anti-aliasing {
image-rendering: pixelated;
}
.warning {
transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s;
-webkit-transition: left cubic-bezier(0, 0.9, 1, 0.1) 2.5s;
animation: warning 1s linear 0s alternate infinite;
-webkit-animation: warning 1s linear 0s alternate infinite;
}
@keyframes warning {
0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);}
100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
}
@-webkit - keyframes warning {
0 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
50 % { text-shadow: 0px 0px 30px rgba(255, 0, 0, 1), 0px 0px 6px rgb(129, 0, 0);}
100 % { text-shadow: 0px 0px 9px rgba(255, 0, 0, 0.5), 0px 0px 6px rgb(129, 0, 0);}
}
.gameCanvas {
transition: transform 1.5s ease-out;
-webkit-transition: transform 1.5s ease-out;
}