diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index d656a8c..d7f1c34 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -1064,14 +1064,14 @@ return code+',\n'; over_s : '旁白文字' ':' EvalString BGNL? Newline - '背景' EvalString? '持续时长' Int? '渐入渐出时长' Int? '音频文件' 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'] +default : ["这段话将在屏幕中心","bg_5043.png",50,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; */; @@ -1090,7 +1090,7 @@ allSounds : ['EvalString_3'] default : ["bg_5043.png","face_050445.png",false,"菲奥奈",-300,0,2000,"","这句话显示在对话框内",[{ "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+',"wait":'+Int_0+',"sound":"'+EvalString_3+'","text": "'+EvalString_4+'"'+list+' },\n'; +var code = '{"type": "cgtext", "bg":"'+EvalString_0+'","WindowSkin":'+Bool_0+',"head":'+head+' ,"name":"'+EvalString_2+'","time":'+Int_0+',"wait":'+Int_1+',"sound":"'+EvalString_3+'","text": "'+EvalString_4+'"'+list+' },\n'; return code; */; textcgDrawingList @@ -1891,7 +1891,7 @@ return code; */; changebg_s - : '上一个背景' EvalString? '下一个背景' EvalString? '切换时长' Int '转场方式' Changebg_List Newline + : '上一个背景' EvalString? '下一个背景' EvalString? '切换帧数' Int '转场方式' Changebg_List Newline /* changebg_s diff --git a/_server/config.json b/_server/config.json index 5d318ea..58ae3cd 100644 --- a/_server/config.json +++ b/_server/config.json @@ -1 +1 @@ -{"viewportLoc":[0,0],"editorLastFloorId":"street01"} \ No newline at end of file +{"viewportLoc":[0,0],"editorLastFloorId":"xiaoxiang01"} \ No newline at end of file diff --git a/project/events.js b/project/events.js index ec024f2..9d511c6 100644 --- a/project/events.js +++ b/project/events.js @@ -164,7 +164,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "人生不如意事,十常居七八。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -185,7 +185,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "世间的万物皆被装缀着不公的色彩。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -206,7 +206,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "没错,就像——", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -227,7 +227,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "十几年前的那一天,", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -248,7 +248,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "在都市的角落,同许多的生命共同消逝一般。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -269,7 +269,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "没错,就像——", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -290,7 +290,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "十几年前的那天起以来,", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -311,7 +311,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "无数的生命被那无法逃脱的污泥囚禁一样。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -332,7 +332,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "人生不如意事,十常居七八。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -353,7 +353,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "世间的万物皆被装缀着不公的色彩。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -374,7 +374,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "没错,就像——", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -395,7 +395,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "type": "over", "text": "如今,这一天。", "image": "", - "time": 3000, + "time": 50, "hidetime": 30, "sound": "", "textColor": [ @@ -429,6 +429,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "这些天,街道不曾下雨。", "bodyList": [ @@ -449,6 +450,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "所以,那浸湿地面的,定是那些女孩们流落的鲜血无疑。", "bodyList": [ @@ -469,6 +471,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我蹲在充斥着铁锈味般恶臭的小巷中,悠闲地如是想着。", "bodyList": [ @@ -496,6 +499,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "扑哧。", "bodyList": [ @@ -516,6 +520,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "耳旁再次响起象征着某个女孩子死去的声音。", "bodyList": [ @@ -536,6 +541,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "再一次——", "bodyList": [ @@ -556,6 +562,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "再一次。", "bodyList": [ @@ -576,6 +583,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "女子们被肢解成单纯的肉块。", "bodyList": [ @@ -596,6 +604,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我任由流下的血浸满全身,屏住自己的呼吸。", "bodyList": [ @@ -616,6 +625,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "祈求自己能拥有从猎人手中逃脱的幸运。", "bodyList": [ @@ -636,6 +646,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "扑哧。", "bodyList": [ @@ -663,6 +674,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "直到刚才,我们还坐在去往娼馆的马车的路上。", "bodyList": [ @@ -683,6 +695,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "而在这之中的某些人,已经不在这个世上了。", "bodyList": [ @@ -703,6 +716,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "不,应该把“某些”换成“几乎所有”才更为恰当吧。", "bodyList": [ @@ -723,6 +737,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "恐怕,不久之后我也会变成小巷中血腥的装饰品。", "bodyList": [ @@ -743,6 +758,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我是为了得到这种死法,才辛苦苟活至今的吗?", "bodyList": [ @@ -763,6 +779,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "来个人告诉我啊——", "bodyList": [ @@ -783,6 +800,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "谁都好。", "bodyList": [ @@ -803,6 +821,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "来人啊!!", "bodyList": [ @@ -830,6 +849,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "少女", "time": 50, + "wait": 2000, "sound": "aiy010000010.mp3", "text": "「呃······!?」", "bodyList": [ @@ -857,6 +877,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "漆黑的物体充斥了我的整个视野", "bodyList": [ @@ -877,6 +898,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我很快意识到,那是只很大的脚。", "bodyList": [ @@ -904,6 +926,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "必须要出声求救。", "bodyList": [ @@ -931,6 +954,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "可是,耳中却只能听到自己的牙关不停交战的声音。", "bodyList": [ @@ -951,6 +975,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我是如此的无助。", "bodyList": [ @@ -978,6 +1003,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "逃跑也好,道歉也罢。", "bodyList": [ @@ -998,6 +1024,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "就连抬头看一眼将要杀掉我的人的面孔都做不到。", "bodyList": [ @@ -1018,6 +1045,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "少女", "time": 50, + "wait": 2000, "sound": "aiy010000020.mp3", "text": "「······被杀」", "bodyList": [ @@ -1038,6 +1066,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "会被杀。", "bodyList": [ @@ -1058,6 +1087,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "会被杀!!", "bodyList": [ @@ -1078,6 +1108,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "来自内心深处的冰冷预感,渐渐地在体内蔓延开来。", "bodyList": [ @@ -1098,6 +1129,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "少女", "time": 50, + "wait": 2000, "sound": "aiy010000030.mp3", "text": "「不,不要······」", "bodyList": [ @@ -1130,6 +1162,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "浮游都市,《诺瓦斯·艾蒂尔》。", "bodyList": [ @@ -1150,6 +1183,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "《特别受灾地区》——", "bodyList": [ @@ -1170,6 +1204,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "通称,《牢狱》", "bodyList": [ @@ -1190,6 +1225,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "是被险峻的峭壁环绕,与世隔绝的,都市的最底部。", "bodyList": [ @@ -1210,6 +1246,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000010.mp3", "text": "「放开我!」", "bodyList": [ @@ -1230,6 +1267,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000020.mp3", "text": "「我只是在帮那个女人而已!」", "bodyList": [ @@ -1257,6 +1295,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000030.mp3", "text": "「你们没听到吗!?」", "bodyList": [ @@ -1277,6 +1316,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000040.mp3", "text": "「她是被受骗才会被卖到娼馆来的」", "bodyList": [ @@ -1297,6 +1337,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000050.mp3", "text": "「用肮脏的手段把钱借给她父母的,就是你们这些家伙吧!?」", "bodyList": [ @@ -1324,6 +1365,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000060.mp3", "text": "「给我说些什么啊」", "bodyList": [ @@ -1344,6 +1386,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000010.mp3", "text": "「这些话等到了娼馆再说吧」", "bodyList": [ @@ -1364,6 +1407,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000020.mp3", "text": "「我来抓你,只是受雇于人而已」", "bodyList": [ @@ -1391,6 +1435,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我走进娼馆《莉莉乌姆》的接待室。", "bodyList": [ @@ -1411,6 +1456,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "正在桌旁整理账簿的奥兹停下手头的工作,抬起头向我看来。", "bodyList": [ @@ -1431,6 +1477,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000010.mp3", "text": "「这不是凯伊姆先生吗,辛苦了」", "bodyList": [ @@ -1451,6 +1498,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000020.mp3", "text": "「委托已经完成了吗?」", "bodyList": [ @@ -1471,6 +1519,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000030.mp3", "text": "「啊啊,是这家伙没错吧」", "bodyList": [ @@ -1491,6 +1540,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹用只要接触到就能杀人般的眼神在男人脸上搜过。", "bodyList": [ @@ -1511,6 +1561,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000030.mp3", "text": "「没错,就是这个人」", "bodyList": [ @@ -1531,6 +1582,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000040.mp3", "text": "「是么」", "bodyList": [ @@ -1551,6 +1603,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000070.mp3", "text": "「你,你们要对我做什么」", "bodyList": [ @@ -1571,6 +1624,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000040.mp3", "text": "「······」", "bodyList": [ @@ -1591,6 +1645,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹用一个眼神,就让男人闭上了嘴。", "bodyList": [ @@ -1611,6 +1666,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "然后,向我这边转过身来。", "bodyList": [ @@ -1631,6 +1687,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000050.mp3", "text": "「抱歉啊,总是麻烦你去做这些无聊的事」", "bodyList": [ @@ -1651,6 +1708,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000060.mp3", "text": "「都怪我们这边的年轻人太没用」", "bodyList": [ @@ -1671,6 +1729,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000050.mp3", "text": "「客套话就免了」", "bodyList": [ @@ -1691,6 +1750,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000070.mp3", "text": "「这还真是失礼了」", "bodyList": [ @@ -1711,6 +1771,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000080.mp3", "text": "「喂,来个人」", "bodyList": [ @@ -1731,6 +1792,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "光头男人", "time": 50, + "wait": 2000, "sound": "aiy820000010.mp3", "text": "「是」", "bodyList": [ @@ -1751,6 +1813,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000090.mp3", "text": "「凯伊姆先生做完工作回来了」", "bodyList": [ @@ -1771,6 +1834,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "光头男人", "time": 50, + "wait": 2000, "sound": "aiy820000020.mp3", "text": "「是,是,那个······」", "bodyList": [ @@ -1791,6 +1855,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000100.mp3", "text": "「我是要你拿些酒来,这个蠢材!」", "bodyList": [ @@ -1811,6 +1876,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "喀!", "bodyList": [ @@ -1831,6 +1897,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹扔出的烟灰缸砸中了手下的额头。", "bodyList": [ @@ -1851,6 +1918,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "鲜血四溅。", "bodyList": [ @@ -1871,6 +1939,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000060.mp3", "text": "「不用这么麻烦」", "bodyList": [ @@ -1891,6 +1960,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000070.mp3", "text": "「我接下来要去《菲诺列塔》」", "bodyList": [ @@ -1911,6 +1981,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000110.mp3", "text": "「喔唷」", "bodyList": [ @@ -1931,6 +2002,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000120.mp3", "text": "「既然如此,我就不留您在这里喝难饮的劣质酒了」", "bodyList": [ @@ -1951,6 +2023,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹斜眼看着正捂住额头呻吟的手下,轻描淡写地说道。", "bodyList": [ @@ -1971,6 +2044,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000080.mp3", "text": "「用这些钱去买药」", "bodyList": [ @@ -1991,6 +2065,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我将几枚铜钱仍在那个手下的身前。", "bodyList": [ @@ -2011,6 +2086,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000130.mp3", "text": "「凯伊姆先生,不用对他们这么好」", "bodyList": [ @@ -2031,6 +2107,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000090.mp3", "text": "「无妨」", "bodyList": [ @@ -2051,6 +2128,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000100.mp3", "text": "「话说回来,那个要落跑的女人呢?」", "bodyList": [ @@ -2071,6 +2149,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000140.mp3", "text": "「我把她交给那些年轻人了,现在应该正在体会人生的严苛吧」", "bodyList": [ @@ -2091,6 +2170,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000150.mp3", "text": "「正好,趁此机会凯伊姆先生也来享受一番如何?」", "bodyList": [ @@ -2111,6 +2191,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000080.mp3", "text": "「你,你们这些家伙,要对她做什么!?」", "bodyList": [ @@ -2131,6 +2212,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "咣!", "bodyList": [ @@ -2151,6 +2233,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹给了他一拳。", "bodyList": [ @@ -2171,6 +2254,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "一击即倒。", "bodyList": [ @@ -2191,6 +2275,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "喀,咚,咯!", "bodyList": [ @@ -2211,6 +2296,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹毫不留情地向男人的脸上踩去。", "bodyList": [ @@ -2231,6 +2317,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000090.mp3", "text": "「咕······呃咳······」", "bodyList": [ @@ -2251,6 +2338,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "折断的牙齿伴着血泡被吐出。", "bodyList": [ @@ -2271,6 +2359,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "这份白色在鲜红色的液体中格外显眼。", "bodyList": [ @@ -2291,6 +2380,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000100.mp3", "text": "「你们以为做出这种事······卫兵会坐视不理吗······」", "bodyList": [ @@ -2311,6 +2401,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000160.mp3", "text": "「啊啊,不会坐视不理的」", "bodyList": [ @@ -2331,6 +2422,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000170.mp3", "text": "「应该会拿出你的钱包,和我们商量如何瓜分吧」", "bodyList": [ @@ -2351,6 +2443,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000110.mp3", "text": "「那,那种事······」", "bodyList": [ @@ -2371,6 +2464,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "这在牢狱是理所当然的事。", "bodyList": [ @@ -2391,6 +2485,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000180.mp3", "text": "「怎么,头一回来牢狱么?」", "bodyList": [ @@ -2411,6 +2506,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "男人点了点头。", "bodyList": [ @@ -2431,6 +2527,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000190.mp3", "text": "「为了被骗的女人而来到牢狱,真是个规矩人啊」", "bodyList": [ @@ -2451,6 +2548,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000200.mp3", "text": "「······前提是,被骗的人不是你」", "bodyList": [ @@ -2471,6 +2569,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000120.mp3", "text": "「你说······我被骗了?」", "bodyList": [ @@ -2491,6 +2590,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "年轻人", "time": 50, + "wait": 2000, "sound": "aiy710000130.mp3", "text": "「那,那是怎么回事!?」", "bodyList": [ @@ -2511,6 +2611,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000210.mp3", "text": "「不用急,今天晚上会好好告诉你的」", "bodyList": [ @@ -2531,6 +2632,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "奥兹抓起男人的脸。", "bodyList": [ @@ -2551,6 +2653,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "为引诱客人的怜悯之心而装纯,是娼妇的惯用手段。", "bodyList": [ @@ -2571,6 +2674,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "双亲被骗而借钱,结果作为抵押而将自己卖到这里,这是典型的说法。", "bodyList": [ @@ -2591,6 +2695,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "如果只是头脑发热而成为常客也就罢了,这次的男人热血过头,居然想出了要带女人私奔的计划。", "bodyList": [ @@ -2611,6 +2716,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "虽然女人半开玩笑地予以拒绝,但不知天高地厚的这家伙还是拉着她逃跑了。", "bodyList": [ @@ -2631,6 +2737,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "不过,想要逃脱追击本来就是不可能的任务。", "bodyList": [ @@ -2651,6 +2758,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "但即便如此,这种事情还是会一再的出现。", "bodyList": [ @@ -2671,6 +2779,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "说谎的女人和被骗的男人。", "bodyList": [ @@ -2691,6 +2800,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "在娼馆街,这是令人看到生厌的日常的风景。", "bodyList": [ @@ -2711,6 +2821,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000110.mp3", "text": "「我要走了」", "bodyList": [ @@ -2731,6 +2842,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000220.mp3", "text": "「好的,下次再麻烦您」", "bodyList": [ @@ -2751,6 +2863,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "奥兹", "time": 50, + "wait": 2000, "sound": "aiy350000230.mp3", "text": "「之后吉克先生会将谢礼交给您的」", "bodyList": [ @@ -2771,6 +2884,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "aiy310000120.mp3", "text": "「啊啊」", "bodyList": [ @@ -2791,6 +2905,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "我背向奥兹走出娼馆。", "bodyList": [ @@ -2815,6 +2930,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "", "text": "「······?」", "bodyList": [ @@ -2842,6 +2958,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "从远方传来微弱的歌声。", "bodyList": [ @@ -2862,6 +2979,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "是关卡广场的方向。", "bodyList": [ @@ -2882,6 +3000,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "对了。", "bodyList": [ @@ -2902,6 +3021,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "今天有觐见圣女的仪式。", "bodyList": [ @@ -2922,6 +3042,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "当代的圣女伊莲——", "bodyList": [ @@ -2942,6 +3063,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "俗称《盲眼之圣女》,据说即使在历代的圣女中,人气也是数一数二的。", "bodyList": [ @@ -2962,6 +3084,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "广场上的人估计相当多吧。", "bodyList": [ @@ -2982,6 +3105,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "虽然我也想去看看她长什么样,不过要在人潮中挤来挤去就免了。", "bodyList": [ @@ -3002,6 +3126,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "还是老老实实去菲诺列塔喝烧酒吧。", "bodyList": [ @@ -3022,6 +3147,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "", "time": 50, + "wait": 2000, "sound": "", "text": "正当我这样想着的时候,一个身影自小巷的那头走来。", "bodyList": [ @@ -3049,6 +3175,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = }, "name": "凯伊姆", "time": 50, + "wait": 2000, "sound": "", "text": "「艾莉斯」", "bodyList": [ diff --git a/project/plugins.js b/project/plugins.js index 3a1a74a..c9a1fc2 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2391,1200 +2391,1198 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = })(); }, "statusBar": function () { - main.dom.floorMsgGroup.style.display = "none"; - main.dom.statusBar.style.display = "none"; - main.dom.toolBar.style.display = "none"; - //所有数据*3是为了实现高清画布 - const GAMEVIEW_WIDTH = 676 * 3; //横屏画面宽度 - const GAMEVIEW_HEIGHT = 416 * 3; //横屏画面高度 + main.dom.floorMsgGroup.style.display = "none"; + main.dom.statusBar.style.display = "none"; + main.dom.toolBar.style.display = "none"; + //所有数据*3是为了实现高清画布 + const GAMEVIEW_WIDTH = 676 * 3; //横屏画面宽度 + const GAMEVIEW_HEIGHT = 416 * 3; //横屏画面高度 - const GAMEVIEW_WIDTH_VERTICAL = 416 * 3; //竖屏画面宽度 - const GAMEVIEW_HEIGHT_VERTICAL = 676 * 3; //竖屏画面高度 + const GAMEVIEW_WIDTH_VERTICAL = 416 * 3; //竖屏画面宽度 + const GAMEVIEW_HEIGHT_VERTICAL = 676 * 3; //竖屏画面高度 - const BAR_WIDTH = 130 * 3; //横屏左侧额外距离(即边栏宽度) - const BAR_HEIGHT_VERTICAL = 130 * 3; //竖屏上侧额外距离(即边栏高度) - const BORDER_WIDTH = 0; //游戏画面左侧偏移距离 - const BORDER_HEIGHT = 0; //游戏画面上侧偏移距离 + const BAR_WIDTH = 130 * 3; //横屏左侧额外距离(即边栏宽度) + const BAR_HEIGHT_VERTICAL = 130 * 3; //竖屏上侧额外距离(即边栏高度) + const BORDER_WIDTH = 0; //游戏画面左侧偏移距离 + const BORDER_HEIGHT = 0; //游戏画面上侧偏移距离 - const ITEM_BOX_LEFT = 549 * 3; //横屏道具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const ITEM_BOX_TOP = 155 * 3; //横屏道具栏上侧距离 - const ITEM_BOX_LEFT_VERTICAL = 160 * 3; //竖屏道具栏左侧距离 - const ITEM_BOX_TOP_VERTICAL = 549 * 3; //竖屏道具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const ITEM_BOX_LEFT = 549 * 3; //横屏道具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const ITEM_BOX_TOP = 155 * 3; //横屏道具栏上侧距离 + const ITEM_BOX_LEFT_VERTICAL = 160 * 3; //竖屏道具栏左侧距离 + const ITEM_BOX_TOP_VERTICAL = 549 * 3; //竖屏道具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const EQUIP_BLOCK_LEFT = 549 * 3; //横屏装备栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const EQUIP_BLOCK_TOP = 10 * 3; //横屏装备栏上侧距离 - const EQUIP_BLOCK_LEFT_VERTICAL = 10 * 3; //竖屏装备栏左侧距离 - const EQUIP_BLOCK_TOP_VERTICAL = 549 * 3; //竖屏装备栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const EQUIP_BLOCK_LEFT = 549 * 3; //横屏装备栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const EQUIP_BLOCK_TOP = 10 * 3; //横屏装备栏上侧距离 + const EQUIP_BLOCK_LEFT_VERTICAL = 10 * 3; //竖屏装备栏左侧距离 + const EQUIP_BLOCK_TOP_VERTICAL = 549 * 3; //竖屏装备栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const MAP_BLOCK_LEFT = 551 * 3; //横屏小地图左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const MAP_BLOCK_TOP = 0; //横屏小地图上侧距离 - const MAP_BLOCK_LEFT_VERTICAL = 0; //竖屏小地图左侧距离 - const MAP_BLOCK_TOP_VERTICAL = 551 * 3; //竖屏小地图上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const MAP_BLOCK_LEFT = 551 * 3; //横屏小地图左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const MAP_BLOCK_TOP = 0; //横屏小地图上侧距离 + const MAP_BLOCK_LEFT_VERTICAL = 0; //竖屏小地图左侧距离 + const MAP_BLOCK_TOP_VERTICAL = 551 * 3; //竖屏小地图上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const KEY_BLOCK_LEFT = EQUIP_BLOCK_LEFT; //横屏钥匙栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const KEY_BLOCK_TOP = 110 * 3; //横屏钥匙栏上侧距离 - const KEY_BLOCK_LEFT_VERTICAL = 110 * 3; //竖屏钥匙栏左侧距离 - const KEY_BLOCK_TOP_VERTICAL = EQUIP_BLOCK_TOP_VERTICAL; //竖屏钥匙栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const KEY_BLOCK_LEFT = EQUIP_BLOCK_LEFT; //横屏钥匙栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const KEY_BLOCK_TOP = 110 * 3; //横屏钥匙栏上侧距离 + const KEY_BLOCK_LEFT_VERTICAL = 110 * 3; //竖屏钥匙栏左侧距离 + const KEY_BLOCK_TOP_VERTICAL = EQUIP_BLOCK_TOP_VERTICAL; //竖屏钥匙栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const INFO_BLOCK_LEFT = 10 * 3; //横屏道具说明左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const INFO_BLOCK_TOP = 180 * 3; //横屏道具说明上侧距离 - const INFO_BLOCK_LEFT_VERTICAL = 113 * 3; //竖屏道具说明左侧距离 - const INFO_BLOCK_TOP_VERTICAL = 8 * 3; //竖屏道具说明上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const INFO_BLOCK_LEFT = 10 * 3; //横屏道具说明左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const INFO_BLOCK_TOP = 180 * 3; //横屏道具说明上侧距离 + const INFO_BLOCK_LEFT_VERTICAL = 113 * 3; //竖屏道具说明左侧距离 + const INFO_BLOCK_TOP_VERTICAL = 8 * 3; //竖屏道具说明上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const TOOL_BOX_LEFT = EQUIP_BLOCK_LEFT; //横屏工具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) - const TOOL_BOX_TOP = 348 * 3; //横屏工具栏上侧距离 - const TOOL_BOX_LEFT_VERTICAL = 348 * 3; //竖屏工具栏左侧距离 - const TOOL_BOX_TOP_VERTICAL = 549 * 3; //竖屏工具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) + const TOOL_BOX_LEFT = EQUIP_BLOCK_LEFT; //横屏工具栏左侧距离(右侧边栏需增加BAR_WIDTH+GAMEVIEW_HEIGHT) + const TOOL_BOX_TOP = 348 * 3; //横屏工具栏上侧距离 + const TOOL_BOX_LEFT_VERTICAL = 348 * 3; //竖屏工具栏左侧距离 + const TOOL_BOX_TOP_VERTICAL = 549 * 3; //竖屏工具栏上侧距离(下侧边栏需增加BAR_HEIGHT_VERTICAL+GAMEVIEW_WIDTH_VERTICAL) - const TOOL_ICON_OUTER_SIZE = 34 * 3; + const TOOL_ICON_OUTER_SIZE = 34 * 3; - const TEXT_COLOR = "#FFFFFF"; //默认文字颜色 - const globalAlpha = 0.7; //默认底框透明度 - const FORCE_COUNTABLE_ITEMS = ["centerFly"]; //常态显示数量的非永久道具,如果道具不在此数组中,则只有道具多余1时显示数量 + const TEXT_COLOR = "#FFFFFF"; //默认文字颜色 + const globalAlpha = 0.7; //默认底框透明度 + const FORCE_COUNTABLE_ITEMS = ["centerFly"]; //常态显示数量的非永久道具,如果道具不在此数组中,则只有道具多余1时显示数量 - const outerBackground = document.createElement("canvas"); //背景画布设置 - let globalAlphafloor = 0, - globalAlphafloorStatus = 4; - outerBackground.style.position = "absolute"; - outerBackground.style.zIndex = 5; - outerBackground.id = "outerBackground"; - main.dom.outerBackground = outerBackground; - main.dom.startPanel.insertAdjacentElement("afterend", outerBackground); + const outerBackground = document.createElement("canvas"); //背景画布设置 + let globalAlphafloor = 0, + globalAlphafloorStatus = 4; + outerBackground.style.position = "absolute"; + outerBackground.style.zIndex = 5; + outerBackground.id = "outerBackground"; + main.dom.outerBackground = outerBackground; + main.dom.startPanel.insertAdjacentElement("afterend", outerBackground); - const outerUI = document.createElement("canvas"); //额外ui画布设置(状态栏所有绘制、点击都在额外ui上) - outerUI.style.position = "absolute"; - outerUI.style.zIndex = 165; - outerUI.id = "outerUI"; + const outerUI = document.createElement("canvas"); //额外ui画布设置(状态栏所有绘制、点击都在额外ui上) + outerUI.style.position = "absolute"; + outerUI.style.zIndex = 165; + outerUI.id = "outerUI"; - main.dom.outerUI = outerUI; - outerBackground.insertAdjacentElement("afterend", outerUI); - setTimeout(function () { - // Should be executed immediately after init() - main.canvas.outerUI = outerUI.getContext("2d"); - }); - outerUI.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.statusBar.onclick(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; + main.dom.outerUI = outerUI; + outerBackground.insertAdjacentElement("afterend", outerUI); + setTimeout(function () { + // Should be executed immediately after init() + main.canvas.outerUI = outerUI.getContext("2d"); + }); + outerUI.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.statusBar.onclick(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; - const _resize_gameGroup = function (obj) { - //游戏画面自适应调节 - const gameGroup = core.dom.gameGroup; - gameGroup.style.width = obj.totalWidth + "px"; - gameGroup.style.height = obj.totalHeight + "px"; - gameGroup.style.left = (obj.clientWidth - obj.totalWidth) / 2 + "px"; - gameGroup.style.top = (obj.clientHeight - obj.totalHeight) / 2 + "px"; - //floorMsgGroup为切换楼层中生效,显示时间可通过‘全塔属性’——‘切换楼层时间’或游戏内设置调整 - //显示内容为游戏名/版本号/楼层名 - // floorMsgGroup - var floorMsgGroup = core.dom.floorMsgGroup; - var globalAttribute = - core.status.globalAttribute || core.initStatus.globalAttribute; - floorMsgGroup.style = globalAttribute.floorChangingStyle; - floorMsgGroup.style.height = floorMsgGroup.style.width = - (GAMEVIEW_HEIGHT / 3) * core.domStyle.scale + "px"; - floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + "px"; + const _resize_gameGroup = function (obj) { + //游戏画面自适应调节 + const gameGroup = core.dom.gameGroup; + gameGroup.style.width = obj.totalWidth + "px"; + gameGroup.style.height = obj.totalHeight + "px"; + gameGroup.style.left = (obj.clientWidth - obj.totalWidth) / 2 + "px"; + gameGroup.style.top = (obj.clientHeight - obj.totalHeight) / 2 + "px"; + //floorMsgGroup为切换楼层中生效,显示时间可通过‘全塔属性’——‘切换楼层时间’或游戏内设置调整 + //显示内容为游戏名/版本号/楼层名 + // floorMsgGroup + var floorMsgGroup = core.dom.floorMsgGroup; + var globalAttribute = + core.status.globalAttribute || core.initStatus.globalAttribute; + floorMsgGroup.style = globalAttribute.floorChangingStyle; + floorMsgGroup.style.height = floorMsgGroup.style.width = + (GAMEVIEW_HEIGHT / 3) * core.domStyle.scale + "px"; + floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + "px"; - if (core.domStyle.isVertical) { - floorMsgGroup.style.left = "0px"; - floorMsgGroup.style.top = - ((GAMEVIEW_HEIGHT_VERTICAL / 3 - GAMEVIEW_WIDTH_VERTICAL / 3) * - core.domStyle.scale) / - 2 + - "px"; - } else { - floorMsgGroup.style.left = - ((GAMEVIEW_WIDTH / 3 - GAMEVIEW_HEIGHT / 3) * core.domStyle.scale) / - 2 + - "px"; - floorMsgGroup.style.top = "0px"; - } - core.dom.musicBtn.style.right = - (obj.clientWidth - obj.totalWidth) / 2 + "px"; - core.dom.musicBtn.style.bottom = - (obj.clientHeight - obj.totalHeight) / 2 - 27 + "px"; - let startBackground = core.domStyle.isVertical - ? main.styles.startVerticalBackground || main.styles.startBackground - : main.styles.startBackground; - if (main.dom.startBackground.getAttribute("__src__") != startBackground) { - main.dom.startBackground.setAttribute("__src__", startBackground); - main.dom.startBackground.src = startBackground; - } - const span = document - .getElementById("startButtons") - .getElementsByTagName("span"); - let font = (GAMEVIEW_WIDTH / 100) * core.domStyle.scale; - if (core.domStyle.isVertical) - font = ((GAMEVIEW_WIDTH_VERTICAL * 2) / 100) * core.domStyle.scale; + if (core.domStyle.isVertical) { + floorMsgGroup.style.left = "0px"; + floorMsgGroup.style.top = + ((GAMEVIEW_HEIGHT_VERTICAL / 3 - GAMEVIEW_WIDTH_VERTICAL / 3) * + core.domStyle.scale) / + 2 + + "px"; + } else { + floorMsgGroup.style.left = + ((GAMEVIEW_WIDTH / 3 - GAMEVIEW_HEIGHT / 3) * core.domStyle.scale) / + 2 + + "px"; + floorMsgGroup.style.top = "0px"; + } + core.dom.musicBtn.style.right = + (obj.clientWidth - obj.totalWidth) / 2 + "px"; + core.dom.musicBtn.style.bottom = + (obj.clientHeight - obj.totalHeight) / 2 - 27 + "px"; + let startBackground = core.domStyle.isVertical ? + main.styles.startVerticalBackground || main.styles.startBackground : + main.styles.startBackground; + if (main.dom.startBackground.getAttribute("__src__") != startBackground) { + main.dom.startBackground.setAttribute("__src__", startBackground); + main.dom.startBackground.src = startBackground; + } + const span = document + .getElementById("startButtons") + .getElementsByTagName("span"); + let font = (GAMEVIEW_WIDTH / 100) * core.domStyle.scale; + if (core.domStyle.isVertical) + font = ((GAMEVIEW_WIDTH_VERTICAL * 2) / 100) * core.domStyle.scale; - core.dom.playGame.style.fontSize = font + "px"; - core.dom.loadGame.style.fontSize = font + "px"; - core.dom.CGMode.style.fontSize = font + "px"; - core.dom.replayGame.style.fontSize = font + "px"; - core.dom.startButtonGroup.style.padding = font * 0.3 + "px 25px"; - }; - const _resize_canvas = function (obj) { - //自适应画布 - main.dom.outerBackground.style.width = obj.totalWidth + "px"; - main.dom.outerBackground.style.height = obj.totalHeight + "px"; - main.dom.outerUI.style.width = obj.totalWidth + "px"; - main.dom.outerUI.style.height = obj.totalHeight + "px"; - main.dom.CGUI.style.width = obj.totalWidth + "px"; - 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"; + core.dom.playGame.style.fontSize = font + "px"; + core.dom.loadGame.style.fontSize = font + "px"; + core.dom.CGMode.style.fontSize = font + "px"; + core.dom.replayGame.style.fontSize = font + "px"; + core.dom.startButtonGroup.style.padding = font * 0.3 + "px 25px"; + }; + const _resize_canvas = function (obj) { + //自适应画布 + main.dom.outerBackground.style.width = obj.totalWidth + "px"; + main.dom.outerBackground.style.height = obj.totalHeight + "px"; + main.dom.outerUI.style.width = obj.totalWidth + "px"; + main.dom.outerUI.style.height = obj.totalHeight + "px"; + main.dom.CGUI.style.width = (obj.totalWidth + 3) + "px"; + main.dom.CGUI.style.height = (obj.totalHeight + 3) + "px"; + main.dom.cgText.style.width = (obj.totalWidth + 3) + "px"; + main.dom.cgText.style.height = (obj.totalHeight + 3) + "px"; + main.dom.over.style.width = (obj.totalWidth + 3) + "px"; + main.dom.over.style.height = (obj.totalHeight + 3) + "px"; - const innerSize = obj.canvasWidth * core.domStyle.scale + "px"; - for (let i = 0; i < core.dom.gameCanvas.length; ++i) - core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[ - i - ].style.height = innerSize; - core.dom.gif.style.width = core.dom.gif.style.height = innerSize; - core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize; - core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = - innerSize; - core.dom.gameDraw.style.top = - obj.gameDrawBox.top * core.domStyle.scale + "px"; - core.dom.gameDraw.style.left = - obj.gameDrawBox.left * core.domStyle.scale + "px"; - // resize bigmap - core.bigmap.canvas.forEach(function (cn) { - const ratio = core.canvas[cn].canvas.hasAttribute("isHD") - ? core.domStyle.ratio - : 1; - core.canvas[cn].canvas.style.width = - (innerSize / ratio) * core.domStyle.scale + "px"; - core.canvas[cn].canvas.style.height = - (innerSize / ratio) * core.domStyle.scale + "px"; - }); - // resize dynamic canvas - for (const name in core.dymCanvas) { - const ctx = core.dymCanvas[name], - canvas = ctx.canvas; - const ratio = canvas.hasAttribute("isHD") ? core.domStyle.ratio : 1; - canvas.style.width = (innerSize / ratio) * core.domStyle.scale + "px"; - canvas.style.height = (innerSize / ratio) * core.domStyle.scale + "px"; - canvas.style.left = - parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; - canvas.style.top = - parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; - } + const innerSize = obj.canvasWidth * core.domStyle.scale + "px"; + for (let i = 0; i < core.dom.gameCanvas.length; ++i) + core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[ + i + ].style.height = innerSize; + core.dom.gif.style.width = core.dom.gif.style.height = innerSize; + core.dom.gif2.style.width = core.dom.gif2.style.height = innerSize; + core.dom.gameDraw.style.width = core.dom.gameDraw.style.height = + innerSize; + core.dom.gameDraw.style.top = + obj.gameDrawBox.top * core.domStyle.scale + "px"; + core.dom.gameDraw.style.left = + obj.gameDrawBox.left * core.domStyle.scale + "px"; + // resize bigmap + core.bigmap.canvas.forEach(function (cn) { + const ratio = core.canvas[cn].canvas.hasAttribute("isHD") ? + core.domStyle.ratio : + 1; + core.canvas[cn].canvas.style.width = + (innerSize / ratio) * core.domStyle.scale + "px"; + core.canvas[cn].canvas.style.height = + (innerSize / ratio) * core.domStyle.scale + "px"; + }); + // resize dynamic canvas + for (const name in core.dymCanvas) { + const ctx = core.dymCanvas[name], + canvas = ctx.canvas; + const ratio = canvas.hasAttribute("isHD") ? core.domStyle.ratio : 1; + canvas.style.width = (innerSize / ratio) * core.domStyle.scale + "px"; + canvas.style.height = (innerSize / ratio) * core.domStyle.scale + "px"; + canvas.style.left = + parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px"; + canvas.style.top = + parseFloat(canvas.getAttribute("_top")) * core.domStyle.scale + "px"; + } - // resize next - main.dom.next.style.width = main.dom.next.style.height = - 5 * core.domStyle.scale + "px"; - main.dom.next.style.borderBottomWidth = - main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px"; - }; - const bgctx = main.dom.outerBackground.getContext("2d"); - const uictx = main.dom.outerUI.getContext("2d"); - const floor = document.createElement("canvas"); - const floorVertical = document.createElement("canvas"); - floor.width = GAMEVIEW_WIDTH; - floor.height = GAMEVIEW_HEIGHT; - floorVertical.width = GAMEVIEW_WIDTH_VERTICAL; - floorVertical.height = GAMEVIEW_HEIGHT_VERTICAL; - const floorctx = floor.getContext("2d"); - const floorVerticalctx = floorVertical.getContext("2d"); + // resize next + main.dom.next.style.width = main.dom.next.style.height = + 5 * core.domStyle.scale + "px"; + main.dom.next.style.borderBottomWidth = + main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px"; + }; + const bgctx = main.dom.outerBackground.getContext("2d"); + const uictx = main.dom.outerUI.getContext("2d"); + const floor = document.createElement("canvas"); + const floorVertical = document.createElement("canvas"); + floor.width = GAMEVIEW_WIDTH; + floor.height = GAMEVIEW_HEIGHT; + floorVertical.width = GAMEVIEW_WIDTH_VERTICAL; + floorVertical.height = GAMEVIEW_HEIGHT_VERTICAL; + const floorctx = floor.getContext("2d"); + const floorVerticalctx = floorVertical.getContext("2d"); - core.registerAnimationFrame("lightFloor", true, function () { - 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); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.png", - MAP_BLOCK_LEFT_VERTICAL + 125, - MAP_BLOCK_TOP_VERTICAL + 170 - ); - uictx.globalAlpha = 1; - } else { - core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); - uictx.drawImage(floor, 0, 0); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.png", - MAP_BLOCK_LEFT + 150, - MAP_BLOCK_TOP + 170 - ); - uictx.globalAlpha = 1; - } - }); + core.registerAnimationFrame("lightFloor", true, function () { + 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); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.png", + MAP_BLOCK_LEFT_VERTICAL + 125, + MAP_BLOCK_TOP_VERTICAL + 170 + ); + uictx.globalAlpha = 1; + } else { + core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); + uictx.drawImage(floor, 0, 0); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.png", + MAP_BLOCK_LEFT + 150, + MAP_BLOCK_TOP + 170 + ); + uictx.globalAlpha = 1; + } + }); - core.control.resize = function () { - //自适应,可实现横竖屏切换 - if (main.mode == "editor") return; + core.control.resize = function () { + //自适应,可实现横竖屏切换 + if (main.mode == "editor") return; - const clientWidth = main.dom.body.clientWidth, - clientHeight = main.dom.body.clientHeight; - const canvasWidth = core.__PIXELS__; + const clientWidth = main.dom.body.clientWidth, + clientHeight = main.dom.body.clientHeight; + const canvasWidth = core.__PIXELS__; - const isVertical = clientHeight > clientWidth; - core.domStyle.isVertical = isVertical; + const isVertical = clientHeight > clientWidth; + core.domStyle.isVertical = isVertical; - const totalWidth = isVertical - ? GAMEVIEW_WIDTH_VERTICAL / 3 - : GAMEVIEW_WIDTH / 3, - totalHeight = isVertical - ? GAMEVIEW_HEIGHT_VERTICAL / 3 - : GAMEVIEW_HEIGHT / 3; + const totalWidth = isVertical ? + GAMEVIEW_WIDTH_VERTICAL / 3 : + GAMEVIEW_WIDTH / 3, + totalHeight = isVertical ? + GAMEVIEW_HEIGHT_VERTICAL / 3 : + GAMEVIEW_HEIGHT / 3; - const maxRatio = Math.min( - clientWidth / totalWidth, - clientHeight / totalHeight - ); + const maxRatio = Math.min( + clientWidth / totalWidth, + clientHeight / totalHeight + ); - core.domStyle.availableScale = []; - [1, 1.25, 1.5, 1.75, 2].forEach(function (v) { - if (maxRatio >= v) { - core.domStyle.availableScale.push(v); - } - }); + core.domStyle.availableScale = []; + [1, 1.25, 1.5, 1.75, 2].forEach(function (v) { + if (maxRatio >= v) { + core.domStyle.availableScale.push(v); + } + }); - if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) { - core.domStyle.scale = Math.min(1, maxRatio); - } else if ( - core.getLocalStorage("scale") == null && - core.domStyle.availableScale.length >= 2 - ) { - core.domStyle.scale = - core.domStyle.availableScale[core.domStyle.availableScale.length - 2]; - core.setLocalStorage("scale", core.domStyle.scale); - } + if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) { + core.domStyle.scale = Math.min(1, maxRatio); + } else if ( + core.getLocalStorage("scale") == null && + core.domStyle.availableScale.length >= 2 + ) { + core.domStyle.scale = + core.domStyle.availableScale[core.domStyle.availableScale.length - 2]; + core.setLocalStorage("scale", core.domStyle.scale); + } - const totalWidthScaled = totalWidth * core.domStyle.scale, - totalHeightScaled = totalHeight * core.domStyle.scale; + const totalWidthScaled = totalWidth * core.domStyle.scale, + totalHeightScaled = totalHeight * core.domStyle.scale; - const gameDrawBox = isVertical - ? { - left: BORDER_WIDTH / 3, - top: BAR_HEIGHT_VERTICAL / 3 + BORDER_HEIGHT / 3, - } - : { left: BAR_WIDTH / 3 + BORDER_WIDTH / 3, top: BORDER_HEIGHT / 3 }; + const gameDrawBox = isVertical ? { + left: BORDER_WIDTH / 3, + top: BAR_HEIGHT_VERTICAL / 3 + BORDER_HEIGHT / 3, + } : { left: BAR_WIDTH / 3 + BORDER_WIDTH / 3, top: BORDER_HEIGHT / 3 }; - const obj = { - clientWidth: clientWidth, - clientHeight: clientHeight, - canvasWidth: canvasWidth, - totalWidth: totalWidthScaled, - totalHeight: totalHeightScaled, - gameDrawBox: gameDrawBox, - globalAttribute: - core.status.globalAttribute || core.initStatus.globalAttribute, - }; + const obj = { + clientWidth: clientWidth, + clientHeight: clientHeight, + canvasWidth: canvasWidth, + totalWidth: totalWidthScaled, + totalHeight: totalHeightScaled, + gameDrawBox: gameDrawBox, + globalAttribute: core.status.globalAttribute || core.initStatus.globalAttribute, + }; - _resize_gameGroup(obj); - _resize_canvas(obj); + _resize_gameGroup(obj); + _resize_canvas(obj); - if (core.status.automaticRoute == null) core.status.automaticRoute = {}; - core.updateStatusBar(); - core.ui.CG.update(); - core.ui.cgText.update(); - }; + if (core.status.automaticRoute == null) core.status.automaticRoute = {}; + core.updateStatusBar(); + core.ui.CG.update(); + core.ui.cgText.update(); + }; - class StatusBar { - constructor() { - //道具栏列表 - this.itemMx = [ - //空位用‘none’填充,当前ui至多4列6行 - ["book", "wand", "none", "fly"], - ["cross", "superPotion", "pickaxe"], - ["bomb", "centerFly", "upFly"], - ["none", "none", "none"], - ["downFly", "knife", "snow"], - ["bigKey", "earthquake", "coin"], - ]; - } - //初始化内容(工具栏/录像操作执行函数) - init() { - this.toolbarAction = [ - [ - main.core.openKeyBoard, - main.core.openQuickShop, - core.openToolbox, - core.doSL, - ], - [main.core.openSettings, main.core.save, main.core.load, core.doSL], - ]; - this.replayAction = [ - [core.triggerReplay, core.stopReplay, core.rewindReplay], - [core.speedDownReplay, core.speedUpReplay, core.saveReplay], - ]; - } - //更新 - update() { - this._update_background(); //更新背景 - this._update_props(); //更新属性 - //this._update_items(); //更新道具 - //this._update_equips(); //更新装备 - //this._update_keys(); //更新钥匙 - //this._update_infoWindow(); //更新道具说明 - this._update_toolBox(); //更新工具栏 - this._redrawMap(); - } - _redrawMap() { - if (core.domStyle.isVertical) { - core.clearMap( - uictx, - MAP_BLOCK_LEFT_VERTICAL, - MAP_BLOCK_TOP_VERTICAL, - 340, - 360 - ); - uictx.drawImage(floorVertical, 0, 0); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.png", - MAP_BLOCK_LEFT_VERTICAL + 125, - MAP_BLOCK_TOP_VERTICAL + 170 - ); - uictx.globalAlpha = 1; - } else { - core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); - uictx.drawImage(floor, 0, 0); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.png", - MAP_BLOCK_LEFT + 150, - MAP_BLOCK_TOP + 170 - ); - uictx.globalAlpha = 1; - } - } - //更新背景 - _update_background() { - if (core.domStyle.isVertical) { - bgctx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; - bgctx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; - uictx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; - uictx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; + class StatusBar { + constructor() { + //道具栏列表 + this.itemMx = [ + //空位用‘none’填充,当前ui至多4列6行 + ["book", "wand", "none", "fly"], + ["cross", "superPotion", "pickaxe"], + ["bomb", "centerFly", "upFly"], + ["none", "none", "none"], + ["downFly", "knife", "snow"], + ["bigKey", "earthquake", "coin"], + ]; + } + //初始化内容(工具栏/录像操作执行函数) + init() { + this.toolbarAction = [ + [ + main.core.openKeyBoard, + main.core.openQuickShop, + core.openToolbox, + core.doSL, + ], + [main.core.openSettings, main.core.save, main.core.load, core.doSL], + ]; + this.replayAction = [ + [core.triggerReplay, core.stopReplay, core.rewindReplay], + [core.speedDownReplay, core.speedUpReplay, core.saveReplay], + ]; + } + //更新 + update() { + this._update_background(); //更新背景 + this._update_props(); //更新属性 + //this._update_items(); //更新道具 + //this._update_equips(); //更新装备 + //this._update_keys(); //更新钥匙 + //this._update_infoWindow(); //更新道具说明 + this._update_toolBox(); //更新工具栏 + this._redrawMap(); + } + _redrawMap() { + if (core.domStyle.isVertical) { + core.clearMap( + uictx, + MAP_BLOCK_LEFT_VERTICAL, + MAP_BLOCK_TOP_VERTICAL, + 340, + 360 + ); + uictx.drawImage(floorVertical, 0, 0); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.png", + MAP_BLOCK_LEFT_VERTICAL + 125, + MAP_BLOCK_TOP_VERTICAL + 170 + ); + uictx.globalAlpha = 1; + } else { + core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); + uictx.drawImage(floor, 0, 0); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.png", + MAP_BLOCK_LEFT + 150, + MAP_BLOCK_TOP + 170 + ); + uictx.globalAlpha = 1; + } + } + //更新背景 + _update_background() { + if (core.domStyle.isVertical) { + bgctx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; + bgctx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; + uictx.canvas.width = GAMEVIEW_WIDTH_VERTICAL; + uictx.canvas.height = GAMEVIEW_HEIGHT_VERTICAL; - const bg = core.material.images.images["bg.jpg"]; //竖屏背景(上) - bgctx.drawImage( - bg, - 0, - 0, - GAMEVIEW_WIDTH_VERTICAL, - BAR_HEIGHT_VERTICAL - ); - const bg2 = core.material.images.images["bg.jpg"]; //竖屏背景(下) - bgctx.drawImage( - bg2, - 0, - BAR_HEIGHT_VERTICAL + GAMEVIEW_WIDTH_VERTICAL, - GAMEVIEW_WIDTH_VERTICAL, - BAR_HEIGHT_VERTICAL - ); - bgctx.globalAlpha = globalAlpha; - const bg3 = core.material.images.images["statusBackground2.png"]; //竖屏按钮 - //bgctx.drawImage(bg3, 0, 0, GAMEVIEW_WIDTH_VERTICAL, GAMEVIEW_HEIGHT_VERTICAL); - bgctx.globalAlpha = 1; - core.setTextAlign("outerUI", "center"); - } else { - bgctx.canvas.width = GAMEVIEW_WIDTH; - bgctx.canvas.height = GAMEVIEW_HEIGHT; - uictx.canvas.width = GAMEVIEW_WIDTH; - uictx.canvas.height = GAMEVIEW_HEIGHT; + const bg = core.material.images.images["bg.jpg"]; //竖屏背景(上) + bgctx.drawImage( + bg, + 0, + 0, + GAMEVIEW_WIDTH_VERTICAL, + BAR_HEIGHT_VERTICAL + ); + const bg2 = core.material.images.images["bg.jpg"]; //竖屏背景(下) + bgctx.drawImage( + bg2, + 0, + BAR_HEIGHT_VERTICAL + GAMEVIEW_WIDTH_VERTICAL, + GAMEVIEW_WIDTH_VERTICAL, + BAR_HEIGHT_VERTICAL + ); + bgctx.globalAlpha = globalAlpha; + const bg3 = core.material.images.images["statusBackground2.png"]; //竖屏按钮 + //bgctx.drawImage(bg3, 0, 0, GAMEVIEW_WIDTH_VERTICAL, GAMEVIEW_HEIGHT_VERTICAL); + bgctx.globalAlpha = 1; + core.setTextAlign("outerUI", "center"); + } else { + bgctx.canvas.width = GAMEVIEW_WIDTH; + bgctx.canvas.height = GAMEVIEW_HEIGHT; + uictx.canvas.width = GAMEVIEW_WIDTH; + uictx.canvas.height = GAMEVIEW_HEIGHT; - const bg = core.material.images.images["bg.jpg"]; //横屏背景(左) - bgctx.drawImage(bg, 0, 0, BAR_WIDTH, GAMEVIEW_HEIGHT); - const bg2 = core.material.images.images["bg.jpg"]; //横屏背景(右) - bgctx.drawImage( - bg2, - BAR_WIDTH + GAMEVIEW_HEIGHT, - 0, - BAR_WIDTH, - GAMEVIEW_HEIGHT - ); - bgctx.globalAlpha = globalAlpha; - const bg3 = core.material.images.images["statusBackground.png"]; //横屏按钮 - //bgctx.drawImage(bg3, 0, 0, GAMEVIEW_WIDTH, GAMEVIEW_HEIGHT); - bgctx.globalAlpha = 1; - core.setTextAlign("outerUI", "center"); - } - } - // 更新属性 - _update_props(updatedFloorTitle) { - if (!updatedFloorTitle && core.status.floorId) { - updatedFloorTitle = core.status.maps[core.status.floorId].title; - } - const statusList = ["hp", "atk", "def", "money"]; //属性列表,图标在函数复写core.statusBar.icons中声明,数字为project\materials\icons.png中的图标序号(可使用便捷ps追加,第一个序号为0) - const drawStatusList = (baseX, baseY) => { - let curh = baseY; - core.setTextAlign("outerUI", "right"); - statusList.forEach((item) => { - // 绘制图标 - core.drawIcon( - "outerUI", - item, - baseX - 95 * 3, - curh - 18 * 3, - 22 * 3, - 22 * 3 - ); + const bg = core.material.images.images["bg.jpg"]; //横屏背景(左) + bgctx.drawImage(bg, 0, 0, BAR_WIDTH, GAMEVIEW_HEIGHT); + const bg2 = core.material.images.images["bg.jpg"]; //横屏背景(右) + bgctx.drawImage( + bg2, + BAR_WIDTH + GAMEVIEW_HEIGHT, + 0, + BAR_WIDTH, + GAMEVIEW_HEIGHT + ); + bgctx.globalAlpha = globalAlpha; + const bg3 = core.material.images.images["statusBackground.png"]; //横屏按钮 + //bgctx.drawImage(bg3, 0, 0, GAMEVIEW_WIDTH, GAMEVIEW_HEIGHT); + bgctx.globalAlpha = 1; + core.setTextAlign("outerUI", "center"); + } + } + // 更新属性 + _update_props(updatedFloorTitle) { + if (!updatedFloorTitle && core.status.floorId) { + updatedFloorTitle = core.status.maps[core.status.floorId].title; + } + const statusList = ["hp", "atk", "def", "money"]; //属性列表,图标在函数复写core.statusBar.icons中声明,数字为project\materials\icons.png中的图标序号(可使用便捷ps追加,第一个序号为0) + const drawStatusList = (baseX, baseY) => { + let curh = baseY; + core.setTextAlign("outerUI", "right"); + statusList.forEach((item) => { + // 绘制图标 + core.drawIcon( + "outerUI", + item, + baseX - 95 * 3, + curh - 18 * 3, + 22 * 3, + 22 * 3 + ); - // 四舍五入 - core.status.hero[item] = Math.round(core.status.hero[item]); - // 大数据格式化 - core.fillBoldText( - "outerUI", - core.getRealStatus(item), - baseX, - curh, - TEXT_COLOR, - "#000000", - 6 - ); - curh += 24 * 3; - if (curh > 130 * 3 && core.domStyle.isVertical) { - curh = 24 * 3; - baseX += 105 * 3; - } - }); - core.setTextAlign("outerUI", "center"); - }; - if (core.domStyle.isVertical) { - core.clearMap("outerUI", 10 * 3, 0, 210 * 3, 120 * 3); - core.setFont("outerUI", "bold 42px Verdana"); - if (updatedFloorTitle) { - core.fillBoldText( - "outerUI", - updatedFloorTitle, - 60 * 3, - 22 * 3, - TEXT_COLOR, - "#000000", - 6 - ); - } - //drawStatusList(96 * 3, 46 * 3); - //core.drawImage("outerUI", "lane1.png", 0, 0) - core.drawImage("outerUI", "cao.png", 0, 0); - } else { - core.clearMap("outerUI", 10 * 3, 40 * 3, 105 * 3, 250 * 3); - core.setFont("outerUI", "bold 48px Verdana"); - if (updatedFloorTitle) { - core.fillBoldText( - "outerUI", - updatedFloorTitle, - 62 * 3, - 41 * 3, - TEXT_COLOR, - "#000000", - 6 - ); - } - //drawStatusList(110 * 3, 93 * 3); - //core.drawImage("outerUI", "lane1.png", 0, 30) - core.drawImage("outerUI", "cao.png", 0, 0, 400, 350, 0, 30, 360, 315); - } - } - _update_items() { - //更新道具栏 - const drawItemMx = (drawFn) => { - for (let i = 0; i < this.itemMx.length; i++) { - for (let j = 0; j < this.itemMx[i].length; j++) { - var item = this.itemMx[i][j]; - drawFn(i, j, item); - } - } - }; - const drawItem = (item, posx, posy) => { - const icon = core.material.icons.items[item], - image = core.material.images.items; - core.drawImage( - "outerUI", - image, - 0, - 32 * icon, - 32, - 32, - posx, - posy, - 30 * 3, - 30 * 3 - ); - const cnt = core.itemCount(item); - if ( - (core.items.items[item].cls === "tools" && cnt > 1) || - FORCE_COUNTABLE_ITEMS.includes(item) - ) { - core.fillText( - "outerUI", - cnt, - posx + 25 * 3, - posy + 28 * 3, - "#FFFFFF", - "bold 36px Verdana" - ); - } - }; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - ITEM_BOX_LEFT_VERTICAL, - ITEM_BOX_TOP_VERTICAL, - 185 * 3, - 125 * 3 - ); + // 四舍五入 + core.status.hero[item] = Math.round(core.status.hero[item]); + // 大数据格式化 + core.fillBoldText( + "outerUI", + core.getRealStatus(item), + baseX, + curh, + TEXT_COLOR, + "#000000", + 6 + ); + curh += 24 * 3; + if (curh > 130 * 3 && core.domStyle.isVertical) { + curh = 24 * 3; + baseX += 105 * 3; + } + }); + core.setTextAlign("outerUI", "center"); + }; + if (core.domStyle.isVertical) { + core.clearMap("outerUI", 10 * 3, 0, 210 * 3, 120 * 3); + core.setFont("outerUI", "bold 42px Verdana"); + if (updatedFloorTitle) { + core.fillBoldText( + "outerUI", + updatedFloorTitle, + 60 * 3, + 22 * 3, + TEXT_COLOR, + "#000000", + 6 + ); + } + //drawStatusList(96 * 3, 46 * 3); + //core.drawImage("outerUI", "lane1.png", 0, 0) + core.drawImage("outerUI", "cao.png", 0, 0); + } else { + core.clearMap("outerUI", 10 * 3, 40 * 3, 105 * 3, 250 * 3); + core.setFont("outerUI", "bold 48px Verdana"); + if (updatedFloorTitle) { + core.fillBoldText( + "outerUI", + updatedFloorTitle, + 62 * 3, + 41 * 3, + TEXT_COLOR, + "#000000", + 6 + ); + } + //drawStatusList(110 * 3, 93 * 3); + //core.drawImage("outerUI", "lane1.png", 0, 30) + core.drawImage("outerUI", "cao.png", 0, 0, 400, 350, 0, 30, 360, 315); + } + } + _update_items() { + //更新道具栏 + const drawItemMx = (drawFn) => { + for (let i = 0; i < this.itemMx.length; i++) { + for (let j = 0; j < this.itemMx[i].length; j++) { + var item = this.itemMx[i][j]; + drawFn(i, j, item); + } + } + }; + const drawItem = (item, posx, posy) => { + const icon = core.material.icons.items[item], + image = core.material.images.items; + core.drawImage( + "outerUI", + image, + 0, + 32 * icon, + 32, + 32, + posx, + posy, + 30 * 3, + 30 * 3 + ); + const cnt = core.itemCount(item); + if ( + (core.items.items[item].cls === "tools" && cnt > 1) || + FORCE_COUNTABLE_ITEMS.includes(item) + ) { + core.fillText( + "outerUI", + cnt, + posx + 25 * 3, + posy + 28 * 3, + "#FFFFFF", + "bold 36px Verdana" + ); + } + }; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + ITEM_BOX_LEFT_VERTICAL, + ITEM_BOX_TOP_VERTICAL, + 185 * 3, + 125 * 3 + ); - drawItemMx((i, j, item) => { - if (core.hasItem(item)) { - const posx = ITEM_BOX_LEFT_VERTICAL + i * 30 * 3, - posy = ITEM_BOX_TOP_VERTICAL + j * 31 * 3; - drawItem(item, posx, posy); - } - }); - } else { - core.clearMap( - "outerUI", - ITEM_BOX_LEFT, - ITEM_BOX_TOP, - 125 * 3, - 185 * 3 - ); + drawItemMx((i, j, item) => { + if (core.hasItem(item)) { + const posx = ITEM_BOX_LEFT_VERTICAL + i * 30 * 3, + posy = ITEM_BOX_TOP_VERTICAL + j * 31 * 3; + drawItem(item, posx, posy); + } + }); + } else { + core.clearMap( + "outerUI", + ITEM_BOX_LEFT, + ITEM_BOX_TOP, + 125 * 3, + 185 * 3 + ); - drawItemMx((i, j, item) => { - if (core.hasItem(item)) { - const posx = ITEM_BOX_LEFT + j * 30 * 3, - posy = ITEM_BOX_TOP + i * 31 * 3; - drawItem(item, posx, posy); - } - }); - } - } + drawItemMx((i, j, item) => { + if (core.hasItem(item)) { + const posx = ITEM_BOX_LEFT + j * 30 * 3, + posy = ITEM_BOX_TOP + i * 31 * 3; + drawItem(item, posx, posy); + } + }); + } + } - _update_map(floorId = core.status.floorId) { - const x = core.domStyle.isVertical - ? MAP_BLOCK_LEFT_VERTICAL - : MAP_BLOCK_LEFT; - const y = core.domStyle.isVertical - ? MAP_BLOCK_TOP_VERTICAL - : MAP_BLOCK_TOP; - const w = core.domStyle.isVertical ? 300 : 300; - const h = core.domStyle.isVertical ? 300 : 300; - let sx, sy; - if (core.domStyle.isVertical) { - sy = y + 50; - sx = x + 5; - } else { - sy = y + 50; - sx = x + 30; - } - if (!floorId) return; - const info = core.plugin.getMapDrawInfo(floorId, Infinity, true); + _update_map(floorId = core.status.floorId) { + const x = core.domStyle.isVertical ? + MAP_BLOCK_LEFT_VERTICAL : + MAP_BLOCK_LEFT; + const y = core.domStyle.isVertical ? + MAP_BLOCK_TOP_VERTICAL : + MAP_BLOCK_TOP; + const w = core.domStyle.isVertical ? 300 : 300; + const h = core.domStyle.isVertical ? 300 : 300; + let sx, sy; + if (core.domStyle.isVertical) { + sy = y + 50; + sx = x + 5; + } else { + sy = y + 50; + sx = x + 30; + } + if (!floorId) return; + const info = core.plugin.getMapDrawInfo(floorId, Infinity, true); - //core.clearMap(uictx, sx, sy, w + 40, h + 60) - //core.fillRect(uictx, sx, sy, w, h, '#000') - //core.strokeRect(uictx, sx, sy, w, h, '#fff', 5) - core.setTextAlign("outerUI", "center"); - core.plugin.drawSmallMap( - floorctx, - info, - floorId, - MAP_BLOCK_LEFT, - MAP_BLOCK_TOP, - w, - h, - false - ); - core.plugin.drawSmallMap( - floorVerticalctx, - info, - floorId, - MAP_BLOCK_LEFT_VERTICAL, - MAP_BLOCK_TOP_VERTICAL, - w, - h, - true - ); - //core.fillText(uictx, core.status.maps[floorId].areas, sx + w / 2, sy - 10, '#FFFFFF') - } + //core.clearMap(uictx, sx, sy, w + 40, h + 60) + //core.fillRect(uictx, sx, sy, w, h, '#000') + //core.strokeRect(uictx, sx, sy, w, h, '#fff', 5) + core.setTextAlign("outerUI", "center"); + core.plugin.drawSmallMap( + floorctx, + info, + floorId, + MAP_BLOCK_LEFT, + MAP_BLOCK_TOP, + w, + h, + false + ); + core.plugin.drawSmallMap( + floorVerticalctx, + info, + floorId, + MAP_BLOCK_LEFT_VERTICAL, + MAP_BLOCK_TOP_VERTICAL, + w, + h, + true + ); + //core.fillText(uictx, core.status.maps[floorId].areas, sx + w / 2, sy - 10, '#FFFFFF') + } - _update_equips() { - return; - core.setFont("outerUI", "bold 48px Verdana"); - const drawEquip = (baseX, baseY, id, color, back) => { - if (!id) - core.fillText( - "outerUI", - back, - baseX + 20 * 3, - baseY + 22 * 3, - color - ); - else { - var icon = core.material.icons.items[id]; - core.drawImage( - "outerUI", - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - baseX + 5 * 3, - baseY, - 32 * 3, - 32 * 3 - ); - } - }; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL, - 90 * 3, - 130 * 3 - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL, - core.getEquip(0), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, - EQUIP_BLOCK_TOP_VERTICAL, - core.getEquip(1), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, - core.getEquip(2), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, - EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, - core.getEquip(3), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL, - EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, - core.getEquip(4), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, - EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, - core.getEquip(5), - "#D1CEFF", - "无" - ); - } else { - core.clearMap( - "outerUI", - EQUIP_BLOCK_LEFT, - EQUIP_BLOCK_TOP, - 130 * 3, - 95 * 3 - ); - drawEquip( - EQUIP_BLOCK_LEFT, - EQUIP_BLOCK_TOP, - core.getEquip(0), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 42 * 3, - EQUIP_BLOCK_TOP, - core.getEquip(1), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 85 * 3, - EQUIP_BLOCK_TOP, - core.getEquip(2), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT, - EQUIP_BLOCK_TOP + 45 * 3, - core.getEquip(3), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 42 * 3, - EQUIP_BLOCK_TOP + 45 * 3, - core.getEquip(4), - "#D1CEFF", - "无" - ); - drawEquip( - EQUIP_BLOCK_LEFT + 85 * 3, - EQUIP_BLOCK_TOP + 45 * 3, - core.getEquip(5), - "#D1CEFF", - "无" - ); - } - } - _update_keys() { - const drawKeyList = (baseX, baseY) => { - const todraw = [], - keyList = ["yellowKey", "blueKey", "redKey", "greenKey"]; - let total = 0; - keyList.forEach(function (key, i) { - todraw[i] = core.itemCount(key); - total += todraw[i]; - }); + _update_equips() { + return; + core.setFont("outerUI", "bold 48px Verdana"); + const drawEquip = (baseX, baseY, id, color, back) => { + if (!id) + core.fillText( + "outerUI", + back, + baseX + 20 * 3, + baseY + 22 * 3, + color + ); + else { + var icon = core.material.icons.items[id]; + core.drawImage( + "outerUI", + core.material.images.items, + 0, + 32 * icon, + 32, + 32, + baseX + 5 * 3, + baseY, + 32 * 3, + 32 * 3 + ); + } + }; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL, + 90 * 3, + 130 * 3 + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL, + core.getEquip(0), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, + EQUIP_BLOCK_TOP_VERTICAL, + core.getEquip(1), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, + core.getEquip(2), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, + EQUIP_BLOCK_TOP_VERTICAL + 45 * 3, + core.getEquip(3), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL, + EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, + core.getEquip(4), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT_VERTICAL + 45 * 3, + EQUIP_BLOCK_TOP_VERTICAL + 90 * 3, + core.getEquip(5), + "#D1CEFF", + "无" + ); + } else { + core.clearMap( + "outerUI", + EQUIP_BLOCK_LEFT, + EQUIP_BLOCK_TOP, + 130 * 3, + 95 * 3 + ); + drawEquip( + EQUIP_BLOCK_LEFT, + EQUIP_BLOCK_TOP, + core.getEquip(0), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 42 * 3, + EQUIP_BLOCK_TOP, + core.getEquip(1), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 85 * 3, + EQUIP_BLOCK_TOP, + core.getEquip(2), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT, + EQUIP_BLOCK_TOP + 45 * 3, + core.getEquip(3), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 42 * 3, + EQUIP_BLOCK_TOP + 45 * 3, + core.getEquip(4), + "#D1CEFF", + "无" + ); + drawEquip( + EQUIP_BLOCK_LEFT + 85 * 3, + EQUIP_BLOCK_TOP + 45 * 3, + core.getEquip(5), + "#D1CEFF", + "无" + ); + } + } + _update_keys() { + const drawKeyList = (baseX, baseY) => { + const todraw = [], + keyList = ["yellowKey", "blueKey", "redKey", "greenKey"]; + let total = 0; + keyList.forEach(function (key, i) { + todraw[i] = core.itemCount(key); + total += todraw[i]; + }); - let dn = 3; - for (let i = 0; i <= dn; i++) { - let delta = i * 32 * 3; + let dn = 3; + for (let i = 0; i <= dn; i++) { + let delta = i * 32 * 3; - if (core.domStyle.isVertical) { - this.drawKey(keyList[i], baseX, baseY + delta); - } else { - this.drawKey(keyList[i], baseX + delta, baseY); - } + if (core.domStyle.isVertical) { + this.drawKey(keyList[i], baseX, baseY + delta); + } else { + this.drawKey(keyList[i], baseX + delta, baseY); + } - core.setFont("outerUI", "bold 48px Verdana"); - core.setTextAlign("outerUI", "left"); - if (core.domStyle.isVertical) { - core.fillText( - "outerUI", - todraw[i], - baseX + 20 * 3, - baseY + 14 * 3 + delta, - TEXT_COLOR - ); - } else { - core.fillText( - "outerUI", - todraw[i], - baseX + delta, - baseY + 32 * 3, - TEXT_COLOR - ); - } - } - }; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - KEY_BLOCK_LEFT_VERTICAL, - KEY_BLOCK_TOP_VERTICAL, - 45 * 3, - 130 * 3 - ); - drawKeyList( - KEY_BLOCK_LEFT_VERTICAL + 3 * 3, - KEY_BLOCK_TOP_VERTICAL + 5 * 3 - ); - } else { - core.clearMap( - "outerUI", - KEY_BLOCK_LEFT, - KEY_BLOCK_TOP, - 130 * 3, - 45 * 3 - ); - drawKeyList(KEY_BLOCK_LEFT + 10 * 3, KEY_BLOCK_TOP); - } - } - drawKey(key, x, y) { - let sx = 0, - sy = 0; + core.setFont("outerUI", "bold 48px Verdana"); + core.setTextAlign("outerUI", "left"); + if (core.domStyle.isVertical) { + core.fillText( + "outerUI", + todraw[i], + baseX + 20 * 3, + baseY + 14 * 3 + delta, + TEXT_COLOR + ); + } else { + core.fillText( + "outerUI", + todraw[i], + baseX + delta, + baseY + 32 * 3, + TEXT_COLOR + ); + } + } + }; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + KEY_BLOCK_LEFT_VERTICAL, + KEY_BLOCK_TOP_VERTICAL, + 45 * 3, + 130 * 3 + ); + drawKeyList( + KEY_BLOCK_LEFT_VERTICAL + 3 * 3, + KEY_BLOCK_TOP_VERTICAL + 5 * 3 + ); + } else { + core.clearMap( + "outerUI", + KEY_BLOCK_LEFT, + KEY_BLOCK_TOP, + 130 * 3, + 45 * 3 + ); + drawKeyList(KEY_BLOCK_LEFT + 10 * 3, KEY_BLOCK_TOP); + } + } + drawKey(key, x, y) { + let sx = 0, + sy = 0; - if (key == "yellowKey") sx += 13; - else if (key == "blueKey") sx += 26; - else if (key == "greenKey") sx += 39; + if (key == "yellowKey") sx += 13; + else if (key == "blueKey") sx += 26; + else if (key == "greenKey") sx += 39; - core.drawImage( - "outerUI", - "maba.png", - sx, - sy, - 13, - 26, - x, - y, - 13 * 3, - 26 * 3 - ); - } - _update_infoWindow() { - const itemId = this.selectedItem; - let text = ""; - if (this.selectedItem) { - text = core.replaceText(core.material.items[itemId]?.text); - if (text[0] == "," || text[0] == ",") text = text.substring(1); - } - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - INFO_BLOCK_LEFT_VERTICAL, - INFO_BLOCK_TOP_VERTICAL, - 300 * 3, - 120 * 3 - ); + core.drawImage( + "outerUI", + "maba.png", + sx, + sy, + 13, + 26, + x, + y, + 13 * 3, + 26 * 3 + ); + } + _update_infoWindow() { + const itemId = this.selectedItem; + let text = ""; + if (this.selectedItem) { + text = core.replaceText(core.material.items[itemId]?.text); + if (text[0] == "," || text[0] == ",") text = text.substring(1); + } + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + INFO_BLOCK_LEFT_VERTICAL, + INFO_BLOCK_TOP_VERTICAL, + 300 * 3, + 120 * 3 + ); - if (this.selectedItem) { - const icon = core.material.icons.items[itemId]; - core.setTextAlign("outerUI", "left"); - core.fillText( - "outerUI", - core.material.items[itemId].name, - INFO_BLOCK_LEFT_VERTICAL + 50 * 3, - INFO_BLOCK_TOP_VERTICAL + 27 * 3, - "#D1CEFF" - ); - core.drawImage( - "outerUI", - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - INFO_BLOCK_LEFT_VERTICAL + 10 * 3, - INFO_BLOCK_TOP_VERTICAL + 8 * 3, - 32 * 3, - 32 * 3 - ); - core.ui.drawTextContent("outerUI", text, { - left: INFO_BLOCK_LEFT_VERTICAL + 10 * 3, - top: INFO_BLOCK_TOP_VERTICAL + 40 * 3, - maxWidth: 275 * 3, - color: "#D1CEFF", - fontSize: 36, - }); - } - } else { - core.clearMap( - "outerUI", - INFO_BLOCK_LEFT, - INFO_BLOCK_TOP, - 115 * 3, - 230 * 3 - ); + if (this.selectedItem) { + const icon = core.material.icons.items[itemId]; + core.setTextAlign("outerUI", "left"); + core.fillText( + "outerUI", + core.material.items[itemId].name, + INFO_BLOCK_LEFT_VERTICAL + 50 * 3, + INFO_BLOCK_TOP_VERTICAL + 27 * 3, + "#D1CEFF" + ); + core.drawImage( + "outerUI", + core.material.images.items, + 0, + 32 * icon, + 32, + 32, + INFO_BLOCK_LEFT_VERTICAL + 10 * 3, + INFO_BLOCK_TOP_VERTICAL + 8 * 3, + 32 * 3, + 32 * 3 + ); + core.ui.drawTextContent("outerUI", text, { + left: INFO_BLOCK_LEFT_VERTICAL + 10 * 3, + top: INFO_BLOCK_TOP_VERTICAL + 40 * 3, + maxWidth: 275 * 3, + color: "#D1CEFF", + fontSize: 36, + }); + } + } else { + core.clearMap( + "outerUI", + INFO_BLOCK_LEFT, + INFO_BLOCK_TOP, + 115 * 3, + 230 * 3 + ); - if (this.selectedItem) { - const icon = core.material.icons.items[itemId]; - core.setTextAlign("outerUI", "center"); - core.fillText( - "outerUI", - core.material.items[itemId].name, - INFO_BLOCK_LEFT + 60 * 3, - INFO_BLOCK_TOP + 25 * 3, - "#D1CEFF" - ); - core.drawImage( - "outerUI", - core.material.images.items, - 0, - 32 * icon, - 32, - 32, - INFO_BLOCK_LEFT + 45 * 3, - INFO_BLOCK_TOP + 30 * 3, - 32 * 3, - 32 * 3 - ); - core.ui.drawTextContent("outerUI", text, { - left: INFO_BLOCK_LEFT + 10 * 3, - top: INFO_BLOCK_TOP + 60 * 3, - maxWidth: 105 * 3, - color: "#D1CEFF", - fontSize: 36, - }); - } - } - } - showItemInfo(itemId) { - //展示道具说明 - this.selectedItem = itemId; - this._update_infoWindow(); - } - clearItemInfo() { - //清除道具说明 - this.selectedItem = null; - this._update_infoWindow(); - } - _update_toolBox() { - const tools = core.isReplaying() - ? [ - [core.status.replay.pausing ? "play" : "pause", "stop", "rewind"], - ["speedDown", "speedUp", "save"], - ] - : [ - ["keyboard", "shop", "pack", "T332"], - ["settings", "save", "load", "T331"], - ]; - if (core.domStyle.isVertical) { - core.clearMap( - "outerUI", - TOOL_BOX_LEFT_VERTICAL, - TOOL_BOX_TOP_VERTICAL, - 115, - 130 - ); + if (this.selectedItem) { + const icon = core.material.icons.items[itemId]; + core.setTextAlign("outerUI", "center"); + core.fillText( + "outerUI", + core.material.items[itemId].name, + INFO_BLOCK_LEFT + 60 * 3, + INFO_BLOCK_TOP + 25 * 3, + "#D1CEFF" + ); + core.drawImage( + "outerUI", + core.material.images.items, + 0, + 32 * icon, + 32, + 32, + INFO_BLOCK_LEFT + 45 * 3, + INFO_BLOCK_TOP + 30 * 3, + 32 * 3, + 32 * 3 + ); + core.ui.drawTextContent("outerUI", text, { + left: INFO_BLOCK_LEFT + 10 * 3, + top: INFO_BLOCK_TOP + 60 * 3, + maxWidth: 105 * 3, + color: "#D1CEFF", + fontSize: 36, + }); + } + } + } + showItemInfo(itemId) { + //展示道具说明 + this.selectedItem = itemId; + this._update_infoWindow(); + } + clearItemInfo() { + //清除道具说明 + this.selectedItem = null; + this._update_infoWindow(); + } + _update_toolBox() { + const tools = core.isReplaying() ? [ + [core.status.replay.pausing ? "play" : "pause", "stop", "rewind"], + ["speedDown", "speedUp", "save"], + ] : [ + ["keyboard", "shop", "pack", "T332"], + ["settings", "save", "load", "T331"], + ]; + if (core.domStyle.isVertical) { + core.clearMap( + "outerUI", + TOOL_BOX_LEFT_VERTICAL, + TOOL_BOX_TOP_VERTICAL, + 115, + 130 + ); - for (let i = 0; i < tools.length; i++) { - for (let j = 0; j < tools[i].length; j++) { - core.drawIcon( - "outerUI", - tools[i][j], - TOOL_BOX_LEFT_VERTICAL + i * 31 * 3, - TOOL_BOX_TOP_VERTICAL + j * 31 * 3, - 30 * 3, - 30 * 3 - ); - } - } - } else { - core.clearMap( - "outerUI", - TOOL_BOX_LEFT, - TOOL_BOX_TOP, - 130 * 3, - 80 * 3 - ); + for (let i = 0; i < tools.length; i++) { + for (let j = 0; j < tools[i].length; j++) { + core.drawIcon( + "outerUI", + tools[i][j], + TOOL_BOX_LEFT_VERTICAL + i * 31 * 3, + TOOL_BOX_TOP_VERTICAL + j * 31 * 3, + 30 * 3, + 30 * 3 + ); + } + } + } else { + core.clearMap( + "outerUI", + TOOL_BOX_LEFT, + TOOL_BOX_TOP, + 130 * 3, + 80 * 3 + ); - for (let i = 0; i < tools.length; i++) { - for (let j = 0; j < tools[i].length; j++) { - core.drawIcon( - "outerUI", - tools[i][j], - TOOL_BOX_LEFT + j * 31 * 3, - TOOL_BOX_TOP + i * 31 * 3, - 30 * 3, - 30 * 3 - ); - } - } - } - } - onclick(x, y) { - const makeBox = ([x, y], [w, h]) => { - return [ - [x, y], - [x + w, y + h], - ]; - }; - const gridify = ([x, y], [gw, gh]) => { - return [Math.floor(x / gw), Math.floor(y / gh)]; - }; - const useItem = (itemId) => { - if (!core.hasItem(itemId)) return; + for (let i = 0; i < tools.length; i++) { + for (let j = 0; j < tools[i].length; j++) { + core.drawIcon( + "outerUI", + tools[i][j], + TOOL_BOX_LEFT + j * 31 * 3, + TOOL_BOX_TOP + i * 31 * 3, + 30 * 3, + 30 * 3 + ); + } + } + } + } + onclick(x, y) { + const makeBox = ([x, y], [w, h]) => { + return [ + [x, y], + [x + w, y + h], + ]; + }; + const gridify = ([x, y], [gw, gh]) => { + return [Math.floor(x / gw), Math.floor(y / gh)]; + }; + const useItem = (itemId) => { + if (!core.hasItem(itemId)) return; - if (itemId != this.selectedItem) { - this.showItemInfo(itemId); - } else { - switch (itemId) { - case "centerFly": - core.ui._drawCenterFly(); - break; - case "book": - core.openBook(true); - break; - case "wand": - core.insertAction({ - type: "useItem", - id: itemId, - }); - break; - case "fly": - core.useItem(itemId, true); - break; - default: - core.useItem(itemId); - } - } - }; - const inRect = ([x, y], [[sx, sy], [dx, dy]]) => { - return sx <= x && x <= dx && sy <= y && y <= dy; - }; - const relativeTo = ([x, y], [ax, ay]) => { - return [x - ax, y - ay]; - }; - const pos = [x, y]; - if (core.domStyle.isVertical) { - const itemBox = makeBox( - [ITEM_BOX_LEFT_VERTICAL, ITEM_BOX_TOP_VERTICAL], - [30 * 6 * 3, 31 * 4 * 3] - ); - if (inRect(pos, itemBox)) { - const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [ - 30 * 3, - 31 * 3, - ]); - const itemId = this.itemMx[gx][gy]; - if ( - (core.status.event.id == "viewMaps" || - core.status.event.id == "fly") && - itemId === "book" - ) - core.openBook(true); - if ( - core.isReplaying() || - core.status.lockControl || - core.isMoving() - ) - return; - useItem(itemId); - return; - } - const toolBox = makeBox( - [TOOL_BOX_LEFT_VERTICAL, TOOL_BOX_TOP_VERTICAL], - [31 * 2 * 3, 31 * 4 * 3] - ); - if (inRect(pos, toolBox)) { - const [col, row] = gridify(relativeTo(pos, toolBox[0]), [ - 31 * 3, - 31 * 3, - ]); - if (core.isReplaying()) { - this.replayAction[col][row].call(core); - } else if (core.isPlaying()) { - if (col === 0 && row === 3) { - core.doSL("autoSave", "load"); - } else if (col === 1 && row === 3) { - core.doSL("autoSave", "reload"); - } else { - this.toolbarAction[col][row].call(core, true); - } - } - return; - } - 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 (itemId != this.selectedItem) { + this.showItemInfo(itemId); + } else { + switch (itemId) { + case "centerFly": + core.ui._drawCenterFly(); + break; + case "book": + core.openBook(true); + break; + case "wand": + core.insertAction({ + type: "useItem", + id: itemId, + }); + break; + case "fly": + core.useItem(itemId, true); + break; + default: + core.useItem(itemId); + } + } + }; + const inRect = ([x, y], [ + [sx, sy], + [dx, dy] + ]) => { + return sx <= x && x <= dx && sy <= y && y <= dy; + }; + const relativeTo = ([x, y], [ax, ay]) => { + return [x - ax, y - ay]; + }; + const pos = [x, y]; + if (core.domStyle.isVertical) { + const itemBox = makeBox( + [ITEM_BOX_LEFT_VERTICAL, ITEM_BOX_TOP_VERTICAL], + [30 * 6 * 3, 31 * 4 * 3] + ); + if (inRect(pos, itemBox)) { + const [gx, gy] = gridify(relativeTo(pos, itemBox[0]), [ + 30 * 3, + 31 * 3, + ]); + const itemId = this.itemMx[gx][gy]; + if ( + (core.status.event.id == "viewMaps" || + core.status.event.id == "fly") && + itemId === "book" + ) + core.openBook(true); + if ( + core.isReplaying() || + core.status.lockControl || + core.isMoving() + ) + return; + useItem(itemId); + return; + } + const toolBox = makeBox( + [TOOL_BOX_LEFT_VERTICAL, TOOL_BOX_TOP_VERTICAL], + [31 * 2 * 3, 31 * 4 * 3] + ); + if (inRect(pos, toolBox)) { + const [col, row] = gridify(relativeTo(pos, toolBox[0]), [ + 31 * 3, + 31 * 3, + ]); + if (core.isReplaying()) { + this.replayAction[col][row].call(core); + } else if (core.isPlaying()) { + if (col === 0 && row === 3) { + core.doSL("autoSave", "load"); + } else if (col === 1 && row === 3) { + core.doSL("autoSave", "reload"); + } else { + this.toolbarAction[col][row].call(core, true); + } + } + return; + } + 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 mapBox = makeBox([MAP_BLOCK_LEFT, MAP_BLOCK_TOP], [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; - } - /* + } else { + 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.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, - ]); - const itemId = this.itemMx[gy][gx]; - if ( - (core.status.event.id == "viewMaps" || - core.status.event.id == "fly") && - itemId === "book" - ) - core.openBook(true); - if ( - core.isReplaying() || - core.status.lockControl || - core.isMoving() - ) - return; - useItem(itemId); - return; - } - const toolBox = makeBox( - [TOOL_BOX_LEFT, TOOL_BOX_TOP], - [31 * 4 * 3, 31 * 2 * 3] - ); - if (inRect(pos, toolBox)) { - const [row, col] = gridify(relativeTo(pos, toolBox[0]), [ - 31 * 3, - 31 * 3, - ]); - if (core.isReplaying()) { - this.replayAction[col][row].call(core); - } else if (core.isPlaying()) { - if (col === 0 && row === 3) { - core.doSL("autoSave", "load"); - } else if (col === 1 && row === 3) { - core.doSL("autoSave", "reload"); - } else { - this.toolbarAction[col][row].call(core, 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, + ]); + const itemId = this.itemMx[gy][gx]; + if ( + (core.status.event.id == "viewMaps" || + core.status.event.id == "fly") && + itemId === "book" + ) + core.openBook(true); + if ( + core.isReplaying() || + core.status.lockControl || + core.isMoving() + ) + return; + useItem(itemId); + return; + } + const toolBox = makeBox( + [TOOL_BOX_LEFT, TOOL_BOX_TOP], + [31 * 4 * 3, 31 * 2 * 3] + ); + if (inRect(pos, toolBox)) { + const [row, col] = gridify(relativeTo(pos, toolBox[0]), [ + 31 * 3, + 31 * 3, + ]); + if (core.isReplaying()) { + this.replayAction[col][row].call(core); + } else if (core.isPlaying()) { + if (col === 0 && row === 3) { + core.doSL("autoSave", "load"); + } else if (col === 1 && row === 3) { + core.doSL("autoSave", "reload"); + } else { + this.toolbarAction[col][row].call(core, true); + } + } + return; + } + } + } + } - core.ui.statusBar = new StatusBar(); + core.ui.statusBar = new StatusBar(); - core.control.clearStatusBar = function () { - core.clearMap("outerUI"); - }; - // init() called in `afterLoadResources`. - }, + core.control.clearStatusBar = function () { + core.clearMap("outerUI"); + }; + // init() called in `afterLoadResources`. +}, "override": function () { core.statusBar.icons = { floor: 0, @@ -4793,435 +4791,435 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "新道具栏/装备栏": function () { - // 在此增加新插件 - // 注:///// *** 裹起来的区域: 该区域内参数可以随意更改调整ui绘制 不会影响总体布局 - // 请尽量修改该区域而不是其他区域 修改的时候最好可以对照现有ui修改 + // 在此增加新插件 + // 注:///// *** 裹起来的区域: 该区域内参数可以随意更改调整ui绘制 不会影响总体布局 + // 请尽量修改该区域而不是其他区域 修改的时候最好可以对照现有ui修改 - ///// *** 道具类型 - // cls对应name - var itemClsName = { - constants: "永久道具", - tools: "消耗道具", - }; - // 一页最大放的道具数量 将把整个道具左栏分成num份 每份是一个道具项 - var itemNum = 12; - ///// *** + ///// *** 道具类型 + // cls对应name + var itemClsName = { + constants: "永久道具", + tools: "消耗道具", + }; + // 一页最大放的道具数量 将把整个道具左栏分成num份 每份是一个道具项 + var itemNum = 12; + ///// *** - // 背景设置 - this.drawBoxBackground = function (ctx) { - core.setTextAlign(ctx, "left"); - core.clearMap(ctx); - core.deleteCanvas("_selector"); - var info = core.status.thisUIEventInfo || {}; + // 背景设置 + this.drawBoxBackground = function (ctx) { + core.setTextAlign(ctx, "left"); + core.clearMap(ctx); + core.deleteCanvas("_selector"); + var info = core.status.thisUIEventInfo || {}; - ///// *** 背景设置 - var max = core.__PIXELS__; - var x = 2, - y = x, - w = max - x * 2, - h = w; - var borderWidth = 2, - borderRadius = 5, // radius:圆角矩形的圆角半径 - borderStyle = "#fff"; - var backgroundColor = "gray"; - // 设置背景不透明度(0.85) - var backgroundAlpha = 0.85; - ///// *** + ///// *** 背景设置 + var max = core.__PIXELS__; + var x = 2, + y = x, + w = max - x * 2, + h = w; + var borderWidth = 2, + borderRadius = 5, // radius:圆角矩形的圆角半径 + borderStyle = "#fff"; + var backgroundColor = "gray"; + // 设置背景不透明度(0.85) + var backgroundAlpha = 0.85; + ///// *** - var start_x = x + borderWidth / 2, - start_y = y + borderWidth / 2, - width = max - start_x * 2, - height = max - start_y * 2; + var start_x = x + borderWidth / 2, + start_y = y + borderWidth / 2, + width = max - start_x * 2, + height = max - start_y * 2; - // 渐变色背景的一个例子(黑色渐变白色): - // 有关渐变色的具体知识请网上搜索canvas createGradient了解 - /* + // 渐变色背景的一个例子(黑色渐变白色): + // 有关渐变色的具体知识请网上搜索canvas createGradient了解 + /* var grd = ctx.createLinearGradient(x, y, x + w, y); grd.addColorStop(0, "black"); grd.addColorStop(1, "white"); backgroundColor = grd; */ - // 使用图片背景要注释掉下面的strokeRect和fillRoundRect - // 图片背景的一个例子: - /* + // 使用图片背景要注释掉下面的strokeRect和fillRoundRect + // 图片背景的一个例子: + /* core.drawImage(ctx, "xxx.png", x, y, w, h); core.strokeRect(ctx, x, y, w, h, borderStyle, borderWidth); */ - core.setAlpha(ctx, backgroundAlpha); - core.strokeRoundRect( - ctx, - x, - y, - w, - h, - borderRadius, - borderStyle, - borderWidth - ); - core.fillRoundRect( - ctx, - start_x, - start_y, - width, - height, - borderRadius, - backgroundColor - ); - core.setAlpha(ctx, 1); + core.setAlpha(ctx, backgroundAlpha); + core.strokeRoundRect( + ctx, + x, + y, + w, + h, + borderRadius, + borderStyle, + borderWidth + ); + core.fillRoundRect( + ctx, + start_x, + start_y, + width, + height, + borderRadius, + backgroundColor + ); + core.setAlpha(ctx, 1); - ///// *** 左栏配置 - var leftbar_height = height; - // 左边栏宽度(width*0.6) 本身仅为坐标使用 需要与底下的rightbar_width(width*0.4)同时更改 - var leftbar_width = width * 0.6; - ///// *** + ///// *** 左栏配置 + var leftbar_height = height; + // 左边栏宽度(width*0.6) 本身仅为坐标使用 需要与底下的rightbar_width(width*0.4)同时更改 + var leftbar_width = width * 0.6; + ///// *** - // xxx_right参数 代表最右侧坐标 - var leftbar_right = start_x + leftbar_width - borderWidth / 2; - var leftbar_bottom = start_y + leftbar_height; - var leftbar_x = start_x; - var leftbar_y = start_y; + // xxx_right参数 代表最右侧坐标 + var leftbar_right = start_x + leftbar_width - borderWidth / 2; + var leftbar_bottom = start_y + leftbar_height; + var leftbar_x = start_x; + var leftbar_y = start_y; - ///// *** 道具栏配置 - var boxName_color = "#fff"; - var boxName_fontSize = 15; - var boxName_font = core.ui._buildFont(boxName_fontSize, true); - var arrow_x = 10 + start_x; - var arrow_y = 10 + start_y; - var arrow_width = 20; - var arrow_style = "white"; - // 暂时只能是1 否则不太行 等待新样板(2.7.3)之后对drawArrow做优化 - var arrow_lineWidth = 1; - // 右箭头 - var rightArrow_right = leftbar_right - 10; - // 道具内栏顶部坐标 本质是通过该项 控制(道具栏顶部文字和箭头)与道具内栏顶部的间隔 - var itembar_top = arrow_y + 15; - ///// *** + ///// *** 道具栏配置 + var boxName_color = "#fff"; + var boxName_fontSize = 15; + var boxName_font = core.ui._buildFont(boxName_fontSize, true); + var arrow_x = 10 + start_x; + var arrow_y = 10 + start_y; + var arrow_width = 20; + var arrow_style = "white"; + // 暂时只能是1 否则不太行 等待新样板(2.7.3)之后对drawArrow做优化 + var arrow_lineWidth = 1; + // 右箭头 + var rightArrow_right = leftbar_right - 10; + // 道具内栏顶部坐标 本质是通过该项 控制(道具栏顶部文字和箭头)与道具内栏顶部的间隔 + var itembar_top = arrow_y + 15; + ///// *** - var itembar_right = rightArrow_right; - var boxName = - core.status.event.id == "toolbox" - ? "\r[yellow]道具栏\r | 装备栏" - : "道具栏 | \r[yellow]装备栏\r"; - core.drawArrow( - ctx, - arrow_x + arrow_width, - arrow_y, - arrow_x, - arrow_y, - arrow_style, - arrow_lineWidth - ); - core.drawArrow( - ctx, - rightArrow_right - arrow_width, - arrow_y, - rightArrow_right, - arrow_y, - arrow_style, - arrow_lineWidth - ); - core.setTextAlign(ctx, "center"); - core.setTextBaseline(ctx, "middle"); - var changeBox = function () { - var id = core.status.event.id; - core.closePanel(); - if (id == "toolbox") core.openEquipbox(); - else core.openToolbox(); - }; - core.fillText( - ctx, - boxName, - (leftbar_right + leftbar_x) / 2, - arrow_y + 2, - boxName_color, - boxName_font - ); + var itembar_right = rightArrow_right; + var boxName = + core.status.event.id == "toolbox" ? + "\r[yellow]道具栏\r | 装备栏" : + "道具栏 | \r[yellow]装备栏\r"; + core.drawArrow( + ctx, + arrow_x + arrow_width, + arrow_y, + arrow_x, + arrow_y, + arrow_style, + arrow_lineWidth + ); + core.drawArrow( + ctx, + rightArrow_right - arrow_width, + arrow_y, + rightArrow_right, + arrow_y, + arrow_style, + arrow_lineWidth + ); + core.setTextAlign(ctx, "center"); + core.setTextBaseline(ctx, "middle"); + var changeBox = function () { + var id = core.status.event.id; + core.closePanel(); + if (id == "toolbox") core.openEquipbox(); + else core.openToolbox(); + }; + core.fillText( + ctx, + boxName, + (leftbar_right + leftbar_x) / 2, + arrow_y + 2, + boxName_color, + boxName_font + ); - ///// *** 底栏按钮 - var pageBtn_radius = 8; - // xxx_left 最左侧坐标 - var pageBtn_left = leftbar_x + 3; - var pageBtn_right = leftbar_right - 3; - // xxx_bottom 最底部坐标 - var pageBtn_bottom = leftbar_bottom - 2; - var pageBtn_borderStyle = "#fff"; - var pageBtn_borderWidth = 2; - var pageText_color = "#fff"; - // 底部按钮与上面的道具内栏的间隔大小 - var bottomSpace = 8; - ///// *** + ///// *** 底栏按钮 + var pageBtn_radius = 8; + // xxx_left 最左侧坐标 + var pageBtn_left = leftbar_x + 3; + var pageBtn_right = leftbar_right - 3; + // xxx_bottom 最底部坐标 + var pageBtn_bottom = leftbar_bottom - 2; + var pageBtn_borderStyle = "#fff"; + var pageBtn_borderWidth = 2; + var pageText_color = "#fff"; + // 底部按钮与上面的道具内栏的间隔大小 + var bottomSpace = 8; + ///// *** - core.drawItemListbox_setPageBtn( - ctx, - pageBtn_left, - pageBtn_right, - pageBtn_bottom, - pageBtn_radius, - pageBtn_borderStyle, - pageBtn_borderWidth - ); - var page = info.page || 1; - var pageFontSize = pageBtn_radius * 2 - 4; - var pageFont = core.ui._buildFont(pageFontSize); - core.setPageItems(page); - var num = itemNum; - if (core.status.event.id == "equipbox") num -= 5; - var maxPage = info.maxPage; - var pageText = page + " / " + maxPage; - core.setTextAlign(ctx, "center"); - core.setTextBaseline(ctx, "bottom"); - core.fillText( - ctx, - pageText, - (leftbar_x + leftbar_right) / 2, - pageBtn_bottom, - pageText_color, - pageFont - ); - core.addUIEventListener( - start_x, - start_y, - leftbar_right - start_x, - arrow_y - start_y + 13, - changeBox - ); - var itembar_height = Math.ceil( - pageBtn_bottom - - pageBtn_radius * 2 - - pageBtn_borderWidth / 2 - - bottomSpace - - itembar_top - ); - var oneItemHeight = (itembar_height - 4) / itemNum; - return { - x: start_x, - y: start_y, - width: width, - height: height, - leftbar_right: leftbar_right, - obj: { - x: arrow_x, - y: itembar_top, - width: itembar_right - arrow_x, - height: itembar_height, - oneItemHeight: oneItemHeight, - }, - }; - }; + core.drawItemListbox_setPageBtn( + ctx, + pageBtn_left, + pageBtn_right, + pageBtn_bottom, + pageBtn_radius, + pageBtn_borderStyle, + pageBtn_borderWidth + ); + var page = info.page || 1; + var pageFontSize = pageBtn_radius * 2 - 4; + var pageFont = core.ui._buildFont(pageFontSize); + core.setPageItems(page); + var num = itemNum; + if (core.status.event.id == "equipbox") num -= 5; + var maxPage = info.maxPage; + var pageText = page + " / " + maxPage; + core.setTextAlign(ctx, "center"); + core.setTextBaseline(ctx, "bottom"); + core.fillText( + ctx, + pageText, + (leftbar_x + leftbar_right) / 2, + pageBtn_bottom, + pageText_color, + pageFont + ); + core.addUIEventListener( + start_x, + start_y, + leftbar_right - start_x, + arrow_y - start_y + 13, + changeBox + ); + var itembar_height = Math.ceil( + pageBtn_bottom - + pageBtn_radius * 2 - + pageBtn_borderWidth / 2 - + bottomSpace - + itembar_top + ); + var oneItemHeight = (itembar_height - 4) / itemNum; + return { + x: start_x, + y: start_y, + width: width, + height: height, + leftbar_right: leftbar_right, + obj: { + x: arrow_x, + y: itembar_top, + width: itembar_right - arrow_x, + height: itembar_height, + oneItemHeight: oneItemHeight, + }, + }; + }; - this.drawItemListbox = function (ctx, obj) { - ctx = ctx || core.canvas.ui; - var itembar_x = obj.x, - itembar_y = obj.y, - itembar_width = obj.width, - itembar_height = obj.height, - itemNum = obj.itemNum, - oneItemHeight = obj.oneItemHeight; - var itembar_right = itembar_x + itembar_width; - var info = core.status.thisUIEventInfo || {}; - var obj = {}; - var page = info.page || 1, - index = info.index, - select = info.select || {}; + this.drawItemListbox = function (ctx, obj) { + ctx = ctx || core.canvas.ui; + var itembar_x = obj.x, + itembar_y = obj.y, + itembar_width = obj.width, + itembar_height = obj.height, + itemNum = obj.itemNum, + oneItemHeight = obj.oneItemHeight; + var itembar_right = itembar_x + itembar_width; + var info = core.status.thisUIEventInfo || {}; + var obj = {}; + var page = info.page || 1, + index = info.index, + select = info.select || {}; - ///// *** 道具栏内栏配置 - var itembar_style = "black"; - var itembar_alpha = 0.7; - // 一个竖屏下减少道具显示的例子: - // if (core.domStyle.isVertical) itemNum = 10; - // 每个道具项的上下空隙占总高度的比例 - var itembar_marginHeightRatio = 0.2; - // 左右间隔空隙 - var item_marginLeft = 2; - var item_x = itembar_x + 2, - item_y = itembar_y + 2, - item_right = itembar_right - 2, - itemName_color = "#fff"; - // 修改此项以更换闪烁光标 - var item_selector = "winskin.png"; - ///// *** + ///// *** 道具栏内栏配置 + var itembar_style = "black"; + var itembar_alpha = 0.7; + // 一个竖屏下减少道具显示的例子: + // if (core.domStyle.isVertical) itemNum = 10; + // 每个道具项的上下空隙占总高度的比例 + var itembar_marginHeightRatio = 0.2; + // 左右间隔空隙 + var item_marginLeft = 2; + var item_x = itembar_x + 2, + item_y = itembar_y + 2, + item_right = itembar_right - 2, + itemName_color = "#fff"; + // 修改此项以更换闪烁光标 + var item_selector = "winskin.png"; + ///// *** - core.setAlpha(ctx, itembar_alpha); - core.fillRect( - ctx, - itembar_x, - itembar_y, - itembar_width, - itembar_height, - itembar_style - ); - core.setAlpha(ctx, 1); - var pageItems = core.setPageItems(page); - var marginHeight = itembar_marginHeightRatio * oneItemHeight; - core.setTextBaseline(ctx, "middle"); - var originColor = itemName_color; - for (var i = 0; i < pageItems.length; i++) { - itemName_color = originColor; - var item = pageItems[i]; - // 设置某个的字体颜色的一个例子 - // if (item.id == "xxx") itemName_color = "green"; - core.drawItemListbox_drawItem( - ctx, - item_x, - item_right, - item_y, - oneItemHeight, - item_marginLeft, - marginHeight, - itemName_color, - pageItems[i] - ); - if (index == i + 1) - core.ui._drawWindowSelector( - item_selector, - item_x + 1, - item_y - 1, - item_right - item_x - 2, - oneItemHeight - 2 - ); - item_y += oneItemHeight; - } - }; + core.setAlpha(ctx, itembar_alpha); + core.fillRect( + ctx, + itembar_x, + itembar_y, + itembar_width, + itembar_height, + itembar_style + ); + core.setAlpha(ctx, 1); + var pageItems = core.setPageItems(page); + var marginHeight = itembar_marginHeightRatio * oneItemHeight; + core.setTextBaseline(ctx, "middle"); + var originColor = itemName_color; + for (var i = 0; i < pageItems.length; i++) { + itemName_color = originColor; + var item = pageItems[i]; + // 设置某个的字体颜色的一个例子 + // if (item.id == "xxx") itemName_color = "green"; + core.drawItemListbox_drawItem( + ctx, + item_x, + item_right, + item_y, + oneItemHeight, + item_marginLeft, + marginHeight, + itemName_color, + pageItems[i] + ); + if (index == i + 1) + core.ui._drawWindowSelector( + item_selector, + item_x + 1, + item_y - 1, + item_right - item_x - 2, + oneItemHeight - 2 + ); + item_y += oneItemHeight; + } + }; - this.drawToolboxRightbar = function (ctx, obj) { - ctx = ctx || core.canvas.ui; - var info = core.status.thisUIEventInfo || {}; - var page = info.page || 1, - index = info.index || 1, - select = info.select || {}; - var start_x = obj.x, - start_y = obj.y, - width = obj.width, - height = obj.height; - var toolboxRight = start_x + width, - toolboxBottom = start_y + height; + this.drawToolboxRightbar = function (ctx, obj) { + ctx = ctx || core.canvas.ui; + var info = core.status.thisUIEventInfo || {}; + var page = info.page || 1, + index = info.index || 1, + select = info.select || {}; + var start_x = obj.x, + start_y = obj.y, + width = obj.width, + height = obj.height; + var toolboxRight = start_x + width, + toolboxBottom = start_y + height; - ///// *** 侧边栏(rightbar)背景设置(物品介绍) - var rightbar_width = width * 0.4; - var rightbar_height = height; - var rightbar_lineWidth = 2; - var rightbar_lineStyle = "#fff"; - ///// *** + ///// *** 侧边栏(rightbar)背景设置(物品介绍) + var rightbar_width = width * 0.4; + var rightbar_height = height; + var rightbar_lineWidth = 2; + var rightbar_lineStyle = "#fff"; + ///// *** - var rightbar_x = toolboxRight - rightbar_width - rightbar_lineWidth / 2; - var rightbar_y = start_y; - core.drawLine( - ctx, - rightbar_x, - rightbar_y, - rightbar_x, - rightbar_y + rightbar_height, - rightbar_lineStyle, - rightbar_lineWidth - ); + var rightbar_x = toolboxRight - rightbar_width - rightbar_lineWidth / 2; + var rightbar_y = start_y; + core.drawLine( + ctx, + rightbar_x, + rightbar_y, + rightbar_x, + rightbar_y + rightbar_height, + rightbar_lineStyle, + rightbar_lineWidth + ); - // 获取道具id(有可能为null) - var itemId = select.id; - var item = core.material.items[itemId]; + // 获取道具id(有可能为null) + var itemId = select.id; + var item = core.material.items[itemId]; - ///// *** 侧边栏物品Icon信息 - var iconRect_y = rightbar_y + 10; - // space:间距 - // 这里布局设定iconRect与侧边栏左边框 itemName与工具栏右边框 itemRect与itemName的间距均为space - var space = 15; - var iconRect_x = rightbar_x + space; - var iconRect_radius = 2, - iconRect_width = 32, - iconRect_height = 32, - iconRect_style = "#fff", - iconRect_lineWidth = 2; - ///// *** + ///// *** 侧边栏物品Icon信息 + var iconRect_y = rightbar_y + 10; + // space:间距 + // 这里布局设定iconRect与侧边栏左边框 itemName与工具栏右边框 itemRect与itemName的间距均为space + var space = 15; + var iconRect_x = rightbar_x + space; + var iconRect_radius = 2, + iconRect_width = 32, + iconRect_height = 32, + iconRect_style = "#fff", + iconRect_lineWidth = 2; + ///// *** - var iconRect_bottom = iconRect_y + iconRect_height, - iconRect_right = iconRect_x + iconRect_width; + var iconRect_bottom = iconRect_y + iconRect_height, + iconRect_right = iconRect_x + iconRect_width; - ///// *** 侧边栏各项信息 - var itemTextFontSize = 15, - itemText_x = iconRect_x - 4, - itemText_y = Math.floor(start_y + rightbar_height * 0.25), // 坐标取整防止模糊 - itemClsFontSize = 15, - itemClsFont = core.ui._buildFont(itemClsFontSize), - itemClsColor = "#fff", - itemCls_x = itemText_x - itemClsFontSize / 2, - itemCls_middle = (iconRect_bottom + itemText_y) / 2, //_middle代表文字的中心y坐标 - itemNameFontSize = 18, - itemNameColor = "#fff", - itemNameFont = core.ui._buildFont(itemNameFontSize, true); - var itemName_x = iconRect_right + space; - var itemName_middle = - iconRect_y + iconRect_height / 2 + iconRect_lineWidth; - // 修改这里可以编辑未选中道具时的默认值 - var defaultItem = { - cls: "constants", - name: "未知道具", - text: "没有道具最永久", - }; - var defaultEquip = { - cls: "equips", - name: "未知装备", - text: "一无所有,又何尝不是一种装备", - equipCls: "无", - equip: { - type: "装备", - }, - }; - ///// *** + ///// *** 侧边栏各项信息 + var itemTextFontSize = 15, + itemText_x = iconRect_x - 4, + itemText_y = Math.floor(start_y + rightbar_height * 0.25), // 坐标取整防止模糊 + itemClsFontSize = 15, + itemClsFont = core.ui._buildFont(itemClsFontSize), + itemClsColor = "#fff", + itemCls_x = itemText_x - itemClsFontSize / 2, + itemCls_middle = (iconRect_bottom + itemText_y) / 2, //_middle代表文字的中心y坐标 + itemNameFontSize = 18, + itemNameColor = "#fff", + itemNameFont = core.ui._buildFont(itemNameFontSize, true); + var itemName_x = iconRect_right + space; + var itemName_middle = + iconRect_y + iconRect_height / 2 + iconRect_lineWidth; + // 修改这里可以编辑未选中道具时的默认值 + var defaultItem = { + cls: "constants", + name: "未知道具", + text: "没有道具最永久", + }; + var defaultEquip = { + cls: "equips", + name: "未知装备", + text: "一无所有,又何尝不是一种装备", + equipCls: "无", + equip: { + type: "装备", + }, + }; + ///// *** - var originItem = item; - if (core.status.event.id == "equipbox") item = item || defaultEquip; - item = item || defaultItem; - var itemCls = item.cls, - itemName = item.name, - itemText = item.text; - itemText = core.replaceText(itemText); - if (itemText[0] == "," || itemText[0] == ",") - itemText = itemText.substring(1); - /* 一个根据道具id修改道具名字(右栏)的例子 - * if (item.id == "xxx") itemNameColor = "red"; - */ - var itemClsName = core.getItemClsName(item); - var itemNameMaxWidth = - rightbar_width - iconRect_width - iconRect_lineWidth * 2 - space * 2; - core.strokeRoundRect( - ctx, - iconRect_x, - iconRect_y, - iconRect_width, - iconRect_height, - iconRect_radius, - iconRect_style, - iconRect_lineWidth - ); - if (item.id) - core.drawIcon( - ctx, - item.id, - iconRect_x + iconRect_lineWidth / 2, - iconRect_y + iconRect_lineWidth / 2, - iconRect_width - iconRect_lineWidth, - iconRect_height - iconRect_lineWidth - ); - core.setTextAlign(ctx, "left"); - core.setTextBaseline(ctx, "middle"); - core.fillText( - ctx, - itemName, - itemName_x, - itemName_middle, - itemNameColor, - itemNameFont, - itemNameMaxWidth - ); - core.fillText( - ctx, - "【" + itemClsName + "】", - itemCls_x, - itemCls_middle, - itemClsColor, - itemClsFont - ); - var statusText = "【装备类型】" + item.equipCls + "\n\n"; - /*if (core.status.event.id == "equipbox") { + var originItem = item; + if (core.status.event.id == "equipbox") item = item || defaultEquip; + item = item || defaultItem; + var itemCls = item.cls, + itemName = item.name, + itemText = item.text; + itemText = core.replaceText(itemText); + if (itemText[0] == "," || itemText[0] == ",") + itemText = itemText.substring(1); + /* 一个根据道具id修改道具名字(右栏)的例子 + * if (item.id == "xxx") itemNameColor = "red"; + */ + var itemClsName = core.getItemClsName(item); + var itemNameMaxWidth = + rightbar_width - iconRect_width - iconRect_lineWidth * 2 - space * 2; + core.strokeRoundRect( + ctx, + iconRect_x, + iconRect_y, + iconRect_width, + iconRect_height, + iconRect_radius, + iconRect_style, + iconRect_lineWidth + ); + if (item.id) + core.drawIcon( + ctx, + item.id, + iconRect_x + iconRect_lineWidth / 2, + iconRect_y + iconRect_lineWidth / 2, + iconRect_width - iconRect_lineWidth, + iconRect_height - iconRect_lineWidth + ); + core.setTextAlign(ctx, "left"); + core.setTextBaseline(ctx, "middle"); + core.fillText( + ctx, + itemName, + itemName_x, + itemName_middle, + itemNameColor, + itemNameFont, + itemNameMaxWidth + ); + core.fillText( + ctx, + "【" + itemClsName + "】", + itemCls_x, + itemCls_middle, + itemClsColor, + itemClsFont + ); + var statusText = "【装备类型】" + item.equipCls + "\n\n"; + /*if (core.status.event.id == "equipbox") { var type = item.equip.type; if (typeof type == "string") type = core.getEquipTypeByName(type); var compare = core.compareEquipment(item.id, core.getEquip(type)); @@ -5240,956 +5238,955 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n"; } }*/ - itemText = statusText + itemText; - core.drawTextContent(ctx, itemText, { - left: itemText_x, - top: itemText_y, - bold: false, - color: "white", - align: "left", - fontSize: itemTextFontSize, - maxWidth: - rightbar_width - (itemText_x - rightbar_x) * 2 + itemTextFontSize / 2, - }); + itemText = statusText + itemText; + core.drawTextContent(ctx, itemText, { + left: itemText_x, + top: itemText_y, + bold: false, + color: "white", + align: "left", + fontSize: itemTextFontSize, + maxWidth: rightbar_width - (itemText_x - rightbar_x) * 2 + itemTextFontSize / 2, + }); - ///// *** 退出按钮设置 - var btnRadius = 10; - var btnBorderWidth = 2; - var btnRight = toolboxRight - 2; - var btnBottom = toolboxBottom - 2; - var btnBorderStyle = "#fff"; - ///// *** + ///// *** 退出按钮设置 + var btnRadius = 10; + var btnBorderWidth = 2; + var btnRight = toolboxRight - 2; + var btnBottom = toolboxBottom - 2; + var btnBorderStyle = "#fff"; + ///// *** - // 获取圆心位置 - var btn_x = btnRight - btnRadius - btnBorderWidth / 2, - btn_y = btnBottom - btnRadius - btnBorderWidth / 2; - core.drawToolbox_setExitBtn( - ctx, - btn_x, - btn_y, - btnRadius, - btnBorderStyle, - btnBorderWidth - ); + // 获取圆心位置 + var btn_x = btnRight - btnRadius - btnBorderWidth / 2, + btn_y = btnBottom - btnRadius - btnBorderWidth / 2; + core.drawToolbox_setExitBtn( + ctx, + btn_x, + btn_y, + btnRadius, + btnBorderStyle, + btnBorderWidth + ); - ///// *** 使用按钮设置 - var useBtnHeight = btnRadius * 2; - // 这里不设置useBtnWidth而是根据各项数据自动得出width - var useBtnRadius = useBtnHeight / 2; - var useBtn_x = rightbar_x + 4, - useBtn_y = btnBottom - useBtnHeight; - var useBtnBorderStyle = "#fff"; - var useBtnBorderWidth = btnBorderWidth; - ///// *** + ///// *** 使用按钮设置 + var useBtnHeight = btnRadius * 2; + // 这里不设置useBtnWidth而是根据各项数据自动得出width + var useBtnRadius = useBtnHeight / 2; + var useBtn_x = rightbar_x + 4, + useBtn_y = btnBottom - useBtnHeight; + var useBtnBorderStyle = "#fff"; + var useBtnBorderWidth = btnBorderWidth; + ///// *** - core.drawToolbox_setUseBtn( - ctx, - useBtn_x, - useBtn_y, - useBtnRadius, - useBtnHeight, - useBtnBorderStyle, - useBtnBorderWidth - ); - }; + core.drawToolbox_setUseBtn( + ctx, + useBtn_x, + useBtn_y, + useBtnRadius, + useBtnHeight, + useBtnBorderStyle, + useBtnBorderWidth + ); + }; - this.drawEquipbox_drawOthers = function (ctx, obj) { - var info = core.status.thisUIEventInfo; + this.drawEquipbox_drawOthers = function (ctx, obj) { + var info = core.status.thisUIEventInfo; - ///// *** 装备格设置 - var equipList_lineWidth = 2; - var equipList_boxSize = 32; - var equipList_borderWidth = 2; - var equipList_borderStyle = "#fff"; - var equipList_nameColor = "#fff"; - ///// *** + ///// *** 装备格设置 + var equipList_lineWidth = 2; + var equipList_boxSize = 32; + var equipList_borderWidth = 2; + var equipList_borderStyle = "#fff"; + var equipList_nameColor = "#fff"; + ///// *** - var equipList_x = obj.x + 4, - equipList_bottom = obj.obj.y - equipList_lineWidth, - equipList_y = equipList_bottom - obj.obj.oneItemHeight * reduceItem - 2, - equipList_height = equipList_bottom - equipList_y; - var equipList_right = obj.leftbar_right, - equipList_width = equipList_right - equipList_x; - core.drawLine( - ctx, - obj.x, - equipList_bottom + equipList_lineWidth / 2, - equipList_right, - equipList_bottom + equipList_lineWidth / 2, - equipList_borderStyle, - equipList_lineWidth - ); - var toDrawList = core.status.globalAttribute.equipName, - len = toDrawList.length; + var equipList_x = obj.x + 4, + equipList_bottom = obj.obj.y - equipList_lineWidth, + equipList_y = equipList_bottom - obj.obj.oneItemHeight * reduceItem - 2, + equipList_height = equipList_bottom - equipList_y; + var equipList_right = obj.leftbar_right, + equipList_width = equipList_right - equipList_x; + core.drawLine( + ctx, + obj.x, + equipList_bottom + equipList_lineWidth / 2, + equipList_right, + equipList_bottom + equipList_lineWidth / 2, + equipList_borderStyle, + equipList_lineWidth + ); + var toDrawList = core.status.globalAttribute.equipName, + len = toDrawList.length; - ///// *** 装备格设置 - var maxItem = 4; - var box_width = 32, - box_height = 32, - box_borderStyle = "#fff", - box_selectBorderStyle = "gold", // 选中的装备格的颜色 - box_borderWidth = 2; - var boxName_fontSize = 14, - boxName_space = 2, - boxName_color = "#fff"; // 装备格名称与上面的装备格框的距离 - var maxLine = Math.ceil(len / maxItem); - ///// *** - var l = Math.sqrt(len); - if (Math.pow(l) == len && len != 4) { - if (l <= maxItem) maxItem = l; - } - maxItem = Math.min(toDrawList.length, maxItem); - info.equips = maxItem; + ///// *** 装备格设置 + var maxItem = 4; + var box_width = 32, + box_height = 32, + box_borderStyle = "#fff", + box_selectBorderStyle = "gold", // 选中的装备格的颜色 + box_borderWidth = 2; + var boxName_fontSize = 14, + boxName_space = 2, + boxName_color = "#fff"; // 装备格名称与上面的装备格框的距离 + var maxLine = Math.ceil(len / maxItem); + ///// *** + var l = Math.sqrt(len); + if (Math.pow(l) == len && len != 4) { + if (l <= maxItem) maxItem = l; + } + maxItem = Math.min(toDrawList.length, maxItem); + info.equips = maxItem; - var boxName_font = core.ui._buildFont(boxName_fontSize); - // 总宽高减去所有装备格宽高得到空隙大小 - var oneBoxWidth = box_width + box_borderWidth * 2; - var oneBoxHeight = - box_height + boxName_fontSize + boxName_space + 2 * box_borderWidth; - var space_y = (equipList_height - maxLine * oneBoxHeight) / (1 + maxLine), - space_x = (equipList_width - maxItem * oneBoxWidth) / (1 + maxItem); - var box_x = equipList_x + space_x, - box_y = equipList_y + space_y; - for (var i = 0; i < len; i++) { - var id = core.getEquip(i), - name = toDrawList[i]; - if (i === 0) name = "主手"; - if (i === 1) name = "副手"; - var selectBorder = false; - if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; - var borderStyle = selectBorder - ? box_selectBorderStyle - : box_borderStyle; - core.drawEquipbox_drawOne( - ctx, - name, - id, - box_x, - box_y, - box_width, - box_height, - boxName_space, - boxName_font, - boxName_color, - borderStyle, - box_borderWidth - ); - var todo = new Function( - "core.clickOneEquipbox('" + id + "'," + i + ")" - ); - core.addUIEventListener( - box_x - box_borderWidth / 2, - box_y - box_borderWidth / 2, - oneBoxWidth, - oneBoxHeight, - todo - ); - box_x += space_x + oneBoxWidth; - if ((i + 1) % maxItem == 0) { - box_x = equipList_x + space_x; - box_y += space_y + oneBoxHeight; - } - } - if (core.material.items[core.getEquip(0)]?.equipCls === "双手剑") { - core.drawLine( - ctx, - equipList_x + space_x + space_x + oneBoxWidth, - equipList_y + space_y, - equipList_x + - space_x + - space_x + - oneBoxWidth + - box_width + - box_borderWidth, - equipList_y + space_y + box_height - ); - core.drawLine( - ctx, - equipList_x + space_x + space_x + oneBoxWidth, - equipList_y + space_y + box_height, - equipList_x + - space_x + - space_x + - oneBoxWidth + - box_width + - box_borderWidth, - equipList_y + space_y - ); - } - }; + var boxName_font = core.ui._buildFont(boxName_fontSize); + // 总宽高减去所有装备格宽高得到空隙大小 + var oneBoxWidth = box_width + box_borderWidth * 2; + var oneBoxHeight = + box_height + boxName_fontSize + boxName_space + 2 * box_borderWidth; + var space_y = (equipList_height - maxLine * oneBoxHeight) / (1 + maxLine), + space_x = (equipList_width - maxItem * oneBoxWidth) / (1 + maxItem); + var box_x = equipList_x + space_x, + box_y = equipList_y + space_y; + for (var i = 0; i < len; i++) { + var id = core.getEquip(i), + name = toDrawList[i]; + if (i === 0) name = "主手"; + if (i === 1) name = "副手"; + var selectBorder = false; + if (core.status.thisUIEventInfo.select.type == i) selectBorder = true; + var borderStyle = selectBorder ? + box_selectBorderStyle : + box_borderStyle; + core.drawEquipbox_drawOne( + ctx, + name, + id, + box_x, + box_y, + box_width, + box_height, + boxName_space, + boxName_font, + boxName_color, + borderStyle, + box_borderWidth + ); + var todo = new Function( + "core.clickOneEquipbox('" + id + "'," + i + ")" + ); + core.addUIEventListener( + box_x - box_borderWidth / 2, + box_y - box_borderWidth / 2, + oneBoxWidth, + oneBoxHeight, + todo + ); + box_x += space_x + oneBoxWidth; + if ((i + 1) % maxItem == 0) { + box_x = equipList_x + space_x; + box_y += space_y + oneBoxHeight; + } + } + if (core.material.items[core.getEquip(0)]?.equipCls === "双手剑") { + core.drawLine( + ctx, + equipList_x + space_x + space_x + oneBoxWidth, + equipList_y + space_y, + equipList_x + + space_x + + space_x + + oneBoxWidth + + box_width + + box_borderWidth, + equipList_y + space_y + box_height + ); + core.drawLine( + ctx, + equipList_x + space_x + space_x + oneBoxWidth, + equipList_y + space_y + box_height, + equipList_x + + space_x + + space_x + + oneBoxWidth + + box_width + + box_borderWidth, + equipList_y + space_y + ); + } + }; - this.drawToolbox = function (ctx) { - ctx = ctx || core.canvas.ui; - core.status.thisEventClickArea = []; + this.drawToolbox = function (ctx) { + ctx = ctx || core.canvas.ui; + core.status.thisEventClickArea = []; - var info = core.drawBoxBackground(ctx); - info.itemNum = itemNum; - core.drawItemListbox(ctx, info.obj); - core.drawToolboxRightbar(ctx, info); - core.setTextBaseline(ctx, "alphabetic"); - core.setTextAlign("left"); - }; + var info = core.drawBoxBackground(ctx); + info.itemNum = itemNum; + core.drawItemListbox(ctx, info.obj); + core.drawToolboxRightbar(ctx, info); + core.setTextBaseline(ctx, "alphabetic"); + core.setTextAlign("left"); + }; - var reduceItem = 4; - this.drawEquipbox = function (ctx) { - ctx = ctx || core.canvas.ui; - core.status.thisEventClickArea = []; - var info = core.drawBoxBackground(ctx); - info.itemNum = itemNum - reduceItem; - info.obj.y += info.obj.oneItemHeight * reduceItem; - info.obj.height -= info.obj.oneItemHeight * reduceItem; - core.drawItemListbox(ctx, info.obj); - core.drawEquipbox_drawOthers(ctx, info); - core.drawToolboxRightbar(ctx, info); - core.setTextBaseline(ctx, "alphabetic"); - core.setTextAlign("left"); - }; + var reduceItem = 4; + this.drawEquipbox = function (ctx) { + ctx = ctx || core.canvas.ui; + core.status.thisEventClickArea = []; + var info = core.drawBoxBackground(ctx); + info.itemNum = itemNum - reduceItem; + info.obj.y += info.obj.oneItemHeight * reduceItem; + info.obj.height -= info.obj.oneItemHeight * reduceItem; + core.drawItemListbox(ctx, info.obj); + core.drawEquipbox_drawOthers(ctx, info); + core.drawToolboxRightbar(ctx, info); + core.setTextBaseline(ctx, "alphabetic"); + core.setTextAlign("left"); + }; - this.drawEquipbox_drawOne = function ( - ctx, - name, - id, - x, - y, - width, - height, - space, - font, - color, - style, - lineWidth - ) { - if (id) - core.drawIcon( - ctx, - id, - x + lineWidth / 2, - y + lineWidth / 2, - width, - height - ); - core.strokeRect( - ctx, - x, - y, - width + lineWidth, - height + lineWidth, - style, - lineWidth - ); - core.setTextAlign(ctx, "center"); - core.setTextBaseline(ctx, "top"); - var tx = (x + x + lineWidth / 2 + width) / 2, - ty = y + height + (lineWidth / 2) * 3 + space; - core.fillText(ctx, name, tx, ty, color, font); - core.setTextBaseline(ctx, "alphabetic"); - core.setTextAlign("left"); - }; + this.drawEquipbox_drawOne = function ( + ctx, + name, + id, + x, + y, + width, + height, + space, + font, + color, + style, + lineWidth + ) { + if (id) + core.drawIcon( + ctx, + id, + x + lineWidth / 2, + y + lineWidth / 2, + width, + height + ); + core.strokeRect( + ctx, + x, + y, + width + lineWidth, + height + lineWidth, + style, + lineWidth + ); + core.setTextAlign(ctx, "center"); + core.setTextBaseline(ctx, "top"); + var tx = (x + x + lineWidth / 2 + width) / 2, + ty = y + height + (lineWidth / 2) * 3 + space; + core.fillText(ctx, name, tx, ty, color, font); + core.setTextBaseline(ctx, "alphabetic"); + core.setTextAlign("left"); + }; - this.drawItemListbox_drawItem = function ( - ctx, - left, - right, - top, - height, - marginLeft, - marginHeight, - style, - id - ) { - var info = core.status.thisUIEventInfo; - var nowClick = info.index; - var item = core.material.items[id] || {}; - var name = item.name || "???"; - var num = core.itemCount(id) || 0; - var fontSize = Math.floor(height - marginHeight * 2); - core.setTextAlign(ctx, "right"); - var numText = "x" + num; - core.fillText( - ctx, - numText, - right - marginLeft, - top + height / 2, - style, - core.ui._buildFont(fontSize) - ); - if (name != "???") - core.drawIcon( - ctx, - id, - left + marginLeft, - top + marginHeight, - fontSize, - fontSize - ); - var text_x = left + marginLeft + fontSize + 2; - var maxWidth = right - core.calWidth(ctx, numText) - text_x; - core.setTextAlign(ctx, "left"); - core.fillText( - ctx, - name, - text_x, - top + height / 2, - style, - core.ui._buildFont(fontSize), - maxWidth - ); - var todo = new Function("core.clickItemFunc('" + id + "');"); - core.addUIEventListener(left, top, right - left, height, todo); - }; + this.drawItemListbox_drawItem = function ( + ctx, + left, + right, + top, + height, + marginLeft, + marginHeight, + style, + id + ) { + var info = core.status.thisUIEventInfo; + var nowClick = info.index; + var item = core.material.items[id] || {}; + var name = item.name || "???"; + var num = core.itemCount(id) || 0; + var fontSize = Math.floor(height - marginHeight * 2); + core.setTextAlign(ctx, "right"); + var numText = "x" + num; + core.fillText( + ctx, + numText, + right - marginLeft, + top + height / 2, + style, + core.ui._buildFont(fontSize) + ); + if (name != "???") + core.drawIcon( + ctx, + id, + left + marginLeft, + top + marginHeight, + fontSize, + fontSize + ); + var text_x = left + marginLeft + fontSize + 2; + var maxWidth = right - core.calWidth(ctx, numText) - text_x; + core.setTextAlign(ctx, "left"); + core.fillText( + ctx, + name, + text_x, + top + height / 2, + style, + core.ui._buildFont(fontSize), + maxWidth + ); + var todo = new Function("core.clickItemFunc('" + id + "');"); + core.addUIEventListener(left, top, right - left, height, todo); + }; - this.setPageItems = function (page) { - var num = itemNum; - if (core.status.event.id == "equipbox") num -= reduceItem; - var info = core.status.thisUIEventInfo; - if (!info) return; - page = page || info.page; - var items = core.getToolboxItems( - core.status.event.id == "toolbox" ? "all" : "equips" - ); - info.allItems = items; - var maxPage = Math.ceil(items.length / num); - info.maxPage = maxPage; - var pageItems = items.slice((page - 1) * num, page * num); - info.pageItems = pageItems; - info.maxItem = pageItems.length; - if (items.length == 0 && pageItems.length == 0) info.index = null; - if (pageItems.length == 0 && info.page > 1) { - info.page = Math.max(1, info.page - 1); - return core.setPageItems(info.page); - } - return pageItems; - }; + this.setPageItems = function (page) { + var num = itemNum; + if (core.status.event.id == "equipbox") num -= reduceItem; + var info = core.status.thisUIEventInfo; + if (!info) return; + page = page || info.page; + var items = core.getToolboxItems( + core.status.event.id == "toolbox" ? "all" : "equips" + ); + info.allItems = items; + var maxPage = Math.ceil(items.length / num); + info.maxPage = maxPage; + var pageItems = items.slice((page - 1) * num, page * num); + info.pageItems = pageItems; + info.maxItem = pageItems.length; + if (items.length == 0 && pageItems.length == 0) info.index = null; + if (pageItems.length == 0 && info.page > 1) { + info.page = Math.max(1, info.page - 1); + return core.setPageItems(info.page); + } + return pageItems; + }; - this.drawToolbox_setExitBtn = function (ctx, x, y, r, style, lineWidth) { - core.strokeCircle(ctx, x, y, r, style, lineWidth); - ctx.textAlign = "center"; - ctx.textBaseline = "middle"; - var textSize = Math.sqrt(2) * r; - core.fillText( - ctx, - "x", - x, - y, - style, - core.ui._buildFont(textSize), - textSize - ); - core.setTextAlign(ctx, "start"); - core.setTextBaseline(ctx, "top"); + this.drawToolbox_setExitBtn = function (ctx, x, y, r, style, lineWidth) { + core.strokeCircle(ctx, x, y, r, style, lineWidth); + ctx.textAlign = "center"; + ctx.textBaseline = "middle"; + var textSize = Math.sqrt(2) * r; + core.fillText( + ctx, + "x", + x, + y, + style, + core.ui._buildFont(textSize), + textSize + ); + core.setTextAlign(ctx, "start"); + core.setTextBaseline(ctx, "top"); - var todo = function () { - core.closePanel(); - }; - core.addUIEventListener(x - r, y - r, r * 2, r * 2, todo); - }; + var todo = function () { + core.closePanel(); + }; + core.addUIEventListener(x - r, y - r, r * 2, r * 2, todo); + }; - this.drawToolbox_setUseBtn = function (ctx, x, y, r, h, style, lineWidth) { - core.setTextAlign(ctx, "left"); - core.setTextBaseline(ctx, "top"); - var fontSize = h - 4; - var font = core.ui._buildFont(fontSize); - var text = core.status.event.id == "toolbox" ? "使用" : "装备"; - if (core.status.thisUIEventInfo.select.action == "unload") text = "卸下"; - var w = core.calWidth(ctx, text, font) + 2 * r + lineWidth / 2; + this.drawToolbox_setUseBtn = function (ctx, x, y, r, h, style, lineWidth) { + core.setTextAlign(ctx, "left"); + core.setTextBaseline(ctx, "top"); + var fontSize = h - 4; + var font = core.ui._buildFont(fontSize); + var text = core.status.event.id == "toolbox" ? "使用" : "装备"; + if (core.status.thisUIEventInfo.select.action == "unload") text = "卸下"; + var w = core.calWidth(ctx, text, font) + 2 * r + lineWidth / 2; - core.strokeRoundRect(ctx, x, y, w, h, r, style, lineWidth); - core.fillText(ctx, text, x + r, y + lineWidth / 2 + 2, style, font); + core.strokeRoundRect(ctx, x, y, w, h, r, style, lineWidth); + core.fillText(ctx, text, x + r, y + lineWidth / 2 + 2, style, font); - var todo = function () { - core.useSelectItemInBox(); - }; - core.addUIEventListener(x, y, w, h, todo); - }; + var todo = function () { + core.useSelectItemInBox(); + }; + core.addUIEventListener(x, y, w, h, todo); + }; - this.drawItemListbox_setPageBtn = function ( - ctx, - left, - right, - bottom, - r, - style, - lineWidth - ) { - var offset = lineWidth / 2 + r; + this.drawItemListbox_setPageBtn = function ( + ctx, + left, + right, + bottom, + r, + style, + lineWidth + ) { + var offset = lineWidth / 2 + r; - var x = left + offset; - var y = bottom - offset; - var pos = (Math.sqrt(2) / 2) * (r - lineWidth / 2); - core.fillPolygon( - ctx, - [ - [x - pos, y], - [x + pos - 2, y - pos], - [x + pos - 2, y + pos], - ], - style - ); - core.strokeCircle(ctx, x, y, r, style, lineWidth); - var todo = function () { - core.addItemListboxPage(-1); - }; - core.addUIEventListener(x - r - 2, y - r - 2, r * 2 + 4, r * 2 + 4, todo); + var x = left + offset; + var y = bottom - offset; + var pos = (Math.sqrt(2) / 2) * (r - lineWidth / 2); + core.fillPolygon( + ctx, + [ + [x - pos, y], + [x + pos - 2, y - pos], + [x + pos - 2, y + pos], + ], + style + ); + core.strokeCircle(ctx, x, y, r, style, lineWidth); + var todo = function () { + core.addItemListboxPage(-1); + }; + core.addUIEventListener(x - r - 2, y - r - 2, r * 2 + 4, r * 2 + 4, todo); - x = right - offset; - core.fillPolygon( - ctx, - [ - [x + pos, y], - [x - pos + 2, y - pos], - [x - pos + 2, y + pos], - ], - style - ); - core.strokeCircle(ctx, x, y, r, style, lineWidth); - var todo = function () { - core.addItemListboxPage(1); - }; - core.addUIEventListener(x - r - 2, y - r - 2, r * 2 + 4, r * 2 + 4, todo); - }; + x = right - offset; + core.fillPolygon( + ctx, + [ + [x + pos, y], + [x - pos + 2, y - pos], + [x - pos + 2, y + pos], + ], + style + ); + core.strokeCircle(ctx, x, y, r, style, lineWidth); + var todo = function () { + core.addItemListboxPage(1); + }; + core.addUIEventListener(x - r - 2, y - r - 2, r * 2 + 4, r * 2 + 4, todo); + }; - this.clickItemFunc = function (id) { - var info = core.status.thisUIEventInfo; - if (!info) return; - if (info.select.id == id) return core.useSelectItemInBox(); - info.select = {}; - info.select.id = id; - core.setIndexAndSelect("index"); - core.refreshBox(); - }; + this.clickItemFunc = function (id) { + var info = core.status.thisUIEventInfo; + if (!info) return; + if (info.select.id == id) return core.useSelectItemInBox(); + info.select = {}; + info.select.id = id; + core.setIndexAndSelect("index"); + core.refreshBox(); + }; - this.clickOneEquipbox = function (id, type) { - var info = core.status.thisUIEventInfo; - if (!info) return; - if (info.select.id == id && info.select.type == type) - core.useSelectItemInBox(); - else - core.status.thisUIEventInfo.select = { - id: id, - type: type, - action: "unload", - }; - return core.refreshBox(); - }; + this.clickOneEquipbox = function (id, type) { + var info = core.status.thisUIEventInfo; + if (!info) return; + if (info.select.id == id && info.select.type == type) + core.useSelectItemInBox(); + else + core.status.thisUIEventInfo.select = { + id: id, + type: type, + action: "unload", + }; + return core.refreshBox(); + }; - core.ui.getToolboxItems = function (cls) { - var list = Object.keys(core.status.hero.items[cls] || {}); - if (cls == "all") { - for (var name in core.status.hero.items) { - if (name == "equips") continue; - list = list.concat(Object.keys(core.status.hero.items[name])); - } - return list - .filter(function (id) { - return !core.material.items[id].hideInToolbox; - }) - .sort(); - } + core.ui.getToolboxItems = function (cls) { + var list = Object.keys(core.status.hero.items[cls] || {}); + if (cls == "all") { + for (var name in core.status.hero.items) { + if (name == "equips") continue; + list = list.concat(Object.keys(core.status.hero.items[name])); + } + return list + .filter(function (id) { + return !core.material.items[id].hideInToolbox; + }) + .sort(); + } - if (this.uidata.getToolboxItems) { - return this.uidata.getToolboxItems(cls); - } - return list - .filter(function (id) { - return !core.material.items[id].hideInToolbox; - }) - .sort(); - }; + if (this.uidata.getToolboxItems) { + return this.uidata.getToolboxItems(cls); + } + return list + .filter(function (id) { + return !core.material.items[id].hideInToolbox; + }) + .sort(); + }; - this.useSelectItemInBox = function () { - var info = core.status.thisUIEventInfo; - if (!info) return; - if (!info.select.id) return; - var id = info.select.id; - if (core.status.event.id == "toolbox") { - core.events.tryUseItem(id); - // core.closePanel(); - } else if (core.status.event.id == "equipbox") { - var action = info.select.action || "load"; - info.index = 1; - if (action == "load") { - var type = core.getEquipTypeById(id); - let equipClsid = core.material.items[id]?.equipCls; - let equipCls0 = core.material.items[core.getEquip(0)]?.equipCls; - let equipCls1 = core.material.items[core.getEquip(1)]?.equipCls; - if (equipCls0 === "双手剑") { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - } - if (equipClsid === "单手剑") { - if ( - equipCls1 !== "单手剑" && - equipCls1 !== "匕首" && - equipCls1 !== "盾牌" - ) { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } else if (equipCls0 !== "单手剑") { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - } - } - if (equipClsid === "法杖") { - if (equipCls1 !== "匕首" && equipCls1 !== "盾牌") { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } else { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - } - } - if (equipClsid === "双手剑") { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } - if (equipClsid === "匕首") { - if (equipCls0 !== "匕首") { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } else { - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } - } - if (equipClsid === "盾牌") { - if (equipCls0 !== "单手剑" && equipCls0 !== "法杖") { - core.unloadEquip(0, function () { - core.status.route.push("unEquip:" + 0); - }); - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } else { - core.unloadEquip(1, function () { - core.status.route.push("unEquip:" + 1); - }); - } - } - core.loadEquip(id, function () { - core.status.route.push("equip:" + id); - info.select.type = type; - core.setIndexAndSelect("select"); - core.drawEquipbox(); - }); - } else { - var type = info.select.type; - core.unloadEquip(type, function () { - core.status.route.push("unEquip:" + type); - info.select.type = type; - //info.select.action = 'load' - core.setIndexAndSelect("select"); - core.drawEquipbox(); - }); - } - } - core.updateStatusBar(); - }; - this.setIndexAndSelect = function (toChange) { - var info = core.status.thisUIEventInfo; - if (!info) return; - core.setPageItems(info.page); - var index = info.index || 1; - var items = info.pageItems; - if (info.select.type != null) { - var type = info.select.type; - id = core.getEquip(type); - info.index = null; - info.select = { - id: id, - action: "unload", - type: type, - }; - return; - } else { - info.select.action = null; - info.select.type = null; - if (toChange == "index") info.index = items.indexOf(info.select.id) + 1; - info.select.id = items[info.index - 1]; - } - }; + this.useSelectItemInBox = function () { + var info = core.status.thisUIEventInfo; + if (!info) return; + if (!info.select.id) return; + var id = info.select.id; + if (core.status.event.id == "toolbox") { + core.events.tryUseItem(id); + // core.closePanel(); + } else if (core.status.event.id == "equipbox") { + var action = info.select.action || "load"; + info.index = 1; + if (action == "load") { + var type = core.getEquipTypeById(id); + let equipClsid = core.material.items[id]?.equipCls; + let equipCls0 = core.material.items[core.getEquip(0)]?.equipCls; + let equipCls1 = core.material.items[core.getEquip(1)]?.equipCls; + if (equipCls0 === "双手剑") { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + } + if (equipClsid === "单手剑") { + if ( + equipCls1 !== "单手剑" && + equipCls1 !== "匕首" && + equipCls1 !== "盾牌" + ) { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } else if (equipCls0 !== "单手剑") { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + } + } + if (equipClsid === "法杖") { + if (equipCls1 !== "匕首" && equipCls1 !== "盾牌") { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } else { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + } + } + if (equipClsid === "双手剑") { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } + if (equipClsid === "匕首") { + if (equipCls0 !== "匕首") { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } else { + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } + } + if (equipClsid === "盾牌") { + if (equipCls0 !== "单手剑" && equipCls0 !== "法杖") { + core.unloadEquip(0, function () { + core.status.route.push("unEquip:" + 0); + }); + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } else { + core.unloadEquip(1, function () { + core.status.route.push("unEquip:" + 1); + }); + } + } + core.loadEquip(id, function () { + core.status.route.push("equip:" + id); + info.select.type = type; + core.setIndexAndSelect("select"); + core.drawEquipbox(); + }); + } else { + var type = info.select.type; + core.unloadEquip(type, function () { + core.status.route.push("unEquip:" + type); + info.select.type = type; + //info.select.action = 'load' + core.setIndexAndSelect("select"); + core.drawEquipbox(); + }); + } + } + core.updateStatusBar(); + }; + this.setIndexAndSelect = function (toChange) { + var info = core.status.thisUIEventInfo; + if (!info) return; + core.setPageItems(info.page); + var index = info.index || 1; + var items = info.pageItems; + if (info.select.type != null) { + var type = info.select.type; + id = core.getEquip(type); + info.index = null; + info.select = { + id: id, + action: "unload", + type: type, + }; + return; + } else { + info.select.action = null; + info.select.type = null; + if (toChange == "index") info.index = items.indexOf(info.select.id) + 1; + info.select.id = items[info.index - 1]; + } + }; - this.addItemListboxPage = function (num) { - var info = core.status.thisUIEventInfo; - if (!info) return; - var maxPage = info.maxPage || 1; - info.page = info.page || 1; - info.page += num; - if (info.page <= 0) info.page = maxPage; - if (info.page > maxPage) info.page = 1; - info.index = 1; - core.setPageItems(info.page); - core.setIndexAndSelect("select"); - core.refreshBox(); - }; + this.addItemListboxPage = function (num) { + var info = core.status.thisUIEventInfo; + if (!info) return; + var maxPage = info.maxPage || 1; + info.page = info.page || 1; + info.page += num; + if (info.page <= 0) info.page = maxPage; + if (info.page > maxPage) info.page = 1; + info.index = 1; + core.setPageItems(info.page); + core.setIndexAndSelect("select"); + core.refreshBox(); + }; - this.addItemListboxIndex = function (num) { - var info = core.status.thisUIEventInfo; - if (!info) return; - var maxItem = info.maxItem || 0; - info.index = info.index || 0; - info.index += num; - if (info.index <= 0) info.index = 1; - if (info.index > maxItem) info.index = maxItem; - core.setIndexAndSelect("select"); - core.refreshBox(); - }; + this.addItemListboxIndex = function (num) { + var info = core.status.thisUIEventInfo; + if (!info) return; + var maxItem = info.maxItem || 0; + info.index = info.index || 0; + info.index += num; + if (info.index <= 0) info.index = 1; + if (info.index > maxItem) info.index = maxItem; + core.setIndexAndSelect("select"); + core.refreshBox(); + }; - this.addEquipboxType = function (num) { - var info = core.status.thisUIEventInfo; - var type = info.select.type; - if (type == null && num > 0) info.select.type = 0; - else info.select.type = type + num; - var max = core.status.globalAttribute.equipName.length; - if (info.select.type >= max) { - info.select = {}; - core.setIndexAndSelect("select"); - return core.addItemListboxPage(0); - } else { - var m = Math.abs(info.select.type); - if (info.select.type < 0) info.select.type = max - m; - core.setIndexAndSelect("select"); - core.refreshBox(); - return; - } - }; + this.addEquipboxType = function (num) { + var info = core.status.thisUIEventInfo; + var type = info.select.type; + if (type == null && num > 0) info.select.type = 0; + else info.select.type = type + num; + var max = core.status.globalAttribute.equipName.length; + if (info.select.type >= max) { + info.select = {}; + core.setIndexAndSelect("select"); + return core.addItemListboxPage(0); + } else { + var m = Math.abs(info.select.type); + if (info.select.type < 0) info.select.type = max - m; + core.setIndexAndSelect("select"); + core.refreshBox(); + return; + } + }; - core.actions._keyDownToolbox = function (keycode) { - if (!core.status.thisEventClickArea) return; - if (keycode == 37) { - // left - core.addItemListboxPage(-1); - return; - } - if (keycode == 38) { - // up - core.addItemListboxIndex(-1); - return; - } - if (keycode == 39) { - // right - core.addItemListboxPage(1); - return; - } - if (keycode == 40) { - // down - core.addItemListboxIndex(1); - return; - } - }; + core.actions._keyDownToolbox = function (keycode) { + if (!core.status.thisEventClickArea) return; + if (keycode == 37) { + // left + core.addItemListboxPage(-1); + return; + } + if (keycode == 38) { + // up + core.addItemListboxIndex(-1); + return; + } + if (keycode == 39) { + // right + core.addItemListboxPage(1); + return; + } + if (keycode == 40) { + // down + core.addItemListboxIndex(1); + return; + } + }; - ////// 工具栏界面时,放开某个键的操作 ////// - core.actions._keyUpToolbox = function (keycode) { - if (keycode == 81) { - core.ui.closePanel(); - if (core.isReplaying()) core.control._replay_equipbox(); - else core.openEquipbox(); - return; - } - if (keycode == 84 || keycode == 27 || keycode == 88) { - core.closePanel(); - return; - } - if (keycode == 13 || keycode == 32 || keycode == 67) { - var info = core.status.thisUIEventInfo; - if (info.select) { - core.useSelectItemInBox(); - } - return; - } - }; + ////// 工具栏界面时,放开某个键的操作 ////// + core.actions._keyUpToolbox = function (keycode) { + if (keycode == 81) { + core.ui.closePanel(); + if (core.isReplaying()) core.control._replay_equipbox(); + else core.openEquipbox(); + return; + } + if (keycode == 84 || keycode == 27 || keycode == 88) { + core.closePanel(); + return; + } + if (keycode == 13 || keycode == 32 || keycode == 67) { + var info = core.status.thisUIEventInfo; + if (info.select) { + core.useSelectItemInBox(); + } + return; + } + }; - core.actions._keyDownEquipbox = function (keycode) { - if (!core.status.thisEventClickArea) return; - if (keycode == 37) { - // left - var info = core.status.thisUIEventInfo; - if (info.index != null) return core.addItemListboxPage(-1); - return core.addEquipboxType(-1); - } - if (keycode == 38) { - // up - var info = core.status.thisUIEventInfo; - if (info.index == 1) { - info.select.type = core.status.globalAttribute.equipName.length - 1; - core.setIndexAndSelect(); - return core.refreshBox(); - } - if (info.index) return core.addItemListboxIndex(-1); - return core.addEquipboxType(-1 * info.equips); - } - if (keycode == 39) { - // right - var info = core.status.thisUIEventInfo; - if (info.index != null) return core.addItemListboxPage(1); - return core.addEquipboxType(1); - } - if (keycode == 40) { - // down - var info = core.status.thisUIEventInfo; - if (info.index) return core.addItemListboxIndex(1); - return core.addEquipboxType(info.equips); - } - }; + core.actions._keyDownEquipbox = function (keycode) { + if (!core.status.thisEventClickArea) return; + if (keycode == 37) { + // left + var info = core.status.thisUIEventInfo; + if (info.index != null) return core.addItemListboxPage(-1); + return core.addEquipboxType(-1); + } + if (keycode == 38) { + // up + var info = core.status.thisUIEventInfo; + if (info.index == 1) { + info.select.type = core.status.globalAttribute.equipName.length - 1; + core.setIndexAndSelect(); + return core.refreshBox(); + } + if (info.index) return core.addItemListboxIndex(-1); + return core.addEquipboxType(-1 * info.equips); + } + if (keycode == 39) { + // right + var info = core.status.thisUIEventInfo; + if (info.index != null) return core.addItemListboxPage(1); + return core.addEquipboxType(1); + } + if (keycode == 40) { + // down + var info = core.status.thisUIEventInfo; + if (info.index) return core.addItemListboxIndex(1); + return core.addEquipboxType(info.equips); + } + }; - core.actions._keyUpEquipbox = function (keycode, altKey) { - if (altKey && keycode >= 48 && keycode <= 57) { - core.items.quickSaveEquip(keycode - 48); - return; - } - if (keycode == 84) { - core.ui.closePanel(); - if (core.isReplaying()) core.control._replay_toolbox(); - else core.openToolbox(); - return; - } - if (keycode == 81 || keycode == 27 || keycode == 88) { - core.closePanel(); - return; - } - if (keycode == 13 || keycode == 32 || keycode == 67) { - var info = core.status.thisUIEventInfo; - if (info.select) core.useSelectItemInBox(); - return; - } - }; + core.actions._keyUpEquipbox = function (keycode, altKey) { + if (altKey && keycode >= 48 && keycode <= 57) { + core.items.quickSaveEquip(keycode - 48); + return; + } + if (keycode == 84) { + core.ui.closePanel(); + if (core.isReplaying()) core.control._replay_toolbox(); + else core.openToolbox(); + return; + } + if (keycode == 81 || keycode == 27 || keycode == 88) { + core.closePanel(); + return; + } + if (keycode == 13 || keycode == 32 || keycode == 67) { + var info = core.status.thisUIEventInfo; + if (info.select) core.useSelectItemInBox(); + return; + } + }; - core.registerAction( - "ondown", - "inEventClickAction", - function (x, y, px, py) { - if (!core.status.thisEventClickArea) return false; - // console.log(px + "," + py); - var info = core.status.thisEventClickArea; - for (var i = 0; i < info.length; i++) { - var obj = info[i]; - if ( - px >= obj.x && - px <= obj.x + obj.width && - py > obj.y && - py < obj.y + obj.height - ) { - if (obj.todo) obj.todo(); - break; - } - } - return true; - }, - 51 - ); - core.registerAction( - "onclick", - "stopClick", - function () { - if (core.status.thisEventClickArea) return true; - }, - 51 - ); + core.registerAction( + "ondown", + "inEventClickAction", + function (x, y, px, py) { + if (!core.status.thisEventClickArea) return false; + // console.log(px + "," + py); + var info = core.status.thisEventClickArea; + for (var i = 0; i < info.length; i++) { + var obj = info[i]; + if ( + px >= obj.x && + px <= obj.x + obj.width && + py > obj.y && + py < obj.y + obj.height + ) { + if (obj.todo) obj.todo(); + break; + } + } + return true; + }, + 51 + ); + core.registerAction( + "onclick", + "stopClick", + function () { + if (core.status.thisEventClickArea) return true; + }, + 51 + ); - this.addUIEventListener = function (x, y, width, height, todo) { - if (!core.status.thisEventClickArea) return; - var obj = { - x: x, - y: y, - width: width, - height: height, - todo: todo, - }; - core.status.thisEventClickArea.push(obj); - }; + this.addUIEventListener = function (x, y, width, height, todo) { + if (!core.status.thisEventClickArea) return; + var obj = { + x: x, + y: y, + width: width, + height: height, + todo: todo, + }; + core.status.thisEventClickArea.push(obj); + }; - this.initThisEventInfo = function () { - core.status.thisUIEventInfo = { - page: 1, - select: {}, - }; - core.status.thisEventClickArea = []; - }; + this.initThisEventInfo = function () { + core.status.thisUIEventInfo = { + page: 1, + select: {}, + }; + core.status.thisEventClickArea = []; + }; - this.refreshBox = function () { - if (!core.status.event.id) return; - if (core.status.event.id == "toolbox") core.drawToolbox(); - else core.drawEquipbox(); - }; + this.refreshBox = function () { + if (!core.status.event.id) return; + if (core.status.event.id == "toolbox") core.drawToolbox(); + else core.drawEquipbox(); + }; - core.ui.closePanel = function () { - if (core.status.hero && core.status.hero.flags) { - // 清除全部临时变量 - Object.keys(core.status.hero.flags).forEach(function (name) { - if (name.startsWith("@temp@") || /^arg\d+$/.test(name)) { - delete core.status.hero.flags[name]; - } - }); - } - this.clearUI(); - core.maps.generateGroundPattern(); - core.updateStatusBar(true); - core.unlockControl(); - core.status.event.data = null; - core.status.event.id = null; - core.status.event.selection = null; - core.status.event.ui = null; - core.status.event.interval = null; - core.status.thisUIEventInfo = null; - core.status.thisEventClickArea = null; - }; + core.ui.closePanel = function () { + if (core.status.hero && core.status.hero.flags) { + // 清除全部临时变量 + Object.keys(core.status.hero.flags).forEach(function (name) { + if (name.startsWith("@temp@") || /^arg\d+$/.test(name)) { + delete core.status.hero.flags[name]; + } + }); + } + this.clearUI(); + core.maps.generateGroundPattern(); + core.updateStatusBar(true); + core.unlockControl(); + core.status.event.data = null; + core.status.event.id = null; + core.status.event.selection = null; + core.status.event.ui = null; + core.status.event.interval = null; + core.status.thisUIEventInfo = null; + core.status.thisEventClickArea = null; + }; - this.getItemClsName = function (item) { - if (item == null) return itemClsName; - if (item.cls == "equips") { - if (typeof item.equip.type == "string") return item.equip.type; - var type = core.getEquipTypeById(item.id); - return core.status.globalAttribute.equipName[type]; - } else return itemClsName[item.cls] || item.cls; - }; + this.getItemClsName = function (item) { + if (item == null) return itemClsName; + if (item.cls == "equips") { + if (typeof item.equip.type == "string") return item.equip.type; + var type = core.getEquipTypeById(item.id); + return core.status.globalAttribute.equipName[type]; + } else return itemClsName[item.cls] || item.cls; + }; - core.events.openToolbox = function (fromUserAction) { - if (core.isReplaying()) return; - if (!this._checkStatus("toolbox", fromUserAction)) return; - core.initThisEventInfo(); - let info = core.status.thisUIEventInfo; - info.index = 1; - core.setIndexAndSelect("select"); - core.drawToolbox(); - }; + core.events.openToolbox = function (fromUserAction) { + if (core.isReplaying()) return; + if (!this._checkStatus("toolbox", fromUserAction)) return; + core.initThisEventInfo(); + let info = core.status.thisUIEventInfo; + info.index = 1; + core.setIndexAndSelect("select"); + core.drawToolbox(); + }; - core.events.openEquipbox = function (fromUserAction) { - if (core.isReplaying()) return; - if (!this._checkStatus("equipbox", fromUserAction)) return; - core.initThisEventInfo(); - let info = core.status.thisUIEventInfo; - info.select.type = 0; - core.setIndexAndSelect("select"); - core.drawEquipbox(); - }; + core.events.openEquipbox = function (fromUserAction) { + if (core.isReplaying()) return; + if (!this._checkStatus("equipbox", fromUserAction)) return; + core.initThisEventInfo(); + let info = core.status.thisUIEventInfo; + info.select.type = 0; + core.setIndexAndSelect("select"); + core.drawEquipbox(); + }; - core.control._replay_toolbox = function () { - if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) - return core.drawTip("请等待当前事件的处理结束"); + core.control._replay_toolbox = function () { + if (!core.isPlaying() || !core.isReplaying()) return; + if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); + if (core.isMoving() || core.status.replay.animate || core.status.event.id) + return core.drawTip("请等待当前事件的处理结束"); - core.lockControl(); - core.status.event.id = "toolbox"; - core.drawToolbox(); - }; + core.lockControl(); + core.status.event.id = "toolbox"; + core.drawToolbox(); + }; - core.control._replay_equipbox = function () { - if (!core.isPlaying() || !core.isReplaying()) return; - if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); - if (core.isMoving() || core.status.replay.animate || core.status.event.id) - return core.drawTip("请等待当前事件的处理结束"); + core.control._replay_equipbox = function () { + if (!core.isPlaying() || !core.isReplaying()) return; + if (!core.status.replay.pausing) return core.drawTip("请先暂停录像"); + if (core.isMoving() || core.status.replay.animate || core.status.event.id) + return core.drawTip("请等待当前事件的处理结束"); - core.lockControl(); - core.status.event.id = "equipbox"; - core.drawEquipbox(); - }; + core.lockControl(); + core.status.event.id = "equipbox"; + core.drawEquipbox(); + }; - core.control._replayAction_item = function (action) { - if (action.indexOf("item:") != 0) return false; - var itemId = action.substring(5); - if (!core.canUseItem(itemId)) return false; - if ( - core.material.items[itemId].hideInReplay || - core.status.replay.speed == 24 - ) { - core.useItem(itemId, false, core.replay); - return true; - } - core.status.event.id = "toolbox"; - core.initThisEventInfo(); - var info = core.status.thisUIEventInfo; - var items = core.getToolboxItems("all"); - core.setPageItems(1); - var index = items.indexOf(itemId) + 1; - info.page = Math.ceil(index / info.maxItem); - info.index = index % info.maxItem || info.maxItem; - core.setIndexAndSelect("select"); - core.setPageItems(info.page); - core.drawToolbox(); - setTimeout(function () { - core.ui.closePanel(); - core.useItem(itemId, false, core.replay); - }, core.control.__replay_getTimeout()); - return true; - }; + core.control._replayAction_item = function (action) { + if (action.indexOf("item:") != 0) return false; + var itemId = action.substring(5); + if (!core.canUseItem(itemId)) return false; + if ( + core.material.items[itemId].hideInReplay || + core.status.replay.speed == 24 + ) { + core.useItem(itemId, false, core.replay); + return true; + } + core.status.event.id = "toolbox"; + core.initThisEventInfo(); + var info = core.status.thisUIEventInfo; + var items = core.getToolboxItems("all"); + core.setPageItems(1); + var index = items.indexOf(itemId) + 1; + info.page = Math.ceil(index / info.maxItem); + info.index = index % info.maxItem || info.maxItem; + core.setIndexAndSelect("select"); + core.setPageItems(info.page); + core.drawToolbox(); + setTimeout(function () { + core.ui.closePanel(); + core.useItem(itemId, false, core.replay); + }, core.control.__replay_getTimeout()); + return true; + }; - core.control._replayAction_equip = function (action) { - if (action.indexOf("equip:") != 0) return false; - var itemId = action.substring(6); - var items = core.getToolboxItems("equips"); - var index = items.indexOf(itemId) + 1; - if (index < 1) return false; - core.status.route.push(action); - if ( - core.material.items[itemId].hideInReplay || - core.status.replay.speed == 24 - ) { - core.loadEquip(itemId, core.replay); - return true; - } - core.status.event.id = "equipbox"; - core.initThisEventInfo(); - var info = core.status.thisUIEventInfo; - core.setPageItems(1); - info.page = Math.ceil(index / info.maxItem); - info.index = index % info.maxItem || info.maxItem; - core.setIndexAndSelect("select"); - core.setPageItems(info.page); - core.drawEquipbox(); - setTimeout(function () { - core.ui.closePanel(); - core.loadEquip(itemId, core.replay); - }, core.control.__replay_getTimeout()); - return true; - }; + core.control._replayAction_equip = function (action) { + if (action.indexOf("equip:") != 0) return false; + var itemId = action.substring(6); + var items = core.getToolboxItems("equips"); + var index = items.indexOf(itemId) + 1; + if (index < 1) return false; + core.status.route.push(action); + if ( + core.material.items[itemId].hideInReplay || + core.status.replay.speed == 24 + ) { + core.loadEquip(itemId, core.replay); + return true; + } + core.status.event.id = "equipbox"; + core.initThisEventInfo(); + var info = core.status.thisUIEventInfo; + core.setPageItems(1); + info.page = Math.ceil(index / info.maxItem); + info.index = index % info.maxItem || info.maxItem; + core.setIndexAndSelect("select"); + core.setPageItems(info.page); + core.drawEquipbox(); + setTimeout(function () { + core.ui.closePanel(); + core.loadEquip(itemId, core.replay); + }, core.control.__replay_getTimeout()); + return true; + }; - core.control._replayAction_unEquip = function (action) { - if (action.indexOf("unEquip:") != 0) return false; - var equipType = parseInt(action.substring(8)); - if (!core.isset(equipType)) return false; - core.status.route.push(action); - if (core.status.replay.speed == 24) { - core.unloadEquip(equipType, core.replay); - return true; - } - core.status.event.id = "equipbox"; - core.initThisEventInfo(); - var info = core.status.thisUIEventInfo; - core.setPageItems(1); - info.select.type = equipType; - core.setIndexAndSelect(); - core.drawEquipbox(); - setTimeout(function () { - core.ui.closePanel(); - core.unloadEquip(equipType, core.replay); - }, core.control.__replay_getTimeout()); - return true; - }; + core.control._replayAction_unEquip = function (action) { + if (action.indexOf("unEquip:") != 0) return false; + var equipType = parseInt(action.substring(8)); + if (!core.isset(equipType)) return false; + core.status.route.push(action); + if (core.status.replay.speed == 24) { + core.unloadEquip(equipType, core.replay); + return true; + } + core.status.event.id = "equipbox"; + core.initThisEventInfo(); + var info = core.status.thisUIEventInfo; + core.setPageItems(1); + info.select.type = equipType; + core.setIndexAndSelect(); + core.drawEquipbox(); + setTimeout(function () { + core.ui.closePanel(); + core.unloadEquip(equipType, core.replay); + }, core.control.__replay_getTimeout()); + return true; + }; - core.registerReplayAction("item", core.control._replayAction_item); - core.registerReplayAction("equip", core.control._replayAction_equip); - core.registerReplayAction("unEquip", core.control._replayAction_unEquip); - }, + core.registerReplayAction("item", core.control._replayAction_item); + core.registerReplayAction("equip", core.control._replayAction_equip); + core.registerReplayAction("unEquip", core.control._replayAction_unEquip); +}, "技能树": function () { // 在此增加新插件 // @@ -11678,587 +11675,590 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ); }, "CG回廊": function () { - // 在此增加新插件 - const CGUI = document.createElement("canvas"); //CGui画布设置 - CGUI.style.position = "absolute"; - CGUI.style.zIndex = 300; - CGUI.style.display = "none"; - CGUI.id = "CGUI"; - main.dom.gameGroup.insertAdjacentElement("afterend", CGUI); - CGUI.style.top = "50%"; - CGUI.style.left = "50%"; - CGUI.style.transform = "translate(-50%,-50%)"; - const ctx = CGUI.getContext("2d"); - main.dom.CGUI = CGUI; - let page = 0; //初始页面 - let show = false; //展示状态 - CGUI.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.CG.onclick(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; + // 在此增加新插件 + const CGUI = document.createElement("canvas"); //CGui画布设置 + CGUI.style.position = "absolute"; + CGUI.style.zIndex = 300; + CGUI.style.display = "none"; + CGUI.id = "CGUI"; + main.dom.gameGroup.insertAdjacentElement("afterend", CGUI); + CGUI.style.top = "50%"; + CGUI.style.left = "50%"; + CGUI.style.transform = "translate(-50%,-50%)"; + const ctx = CGUI.getContext("2d"); + main.dom.CGUI = CGUI; + let page = 0; //初始页面 + let show = false; //展示状态 + CGUI.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.CG.onclick(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; - function drawImage( - name, - image, - x, - y, - w, - h, - x1, - y1, - w1, - h1, - angle, - reverse - ) { - // 检测文件名以 :x, :y, :o 结尾,表示左右翻转,上下翻转和中心翻转 + function drawImage( + name, + image, + x, + y, + w, + h, + x1, + y1, + w1, + h1, + angle, + reverse + ) { + // 检测文件名以 :x, :y, :o 结尾,表示左右翻转,上下翻转和中心翻转 - image = core.material.images.images[image]; + image = core.material.images.images[image]; - var scale = { - x: [-1, 1], - y: [1, -1], - o: [-1, -1], - }; + var scale = { + x: [-1, 1], + y: [1, -1], + o: [-1, -1], + }; - // 只能接受2, 4, 8个参数 - if (x != null && y != null) { - if (w == null || h == null) { - // 两个参数变成四个参数 - w = image.width; - h = image.height; - } - if (x1 != null && y1 != null && w1 != null && h1 != null) { - if (!reverse && !angle) { - name.drawImage(image, x, y, w, h, x1, y1, w1, h1); - } else { - name.save(); - name.translate(x1 + w1 / 2, y1 + h1 / 2); - if (reverse) name.scale(scale[reverse][0], scale[reverse][1]); - if (angle) name.rotate(angle); - name.drawImage(image, x, y, w, h, -w1 / 2, -h1 / 2, w1, h1); - name.restore(); - } - return; - } - if (!reverse && !angle) { - name.drawImage(image, x, y, w, h); - } else { - name.save(); - name.translate(x + w / 2, y + h / 2); - if (reverse) name.scale(scale[reverse][0], scale[reverse][1]); - if (angle) name.rotate(angle); - name.drawImage(image, -w / 2, -h / 2, w, h); - name.restore(); - } - return; - } - } + // 只能接受2, 4, 8个参数 + if (x != null && y != null) { + if (w == null || h == null) { + // 两个参数变成四个参数 + w = image.width; + h = image.height; + } + if (x1 != null && y1 != null && w1 != null && h1 != null) { + if (!reverse && !angle) { + name.drawImage(image, x, y, w, h, x1, y1, w1, h1); + } else { + name.save(); + name.translate(x1 + w1 / 2, y1 + h1 / 2); + if (reverse) name.scale(scale[reverse][0], scale[reverse][1]); + if (angle) name.rotate(angle); + name.drawImage(image, x, y, w, h, -w1 / 2, -h1 / 2, w1, h1); + name.restore(); + } + return; + } + if (!reverse && !angle) { + name.drawImage(image, x, y, w, h); + } else { + name.save(); + name.translate(x + w / 2, y + h / 2); + if (reverse) name.scale(scale[reverse][0], scale[reverse][1]); + if (angle) name.rotate(angle); + name.drawImage(image, -w / 2, -h / 2, w, h); + name.restore(); + } + return; + } + } - function drawWindow(background, ctx, x, y, w, h, direction, px, py) { - // 仿RM窗口皮肤 ↓ + function drawWindow(background, ctx, x, y, w, h, direction, px, py) { + // 仿RM窗口皮肤 ↓ - drawImage(ctx, background, 0, 0, 128, 128, x + 2, y + 2, w - 4, h - 4); - // 绘制边框 - // 上方 - drawImage(ctx, background, 128, 0, 16, 16, x, y, 16, 16); - for (var dx = 0; dx < w - 64; dx += 32) { - drawImage(ctx, background, 144, 0, 32, 16, x + dx + 16, y, 32, 16); - drawImage( - ctx, - background, - 144, - 48, - 32, - 16, - x + dx + 16, - y + h - 16, - 32, - 16 - ); - } - drawImage( - ctx, - background, - 144, - 0, - w - dx - 32, - 16, - x + dx + 16, - y, - w - dx - 32, - 16 - ); - drawImage( - ctx, - background, - 144, - 48, - w - dx - 32, - 16, - x + dx + 16, - y + h - 16, - w - dx - 32, - 16 - ); - drawImage(ctx, background, 176, 0, 16, 16, x + w - 16, y, 16, 16); - // 左右 - for (var dy = 0; dy < h - 64; dy += 32) { - drawImage(ctx, background, 128, 16, 16, 32, x, y + dy + 16, 16, 32); - drawImage( - ctx, - background, - 176, - 16, - 16, - 32, - x + w - 16, - y + dy + 16, - 16, - 32 - ); - } - drawImage( - ctx, - background, - 128, - 16, - 16, - h - dy - 32, - x, - y + dy + 16, - 16, - h - dy - 32 - ); - drawImage( - ctx, - background, - 176, - 16, - 16, - h - dy - 32, - x + w - 16, - y + dy + 16, - 16, - h - dy - 32 - ); - // 下方 - drawImage(ctx, background, 128, 48, 16, 16, x, y + h - 16, 16, 16); - drawImage( - ctx, - background, - 176, - 48, - 16, - 16, - x + w - 16, - y + h - 16, - 16, - 16 - ); + drawImage(ctx, background, 0, 0, 128, 128, x + 2, y + 2, w - 4, h - 4); + // 绘制边框 + // 上方 + drawImage(ctx, background, 128, 0, 16, 16, x, y, 16, 16); + for (var dx = 0; dx < w - 64; dx += 32) { + drawImage(ctx, background, 144, 0, 32, 16, x + dx + 16, y, 32, 16); + drawImage( + ctx, + background, + 144, + 48, + 32, + 16, + x + dx + 16, + y + h - 16, + 32, + 16 + ); + } + drawImage( + ctx, + background, + 144, + 0, + w - dx - 32, + 16, + x + dx + 16, + y, + w - dx - 32, + 16 + ); + drawImage( + ctx, + background, + 144, + 48, + w - dx - 32, + 16, + x + dx + 16, + y + h - 16, + w - dx - 32, + 16 + ); + drawImage(ctx, background, 176, 0, 16, 16, x + w - 16, y, 16, 16); + // 左右 + for (var dy = 0; dy < h - 64; dy += 32) { + drawImage(ctx, background, 128, 16, 16, 32, x, y + dy + 16, 16, 32); + drawImage( + ctx, + background, + 176, + 16, + 16, + 32, + x + w - 16, + y + dy + 16, + 16, + 32 + ); + } + drawImage( + ctx, + background, + 128, + 16, + 16, + h - dy - 32, + x, + y + dy + 16, + 16, + h - dy - 32 + ); + drawImage( + ctx, + background, + 176, + 16, + 16, + h - dy - 32, + x + w - 16, + y + dy + 16, + 16, + h - dy - 32 + ); + // 下方 + drawImage(ctx, background, 128, 48, 16, 16, x, y + h - 16, 16, 16); + drawImage( + ctx, + background, + 176, + 48, + 16, + 16, + x + w - 16, + y + h - 16, + 16, + 16 + ); - // arrow - if (px != null && py != null) { - if (direction == "up") { - drawImage(ctx, background, 128, 96, 32, 32, px, y + h - 3, 32, 32); - } else if (direction == "down") { - drawImage(ctx, background, 160, 96, 32, 32, px, y - 29, 32, 32); - } - } - // 仿RM窗口皮肤 ↑ - } - class CG { - constructor() { - //cg列表 - this.UIMx = [ - //空位用‘none’填充,当前ui至多4列6行 - [ - ["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"], - ], - ]; - } + // arrow + if (px != null && py != null) { + if (direction == "up") { + drawImage(ctx, background, 128, 96, 32, 32, px, y + h - 3, 32, 32); + } else if (direction == "down") { + drawImage(ctx, background, 160, 96, 32, 32, px, y - 29, 32, 32); + } + } + // 仿RM窗口皮肤 ↑ + } + class CG { + constructor() { + //cg列表 + this.UIMx = [ + //空位用‘none’填充,当前ui至多4列6行 + [ + ["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"], + ], + ]; + } - //更新 - update() { - this.background(); - this.drawUI(); - } - background() { - //画布大小设置 - if (core.domStyle.isVertical) { - ctx.canvas.width = 1248; - ctx.canvas.height = 2028; + //更新 + update() { + this.background(); + this.drawUI(); + } + background() { + //画布大小设置 + 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"); + } else { + ctx.canvas.width = 2028; + ctx.canvas.height = 1248; - core.setTextAlign(ctx, "center"); - } - } - onclick(px, py) { - //点击 - 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 (core.domStyle.isVertical) { - //竖屏 - const pageupbox = makeBox([30, 380], [144, 144]); - const pagedownbox = makeBox([30, 1080], [144, 144]); + core.setTextAlign(ctx, "center"); + } + } + onclick(px, py) { + //点击 + 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 (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 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, pagedownbox)) { - 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(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() { - //绘制页面 - core.clearMap(CGUI); - if (!core?.material?.images?.images?.["winskin1.png"]) return; - if (core.domStyle.isVertical) { - //竖屏 - //core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028); - core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 - ctx.globalAlpha = 0.5; //透明度 - drawImage(ctx, "bg_2010.png", 0, 0, 1280, 1500, 0, 0, 1248, 2028); //绘制半透明背景图片 - ctx.globalAlpha = 1; //恢复为不透明 + 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, pagedownbox)) { + 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(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() { + //绘制页面 + core.clearMap(CGUI); + if (!core?.material?.images?.images?.["winskin1.png"]) return; + if (core.domStyle.isVertical) { + //竖屏 + //core.drawWindowSkin('winskin1.png', ctx, 0, 0, 1248, 2028); + core.fillRect(ctx, 0, 0, 1248, 2028, "#000000"); //黑色背景 + ctx.globalAlpha = 0.5; //透明度 + 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.fillBoldText( - ctx, - "离开", - 100, - 110, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(33, 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.fillBoldText( - ctx, - "向上翻页", - 100, - 450, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); - core.fillBoldText( - ctx, - "向下翻页", - 100, - 1150, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); + 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.fillBoldText( + ctx, + "离开", + 100, + 110, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(33, 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.fillBoldText( + ctx, + "向上翻页", + 100, + 450, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.fillBoldText( + ctx, + "向下翻页", + 100, + 1150, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); - // 添加3*2个4:3的画框,及图片 - for (let i = 0; i < 3; i++) { - for (let j = 0; j < 2; j++) { - 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 - ); - } - } + // 添加3*2个4:3的画框,及图片 + for (let i = 0; i < 3; i++) { + for (let j = 0; j < 2; j++) { + 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模式的字样 - /* + // 添加浏览模式和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'); @@ -12266,130 +12266,130 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.fillText(ctx, '浏览模式', 400, 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"); //黑色背景 - ctx.globalAlpha = 0.5; //透明度 - drawImage(ctx, "bg_5043.png", 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片 - ctx.globalAlpha = 1; //恢复为不透明 - //core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248); - core.setTextAlign(ctx, "center"); - core.fillRoundRect( - ctx, - 45 - 6, - 45 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 45 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText( - ctx, - "离开", - 100, - 110, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(33, true) - ); + } else { + //横屏 + core.fillRect(ctx, 0, 0, 2028, 1248, "#000000"); //黑色背景 + ctx.globalAlpha = 0.5; //透明度 + drawImage(ctx, "bg_5043.png", 0, 0, 1280, 720, 0, 0, 2028, 1248); //绘制半透明背景图片 + ctx.globalAlpha = 1; //恢复为不透明 + //core.drawWindowSkin('winskin1.png', ctx, 0, 0, 2028, 1248); + core.setTextAlign(ctx, "center"); + core.fillRoundRect( + ctx, + 45 - 6, + 45 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 45 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillBoldText( + ctx, + "离开", + 100, + 110, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(33, true) + ); - // 添加向上翻页和向下翻页的按钮 - core.fillRoundRect( - ctx, - 45 - 6, - 350 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 350 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText( - ctx, - "向上翻页", - 100, - 400, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); - core.fillRoundRect( - ctx, - 45 - 6, - 850 - 6, - 120 + 12, - 120 + 12, - 6, - "#444444" - ); - core.strokeRoundRect( - ctx, - 45 - 12, - 850 - 12, - 120 + 24, - 120 + 24, - 12, - "#444444", - 3 - ); - core.fillBoldText( - ctx, - "向下翻页", - 100, - 900, - "#FFFFFF", - "#000000", - 6, - core.ui._buildFont(24, true) - ); + // 添加向上翻页和向下翻页的按钮 + core.fillRoundRect( + ctx, + 45 - 6, + 350 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 350 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillBoldText( + ctx, + "向上翻页", + 100, + 400, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); + core.fillRoundRect( + ctx, + 45 - 6, + 850 - 6, + 120 + 12, + 120 + 12, + 6, + "#444444" + ); + core.strokeRoundRect( + ctx, + 45 - 12, + 850 - 12, + 120 + 24, + 120 + 24, + 12, + "#444444", + 3 + ); + core.fillBoldText( + ctx, + "向下翻页", + 100, + 900, + "#FFFFFF", + "#000000", + 6, + core.ui._buildFont(24, true) + ); - // 添加3*2个4:3的画框 - for (let i = 0; i < 2; i++) { - 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 - ); - } - } + // 添加3*2个4:3的画框 + for (let i = 0; i < 2; i++) { + 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模式的字样 - /* + // 添加浏览模式和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)); @@ -12397,18 +12397,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 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.ui.CG = new CG(); - main.dom.CGMode.onclick = function () { - //点击开始页面的CG MODE进入cg回廊 - main.core.control.checkBgm(); - page = 0; - CGUI.style.display = "block"; - main.core.ui.CG.update(); - }; - }, + } + } + } + core.ui.CG = new CG(); + main.dom.CGMode.onclick = function () { + //点击开始页面的CG MODE进入cg回廊 + main.core.control.checkBgm(); + page = 0; + CGUI.style.display = "block"; + main.core.ui.CG.update(); + }; +}, "光标设置": function () { // 在此增加新插件 this.changeMouse = function ( @@ -12447,104 +12447,104 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "信息弹出": function () { - // 在此增加新插件 - /* 弹出显示某个内容 - * 使用方法:core.addPop(px, py, value, color, boldColor, left, jump, time, show, font, speed) - * 参数说明: - * px & py: number 弹出位置 - * value: string 显示内容 - * color: string 填充颜色 - * boldColor: string 描边颜色 - */ + // 在此增加新插件 + /* 弹出显示某个内容 + * 使用方法:core.addPop(px, py, value, color, boldColor, left, jump, time, show, font, speed) + * 参数说明: + * px & py: number 弹出位置 + * value: string 显示内容 + * color: string 填充颜色 + * boldColor: string 描边颜色 + */ - // 默认字体 - var fontD = "16px Verdana"; - // 默认颜色 - var colorD = "red"; - // 默认描边颜色 - var boldColorD = "black"; + // 默认字体 + var fontD = "16px Verdana"; + // 默认颜色 + var colorD = "red"; + // 默认描边颜色 + var boldColorD = "black"; - /** 血量弹出 */ - function pop() { - var ctx = core.getContextByName("pop"); - if (!ctx) - ctx = core.createCanvas( - "pop", - 0, - 0, - core.__PIXELS__, - core.__PIXELS__, - 90 - ); - core.clearMap(ctx); - core.setTextAlign("pop", "left"); - var list = core.status.pop || []; - var count = 0; - list.forEach(function (one) { - // 由frame计算出dy - var dy = 6 - one.frame * 0.2; - var dx = one.speed; - if (one.jump) { - one.py -= dy; - } - if (!one.left) { - one.px += dx; - } else { - one.px -= dx; - } - one.frame++; - // 绘制 - if (one.frame >= one.time) - core.setAlpha(ctx, 1 - (one.frame - one.time) / one.show); - else core.setAlpha(ctx, 1); - core.fillBoldText( - ctx, - one.value, - one.px, - one.py, - one.color || "red", - one.boldColor || "black", - 2, - one.font - ); - if (one.frame >= one.time + one.show) count++; - }); - if (count > 0) list.splice(0, count); - } - if (!main.replayChecking) core.registerAnimationFrame("pop", true, pop); + /** 血量弹出 */ + function pop() { + var ctx = core.getContextByName("pop"); + if (!ctx) + ctx = core.createCanvas( + "pop", + 0, + 0, + core.__PIXELS__, + core.__PIXELS__, + 90 + ); + core.clearMap(ctx); + core.setTextAlign("pop", "left"); + var list = core.status.pop || []; + var count = 0; + list.forEach(function (one) { + // 由frame计算出dy + var dy = 6 - one.frame * 0.2; + var dx = one.speed; + if (one.jump) { + one.py -= dy; + } + if (!one.left) { + one.px += dx; + } else { + one.px -= dx; + } + one.frame++; + // 绘制 + if (one.frame >= one.time) + core.setAlpha(ctx, 1 - (one.frame - one.time) / one.show); + else core.setAlpha(ctx, 1); + core.fillBoldText( + ctx, + one.value, + one.px, + one.py, + one.color || "red", + one.boldColor || "black", + 2, + one.font + ); + if (one.frame >= one.time + one.show) count++; + }); + if (count > 0) list.splice(0, count); + } + if (!main.replayChecking) core.registerAnimationFrame("pop", true, pop); - /** 添加弹出内容 */ - this.addPop = function ( - value, - px, - py, - color, - boldColor, - left, - jump, - time, - show, - font, - speed - ) { - var data = { - px: px, - py: py, - value: value, - color: color || colorD, - boldColor: boldColor || boldColorD, - frame: 0, - left: left || false, - jump: jump || false, - time: time || 60, - show: show || 30, - font: font || fontD, - speed: speed || 1, - }; - if (!core.status.pop) core.status.pop = [data]; - else core.status.pop.push(data); - }; - }, + /** 添加弹出内容 */ + this.addPop = function ( + value, + px, + py, + color, + boldColor, + left, + jump, + time, + show, + font, + speed + ) { + var data = { + px: px, + py: py, + value: value, + color: color || colorD, + boldColor: boldColor || boldColorD, + frame: 0, + left: left || false, + jump: jump || false, + time: time || 60, + show: show || 30, + font: font || fontD, + speed: speed || 1, + }; + if (!core.status.pop) core.status.pop = [data]; + else core.status.pop.push(data); + }; +}, "warning": function () { // 在此增加新插件 // 默认音效名 @@ -13408,268 +13408,253 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.cgText = new cgText(); }, "旁白": 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; + // 在此增加新插件 + 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]; - over.style.display = "block"; - let globalAlpha = 0; - core.registerAnimationFrame("overshow", 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; + this.over = function ( + image, + time = 100, + hidetime = 30, + sound = "", + textColor = "#FFFFFF", + boldColor = "#000000", + font = "bold 48px Verdana", + text = "" + ) { + if (!core.isPlaying()) { + return core.doAction(); + } + const img = core.material.images.images?.[image]; + over.style.display = "block"; + let frame = 0 + let sod = 0; + core.registerAnimationFrame("over", true, () => { - 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, 6, font); + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 416 * 3; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(416 * 3, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 416 * 3; + } + ctx.globalAlpha = 1; + if (img) { + //绘制背景 + ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); + } + frame++; + // 绘制 + if (frame <= hidetime) core.setAlpha(ctx, 1 - (hidetime - frame) / hidetime); + if (frame > hidetime && frame <= hidetime + time) ctx.globalAlpha = 1; + if (frame > hidetime + time && frame <= hidetime * 2 + time) core.setAlpha(ctx, 1 - (frame - hidetime - time) / hidetime); + const lisen = sound && core.material.sounds[sound] && core.musicStatus.soundStatus; + if (frame == hidetime && lisen) { + sod = core.playSound(sound) + } + if (frame > hidetime * 2 + time) { + core.unregisterAnimationFrame("over") + ctx.restore(); + over.style.display = "none"; + core.stopSound(sod) + core.doAction() + return - 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, - 6, - font - ); + } - ctx.restore(); - if (globalAlpha <= 0) { - over.style.display = "none"; - core.unregisterAnimationFrame("overhide"); - core.doAction(); - } - }); - }); - } else { - setTimeout(() => { - 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, - 6, - font - ); + core.setTextAlign(ctx, "center"); + core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, 6, font); - ctx.restore(); + ctx.restore(); + }) + } - if (globalAlpha <= 0) { - over.style.display = "none"; - core.unregisterAnimationFrame("overhide"); - core.doAction(); - } - }); - }, time); - } - } - }); - }; - this.changebg = function (img1, img2, time, style) { - let globalAlpha1 = 0; - let globalAlpha2 = time; - img1 = core.material.images.images?.[img1]; - img2 = core.material.images.images?.[img2]; - over.style.display = "block"; - switch (style) { - case "引入": - core.registerAnimationFrame("bgin", 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 = globalAlpha1 / time; - if (img2) { - //绘制背景 - ctx.drawImage(img2, 0, 0, 2028, 1248); - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } - globalAlpha1++; - ctx.restore(); - if (globalAlpha1 >= time) { - core.unregisterAnimationFrame("bgin"); - over.style.display = "none"; - core.doAction(); - } - }); - break; - case "引出": - core.registerAnimationFrame("bgout", 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 = globalAlpha2 / time; - if (img1) { - //绘制背景 - ctx.drawImage(img1, 0, 0, 2028, 1248); - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } - globalAlpha2--; - ctx.restore(); - if (globalAlpha2 <= 0) { - core.unregisterAnimationFrame("bgout"); - over.style.display = "none"; - core.doAction(); - } - }); + this.overlist = function ( + image, + time = 100, + hidetime = 30, + font = "bold 48px Verdana", + list = [{ text: "", sound: "", textColor: "#FFFFFF", boldColor: "#000000", font: "bold 48px Verdana", frame: 0 }] + ) { + if (!core.isPlaying()) { + return core.doAction(); + } + const img = core.material.images.images?.[image]; + over.style.display = "block"; + let sod = 0; + core.registerAnimationFrame("overlist", true, () => { - break; - case "场景切换": - core.registerAnimationFrame("changebg", 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; - core.fillRect(ctx, 0, 0, 2028, 1248); - ctx.globalAlpha = globalAlpha2 / time; - if (img1) { - //绘制背景 - ctx.drawImage(img1, 0, 0, 2028, 1248); - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } - ctx.globalAlpha = globalAlpha1 / time; - if (img2) { - //绘制背景 - ctx.drawImage(img2, 0, 0, 2028, 1248); - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } - globalAlpha2--; - globalAlpha1++; - ctx.restore(); - if (globalAlpha2 <= 0 || globalAlpha1 >= time) { - core.unregisterAnimationFrame("changebg"); - over.style.display = "none"; - core.doAction(); - } - }); + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 416 * 3; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(416 * 3, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 416 * 3; + } + ctx.globalAlpha = 1; + if (img) { + //绘制背景 + ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); + } - break; - } - }; - }, + frame++; + // 绘制 + if (frame <= hidetime) core.setAlpha(ctx, 1 - (hidetime - frame) / hidetime); + if (frame > hidetime && frame <= hidetime + time) ctx.globalAlpha = 1; + if (frame > hidetime + time && frame <= hidetime * 2 + time) core.setAlpha(ctx, 1 - (frame - hidetime - time) / hidetime); + const lisen = sound && core.material.sounds[sound] && core.musicStatus.soundStatus; + if (frame == hidetime && lisen) { + sod = core.playSound(sound) + } + if (frame > hidetime * 2 + time) { + core.unregisterAnimationFrame("over") + ctx.restore(); + over.style.display = "none"; + core.stopSound(sod) + core.doAction() + return + + } + + core.setTextAlign(ctx, "center"); + core.fillBoldText(ctx, text, 1014, 624, textColor, boldColor, 6, font); + + ctx.restore(); + }) + } + + this.changebg = function (img1, img2, time, style) { + let globalAlpha1 = 0; + let globalAlpha2 = time; + img1 = core.material.images.images?.[img1]; + img2 = core.material.images.images?.[img2]; + over.style.display = "block"; + switch (style) { + case "引入": + core.registerAnimationFrame("bgin", true, () => { + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = globalAlpha1 / time; + if (img2) { + //绘制背景 + ctx.drawImage(img2, 0, 0, 676 * 3, 1248); + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + globalAlpha1++; + ctx.restore(); + if (globalAlpha1 >= time) { + core.unregisterAnimationFrame("bgin"); + over.style.display = "none"; + core.doAction(); + } + }); + + break; + case "引出": + core.registerAnimationFrame("bgout", true, () => { + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = globalAlpha2 / time; + if (img1) { + //绘制背景 + ctx.drawImage(img1, 0, 0, 676 * 3, 1248); + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + globalAlpha2--; + ctx.restore(); + if (globalAlpha2 <= 0) { + core.unregisterAnimationFrame("bgout"); + over.style.display = "none"; + core.doAction(); + } + }); + + break; + case "场景切换": + core.registerAnimationFrame("changebg", true, () => { + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = 1; + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + ctx.globalAlpha = globalAlpha2 / time; + if (img1) { + //绘制背景 + ctx.drawImage(img1, 0, 0, 676 * 3, 1248); + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + ctx.globalAlpha = globalAlpha1 / time; + if (img2) { + //绘制背景 + ctx.drawImage(img2, 0, 0, 676 * 3, 1248); + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + globalAlpha2--; + globalAlpha1++; + ctx.restore(); + if (globalAlpha2 <= 0 || globalAlpha1 >= time) { + core.unregisterAnimationFrame("changebg"); + over.style.display = "none"; + core.doAction(); + } + }); + + break; + } + }; +}, "属性映射": function () { // 在此增加新插件 this.statusEquip = function () {