From 1b4e77f23bce46d475b2791072079dc22da858cc Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Thu, 16 Jan 2025 13:17:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B1=9E=E6=80=A7=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/MotaAction.g4 | 4 +- _server/table/comment.js | 10 +- _server/table/data.comment.js | 33 +- project/data.js | 3203 +++++++------- project/functions.js | 41 +- project/items.js | 10 +- project/plugins.js | 7882 ++++++++++++++++----------------- 7 files changed, 5468 insertions(+), 5715 deletions(-) diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 4ee806d..10a88d7 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -4596,8 +4596,8 @@ EnemyPoint_List /*EnemyPoint_List ['hp','atk','def','money','exp','point','name']*/; Equip_List - : '力量'|'敏捷'|'智力'|'体质'|'生命'|'生命上限'|'攻击'|'物理防御'|'魔法防御'|'魔力'|'魔力上限'|'速度' - /*Equip_List ['str','agi','int','con','hp','hpmax','atk','def','mdef','mana','manamax','speed']*/; + : '生命'|'生命上限'|'攻击'|'防御'|'法强'|'魔力'|'魔力上限'|'速度' + /*Equip_List ['hp','hpmax','atk','def','mdef','mana','manamax','speed']*/; Key_List : '黄钥匙'|'蓝钥匙'|'红钥匙'|'绿钥匙'|'铁门钥匙' diff --git a/_server/table/comment.js b/_server/table/comment.js index b417a50..f8660c0 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -187,24 +187,18 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "def": { "_leaf": true, "_type": "textarea", - "_data": "物理防御力" + "_data": "防御力" }, "mdef": { "_leaf": true, "_type": "textarea", - "_data": "魔法防御力" + "_data": "法抗(写为小数)" }, "speed": { "_leaf": true, "_type": "textarea", "_data": "速度" }, - "magic": { - "_leaf": true, - "_type": "checkbox", - "_docs": "是否为魔法攻击", - "_data": "勾选以魔法攻击计算,不勾选以物理攻击计算" - }, "money": { "_leaf": true, "_type": "textarea", diff --git a/_server/table/data.comment.js b/_server/table/data.comment.js index de82674..10e76cf 100644 --- a/_server/table/data.comment.js +++ b/_server/table/data.comment.js @@ -262,44 +262,19 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "def": { "_leaf": true, "_type": "textarea", - "_data": "物理防御" + "_data": "防御" }, "mdef": { "_leaf": true, "_type": "textarea", - "_data": "魔法防御" + "_data": "法强" }, "speed": { "_leaf": true, "_type": "textarea", - "_data": "攻击速度" - }, - "str": { - "_leaf": true, - "_type": "textarea", - "_data": "力量" - }, - "agi": { - "_leaf": true, - "_type": "textarea", - "_data": "敏捷" - }, - "int": { - "_leaf": true, - "_type": "textarea", - "_data": "智力" - }, - "con": { - "_leaf": true, - "_type": "textarea", - "_data": "体质" - }, - "magic": { - "_leaf": true, - "_type": "checkbox", - "_docs": "攻击类型", - "_data": "攻击类型是否是魔法" + "_data": "速度" }, + "money": { "_leaf": true, "_type": "textarea", diff --git a/project/data.js b/project/data.js index 95ad3ee..1638c4f 100644 --- a/project/data.js +++ b/project/data.js @@ -1,1644 +1,1559 @@ -var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = -{ - "main": { - "floorIds": [ - "Caimhome", - "jiuguan", - "KTV", - "KTVF2", - "goldkey", - "bihusuo", - "jiaotang", - "shengnvhome", - "shinvhome", - "jiedao", - "street01", - "street02", - "guangchang", - "guangchang2", - "xiaoxiang01", - "xiaoxiang02", - "xiaoxiang3", - "yiqu1", - "yiqu2", - "yiqu3", - "yiqu4", - "yiqu5", - "yiqu6", - "yiqu7", - "yiqu8", - "yiqu9", - "yiqu10" - ], - "floorPartitions": [], - "images": [ - "HPGaugeEnemy_A.webp", - "HPGaugeEnemy_B.webp", - "background.webp", - "backgroundvertical.webp", - "bg_0000.png", - "bg_1511.webp", - "bg_1521.webp", - "bg_2010.webp", - "bg_2011.webp", - "bg_2521.webp", - "bg_3021.webp", - "bg_3026.webp", - "bg_3028.webp", - "bg_3042.webp", - "bg_3531.webp", - "bg_3551.webp", - "bg_3561.webp", - "bg_3563.webp", - "bg_3571.webp", - "bg_3601.webp", - "bg_3721.webp", - "bg_3801.webp", - "bg_5033.webp", - "bg_5043.webp", - "bg_5044.webp", - "bg_6004.webp", - "cao.webp", - "d.webp", - "dl.webp", - "dlr.webp", - "dr.webp", - "eve_010102.webp", - "eve_010203.webp", - "eve_010304.webp", - "eve_010501.webp", - "eve_010601.webp", - "eve_010701.webp", - "eve_010801.webp", - "eve_010902.webp", - "eve_011001.webp", - "eve_011101.webp", - "eve_011202.webp", - "eve_011302.webp", - "eve_011402.webp", - "eve_020102.webp", - "eve_020201.webp", - "eve_020301.webp", - "eve_020401.webp", - "eve_020501.webp", - "eve_020605.webp", - "eve_020701.webp", - "eve_020801.webp", - "eve_030101.webp", - "eve_030206.webp", - "eve_030302.webp", - "eve_030508.webp", - "eve_030601.webp", - "eve_030801.webp", - "eve_030901.webp", - "eve_031002.webp", - "eve_031101.webp", - "eve_040201.webp", - "eve_040401.webp", - "eve_040501.webp", - "eve_040601.webp", - "eve_040702.webp", - "eve_040801.webp", - "eve_050101.webp", - "eve_050201.webp", - "eve_050401.webp", - "eve_050501.webp", - "eve_050601.webp", - "eve_050704.webp", - "eve_050801.webp", - "eve_070101.webp", - "face_020101.webp", - "face_020102.webp", - "face_020103.webp", - "face_020104.webp", - "face_020105.webp", - "face_020106.webp", - "face_020107.webp", - "face_020108.webp", - "face_020109.webp", - "face_020110.webp", - "face_020111.webp", - "face_020112.webp", - "face_020113.webp", - "face_020114.webp", - "face_020115.webp", - "face_020116.webp", - "face_020117.webp", - "face_020118.webp", - "face_020121.webp", - "face_020122.webp", - "face_020123.webp", - "face_020124.webp", - "face_020125.webp", - "face_020126.webp", - "face_020127.webp", - "face_020128.webp", - "face_020129.webp", - "face_020130.webp", - "face_020131.webp", - "face_020132.webp", - "face_020133.webp", - "face_020134.webp", - "face_020135.webp", - "face_020136.webp", - "face_020137.webp", - "face_020141.webp", - "face_020142.webp", - "face_020143.webp", - "face_020144.webp", - "face_020145.webp", - "face_020146.webp", - "face_020147.webp", - "face_020148.webp", - "face_020149.webp", - "face_020150.webp", - "face_020151.webp", - "face_020152.webp", - "face_020153.webp", - "face_020154.webp", - "face_020155.webp", - "face_020156.webp", - "face_020157.webp", - "face_020158.webp", - "face_020159.webp", - "face_030101.webp", - "face_030102.webp", - "face_030103.webp", - "face_030104.webp", - "face_030105.webp", - "face_030107.webp", - "face_030121.webp", - "face_030122.webp", - "face_030123.webp", - "face_030124.webp", - "face_030125.webp", - "face_030127.webp", - "face_030129.webp", - "face_030131.webp", - "face_030132.webp", - "face_030141.webp", - "face_030142.webp", - "face_030143.webp", - "face_030144.webp", - "face_030145.webp", - "face_050101.webp", - "face_050102.webp", - "face_050103.webp", - "face_050104.webp", - "face_050105.webp", - "face_050106.webp", - "face_050107.webp", - "face_050108.webp", - "face_050111.webp", - "face_050112.webp", - "face_050113.webp", - "face_050116.webp", - "face_050121.webp", - "face_050122.webp", - "face_050123.webp", - "face_050124.webp", - "face_050125.webp", - "face_050126.webp", - "face_050127.webp", - "face_050128.webp", - "face_050129.webp", - "face_050130.webp", - "face_050131.webp", - "face_050132.webp", - "face_050134.webp", - "face_050135.webp", - "face_050136.webp", - "face_050137.webp", - "face_050141.webp", - "face_050142.webp", - "face_050143.webp", - "face_050144.webp", - "face_050145.webp", - "face_050146.webp", - "face_050147.webp", - "face_050148.webp", - "face_050150.webp", - "face_050151.webp", - "face_050152.webp", - "face_050201.webp", - "face_050202.webp", - "face_050203.webp", - "face_050204.webp", - "face_050205.webp", - "face_050206.webp", - "face_050210.webp", - "face_050212.webp", - "face_050213.webp", - "face_050214.webp", - "face_050215.webp", - "face_050216.webp", - "face_050221.webp", - "face_050222.webp", - "face_050223.webp", - "face_050224.webp", - "face_050225.webp", - "face_050226.webp", - "face_050229.webp", - "face_050230.webp", - "face_050232.webp", - "face_050234.webp", - "face_050235.webp", - "face_050237.webp", - "face_050241.webp", - "face_050242.webp", - "face_050243.webp", - "face_050244.webp", - "face_050245.webp", - "face_050246.webp", - "face_050249.webp", - "face_050250.webp", - "face_050252.webp", - "face_050301.webp", - "face_050302.webp", - "face_050303.webp", - "face_050304.webp", - "face_050305.webp", - "face_050306.webp", - "face_050307.webp", - "face_050308.webp", - "face_050309.webp", - "face_050310.webp", - "face_050311.webp", - "face_050313.webp", - "face_050314.webp", - "face_050315.webp", - "face_050316.webp", - "face_050317.webp", - "face_050321.webp", - "face_050322.webp", - "face_050323.webp", - "face_050324.webp", - "face_050325.webp", - "face_050326.webp", - "face_050327.webp", - "face_050328.webp", - "face_050329.webp", - "face_050330.webp", - "face_050331.webp", - "face_050332.webp", - "face_050333.webp", - "face_050334.webp", - "face_050335.webp", - "face_050336.webp", - "face_050337.webp", - "face_050338.webp", - "face_050341.webp", - "face_050342.webp", - "face_050343.webp", - "face_050344.webp", - "face_050345.webp", - "face_050346.webp", - "face_050347.webp", - "face_050348.webp", - "face_050349.webp", - "face_050350.webp", - "face_050351.webp", - "face_050352.webp", - "face_050353.webp", - "face_050441.webp", - "face_050442.webp", - "face_050443.webp", - "face_050445.webp", - "face_050446.webp", - "face_050447.webp", - "face_050451.webp", - "face_050452.webp", - "face_120101.webp", - "face_120102.webp", - "face_120103.webp", - "face_120104.webp", - "face_120105.webp", - "face_120106.webp", - "face_120107.webp", - "face_120108.webp", - "face_120111.webp", - "face_120112.webp", - "face_120113.webp", - "face_120121.webp", - "face_120122.webp", - "face_120123.webp", - "face_120124.webp", - "face_120125.webp", - "face_120126.webp", - "face_120127.webp", - "face_120128.webp", - "face_120131.webp", - "face_120132.webp", - "face_130101.webp", - "face_130102.webp", - "face_130103.webp", - "face_130104.webp", - "face_130105.webp", - "face_130106.webp", - "face_130107.webp", - "face_130108.webp", - "face_130109.webp", - "face_130110.webp", - "face_130111.webp", - "face_130112.webp", - "face_130113.webp", - "face_130121.webp", - "face_130122.webp", - "face_130123.webp", - "face_130124.webp", - "face_130125.webp", - "face_130126.webp", - "face_130127.webp", - "face_130128.webp", - "face_130129.webp", - "face_130130.webp", - "face_130131.webp", - "face_130132.webp", - "face_130201.webp", - "face_130202.webp", - "face_130203.webp", - "face_130204.webp", - "face_130205.webp", - "face_130206.webp", - "face_130207.webp", - "face_130208.webp", - "face_130209.webp", - "face_130211.webp", - "face_130212.webp", - "face_130213.webp", - "face_130221.webp", - "face_130222.webp", - "face_130223.webp", - "face_130224.webp", - "face_130225.webp", - "face_130226.webp", - "face_130227.webp", - "face_130228.webp", - "face_130229.webp", - "face_130230.webp", - "face_130231.webp", - "face_320101.webp", - "face_320102.webp", - "face_320103.webp", - "face_320104.webp", - "face_320105.webp", - "face_320106.webp", - "face_320107.webp", - "face_320108.webp", - "face_320109.webp", - "face_320121.webp", - "face_320122.webp", - "face_320123.webp", - "face_320124.webp", - "face_320125.webp", - "face_320127.webp", - "face_430101.webp", - "face_430102.webp", - "face_430103.webp", - "face_430104.webp", - "face_430105.webp", - "face_430106.webp", - "face_430107.webp", - "face_430108.webp", - "face_440101.webp", - "face_440102.webp", - "face_440103.webp", - "face_440104.webp", - "face_440105.webp", - "face_440106.webp", - "face_440107.webp", - "face_440108.webp", - "face_440109.webp", - "face_440110.webp", - "green.webp", - "hero.webp", - "l.webp", - "lane1.webp", - "light.webp", - "lock.webp", - "lr.webp", - "maba.webp", - "null.webp", - "other_0001.webp", - "other_0002.webp", - "other_0003.webp", - "other_0004.webp", - "r.webp", - "status.webp", - "tati_020101.webp", - "tati_020101a.webp", - "tati_020101y.webp", - "tati_020102.webp", - "tati_020102a.webp", - "tati_020103.webp", - "tati_020103y.webp", - "tati_020104.webp", - "tati_020104a.webp", - "tati_020104y.webp", - "tati_020105.webp", - "tati_020105a.webp", - "tati_020105y.webp", - "tati_020106.webp", - "tati_020107.webp", - "tati_020107a.webp", - "tati_020107y.webp", - "tati_020109.webp", - "tati_020110.webp", - "tati_020111.webp", - "tati_020111a.webp", - "tati_020113.webp", - "tati_020113a.webp", - "tati_020114.webp", - "tati_020115.webp", - "tati_020115y.webp", - "tati_020116.webp", - "tati_020116a.webp", - "tati_020117.webp", - "tati_020117a.webp", - "tati_020118.webp", - "tati_020121a.webp", - "tati_020122.webp", - "tati_020123.webp", - "tati_020123y.webp", - "tati_020124.webp", - "tati_020124a.webp", - "tati_020125.webp", - "tati_020125a.webp", - "tati_020125y.webp", - "tati_020126.webp", - "tati_020126y.webp", - "tati_020127.webp", - "tati_020129.webp", - "tati_020130.webp", - "tati_020131.webp", - "tati_020131a.webp", - "tati_020131y.webp", - "tati_020132.webp", - "tati_020133.webp", - "tati_020134.webp", - "tati_020135.webp", - "tati_020135a.webp", - "tati_020136.webp", - "tati_020137.webp", - "tati_020141.webp", - "tati_020141a.webp", - "tati_020142.webp", - "tati_020142a.webp", - "tati_020142y.webp", - "tati_020143.webp", - "tati_020143y.webp", - "tati_020144.webp", - "tati_020144a.webp", - "tati_020145.webp", - "tati_020145a.webp", - "tati_020145y.webp", - "tati_020146.webp", - "tati_020147.webp", - "tati_020149.webp", - "tati_020150.webp", - "tati_020151.webp", - "tati_020151a.webp", - "tati_020152.webp", - "tati_020153.webp", - "tati_020154.webp", - "tati_020157.webp", - "tati_020157a.webp", - "tati_020158.webp", - "tati_050101.webp", - "tati_050101a.webp", - "tati_050101y.webp", - "tati_050102.webp", - "tati_050102y.webp", - "tati_050103.webp", - "tati_050103a.webp", - "tati_050103y.webp", - "tati_050104.webp", - "tati_050104a.webp", - "tati_050105.webp", - "tati_050105a.webp", - "tati_050105y.webp", - "tati_050106.webp", - "tati_050106y.webp", - "tati_050107.webp", - "tati_050107a.webp", - "tati_050107y.webp", - "tati_050110.webp", - "tati_050111.webp", - "tati_050111a.webp", - "tati_050111y.webp", - "tati_050112.webp", - "tati_050113y.webp", - "tati_050116.webp", - "tati_050116a.webp", - "tati_050116y.webp", - "tati_050117.webp", - "tati_050121.webp", - "tati_050121a.webp", - "tati_050121y.webp", - "tati_050122.webp", - "tati_050122y.webp", - "tati_050123.webp", - "tati_050123a.webp", - "tati_050123y.webp", - "tati_050124.webp", - "tati_050124a.webp", - "tati_050124y.webp", - "tati_050125.webp", - "tati_050125a.webp", - "tati_050125y.webp", - "tati_050126.webp", - "tati_050126y.webp", - "tati_050127.webp", - "tati_050127a.webp", - "tati_050128.webp", - "tati_050131.webp", - "tati_050131a.webp", - "tati_050131y.webp", - "tati_050132.webp", - "tati_050134.webp", - "tati_050134y.webp", - "tati_050135.webp", - "tati_050135y.webp", - "tati_050136.webp", - "tati_050137.webp", - "tati_050137y.webp", - "tati_050141.webp", - "tati_050141a.webp", - "tati_050141y.webp", - "tati_050142.webp", - "tati_050142a.webp", - "tati_050142y.webp", - "tati_050143.webp", - "tati_050143a.webp", - "tati_050143y.webp", - "tati_050144.webp", - "tati_050144a.webp", - "tati_050144y.webp", - "tati_050145.webp", - "tati_050145a.webp", - "tati_050145y.webp", - "tati_050146.webp", - "tati_050146y.webp", - "tati_050147.webp", - "tati_050147y.webp", - "tati_050151.webp", - "tati_050151a.webp", - "tati_050151y.webp", - "tati_050152.webp", - "tati_050152y.webp", - "tati_050201.webp", - "tati_050201a.webp", - "tati_050201y.webp", - "tati_050202.webp", - "tati_050202a.webp", - "tati_050202y.webp", - "tati_050203.webp", - "tati_050203y.webp", - "tati_050204a.webp", - "tati_050204y.webp", - "tati_050205.webp", - "tati_050205a.webp", - "tati_050205y.webp", - "tati_050206.webp", - "tati_050206a.webp", - "tati_050206y.webp", - "tati_050210y.webp", - "tati_050215.webp", - "tati_050216.webp", - "tati_050221.webp", - "tati_050221a.webp", - "tati_050221y.webp", - "tati_050222.webp", - "tati_050222a.webp", - "tati_050222y.webp", - "tati_050223.webp", - "tati_050224a.webp", - "tati_050224y.webp", - "tati_050225.webp", - "tati_050225a.webp", - "tati_050225y.webp", - "tati_050226.webp", - "tati_050226a.webp", - "tati_050229.webp", - "tati_050230y.webp", - "tati_050232a.webp", - "tati_050234a.webp", - "tati_050237.webp", - "tati_050241.webp", - "tati_050241a.webp", - "tati_050241y.webp", - "tati_050242.webp", - "tati_050242a.webp", - "tati_050242y.webp", - "tati_050243.webp", - "tati_050243y.webp", - "tati_050244a.webp", - "tati_050244y.webp", - "tati_050245.webp", - "tati_050245a.webp", - "tati_050245y.webp", - "tati_050252.webp", - "tati_050252y.webp", - "tati_050301.webp", - "tati_050301a.webp", - "tati_050301y.webp", - "tati_050302.webp", - "tati_050303.webp", - "tati_050303y.webp", - "tati_050304.webp", - "tati_050304y.webp", - "tati_050305.webp", - "tati_050305a.webp", - "tati_050305y.webp", - "tati_050306.webp", - "tati_050306y.webp", - "tati_050307.webp", - "tati_050307a.webp", - "tati_050307y.webp", - "tati_050308.webp", - "tati_050309.webp", - "tati_050310.webp", - "tati_050311.webp", - "tati_050311y.webp", - "tati_050313.webp", - "tati_050314.webp", - "tati_050315.webp", - "tati_050316.webp", - "tati_050316y.webp", - "tati_050317.webp", - "tati_050321.webp", - "tati_050321a.webp", - "tati_050321y.webp", - "tati_050322.webp", - "tati_050322y.webp", - "tati_050323.webp", - "tati_050324.webp", - "tati_050324a.webp", - "tati_050324y.webp", - "tati_050325.webp", - "tati_050325a.webp", - "tati_050325y.webp", - "tati_050326.webp", - "tati_050327.webp", - "tati_050327y.webp", - "tati_050328.webp", - "tati_050329.webp", - "tati_050331.webp", - "tati_050331y.webp", - "tati_050332.webp", - "tati_050333.webp", - "tati_050334.webp", - "tati_050334a.webp", - "tati_050335.webp", - "tati_050337.webp", - "tati_050338.webp", - "tati_050338y.webp", - "tati_050341.webp", - "tati_050341a.webp", - "tati_050341y.webp", - "tati_050342.webp", - "tati_050343.webp", - "tati_050343y.webp", - "tati_050344.webp", - "tati_050345.webp", - "tati_050345a.webp", - "tati_050345y.webp", - "tati_050346.webp", - "tati_050347.webp", - "tati_050348.webp", - "tati_050349.webp", - "tati_050351.webp", - "tati_050351y.webp", - "tati_050352.webp", - "tati_050353.webp", - "tati_050353y.webp", - "tati_050441.webp", - "tati_050443.webp", - "tati_050443y.webp", - "tati_050445.webp", - "tati_050445a.webp", - "tati_050445y.webp", - "tati_050451.webp", - "tati_050451a.webp", - "tati_050452.webp", - "tati_050452y.webp", - "tati_120101.webp", - "tati_120101y.webp", - "tati_120102.webp", - "tati_120102y.webp", - "tati_120103.webp", - "tati_120103y.webp", - "tati_120104.webp", - "tati_120104y.webp", - "tati_120105.webp", - "tati_120105y.webp", - "tati_120106.webp", - "tati_120107.webp", - "tati_120107y.webp", - "tati_120108.webp", - "tati_120111.webp", - "tati_120111y.webp", - "tati_120112.webp", - "tati_120113.webp", - "tati_120113y.webp", - "tati_120121.webp", - "tati_120121y.webp", - "tati_120122.webp", - "tati_120123.webp", - "tati_120123y.webp", - "tati_120124.webp", - "tati_120125.webp", - "tati_120125y.webp", - "tati_120126.webp", - "tati_120127.webp", - "tati_120127y.webp", - "tati_120128.webp", - "tati_120131.webp", - "tati_120132.webp", - "tati_430101.webp", - "tati_430101a.webp", - "tati_430101y.webp", - "tati_430102.webp", - "tati_430102a.webp", - "tati_430102y.webp", - "tati_430103.webp", - "tati_430103a.webp", - "tati_430103y.webp", - "tati_430105.webp", - "tati_430105a.webp", - "tati_430105y.webp", - "tati_430106.webp", - "tati_430106a.webp", - "tati_430106y.webp", - "tati_430107.webp", - "tati_430107y.webp", - "tati_430108a.webp", - "tati_430108y.webp", - "tati_440101.webp", - "tati_440101y.webp", - "tati_440103.webp", - "tati_440104.webp", - "tati_440105.webp", - "tati_440106.webp", - "tati_440108.webp", - "u.webp", - "ud.webp", - "udl.webp", - "udlr.webp", - "udr.webp", - "ul.webp", - "ulr.webp", - "unknow.webp", - "ur.webp", - "winskin.webp", - "winskin1.webp" - ], - "tilesets": [ - "magictower.webp", - "5.webp", - "4.webp", - "3.webp", - "2.webp", - "1.webp", - "11.webp", - "6.webp", - "12.webp", - "Outside_B.webp", - "C4.webp", - "C3.webp", - "C2.webp", - "C1.webp", - "IconSet.webp", - "9.webp", - "8.webp", - "7.webp", - "10.webp", - "C5.webp" - ], - "animates": [ - "hand", - "jianji", - "sword", - "thunder", - "yongchang", - "zone" - ], - "bgms": [ - "Asphodelus_Ceui.mp3", - "Blind_Alley.mp3", - "Crawler.mp3", - "theme.mp3" - ], - "sounds": [ - "aiy010000010.mp3", - "aiy010000020.mp3", - "aiy010000030.mp3", - "aiy020000005.mp3", - "aiy020000010.mp3", - "aiy020000020.mp3", - "aiy020000030.mp3", - "aiy020000040.mp3", - "aiy020000050.mp3", - "aiy020000060.mp3", - "aiy020000070.mp3", - "aiy020000080.mp3", - "aiy020000090.mp3", - "aiy020000100.mp3", - "aiy020000110.mp3", - "aiy020000120.mp3", - "aiy020000130.mp3", - "aiy020000140.mp3", - "aiy020000150.mp3", - "aiy020000160.mp3", - "aiy020000170.mp3", - "aiy020000180.mp3", - "aiy310000010.mp3", - "aiy310000020.mp3", - "aiy310000030.mp3", - "aiy310000040.mp3", - "aiy310000050.mp3", - "aiy310000060.mp3", - "aiy310000070.mp3", - "aiy310000080.mp3", - "aiy310000090.mp3", - "aiy310000100.mp3", - "aiy310000110.mp3", - "aiy310000120.mp3", - "aiy310000130.mp3", - "aiy310000140.mp3", - "aiy310000150.mp3", - "aiy310000160.mp3", - "aiy310000170.mp3", - "aiy310000180.mp3", - "aiy310000190.mp3", - "aiy310000200.mp3", - "aiy310000210.mp3", - "aiy310000220.mp3", - "aiy310000230.mp3", - "aiy310000240.mp3", - "aiy310000250.mp3", - "aiy310000260.mp3", - "aiy310000280.mp3", - "aiy310000290.mp3", - "aiy310000300.mp3", - "aiy350000010.mp3", - "aiy350000020.mp3", - "aiy350000030.mp3", - "aiy350000040.mp3", - "aiy350000050.mp3", - "aiy350000060.mp3", - "aiy350000070.mp3", - "aiy350000080.mp3", - "aiy350000090.mp3", - "aiy350000100.mp3", - "aiy350000110.mp3", - "aiy350000120.mp3", - "aiy350000130.mp3", - "aiy350000140.mp3", - "aiy350000150.mp3", - "aiy350000160.mp3", - "aiy350000170.mp3", - "aiy350000180.mp3", - "aiy350000190.mp3", - "aiy350000200.mp3", - "aiy350000210.mp3", - "aiy350000220.mp3", - "aiy350000230.mp3", - "aiy710000010.mp3", - "aiy710000020.mp3", - "aiy710000030.mp3", - "aiy710000040.mp3", - "aiy710000050.mp3", - "aiy710000060.mp3", - "aiy710000070.mp3", - "aiy710000080.mp3", - "aiy710000090.mp3", - "aiy710000100.mp3", - "aiy710000110.mp3", - "aiy710000120.mp3", - "aiy710000130.mp3", - "aiy820000010.mp3", - "aiy820000020.mp3", - "attack.mp3", - "bomb.mp3", - "cancel.mp3", - "centerFly.mp3", - "confirm.mp3", - "cursor.mp3", - "door.mp3", - "equip.mp3", - "error.mp3", - "floor.mp3", - "gem.mp3", - "icePickaxe.mp3", - "item.mp3", - "jingbao.mp3", - "jump.mp3", - "load.mp3", - "open_ui.mp3", - "pickaxe.mp3", - "recovery.mp3", - "save.mp3", - "shop.mp3", - "zone.mp3" - ], - "fonts": [ - "HATTEN", - "number", - "pala", - "simhei" - ], - "nameMap": { - "确定": "confirm.mp3", - "取消": "cancel.mp3", - "操作失败": "error.mp3", - "光标移动": "cursor.mp3", - "打开界面": "open_ui.mp3", - "读档": "load.mp3", - "存档": "save.mp3", - "获得道具": "item.mp3", - "回血": "recovery.mp3", - "炸弹": "bomb.mp3", - "飞行器": "centerFly.mp3", - "开关门": "door.mp3", - "上下楼": "floor.mp3", - "跳跃": "jump.mp3", - "破墙镐": "pickaxe.mp3", - "破冰镐": "icePickaxe.mp3", - "宝石": "gem.mp3", - "阻激夹域": "zone.mp3", - "穿脱装备": "equip.mp3", - "背景音乐": "bgm.mp3", - "攻击": "attack.mp3", - "背景图": "bg.webp", - "商店": "shop.mp3", - "领域": "zone" - }, - "levelChoose": null, - "equipName": [ - "武器", - "武器", - "护具", - "饰品", - "饰品" - ], - "startBgm": "theme.mp3", - "styles": { - "startBackground": "project/images/background.webp", - "startVerticalBackground": "project/images/backgroundvertical.webp", - "startLogoStyle": "color: black", - "startButtonsStyle": "background-color: #000000; opacity: 0.45; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", - "statusLeftBackground": "url(project/materials/ground.webp) repeat", - "statusTopBackground": "url(project/materials/ground.webp) repeat", - "toolsBackground": "url(project/materials/ground.webp) repeat", - "floorChangingStyle": "background-color: black; color: white", - "statusBarColor": [ - 255, - 255, - 255, - 1 - ], - "borderColor": [ - 204, - 204, - 204, - 1 - ], - "selectColor": [ - 255, - 215, - 0, - 1 - ], - "font": "pala" - }, - "splitImages": null - }, - "firstData": { - "title": "秽翼的尤斯蒂娅", - "name": "Eustia", - "version": "鸽子窝造塔小队", - "floorId": "street01", - "hero": { - "image": "hero.webp", - "animate": false, - "name": "Caim", - "lv": 1, - "hpmax": 9999, - "hp": 1000, - "manamax": -1, - "mana": 0, - "atk": 100, - "def": 100, - "mdef": 0, - "money": 0, - "exp": 0, - "equipment": [], - "items": { - "constants": {}, - "tools": {}, - "equips": {} - }, - "loc": { - "direction": "up", - "x": 5, - "y": 11 - }, - "flags": { - "itemDetail": true, - "useBetweenLight": true - }, - "followers": [], - "steps": 0, - "matk": 0, - "speed": 0, - "str": 5, - "agi": 5, - "int": 5, - "con": 5, - "magic": false - }, - "startCanvas": [ - { - "type": "comment", - "text": "在这里可以用事件来自定义绘制标题界面的背景图等" - }, - { - "type": "comment", - "text": "也可以直接切换到其他楼层(比如某个开始剧情楼层)进行操作。" - }, - { - "type": "previewUI", - "action": [ - { - "type": "fillRect", - "x": 0, - "y": 0, - "width": "core._PX_ || core.__PIXELS__", - "height": "core._PY_ || core.__PIXELS__", - "style": [ - 82, - 82, - 82, - 1 - ] - }, - { - "type": "setAttribute", - "align": "center" - }, - { - "type": "fillBoldText", - "x": "(core._PX_ || core.__PIXELS__) / 2", - "y": 80, - "style": [ - 255, - 255, - 255, - 1 - ], - "strokeStyle": [ - 0, - 0, - 0, - 1 - ], - "font": "bold 40px Verdana", - "text": "${core.firstData.title}" - } - ] - }, - { - "type": "setValue", - "name": "flag:selection", - "value": "0" - }, - { - "type": "comment", - "text": "在右下方自绘一个对话框进行显示选择项" - }, - { - "type": "previewUI", - "action": [ - { - "type": "fillRect", - "x": 230, - "y": 250, - "width": 150, - "height": 142, - "radius": 10, - "style": [ - 50, - 54, - 159, - 0.85 - ] - }, - { - "type": "strokeRect", - "x": 230, - "y": 250, - "width": 150, - "height": 142, - "radius": 10, - "style": [ - 255, - 255, - 255, - 1 - ], - "lineWidth": 2 - }, - { - "type": "fillBoldText", - "x": 305, - "y": 290, - "style": [ - 255, - 255, - 255, - 1 - ], - "font": "bold 25px Verdana", - "text": "开始游戏" - }, - { - "type": "fillBoldText", - "x": 305, - "y": 330, - "font": "bold 25px Verdana", - "text": "读取存档" - }, - { - "type": "fillBoldText", - "x": 305, - "y": 370, - "font": "bold 25px Verdana", - "text": "回放录像" - } - ] - }, - { - "type": "while", - "condition": "1", - "data": [ - { - "type": "drawSelector", - "image": "winskin.webp", - "code": 1, - "x": 245, - "y": "261 + 40*flag:selection", - "width": 120, - "height": 40 - }, - { - "type": "wait", - "data": [ - { - "case": "keyboard", - "keycode": "13,32", - "break": true, - "action": [ - { - "type": "switch", - "condition": "flag:selection", - "caseList": [ - { - "case": "0", - "action": [ - { - "type": "comment", - "text": "在“开始游戏”确定" - }, - { - "type": "break", - "n": 1 - } - ] - }, - { - "case": "1", - "action": [ - { - "type": "comment", - "text": "在“读取存档”确定" - }, - { - "type": "callLoad" - } - ] - }, - { - "case": "2", - "action": [ - { - "type": "comment", - "text": "在“回放录像”确定" - }, - { - "type": "if", - "condition": "(!core.isReplaying())", - "true": [ - { - "type": "function", - "function": "function(){\ncore.chooseReplayFile()\n}" - } - ] - } - ] - } - ] - } - ] - }, - { - "case": "keyboard", - "keycode": "38", - "break": true, - "action": [ - { - "type": "comment", - "text": "光标上键" - }, - { - "type": "setValue", - "name": "flag:selection", - "value": "(flag:selection + 2) % 3" - } - ] - }, - { - "case": "keyboard", - "keycode": "40", - "break": true, - "action": [ - { - "type": "comment", - "text": "光标下键" - }, - { - "type": "setValue", - "name": "flag:selection", - "value": "(flag:selection + 1) % 3" - } - ] - }, - { - "case": "mouse", - "px": [ - 245, - 365 - ], - "py": [ - 261, - 300 - ], - "break": true, - "action": [ - { - "type": "comment", - "text": "点击“开始游戏”" - }, - { - "type": "break", - "n": 1 - } - ] - }, - { - "case": "mouse", - "px": [ - 245, - 365 - ], - "py": [ - 301, - 340 - ], - "break": true, - "action": [ - { - "type": "comment", - "text": "点击“读取存档”" - }, - { - "type": "callLoad" - } - ] - }, - { - "case": "mouse", - "px": [ - 245, - 365 - ], - "py": [ - 341, - 380 - ], - "break": true, - "action": [ - { - "type": "comment", - "text": "点击“播放录像”" - }, - { - "type": "if", - "condition": "(!core.isReplaying())", - "true": [ - { - "type": "function", - "function": "function(){\ncore.chooseReplayFile()\n}" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "setValue", - "name": "flag:selection", - "value": "null" - }, - { - "type": "drawSelector", - "code": 1 - }, - { - "type": "clearMap" - }, - { - "type": "function", - "function": "function(){\ncore.control.checkBgm()\n}" - }, - { - "type": "if", - "condition": "(main.levelChoose.length == 0)", - "true": [ - { - "type": "comment", - "text": "没有难度选择:直接开始游戏" - } - ], - "false": [ - { - "type": "comment", - "text": "难度选择:作为样例,这里只提供了一个显示选择项。" - }, - { - "type": "function", - "function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one.title || '',\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + (one.name || '') + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}" - }, - { - "type": "comment", - "text": "你也可以仿照上面的样例进行自己创建等待用户操作来处理不同的难度分歧。\n如需自己处理,请设置 core.status.hard \n(例如,自定义js脚本:core.status.hard = 'Easy' )" - } - ] - }, - { - "type": "clearMap" - }, - { - "type": "comment", - "text": "接下来会执行startText中的事件" - }, - { - "type": "comment", - "text": "状态栏默认处于隐藏状态;可以使用“显示状态栏”事件进行显示。" - } - ], - "startText": [ - { - "type": "setValue", - "name": "item:book", - "value": "1" - }, - { - "type": "setValue", - "name": "item:fly", - "value": "1" - } - ], - "shops": [ - { - "id": "shop1", - "text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:", - "textInList": "1F金币商店", - "mustEnable": false, - "disablePreview": false, - "choices": [ - { - "text": "生命+800", - "need": "status:money>=20+2*flag:shop1", - "action": [ - { - "type": "comment", - "text": "新版商店中需要手动扣减金币和增加访问次数" - }, - { - "type": "setValue", - "name": "status:money", - "operator": "-=", - "value": "20+2*flag:shop1" - }, - { - "type": "setValue", - "name": "flag:shop1", - "operator": "+=", - "value": "1" - }, - { - "type": "setValue", - "name": "status:hp", - "operator": "+=", - "value": "800" - } - ] - }, - { - "text": "攻击+4", - "need": "status:money>=20+2*flag:shop1", - "action": [ - { - "type": "comment", - "text": "新版商店中需要手动扣减金币和增加访问次数" - }, - { - "type": "setValue", - "name": "status:money", - "operator": "-=", - "value": "20+2*flag:shop1" - }, - { - "type": "setValue", - "name": "flag:shop1", - "operator": "+=", - "value": "1" - }, - { - "type": "setValue", - "name": "status:atk", - "operator": "+=", - "value": "4" - } - ] - } - ] - }, - { - "id": "shop2", - "text": "\t[贪婪之神,expShop]勇敢的武士啊, 给我一定经验就可以:", - "textInList": "1F经验商店", - "mustEnable": false, - "disablePreview": true, - "choices": [ - { - "text": "等级+1(100经验)", - "need": "status:exp>=100", - "action": [ - { - "type": "setValue", - "name": "status:exp", - "operator": "-=", - "value": "100" - }, - { - "type": "setValue", - "name": "status:lv", - "operator": "+=", - "value": "1" - }, - { - "type": "setValue", - "name": "status:hp", - "operator": "+=", - "value": "1000" - } - ] - } - ] - }, - { - "id": "itemShop", - "item": true, - "textInList": "道具商店", - "use": "money", - "mustEnable": false, - "choices": [ - { - "id": "yellowKey", - "number": 10, - "money": "10", - "sell": "5" - } - ] - }, - { - "id": "keyShop", - "textInList": "回收钥匙商店", - "mustEnable": false, - "commonEvent": "回收钥匙商店" - } - ], - "levelUp": [ - { - "need": "0", - "title": "", - "action": [ - { - "type": "comment", - "text": "此处是初始等级,只需填写称号" - } - ] - }, - { - "need": "20", - "title": "", - "action": [ - { - "type": "setValue", - "name": "status:atk", - "operator": "+=", - "value": "10" - }, - { - "type": "setValue", - "name": "status:def", - "operator": "+=", - "value": "10" - } - ] - }, - { - "need": "40", - "title": "", - "action": [ - { - "type": "tip", - "text": "恭喜升级" - } - ] - } - ] - }, - "values": { - "lavaDamage": 100, - "poisonDamage": 10, - "weakValue": 20, - "redGem": 3, - "blueGem": 3, - "greenGem": 5, - "redPotion": 100, - "bluePotion": 250, - "yellowPotion": 500, - "greenPotion": 800, - "breakArmor": 0.9, - "counterAttack": 0.1, - "purify": 3, - "hatred": 2, - "animateSpeed": 300, - "moveSpeed": 100, - "statusCanvasRowsOnMobile": 3, - "floorChangeTime": 500 - }, - "flags": { - "statusBarItems": [ - "enableFloor", - "enableLv", - "enableHP", - "enableMana", - "enableAtk", - "enableDef", - "enableMDef", - "enableMoney", - "enableExp", - "enableKeys", - "enablePZF", - "enableSkill" - ], - "autoScale": true, - "extendToolbar": false, - "flyNearStair": false, - "flyRecordPosition": true, - "itemFirstText": false, - "equipboxButton": false, - "enableAddPoint": false, - "enableNegativeDamage": false, - "betweenAttackMax": false, - "useLoop": true, - "startUsingCanvas": false, - "statusCanvas": false, - "enableEnemyPoint": true, - "enableGentleClick": true, - "ignoreChangeFloor": true, - "canGoDeadZone": false, - "enableMoveDirectly": true, - "enableRouteFolding": true, - "disableShopOnDamage": false, - "blurFg": true, - "hideLeftStatusBar": false - } -} \ No newline at end of file +var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = { + main: { + floorIds: [ + "Caimhome", + "jiuguan", + "KTV", + "KTVF2", + "goldkey", + "bihusuo", + "jiaotang", + "shengnvhome", + "shinvhome", + "jiedao", + "street01", + "street02", + "guangchang", + "guangchang2", + "xiaoxiang01", + "xiaoxiang02", + "xiaoxiang3", + "yiqu1", + "yiqu2", + "yiqu3", + "yiqu4", + "yiqu5", + "yiqu6", + "yiqu7", + "yiqu8", + "yiqu9", + "yiqu10", + ], + floorPartitions: [], + images: [ + "HPGaugeEnemy_A.webp", + "HPGaugeEnemy_B.webp", + "background.webp", + "backgroundvertical.webp", + "bg_0000.png", + "bg_1511.webp", + "bg_1521.webp", + "bg_2010.webp", + "bg_2011.webp", + "bg_2521.webp", + "bg_3021.webp", + "bg_3026.webp", + "bg_3028.webp", + "bg_3042.webp", + "bg_3531.webp", + "bg_3551.webp", + "bg_3561.webp", + "bg_3563.webp", + "bg_3571.webp", + "bg_3601.webp", + "bg_3721.webp", + "bg_3801.webp", + "bg_5033.webp", + "bg_5043.webp", + "bg_5044.webp", + "bg_6004.webp", + "cao.webp", + "d.webp", + "dl.webp", + "dlr.webp", + "dr.webp", + "eve_010102.webp", + "eve_010203.webp", + "eve_010304.webp", + "eve_010501.webp", + "eve_010601.webp", + "eve_010701.webp", + "eve_010801.webp", + "eve_010902.webp", + "eve_011001.webp", + "eve_011101.webp", + "eve_011202.webp", + "eve_011302.webp", + "eve_011402.webp", + "eve_020102.webp", + "eve_020201.webp", + "eve_020301.webp", + "eve_020401.webp", + "eve_020501.webp", + "eve_020605.webp", + "eve_020701.webp", + "eve_020801.webp", + "eve_030101.webp", + "eve_030206.webp", + "eve_030302.webp", + "eve_030508.webp", + "eve_030601.webp", + "eve_030801.webp", + "eve_030901.webp", + "eve_031002.webp", + "eve_031101.webp", + "eve_040201.webp", + "eve_040401.webp", + "eve_040501.webp", + "eve_040601.webp", + "eve_040702.webp", + "eve_040801.webp", + "eve_050101.webp", + "eve_050201.webp", + "eve_050401.webp", + "eve_050501.webp", + "eve_050601.webp", + "eve_050704.webp", + "eve_050801.webp", + "eve_070101.webp", + "face_020101.webp", + "face_020102.webp", + "face_020103.webp", + "face_020104.webp", + "face_020105.webp", + "face_020106.webp", + "face_020107.webp", + "face_020108.webp", + "face_020109.webp", + "face_020110.webp", + "face_020111.webp", + "face_020112.webp", + "face_020113.webp", + "face_020114.webp", + "face_020115.webp", + "face_020116.webp", + "face_020117.webp", + "face_020118.webp", + "face_020121.webp", + "face_020122.webp", + "face_020123.webp", + "face_020124.webp", + "face_020125.webp", + "face_020126.webp", + "face_020127.webp", + "face_020128.webp", + "face_020129.webp", + "face_020130.webp", + "face_020131.webp", + "face_020132.webp", + "face_020133.webp", + "face_020134.webp", + "face_020135.webp", + "face_020136.webp", + "face_020137.webp", + "face_020141.webp", + "face_020142.webp", + "face_020143.webp", + "face_020144.webp", + "face_020145.webp", + "face_020146.webp", + "face_020147.webp", + "face_020148.webp", + "face_020149.webp", + "face_020150.webp", + "face_020151.webp", + "face_020152.webp", + "face_020153.webp", + "face_020154.webp", + "face_020155.webp", + "face_020156.webp", + "face_020157.webp", + "face_020158.webp", + "face_020159.webp", + "face_030101.webp", + "face_030102.webp", + "face_030103.webp", + "face_030104.webp", + "face_030105.webp", + "face_030107.webp", + "face_030121.webp", + "face_030122.webp", + "face_030123.webp", + "face_030124.webp", + "face_030125.webp", + "face_030127.webp", + "face_030129.webp", + "face_030131.webp", + "face_030132.webp", + "face_030141.webp", + "face_030142.webp", + "face_030143.webp", + "face_030144.webp", + "face_030145.webp", + "face_050101.webp", + "face_050102.webp", + "face_050103.webp", + "face_050104.webp", + "face_050105.webp", + "face_050106.webp", + "face_050107.webp", + "face_050108.webp", + "face_050111.webp", + "face_050112.webp", + "face_050113.webp", + "face_050116.webp", + "face_050121.webp", + "face_050122.webp", + "face_050123.webp", + "face_050124.webp", + "face_050125.webp", + "face_050126.webp", + "face_050127.webp", + "face_050128.webp", + "face_050129.webp", + "face_050130.webp", + "face_050131.webp", + "face_050132.webp", + "face_050134.webp", + "face_050135.webp", + "face_050136.webp", + "face_050137.webp", + "face_050141.webp", + "face_050142.webp", + "face_050143.webp", + "face_050144.webp", + "face_050145.webp", + "face_050146.webp", + "face_050147.webp", + "face_050148.webp", + "face_050150.webp", + "face_050151.webp", + "face_050152.webp", + "face_050201.webp", + "face_050202.webp", + "face_050203.webp", + "face_050204.webp", + "face_050205.webp", + "face_050206.webp", + "face_050210.webp", + "face_050212.webp", + "face_050213.webp", + "face_050214.webp", + "face_050215.webp", + "face_050216.webp", + "face_050221.webp", + "face_050222.webp", + "face_050223.webp", + "face_050224.webp", + "face_050225.webp", + "face_050226.webp", + "face_050229.webp", + "face_050230.webp", + "face_050232.webp", + "face_050234.webp", + "face_050235.webp", + "face_050237.webp", + "face_050241.webp", + "face_050242.webp", + "face_050243.webp", + "face_050244.webp", + "face_050245.webp", + "face_050246.webp", + "face_050249.webp", + "face_050250.webp", + "face_050252.webp", + "face_050301.webp", + "face_050302.webp", + "face_050303.webp", + "face_050304.webp", + "face_050305.webp", + "face_050306.webp", + "face_050307.webp", + "face_050308.webp", + "face_050309.webp", + "face_050310.webp", + "face_050311.webp", + "face_050313.webp", + "face_050314.webp", + "face_050315.webp", + "face_050316.webp", + "face_050317.webp", + "face_050321.webp", + "face_050322.webp", + "face_050323.webp", + "face_050324.webp", + "face_050325.webp", + "face_050326.webp", + "face_050327.webp", + "face_050328.webp", + "face_050329.webp", + "face_050330.webp", + "face_050331.webp", + "face_050332.webp", + "face_050333.webp", + "face_050334.webp", + "face_050335.webp", + "face_050336.webp", + "face_050337.webp", + "face_050338.webp", + "face_050341.webp", + "face_050342.webp", + "face_050343.webp", + "face_050344.webp", + "face_050345.webp", + "face_050346.webp", + "face_050347.webp", + "face_050348.webp", + "face_050349.webp", + "face_050350.webp", + "face_050351.webp", + "face_050352.webp", + "face_050353.webp", + "face_050441.webp", + "face_050442.webp", + "face_050443.webp", + "face_050445.webp", + "face_050446.webp", + "face_050447.webp", + "face_050451.webp", + "face_050452.webp", + "face_120101.webp", + "face_120102.webp", + "face_120103.webp", + "face_120104.webp", + "face_120105.webp", + "face_120106.webp", + "face_120107.webp", + "face_120108.webp", + "face_120111.webp", + "face_120112.webp", + "face_120113.webp", + "face_120121.webp", + "face_120122.webp", + "face_120123.webp", + "face_120124.webp", + "face_120125.webp", + "face_120126.webp", + "face_120127.webp", + "face_120128.webp", + "face_120131.webp", + "face_120132.webp", + "face_130101.webp", + "face_130102.webp", + "face_130103.webp", + "face_130104.webp", + "face_130105.webp", + "face_130106.webp", + "face_130107.webp", + "face_130108.webp", + "face_130109.webp", + "face_130110.webp", + "face_130111.webp", + "face_130112.webp", + "face_130113.webp", + "face_130121.webp", + "face_130122.webp", + "face_130123.webp", + "face_130124.webp", + "face_130125.webp", + "face_130126.webp", + "face_130127.webp", + "face_130128.webp", + "face_130129.webp", + "face_130130.webp", + "face_130131.webp", + "face_130132.webp", + "face_130201.webp", + "face_130202.webp", + "face_130203.webp", + "face_130204.webp", + "face_130205.webp", + "face_130206.webp", + "face_130207.webp", + "face_130208.webp", + "face_130209.webp", + "face_130211.webp", + "face_130212.webp", + "face_130213.webp", + "face_130221.webp", + "face_130222.webp", + "face_130223.webp", + "face_130224.webp", + "face_130225.webp", + "face_130226.webp", + "face_130227.webp", + "face_130228.webp", + "face_130229.webp", + "face_130230.webp", + "face_130231.webp", + "face_320101.webp", + "face_320102.webp", + "face_320103.webp", + "face_320104.webp", + "face_320105.webp", + "face_320106.webp", + "face_320107.webp", + "face_320108.webp", + "face_320109.webp", + "face_320121.webp", + "face_320122.webp", + "face_320123.webp", + "face_320124.webp", + "face_320125.webp", + "face_320127.webp", + "face_430101.webp", + "face_430102.webp", + "face_430103.webp", + "face_430104.webp", + "face_430105.webp", + "face_430106.webp", + "face_430107.webp", + "face_430108.webp", + "face_440101.webp", + "face_440102.webp", + "face_440103.webp", + "face_440104.webp", + "face_440105.webp", + "face_440106.webp", + "face_440107.webp", + "face_440108.webp", + "face_440109.webp", + "face_440110.webp", + "green.webp", + "hero.webp", + "l.webp", + "lane1.webp", + "light.webp", + "lock.webp", + "lr.webp", + "maba.webp", + "null.webp", + "other_0001.webp", + "other_0002.webp", + "other_0003.webp", + "other_0004.webp", + "r.webp", + "status.webp", + "tati_020101.webp", + "tati_020101a.webp", + "tati_020101y.webp", + "tati_020102.webp", + "tati_020102a.webp", + "tati_020103.webp", + "tati_020103y.webp", + "tati_020104.webp", + "tati_020104a.webp", + "tati_020104y.webp", + "tati_020105.webp", + "tati_020105a.webp", + "tati_020105y.webp", + "tati_020106.webp", + "tati_020107.webp", + "tati_020107a.webp", + "tati_020107y.webp", + "tati_020109.webp", + "tati_020110.webp", + "tati_020111.webp", + "tati_020111a.webp", + "tati_020113.webp", + "tati_020113a.webp", + "tati_020114.webp", + "tati_020115.webp", + "tati_020115y.webp", + "tati_020116.webp", + "tati_020116a.webp", + "tati_020117.webp", + "tati_020117a.webp", + "tati_020118.webp", + "tati_020121a.webp", + "tati_020122.webp", + "tati_020123.webp", + "tati_020123y.webp", + "tati_020124.webp", + "tati_020124a.webp", + "tati_020125.webp", + "tati_020125a.webp", + "tati_020125y.webp", + "tati_020126.webp", + "tati_020126y.webp", + "tati_020127.webp", + "tati_020129.webp", + "tati_020130.webp", + "tati_020131.webp", + "tati_020131a.webp", + "tati_020131y.webp", + "tati_020132.webp", + "tati_020133.webp", + "tati_020134.webp", + "tati_020135.webp", + "tati_020135a.webp", + "tati_020136.webp", + "tati_020137.webp", + "tati_020141.webp", + "tati_020141a.webp", + "tati_020142.webp", + "tati_020142a.webp", + "tati_020142y.webp", + "tati_020143.webp", + "tati_020143y.webp", + "tati_020144.webp", + "tati_020144a.webp", + "tati_020145.webp", + "tati_020145a.webp", + "tati_020145y.webp", + "tati_020146.webp", + "tati_020147.webp", + "tati_020149.webp", + "tati_020150.webp", + "tati_020151.webp", + "tati_020151a.webp", + "tati_020152.webp", + "tati_020153.webp", + "tati_020154.webp", + "tati_020157.webp", + "tati_020157a.webp", + "tati_020158.webp", + "tati_050101.webp", + "tati_050101a.webp", + "tati_050101y.webp", + "tati_050102.webp", + "tati_050102y.webp", + "tati_050103.webp", + "tati_050103a.webp", + "tati_050103y.webp", + "tati_050104.webp", + "tati_050104a.webp", + "tati_050105.webp", + "tati_050105a.webp", + "tati_050105y.webp", + "tati_050106.webp", + "tati_050106y.webp", + "tati_050107.webp", + "tati_050107a.webp", + "tati_050107y.webp", + "tati_050110.webp", + "tati_050111.webp", + "tati_050111a.webp", + "tati_050111y.webp", + "tati_050112.webp", + "tati_050113y.webp", + "tati_050116.webp", + "tati_050116a.webp", + "tati_050116y.webp", + "tati_050117.webp", + "tati_050121.webp", + "tati_050121a.webp", + "tati_050121y.webp", + "tati_050122.webp", + "tati_050122y.webp", + "tati_050123.webp", + "tati_050123a.webp", + "tati_050123y.webp", + "tati_050124.webp", + "tati_050124a.webp", + "tati_050124y.webp", + "tati_050125.webp", + "tati_050125a.webp", + "tati_050125y.webp", + "tati_050126.webp", + "tati_050126y.webp", + "tati_050127.webp", + "tati_050127a.webp", + "tati_050128.webp", + "tati_050131.webp", + "tati_050131a.webp", + "tati_050131y.webp", + "tati_050132.webp", + "tati_050134.webp", + "tati_050134y.webp", + "tati_050135.webp", + "tati_050135y.webp", + "tati_050136.webp", + "tati_050137.webp", + "tati_050137y.webp", + "tati_050141.webp", + "tati_050141a.webp", + "tati_050141y.webp", + "tati_050142.webp", + "tati_050142a.webp", + "tati_050142y.webp", + "tati_050143.webp", + "tati_050143a.webp", + "tati_050143y.webp", + "tati_050144.webp", + "tati_050144a.webp", + "tati_050144y.webp", + "tati_050145.webp", + "tati_050145a.webp", + "tati_050145y.webp", + "tati_050146.webp", + "tati_050146y.webp", + "tati_050147.webp", + "tati_050147y.webp", + "tati_050151.webp", + "tati_050151a.webp", + "tati_050151y.webp", + "tati_050152.webp", + "tati_050152y.webp", + "tati_050201.webp", + "tati_050201a.webp", + "tati_050201y.webp", + "tati_050202.webp", + "tati_050202a.webp", + "tati_050202y.webp", + "tati_050203.webp", + "tati_050203y.webp", + "tati_050204a.webp", + "tati_050204y.webp", + "tati_050205.webp", + "tati_050205a.webp", + "tati_050205y.webp", + "tati_050206.webp", + "tati_050206a.webp", + "tati_050206y.webp", + "tati_050210y.webp", + "tati_050215.webp", + "tati_050216.webp", + "tati_050221.webp", + "tati_050221a.webp", + "tati_050221y.webp", + "tati_050222.webp", + "tati_050222a.webp", + "tati_050222y.webp", + "tati_050223.webp", + "tati_050224a.webp", + "tati_050224y.webp", + "tati_050225.webp", + "tati_050225a.webp", + "tati_050225y.webp", + "tati_050226.webp", + "tati_050226a.webp", + "tati_050229.webp", + "tati_050230y.webp", + "tati_050232a.webp", + "tati_050234a.webp", + "tati_050237.webp", + "tati_050241.webp", + "tati_050241a.webp", + "tati_050241y.webp", + "tati_050242.webp", + "tati_050242a.webp", + "tati_050242y.webp", + "tati_050243.webp", + "tati_050243y.webp", + "tati_050244a.webp", + "tati_050244y.webp", + "tati_050245.webp", + "tati_050245a.webp", + "tati_050245y.webp", + "tati_050252.webp", + "tati_050252y.webp", + "tati_050301.webp", + "tati_050301a.webp", + "tati_050301y.webp", + "tati_050302.webp", + "tati_050303.webp", + "tati_050303y.webp", + "tati_050304.webp", + "tati_050304y.webp", + "tati_050305.webp", + "tati_050305a.webp", + "tati_050305y.webp", + "tati_050306.webp", + "tati_050306y.webp", + "tati_050307.webp", + "tati_050307a.webp", + "tati_050307y.webp", + "tati_050308.webp", + "tati_050309.webp", + "tati_050310.webp", + "tati_050311.webp", + "tati_050311y.webp", + "tati_050313.webp", + "tati_050314.webp", + "tati_050315.webp", + "tati_050316.webp", + "tati_050316y.webp", + "tati_050317.webp", + "tati_050321.webp", + "tati_050321a.webp", + "tati_050321y.webp", + "tati_050322.webp", + "tati_050322y.webp", + "tati_050323.webp", + "tati_050324.webp", + "tati_050324a.webp", + "tati_050324y.webp", + "tati_050325.webp", + "tati_050325a.webp", + "tati_050325y.webp", + "tati_050326.webp", + "tati_050327.webp", + "tati_050327y.webp", + "tati_050328.webp", + "tati_050329.webp", + "tati_050331.webp", + "tati_050331y.webp", + "tati_050332.webp", + "tati_050333.webp", + "tati_050334.webp", + "tati_050334a.webp", + "tati_050335.webp", + "tati_050337.webp", + "tati_050338.webp", + "tati_050338y.webp", + "tati_050341.webp", + "tati_050341a.webp", + "tati_050341y.webp", + "tati_050342.webp", + "tati_050343.webp", + "tati_050343y.webp", + "tati_050344.webp", + "tati_050345.webp", + "tati_050345a.webp", + "tati_050345y.webp", + "tati_050346.webp", + "tati_050347.webp", + "tati_050348.webp", + "tati_050349.webp", + "tati_050351.webp", + "tati_050351y.webp", + "tati_050352.webp", + "tati_050353.webp", + "tati_050353y.webp", + "tati_050441.webp", + "tati_050443.webp", + "tati_050443y.webp", + "tati_050445.webp", + "tati_050445a.webp", + "tati_050445y.webp", + "tati_050451.webp", + "tati_050451a.webp", + "tati_050452.webp", + "tati_050452y.webp", + "tati_120101.webp", + "tati_120101y.webp", + "tati_120102.webp", + "tati_120102y.webp", + "tati_120103.webp", + "tati_120103y.webp", + "tati_120104.webp", + "tati_120104y.webp", + "tati_120105.webp", + "tati_120105y.webp", + "tati_120106.webp", + "tati_120107.webp", + "tati_120107y.webp", + "tati_120108.webp", + "tati_120111.webp", + "tati_120111y.webp", + "tati_120112.webp", + "tati_120113.webp", + "tati_120113y.webp", + "tati_120121.webp", + "tati_120121y.webp", + "tati_120122.webp", + "tati_120123.webp", + "tati_120123y.webp", + "tati_120124.webp", + "tati_120125.webp", + "tati_120125y.webp", + "tati_120126.webp", + "tati_120127.webp", + "tati_120127y.webp", + "tati_120128.webp", + "tati_120131.webp", + "tati_120132.webp", + "tati_430101.webp", + "tati_430101a.webp", + "tati_430101y.webp", + "tati_430102.webp", + "tati_430102a.webp", + "tati_430102y.webp", + "tati_430103.webp", + "tati_430103a.webp", + "tati_430103y.webp", + "tati_430105.webp", + "tati_430105a.webp", + "tati_430105y.webp", + "tati_430106.webp", + "tati_430106a.webp", + "tati_430106y.webp", + "tati_430107.webp", + "tati_430107y.webp", + "tati_430108a.webp", + "tati_430108y.webp", + "tati_440101.webp", + "tati_440101y.webp", + "tati_440103.webp", + "tati_440104.webp", + "tati_440105.webp", + "tati_440106.webp", + "tati_440108.webp", + "u.webp", + "ud.webp", + "udl.webp", + "udlr.webp", + "udr.webp", + "ul.webp", + "ulr.webp", + "unknow.webp", + "ur.webp", + "winskin.webp", + "winskin1.webp", + ], + tilesets: [ + "magictower.webp", + "5.webp", + "4.webp", + "3.webp", + "2.webp", + "1.webp", + "11.webp", + "6.webp", + "12.webp", + "Outside_B.webp", + "C4.webp", + "C3.webp", + "C2.webp", + "C1.webp", + "IconSet.webp", + "9.webp", + "8.webp", + "7.webp", + "10.webp", + "C5.webp", + ], + animates: ["hand", "jianji", "sword", "thunder", "yongchang", "zone"], + bgms: [ + "Asphodelus_Ceui.mp3", + "Blind_Alley.mp3", + "Crawler.mp3", + "theme.mp3", + ], + sounds: [ + "aiy010000010.mp3", + "aiy010000020.mp3", + "aiy010000030.mp3", + "aiy020000005.mp3", + "aiy020000010.mp3", + "aiy020000020.mp3", + "aiy020000030.mp3", + "aiy020000040.mp3", + "aiy020000050.mp3", + "aiy020000060.mp3", + "aiy020000070.mp3", + "aiy020000080.mp3", + "aiy020000090.mp3", + "aiy020000100.mp3", + "aiy020000110.mp3", + "aiy020000120.mp3", + "aiy020000130.mp3", + "aiy020000140.mp3", + "aiy020000150.mp3", + "aiy020000160.mp3", + "aiy020000170.mp3", + "aiy020000180.mp3", + "aiy310000010.mp3", + "aiy310000020.mp3", + "aiy310000030.mp3", + "aiy310000040.mp3", + "aiy310000050.mp3", + "aiy310000060.mp3", + "aiy310000070.mp3", + "aiy310000080.mp3", + "aiy310000090.mp3", + "aiy310000100.mp3", + "aiy310000110.mp3", + "aiy310000120.mp3", + "aiy310000130.mp3", + "aiy310000140.mp3", + "aiy310000150.mp3", + "aiy310000160.mp3", + "aiy310000170.mp3", + "aiy310000180.mp3", + "aiy310000190.mp3", + "aiy310000200.mp3", + "aiy310000210.mp3", + "aiy310000220.mp3", + "aiy310000230.mp3", + "aiy310000240.mp3", + "aiy310000250.mp3", + "aiy310000260.mp3", + "aiy310000280.mp3", + "aiy310000290.mp3", + "aiy310000300.mp3", + "aiy350000010.mp3", + "aiy350000020.mp3", + "aiy350000030.mp3", + "aiy350000040.mp3", + "aiy350000050.mp3", + "aiy350000060.mp3", + "aiy350000070.mp3", + "aiy350000080.mp3", + "aiy350000090.mp3", + "aiy350000100.mp3", + "aiy350000110.mp3", + "aiy350000120.mp3", + "aiy350000130.mp3", + "aiy350000140.mp3", + "aiy350000150.mp3", + "aiy350000160.mp3", + "aiy350000170.mp3", + "aiy350000180.mp3", + "aiy350000190.mp3", + "aiy350000200.mp3", + "aiy350000210.mp3", + "aiy350000220.mp3", + "aiy350000230.mp3", + "aiy710000010.mp3", + "aiy710000020.mp3", + "aiy710000030.mp3", + "aiy710000040.mp3", + "aiy710000050.mp3", + "aiy710000060.mp3", + "aiy710000070.mp3", + "aiy710000080.mp3", + "aiy710000090.mp3", + "aiy710000100.mp3", + "aiy710000110.mp3", + "aiy710000120.mp3", + "aiy710000130.mp3", + "aiy820000010.mp3", + "aiy820000020.mp3", + "attack.mp3", + "bomb.mp3", + "cancel.mp3", + "centerFly.mp3", + "confirm.mp3", + "cursor.mp3", + "door.mp3", + "equip.mp3", + "error.mp3", + "floor.mp3", + "gem.mp3", + "icePickaxe.mp3", + "item.mp3", + "jingbao.mp3", + "jump.mp3", + "load.mp3", + "open_ui.mp3", + "pickaxe.mp3", + "recovery.mp3", + "save.mp3", + "shop.mp3", + "zone.mp3", + ], + fonts: ["HATTEN", "number", "pala", "simhei"], + nameMap: { + 确定: "confirm.mp3", + 取消: "cancel.mp3", + 操作失败: "error.mp3", + 光标移动: "cursor.mp3", + 打开界面: "open_ui.mp3", + 读档: "load.mp3", + 存档: "save.mp3", + 获得道具: "item.mp3", + 回血: "recovery.mp3", + 炸弹: "bomb.mp3", + 飞行器: "centerFly.mp3", + 开关门: "door.mp3", + 上下楼: "floor.mp3", + 跳跃: "jump.mp3", + 破墙镐: "pickaxe.mp3", + 破冰镐: "icePickaxe.mp3", + 宝石: "gem.mp3", + 阻激夹域: "zone.mp3", + 穿脱装备: "equip.mp3", + 背景音乐: "bgm.mp3", + 攻击: "attack.mp3", + 背景图: "bg.webp", + 商店: "shop.mp3", + 领域: "zone", + }, + levelChoose: null, + equipName: ["武器", "武器", "护具", "饰品", "饰品"], + startBgm: "theme.mp3", + styles: { + startBackground: "project/images/background.webp", + startVerticalBackground: "project/images/backgroundvertical.webp", + startLogoStyle: "color: black", + startButtonsStyle: + "background-color: #000000; opacity: 0.45; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", + statusLeftBackground: "url(project/materials/ground.webp) repeat", + statusTopBackground: "url(project/materials/ground.webp) repeat", + toolsBackground: "url(project/materials/ground.webp) repeat", + floorChangingStyle: "background-color: black; color: white", + statusBarColor: [255, 255, 255, 1], + borderColor: [204, 204, 204, 1], + selectColor: [255, 215, 0, 1], + font: "pala", + }, + splitImages: null, + }, + firstData: { + title: "秽翼的尤斯蒂娅", + name: "Eustia", + version: "鸽子窝造塔小队", + floorId: "street01", + hero: { + image: "hero.webp", + animate: false, + name: "Caim", + lv: 1, + hpmax: 9999, + hp: 1000, + manamax: -1, + mana: 0, + atk: 100, + def: 100, + mdef: 0, + money: 0, + exp: 0, + equipment: [], + items: { + constants: {}, + tools: {}, + equips: {}, + }, + loc: { + direction: "up", + x: 5, + y: 11, + }, + flags: { + itemDetail: true, + useBetweenLight: true, + }, + followers: [], + steps: 0, + speed: 0, + }, + startCanvas: [ + { + type: "comment", + text: "在这里可以用事件来自定义绘制标题界面的背景图等", + }, + { + type: "comment", + text: "也可以直接切换到其他楼层(比如某个开始剧情楼层)进行操作。", + }, + { + type: "previewUI", + action: [ + { + type: "fillRect", + x: 0, + y: 0, + width: "core._PX_ || core.__PIXELS__", + height: "core._PY_ || core.__PIXELS__", + style: [82, 82, 82, 1], + }, + { + type: "setAttribute", + align: "center", + }, + { + type: "fillBoldText", + x: "(core._PX_ || core.__PIXELS__) / 2", + y: 80, + style: [255, 255, 255, 1], + strokeStyle: [0, 0, 0, 1], + font: "bold 40px Verdana", + text: "${core.firstData.title}", + }, + ], + }, + { + type: "setValue", + name: "flag:selection", + value: "0", + }, + { + type: "comment", + text: "在右下方自绘一个对话框进行显示选择项", + }, + { + type: "previewUI", + action: [ + { + type: "fillRect", + x: 230, + y: 250, + width: 150, + height: 142, + radius: 10, + style: [50, 54, 159, 0.85], + }, + { + type: "strokeRect", + x: 230, + y: 250, + width: 150, + height: 142, + radius: 10, + style: [255, 255, 255, 1], + lineWidth: 2, + }, + { + type: "fillBoldText", + x: 305, + y: 290, + style: [255, 255, 255, 1], + font: "bold 25px Verdana", + text: "开始游戏", + }, + { + type: "fillBoldText", + x: 305, + y: 330, + font: "bold 25px Verdana", + text: "读取存档", + }, + { + type: "fillBoldText", + x: 305, + y: 370, + font: "bold 25px Verdana", + text: "回放录像", + }, + ], + }, + { + type: "while", + condition: "1", + data: [ + { + type: "drawSelector", + image: "winskin.webp", + code: 1, + x: 245, + y: "261 + 40*flag:selection", + width: 120, + height: 40, + }, + { + type: "wait", + data: [ + { + case: "keyboard", + keycode: "13,32", + break: true, + action: [ + { + type: "switch", + condition: "flag:selection", + caseList: [ + { + case: "0", + action: [ + { + type: "comment", + text: "在“开始游戏”确定", + }, + { + type: "break", + n: 1, + }, + ], + }, + { + case: "1", + action: [ + { + type: "comment", + text: "在“读取存档”确定", + }, + { + type: "callLoad", + }, + ], + }, + { + case: "2", + action: [ + { + type: "comment", + text: "在“回放录像”确定", + }, + { + type: "if", + condition: "(!core.isReplaying())", + true: [ + { + type: "function", + function: + "function(){\ncore.chooseReplayFile()\n}", + }, + ], + }, + ], + }, + ], + }, + ], + }, + { + case: "keyboard", + keycode: "38", + break: true, + action: [ + { + type: "comment", + text: "光标上键", + }, + { + type: "setValue", + name: "flag:selection", + value: "(flag:selection + 2) % 3", + }, + ], + }, + { + case: "keyboard", + keycode: "40", + break: true, + action: [ + { + type: "comment", + text: "光标下键", + }, + { + type: "setValue", + name: "flag:selection", + value: "(flag:selection + 1) % 3", + }, + ], + }, + { + case: "mouse", + px: [245, 365], + py: [261, 300], + break: true, + action: [ + { + type: "comment", + text: "点击“开始游戏”", + }, + { + type: "break", + n: 1, + }, + ], + }, + { + case: "mouse", + px: [245, 365], + py: [301, 340], + break: true, + action: [ + { + type: "comment", + text: "点击“读取存档”", + }, + { + type: "callLoad", + }, + ], + }, + { + case: "mouse", + px: [245, 365], + py: [341, 380], + break: true, + action: [ + { + type: "comment", + text: "点击“播放录像”", + }, + { + type: "if", + condition: "(!core.isReplaying())", + true: [ + { + type: "function", + function: "function(){\ncore.chooseReplayFile()\n}", + }, + ], + }, + ], + }, + ], + }, + ], + }, + { + type: "setValue", + name: "flag:selection", + value: "null", + }, + { + type: "drawSelector", + code: 1, + }, + { + type: "clearMap", + }, + { + type: "function", + function: "function(){\ncore.control.checkBgm()\n}", + }, + { + type: "if", + condition: "(main.levelChoose.length == 0)", + true: [ + { + type: "comment", + text: "没有难度选择:直接开始游戏", + }, + ], + false: [ + { + type: "comment", + text: "难度选择:作为样例,这里只提供了一个显示选择项。", + }, + { + type: "function", + function: + 'function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t"text": one.title || \'\',\n\t\t"action": [\n\t\t\t{ "type": "function", "function": "function() { core.status.hard = \'" + (one.name || \'\') + "\'; }" }\n\t\t]\n\t});\n})\ncore.insertAction({ "type": "choices", "choices": choices });\n}', + }, + { + type: "comment", + text: "你也可以仿照上面的样例进行自己创建等待用户操作来处理不同的难度分歧。\n如需自己处理,请设置 core.status.hard \n(例如,自定义js脚本:core.status.hard = 'Easy' )", + }, + ], + }, + { + type: "clearMap", + }, + { + type: "comment", + text: "接下来会执行startText中的事件", + }, + { + type: "comment", + text: "状态栏默认处于隐藏状态;可以使用“显示状态栏”事件进行显示。", + }, + ], + startText: [ + { + type: "setValue", + name: "item:book", + value: "1", + }, + { + type: "setValue", + name: "item:fly", + value: "1", + }, + ], + shops: [ + { + id: "shop1", + text: "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:", + textInList: "1F金币商店", + mustEnable: false, + disablePreview: false, + choices: [ + { + text: "生命+800", + need: "status:money>=20+2*flag:shop1", + action: [ + { + type: "comment", + text: "新版商店中需要手动扣减金币和增加访问次数", + }, + { + type: "setValue", + name: "status:money", + operator: "-=", + value: "20+2*flag:shop1", + }, + { + type: "setValue", + name: "flag:shop1", + operator: "+=", + value: "1", + }, + { + type: "setValue", + name: "status:hp", + operator: "+=", + value: "800", + }, + ], + }, + { + text: "攻击+4", + need: "status:money>=20+2*flag:shop1", + action: [ + { + type: "comment", + text: "新版商店中需要手动扣减金币和增加访问次数", + }, + { + type: "setValue", + name: "status:money", + operator: "-=", + value: "20+2*flag:shop1", + }, + { + type: "setValue", + name: "flag:shop1", + operator: "+=", + value: "1", + }, + { + type: "setValue", + name: "status:atk", + operator: "+=", + value: "4", + }, + ], + }, + ], + }, + { + id: "shop2", + text: "\t[贪婪之神,expShop]勇敢的武士啊, 给我一定经验就可以:", + textInList: "1F经验商店", + mustEnable: false, + disablePreview: true, + choices: [ + { + text: "等级+1(100经验)", + need: "status:exp>=100", + action: [ + { + type: "setValue", + name: "status:exp", + operator: "-=", + value: "100", + }, + { + type: "setValue", + name: "status:lv", + operator: "+=", + value: "1", + }, + { + type: "setValue", + name: "status:hp", + operator: "+=", + value: "1000", + }, + ], + }, + ], + }, + { + id: "itemShop", + item: true, + textInList: "道具商店", + use: "money", + mustEnable: false, + choices: [ + { + id: "yellowKey", + number: 10, + money: "10", + sell: "5", + }, + ], + }, + { + id: "keyShop", + textInList: "回收钥匙商店", + mustEnable: false, + commonEvent: "回收钥匙商店", + }, + ], + levelUp: [ + { + need: "0", + title: "", + action: [ + { + type: "comment", + text: "此处是初始等级,只需填写称号", + }, + ], + }, + { + need: "20", + title: "", + action: [ + { + type: "setValue", + name: "status:atk", + operator: "+=", + value: "10", + }, + { + type: "setValue", + name: "status:def", + operator: "+=", + value: "10", + }, + ], + }, + { + need: "40", + title: "", + action: [ + { + type: "tip", + text: "恭喜升级", + }, + ], + }, + ], + }, + values: { + lavaDamage: 100, + poisonDamage: 10, + weakValue: 20, + redGem: 3, + blueGem: 3, + greenGem: 5, + redPotion: 100, + bluePotion: 250, + yellowPotion: 500, + greenPotion: 800, + breakArmor: 0.9, + counterAttack: 0.1, + purify: 3, + hatred: 2, + animateSpeed: 300, + moveSpeed: 100, + statusCanvasRowsOnMobile: 3, + floorChangeTime: 500, + }, + flags: { + statusBarItems: [ + "enableFloor", + "enableLv", + "enableHP", + "enableMana", + "enableAtk", + "enableDef", + "enableMDef", + "enableMoney", + "enableExp", + "enableKeys", + "enablePZF", + "enableSkill", + ], + autoScale: true, + extendToolbar: false, + flyNearStair: false, + flyRecordPosition: true, + itemFirstText: false, + equipboxButton: false, + enableAddPoint: false, + enableNegativeDamage: false, + betweenAttackMax: false, + useLoop: true, + startUsingCanvas: false, + statusCanvas: false, + enableEnemyPoint: true, + enableGentleClick: true, + ignoreChangeFloor: true, + canGoDeadZone: false, + enableMoveDirectly: true, + enableRouteFolding: true, + disableShopOnDamage: false, + blurFg: true, + hideLeftStatusBar: false, + }, +}; diff --git a/project/functions.js b/project/functions.js index 0719015..e90a843 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1088,26 +1088,27 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }, "getStatusLabel": function (name) { - // 返回某个状态英文名的对应中文标签,如atk -> 攻击,def -> 防御等。 - // 请注意此项仅影响 libs/ 下的内容(如绘制怪物手册、数据统计等) - // 自行定义的(比如获得道具效果)中用到的“攻击+3”等需要自己去对应地方修改 + // 返回某个状态英文名的对应中文标签,如atk -> 攻击,def -> 防御等。 + // 请注意此项仅影响 libs/ 下的内容(如绘制怪物手册、数据统计等) + // 自行定义的(比如获得道具效果)中用到的“攻击+3”等需要自己去对应地方修改 - return { - name: "名称", - lv: "等级", - hpmax: "生命上限", - hp: "生命", - manamax: "魔力上限", - mana: "魔力", - atk: "攻击", - def: "防御", - mdef: "护盾", - money: "金币", - exp: "经验", - point: "加点", - steps: "步数", - }[name] || name; - }, + return { + name: "名称", + lv: "等级", + hpmax: "生命上限", + hp: "生命", + manamax: "魔力上限", + mana: "魔力", + atk: "攻击", + def: "防御", + mdef: "法强", + speed: "速度", + money: "金币", + exp: "经验", + point: "加点", + steps: "步数", + } [name] || name; +}, "triggerDebuff": function (action, type) { // 毒衰咒效果的获得与解除 // action:获得还是解除;'get'表示获得,'remove'表示解除 @@ -1166,8 +1167,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } }, "updateStatusBar": function () { - //更新属性映射 - core.updateStatus() // 更新状态栏 core.ui.statusBar.update(); // 更新阻激夹域的伤害值 diff --git a/project/items.js b/project/items.js index 385932e..fddc8ac 100644 --- a/project/items.js +++ b/project/items.js @@ -146,12 +146,12 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "sword1": { "cls": "equips", "name": "铁剑", - "text": "一把很普通的铁剑", + "text": "一把普通的铁剑", "equip": { "type": 0, "animate": "sword", "value": { - "str": 10 + "atk": 10 }, "percentage": {} }, @@ -230,11 +230,11 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "equip": { "type": 2, "value": { - "str": 10, - "agi": -5 + "mdef": -5, + "def": 10 }, "percentage": { - "str": 10 + "def": 10 } }, "itemEffect": "core.status.hero.def += 0", diff --git a/project/plugins.js b/project/plugins.js index cb4d4b2..95c5192 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1,213 +1,226 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { "init": function () { - this._afterLoadResources = function () { - // 本函数将在所有资源加载完毕后,游戏开启前被执行 - core.ui.statusBar.init(); - core.registerEvent("changeMouse", function (data) { - if (!main.replayChecking && !core.isReplaying()) - core.changeMouse( - data.icon, - data.div, - data.translate[0], - data.translate[1], - data.scale[0], - data.scale[1], - data.angel, - data.px, - data.py - ); - core.doAction(); - }); - core.registerEvent("removeMouse", function (data) { - if (!main.replayChecking && !core.isReplaying()) - core.removeMouse(data.div); - core.doAction(); - }); - core.registerEvent("addPop", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - data.value = core.replaceText(data.value); - core.addPop( - data.value, - data.px, - data.py, - data.color, - data.boldColor, - data.left, - data.jump, - data.time, - data.show, - data.font, - data.speed - ); - } - core.doAction(); - }); - core.registerEvent("drawWarning", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - data.text = core.replaceText(data.text); - data.text2 = core.replaceText(data.text2); - core.drawWarning( - data.x, - data.y, - data.size, - data?.text, - data?.text2, - data?.warning - ); - setTimeout(() => core.doAction(), 3100); - } else { - core.doAction(); - } - }); - core.registerEvent("playStereo", function (data) { - if (!main.replayChecking && !core.isReplaying()) - core.playStereo(data.name, data.left, data.right, data.split); - core.doAction(); - }); - core.registerEvent("moveStereo", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - const id = core.playStereo( - data.name, - data.left, - data.right, - data.split - ); - core.moveStereo(id, data.leftTo, data.rightTo, data.time); - } - core.doAction(); - }); - core.registerEvent("over", function (data) { - let image = data.image ?? ""; - let time = data.time ?? 3000; - let sound = data.sound ?? ""; - let textColor = data.textColor ?? "#FFFFFF"; - let boldColor = data.boldColor ?? "#000000"; - let font = data.font ?? "bold 48px Verdana"; - let text = data.text ?? ""; - let hidetime = data.hidetime ?? 100; - if (!main.replayChecking && !core.isReplaying()) { - core.over( - image, - data.memory, - time, - hidetime, - sound, - textColor, - boldColor, - font, - text - ); - } else { - core.doAction(); - } - }); - core.registerEvent("changebg", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.changebg( - data.img1, - data.memory1, - data.img2, - data.memory2, - data.time, - data.style - ); - } else { - core.doAction(); - } - }); - core.registerEvent("overlist", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.overlist( - data.image, - data.memory, - data.hidetime || 30, - data.list || [{ - text: "", - sound: "", - time: 50, - textColor: "#FFFFFF", - boldColor: "#000000", - font: "bold 48px Verdana", - frame: 0, - }, ] - ); - } else { - core.doAction(); - } - }); - core.registerEvent("op", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.openvideo(); - } else { - core.doAction(); - } - }); - core.registerEvent("animationDrawable", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.animationDrawable( - data.allFarme, - data.color, - data.globalAlpha, - data.imageList, - data.soundList - ); - } else { - core.doAction(); - } - }); - core.registerEvent("setanimate", function (data) { + this._afterLoadResources = function () { + // 本函数将在所有资源加载完毕后,游戏开启前被执行 + core.ui.statusBar.init(); + core.registerEvent("changeMouse", function (data) { + if (!main.replayChecking && !core.isReplaying()) + core.changeMouse( + data.icon, + data.div, + data.translate[0], + data.translate[1], + data.scale[0], + data.scale[1], + data.angel, + data.px, + data.py + ); + core.doAction(); + }); + core.registerEvent("removeMouse", function (data) { + if (!main.replayChecking && !core.isReplaying()) + core.removeMouse(data.div); + core.doAction(); + }); + core.registerEvent("addPop", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + data.value = core.replaceText(data.value); + core.addPop( + data.value, + data.px, + data.py, + data.color, + data.boldColor, + data.left, + data.jump, + data.time, + data.show, + data.font, + data.speed + ); + } + core.doAction(); + }); + core.registerEvent("drawWarning", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + data.text = core.replaceText(data.text); + data.text2 = core.replaceText(data.text2); + core.drawWarning( + data.x, + data.y, + data.size, + data?.text, + data?.text2, + data?.warning + ); + setTimeout(() => core.doAction(), 3100); + } else { + core.doAction(); + } + }); + core.registerEvent("playStereo", function (data) { + if (!main.replayChecking && !core.isReplaying()) + core.playStereo(data.name, data.left, data.right, data.split); + core.doAction(); + }); + core.registerEvent("moveStereo", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + const id = core.playStereo( + data.name, + data.left, + data.right, + data.split + ); + core.moveStereo(id, data.leftTo, data.rightTo, data.time); + } + core.doAction(); + }); + core.registerEvent("over", function (data) { + let image = data.image ?? ""; + let time = data.time ?? 3000; + let sound = data.sound ?? ""; + let textColor = data.textColor ?? "#FFFFFF"; + let boldColor = data.boldColor ?? "#000000"; + let font = data.font ?? "bold 48px Verdana"; + let text = data.text ?? ""; + let hidetime = data.hidetime ?? 100; + if (!main.replayChecking && !core.isReplaying()) { + core.over( + image, + data.memory, + time, + hidetime, + sound, + textColor, + boldColor, + font, + text + ); + } else { + core.doAction(); + } + }); + core.registerEvent("changebg", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.changebg( + data.img1, + data.memory1, + data.img2, + data.memory2, + data.time, + data.style + ); + } else { + core.doAction(); + } + }); + core.registerEvent("overlist", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.overlist( + data.image, + data.memory, + data.hidetime || 30, + data.list || [ + { + text: "", + sound: "", + time: 50, + textColor: "#FFFFFF", + boldColor: "#000000", + font: "bold 48px Verdana", + frame: 0, + }, + ] + ); + } else { + core.doAction(); + } + }); + core.registerEvent("op", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.openvideo(); + } else { + core.doAction(); + } + }); + core.registerEvent("animationDrawable", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.animationDrawable( + data.allFarme, + data.color, + data.globalAlpha, + data.imageList, + data.soundList + ); + } else { + core.doAction(); + } + }); + core.registerEvent("setanimate", function (data) { + data.px = data.px ?? 0; + data.py = data.py ?? 0; + core.setanimate( + data.name, + data.px, + data.py, + data.width, + data.height, + data.allFarme, + data.imageList, + data.soundList + ); + core.doAction(); + }); + core.registerEvent("clearanimate", function (data) { + core.plugin.playing.clear(); - data.px = data.px ?? 0; - data.py = data.py ?? 0; - core.setanimate(data.name, data.px, data.py, data.width, data.height, data.allFarme, data.imageList, data.soundList) - core.doAction(); - - - }); - core.registerEvent("clearanimate", function (data) { - core.plugin.playing.clear() - - core.doAction(); - - - }); - core.registerEvent("deleteanimate", function (data) { - core.deleteanimate(data.name) - core.doAction(); - }); - core.registerEvent("playanimate", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - data.x = data.x ?? 0 - data.y = data.y ?? 0 - data.scalex = data.scalex ?? 1 - data.scaley = data.scaley ?? 1 - core.playanimate(data.name, data.x, data.y, data.hero, data.scalex, data.scaley) - core.doAction(); - } else { - core.doAction(); - } - }); - core.registerEvent("cgtext", function (data) { - if (!main.replayChecking && !core.isReplaying()) { - core.ui.cgText.image = data.bg; - core.ui.cgText.memory = data.memory; - core.ui.cgText.head = core.clone(data.head); - core.ui.cgText.name = data.name; - core.ui.cgText.text = data.text; - core.ui.cgText.time = data.time; - core.ui.cgText.wait = data.wait; - core.ui.cgText.WindowSkin = data.WindowSkin; - core.ui.cgText.sound = data.sound || ""; - core.ui.cgText.bodyList = core.clone(data.bodyList); - main.dom.cgText.style.display = "block"; - core.ui.cgText.update(); - } else { - core.doAction(); - } - }); - }; -}, + core.doAction(); + }); + core.registerEvent("deleteanimate", function (data) { + core.deleteanimate(data.name); + core.doAction(); + }); + core.registerEvent("playanimate", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + data.x = data.x ?? 0; + data.y = data.y ?? 0; + data.scalex = data.scalex ?? 1; + data.scaley = data.scaley ?? 1; + core.playanimate( + data.name, + data.x, + data.y, + data.hero, + data.scalex, + data.scaley + ); + core.doAction(); + } else { + core.doAction(); + } + }); + core.registerEvent("cgtext", function (data) { + if (!main.replayChecking && !core.isReplaying()) { + core.ui.cgText.image = data.bg; + core.ui.cgText.memory = data.memory; + core.ui.cgText.head = core.clone(data.head); + core.ui.cgText.name = data.name; + core.ui.cgText.text = data.text; + core.ui.cgText.time = data.time; + core.ui.cgText.wait = data.wait; + core.ui.cgText.WindowSkin = data.WindowSkin; + core.ui.cgText.sound = data.sound || ""; + core.ui.cgText.bodyList = core.clone(data.bodyList); + main.dom.cgText.style.display = "block"; + core.ui.cgText.update(); + } else { + core.doAction(); + } + }); + }; + }, "drawLight": function () { // 绘制灯光/漆黑层效果。调用方式 core.plugin.drawLight(...) // 【参数说明】 @@ -2471,1208 +2484,1210 @@ 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.musicMode.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"; - if (main.dom.CGUI) { - main.dom.CGUI.style.width = obj.totalWidth + 3 + "px"; - main.dom.CGUI.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.music) { - main.dom.music.style.width = obj.totalWidth + 3 + "px"; - main.dom.music.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.cgText) { - main.dom.cgText.style.width = obj.totalWidth + 3 + "px"; - main.dom.cgText.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.over) { - main.dom.over.style.width = obj.totalWidth + 3 + "px"; - main.dom.over.style.height = obj.totalHeight + 3 + "px"; - } - if (main.dom.video) { - main.dom.video.style.width = obj.totalWidth + 3 + "px"; - main.dom.video.style.height = obj.totalHeight + 3 + "px"; - if (core.domStyle.isVertical) - main.dom.video.style.width = obj.totalHeight + 3 + "px"; - if (core.domStyle.isVertical) - main.dom.video.style.height = obj.totalWidth + 3 + "px"; - main.dom.video.style.top = "50%"; - main.dom.video.style.left = "50%"; + core.dom.playGame.style.fontSize = font + "px"; + core.dom.loadGame.style.fontSize = font + "px"; + core.dom.CGMode.style.fontSize = font + "px"; + core.dom.musicMode.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"; + if (main.dom.CGUI) { + main.dom.CGUI.style.width = obj.totalWidth + 3 + "px"; + main.dom.CGUI.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.music) { + main.dom.music.style.width = obj.totalWidth + 3 + "px"; + main.dom.music.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.cgText) { + main.dom.cgText.style.width = obj.totalWidth + 3 + "px"; + main.dom.cgText.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.over) { + main.dom.over.style.width = obj.totalWidth + 3 + "px"; + main.dom.over.style.height = obj.totalHeight + 3 + "px"; + } + if (main.dom.video) { + main.dom.video.style.width = obj.totalWidth + 3 + "px"; + main.dom.video.style.height = obj.totalHeight + 3 + "px"; + if (core.domStyle.isVertical) + main.dom.video.style.width = obj.totalHeight + 3 + "px"; + if (core.domStyle.isVertical) + main.dom.video.style.height = obj.totalWidth + 3 + "px"; + main.dom.video.style.top = "50%"; + main.dom.video.style.left = "50%"; - main.dom.video.style.transform = "translate(-50%,-50%)"; + main.dom.video.style.transform = "translate(-50%,-50%)"; - if (core.domStyle.isVertical) - main.dom.video.style.transform = "translate(-50%,-50%) rotate(90deg)"; - } - if (main.dom.video1) { - main.dom.video1.style.width = obj.totalWidth + 3 + "px"; - main.dom.video1.style.height = obj.totalHeight + 3 + "px"; - } + if (core.domStyle.isVertical) + main.dom.video.style.transform = "translate(-50%,-50%) rotate(90deg)"; + } + if (main.dom.video1) { + main.dom.video1.style.width = obj.totalWidth + 3 + "px"; + main.dom.video1.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; + 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"); - let now = 0; - core.registerAnimationFrame("lightFloor", true, function (timestamp) { - if (timestamp - now > 1000 / 60) { - now = timestamp; - globalAlphafloor += globalAlphafloorStatus; - if (globalAlphafloor === 100) globalAlphafloorStatus = -2; - if (globalAlphafloor === 0) globalAlphafloorStatus = 2; + 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"); + let now = 0; + core.registerAnimationFrame("lightFloor", true, function (timestamp) { + if (timestamp - now > 1000 / 60) { + now = timestamp; + globalAlphafloor += globalAlphafloorStatus; + if (globalAlphafloor === 100) globalAlphafloorStatus = -2; + if (globalAlphafloor === 0) globalAlphafloorStatus = 2; - if (core.domStyle.isVertical) { - core.clearMap( - uictx, - MAP_BLOCK_LEFT_VERTICAL, - MAP_BLOCK_TOP_VERTICAL, - 340, - 360 - ); - 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 + ); + if (core.status.event.id === "viewMaps") { + core.ui.statusBar._update_map(core.status.event.data.floorId); + } else { + core.ui.statusBar._update_map(); + } - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - MAP_BLOCK_LEFT_VERTICAL + 135, - MAP_BLOCK_TOP_VERTICAL + 170 - ); - uictx.globalAlpha = 1; - } else { - core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); - if (core.status.event.id === "viewMaps") { - core.ui.statusBar._update_map(core.status.event.data.floorId); - } else { - core.ui.statusBar._update_map(); - } - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - MAP_BLOCK_LEFT + 150, - MAP_BLOCK_TOP + 180 - ); - uictx.globalAlpha = 1; - } - } - }); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + MAP_BLOCK_LEFT_VERTICAL + 135, + MAP_BLOCK_TOP_VERTICAL + 170 + ); + uictx.globalAlpha = 1; + } else { + core.clearMap(uictx, MAP_BLOCK_LEFT, MAP_BLOCK_TOP, 340, 360); + if (core.status.event.id === "viewMaps") { + core.ui.statusBar._update_map(core.status.event.data.floorId); + } else { + core.ui.statusBar._update_map(); + } + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + MAP_BLOCK_LEFT + 150, + MAP_BLOCK_TOP + 180 + ); + 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(); - if (main.dom.CGUI && main.dom.CGUI.style.display === "block") - core.ui.CG.update(); - if (main.dom.music && main.dom.music.style.display === "block") - core.ui.music.update(); - if (main.dom.cgText && main.dom.cgText.style.display === "block") - core.ui.cgText.update(); - }; + if (core.status.automaticRoute == null) core.status.automaticRoute = {}; + core.updateStatusBar(); + if (main.dom.CGUI && main.dom.CGUI.style.display === "block") + core.ui.CG.update(); + if (main.dom.music && main.dom.music.style.display === "block") + core.ui.music.update(); + if (main.dom.cgText && main.dom.cgText.style.display === "block") + 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 - ); - this._update_map(); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - 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); - this._update_map(); - uictx.globalAlpha = globalAlphafloor / 100; - core.drawImage( - uictx, - "green.webp", - 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 + ); + this._update_map(); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + 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); + this._update_map(); + uictx.globalAlpha = globalAlphafloor / 100; + core.drawImage( + uictx, + "green.webp", + 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["status.webp"]; //竖屏背景(上) - bgctx.drawImage( - bg, - 0, - 0, - GAMEVIEW_WIDTH_VERTICAL, - BAR_HEIGHT_VERTICAL - ); - const bg2 = core.material.images.images["status.webp"]; //竖屏背景(下) - bgctx.drawImage( - bg2, - 0, - BAR_HEIGHT_VERTICAL + GAMEVIEW_WIDTH_VERTICAL, - GAMEVIEW_WIDTH_VERTICAL, - BAR_HEIGHT_VERTICAL - ); - bgctx.globalAlpha = globalAlpha; - 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["status.webp"]; //竖屏背景(上) + bgctx.drawImage( + bg, + 0, + 0, + GAMEVIEW_WIDTH_VERTICAL, + BAR_HEIGHT_VERTICAL + ); + const bg2 = core.material.images.images["status.webp"]; //竖屏背景(下) + bgctx.drawImage( + bg2, + 0, + BAR_HEIGHT_VERTICAL + GAMEVIEW_WIDTH_VERTICAL, + GAMEVIEW_WIDTH_VERTICAL, + BAR_HEIGHT_VERTICAL + ); + bgctx.globalAlpha = globalAlpha; + 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["status.webp"]; //横屏背景(左) - bgctx.drawImage(bg, 0, 0, BAR_WIDTH, GAMEVIEW_HEIGHT); - const bg2 = core.material.images.images["status.webp"]; //横屏背景(右) - bgctx.drawImage( - bg2, - BAR_WIDTH + GAMEVIEW_HEIGHT, - 0, - BAR_WIDTH, - GAMEVIEW_HEIGHT - ); - bgctx.globalAlpha = globalAlpha; + const bg = core.material.images.images["status.webp"]; //横屏背景(左) + bgctx.drawImage(bg, 0, 0, BAR_WIDTH, GAMEVIEW_HEIGHT); + const bg2 = core.material.images.images["status.webp"]; //横屏背景(右) + bgctx.drawImage( + bg2, + BAR_WIDTH + GAMEVIEW_HEIGHT, + 0, + BAR_WIDTH, + GAMEVIEW_HEIGHT + ); + bgctx.globalAlpha = globalAlpha; - 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 - ); + 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.fillBoldText1( - "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.fillBoldText1( - "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.webp", 0, 0); - } else { - core.clearMap("outerUI", 10 * 3, 40 * 3, 105 * 3, 250 * 3); - core.setFont("outerUI", "bold 48px Verdana"); - if (updatedFloorTitle) { - core.fillBoldText1( - "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.webp", - 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.fillBoldText1( + "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.fillBoldText1( + "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.webp", 0, 0); + } else { + core.clearMap("outerUI", 10 * 3, 40 * 3, 105 * 3, 250 * 3); + core.setFont("outerUI", "bold 48px Verdana"); + if (updatedFloorTitle) { + core.fillBoldText1( + "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.webp", + 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; + _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; - if (!floorId) return; - const info = core.plugin.getMapDrawInfo(floorId, Infinity, true); - core.setTextAlign("outerUI", "center"); + if (!floorId) return; + const info = core.plugin.getMapDrawInfo(floorId, Infinity, true); + core.setTextAlign("outerUI", "center"); - core.plugin.drawSmallMap(uictx, info, floorId, x, y, 300, 300); - } + core.plugin.drawSmallMap(uictx, info, floorId, x, y, 300, 300); + } - _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.webp", - 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.webp", + 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, @@ -5264,15 +5279,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = itemText = core.replaceText(itemText); if (itemText[0] == "," || itemText[0] == ",") itemText = itemText.substring(1); - if (itemCls === 'equips' && item.id) { - let text = "" - - switch (item.id) { //此处写道具效果描述\n表示换行 - case 'sword1': - text = "普通攻击属性:物理\n作为主手时:物理攻击=力量+敏捷(" + (core.getRealStatusOrDefault(hero, 'str') + core.getRealStatusOrDefault(hero, 'agi')) + ")\n作为副手时:物理攻击+敏捷(" + core.getRealStatusOrDefault(hero, 'agi') + ")" - break; - } - itemText = text ? '【装备效果】\n' + text : "" + if (itemCls === "equips" && item.id) { + itemText = itemText ? "【装备效果】\n" + itemText : ""; } /* 一个根据道具id修改道具名字(右栏)的例子 * if (item.id == "xxx") itemNameColor = "red"; @@ -5301,8 +5309,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ); core.setTextAlign(ctx, "left"); core.setTextBaseline(ctx, "middle"); - if (itemCls === 'equips' && item.id) { - itemName = "【" + item.equipCls + "】" + itemName + if (itemCls === "equips" && item.id) { + itemName = "【" + item.equipCls + "】" + itemName; } core.fillText( ctx, @@ -5313,135 +5321,39 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = itemNameFont, itemNameMaxWidth ); - if (!item.equip) core.fillText( - ctx, - "【" + itemClsName + "】", - itemCls_x, - itemCls_middle, - itemClsColor, - itemClsFont - ); + if (!item.equip) + core.fillText( + ctx, + "【" + itemClsName + "】", + itemCls_x, + itemCls_middle, + itemClsColor, + itemClsFont + ); - /*if (core.status.event.id == "equipbox") { + var statusText = ""; + 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)); + var compare2 + if (item.equipCls === "双手剑") compare2 = core.compareEquipment(null, core.getEquip(1)) if (info.select.action == "unload") compare = core.compareEquipment(null, item.id); // --- 变化值... for (var name in core.status.hero) { if (typeof core.status.hero[name] != 'number') continue; var nowValue = core.getRealStatus(name); // 查询新值 - var newValue = Math.floor((core.getStatus(name) + (compare.value[name] || 0)) * - (core.getBuff(name) * 100 + (compare.percentage[name] || 0)) / 100); + var newValue = Math.floor((core.getStatus(name) + (compare.value[name] || 0) + (compare2?.value[name] || 0)) * + (core.getBuff(name) * 100 + (compare.percentage[name] || 0) + (compare2?.percentage[name] || 0)) / 100); if (nowValue == newValue) continue; var color = newValue > nowValue ? '#00FF00' : '#FF0000'; nowValue = core.formatBigNumber(nowValue); newValue = core.formatBigNumber(newValue); statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n"; } - }*/ - const equipValue = core.material.items[item.id]?.equip - if (equipValue) { - let value = "" - for (const a in equipValue.value) { - switch (a) { - case "str": - value += equipValue.value[a] > 0 ? "力量+" + equipValue.value[a] + '\n' : "力量" + equipValue.value[a] + '\n' - break; - case "agi": - value += equipValue.value[a] > 0 ? "敏捷+" + equipValue.value[a] + '\n' : "敏捷" + equipValue.value[a] + '\n' - break; - case "int": - value += equipValue.value[a] > 0 ? "智力+" + equipValue.value[a] + '\n' : "智力" + equipValue.value[a] + '\n' - break; - case "con": - value += equipValue.value[a] > 0 ? "体质+" + equipValue.value[a] + '\n' : "体质" + equipValue.value[a] + '\n' - break; - case "hpmax": - value += equipValue.value[a] > 0 ? "生命上限+" + equipValue.value[a] + '\n' : "生命上限" + equipValue.value[a] + '\n' - break; - case "manamax": - value += equipValue.value[a] > 0 ? "魔力上限+" + equipValue.value[a] + '\n' : "魔力上限" + equipValue.value[a] + '\n' - break; - case "atk": - value += equipValue.value[a] > 0 ? "攻击+" + equipValue.value[a] + '\n' : "攻击" + equipValue.value[a] + '\n' - break; - case "def": - value += equipValue.value[a] > 0 ? "物理防御+" + equipValue.value[a] + '\n' : "物理防御" + equipValue.value[a] + '\n' - break; - case "mdef": - value += equipValue.value[a] > 0 ? "魔法防御+" + equipValue.value[a] + '\n' : "魔法防御" + equipValue.value[a] + '\n' - break; - case "speed": - value += equipValue.value[a] > 0 ? "速度+" + equipValue.value[a] + '\n' : "速度" + equipValue.value[a] + '\n' - break; - - } - } - for (const a in equipValue.percentage) { - switch (a) { - case "str": - value += equipValue.percentage[a] > 0 ? "力量+" + equipValue.percentage[a] + '%\n' : "力量" + equipValue.percentage[a] + '%\n' - break; - case "agi": - value += equipValue.percentage[a] > 0 ? "敏捷+" + equipValue.percentage[a] + '%\n' : "敏捷" + equipValue.percentage[a] + '%\n' - break; - case "int": - value += equipValue.percentage[a] > 0 ? "智力+" + equipValue.percentage[a] + '%\n' : "智力" + equipValue.percentage[a] + '%\n' - break; - case "con": - value += equipValue.percentage[a] > 0 ? "体质+" + equipValue.percentage[a] + '%\n' : "体质" + equipValue.percentage[a] + '%\n' - break; - case "hpmax": - value += equipValue.percentage[a] > 0 ? "生命上限+" + equipValue.percentage[a] + '%\n' : "生命上限" + equipValue.percentage[a] + '%\n' - break; - case "manamax": - value += equipValue.percentage[a] > 0 ? "魔力上限+" + equipValue.percentage[a] + '%\n' : "魔力上限" + equipValue.percentage[a] + '%\n' - break; - case "atk": - value += equipValue.percentage[a] > 0 ? "攻击+" + equipValue.percentage[a] + '%\n' : "攻击" + equipValue.percentage[a] + '%\n' - break; - case "def": - value += equipValue.percentage[a] > 0 ? "物理防御+" + equipValue.percentage[a] + '%\n' : "物理防御" + equipValue.percentage[a] + '%\n' - break; - case "mdef": - value += equipValue.percentage[a] > 0 ? "魔法防御+" + equipValue.percentage[a] + '%\n' : "魔法防御" + equipValue.percentage[a] + '%\n' - break; - case "speed": - value += equipValue.percentage[a] > 0 ? "速度+" + equipValue.percentage[a] + '%\n' : "速度" + equipValue.percentage[a] + '%\n' - break; - - } - } - if (value !== '') itemText += "\n\n【装备属性】\n" + value } - - - - let needText = '\n【装备需求】\n' - - const need = core.plugin.equipNeed[item.id] - if (need) { - for (const a in need) { - switch (a) { - case "str": - needText += "力量【" + need[a] + '】\n' - break; - case "agi": - needText += "敏捷【" + need[a] + '】\n' - break; - case "int": - needText += "智力【" + need[a] + '】\n' - break; - case "con": - needText += "体质【" + need[a] + '】\n' - break; - - } - } - } - itemText = need ? itemText + needText : itemText + itemText = statusText + itemText; if (item.equip) { core.drawTextContent(ctx, itemText, { left: itemText_x, @@ -5450,7 +5362,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = color: "white", align: "left", fontSize: itemTextFontSize, - maxWidth: rightbar_width - (itemText_x - rightbar_x) * 2 + itemTextFontSize / 2, + maxWidth: rightbar_width - + (itemText_x - rightbar_x) * 2 + + itemTextFontSize / 2, }); } else { core.drawTextContent(ctx, itemText, { @@ -5460,7 +5374,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = color: "white", align: "left", fontSize: itemTextFontSize, - maxWidth: rightbar_width - (itemText_x - rightbar_x) * 2 + itemTextFontSize / 2, + maxWidth: rightbar_width - + (itemText_x - rightbar_x) * 2 + + itemTextFontSize / 2, }); } @@ -5535,7 +5451,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = len = toDrawList.length; ///// *** 装备格设置 - var maxItem = 4; + var maxItem = 2; var box_width = 32, box_height = 32, box_borderStyle = "#fff", @@ -5561,8 +5477,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = 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++) { + box_y = equipList_y + space_y + 12; + for (var i = 0; i < 2; i++) { var id = core.getEquip(i), name = toDrawList[i]; if (i === 0) name = "主手"; @@ -5606,28 +5522,92 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.drawLine( ctx, equipList_x + space_x + space_x + oneBoxWidth, - equipList_y + space_y, + equipList_y + space_y + 12, equipList_x + space_x + space_x + oneBoxWidth + box_width + box_borderWidth, - equipList_y + space_y + box_height + equipList_y + space_y + box_height + 12 ); core.drawLine( ctx, equipList_x + space_x + space_x + oneBoxWidth, - equipList_y + space_y + box_height, + equipList_y + space_y + box_height + 12, equipList_x + space_x + space_x + oneBoxWidth + box_width + box_borderWidth, - equipList_y + space_y + equipList_y + space_y + 12 ); } + ///// *** 装备格设置 + var maxItem = 3; + 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 + space_y + oneBoxHeight; + for (var i = 2; i < len; i++) { + var id = core.getEquip(i), + name = toDrawList[i]; + 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; + + } + }; this.drawToolbox = function (ctx) { @@ -5932,103 +5912,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.status.route.push("unEquip:" + 1); }); } - 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); - }); - } - } - if (equipClsid === "护具") { - core.unloadEquip(2, function () { - core.status.route.push("unEquip:" + 2); - }); - } - if (equipClsid === "饰品" && core.getEquip(3) && core.getEquip(4)) { + core.loadEquip(id, function () { + core.status.route.push("equip:" + id); + info.select.type = type; + core.setIndexAndSelect("select"); + core.drawEquipbox(); + }); - core.unloadEquip(4, function () { - core.status.route.push("unEquip:" + 4); - }); - } - - const idneed = core.plugin.equipNeed[id] - let canload = true - if (core.plugin.equipNeed[id]) { - for (const a in idneed) { - if (core.status.hero[a] < idneed[a]) canload = false - } - } - if (canload) { - core.loadEquip(id, function () { - core.status.route.push("equip:" + id); - info.select.type = type; - core.setIndexAndSelect("select"); - core.drawEquipbox(); - }); - } else { - core.drawTip("未达装备需求") - } } else { var type = info.select.type; core.unloadEquip(type, function () { @@ -8794,21 +8684,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "自定义常用事件": function () { - // editorBlocklyconfigPlus.js - // 自訂常見事件模板插件 - // 本插件引用了通用函數插件(Utility.js) - // 適用樣板:2.10.3 - // 請注意: - // 此插件對事件編輯器(editor_blocklyconfig)進行複寫,若還有其它針對事件編輯器做複寫的插件,請謹慎使用! - // 此插件對表格操作行為(editor_mode.doActionList)進行複寫,若還有其它對表格操作行為做複寫的插件,請謹慎使用! - // 使用方法: - // 現在在主頁下拉選單多了個常用事件模版,在那邊可以自由設定常用事件模板。 - // 設定完後按F5刷新,再到事件編輯器看就有你設定好的常用事件模板了。 + // editorBlocklyconfigPlus.js + // 自訂常見事件模板插件 + // 本插件引用了通用函數插件(Utility.js) + // 適用樣板:2.10.3 + // 請注意: + // 此插件對事件編輯器(editor_blocklyconfig)進行複寫,若還有其它針對事件編輯器做複寫的插件,請謹慎使用! + // 此插件對表格操作行為(editor_mode.doActionList)進行複寫,若還有其它對表格操作行為做複寫的插件,請謹慎使用! + // 使用方法: + // 現在在主頁下拉選單多了個常用事件模版,在那邊可以自由設定常用事件模板。 + // 設定完後按F5刷新,再到事件編輯器看就有你設定好的常用事件模板了。 - if (main.mode == "editor") { - //#region 配置表格初始化 - let TableFileName = "project/table/CommonEventTemplate_comment.js"; - let TableRow = ` + if (main.mode == "editor") { + //#region 配置表格初始化 + let TableFileName = "project/table/CommonEventTemplate_comment.js"; + let TableRow = ` var CommonEventTemplate_comment = {"_type": "object", "_data": { "CommonEventTemplate": { @@ -8851,221 +8741,241 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } }} `; - if (!events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate) { - /** - * @type {{[EvnetName:actionParserJson]}} - */ - events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate = { - 检测音乐如果没有开启则系统提示开启: [{ - type: "if", - condition: "!core.musicStatus.bgmStatus", - true: [ - "\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳", - ], - false: [], - }, ], - 仿新新魔塔一次性商人: [{ - type: "if", - condition: "switch:A", - true: [ - "\t[行商,trader]\b[this]这是购买我的道具后我给玩家的提示。", - { - type: "comment", - text: "下一条指令可视情况使用或不使用", - }, - { - type: "hide", - remove: true, - time: 250, - }, - ], - false: [{ - type: "confirm", - text: "我有3把黄钥匙,\n你出50金币就卖给你。", - yes: [{ - type: "if", - condition: "status:money>=50", - true: [{ - type: "setValue", - name: "status:money", - operator: "-=", - value: "50", - }, - { - type: "setValue", - name: "item:yellowKey", - operator: "+=", - value: "3", - }, - { - type: "playSound", - name: "确定", - stop: true, - }, - { - type: "setValue", - name: "switch:A", - value: "true", - }, - ], - false: [{ - type: "playSound", - name: "操作失败", - }, - "\t[行商,trader]\b[this]你的金币不足!", - ], - }, ], - no: [], - }, ], - }, ], - 全地图选中一个点: [{ - type: "comment", - text: "全地图选中一个点,需要用鼠标或触屏操作", - }, - { - type: "setValue", - name: "temp:X", - value: "status:x", - }, - { - type: "setValue", - name: "temp:Y", - value: "status:y", - }, - { - type: "tip", - text: "再次点击闪烁位置确认", - }, - { - type: "while", - condition: "true", - data: [{ - type: "drawSelector", - image: "winskin.webp", - code: 1, - x: "32*temp:X", - y: "32*temp:Y", - width: 32, - height: 32, - }, - { - type: "wait", - }, - { - type: "if", - condition: "(flag:type === 1)", - true: [{ - type: "if", - condition: "((temp:X===flag:x)&&(temp:Y===flag:y))", - true: [{ - type: "break", - n: 1, - }, ], - }, - { - type: "setValue", - name: "temp:X", - value: "flag:x", - }, - { - type: "setValue", - name: "temp:Y", - value: "flag:y", - }, - ], - }, - ], - }, - { - type: "drawSelector", - code: 1, - }, - { - type: "comment", - text: "流程进行到这里可以对[X,Y]点进行处理,比如", - }, - { - type: "closeDoor", - id: "yellowDoor", - loc: ["temp:X", "temp:Y"], - }, - ], - 多阶段Boss战斗: [{ - type: "comment", - text: "多阶段boss,请直接作为战后事件使用", - }, - { - type: "setValue", - name: "switch:A", - operator: "+=", - value: "1", - }, - { - type: "switch", - condition: "switch:A", - caseList: [{ - case: "1", - action: [{ - type: "setBlock", - number: "redSlime", - }, - "\t[2阶段boss,redSlime]\b[this]你以为你已经打败我了吗?没听说过史莱姆有九条命吗?", - ], - }, - { - case: "2", - action: [{ - type: "setBlock", - number: "blackSlime", - }, - "\t[3阶段boss,blackSlime]\b[this]不能消灭我的,只会让我更强大!", - ], - }, - { - case: "3", - action: [{ - type: "setBlock", - number: "slimelord", - }, - "\t[4阶段boss,slimelord]\b[this]我还能打!", - ], - }, - { - case: "4", - action: ["\t[4阶段boss,slimelord]我一定会回来的!"], - }, - ], - }, - ], - }; - } - //#endregion + if (!events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate) { + /** + * @type {{[EvnetName:actionParserJson]}} + */ + events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate = { + 检测音乐如果没有开启则系统提示开启: [ + { + type: "if", + condition: "!core.musicStatus.bgmStatus", + true: [ + "\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳", + ], + false: [], + }, + ], + 仿新新魔塔一次性商人: [ + { + type: "if", + condition: "switch:A", + true: [ + "\t[行商,trader]\b[this]这是购买我的道具后我给玩家的提示。", + { + type: "comment", + text: "下一条指令可视情况使用或不使用", + }, + { + type: "hide", + remove: true, + time: 250, + }, + ], + false: [ + { + type: "confirm", + text: "我有3把黄钥匙,\n你出50金币就卖给你。", + yes: [ + { + type: "if", + condition: "status:money>=50", + true: [ + { + type: "setValue", + name: "status:money", + operator: "-=", + value: "50", + }, + { + type: "setValue", + name: "item:yellowKey", + operator: "+=", + value: "3", + }, + { + type: "playSound", + name: "确定", + stop: true, + }, + { + type: "setValue", + name: "switch:A", + value: "true", + }, + ], + false: [ + { + type: "playSound", + name: "操作失败", + }, + "\t[行商,trader]\b[this]你的金币不足!", + ], + }, + ], + no: [], + }, + ], + }, + ], + 全地图选中一个点: [ + { + type: "comment", + text: "全地图选中一个点,需要用鼠标或触屏操作", + }, + { + type: "setValue", + name: "temp:X", + value: "status:x", + }, + { + type: "setValue", + name: "temp:Y", + value: "status:y", + }, + { + type: "tip", + text: "再次点击闪烁位置确认", + }, + { + type: "while", + condition: "true", + data: [ + { + type: "drawSelector", + image: "winskin.webp", + code: 1, + x: "32*temp:X", + y: "32*temp:Y", + width: 32, + height: 32, + }, + { + type: "wait", + }, + { + type: "if", + condition: "(flag:type === 1)", + true: [ + { + type: "if", + condition: "((temp:X===flag:x)&&(temp:Y===flag:y))", + true: [ + { + type: "break", + n: 1, + }, + ], + }, + { + type: "setValue", + name: "temp:X", + value: "flag:x", + }, + { + type: "setValue", + name: "temp:Y", + value: "flag:y", + }, + ], + }, + ], + }, + { + type: "drawSelector", + code: 1, + }, + { + type: "comment", + text: "流程进行到这里可以对[X,Y]点进行处理,比如", + }, + { + type: "closeDoor", + id: "yellowDoor", + loc: ["temp:X", "temp:Y"], + }, + ], + 多阶段Boss战斗: [ + { + type: "comment", + text: "多阶段boss,请直接作为战后事件使用", + }, + { + type: "setValue", + name: "switch:A", + operator: "+=", + value: "1", + }, + { + type: "switch", + condition: "switch:A", + caseList: [ + { + case: "1", + action: [ + { + type: "setBlock", + number: "redSlime", + }, + "\t[2阶段boss,redSlime]\b[this]你以为你已经打败我了吗?没听说过史莱姆有九条命吗?", + ], + }, + { + case: "2", + action: [ + { + type: "setBlock", + number: "blackSlime", + }, + "\t[3阶段boss,blackSlime]\b[this]不能消灭我的,只会让我更强大!", + ], + }, + { + case: "3", + action: [ + { + type: "setBlock", + number: "slimelord", + }, + "\t[4阶段boss,slimelord]\b[this]我还能打!", + ], + }, + { + case: "4", + action: ["\t[4阶段boss,slimelord]我一定会回来的!"], + }, + ], + }, + ], + }; + } + //#endregion - // 新增模板選項 - let editModeSelect = document.getElementById("editModeSelect"); - let newEditModeOption = document.createElement("option"); - newEditModeOption.value = "CommonEventTemplate"; - newEditModeOption.text = "常見事件模板"; - editModeSelect.add(newEditModeOption); + // 新增模板選項 + let editModeSelect = document.getElementById("editModeSelect"); + let newEditModeOption = document.createElement("option"); + newEditModeOption.value = "CommonEventTemplate"; + newEditModeOption.text = "常見事件模板"; + editModeSelect.add(newEditModeOption); - //檢查可用的編輯模板ID - let leftIDNumber = 11 - 1; - let ExistLeftElement = document.querySelector(".main"); - while (ExistLeftElement) { - leftIDNumber++; - ExistLeftElement = document.getElementById(`left${leftIDNumber}`); - } + //檢查可用的編輯模板ID + let leftIDNumber = 11 - 1; + let ExistLeftElement = document.querySelector(".main"); + while (ExistLeftElement) { + leftIDNumber++; + ExistLeftElement = document.getElementById(`left${leftIDNumber}`); + } - //新增編輯模板 - let MainDiv = document.querySelector(".main"); + //新增編輯模板 + let MainDiv = document.querySelector(".main"); - let CommonEventTemplateMainDiv = document.createElement("div"); - CommonEventTemplateMainDiv.id = `left${leftIDNumber}`; - CommonEventTemplateMainDiv.className = "leftTab"; - CommonEventTemplateMainDiv.style.zIndex = "-1"; - CommonEventTemplateMainDiv.style.opacity = "0"; + let CommonEventTemplateMainDiv = document.createElement("div"); + CommonEventTemplateMainDiv.id = `left${leftIDNumber}`; + CommonEventTemplateMainDiv.className = "leftTab"; + CommonEventTemplateMainDiv.style.zIndex = "-1"; + CommonEventTemplateMainDiv.style.opacity = "0"; - CommonEventTemplateMainDiv.innerHTML = ` + CommonEventTemplateMainDiv.innerHTML = `

常見事件模板   @@ -9088,958 +8998,980 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = `; - MainDiv.appendChild(CommonEventTemplateMainDiv); + MainDiv.appendChild(CommonEventTemplateMainDiv); - (async function () { - //等待編輯器初始化 - while (!editor_mode.ids) { - await Sleep(100); - } - //新增編輯模板ID - editor_mode.ids["CommonEventTemplate"] = `left${leftIDNumber}`; - editor_mode.init_dom_ids(); - //切換至常見事件模板 - editor_mode.CommonEventTemplate = function (callback) { - var objs = []; - editor.file.editCommonEventTemplate([], function (objs_) { - objs = objs_; - //console.log(objs_) - }); - //只查询不修改时,内部实现不是异步的,所以可以这么写 - var tableinfo = editor.table.objToTable(objs[0], objs[1]); - document.getElementById( - "table_298572d8-93dd-4c6e-a278-6a7d49831e3a" - ).innerHTML = tableinfo.HTML; - tableinfo.listen(tableinfo.guids); - if (Boolean(callback)) callback(); - }; + (async function () { + //等待編輯器初始化 + while (!editor_mode.ids) { + await Sleep(100); + } + //新增編輯模板ID + editor_mode.ids["CommonEventTemplate"] = `left${leftIDNumber}`; + editor_mode.init_dom_ids(); + //切換至常見事件模板 + editor_mode.CommonEventTemplate = function (callback) { + var objs = []; + editor.file.editCommonEventTemplate([], function (objs_) { + objs = objs_; + //console.log(objs_) + }); + //只查询不修改时,内部实现不是异步的,所以可以这么写 + var tableinfo = editor.table.objToTable(objs[0], objs[1]); + document.getElementById( + "table_298572d8-93dd-4c6e-a278-6a7d49831e3a" + ).innerHTML = tableinfo.HTML; + tableinfo.listen(tableinfo.guids); + if (Boolean(callback)) callback(); + }; - //檢查配置表格存在 - let TableRowExist = null; - fs.readFile(TableFileName, "base64", function (err, data) { - if (err) { - console.log(`察覺常見事件模板配置表格不存在,原因:${err}`); - console.log("新建一個常見事件模板配置表格。"); - TableRowExist = false; - } else { - TableRowExist = true; - } - }); - //等待配置表格載入完畢(最多0.3秒,超過則視為失敗) - for (let i = 0; i < 3; i++) { - if (TableRowExist == null) { - await Sleep(100); - } - } - //配置表格初始化 - if (TableRowExist != true) { - fs.mkdir("project/table", function (err, data) { - if (err) throw `常見事件模板配置表格目錄初始化失敗,原因:${err}`; - }); - fs.writeFile( - TableFileName, - editor.util.encode64(TableRow || ""), - "base64", - function (err, data) { - if (err) throw `常見事件模板配置表格文件初始化失敗,原因:${err}`; - } - ); - } - //載入配置表格 - //editor.file.loadCommentjs(callback); - (function () { - var key = "CommonEventTemplate_comment"; - var script = document.createElement("script"); - script.src = "project/table/" + key + ".js"; - document.body.appendChild(script); - script.onload = function () { - editor.file[key] = eval(key.replace(".", "_")); - var loaded = Boolean(editor.file[key]); - }; - })(); - //按下配置表格 - editor_multi.CommonEventTemplateEditCommentJs = function (mod) { - editor_multi.lintAutocomplete = true; - editor_multi.setLint(); - editor_multi.importFile(TableFileName); - }; + //檢查配置表格存在 + let TableRowExist = null; + fs.readFile(TableFileName, "base64", function (err, data) { + if (err) { + console.log(`察覺常見事件模板配置表格不存在,原因:${err}`); + console.log("新建一個常見事件模板配置表格。"); + TableRowExist = false; + } else { + TableRowExist = true; + } + }); + //等待配置表格載入完畢(最多0.3秒,超過則視為失敗) + for (let i = 0; i < 3; i++) { + if (TableRowExist == null) { + await Sleep(100); + } + } + //配置表格初始化 + if (TableRowExist != true) { + fs.mkdir("project/table", function (err, data) { + if (err) throw `常見事件模板配置表格目錄初始化失敗,原因:${err}`; + }); + fs.writeFile( + TableFileName, + editor.util.encode64(TableRow || ""), + "base64", + function (err, data) { + if (err) throw `常見事件模板配置表格文件初始化失敗,原因:${err}`; + } + ); + } + //載入配置表格 + //editor.file.loadCommentjs(callback); + (function () { + var key = "CommonEventTemplate_comment"; + var script = document.createElement("script"); + script.src = "project/table/" + key + ".js"; + document.body.appendChild(script); + script.onload = function () { + editor.file[key] = eval(key.replace(".", "_")); + var loaded = Boolean(editor.file[key]); + }; + })(); + //按下配置表格 + editor_multi.CommonEventTemplateEditCommentJs = function (mod) { + editor_multi.lintAutocomplete = true; + editor_multi.setLint(); + editor_multi.importFile(TableFileName); + }; - //定義表格操作行為 - editor_mode.OriginDoActionList = editor_mode.doActionList; - editor_mode.doActionList = function (mode, actionList, callback) { - if (editor_mode.mode == "CommonEventTemplate") { - if (actionList.length == 0) return; - printf("修改中..."); - var cb = function (objs_) { - if (objs_.slice(-1)[0] != null) { - printe(objs_.slice(-1)[0]); - throw objs_.slice(-1)[0]; - } - var str = "修改成功!"; - if ( - data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.name == - "template" - ) - str += "
请注意:全塔属性的name尚未修改,请及时予以设置。"; - printf(str); - if (callback) callback(); - }; - editor.file.editCommonEventTemplate(actionList, cb); - } else { - editor_mode.OriginDoActionList(mode, actionList, callback); - } - }; - //添加表格列 - editor.table.CommonEventTemplateAddFunc = function () { - let obj = events_c12a15a8_c380_4b28_8144_256cba95f760; + //定義表格操作行為 + editor_mode.OriginDoActionList = editor_mode.doActionList; + editor_mode.doActionList = function (mode, actionList, callback) { + if (editor_mode.mode == "CommonEventTemplate") { + if (actionList.length == 0) return; + printf("修改中..."); + var cb = function (objs_) { + if (objs_.slice(-1)[0] != null) { + printe(objs_.slice(-1)[0]); + throw objs_.slice(-1)[0]; + } + var str = "修改成功!"; + if ( + data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.name == + "template" + ) + str += "
请注意:全塔属性的name尚未修改,请及时予以设置。"; + printf(str); + if (callback) callback(); + }; + editor.file.editCommonEventTemplate(actionList, cb); + } else { + editor_mode.OriginDoActionList(mode, actionList, callback); + } + }; + //添加表格列 + editor.table.CommonEventTemplateAddFunc = function () { + let obj = events_c12a15a8_c380_4b28_8144_256cba95f760; - // 1.输入id - let newid = prompt("请输入新项的ID(支持中文)"); - if (newid == null || newid.length == 0) { - return; - } + // 1.输入id + let newid = prompt("请输入新项的ID(支持中文)"); + if (newid == null || newid.length == 0) { + return; + } - // 2.检查id是否符合规范或与已有id重复 - var conflict = true; - var basefield = "".replace(/\[[^\[]*\]$/, ""); + // 2.检查id是否符合规范或与已有id重复 + var conflict = true; + var basefield = "".replace(/\[[^\[]*\]$/, ""); - try { - var baseobj = eval("obj" + basefield); - conflict = newid in baseobj; - } catch (ee) { - // 理论上这里不会发生错误 - printe(ee); - throw ee; - } + try { + var baseobj = eval("obj" + basefield); + conflict = newid in baseobj; + } catch (ee) { + // 理论上这里不会发生错误 + printe(ee); + throw ee; + } - if (conflict) { - printe("id已存在, 请直接修改该项的值"); - return; - } + if (conflict) { + printe("id已存在, 请直接修改该项的值"); + return; + } - // 3.添加 - editor_mode.addAction(["add", basefield + "['" + newid + "']", null]); - editor_mode.onmode("save", function () { - printf("添加成功,刷新后生效;也可以继续新增其他项目。"); - }); //自动保存 删掉此行的话点保存按钮才会保存 - }; - //對表格的存讀 - editor.file.editCommonEventTemplate = function (actionList, callback) { - /*actionList:[ + // 3.添加 + editor_mode.addAction(["add", basefield + "['" + newid + "']", null]); + editor_mode.onmode("save", function () { + printf("添加成功,刷新后生效;也可以继续新增其他项目。"); + }); //自动保存 删掉此行的话点保存按钮才会保存 + }; + //對表格的存讀 + editor.file.editCommonEventTemplate = function (actionList, callback) { + /*actionList:[ ["change","['test']",['123']], ] 为[]时只查询不修改 */ - var data_obj = - events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate; - checkCallback(callback); - if (isset(actionList) && actionList.length > 0) { - actionList.forEach(function (value) { - value[1] = "['CommonEventTemplate']" + value[1]; - }); - editor.file.saveSetting("events", actionList, function (err) { - callback([err]); - }); - } else { - callback([ - Object.assign({}, data_obj), - editor.file.CommonEventTemplate_comment._data.CommonEventTemplate, - null, - ]); - } - }; - })(); + var data_obj = + events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate; + checkCallback(callback); + if (isset(actionList) && actionList.length > 0) { + actionList.forEach(function (value) { + value[1] = "['CommonEventTemplate']" + value[1]; + }); + editor.file.saveSetting("events", actionList, function (err) { + callback([err]); + }); + } else { + callback([ + Object.assign({}, data_obj), + editor.file.CommonEventTemplate_comment._data.CommonEventTemplate, + null, + ]); + } + }; + })(); - //複寫事件編輯器(editor_blocklyconfig) - editor_blocklyconfig = function () { - // start mark sfergsvae + //複寫事件編輯器(editor_blocklyconfig) + editor_blocklyconfig = function () { + // start mark sfergsvae - (function () { - var getCategory = function (name, custom) { - for (var node of document.getElementById("toolbox").children) { - if (node.getAttribute("name") == name) return node; - } - var node = document.createElement("category"); - node.setAttribute("name", name); - if (custom) node.setAttribute("custom", custom); - document.getElementById("toolbox").appendChild(node); - return node; - }; + (function () { + var getCategory = function (name, custom) { + for (var node of document.getElementById("toolbox").children) { + if (node.getAttribute("name") == name) return node; + } + var node = document.createElement("category"); + node.setAttribute("name", name); + if (custom) node.setAttribute("custom", custom); + document.getElementById("toolbox").appendChild(node); + return node; + }; - var toolboxObj = { - 入口方块: [ - '', - MotaActionFunctions.actionParser.parse( - [ - "欢迎使用事件编辑器", - "本事件触发一次后会消失", - { type: "hide", time: 500 }, - ], - "event" - ), - MotaActionFunctions.actionParser.parse({ - condition: "flag:__door__===2", - currentFloor: true, - priority: 0, - delayExecute: false, - multiExecute: false, - data: [{ type: "openDoor", loc: [10, 5] }], - }, - "autoEvent" - ), - MotaActionBlocks["changeFloor_m"].xmlText(), - MotaActionFunctions.actionParser.parse( - [{ - id: "shop1", - text: "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:", - textInList: "1F金币商店", - choices: [{ - text: "生命+800", - need: "status:money>=20+2*flag:shop1", - action: [{ - type: "comment", - text: "新版商店中需要手动扣减金币和增加访问次数", - }, - { - type: "setValue", - name: "status:money", - operator: "-=", - value: "20+2*flag:shop1", - }, - { - type: "setValue", - name: "flag:shop1", - operator: "+=", - value: "1", - }, - { - type: "setValue", - name: "status:hp", - operator: "+=", - value: "800", - }, - ], - }, ], - }, - { - id: "itemShop", - item: true, - textInList: "道具商店", - choices: [{ id: "yellowKey", number: 10, money: 10 }], - }, - { - id: "keyShop1", - textInList: "回收钥匙商店", - commonEvent: "回收钥匙商店", - args: "", - }, - ], - "shop" - ), - MotaActionBlocks["common_m"].xmlText(), - MotaActionBlocks["beforeBattle_m"].xmlText(), - MotaActionBlocks["afterBattle_m"].xmlText(), - MotaActionBlocks["afterGetItem_m"].xmlText(), - MotaActionBlocks["afterOpenDoor_m"].xmlText(), - MotaActionBlocks["firstArrive_m"].xmlText(), - MotaActionBlocks["eachArrive_m"].xmlText(), - MotaActionBlocks["level_m"].xmlText(), - MotaActionFunctions.actionParser.parse( - [ - ["MTx", ""] - ], - "floorPartition" - ), - MotaActionBlocks["commonEvent_m"].xmlText(), - MotaActionBlocks["item_m"].xmlText(), - MotaActionFunctions.actionParser.parse( - [{ - title: "简单", - name: "Easy", - hard: 1, - action: [ - { type: "comment", text: "在这里写该难度需执行的事件" }, - ], - }, ], - "levelChoose" - ), - MotaActionFunctions.actionParser.parse({ - type: 0, - value: { atk: 10 }, - percentage: { speed: 10 }, - }, - "equip" - ), - MotaActionFunctions.actionParser.parse( - [{ - name: "bg.webp", - x: 0, - y: 0, - canvas: "bg", - }, ], - "floorImage" - ), - MotaActionFunctions.actionParser.parse({ - time: 160, - openSound: "door.mp3", - closeSound: "door.mp3", - keys: { yellowKey: 1, orangeKey: 1 }, - }, - "doorInfo" - ), - MotaActionBlocks["faceIds_m"].xmlText(), - MotaActionBlocks["mainStyle_m"].xmlText(), - MotaActionFunctions.actionParser.parse({ - 背景音乐: "bgm.mp3", - 确定: "confirm.mp3", - 攻击: "attack.mp3", - 背景图: "bg.webp", - 领域: "zone", - 文件名: "file.jpg", - }, - "nameMap" - ), - MotaActionFunctions.actionParser.parse( - [{ name: "hero.webp", width: 32, height: 32, prefix: "hero_" }], - "splitImages" - ), - ], - 显示文字: [ - MotaActionBlocks["text_0_s"].xmlText(), - MotaActionBlocks["text_1_s"].xmlText(), - MotaActionFunctions.actionParser.parseList( - "\t[小妖精,fairy]\f[fairy.webp,0,0]欢迎使用事件编辑器(双击方块可直接预览)" - ), - MotaActionBlocks["over_s"].xmlText(), - MotaActionFunctions.actionParser.parseList([{ - type: "overlist", - image: "bg_5043.webp", - memory: false, - hidetime: 30, - list: [{ - text: "", - sound: "", - time: 50, - textColor: "255,255,255,1", - boldColor: "0,0,0,1", - font: "bold 48px Verdana", - frame: 0, - }, ], - }, ]), - MotaActionFunctions.actionParser.parseList([{ - type: "cgtext", - bg: "bg_5043.webp", - memory: false, - WindowSkin: false, - head: { name: "face_050445.webp", px: -300 }, - name: "菲奥奈", - time: 0, - wait: 2000, - sound: "", - text: "这句话显示在对话框内", - bodyList: [ - { name: "tati_050145a.webp", px: 100, filter: false }, - ], - }, ]), - MotaActionBlocks["moveTextBox_s"].xmlText(), - MotaActionBlocks["clearTextBox_s"].xmlText(), - MotaActionBlocks["comment_s"].xmlText(), - MotaActionBlocks["autoText_s"].xmlText(), - MotaActionBlocks["scrollText_s"].xmlText(), - MotaActionBlocks["setText_s"].xmlText(), - MotaActionBlocks["tip_s"].xmlText(), - MotaActionBlocks["addPop_s"].xmlText(), - MotaActionBlocks["confirm_s"].xmlText(), - MotaActionBlocks["choices_s"].xmlText([ - "选择剑或者盾", - "流浪者", - "man", - 0, - "", - MotaActionBlocks["choicesContext"].xmlText([ - "剑", - "", - "", - null, - "", - "", - MotaActionFunctions.actionParser.parseList([ - { type: "openDoor", loc: [3, 3] }, - ]), - ]), - ]), - MotaActionBlocks["win_s"].xmlText(), - MotaActionBlocks["lose_s"].xmlText(), - MotaActionBlocks["restart_s"].xmlText(), - ], - 数据相关: [ - MotaActionBlocks["setValue_s"].xmlText([ - MotaActionBlocks["idIdList_e"].xmlText(["status", "生命"]), - "=", - "", - false, - ]), - MotaActionBlocks["setEnemy_s"].xmlText(), - MotaActionBlocks["setEnemyOnPoint_s"].xmlText(), - MotaActionBlocks["resetEnemyOnPoint_s"].xmlText(), - MotaActionBlocks["moveEnemyOnPoint_s"].xmlText(), - MotaActionBlocks["moveEnemyOnPoint_1_s"].xmlText(), - MotaActionBlocks["setEquip_s"].xmlText(), - MotaActionBlocks["setFloor_s"].xmlText(), - MotaActionBlocks["setGlobalAttribute_s"].xmlText(), - MotaActionBlocks["setGlobalValue_s"].xmlText(), - MotaActionBlocks["setGlobalFlag_s"].xmlText(), - MotaActionBlocks["setNameMap_s"].xmlText(), - MotaActionBlocks["input_s"].xmlText(), - MotaActionBlocks["input2_s"].xmlText(), - MotaActionBlocks["update_s"].xmlText(), - MotaActionBlocks["moveAction_s"].xmlText(), - MotaActionBlocks["changeFloor_s"].xmlText(), - MotaActionBlocks["changePos_s"].xmlText(), - MotaActionBlocks["battle_s"].xmlText(), - MotaActionBlocks["useItem_s"].xmlText(), - MotaActionBlocks["loadEquip_s"].xmlText(), - MotaActionBlocks["unloadEquip_s"].xmlText(), - MotaActionBlocks["openShop_s"].xmlText(), - MotaActionBlocks["disableShop_s"].xmlText(), - MotaActionBlocks["setHeroIcon_s"].xmlText(), - MotaActionBlocks["follow_s"].xmlText(), - MotaActionBlocks["unfollow_s"].xmlText(), - ], - 地图处理: [ - MotaActionBlocks["battle_1_s"].xmlText(), - MotaActionBlocks["openDoor_s"].xmlText(), - MotaActionBlocks["closeDoor_s"].xmlText(), - MotaActionBlocks["show_s"].xmlText(), - MotaActionBlocks["hide_s"].xmlText(), - MotaActionBlocks["setBlock_s"].xmlText(), - MotaActionBlocks["setBlockOpacity_s"].xmlText(), - MotaActionBlocks["setBlockFilter_s"].xmlText(), - MotaActionBlocks["turnBlock_s"].xmlText(), - MotaActionBlocks["moveHero_s"].xmlText(), - MotaActionBlocks["move_s"].xmlText(), - MotaActionBlocks["jumpHero_s"].xmlText(), - MotaActionBlocks["jumpHero_1_s"].xmlText(), - MotaActionBlocks["jump_s"].xmlText(), - MotaActionBlocks["jump_1_s"].xmlText(), - MotaActionBlocks["showBgFgMap_s"].xmlText(), - MotaActionBlocks["hideBgFgMap_s"].xmlText(), - MotaActionBlocks["setBgFgBlock_s"].xmlText(), - MotaActionBlocks["showFloorImg_s"].xmlText(), - MotaActionBlocks["hideFloorImg_s"].xmlText(), - ], - 事件控制: [ - MotaActionBlocks["if_1_s"].xmlText(), - MotaActionBlocks["if_s"].xmlText(), - MotaActionFunctions.actionParser.parseList({ - type: "switch", - condition: "判别值", - caseList: [{ - action: [ - { type: "comment", text: "当判别值是值的场合执行此事件" }, - ], - }, - { - case: "default", - action: [{ - type: "comment", - text: "当没有符合的值的场合执行default事件", - }, ], - }, - ], - }), - MotaActionFunctions.actionParser.parseList({ - type: "for", - name: "temp:A", - from: "0", - to: "12", - step: "1", - data: [], - }), - MotaActionFunctions.actionParser.parseList({ - type: "forEach", - name: "temp:A", - list: ["status:atk", "status:def"], - data: [], - }), - MotaActionBlocks["while_s"].xmlText(), - MotaActionBlocks["dowhile_s"].xmlText(), - MotaActionBlocks["break_s"].xmlText(), - MotaActionBlocks["continue_s"].xmlText(), - MotaActionBlocks["exit_s"].xmlText(), - MotaActionBlocks["trigger_s"].xmlText(), - MotaActionBlocks["insert_1_s"].xmlText(), - MotaActionBlocks["insert_2_s"].xmlText(), - ], - 特效表现: [ - MotaActionBlocks["sleep_s"].xmlText(), - MotaActionBlocks["changebg_s"].xmlText(), - MotaActionFunctions.actionParser.parseList({ - type: "wait", - timeout: 0, - data: [{ - case: "keyboard", - keycode: "13,32", - action: [{ - type: "comment", - text: "当按下回车(keycode=13)或空格(keycode=32)时执行此事件\n超时剩余时间会写入flag:timeout", - }, ], - }, - { - case: "mouse", - px: [0, 32], - py: [0, 32], - action: [{ - type: "comment", - text: "当点击地图左上角时执行此事件\n超时剩余时间会写入flag:timeout", - }, ], - }, - { - case: "condition", - condition: "flag:type==0\n&&flag:keycode==13", - action: [{ - type: "comment", - text: "当满足自定义条件时会执行此事件\n超时剩余时间会写入flag:timeout", - }, ], - }, - { - case: "timeout", - action: [ - { type: "comment", text: "当超时未操作时执行此事件" }, - ], - }, - ], - }), - MotaActionBlocks["waitAsync_s"].xmlText(), - MotaActionBlocks["stopAsync_s"].xmlText(), - MotaActionBlocks["op_s"].xmlText(), - MotaActionBlocks["drawWarning_s"].xmlText(), - MotaActionBlocks["changeMouse_s"].xmlText(), - MotaActionBlocks["removeMouse_s"].xmlText(), - MotaActionBlocks["vibrate_s"].xmlText(), - MotaActionBlocks["setanimate_s"].xmlText(), - MotaActionBlocks["deleteanimate_s"].xmlText(), - MotaActionBlocks["playanimate_s"].xmlText(), - MotaActionBlocks["clearanimate_s"].xmlText(), - MotaActionBlocks["animate_s"].xmlText(), - MotaActionBlocks["animate_1_s"].xmlText(), - MotaActionBlocks["stopAnimate_s"].xmlText(), - MotaActionBlocks["setViewport_s"].xmlText(), - MotaActionBlocks["setViewport_1_s"].xmlText(), - MotaActionBlocks["lockViewport_s"].xmlText(), - MotaActionBlocks["showStatusBar_s"].xmlText(), - MotaActionBlocks["hideStatusBar_s"].xmlText(), - MotaActionBlocks["setHeroOpacity_s"].xmlText(), - MotaActionBlocks["setCurtain_0_s"].xmlText(), - MotaActionBlocks["setCurtain_1_s"].xmlText(), - MotaActionBlocks["screenFlash_s"].xmlText(), - MotaActionBlocks["setWeather_s"].xmlText(), - MotaActionBlocks["callBook_s"].xmlText(), - MotaActionBlocks["callSave_s"].xmlText(), - MotaActionBlocks["autoSave_s"].xmlText(), - MotaActionBlocks["forbidSave_s"].xmlText(), - MotaActionBlocks["callLoad_s"].xmlText(), - ], - 音像处理: [ - MotaActionBlocks["animationDrawable_s"].xmlText(), - MotaActionBlocks["setanimate_s"].xmlText(), - MotaActionBlocks["deleteanimate_s"].xmlText(), - MotaActionBlocks["playanimate_s"].xmlText(), - MotaActionBlocks["clearanimate_s"].xmlText(), - MotaActionBlocks["showImage_s"].xmlText(), - MotaActionBlocks["showImage_1_s"].xmlText(), - MotaActionBlocks["hideImage_s"].xmlText(), - MotaActionBlocks["showTextImage_s"].xmlText(), - MotaActionBlocks["moveImage_s"].xmlText(), - MotaActionBlocks["rotateImage_s"].xmlText(), - MotaActionBlocks["scaleImage_s"].xmlText(), - MotaActionBlocks["showGif_s"].xmlText(), - MotaActionBlocks["playBgm_s"].xmlText(), - MotaActionBlocks["playStereo_s"].xmlText(), - MotaActionBlocks["moveStereo_s"].xmlText(), - MotaActionBlocks["pauseBgm_s"].xmlText(), - MotaActionBlocks["resumeBgm_s"].xmlText(), - MotaActionBlocks["loadBgm_s"].xmlText(), - MotaActionBlocks["freeBgm_s"].xmlText(), - MotaActionBlocks["playSound_s"].xmlText(), - MotaActionBlocks["playSound_1_s"].xmlText(), - MotaActionBlocks["stopSound_s"].xmlText(), - MotaActionBlocks["setVolume_s"].xmlText(), - MotaActionBlocks["setBgmSpeed_s"].xmlText(), - ], - UI绘制: [ - MotaActionBlocks["previewUI_s"].xmlText(), - MotaActionBlocks["clearMap_s"].xmlText(), - MotaActionBlocks["setAttribute_s"].xmlText(), - MotaActionBlocks["setFilter_s"].xmlText(), - MotaActionBlocks["fillText_s"].xmlText(), - MotaActionBlocks["fillBoldText_s"].xmlText(), - MotaActionBlocks["drawTextContent_s"].xmlText(), - MotaActionBlocks["fillRect_s"].xmlText(), - MotaActionBlocks["strokeRect_s"].xmlText(), - MotaActionBlocks["drawLine_s"].xmlText(), - MotaActionBlocks["drawArrow_s"].xmlText(), - MotaActionBlocks["fillPolygon_s"].xmlText(), - MotaActionBlocks["strokePolygon_s"].xmlText(), - MotaActionBlocks["fillEllipse_s"].xmlText(), - MotaActionBlocks["strokeEllipse_s"].xmlText(), - MotaActionBlocks["fillArc_s"].xmlText(), - MotaActionBlocks["strokeArc_s"].xmlText(), - MotaActionBlocks["drawImage_s"].xmlText(), - MotaActionBlocks["drawImage_1_s"].xmlText(), - MotaActionBlocks["drawIcon_s"].xmlText(), - MotaActionBlocks["drawBackground_s"].xmlText(), - MotaActionBlocks["drawSelector_s"].xmlText(), - MotaActionBlocks["drawSelector_1_s"].xmlText(), - ], - 原生脚本: [ - MotaActionBlocks["function_s"].xmlText(), - MotaActionBlocks["unknown_s"].xmlText(), - ], - 值块: [ - MotaActionBlocks["setValue_s"].xmlText([ - MotaActionBlocks["idIdList_e"].xmlText(["status", "生命"]), - "=", - "", - false, - ]), - MotaActionBlocks["expression_arithmetic_0"].xmlText(), - MotaActionBlocks["idFlag_e"].xmlText(), - MotaActionBlocks["idTemp_e"].xmlText(), - MotaActionBlocks["negate_e"].xmlText(), - MotaActionBlocks["unaryOperation_e"].xmlText(), - MotaActionBlocks["bool_e"].xmlText(), - MotaActionBlocks["idString_e"].xmlText(), - MotaActionBlocks["idIdList_e"].xmlText(), - MotaActionBlocks["idFixedList_e"].xmlText(), - MotaActionBlocks["enemyattr_e"].xmlText(), - MotaActionBlocks["blockId_e"].xmlText(), - MotaActionBlocks["blockNumber_e"].xmlText(), - MotaActionBlocks["blockCls_e"].xmlText(), - MotaActionBlocks["hasEquip_e"].xmlText(), - MotaActionBlocks["equip_e"].xmlText(), - MotaActionBlocks["nextXY_e"].xmlText(), - MotaActionBlocks["isReplaying_e"].xmlText(), - MotaActionBlocks["hasVisitedFloor_e"].xmlText(), - MotaActionBlocks["isShopVisited_e"].xmlText(), - MotaActionBlocks["canBattle_e"].xmlText(), - MotaActionBlocks["damage_e"].xmlText(), - MotaActionBlocks["damage_1_e"].xmlText(), - MotaActionBlocks["rand_e"].xmlText(), - MotaActionBlocks["evalString_e"].xmlText(), - ], - 常见事件模板: [ - '', - ], - 最近使用事件: [ - '', - ], - }; - var toolboxgap = ''; - //xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event') - //MotaActionBlocks['idString_e'].xmlText() + var toolboxObj = { + 入口方块: [ + '', + MotaActionFunctions.actionParser.parse( + [ + "欢迎使用事件编辑器", + "本事件触发一次后会消失", + { type: "hide", time: 500 }, + ], + "event" + ), + MotaActionFunctions.actionParser.parse( + { + condition: "flag:__door__===2", + currentFloor: true, + priority: 0, + delayExecute: false, + multiExecute: false, + data: [{ type: "openDoor", loc: [10, 5] }], + }, + "autoEvent" + ), + MotaActionBlocks["changeFloor_m"].xmlText(), + MotaActionFunctions.actionParser.parse( + [ + { + id: "shop1", + text: "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:", + textInList: "1F金币商店", + choices: [ + { + text: "生命+800", + need: "status:money>=20+2*flag:shop1", + action: [ + { + type: "comment", + text: "新版商店中需要手动扣减金币和增加访问次数", + }, + { + type: "setValue", + name: "status:money", + operator: "-=", + value: "20+2*flag:shop1", + }, + { + type: "setValue", + name: "flag:shop1", + operator: "+=", + value: "1", + }, + { + type: "setValue", + name: "status:hp", + operator: "+=", + value: "800", + }, + ], + }, + ], + }, + { + id: "itemShop", + item: true, + textInList: "道具商店", + choices: [{ id: "yellowKey", number: 10, money: 10 }], + }, + { + id: "keyShop1", + textInList: "回收钥匙商店", + commonEvent: "回收钥匙商店", + args: "", + }, + ], + "shop" + ), + MotaActionBlocks["common_m"].xmlText(), + MotaActionBlocks["beforeBattle_m"].xmlText(), + MotaActionBlocks["afterBattle_m"].xmlText(), + MotaActionBlocks["afterGetItem_m"].xmlText(), + MotaActionBlocks["afterOpenDoor_m"].xmlText(), + MotaActionBlocks["firstArrive_m"].xmlText(), + MotaActionBlocks["eachArrive_m"].xmlText(), + MotaActionBlocks["level_m"].xmlText(), + MotaActionFunctions.actionParser.parse( + [["MTx", ""]], + "floorPartition" + ), + MotaActionBlocks["commonEvent_m"].xmlText(), + MotaActionBlocks["item_m"].xmlText(), + MotaActionFunctions.actionParser.parse( + [ + { + title: "简单", + name: "Easy", + hard: 1, + action: [ + { type: "comment", text: "在这里写该难度需执行的事件" }, + ], + }, + ], + "levelChoose" + ), + MotaActionFunctions.actionParser.parse( + { + type: 0, + value: { atk: 10 }, + percentage: { speed: 10 }, + }, + "equip" + ), + MotaActionFunctions.actionParser.parse( + [ + { + name: "bg.webp", + x: 0, + y: 0, + canvas: "bg", + }, + ], + "floorImage" + ), + MotaActionFunctions.actionParser.parse( + { + time: 160, + openSound: "door.mp3", + closeSound: "door.mp3", + keys: { yellowKey: 1, orangeKey: 1 }, + }, + "doorInfo" + ), + MotaActionBlocks["faceIds_m"].xmlText(), + MotaActionBlocks["mainStyle_m"].xmlText(), + MotaActionFunctions.actionParser.parse( + { + 背景音乐: "bgm.mp3", + 确定: "confirm.mp3", + 攻击: "attack.mp3", + 背景图: "bg.webp", + 领域: "zone", + 文件名: "file.jpg", + }, + "nameMap" + ), + MotaActionFunctions.actionParser.parse( + [{ name: "hero.webp", width: 32, height: 32, prefix: "hero_" }], + "splitImages" + ), + ], + 显示文字: [ + MotaActionBlocks["text_0_s"].xmlText(), + MotaActionBlocks["text_1_s"].xmlText(), + MotaActionFunctions.actionParser.parseList( + "\t[小妖精,fairy]\f[fairy.webp,0,0]欢迎使用事件编辑器(双击方块可直接预览)" + ), + MotaActionBlocks["over_s"].xmlText(), + MotaActionFunctions.actionParser.parseList([ + { + type: "overlist", + image: "bg_5043.webp", + memory: false, + hidetime: 30, + list: [ + { + text: "", + sound: "", + time: 50, + textColor: "255,255,255,1", + boldColor: "0,0,0,1", + font: "bold 48px Verdana", + frame: 0, + }, + ], + }, + ]), + MotaActionFunctions.actionParser.parseList([ + { + type: "cgtext", + bg: "bg_5043.webp", + memory: false, + WindowSkin: false, + head: { name: "face_050445.webp", px: -300 }, + name: "菲奥奈", + time: 0, + wait: 2000, + sound: "", + text: "这句话显示在对话框内", + bodyList: [ + { name: "tati_050145a.webp", px: 100, filter: false }, + ], + }, + ]), + MotaActionBlocks["moveTextBox_s"].xmlText(), + MotaActionBlocks["clearTextBox_s"].xmlText(), + MotaActionBlocks["comment_s"].xmlText(), + MotaActionBlocks["autoText_s"].xmlText(), + MotaActionBlocks["scrollText_s"].xmlText(), + MotaActionBlocks["setText_s"].xmlText(), + MotaActionBlocks["tip_s"].xmlText(), + MotaActionBlocks["addPop_s"].xmlText(), + MotaActionBlocks["confirm_s"].xmlText(), + MotaActionBlocks["choices_s"].xmlText([ + "选择剑或者盾", + "流浪者", + "man", + 0, + "", + MotaActionBlocks["choicesContext"].xmlText([ + "剑", + "", + "", + null, + "", + "", + MotaActionFunctions.actionParser.parseList([ + { type: "openDoor", loc: [3, 3] }, + ]), + ]), + ]), + MotaActionBlocks["win_s"].xmlText(), + MotaActionBlocks["lose_s"].xmlText(), + MotaActionBlocks["restart_s"].xmlText(), + ], + 数据相关: [ + MotaActionBlocks["setValue_s"].xmlText([ + MotaActionBlocks["idIdList_e"].xmlText(["status", "生命"]), + "=", + "", + false, + ]), + MotaActionBlocks["setEnemy_s"].xmlText(), + MotaActionBlocks["setEnemyOnPoint_s"].xmlText(), + MotaActionBlocks["resetEnemyOnPoint_s"].xmlText(), + MotaActionBlocks["moveEnemyOnPoint_s"].xmlText(), + MotaActionBlocks["moveEnemyOnPoint_1_s"].xmlText(), + MotaActionBlocks["setEquip_s"].xmlText(), + MotaActionBlocks["setFloor_s"].xmlText(), + MotaActionBlocks["setGlobalAttribute_s"].xmlText(), + MotaActionBlocks["setGlobalValue_s"].xmlText(), + MotaActionBlocks["setGlobalFlag_s"].xmlText(), + MotaActionBlocks["setNameMap_s"].xmlText(), + MotaActionBlocks["input_s"].xmlText(), + MotaActionBlocks["input2_s"].xmlText(), + MotaActionBlocks["update_s"].xmlText(), + MotaActionBlocks["moveAction_s"].xmlText(), + MotaActionBlocks["changeFloor_s"].xmlText(), + MotaActionBlocks["changePos_s"].xmlText(), + MotaActionBlocks["battle_s"].xmlText(), + MotaActionBlocks["useItem_s"].xmlText(), + MotaActionBlocks["loadEquip_s"].xmlText(), + MotaActionBlocks["unloadEquip_s"].xmlText(), + MotaActionBlocks["openShop_s"].xmlText(), + MotaActionBlocks["disableShop_s"].xmlText(), + MotaActionBlocks["setHeroIcon_s"].xmlText(), + MotaActionBlocks["follow_s"].xmlText(), + MotaActionBlocks["unfollow_s"].xmlText(), + ], + 地图处理: [ + MotaActionBlocks["battle_1_s"].xmlText(), + MotaActionBlocks["openDoor_s"].xmlText(), + MotaActionBlocks["closeDoor_s"].xmlText(), + MotaActionBlocks["show_s"].xmlText(), + MotaActionBlocks["hide_s"].xmlText(), + MotaActionBlocks["setBlock_s"].xmlText(), + MotaActionBlocks["setBlockOpacity_s"].xmlText(), + MotaActionBlocks["setBlockFilter_s"].xmlText(), + MotaActionBlocks["turnBlock_s"].xmlText(), + MotaActionBlocks["moveHero_s"].xmlText(), + MotaActionBlocks["move_s"].xmlText(), + MotaActionBlocks["jumpHero_s"].xmlText(), + MotaActionBlocks["jumpHero_1_s"].xmlText(), + MotaActionBlocks["jump_s"].xmlText(), + MotaActionBlocks["jump_1_s"].xmlText(), + MotaActionBlocks["showBgFgMap_s"].xmlText(), + MotaActionBlocks["hideBgFgMap_s"].xmlText(), + MotaActionBlocks["setBgFgBlock_s"].xmlText(), + MotaActionBlocks["showFloorImg_s"].xmlText(), + MotaActionBlocks["hideFloorImg_s"].xmlText(), + ], + 事件控制: [ + MotaActionBlocks["if_1_s"].xmlText(), + MotaActionBlocks["if_s"].xmlText(), + MotaActionFunctions.actionParser.parseList({ + type: "switch", + condition: "判别值", + caseList: [ + { + action: [ + { type: "comment", text: "当判别值是值的场合执行此事件" }, + ], + }, + { + case: "default", + action: [ + { + type: "comment", + text: "当没有符合的值的场合执行default事件", + }, + ], + }, + ], + }), + MotaActionFunctions.actionParser.parseList({ + type: "for", + name: "temp:A", + from: "0", + to: "12", + step: "1", + data: [], + }), + MotaActionFunctions.actionParser.parseList({ + type: "forEach", + name: "temp:A", + list: ["status:atk", "status:def"], + data: [], + }), + MotaActionBlocks["while_s"].xmlText(), + MotaActionBlocks["dowhile_s"].xmlText(), + MotaActionBlocks["break_s"].xmlText(), + MotaActionBlocks["continue_s"].xmlText(), + MotaActionBlocks["exit_s"].xmlText(), + MotaActionBlocks["trigger_s"].xmlText(), + MotaActionBlocks["insert_1_s"].xmlText(), + MotaActionBlocks["insert_2_s"].xmlText(), + ], + 特效表现: [ + MotaActionBlocks["sleep_s"].xmlText(), + MotaActionBlocks["changebg_s"].xmlText(), + MotaActionFunctions.actionParser.parseList({ + type: "wait", + timeout: 0, + data: [ + { + case: "keyboard", + keycode: "13,32", + action: [ + { + type: "comment", + text: "当按下回车(keycode=13)或空格(keycode=32)时执行此事件\n超时剩余时间会写入flag:timeout", + }, + ], + }, + { + case: "mouse", + px: [0, 32], + py: [0, 32], + action: [ + { + type: "comment", + text: "当点击地图左上角时执行此事件\n超时剩余时间会写入flag:timeout", + }, + ], + }, + { + case: "condition", + condition: "flag:type==0\n&&flag:keycode==13", + action: [ + { + type: "comment", + text: "当满足自定义条件时会执行此事件\n超时剩余时间会写入flag:timeout", + }, + ], + }, + { + case: "timeout", + action: [ + { type: "comment", text: "当超时未操作时执行此事件" }, + ], + }, + ], + }), + MotaActionBlocks["waitAsync_s"].xmlText(), + MotaActionBlocks["stopAsync_s"].xmlText(), + MotaActionBlocks["op_s"].xmlText(), + MotaActionBlocks["drawWarning_s"].xmlText(), + MotaActionBlocks["changeMouse_s"].xmlText(), + MotaActionBlocks["removeMouse_s"].xmlText(), + MotaActionBlocks["vibrate_s"].xmlText(), + MotaActionBlocks["setanimate_s"].xmlText(), + MotaActionBlocks["deleteanimate_s"].xmlText(), + MotaActionBlocks["playanimate_s"].xmlText(), + MotaActionBlocks["clearanimate_s"].xmlText(), + MotaActionBlocks["animate_s"].xmlText(), + MotaActionBlocks["animate_1_s"].xmlText(), + MotaActionBlocks["stopAnimate_s"].xmlText(), + MotaActionBlocks["setViewport_s"].xmlText(), + MotaActionBlocks["setViewport_1_s"].xmlText(), + MotaActionBlocks["lockViewport_s"].xmlText(), + MotaActionBlocks["showStatusBar_s"].xmlText(), + MotaActionBlocks["hideStatusBar_s"].xmlText(), + MotaActionBlocks["setHeroOpacity_s"].xmlText(), + MotaActionBlocks["setCurtain_0_s"].xmlText(), + MotaActionBlocks["setCurtain_1_s"].xmlText(), + MotaActionBlocks["screenFlash_s"].xmlText(), + MotaActionBlocks["setWeather_s"].xmlText(), + MotaActionBlocks["callBook_s"].xmlText(), + MotaActionBlocks["callSave_s"].xmlText(), + MotaActionBlocks["autoSave_s"].xmlText(), + MotaActionBlocks["forbidSave_s"].xmlText(), + MotaActionBlocks["callLoad_s"].xmlText(), + ], + 音像处理: [ + MotaActionBlocks["animationDrawable_s"].xmlText(), + MotaActionBlocks["setanimate_s"].xmlText(), + MotaActionBlocks["deleteanimate_s"].xmlText(), + MotaActionBlocks["playanimate_s"].xmlText(), + MotaActionBlocks["clearanimate_s"].xmlText(), + MotaActionBlocks["showImage_s"].xmlText(), + MotaActionBlocks["showImage_1_s"].xmlText(), + MotaActionBlocks["hideImage_s"].xmlText(), + MotaActionBlocks["showTextImage_s"].xmlText(), + MotaActionBlocks["moveImage_s"].xmlText(), + MotaActionBlocks["rotateImage_s"].xmlText(), + MotaActionBlocks["scaleImage_s"].xmlText(), + MotaActionBlocks["showGif_s"].xmlText(), + MotaActionBlocks["playBgm_s"].xmlText(), + MotaActionBlocks["playStereo_s"].xmlText(), + MotaActionBlocks["moveStereo_s"].xmlText(), + MotaActionBlocks["pauseBgm_s"].xmlText(), + MotaActionBlocks["resumeBgm_s"].xmlText(), + MotaActionBlocks["loadBgm_s"].xmlText(), + MotaActionBlocks["freeBgm_s"].xmlText(), + MotaActionBlocks["playSound_s"].xmlText(), + MotaActionBlocks["playSound_1_s"].xmlText(), + MotaActionBlocks["stopSound_s"].xmlText(), + MotaActionBlocks["setVolume_s"].xmlText(), + MotaActionBlocks["setBgmSpeed_s"].xmlText(), + ], + UI绘制: [ + MotaActionBlocks["previewUI_s"].xmlText(), + MotaActionBlocks["clearMap_s"].xmlText(), + MotaActionBlocks["setAttribute_s"].xmlText(), + MotaActionBlocks["setFilter_s"].xmlText(), + MotaActionBlocks["fillText_s"].xmlText(), + MotaActionBlocks["fillBoldText_s"].xmlText(), + MotaActionBlocks["drawTextContent_s"].xmlText(), + MotaActionBlocks["fillRect_s"].xmlText(), + MotaActionBlocks["strokeRect_s"].xmlText(), + MotaActionBlocks["drawLine_s"].xmlText(), + MotaActionBlocks["drawArrow_s"].xmlText(), + MotaActionBlocks["fillPolygon_s"].xmlText(), + MotaActionBlocks["strokePolygon_s"].xmlText(), + MotaActionBlocks["fillEllipse_s"].xmlText(), + MotaActionBlocks["strokeEllipse_s"].xmlText(), + MotaActionBlocks["fillArc_s"].xmlText(), + MotaActionBlocks["strokeArc_s"].xmlText(), + MotaActionBlocks["drawImage_s"].xmlText(), + MotaActionBlocks["drawImage_1_s"].xmlText(), + MotaActionBlocks["drawIcon_s"].xmlText(), + MotaActionBlocks["drawBackground_s"].xmlText(), + MotaActionBlocks["drawSelector_s"].xmlText(), + MotaActionBlocks["drawSelector_1_s"].xmlText(), + ], + 原生脚本: [ + MotaActionBlocks["function_s"].xmlText(), + MotaActionBlocks["unknown_s"].xmlText(), + ], + 值块: [ + MotaActionBlocks["setValue_s"].xmlText([ + MotaActionBlocks["idIdList_e"].xmlText(["status", "生命"]), + "=", + "", + false, + ]), + MotaActionBlocks["expression_arithmetic_0"].xmlText(), + MotaActionBlocks["idFlag_e"].xmlText(), + MotaActionBlocks["idTemp_e"].xmlText(), + MotaActionBlocks["negate_e"].xmlText(), + MotaActionBlocks["unaryOperation_e"].xmlText(), + MotaActionBlocks["bool_e"].xmlText(), + MotaActionBlocks["idString_e"].xmlText(), + MotaActionBlocks["idIdList_e"].xmlText(), + MotaActionBlocks["idFixedList_e"].xmlText(), + MotaActionBlocks["enemyattr_e"].xmlText(), + MotaActionBlocks["blockId_e"].xmlText(), + MotaActionBlocks["blockNumber_e"].xmlText(), + MotaActionBlocks["blockCls_e"].xmlText(), + MotaActionBlocks["hasEquip_e"].xmlText(), + MotaActionBlocks["equip_e"].xmlText(), + MotaActionBlocks["nextXY_e"].xmlText(), + MotaActionBlocks["isReplaying_e"].xmlText(), + MotaActionBlocks["hasVisitedFloor_e"].xmlText(), + MotaActionBlocks["isShopVisited_e"].xmlText(), + MotaActionBlocks["canBattle_e"].xmlText(), + MotaActionBlocks["damage_e"].xmlText(), + MotaActionBlocks["damage_1_e"].xmlText(), + MotaActionBlocks["rand_e"].xmlText(), + MotaActionBlocks["evalString_e"].xmlText(), + ], + 常见事件模板: [ + '', + ], + 最近使用事件: [ + '', + ], + }; + var toolboxgap = ''; + //xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event') + //MotaActionBlocks['idString_e'].xmlText() - //#region 動態常見事件模板 - let CommonEventTemplateHTML = []; + //#region 動態常見事件模板 + let CommonEventTemplateHTML = []; - for (let commonEventName in events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate) { - if ( - events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate.hasOwnProperty( - commonEventName - ) - ) { - let actionParserJson = Array.from( - events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate[ - commonEventName - ] ?? [] - ); + for (let commonEventName in events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate) { + if ( + events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate.hasOwnProperty( + commonEventName + ) + ) { + let actionParserJson = Array.from( + events_c12a15a8_c380_4b28_8144_256cba95f760.CommonEventTemplate[ + commonEventName + ] ?? [] + ); - let labelHTML = ""; - let blockHTML = ""; + let labelHTML = ""; + let blockHTML = ""; - labelHTML = ``; + labelHTML = ``; - if (actionParserJson.length > 1) { - actionParserJson = { - type: "if", - condition: "true", - true: actionParserJson, - }; - } else if (actionParserJson.length < 1) { - actionParserJson = [ - "空的常用事件模板。\n請在主頁下拉菜單中,選擇常用事件模板,進行編輯。\n編輯後需按F5刷新事件編輯器。", - ]; - } - blockHTML = - MotaActionFunctions.actionParser.parseList(actionParserJson); + if (actionParserJson.length > 1) { + actionParserJson = { + type: "if", + condition: "true", + true: actionParserJson, + }; + } else if (actionParserJson.length < 1) { + actionParserJson = [ + "空的常用事件模板。\n請在主頁下拉菜單中,選擇常用事件模板,進行編輯。\n編輯後需按F5刷新事件編輯器。", + ]; + } + blockHTML = + MotaActionFunctions.actionParser.parseList(actionParserJson); - CommonEventTemplateHTML.push(labelHTML); - CommonEventTemplateHTML.push(blockHTML); - } - } + CommonEventTemplateHTML.push(labelHTML); + CommonEventTemplateHTML.push(blockHTML); + } + } - toolboxObj["常见事件模板"] = CommonEventTemplateHTML; - //#endregion + toolboxObj["常见事件模板"] = CommonEventTemplateHTML; + //#endregion - for (var name in toolboxObj) { - var custom = null; - if (name == "最近使用事件") custom = "searchBlockCategory"; - if (name == "入口方块") custom = "entranceCategory"; - getCategory(name, custom).innerHTML = - toolboxObj[name].join(toolboxgap); - } + for (var name in toolboxObj) { + var custom = null; + if (name == "最近使用事件") custom = "searchBlockCategory"; + if (name == "入口方块") custom = "entranceCategory"; + getCategory(name, custom).innerHTML = + toolboxObj[name].join(toolboxgap); + } - var blocklyArea = document.getElementById("blocklyArea"); - var blocklyDiv = document.getElementById("blocklyDiv"); - var workspace = Blockly.inject(blocklyDiv, { - media: "_server/blockly/media/", - toolbox: document.getElementById("toolbox"), - zoom: { - controls: true, - wheel: false, //滚轮改为上下(shift:左右)翻滚 - startScale: 1.0, - maxScale: 3, - minScale: 0.3, - scaleSpeed: 1.08, - }, - trashcan: false, - }); + var blocklyArea = document.getElementById("blocklyArea"); + var blocklyDiv = document.getElementById("blocklyDiv"); + var workspace = Blockly.inject(blocklyDiv, { + media: "_server/blockly/media/", + toolbox: document.getElementById("toolbox"), + zoom: { + controls: true, + wheel: false, //滚轮改为上下(shift:左右)翻滚 + startScale: 1.0, + maxScale: 3, + minScale: 0.3, + scaleSpeed: 1.08, + }, + trashcan: false, + }); - editor_blockly.isCommonEntry = function () { - var commonEntries = [ - "beforeBattle", - "afterBattle", - "afterOpenDoor", - "firstArrive", - "eachArrive", - "commonEvent", - "item", - ]; - return commonEntries.indexOf(editor_blockly.entryType) >= 0; - }; + editor_blockly.isCommonEntry = function () { + var commonEntries = [ + "beforeBattle", + "afterBattle", + "afterOpenDoor", + "firstArrive", + "eachArrive", + "commonEvent", + "item", + ]; + return commonEntries.indexOf(editor_blockly.entryType) >= 0; + }; - editor_blockly.entranceCategoryCallback = function (workspace) { - var list = toolboxObj["入口方块"]; - var xmlList = []; - var eventType = - (editor_blockly.isCommonEntry() ? - "common" : - editor_blockly.entryType) + "_m"; - for (var ii = 0, blockText; - (blockText = list[ii]); ii++) { - if ( - new RegExp('').exec(blockText) - ) { - var block = Blockly.Xml.textToDom( - "" + blockText + "" - ).firstChild; - block.setAttribute("gap", 5); - xmlList.push(block); - } - } - return xmlList; - }; + editor_blockly.entranceCategoryCallback = function (workspace) { + var list = toolboxObj["入口方块"]; + var xmlList = []; + var eventType = + (editor_blockly.isCommonEntry() + ? "common" + : editor_blockly.entryType) + "_m"; + for (var ii = 0, blockText; (blockText = list[ii]); ii++) { + if ( + new RegExp('').exec(blockText) + ) { + var block = Blockly.Xml.textToDom( + "" + blockText + "" + ).firstChild; + block.setAttribute("gap", 5); + xmlList.push(block); + } + } + return xmlList; + }; - workspace.registerToolboxCategoryCallback( - "entranceCategory", - editor_blockly.entranceCategoryCallback - ); + workspace.registerToolboxCategoryCallback( + "entranceCategory", + editor_blockly.entranceCategoryCallback + ); - editor_blockly.searchBlockCategoryCallback = function (workspace) { - var xmlList = []; - var labels = editor_blockly.searchBlock(); - for (var i = 0; i < labels.length; i++) { - var blockText = - "" + MotaActionBlocks[labels[i]].xmlText() + ""; - var block = Blockly.Xml.textToDom(blockText).firstChild; - block.setAttribute("gap", 5); - xmlList.push(block); - } - return xmlList; - }; + editor_blockly.searchBlockCategoryCallback = function (workspace) { + var xmlList = []; + var labels = editor_blockly.searchBlock(); + for (var i = 0; i < labels.length; i++) { + var blockText = + "" + MotaActionBlocks[labels[i]].xmlText() + ""; + var block = Blockly.Xml.textToDom(blockText).firstChild; + block.setAttribute("gap", 5); + xmlList.push(block); + } + return xmlList; + }; - workspace.registerToolboxCategoryCallback( - "searchBlockCategory", - editor_blockly.searchBlockCategoryCallback - ); + workspace.registerToolboxCategoryCallback( + "searchBlockCategory", + editor_blockly.searchBlockCategoryCallback + ); - var onresize = function (e) { - blocklyDiv.style.width = blocklyArea.offsetWidth + "px"; - blocklyDiv.style.height = blocklyArea.offsetHeight + "px"; - Blockly.svgResize(workspace); - }; - if (typeof editor !== "undefined" && !editor.isMobile) - window.addEventListener("resize", onresize, false); - onresize(); - //Blockly.svgResize(workspace); + var onresize = function (e) { + blocklyDiv.style.width = blocklyArea.offsetWidth + "px"; + blocklyDiv.style.height = blocklyArea.offsetHeight + "px"; + Blockly.svgResize(workspace); + }; + if (typeof editor !== "undefined" && !editor.isMobile) + window.addEventListener("resize", onresize, false); + onresize(); + //Blockly.svgResize(workspace); - //Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){}); - document.getElementById("blocklyDiv").onmousewheel = function (e) { - //console.log(e); - e.preventDefault(); - var hvScroll = e.shiftKey ? "hScroll" : "vScroll"; - var mousewheelOffsetValue = - (20 / 380) * workspace.scrollbar[hvScroll].handleLength_ * 3; - workspace.scrollbar[hvScroll].handlePosition_ += - (e.deltaY || 0) + (e.detail || 0) > 0 ? - mousewheelOffsetValue : - -mousewheelOffsetValue; - workspace.scrollbar[hvScroll].onScroll_(); - // workspace.setScale(workspace.scale); - }; + //Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){}); + document.getElementById("blocklyDiv").onmousewheel = function (e) { + //console.log(e); + e.preventDefault(); + var hvScroll = e.shiftKey ? "hScroll" : "vScroll"; + var mousewheelOffsetValue = + (20 / 380) * workspace.scrollbar[hvScroll].handleLength_ * 3; + workspace.scrollbar[hvScroll].handlePosition_ += + (e.deltaY || 0) + (e.detail || 0) > 0 + ? mousewheelOffsetValue + : -mousewheelOffsetValue; + workspace.scrollbar[hvScroll].onScroll_(); + // workspace.setScale(workspace.scale); + }; - var doubleClickCheck = [ - [0, "abc"] - ]; + var doubleClickCheck = [[0, "abc"]]; - function omitedcheckUpdateFunction(event) { - if (event.type === "create") { - editor_blockly.addIntoLastUsedType(event.blockId); - } - if (event.type === "ui" && event.element == "click") { - var newClick = [new Date().getTime(), event.blockId]; - var lastClick = doubleClickCheck.shift(); - doubleClickCheck.push(newClick); - if (newClick[0] - lastClick[0] < 500) { - if (newClick[1] === lastClick[1]) { - editor_blockly.doubleClickBlock(newClick[1]); - } - } - } - // Only handle these events - if (["create", "move", "change", "delete"].indexOf(event.type) < 0) - return; - if (editor_blockly.workspace.topBlocks_.length >= 2) { - editor_blockly.setValue("入口方块只能有一个"); - return; - } - var eventType = editor_blockly.entryType; - if (editor_blockly.workspace.topBlocks_.length == 1) { - var blockType = editor_blockly.workspace.topBlocks_[0].type; - if ( - blockType !== eventType + "_m" && - !(editor_blockly.isCommonEntry() && blockType == "common_m") - ) { - editor_blockly.setValue("入口方块类型错误"); - return; - } - } - try { - var code = Blockly.JavaScript.workspaceToCode(workspace).replace( - /\\(i|c|d|e|g|z)/g, - "\\\\$1" - ); - editor_blockly.setValue(code); - } catch (error) { - editor_blockly.setValue(String(error)); - if (error instanceof OmitedError) { - var blockName = error.blockName; - var varName = error.varName; - var block = error.block; - } - // console.log(error); - } - } + function omitedcheckUpdateFunction(event) { + if (event.type === "create") { + editor_blockly.addIntoLastUsedType(event.blockId); + } + if (event.type === "ui" && event.element == "click") { + var newClick = [new Date().getTime(), event.blockId]; + var lastClick = doubleClickCheck.shift(); + doubleClickCheck.push(newClick); + if (newClick[0] - lastClick[0] < 500) { + if (newClick[1] === lastClick[1]) { + editor_blockly.doubleClickBlock(newClick[1]); + } + } + } + // Only handle these events + if (["create", "move", "change", "delete"].indexOf(event.type) < 0) + return; + if (editor_blockly.workspace.topBlocks_.length >= 2) { + editor_blockly.setValue("入口方块只能有一个"); + return; + } + var eventType = editor_blockly.entryType; + if (editor_blockly.workspace.topBlocks_.length == 1) { + var blockType = editor_blockly.workspace.topBlocks_[0].type; + if ( + blockType !== eventType + "_m" && + !(editor_blockly.isCommonEntry() && blockType == "common_m") + ) { + editor_blockly.setValue("入口方块类型错误"); + return; + } + } + try { + var code = Blockly.JavaScript.workspaceToCode(workspace).replace( + /\\(i|c|d|e|g|z)/g, + "\\\\$1" + ); + editor_blockly.setValue(code); + } catch (error) { + editor_blockly.setValue(String(error)); + if (error instanceof OmitedError) { + var blockName = error.blockName; + var varName = error.varName; + var block = error.block; + } + // console.log(error); + } + } - workspace.addChangeListener(omitedcheckUpdateFunction); + workspace.addChangeListener(omitedcheckUpdateFunction); - workspace.addChangeListener(Blockly.Events.disableOrphans); + workspace.addChangeListener(Blockly.Events.disableOrphans); - editor_blockly.workspace = workspace; + editor_blockly.workspace = workspace; - MotaActionFunctions.workspace = function () { - return editor_blockly.workspace; - }; + MotaActionFunctions.workspace = function () { + return editor_blockly.workspace; + }; - // 因为在editor_blockly.parse里已经HTML转义过一次了,所以这里要覆盖掉以避免在注释中出现<等 - MotaActionFunctions.xmlText = function ( - ruleName, - inputs, - isShadow, - comment, - collapsed, - disabled - ) { - var rule = MotaActionBlocks[ruleName]; - var blocktext = isShadow ? "shadow" : "block"; - var xmlText = []; - xmlText.push( - "<" + - blocktext + - ' type="' + - ruleName + - '"' + - (collapsed ? ' collapsed="true"' : "") + - (disabled ? ' disabled="true"' : "") + - ">" - ); - if (!inputs) inputs = []; - for (var ii = 0, inputType; - (inputType = rule.argsType[ii]); ii++) { - var input = inputs[ii]; - var _input = ""; - var noinput = input === null || input === undefined; - if ( - noinput && - inputType === "field" && - MotaActionBlocks[rule.argsGrammarName[ii]].type !== - "field_dropdown" - ) - continue; - if (noinput && inputType === "field") { - noinput = false; - input = rule.fieldDefault(rule.args[ii]); - } - if (noinput) input = ""; - if ( - inputType === "field" && - MotaActionBlocks[rule.argsGrammarName[ii]].type === - "field_checkbox" - ) - input = input ? "TRUE" : "FALSE"; - if (inputType !== "field") { - var subList = false; - var subrulename = rule.argsGrammarName[ii]; - var subrule = MotaActionBlocks[subrulename]; - if (subrule instanceof Array) { - subrulename = subrule[subrule.length - 1]; - subrule = MotaActionBlocks[subrulename]; - subList = true; - } - _input = subrule.xmlText([], true); - if (noinput && !subList && !isShadow) { - //无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块 - input = subrule.xmlText(); - } - } - xmlText.push("<" + inputType + ' name="' + rule.args[ii] + '">'); - xmlText.push(_input + input); - xmlText.push(""); - } - if (comment) { - xmlText.push(""); - xmlText.push(comment); - xmlText.push(""); - } - var next = inputs[rule.args.length]; - if (next) { - //next - xmlText.push(""); - xmlText.push(next); - xmlText.push(""); - } - xmlText.push(""); - return xmlText.join(""); - }; - })(); + // 因为在editor_blockly.parse里已经HTML转义过一次了,所以这里要覆盖掉以避免在注释中出现<等 + MotaActionFunctions.xmlText = function ( + ruleName, + inputs, + isShadow, + comment, + collapsed, + disabled + ) { + var rule = MotaActionBlocks[ruleName]; + var blocktext = isShadow ? "shadow" : "block"; + var xmlText = []; + xmlText.push( + "<" + + blocktext + + ' type="' + + ruleName + + '"' + + (collapsed ? ' collapsed="true"' : "") + + (disabled ? ' disabled="true"' : "") + + ">" + ); + if (!inputs) inputs = []; + for (var ii = 0, inputType; (inputType = rule.argsType[ii]); ii++) { + var input = inputs[ii]; + var _input = ""; + var noinput = input === null || input === undefined; + if ( + noinput && + inputType === "field" && + MotaActionBlocks[rule.argsGrammarName[ii]].type !== + "field_dropdown" + ) + continue; + if (noinput && inputType === "field") { + noinput = false; + input = rule.fieldDefault(rule.args[ii]); + } + if (noinput) input = ""; + if ( + inputType === "field" && + MotaActionBlocks[rule.argsGrammarName[ii]].type === + "field_checkbox" + ) + input = input ? "TRUE" : "FALSE"; + if (inputType !== "field") { + var subList = false; + var subrulename = rule.argsGrammarName[ii]; + var subrule = MotaActionBlocks[subrulename]; + if (subrule instanceof Array) { + subrulename = subrule[subrule.length - 1]; + subrule = MotaActionBlocks[subrulename]; + subList = true; + } + _input = subrule.xmlText([], true); + if (noinput && !subList && !isShadow) { + //无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块 + input = subrule.xmlText(); + } + } + xmlText.push("<" + inputType + ' name="' + rule.args[ii] + '">'); + xmlText.push(_input + input); + xmlText.push(""); + } + if (comment) { + xmlText.push(""); + xmlText.push(comment); + xmlText.push(""); + } + var next = inputs[rule.args.length]; + if (next) { + //next + xmlText.push(""); + xmlText.push(next); + xmlText.push(""); + } + xmlText.push(""); + return xmlText.join(""); + }; + })(); - // end mark sfergsvae - } - .toString() - .split("// start mark sfergsvae")[1] - .split("// end mark sfergsvae")[0]; - } -}, + // end mark sfergsvae + } + .toString() + .split("// start mark sfergsvae")[1] + .split("// end mark sfergsvae")[0]; + } + }, "夹击激光动画": function () { function createCanvas(name, zIndex) { if (!name) return; @@ -10272,81 +10204,81 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "瞬移轨迹": function () { - // 在此增加新插件 - function popMove() { - var ctx = core.getContextByName("popMove"); - if (!ctx) - ctx = core.createCanvas( - "popMove", - 0, - 0, - core.__PIXELS__, - core.__PIXELS__, - 71 - ); - ctx.canvas.classList.add('gameCanvas', 'anti-aliasing') - core.clearMap(ctx); - if (core.status.replay.speed <= 3 && !flags.stopPop) { - var list = core.status.popMove || []; - var count = 0; - list.forEach(function (one) { - // 由frame计算出dy + // 在此增加新插件 + function popMove() { + var ctx = core.getContextByName("popMove"); + if (!ctx) + ctx = core.createCanvas( + "popMove", + 0, + 0, + core.__PIXELS__, + core.__PIXELS__, + 71 + ); + ctx.canvas.classList.add("gameCanvas", "anti-aliasing"); + core.clearMap(ctx); + if (core.status.replay.speed <= 3 && !flags.stopPop) { + var list = core.status.popMove || []; + var count = 0; + list.forEach(function (one) { + // 由frame计算出dy - one.frame++; - // 绘制 + one.frame++; + // 绘制 - if (one.frame >= 0) core.setAlpha(ctx, 1 - one.frame / 30); - else core.setAlpha(ctx, 1); + if (one.frame >= 0) core.setAlpha(ctx, 1 - one.frame / 30); + else core.setAlpha(ctx, 1); - var length = Math.sqrt( - Math.pow(one.px2 - one.px, 2) + Math.pow(one.py2 - one.py, 2) - ); - //console.log(length) - var li = length / 16; - var lx = (one.px2 - one.px) / li; - var ly = (one.py2 - one.py) / li; - for (var i = 0; i < li; i += 1) { - core.setAlpha(ctx, (1 - one.frame / 30) * ((i / li) * 0.8 + 0.2)); - core.drawLine( - "popMove", - one.px + i * lx, - one.py + i * ly, - one.px + (i + 0.5) * lx, - one.py + (i + 0.5) * ly, - "#E1E1E1", - 6 - ); - if (i == 0) - core.strokeCircle("popMove", one.px, one.py, 6, "#E1E1E1", 3); - } - core.strokeCircle("popMove", one.px2, one.py2, 6, "#E1E1E1", 3); - core.strokeCircle( - "popMove", - one.px2, - one.py2, - 6 + (16 * one.frame) / 30, - "#E1E1E1", - 6 * (1 - one.frame / 30) - ); - //core.drawLine('popMove', one.px, one.py, one.px2, one.py2, '#E1E1E1', 6); + var length = Math.sqrt( + Math.pow(one.px2 - one.px, 2) + Math.pow(one.py2 - one.py, 2) + ); + //console.log(length) + var li = length / 16; + var lx = (one.px2 - one.px) / li; + var ly = (one.py2 - one.py) / li; + for (var i = 0; i < li; i += 1) { + core.setAlpha(ctx, (1 - one.frame / 30) * ((i / li) * 0.8 + 0.2)); + core.drawLine( + "popMove", + one.px + i * lx, + one.py + i * ly, + one.px + (i + 0.5) * lx, + one.py + (i + 0.5) * ly, + "#E1E1E1", + 6 + ); + if (i == 0) + core.strokeCircle("popMove", one.px, one.py, 6, "#E1E1E1", 3); + } + core.strokeCircle("popMove", one.px2, one.py2, 6, "#E1E1E1", 3); + core.strokeCircle( + "popMove", + one.px2, + one.py2, + 6 + (16 * one.frame) / 30, + "#E1E1E1", + 6 * (1 - one.frame / 30) + ); + //core.drawLine('popMove', one.px, one.py, one.px2, one.py2, '#E1E1E1', 6); - if (one.frame >= 30) count++; - }); - if (count > 0) list.splice(0, count); - } - } + if (one.frame >= 30) count++; + }); + if (count > 0) list.splice(0, count); + } + } - if (!main.replayChecking) { - core.registerAnimationFrame("popMove", true, popMove); - } - this.addPopMove = function (px, py, px2, py2, frame) { - var data = { px: px, py: py, px2: px2, py2: py2, frame: frame || 0 }; - if (core.status.replay.speed <= 3) { - if (!core.status.popMove) core.status.popMove = [data]; - else core.status.popMove.push(data); - } - }; -}, + if (!main.replayChecking) { + core.registerAnimationFrame("popMove", true, popMove); + } + this.addPopMove = function (px, py, px2, py2, frame) { + var data = { px: px, py: py, px2: px2, py2: py2, frame: frame || 0 }; + if (core.status.replay.speed <= 3) { + if (!core.status.popMove) core.status.popMove = [data]; + else core.status.popMove.push(data); + } + }; + }, "墓碑(编辑器)": function () { // 在此增加新插件 if (main.mode != "editor") return; // 编辑器模式下使用 @@ -12500,168 +12432,168 @@ 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 - ); - ctx.canvas.classList.add('gameCanvas', 'anti-aliasing') - 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.fillBoldText1( - 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 + ); + ctx.canvas.classList.add("gameCanvas", "anti-aliasing"); + 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.fillBoldText1( + 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 () { - // 在此增加新插件 - // 默认音效名 - var defaultSound = "jingbao.mp3"; - // 默认字体名 - var defaultFont = "Verdana"; + // 在此增加新插件 + // 默认音效名 + var defaultSound = "jingbao.mp3"; + // 默认字体名 + var defaultFont = "Verdana"; - var timeout; - /** warning提示 - * @param {number} x 横坐标 - * @param {number} y 纵坐标 - * @param {string} text 显示的文字 - */ - this.drawWarning = function (x, y, size, text, text2, warning) { - if (timeout) return; - x = x ?? 6; - y = y ?? 6; - text = text || "boss"; - text += "
"; - for (var i = 0; i < 10; i++) text += " "; - text += text2; - // 生成文字 - var elements = document.querySelectorAll(".gameCanvas"); - var t = document.createElement("p"); - t.innerHTML = text; - t.style.position = "absolute"; - t.style.fontSize = size * core.domStyle.scale + "px"; - t.style.left = -(300 * core.domStyle.scale) + "px"; - t.style.top = parseInt(elements[0].style.height) / 2 - 100 + "px"; - t.style.zIndex = "300"; - t.style.color = "#f11"; - t.style.fontFamily = defaultFont; - t.style.overflow = "none"; - t.style.width = "100%"; - t.classList.add("warning"); - core.dom.gameDraw.appendChild(t); - setTimeout(function () { - t.style.left = 416 * core.domStyle.scale + "px"; - }, 50); - // 计算偏移量 - var px = ((6 - x) / 12) * 50; - var py = ((6 - y) / 12) * 50; - // 修改画布的scale和transform - elements.forEach(function (v) { - if (v instanceof HTMLCanvasElement) { - v.style.transform = "scale(2)translate(" + px + "%, " + py + "%)"; - } - }); - if (!warning) core.playSound(defaultSound); - // 拉回镜头 - timeout = setTimeout(function () { - timeout = setTimeout(function () { - timeout = void 0; - core.dom.gameDraw.removeChild(t); - }, 1500); - elements.forEach(function (v) { - if (v instanceof HTMLCanvasElement) { - v.style.transform = "none"; - } - }); - }, 1600); - }; -}, + var timeout; + /** warning提示 + * @param {number} x 横坐标 + * @param {number} y 纵坐标 + * @param {string} text 显示的文字 + */ + this.drawWarning = function (x, y, size, text, text2, warning) { + if (timeout) return; + x = x ?? 6; + y = y ?? 6; + text = text || "boss"; + text += "
"; + for (var i = 0; i < 10; i++) text += " "; + text += text2; + // 生成文字 + var elements = document.querySelectorAll(".gameCanvas"); + var t = document.createElement("p"); + t.innerHTML = text; + t.style.position = "absolute"; + t.style.fontSize = size * core.domStyle.scale + "px"; + t.style.left = -(300 * core.domStyle.scale) + "px"; + t.style.top = parseInt(elements[0].style.height) / 2 - 100 + "px"; + t.style.zIndex = "300"; + t.style.color = "#f11"; + t.style.fontFamily = defaultFont; + t.style.overflow = "none"; + t.style.width = "100%"; + t.classList.add("warning"); + core.dom.gameDraw.appendChild(t); + setTimeout(function () { + t.style.left = 416 * core.domStyle.scale + "px"; + }, 50); + // 计算偏移量 + var px = ((6 - x) / 12) * 50; + var py = ((6 - y) / 12) * 50; + // 修改画布的scale和transform + elements.forEach(function (v) { + if (v instanceof HTMLCanvasElement) { + v.style.transform = "scale(2)translate(" + px + "%, " + py + "%)"; + } + }); + if (!warning) core.playSound(defaultSound); + // 拉回镜头 + timeout = setTimeout(function () { + timeout = setTimeout(function () { + timeout = void 0; + core.dom.gameDraw.removeChild(t); + }, 1500); + elements.forEach(function (v) { + if (v instanceof HTMLCanvasElement) { + v.style.transform = "none"; + } + }); + }, 1600); + }; + }, "立体声音效": function () { // 在此增加新插件 // 音效双声道播放 @@ -12957,536 +12889,534 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "剧情cg": function () { - // 在此增加新插件 - const cg = document.createElement("canvas"); //cg画布设置 - cg.style.position = "absolute"; - cg.style.zIndex = 300; - cg.style.display = "none"; - cg.id = "cgText"; - main.dom.gameGroup.insertAdjacentElement("afterend", cg); - cg.style.top = "50%"; - cg.style.left = "50%"; - cg.style.transform = "translate(-50%,-50%)"; - const ctx = cg.getContext("2d"); - main.dom.cgText = cg; + // 在此增加新插件 + const cg = document.createElement("canvas"); //cg画布设置 + cg.style.position = "absolute"; + cg.style.zIndex = 300; + cg.style.display = "none"; + cg.id = "cgText"; + main.dom.gameGroup.insertAdjacentElement("afterend", cg); + cg.style.top = "50%"; + cg.style.left = "50%"; + cg.style.transform = "translate(-50%,-50%)"; + const ctx = cg.getContext("2d"); + main.dom.cgText = cg; - cg.onmouseup = function (e) { - //鼠标抬起 + cg.onmouseup = function (e) { + //鼠标抬起 - try { - e.stopPropagation(); - if (!core.isPlaying()) return false; - core.unregisterAnimationFrame("skip"); - let a = core.getFlag("skip", false); - core.setFlag("skip", false); - if (a) { - const data = core.clone(core.status.event.data.current); + try { + e.stopPropagation(); + if (!core.isPlaying()) return false; + core.unregisterAnimationFrame("skip"); + let a = core.getFlag("skip", false); + core.setFlag("skip", false); + if (a) { + const data = core.clone(core.status.event.data.current); - core.insertAction(data); - core.doAction(); - } - } catch (ee) { - console.error(ee); - } - }; - cg.onmousedown = function (e) { - //鼠标按下 - try { - e.stopPropagation(); - 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.cgText.click(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - cg.ontouchend = function (e) { - //触摸抬起 + core.insertAction(data); + core.doAction(); + } + } catch (ee) { + console.error(ee); + } + }; + cg.onmousedown = function (e) { + //鼠标按下 + try { + e.stopPropagation(); + 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.cgText.click(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; + cg.ontouchend = function (e) { + //触摸抬起 - try { - e.preventDefault(); - if (!core.isPlaying()) return false; - core.unregisterAnimationFrame("skip"); - core.setFlag("skip", false); - let a = core.getFlag("skip", false); - core.setFlag("skip", false); - if (a) { - const data = core.clone(core.status.event.data.current); + try { + e.preventDefault(); + if (!core.isPlaying()) return false; + core.unregisterAnimationFrame("skip"); + core.setFlag("skip", false); + let a = core.getFlag("skip", false); + core.setFlag("skip", false); + if (a) { + const data = core.clone(core.status.event.data.current); - core.insertAction(data); - core.doAction(); - } - } catch (ee) { - console.error(ee); - } - }; - cg.ontouchstart = 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.targetTouches[0].clientX - left) / core.domStyle.scale - ), - py = Math.floor( - (e.targetTouches[0].clientY - top) / core.domStyle.scale - ); - core.ui.cgText.click(px * 3, py * 3); - } catch (ee) { - main.log(ee); - } - }; - let auto = false; - class cgText { - constructor() { - //绘制需要的变量 - this.image = ""; - this.head = { name: "face_050445.webp", px: -300 }; - this.bodyList = [ - { name: "tati_050145a.webp", px: 100, filter: false }, - { name: "tati_120124.webp", px: 1100, filter: true }, - ]; - this.name = ""; - this.text = ""; - this.time = 0; - this.WindowSkin = false; - this.sound = ""; - this.beforeSound = 0; - this.wait = 200; - this.memory = false; - } - click(px, py) { - //点击效果 + core.insertAction(data); + core.doAction(); + } + } catch (ee) { + console.error(ee); + } + }; + cg.ontouchstart = 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.targetTouches[0].clientX - left) / core.domStyle.scale + ), + py = Math.floor( + (e.targetTouches[0].clientY - top) / core.domStyle.scale + ); + core.ui.cgText.click(px * 3, py * 3); + } catch (ee) { + main.log(ee); + } + }; + let auto = false; + class cgText { + constructor() { + //绘制需要的变量 + this.image = ""; + this.head = { name: "face_050445.webp", px: -300 }; + this.bodyList = [ + { name: "tati_050145a.webp", px: 100, filter: false }, + { name: "tati_120124.webp", px: 1100, filter: true }, + ]; + this.name = ""; + this.text = ""; + this.time = 0; + this.WindowSkin = false; + this.sound = ""; + this.beforeSound = 0; + this.wait = 200; + this.memory = false; + } + click(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 savebox = makeBox([1700, 1100], [192, 96]); - const saveboxVertical = makeBox([52, 1700], [96, 192]); - const skipbox = makeBox([1400, 1100], [192, 96]); - const skipboxVertical = makeBox([52, 1400], [96, 192]); - const autobox = makeBox([1700, 900], [192, 96]); - const autoboxVertical = makeBox([256, 1700], [96, 192]); - if ( - (core.domStyle.isVertical && - inRect(pos, skipboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, skipbox)) - ) { - auto = false; - let time = 0; - core.stopSound(this.beforeSound); - core.registerAnimationFrame("skip", true, (timestamp) => { - if (timestamp > time + 50) { - time = timestamp; - if ( - core.status.event.id == "action" && - core.status.event.data.type == "cgtext" - ) { - core.setFlag("skip", true); - main.dom.cgText.style.display = "none"; - core.doAction(); - } - } - }); - } else if ( - (core.domStyle.isVertical && - inRect(pos, autoboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, autobox)) - ) { - auto = !auto; + 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 savebox = makeBox([1700, 1100], [192, 96]); + const saveboxVertical = makeBox([52, 1700], [96, 192]); + const skipbox = makeBox([1400, 1100], [192, 96]); + const skipboxVertical = makeBox([52, 1400], [96, 192]); + const autobox = makeBox([1700, 900], [192, 96]); + const autoboxVertical = makeBox([256, 1700], [96, 192]); + if ( + (core.domStyle.isVertical && + inRect(pos, skipboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, skipbox)) + ) { + auto = false; + let time = 0; + core.stopSound(this.beforeSound); + core.registerAnimationFrame("skip", true, (timestamp) => { + if (timestamp > time + 50) { + time = timestamp; + if ( + core.status.event.id == "action" && + core.status.event.data.type == "cgtext" + ) { + core.setFlag("skip", true); + main.dom.cgText.style.display = "none"; + core.doAction(); + } + } + }); + } else if ( + (core.domStyle.isVertical && + inRect(pos, autoboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, autobox)) + ) { + auto = !auto; - const data = core.clone(core.status.event.data.current); - data.showAll = true; - data.time = 0; - data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果 - data.sound = ""; - core.insertAction(data); - core.doAction(); - } else if ( - (core.domStyle.isVertical && - inRect(pos, saveboxVertical) && - !this.WindowSkin) || - (!core.domStyle.isVertical && - !this.WindowSkin && - inRect(pos, savebox)) - ) { - //存档 - auto = false; - if (core.status.event.animateUI) return; - if (core.status.event.interval != null) return; - const current = core.clone(core.status.event.data.current); - current.showAll = true; - current.time = 0; - current.sound = ""; - current.text = current.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除当前事件所有打字机效果 - cg.style.display = "none"; - const data = [{ type: "callSave" }, current]; //插入存档事件 - core.insertAction(data); + const data = core.clone(core.status.event.data.current); + data.showAll = true; + data.time = 0; + data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果 + data.sound = ""; + core.insertAction(data); + core.doAction(); + } else if ( + (core.domStyle.isVertical && + inRect(pos, saveboxVertical) && + !this.WindowSkin) || + (!core.domStyle.isVertical && + !this.WindowSkin && + inRect(pos, savebox)) + ) { + //存档 + auto = false; + if (core.status.event.animateUI) return; + if (core.status.event.interval != null) return; + const current = core.clone(core.status.event.data.current); + current.showAll = true; + current.time = 0; + current.sound = ""; + current.text = current.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除当前事件所有打字机效果 + cg.style.display = "none"; + const data = [{ type: "callSave" }, current]; //插入存档事件 + core.insertAction(data); - core.doAction(); - } else if (!core.status.event.data) { - cg.style.display = "none"; - core.ui._animateUI("hide", null, () => { - core.doAction(); - }); - } else { - // 正在淡入淡出的话不执行 - if (core.status.event.animateUI) return; - auto = false; + core.doAction(); + } else if (!core.status.event.data) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } else { + // 正在淡入淡出的话不执行 + if (core.status.event.animateUI) return; + auto = false; - // 打字机效果显示全部文字 - if (core.status.event.interval != null) { - const data = core.clone(core.status.event.data?.current); - data.showAll = true; - data.time = 0; - data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果 - data.sound = ""; - core.insertAction(data); - core.doAction(); - return; - } else { - core.stopSound(this.beforeSound); - } + // 打字机效果显示全部文字 + if (core.status.event.interval != null) { + const data = core.clone(core.status.event.data?.current); + data.showAll = true; + data.time = 0; + data.text = data.text.replace(/(\\(z))(\[.*?])?/g, ""); //去除打字机暂停效果 + data.sound = ""; + core.insertAction(data); + core.doAction(); + return; + } else { + core.stopSound(this.beforeSound); + } - cg.style.display = "none"; - core.ui._animateUI("hide", null, () => { - core.doAction(); - }); - } - } + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + } - drawTextContent(ctx, content, config) { - //绘制多行文字并执行打字机效果 + drawTextContent(ctx, content, config) { + //绘制多行文字并执行打字机效果 - ctx = core.getContextByName(ctx); - // 设置默认配置项 - var textAttribute = - core.status.textAttribute || core.initStatus.textAttribute; - var globalAttribute = - core.status.globalAttribute || core.initStatus.globalAttribute; - config = core.clone(config || {}); - config.left = config.left || 0; - config.right = - config.left + (config.maxWidth == null ? core._PX_ : config.maxWidth); - config.top = config.top || 0; - config.color = core.arrayToRGBA(config.color || textAttribute.text); - if (config.bold == null) config.bold = textAttribute.bold; - config.italic = config.italic || false; - config.align = config.align || textAttribute.align || "left"; - config.fontSize = config.fontSize || textAttribute.textfont; - config.lineHeight = config.lineHeight || config.fontSize * 1.3; - config.defaultFont = config.font = config.font || globalAttribute.font; - config.time = config.time || 0; - config.letterSpacing = - config.letterSpacing == null ? - textAttribute.letterSpacing || 0 : - config.letterSpacing; + ctx = core.getContextByName(ctx); + // 设置默认配置项 + var textAttribute = + core.status.textAttribute || core.initStatus.textAttribute; + var globalAttribute = + core.status.globalAttribute || core.initStatus.globalAttribute; + config = core.clone(config || {}); + config.left = config.left || 0; + config.right = + config.left + (config.maxWidth == null ? core._PX_ : config.maxWidth); + config.top = config.top || 0; + config.color = core.arrayToRGBA(config.color || textAttribute.text); + if (config.bold == null) config.bold = textAttribute.bold; + config.italic = config.italic || false; + config.align = config.align || textAttribute.align || "left"; + config.fontSize = config.fontSize || textAttribute.textfont; + config.lineHeight = config.lineHeight || config.fontSize * 1.3; + config.defaultFont = config.font = config.font || globalAttribute.font; + config.time = config.time || 0; + config.letterSpacing = + config.letterSpacing == null + ? textAttribute.letterSpacing || 0 + : config.letterSpacing; - config.index = 0; - config.currcolor = config.color; - config.currfont = config.fontSize; - config.lineMargin = Math.max( - Math.round(config.fontSize / 4), - config.lineHeight - config.fontSize - ); - config.topMargin = parseInt(config.lineMargin / 2); - config.lineMaxHeight = config.lineMargin + config.fontSize; - config.offsetX = 0; - config.offsetY = 0; - config.line = 0; - config.blocks = []; - config.isHD = ctx == null || ctx.canvas.hasAttribute("isHD"); + config.index = 0; + config.currcolor = config.color; + config.currfont = config.fontSize; + config.lineMargin = Math.max( + Math.round(config.fontSize / 4), + config.lineHeight - config.fontSize + ); + config.topMargin = parseInt(config.lineMargin / 2); + config.lineMaxHeight = config.lineMargin + config.fontSize; + config.offsetX = 0; + config.offsetY = 0; + config.line = 0; + config.blocks = []; + config.isHD = ctx == null || ctx.canvas.hasAttribute("isHD"); - // 创建一个新的临时画布 - var tempCtx = document.createElement("canvas").getContext("2d"); - if (config.isHD && ctx) { - core.maps._setHDCanvasSize( - tempCtx, - ctx.canvas.width, - ctx.canvas.height - ); - } else { - tempCtx.canvas.width = ctx == null ? 1 : ctx.canvas.width; - tempCtx.canvas.height = ctx == null ? 1 : ctx.canvas.height; - } + // 创建一个新的临时画布 + var tempCtx = document.createElement("canvas").getContext("2d"); + if (config.isHD && ctx) { + core.maps._setHDCanvasSize( + tempCtx, + ctx.canvas.width, + ctx.canvas.height + ); + } else { + tempCtx.canvas.width = ctx == null ? 1 : ctx.canvas.width; + tempCtx.canvas.height = ctx == null ? 1 : ctx.canvas.height; + } - tempCtx.textBaseline = "top"; - tempCtx.font = core.ui._buildFont( - config.fontSize, - config.bold, - config.italic, - config.font - ); - tempCtx.fillStyle = config.color; - config = this._drawTextContent_draw(ctx, tempCtx, content, config); - return config; - } - _drawTextContent_draw(ctx, tempCtx, content, config) { - // Step 1: 绘制到tempCtx上,并记录下图块信息 - while (core.ui._drawTextContent_next(tempCtx, content, config)); + tempCtx.textBaseline = "top"; + tempCtx.font = core.ui._buildFont( + config.fontSize, + config.bold, + config.italic, + config.font + ); + tempCtx.fillStyle = config.color; + config = this._drawTextContent_draw(ctx, tempCtx, content, config); + return config; + } + _drawTextContent_draw(ctx, tempCtx, content, config) { + // Step 1: 绘制到tempCtx上,并记录下图块信息 + while (core.ui._drawTextContent_next(tempCtx, content, config)); - if (ctx == null) return config; + if (ctx == null) return config; - // Step 2: 从tempCtx绘制到画布上 - config.index = 0; - var _drawNext = function () { - if (config.index >= config.blocks.length) return false; - var block = config.blocks[config.index++]; - if (block != null) { - // It works, why? - const scale = config.isHD ? - devicePixelRatio * core.domStyle.scale : - 1; - ctx.restore(); - ctx.save(); //保存设置 - if (core.domStyle.isVertical) { - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } - ctx.drawImage( - tempCtx.canvas, - block.left * scale, - block.top * scale, - block.width * scale, - block.height * scale, - config.left + block.left + block.marginLeft, - config.top + block.top + block.marginTop, - block.width, - block.height - ); - ctx.restore(); - } - return true; - }; + // Step 2: 从tempCtx绘制到画布上 + config.index = 0; + var _drawNext = function () { + if (config.index >= config.blocks.length) return false; + var block = config.blocks[config.index++]; + if (block != null) { + // It works, why? + const scale = config.isHD + ? devicePixelRatio * core.domStyle.scale + : 1; + ctx.restore(); + ctx.save(); //保存设置 + if (core.domStyle.isVertical) { + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } + ctx.drawImage( + tempCtx.canvas, + block.left * scale, + block.top * scale, + block.width * scale, + block.height * scale, + config.left + block.left + block.marginLeft, + config.top + block.top + block.marginTop, + block.width, + block.height + ); + ctx.restore(); + } + return true; + }; - if (config.time == 0) { - while (_drawNext()); - if ( - (auto && !this.WindowSkin && !core.ui.cgText.sound) || - (core.ui.cgText.sound && !core.musicStatus.soundStatus) - ) { - setTimeout(() => { - if (auto) { - cg.style.display = "none"; - core.ui._animateUI("hide", null, () => { - core.doAction(); - }); - } - }, core.ui.cgText.wait); - } - } else { - clearInterval(core.status.event.interval); - core.status.event.interval = setInterval(function () { - if (!_drawNext()) { - clearInterval(core.status.event.interval); - core.status.event.interval = null; - if ( - (auto && !this.WindowSkin && !core.ui.cgText.sound) || - (core.ui.cgText.sound && !core.musicStatus.soundStatus) - ) - setTimeout(() => { - if (auto) { - cg.style.display = "none"; - core.ui._animateUI("hide", null, () => { - core.doAction(); - }); - } - }, core.ui.cgText.wait); - } - }, config.time); - } + if (config.time == 0) { + while (_drawNext()); + if ( + (auto && !this.WindowSkin && !core.ui.cgText.sound) || + (core.ui.cgText.sound && !core.musicStatus.soundStatus) + ) { + setTimeout(() => { + if (auto) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + }, core.ui.cgText.wait); + } + } else { + clearInterval(core.status.event.interval); + core.status.event.interval = setInterval(function () { + if (!_drawNext()) { + clearInterval(core.status.event.interval); + core.status.event.interval = null; + if ( + (auto && !this.WindowSkin && !core.ui.cgText.sound) || + (core.ui.cgText.sound && !core.musicStatus.soundStatus) + ) + setTimeout(() => { + if (auto) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + }, core.ui.cgText.wait); + } + }, config.time); + } - return config; - } + return config; + } - update() { - this.background(); - } - background() { - const img = core.material.images.images?.[this.image]; + update() { + this.background(); + } + background() { + const img = core.material.images.images?.[this.image]; - 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; - } + 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; + } - if (img) { - //绘制背景 - if (this.memory) ctx.filter = "sepia(50%)"; - ctx.drawImage(img, 0, 0, 2028, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 2028, 1248); - } - this.bodyList.forEach((v) => { - //绘制立绘 - const body = core.material.images.images?.[v.name]; - if (v.filter) ctx.filter = "brightness(50%)"; - if (body) { - if (!v.w && !v.h && !v.scale) v.scale = 1.7 - if (!v.w && !v.h) { - ctx.drawImage( - body, - 0, - 0, - body.width, - body.height, - v.px, - 1248 - body.height * v.scale, - body.width * v.scale, - body.height * v.scale - ); - } else { - ctx.drawImage( - body, - 0, - 0, - body.width, - body.height, - v.px, - 1248 - (v.h ?? body.height), - v.w ?? body.width, - v.h ?? body.height) - } - } - ctx.filter = "none"; - }); - if (core.isPlaying() && !this.WindowSkin) - core.drawWindowSkin("winskin.webp", ctx, 30, 802, 1968, 416); //绘制对话框 - const head = core.material.images.images?.[this.head.name]; - if (head) { - //绘制头像 - ctx.drawImage( - head, - 0, - 0, - head.width, - head.height, - this.head.px, - 1248 - head.height * 2, - head.width * 2, - head.height * 2 - ); - } - if (core.isPlaying() && !this.WindowSkin) { - core.drawWindowSkin("winskin.webp", ctx, 1700, 1100, 192, 96); - core.fillBoldText1( - ctx, - "存 档", - 1736, - 1166, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - core.drawWindowSkin("winskin.webp", ctx, 1400, 1100, 192, 96); - core.fillBoldText1( - ctx, - "▶▶", - 1456, - 1166, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - core.drawWindowSkin("winskin.webp", ctx, 1700, 900, 192, 96); - let autoText = "AUTO"; - if (auto) autoText = "STOP"; - core.fillBoldText1( - ctx, - autoText, - 1722, - 966, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - } - if (this.name) - core.fillBoldText1( - ctx, - `【${this.name}】`, - 500, - 880, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); //绘制名字 - if ( - this.sound && - core.material.sounds[this.sound] && - !core.getFlag("skip", false) && - core.musicStatus.soundStatus - ) { - this.beforeSound = core.playSound(this.sound, null, () => { - if ( - this.sound && - auto && - !this.WindowSkin && - core.musicStatus.soundStatus - ) { - setTimeout(() => { - if (auto) { - cg.style.display = "none"; - core.ui._animateUI("hide", null, () => { - core.doAction(); - }); - } - }, core.ui.cgText.wait); - } - }); - } - if (this.text && !core.getFlag("skip", false)) { - //绘制对话 - this.drawTextContent(ctx, this.text, { - left: 500, - top: 950, - bold: true, - color: "#FFFFFF", - align: "left", - fontSize: 48, - time: this.time || 0, - font: "Verdana", - maxWidth: 1000, - }); - } + if (img) { + //绘制背景 + if (this.memory) ctx.filter = "sepia(50%)"; + ctx.drawImage(img, 0, 0, 2028, 1248); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 2028, 1248); + } + this.bodyList.forEach((v) => { + //绘制立绘 + const body = core.material.images.images?.[v.name]; + if (v.filter) ctx.filter = "brightness(50%)"; + if (body) { + if (!v.w && !v.h && !v.scale) v.scale = 1.7; + if (!v.w && !v.h) { + ctx.drawImage( + body, + 0, + 0, + body.width, + body.height, + v.px, + 1248 - body.height * v.scale, + body.width * v.scale, + body.height * v.scale + ); + } else { + ctx.drawImage( + body, + 0, + 0, + body.width, + body.height, + v.px, + 1248 - (v.h ?? body.height), + v.w ?? body.width, + v.h ?? body.height + ); + } + } + ctx.filter = "none"; + }); + if (core.isPlaying() && !this.WindowSkin) + core.drawWindowSkin("winskin.webp", ctx, 30, 802, 1968, 416); //绘制对话框 + const head = core.material.images.images?.[this.head.name]; + if (head) { + //绘制头像 + ctx.drawImage( + head, + 0, + 0, + head.width, + head.height, + this.head.px, + 1248 - head.height * 2, + head.width * 2, + head.height * 2 + ); + } + if (core.isPlaying() && !this.WindowSkin) { + core.drawWindowSkin("winskin.webp", ctx, 1700, 1100, 192, 96); + core.fillBoldText1( + ctx, + "存 档", + 1736, + 1166, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + core.drawWindowSkin("winskin.webp", ctx, 1400, 1100, 192, 96); + core.fillBoldText1( + ctx, + "▶▶", + 1456, + 1166, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + core.drawWindowSkin("winskin.webp", ctx, 1700, 900, 192, 96); + let autoText = "AUTO"; + if (auto) autoText = "STOP"; + core.fillBoldText1( + ctx, + autoText, + 1722, + 966, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + } + if (this.name) + core.fillBoldText1( + ctx, + `【${this.name}】`, + 500, + 880, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); //绘制名字 + if ( + this.sound && + core.material.sounds[this.sound] && + !core.getFlag("skip", false) && + core.musicStatus.soundStatus + ) { + this.beforeSound = core.playSound(this.sound, null, () => { + if ( + this.sound && + auto && + !this.WindowSkin && + core.musicStatus.soundStatus + ) { + setTimeout(() => { + if (auto) { + cg.style.display = "none"; + core.ui._animateUI("hide", null, () => { + core.doAction(); + }); + } + }, core.ui.cgText.wait); + } + }); + } + if (this.text && !core.getFlag("skip", false)) { + //绘制对话 + this.drawTextContent(ctx, this.text, { + left: 500, + top: 950, + bold: true, + color: "#FFFFFF", + align: "left", + fontSize: 48, + time: this.time || 0, + font: "Verdana", + maxWidth: 1000, + }); + } - ctx.restore(); - } - } - core.ui.cgText = new cgText(); -}, + ctx.restore(); + } + } + core.ui.cgText = new cgText(); + }, "旁白": function () { // 在此增加新插件 const over = document.createElement("canvas"); //over画布设置 @@ -13977,116 +13907,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } }; }, - "属性映射": function () { - // 在此增加新插件 - this.statusEquip = function (hero = core.status.hero) { - //装备具体效果在这里写,道具填写道具类型为equip并选择装备类型,道具的装备属性中装备类型遵循以下填写方式: - //固定装备孔的填写0/1/2/3,分别对应主手、副手、防具、饰品 - //主副手同时可使用的,填写 武器 - //具体的换装时装备切换操作写在新道具栏/物品栏插件 - //当前仅完善法杖、单手剑、双手剑、匕首、盾牌的多孔切换操作 - //主武器效果 - if (core.getEquip[0]) { - switch (core.getEquip[0]) { - case "sword1": - hero.atk = hero_str + hero_agi; - hero.magic = false; - break; - case "twoHandedSword1": - hero.atk = Math.floor(hero_str * 2 + hero_con / 10); - hero.magic = false; - break; - case "wand1": - hero.atk = hero_str + hero_int; - hero.magic = true; - break; - case "knife1": - hero.atk = Math.floor(hero_agi * 1.2); - hero.speed = hero_agi * 2 + hero_int; - hero.magic = false; - break; - } - } - //副手效果 - if (core.getEquip[1]) { - switch (core.getEquip[1]) { - case "sword1": - hero.atk += hero_agi; - break; - case "knife1": - hero.speed += Math.floor(hero_agi * 0.6); - if (core.getEquip[0] === "knife1") { - hero.atk += Math.floor(hero_agi * 0.6); - } - break; - } - } - //防具效果 - if (core.getEquip[2]) { - switch (core.getEquip[2]) { - case "armor1": - hero.def = hero_con + hero_agi; - hero.hpmax = Math.floor(2.5 * hero_con); - break; - case "armor2": - hero.mdef = hero_con + hero_int; - hero.hpmax = hero_con * 2 + hero_int; - break; - } - } - //饰品效果 - if (core.getEquip[3]) { - switch (core.getEquip[3]) { - case "jewel1": - hero.speed += Math.floor(0.4 * hero_int + 0.6 * hero_agi); - break; - } - } - const list = ['str', 'agi', 'int', 'con'] //四维 - //处理当前装备数值效果(四维数值已经处理过,无需再次处理) - for (let i = 0; i < 5; i++) { - const value = core.material.items[core.getEquip(i)]?.value - if (value) { - for (let item in value) { - if (!list.includes(item)) hero[item] += value[item] - } - } - } - return hero - }; - this.equipNeed = { //装备需求(无需求装备不写,只写需求的属性,无要求属性不写) - "sword1": { str: 10 }, - "knife1": { str: 5, agi: 5 } - - } - this.updateStatus = function () { - let hero = core.status.hero; - //core.getRealStatusOrDefault计算增幅后属性 - const hero_str = core.getRealStatusOrDefault(hero, 'str') - const hero_agi = core.getRealStatusOrDefault(hero, 'agi') - const hero_int = core.getRealStatusOrDefault(hero, 'int') - const hero_con = core.getRealStatusOrDefault(hero, 'con') - - //默认映射关系 - hero.hpmax = hero_str * 100 + hero_con * 100; - hero.atk = hero_str + hero_int; - hero.manamax = hero_agi + hero_int; - hero.def = hero_con + hero_agi; - hero.mdef = hero_con + hero_int; - hero.speed = hero_str + hero_agi; - hero.magic = false; - hero = this.statusEquip(hero); //处理装备效果 - for (let v in hero) { - //归整 - if (typeof hero[v] === "number") { - hero[v] = Math.floor(hero[v]); - } - } - hero.hp = Math.min(hero.hp, hero.hpmax); - hero.mana = Math.min(hero.mana, hero.manamax); - core.status.hero = hero; - }; -}, "回合制boss战": function () { // 在此增加新插件 const boss = document.createElement("canvas"); //boss战画布设置 @@ -14136,311 +13956,311 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.boss = new boss1(); }, "剧情视频引用": function () { - // 在此增加新插件 - let a; - let bgm; + // 在此增加新插件 + let a; + let bgm; - function gtouchstart() { - timeOutEvent = setTimeout(() => { - video.remove(); - video1.remove(); - core.doAction(); - clearTimeout(a); - core.playBgm(bgm); - core.resumeBgm(); - }, 2000); //这里设置定时器,定义长按500毫秒触发长按事件,时间可以自己改,个人感觉500毫秒非常合适 - return false; - } + function gtouchstart() { + timeOutEvent = setTimeout(() => { + video.remove(); + video1.remove(); + core.doAction(); + clearTimeout(a); + core.playBgm(bgm); + core.resumeBgm(); + }, 2000); //这里设置定时器,定义长按500毫秒触发长按事件,时间可以自己改,个人感觉500毫秒非常合适 + return false; + } - //手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件 - function gtouchend() { - if (timeOutEvent != 0) { - //这里写要执行的内容(尤如onclick事件) - console.log("你这是点击,不是长按"); - } - clearTimeout(timeOutEvent); //清除定时器 - return false; - } + //手释放,如果在500毫秒内就释放,则取消长按事件,此时可以执行onclick应该执行的事件 + function gtouchend() { + if (timeOutEvent != 0) { + //这里写要执行的内容(尤如onclick事件) + console.log("你这是点击,不是长按"); + } + clearTimeout(timeOutEvent); //清除定时器 + return false; + } - this.openvideo = function () { - if (!core.isPlaying()) return; - const video = document.createElement("iframe"); //iframe设置 - video.style.position = "absolute"; - video.style.zIndex = 320; - video.style.display = "block"; - video.id = "video"; - main.dom.gameGroup.insertAdjacentElement("afterend", video); - video.style.top = "50%"; - video.style.left = "50%"; - video.style.transform = "translate(-50%,-50%)"; - main.dom.video = video; - const video1 = document.createElement("canvas"); //video1画布设置 - video1.style.position = "absolute"; - video1.style.zIndex = 330; - video1.style.display = "block"; - video1.id = "video1"; - main.dom.gameGroup.insertAdjacentElement("afterend", video1); - video1.style.top = "50%"; - video1.style.left = "50%"; - video1.style.transform = "translate(-50%,-50%)"; - const ctx = video1.getContext("2d"); - main.dom.video1 = video1; - if (core.domStyle.isVertical) { - video.width = 416 * 3; - video.height = 676 * 3; - video.style.transform = "translate(-50%,-50%) rotate(90deg)"; //重新定位右上角为基准 - } else { - video.width = 676 * 3; - video.height = 416 * 3; - video.style.transform = "translate(-50%,-50%)"; - } - video1.ontouchstart = function (e) { - try { - e.preventDefault(); - if (!core.isPlaying()) return false; - gtouchstart(); - } catch (ee) { - main.log(ee); - } - }; - video1.ontouchend = function (e) { - try { - e.preventDefault(); - if (!core.isPlaying()) return false; - gtouchend(); - } catch (ee) { - main.log(ee); - } - }; + this.openvideo = function () { + if (!core.isPlaying()) return; + const video = document.createElement("iframe"); //iframe设置 + video.style.position = "absolute"; + video.style.zIndex = 320; + video.style.display = "block"; + video.id = "video"; + main.dom.gameGroup.insertAdjacentElement("afterend", video); + video.style.top = "50%"; + video.style.left = "50%"; + video.style.transform = "translate(-50%,-50%)"; + main.dom.video = video; + const video1 = document.createElement("canvas"); //video1画布设置 + video1.style.position = "absolute"; + video1.style.zIndex = 330; + video1.style.display = "block"; + video1.id = "video1"; + main.dom.gameGroup.insertAdjacentElement("afterend", video1); + video1.style.top = "50%"; + video1.style.left = "50%"; + video1.style.transform = "translate(-50%,-50%)"; + const ctx = video1.getContext("2d"); + main.dom.video1 = video1; + if (core.domStyle.isVertical) { + video.width = 416 * 3; + video.height = 676 * 3; + video.style.transform = "translate(-50%,-50%) rotate(90deg)"; //重新定位右上角为基准 + } else { + video.width = 676 * 3; + video.height = 416 * 3; + video.style.transform = "translate(-50%,-50%)"; + } + video1.ontouchstart = function (e) { + try { + e.preventDefault(); + if (!core.isPlaying()) return false; + gtouchstart(); + } catch (ee) { + main.log(ee); + } + }; + video1.ontouchend = function (e) { + try { + e.preventDefault(); + if (!core.isPlaying()) return false; + gtouchend(); + } catch (ee) { + main.log(ee); + } + }; - video1.onmouseup = function (e) { - //鼠标抬起 - try { - e.stopPropagation(); - if (!core.isPlaying()) return false; - gtouchend(); - } catch (ee) { - console.error(ee); - } - }; - video1.onmousedown = function (e) { - //鼠标按下 - try { - e.stopPropagation(); - if (!core.isPlaying()) return false; - gtouchstart(); - } catch (ee) { - main.log(ee); - } - }; - let globalAlpha = 0; - let frame = 1; - let al = 0; - core.registerAnimationFrame("beforeop", true, function () { - al++; - core.clearMap(ctx) - ctx.globalAlpha = al / 30; - core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000"); - ctx.globalAlpha = 1; - core.fillBoldText1( - ctx, - "Loading...", - 1014, - 624, - "#FFFFFF", - "#000000", - 6, - "bold 72px Verdana" - ); - }); - core.control.resize(); + video1.onmouseup = function (e) { + //鼠标抬起 + try { + e.stopPropagation(); + if (!core.isPlaying()) return false; + gtouchend(); + } catch (ee) { + console.error(ee); + } + }; + video1.onmousedown = function (e) { + //鼠标按下 + try { + e.stopPropagation(); + if (!core.isPlaying()) return false; + gtouchstart(); + } catch (ee) { + main.log(ee); + } + }; + let globalAlpha = 0; + let frame = 1; + let al = 0; + core.registerAnimationFrame("beforeop", true, function () { + al++; + core.clearMap(ctx); + ctx.globalAlpha = al / 30; + core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000"); + ctx.globalAlpha = 1; + core.fillBoldText1( + ctx, + "Loading...", + 1014, + 624, + "#FFFFFF", + "#000000", + 6, + "bold 72px Verdana" + ); + }); + core.control.resize(); - //player.bilibili.com/player.html - //www.bilibili.com/blackboard/html5mobileplayer.html - // - video.src = - "///www.bilibili.com/blackboard/html5mobileplayer.html?isOutside=true&aid=6484104&bvid=BV1cs411b7cH&cid=10546155&p=1&poster=0&autoplay=1&high_quality=1&muted=0&danmaku=0"; - video.scrolling = "no"; - video.border = "0"; - video.crossorigin = true; - video.frameborder = "no"; - video.framespacing = "0"; - video.allowfullscreen = false; + //player.bilibili.com/player.html + //www.bilibili.com/blackboard/html5mobileplayer.html + // + video.src = + "///www.bilibili.com/blackboard/html5mobileplayer.html?isOutside=true&aid=6484104&bvid=BV1cs411b7cH&cid=10546155&p=1&poster=0&autoplay=1&high_quality=1&muted=0&danmaku=0"; + video.scrolling = "no"; + video.border = "0"; + video.crossorigin = true; + video.frameborder = "no"; + video.framespacing = "0"; + video.allowfullscreen = false; - video.sandbox = - "allow-top-navigation allow-same-origin allow-forms allow-scripts"; - //gsl_play_mask + video.sandbox = + "allow-top-navigation allow-same-origin allow-forms allow-scripts"; + //gsl_play_mask - video.addEventListener("load", function () { - core.unregisterAnimationFrame("beforeop"); - core.registerAnimationFrame("op", true, function () { - 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; - core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000"); + video.addEventListener("load", function () { + core.unregisterAnimationFrame("beforeop"); + core.registerAnimationFrame("op", true, function () { + 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; + core.fillRect(ctx, 0, 0, video1.width, video1.height, "#000000"); - ctx.globalAlpha = globalAlpha / 30; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - "长按2秒后跳过op", - 1014, - 624, - "#FFFFFF", - "#000000", - 6, - "bold 48px Verdana" - ); - globalAlpha += frame; - if (globalAlpha > 29) frame = -1; - ctx.restore(); - if (frame === -1 && globalAlpha < 0) { - core.clearMap(ctx); - core.unregisterAnimationFrame("op"); - } - }); - bgm = core.musicStatus.playingBgm; - core.playBgm("op.mp3"); - a = setTimeout(() => { - video.remove(); - video1.remove(); - core.playBgm(bgm); - core.doAction(); - }, 127500); - }); - }; -}, + ctx.globalAlpha = globalAlpha / 30; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + "长按2秒后跳过op", + 1014, + 624, + "#FFFFFF", + "#000000", + 6, + "bold 48px Verdana" + ); + globalAlpha += frame; + if (globalAlpha > 29) frame = -1; + ctx.restore(); + if (frame === -1 && globalAlpha < 0) { + core.clearMap(ctx); + core.unregisterAnimationFrame("op"); + } + }); + bgm = core.musicStatus.playingBgm; + core.playBgm("op.mp3"); + a = setTimeout(() => { + video.remove(); + video1.remove(); + core.playBgm(bgm); + core.doAction(); + }, 127500); + }); + }; + }, "帧动画/图片叠拼": function () { - // 在此增加新插件 - this.animationDrawable = function ( - allFarme, - color, - globalAlpha, - imageList, - soundList - ) { - if (!core.isPlaying()) { - return core.doAction(); - } - const over = main.dom.over; - const ctx = over.getContext("2d"); - over.style.display = "block"; + // 在此增加新插件 + this.animationDrawable = function ( + allFarme, + color, + globalAlpha, + imageList, + soundList + ) { + if (!core.isPlaying()) { + return core.doAction(); + } + const over = main.dom.over; + const ctx = over.getContext("2d"); + over.style.display = "block"; - let farme = 0; - let now = 0; - core.registerAnimationFrame( - "animationDrawable", - true, - function (timestamp) { - if (timestamp - now > 1000 / 60) { - now = timestamp; - if (core.domStyle.isVertical) { - over.width = 1248; - over.height = 2028; - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - over.width = 2028; - over.height = 1248; - } + let farme = 0; + let now = 0; + core.registerAnimationFrame( + "animationDrawable", + true, + function (timestamp) { + if (timestamp - now > 1000 / 60) { + now = timestamp; + if (core.domStyle.isVertical) { + over.width = 1248; + over.height = 2028; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + over.width = 2028; + over.height = 1248; + } - ctx.globalAlpha = (globalAlpha ?? 100) / 100; - core.fillRect(ctx, 0, 0, 2028, 1248, color); + ctx.globalAlpha = (globalAlpha ?? 100) / 100; + core.fillRect(ctx, 0, 0, 2028, 1248, color); - imageList.forEach(function (one) { - if ( - farme >= (one.beforefarme ?? 0) && - farme <= (one.afterfarme ?? allFarme) - ) { - const img = core.material.images.images?.[one.image]; - if (img) { - const gla = one.globalAlpha ?? 100; - const agla = one.aglobalAlpha ?? gla, - beforefarme = one.beforefarme ?? 0; - const afterfarme = one.afterfarme ?? allFarme; + imageList.forEach(function (one) { + if ( + farme >= (one.beforefarme ?? 0) && + farme <= (one.afterfarme ?? allFarme) + ) { + const img = core.material.images.images?.[one.image]; + if (img) { + const gla = one.globalAlpha ?? 100; + const agla = one.aglobalAlpha ?? gla, + beforefarme = one.beforefarme ?? 0; + const afterfarme = one.afterfarme ?? allFarme; - ctx.globalAlpha = - (gla + - ((agla - gla) * (farme - beforefarme)) / - (afterfarme - beforefarme || 1)) / - 100; + ctx.globalAlpha = + (gla + + ((agla - gla) * (farme - beforefarme)) / + (afterfarme - beforefarme || 1)) / + 100; - const cx = - (one.cx ?? 0) + - (((one.acx ?? 0) - (one.cx ?? 0)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - cy = - (one.cy ?? 0) + - (((one.acy ?? 0) - (one.cy ?? 0)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - cw = - (one.cw ?? img.width) + - (((one.acw ?? img.width) - (one.cw ?? img.width)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - ch = - (one.ch ?? img.height) + - (((one.acw ?? img.height) - (one.cw ?? img.height)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - x = - (one.x ?? 0) + - (((one.ax ?? 0) - (one.x ?? 0)) * (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - y = - (one.y ?? 0) + - (((one.ay ?? 0) - (one.y ?? 0)) * (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - w = - (one.w ?? 2028) + - (((one.aw ?? 2028) - (one.w ?? 2028)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1), - h = - (one.h ?? 1248) + - (((one.aw ?? 1248) - (one.w ?? 1248)) * - (farme - beforefarme)) / - (afterfarme - beforefarme || 1); - ctx.drawImage(img, cx, cy, cw, ch, x, y, w, h); - } - } - }); - soundList.forEach(function (one) { - const lisen = - one.sound && - core.material.sounds[one.sound] && - core.musicStatus.soundStatus; - if (farme == one.startfarme && lisen) { - if (one.stopbefore) core.stopSound(); - core.playSound(one.sound); - } - }); - farme++; - ctx.globalAlpha = 1; - ctx.restore(); + const cx = + (one.cx ?? 0) + + (((one.acx ?? 0) - (one.cx ?? 0)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + cy = + (one.cy ?? 0) + + (((one.acy ?? 0) - (one.cy ?? 0)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + cw = + (one.cw ?? img.width) + + (((one.acw ?? img.width) - (one.cw ?? img.width)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + ch = + (one.ch ?? img.height) + + (((one.acw ?? img.height) - (one.cw ?? img.height)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + x = + (one.x ?? 0) + + (((one.ax ?? 0) - (one.x ?? 0)) * (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + y = + (one.y ?? 0) + + (((one.ay ?? 0) - (one.y ?? 0)) * (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + w = + (one.w ?? 2028) + + (((one.aw ?? 2028) - (one.w ?? 2028)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1), + h = + (one.h ?? 1248) + + (((one.aw ?? 1248) - (one.w ?? 1248)) * + (farme - beforefarme)) / + (afterfarme - beforefarme || 1); + ctx.drawImage(img, cx, cy, cw, ch, x, y, w, h); + } + } + }); + soundList.forEach(function (one) { + const lisen = + one.sound && + core.material.sounds[one.sound] && + core.musicStatus.soundStatus; + if (farme == one.startfarme && lisen) { + if (one.stopbefore) core.stopSound(); + core.playSound(one.sound); + } + }); + farme++; + ctx.globalAlpha = 1; + ctx.restore(); - if (farme > allFarme) { - core.unregisterAnimationFrame("animationDrawable"); - over.style.display = "none"; - core.doAction(); - } - } - } - ); - }; -}, + if (farme > allFarme) { + core.unregisterAnimationFrame("animationDrawable"); + over.style.display = "none"; + core.doAction(); + } + } + } + ); + }; + }, "musicMode": function () { // 在此增加新插件 const music = document.createElement("canvas"); //CGui画布设置 @@ -14661,178 +14481,228 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "图片压缩webp导出": function () { - // 在此增加新插件 - //使用方法:进入游戏后开始游戏,F12打开控制台,输入core.towebp(image),image为已在全塔属性中注册过的图片名字,需要""括起来 - this.towebp = function (image) { - const canvas = document.createElement("canvas"); //背景画布设置 - const ctx = canvas.getContext("2d"); - const img = core.material.images.images[image]; - canvas.width = img.width; - canvas.height = img.height; - ctx.drawImage(img, 0, 0); - const webpDataURL = canvas.toDataURL("image/webp", 0.85); //第二个参数为画面质量,范围为0-1,1为无损 - console.log(webpDataURL); - const link = document.createElement("a"); - link.href = webpDataURL; - const name = image.substring(0, image.indexOf(".")); - link.download = name + ".webp"; - link.click(); - }; - this.towebpall = function () { - const canvas = document.createElement("canvas"); //背景画布设置 - const ctx = canvas.getContext("2d"); - for (const image in core.material.images.images) { - this.towebp(image); - } - }; - this.towebpsome = function (images) { - images.forEach((image) => { - core.towebp(image); - }); - }; -}, + // 在此增加新插件 + //使用方法:进入游戏后开始游戏,F12打开控制台,输入core.towebp(image),image为已在全塔属性中注册过的图片名字,需要""括起来 + this.towebp = function (image) { + const canvas = document.createElement("canvas"); //背景画布设置 + const ctx = canvas.getContext("2d"); + const img = core.material.images.images[image]; + canvas.width = img.width; + canvas.height = img.height; + ctx.drawImage(img, 0, 0); + const webpDataURL = canvas.toDataURL("image/webp", 0.85); //第二个参数为画面质量,范围为0-1,1为无损 + console.log(webpDataURL); + const link = document.createElement("a"); + link.href = webpDataURL; + const name = image.substring(0, image.indexOf(".")); + link.download = name + ".webp"; + link.click(); + }; + this.towebpall = function () { + const canvas = document.createElement("canvas"); //背景画布设置 + const ctx = canvas.getContext("2d"); + for (const image in core.material.images.images) { + this.towebp(image); + } + }; + this.towebpsome = function (images) { + images.forEach((image) => { + core.towebp(image); + }); + }; + }, "帧动画特效(游戏界面)": function () { - // 在此增加新插件 - const animate2 = document.createElement("canvas"); //画布设置 - animate2.style.zIndex = 71; - animate2.id = "animate2"; - animate2.classList.add('gameCanvas', 'anti-aliasing') - animate2.style.display = "block" - animate2.width = 416 - animate2.height = 416 - animate2.style.width = core.__PIXELS__ * core.domStyle.scale + 'px' - animate2.style.height = core.__PIXELS__ * core.domStyle.scale + 'px' - main.dom.animate2 = animate2; - const anctx = animate2.getContext('2d') + // 在此增加新插件 + const animate2 = document.createElement("canvas"); //画布设置 + animate2.style.zIndex = 71; + animate2.id = "animate2"; + animate2.classList.add("gameCanvas", "anti-aliasing"); + animate2.style.display = "block"; + animate2.width = 416; + animate2.height = 416; + animate2.style.width = core.__PIXELS__ * core.domStyle.scale + "px"; + animate2.style.height = core.__PIXELS__ * core.domStyle.scale + "px"; + main.dom.animate2 = animate2; + const anctx = animate2.getContext("2d"); - main.dom.gameDraw.appendChild(animate2); + main.dom.gameDraw.appendChild(animate2); - core.plugin.playing = new Set() + core.plugin.playing = new Set(); - this.setanimate = function (name, - px, - py, - width, - height, - allFarme, - imageList, - soundList) { - const data = { - px: px, - py: py, - width: width, - height: height, - allFarme: allFarme, - imageList: imageList, - soundList: soundList - } - core.setFlag("animate_" + name, data) + this.setanimate = function ( + name, + px, + py, + width, + height, + allFarme, + imageList, + soundList + ) { + const data = { + px: px, + py: py, + width: width, + height: height, + allFarme: allFarme, + imageList: imageList, + soundList: soundList, + }; + core.setFlag("animate_" + name, data); + }; + this.deleteanimate = function (name) { + core.setFlag("animate_" + name); + }; + let thistime = 0; + this.playanimate = function (name, x, y, hero, scalex, scaley) { + const data = { + name: name, + x: x, + y: y, + hero: hero, + scalex: scalex, + scaley: scaley, + farme: 0, + }; - } - this.deleteanimate = function (name) { - core.setFlag("animate_" + name) + core.plugin.playing.add(data); + }; + core.registerAnimationFrame("animateonmap", true, function (timestamp) { + if (timestamp - thistime > 1000 / 60) { + thistime = timestamp; + core.clearMap(anctx); + core.plugin.playing.forEach((one) => { + const data = flags["animate_" + one.name]; + if (!data) { + core.plugin.playing.delete(one); + } else { + data.imageList.forEach(function (image) { + if ( + one.farme >= (image.beforefarme ?? 0) && + one.farme <= (image.afterfarme ?? data.allFarme) + ) { + const img = core.material.images.images?.[image.image]; + if (img) { + const gla = image.globalAlpha ?? 100; + const agla = image.aglobalAlpha ?? gla, + beforefarme = image.beforefarme ?? 0; + const afterfarme = image.afterfarme ?? data.allFarme; - } - let thistime = 0 - this.playanimate = function (name, x, y, hero, scalex, scaley) { - const data = { name: name, x: x, y: y, hero: hero, scalex: scalex, scaley: scaley, farme: 0 } + anctx.globalAlpha = + (gla + + ((agla - gla) * (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1)) / + 100; - core.plugin.playing.add(data) - - } - core.registerAnimationFrame("animateonmap", true, function (timestamp) { - if (timestamp - thistime > 1000 / 60) { - thistime = timestamp; - core.clearMap(anctx) - core.plugin.playing.forEach(one => { - const data = flags["animate_" + one.name] - if (!data) { - core.plugin.playing.delete(one) - } else { - data.imageList.forEach(function (image) { - if (one.farme >= (image.beforefarme ?? 0) && - one.farme <= (image.afterfarme ?? data.allFarme) - ) { - const img = core.material.images.images?.[image.image]; - if (img) { - const gla = image.globalAlpha ?? 100; - const agla = image.aglobalAlpha ?? gla, - beforefarme = image.beforefarme ?? 0; - const afterfarme = image.afterfarme ?? data.allFarme; - - anctx.globalAlpha = - (gla + - ((agla - gla) * (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1)) / - 100; - - const cx = - (image.cx ?? 0) + - (((image.acx ?? 0) - (image.cx ?? 0)) * - (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - cy = - (image.cy ?? 0) + - (((image.acy ?? 0) - (image.cy ?? 0)) * - (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - cw = - (image.cw ?? img.width) + - (((image.acw ?? img.width) - (image.cw ?? img.width)) * - (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - ch = - (image.ch ?? img.height) + - (((image.acw ?? img.height) - (image.cw ?? img.height)) * - (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - x = - (image.x ?? 0) + - (((image.ax ?? 0) - (image.x ?? 0)) * (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - y = - (image.y ?? 0) + - (((image.ay ?? 0) - (image.y ?? 0)) * (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - w = - (image.w ?? one.width) + - (((image.aw ?? one.width) - (image.w ?? one.width)) * - (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - h = - (image.h ?? one.height) + - (((image.aw ?? one.height) - (image.w ?? one.height)) * - (one.farme - beforefarme)) / - (afterfarme - beforefarme || 1), - angle = (Math.PI * (image.angel ?? 0) / 180) + ((Math.PI * (image.aangel ?? 0) / 180) - ((Math.PI * (image.angel ?? 0) / 180)) * (one.farme - beforefarme)) / (afterfarme - beforefarme || 1); - if (one.hero) { - let sx, sy; - if (core.status.heroMoving < 0) { sx = 0; - sy = 0 } else { - sx = core.utils.scan[core.status.hero.loc.direction].x * 4 * core.status.heroMoving - sy = core.utils.scan[core.status.hero.loc.direction].y * 4 * core.status.heroMoving - } - const herox = core.status.hero.loc.x * 32 + 16 + sx - const heroy = core.status.hero.loc.y * 32 + 16 + sy - core.drawImage(anctx, img, cx, cy, cw, ch, herox + (x - data.px) * one.scalex, heroy + (y - data.py) * one.scaley, w * one.scalex, h * one.scaley, angle) - } else { core.drawImage(anctx, img, cx, cy, cw, ch, one.x + (x - data.px) * one.scalex, one.y + (y - data.py) * one.scaley, w * one.scalex, h * one.scaley, angle); } - } - } - }) - data.soundList.forEach(function (sound) { - const lisen = sound.sound && core.material.sounds[sound.sound] && core.musicStatus.soundStatus; - if (one.farme == sound.startfarme && lisen) { - if (sound.stopbefore) core.stopSound(); - core.playSound(sound.sound); - } - }) - one.farme++; - if (one.farme > data.allFarme) core.plugin.playing.delete(one) - } - }) - } - - }) - -} + const cx = + (image.cx ?? 0) + + (((image.acx ?? 0) - (image.cx ?? 0)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + cy = + (image.cy ?? 0) + + (((image.acy ?? 0) - (image.cy ?? 0)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + cw = + (image.cw ?? img.width) + + (((image.acw ?? img.width) - (image.cw ?? img.width)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + ch = + (image.ch ?? img.height) + + (((image.acw ?? img.height) - (image.cw ?? img.height)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + x = + (image.x ?? 0) + + (((image.ax ?? 0) - (image.x ?? 0)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + y = + (image.y ?? 0) + + (((image.ay ?? 0) - (image.y ?? 0)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + w = + (image.w ?? one.width) + + (((image.aw ?? one.width) - (image.w ?? one.width)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + h = + (image.h ?? one.height) + + (((image.aw ?? one.height) - (image.w ?? one.height)) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1), + angle = + (Math.PI * (image.angel ?? 0)) / 180 + + ((Math.PI * (image.aangel ?? 0)) / 180 - + ((Math.PI * (image.angel ?? 0)) / 180) * + (one.farme - beforefarme)) / + (afterfarme - beforefarme || 1); + if (one.hero) { + let sx, sy; + if (core.status.heroMoving < 0) { + sx = 0; + sy = 0; + } else { + sx = + core.utils.scan[core.status.hero.loc.direction].x * + 4 * + core.status.heroMoving; + sy = + core.utils.scan[core.status.hero.loc.direction].y * + 4 * + core.status.heroMoving; + } + const herox = core.status.hero.loc.x * 32 + 16 + sx; + const heroy = core.status.hero.loc.y * 32 + 16 + sy; + core.drawImage( + anctx, + img, + cx, + cy, + cw, + ch, + herox + (x - data.px) * one.scalex, + heroy + (y - data.py) * one.scaley, + w * one.scalex, + h * one.scaley, + angle + ); + } else { + core.drawImage( + anctx, + img, + cx, + cy, + cw, + ch, + one.x + (x - data.px) * one.scalex, + one.y + (y - data.py) * one.scaley, + w * one.scalex, + h * one.scaley, + angle + ); + } + } + } + }); + data.soundList.forEach(function (sound) { + const lisen = + sound.sound && + core.material.sounds[sound.sound] && + core.musicStatus.soundStatus; + if (one.farme == sound.startfarme && lisen) { + if (sound.stopbefore) core.stopSound(); + core.playSound(sound.sound); + } + }); + one.farme++; + if (one.farme > data.allFarme) core.plugin.playing.delete(one); + } + }); + } + }); + } } \ No newline at end of file