+
请稍候...
+
![]()
+
+
+
+
资源即将开始加载
+
HTML5魔塔游戏平台,享受更多魔塔游戏:
https://h5mota.com/
-
资源即将开始加载
-
HTML5魔塔游戏平台,享受更多魔塔游戏:
https://h5mota.com/
-
-
![]()
-
-
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
![]()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
![]()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 23e4b81..21404e2 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -42,23 +42,23 @@ dependencies:
devDependencies:
'@types/fontmin': 0.9.0
'@types/fs-extra': 9.0.13
- '@types/lodash': 4.14.188
+ '@types/lodash': 4.14.189
'@types/lz-string': 1.3.34
'@types/node': 18.11.9
- '@vitejs/plugin-legacy': 2.3.1_terser@5.15.1+vite@3.2.3
- '@vitejs/plugin-vue': 3.2.0_vite@3.2.3+vue@3.2.45
- '@vitejs/plugin-vue-jsx': 2.1.1_vite@3.2.3+vue@3.2.45
+ '@vitejs/plugin-legacy': 2.3.1_terser@5.15.1+vite@3.2.4
+ '@vitejs/plugin-vue': 3.2.0_vite@3.2.4+vue@3.2.45
+ '@vitejs/plugin-vue-jsx': 2.1.1_vite@3.2.4+vue@3.2.45
compressing: 1.6.2
fontmin: 0.9.9
form-data: 4.0.0
fs-extra: 10.1.0
less: 4.1.3
terser: 5.15.1
- ts-node: 10.9.1_cbe7ovvae6zqfnmtgctpgpys54
- typescript: 4.8.4
+ ts-node: 10.9.1_wup25etrarvlqkprac7h35hj7u
+ typescript: 4.9.3
unplugin-vue-components: 0.22.9_vue@3.2.45
- vite: 3.2.3_sjdpriiyqai3ghwmd5e3ldppum
- vue-tsc: 1.0.9_typescript@4.8.4
+ vite: 3.2.4_sjdpriiyqai3ghwmd5e3ldppum
+ vue-tsc: 1.0.9_typescript@4.9.3
packages:
@@ -343,7 +343,7 @@ packages:
resolution: {integrity: sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==}
engines: {node: '>=6.9.0'}
dependencies:
- regenerator-runtime: 0.13.10
+ regenerator-runtime: 0.13.11
dev: false
/@babel/standalone/7.20.4:
@@ -398,8 +398,8 @@ packages:
engines: {node: '>=10'}
dev: false
- /@esbuild/android-arm/0.15.13:
- resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==}
+ /@esbuild/android-arm/0.15.14:
+ resolution: {integrity: sha512-+Rb20XXxRGisNu2WmNKk+scpanb7nL5yhuI1KR9wQFiC43ddPj/V1fmNyzlFC9bKiG4mYzxW7egtoHVcynr+OA==}
engines: {node: '>=12'}
cpu: [arm]
os: [android]
@@ -407,8 +407,8 @@ packages:
dev: true
optional: true
- /@esbuild/linux-loong64/0.15.13:
- resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==}
+ /@esbuild/linux-loong64/0.15.14:
+ resolution: {integrity: sha512-eQi9rosGNVQFJyJWV0HCA5WZae/qWIQME7s8/j8DMvnylfBv62Pbu+zJ2eUDqNf2O4u3WB+OEXyfkpBoe194sg==}
engines: {node: '>=12'}
cpu: [loong64]
os: [linux]
@@ -527,7 +527,7 @@ packages:
/@simonwep/pickr/1.8.2:
resolution: {integrity: sha512-/l5w8BIkrpP6n1xsetx9MWPWlU6OblN5YgZZphxan0Tq4BByTCETL6lyIeY8lagalS2Nbt4F2W034KHLIiunKA==}
dependencies:
- core-js: 3.26.0
+ core-js: 3.26.1
nanopop: 2.2.0
dev: false
@@ -568,8 +568,8 @@ packages:
'@types/node': 18.11.9
dev: true
- /@types/lodash/4.14.188:
- resolution: {integrity: sha512-zmEmF5OIM3rb7SbLCFYoQhO4dGt2FRM9AMkxvA3LaADOF1n8in/zGJlWji9fmafLoNyz+FoL6FE0SLtGIArD7w==}
+ /@types/lodash/4.14.189:
+ resolution: {integrity: sha512-kb9/98N6X8gyME9Cf7YaqIMvYGnBSWqEci6tiettE6iJWH1XdJz/PO8LB0GtLCG7x8dU3KWhZT+lA1a35127tA==}
dev: true
/@types/lz-string/1.3.34:
@@ -588,7 +588,7 @@ packages:
resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==}
dev: true
- /@vitejs/plugin-legacy/2.3.1_terser@5.15.1+vite@3.2.3:
+ /@vitejs/plugin-legacy/2.3.1_terser@5.15.1+vite@3.2.4:
resolution: {integrity: sha512-J5KaGBlSt2tEYPVjM/C8dA6DkRzkFkbPe+Xb4IX5G+XOV5OGbVAfkMjKywdrkO3gGynO8S98i71Lmsff4cWkCQ==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
@@ -596,15 +596,15 @@ packages:
vite: ^3.0.0
dependencies:
'@babel/standalone': 7.20.4
- core-js: 3.26.0
+ core-js: 3.26.1
magic-string: 0.26.7
- regenerator-runtime: 0.13.10
+ regenerator-runtime: 0.13.11
systemjs: 6.13.0
terser: 5.15.1
- vite: 3.2.3_sjdpriiyqai3ghwmd5e3ldppum
+ vite: 3.2.4_sjdpriiyqai3ghwmd5e3ldppum
dev: true
- /@vitejs/plugin-vue-jsx/2.1.1_vite@3.2.3+vue@3.2.45:
+ /@vitejs/plugin-vue-jsx/2.1.1_vite@3.2.4+vue@3.2.45:
resolution: {integrity: sha512-JgDhxstQlwnHBvZ1BSnU5mbmyQ14/t5JhREc6YH5kWyu2QdAAOsLF6xgHoIWarj8tddaiwFrNzLbWJPudpXKYA==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
@@ -614,20 +614,20 @@ packages:
'@babel/core': 7.20.2
'@babel/plugin-transform-typescript': 7.20.2_@babel+core@7.20.2
'@vue/babel-plugin-jsx': 1.1.1_@babel+core@7.20.2
- vite: 3.2.3_sjdpriiyqai3ghwmd5e3ldppum
+ vite: 3.2.4_sjdpriiyqai3ghwmd5e3ldppum
vue: 3.2.45
transitivePeerDependencies:
- supports-color
dev: true
- /@vitejs/plugin-vue/3.2.0_vite@3.2.3+vue@3.2.45:
+ /@vitejs/plugin-vue/3.2.0_vite@3.2.4+vue@3.2.45:
resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
vite: ^3.0.0
vue: ^3.2.25
dependencies:
- vite: 3.2.3_sjdpriiyqai3ghwmd5e3ldppum
+ vite: 3.2.4_sjdpriiyqai3ghwmd5e3ldppum
vue: 3.2.45
dev: true
@@ -839,7 +839,7 @@ packages:
array-tree-filter: 2.1.0
async-validator: 4.2.5
dayjs: 1.11.6
- dom-align: 1.12.3
+ dom-align: 1.12.4
dom-scroll-into-view: 2.0.1
lodash: 4.17.21
lodash-es: 4.17.21
@@ -1214,8 +1214,8 @@ packages:
is-what: 3.14.1
dev: true
- /core-js/3.26.0:
- resolution: {integrity: sha512-+DkDrhoR4Y0PxDz6rurahuB+I45OsEUv8E1maPTB6OuHRohMMcznBq9TMpdpDMm/hUPob/mJJS3PqgbHpMTQgw==}
+ /core-js/3.26.1:
+ resolution: {integrity: sha512-21491RRQVzUn0GGM9Z1Jrpr6PNPxPi+Za8OM9q4tksTSnlbXXGKK1nXNg/QvwFYettXvSX6zWKCtHHfjN4puyA==}
requiresBuild: true
/core-util-is/1.0.3:
@@ -1305,8 +1305,8 @@ packages:
engines: {node: '>=0.3.1'}
dev: true
- /dom-align/1.12.3:
- resolution: {integrity: sha512-Gj9hZN3a07cbR6zviMUBOMPdWxYhbMI+x+WS0NAIu2zFZmbK8ys9R79g+iG9qLnlCwpFoaB+fKy8Pdv470GsPA==}
+ /dom-align/1.12.4:
+ resolution: {integrity: sha512-R8LUSEay/68zE5c8/3BDxiTEvgb4xZTF0RKmAHfiEVN3klfIpXfi2/QCoiWPccVQ0J/ZGdz9OjzL4uJEP/MRAw==}
dev: false
/dom-scroll-into-view/2.0.1:
@@ -1372,8 +1372,8 @@ packages:
is-arrayish: 0.2.1
dev: true
- /esbuild-android-64/0.15.13:
- resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==}
+ /esbuild-android-64/0.15.14:
+ resolution: {integrity: sha512-HuilVIb4rk9abT4U6bcFdU35UHOzcWVGLSjEmC58OVr96q5UiRqzDtWjPlCMugjhgUGKEs8Zf4ueIvYbOStbIg==}
engines: {node: '>=12'}
cpu: [x64]
os: [android]
@@ -1381,8 +1381,8 @@ packages:
dev: true
optional: true
- /esbuild-android-arm64/0.15.13:
- resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==}
+ /esbuild-android-arm64/0.15.14:
+ resolution: {integrity: sha512-/QnxRVxsR2Vtf3XottAHj7hENAMW2wCs6S+OZcAbc/8nlhbAL/bCQRCVD78VtI5mdwqWkVi3wMqM94kScQCgqg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [android]
@@ -1390,8 +1390,8 @@ packages:
dev: true
optional: true
- /esbuild-darwin-64/0.15.13:
- resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==}
+ /esbuild-darwin-64/0.15.14:
+ resolution: {integrity: sha512-ToNuf1uifu8hhwWvoZJGCdLIX/1zpo8cOGnT0XAhDQXiKOKYaotVNx7pOVB1f+wHoWwTLInrOmh3EmA7Fd+8Vg==}
engines: {node: '>=12'}
cpu: [x64]
os: [darwin]
@@ -1399,8 +1399,8 @@ packages:
dev: true
optional: true
- /esbuild-darwin-arm64/0.15.13:
- resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==}
+ /esbuild-darwin-arm64/0.15.14:
+ resolution: {integrity: sha512-KgGP+y77GszfYJgceO0Wi/PiRtYo5y2Xo9rhBUpxTPaBgWDJ14gqYN0+NMbu+qC2fykxXaipHxN4Scaj9tUS1A==}
engines: {node: '>=12'}
cpu: [arm64]
os: [darwin]
@@ -1408,8 +1408,8 @@ packages:
dev: true
optional: true
- /esbuild-freebsd-64/0.15.13:
- resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==}
+ /esbuild-freebsd-64/0.15.14:
+ resolution: {integrity: sha512-xr0E2n5lyWw3uFSwwUXHc0EcaBDtsal/iIfLioflHdhAe10KSctV978Te7YsfnsMKzcoGeS366+tqbCXdqDHQA==}
engines: {node: '>=12'}
cpu: [x64]
os: [freebsd]
@@ -1417,8 +1417,8 @@ packages:
dev: true
optional: true
- /esbuild-freebsd-arm64/0.15.13:
- resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==}
+ /esbuild-freebsd-arm64/0.15.14:
+ resolution: {integrity: sha512-8XH96sOQ4b1LhMlO10eEWOjEngmZ2oyw3pW4o8kvBcpF6pULr56eeYVP5radtgw54g3T8nKHDHYEI5AItvskZg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [freebsd]
@@ -1426,8 +1426,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-32/0.15.13:
- resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==}
+ /esbuild-linux-32/0.15.14:
+ resolution: {integrity: sha512-6ssnvwaTAi8AzKN8By2V0nS+WF5jTP7SfuK6sStGnDP7MCJo/4zHgM9oE1eQTS2jPmo3D673rckuCzRlig+HMA==}
engines: {node: '>=12'}
cpu: [ia32]
os: [linux]
@@ -1435,8 +1435,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-64/0.15.13:
- resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==}
+ /esbuild-linux-64/0.15.14:
+ resolution: {integrity: sha512-ONySx3U0wAJOJuxGUlXBWxVKFVpWv88JEv0NZ6NlHknmDd1yCbf4AEdClSgLrqKQDXYywmw4gYDvdLsS6z0hcw==}
engines: {node: '>=12'}
cpu: [x64]
os: [linux]
@@ -1444,8 +1444,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-arm/0.15.13:
- resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==}
+ /esbuild-linux-arm/0.15.14:
+ resolution: {integrity: sha512-D2LImAIV3QzL7lHURyCHBkycVFbKwkDb1XEUWan+2fb4qfW7qAeUtul7ZIcIwFKZgPcl+6gKZmvLgPSj26RQ2Q==}
engines: {node: '>=12'}
cpu: [arm]
os: [linux]
@@ -1453,8 +1453,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-arm64/0.15.13:
- resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==}
+ /esbuild-linux-arm64/0.15.14:
+ resolution: {integrity: sha512-kle2Ov6a1e5AjlHlMQl1e+c4myGTeggrRzArQFmWp6O6JoqqB9hT+B28EW4tjFWgV/NxUq46pWYpgaWXsXRPAg==}
engines: {node: '>=12'}
cpu: [arm64]
os: [linux]
@@ -1462,8 +1462,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-mips64le/0.15.13:
- resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==}
+ /esbuild-linux-mips64le/0.15.14:
+ resolution: {integrity: sha512-FVdMYIzOLXUq+OE7XYKesuEAqZhmAIV6qOoYahvUp93oXy0MOVTP370ECbPfGXXUdlvc0TNgkJa3YhEwyZ6MRA==}
engines: {node: '>=12'}
cpu: [mips64el]
os: [linux]
@@ -1471,8 +1471,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-ppc64le/0.15.13:
- resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==}
+ /esbuild-linux-ppc64le/0.15.14:
+ resolution: {integrity: sha512-2NzH+iuzMDA+jjtPjuIz/OhRDf8tzbQ1tRZJI//aT25o1HKc0reMMXxKIYq/8nSHXiJSnYV4ODzTiv45s+h73w==}
engines: {node: '>=12'}
cpu: [ppc64]
os: [linux]
@@ -1480,8 +1480,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-riscv64/0.15.13:
- resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==}
+ /esbuild-linux-riscv64/0.15.14:
+ resolution: {integrity: sha512-VqxvutZNlQxmUNS7Ac+aczttLEoHBJ9e3OYGqnULrfipRvG97qLrAv9EUY9iSrRKBqeEbSvS9bSfstZqwz0T4Q==}
engines: {node: '>=12'}
cpu: [riscv64]
os: [linux]
@@ -1489,8 +1489,8 @@ packages:
dev: true
optional: true
- /esbuild-linux-s390x/0.15.13:
- resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==}
+ /esbuild-linux-s390x/0.15.14:
+ resolution: {integrity: sha512-+KVHEUshX5n6VP6Vp/AKv9fZIl5kr2ph8EUFmQUJnDpHwcfTSn2AQgYYm0HTBR2Mr4d0Wlr0FxF/Cs5pbFgiOw==}
engines: {node: '>=12'}
cpu: [s390x]
os: [linux]
@@ -1498,8 +1498,8 @@ packages:
dev: true
optional: true
- /esbuild-netbsd-64/0.15.13:
- resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==}
+ /esbuild-netbsd-64/0.15.14:
+ resolution: {integrity: sha512-6D/dr17piEgevIm1xJfZP2SjB9Z+g8ERhNnBdlZPBWZl+KSPUKLGF13AbvC+nzGh8IxOH2TyTIdRMvKMP0nEzQ==}
engines: {node: '>=12'}
cpu: [x64]
os: [netbsd]
@@ -1507,8 +1507,8 @@ packages:
dev: true
optional: true
- /esbuild-openbsd-64/0.15.13:
- resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==}
+ /esbuild-openbsd-64/0.15.14:
+ resolution: {integrity: sha512-rREQBIlMibBetgr2E9Lywt2Qxv2ZdpmYahR4IUlAQ1Efv/A5gYdO0/VIN3iowDbCNTLxp0bb57Vf0LFcffD6kA==}
engines: {node: '>=12'}
cpu: [x64]
os: [openbsd]
@@ -1516,8 +1516,8 @@ packages:
dev: true
optional: true
- /esbuild-sunos-64/0.15.13:
- resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==}
+ /esbuild-sunos-64/0.15.14:
+ resolution: {integrity: sha512-DNVjSp/BY4IfwtdUAvWGIDaIjJXY5KI4uD82+15v6k/w7px9dnaDaJJ2R6Mu+KCgr5oklmFc0KjBjh311Gxl9Q==}
engines: {node: '>=12'}
cpu: [x64]
os: [sunos]
@@ -1525,8 +1525,8 @@ packages:
dev: true
optional: true
- /esbuild-windows-32/0.15.13:
- resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==}
+ /esbuild-windows-32/0.15.14:
+ resolution: {integrity: sha512-pHBWrcA+/oLgvViuG9FO3kNPO635gkoVrRQwe6ZY1S0jdET07xe2toUvQoJQ8KT3/OkxqUasIty5hpuKFLD+eg==}
engines: {node: '>=12'}
cpu: [ia32]
os: [win32]
@@ -1534,8 +1534,8 @@ packages:
dev: true
optional: true
- /esbuild-windows-64/0.15.13:
- resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==}
+ /esbuild-windows-64/0.15.14:
+ resolution: {integrity: sha512-CszIGQVk/P8FOS5UgAH4hKc9zOaFo69fe+k1rqgBHx3CSK3Opyk5lwYriIamaWOVjBt7IwEP6NALz+tkVWdFog==}
engines: {node: '>=12'}
cpu: [x64]
os: [win32]
@@ -1543,8 +1543,8 @@ packages:
dev: true
optional: true
- /esbuild-windows-arm64/0.15.13:
- resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==}
+ /esbuild-windows-arm64/0.15.14:
+ resolution: {integrity: sha512-KW9W4psdZceaS9A7Jsgl4WialOznSURvqX/oHZk3gOP7KbjtHLSsnmSvNdzagGJfxbAe30UVGXRe8q8nDsOSQw==}
engines: {node: '>=12'}
cpu: [arm64]
os: [win32]
@@ -1552,34 +1552,34 @@ packages:
dev: true
optional: true
- /esbuild/0.15.13:
- resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==}
+ /esbuild/0.15.14:
+ resolution: {integrity: sha512-pJN8j42fvWLFWwSMG4luuupl2Me7mxciUOsMegKvwCmhEbJ2covUdFnihxm0FMIBV+cbwbtMoHgMCCI+pj1btQ==}
engines: {node: '>=12'}
hasBin: true
requiresBuild: true
optionalDependencies:
- '@esbuild/android-arm': 0.15.13
- '@esbuild/linux-loong64': 0.15.13
- esbuild-android-64: 0.15.13
- esbuild-android-arm64: 0.15.13
- esbuild-darwin-64: 0.15.13
- esbuild-darwin-arm64: 0.15.13
- esbuild-freebsd-64: 0.15.13
- esbuild-freebsd-arm64: 0.15.13
- esbuild-linux-32: 0.15.13
- esbuild-linux-64: 0.15.13
- esbuild-linux-arm: 0.15.13
- esbuild-linux-arm64: 0.15.13
- esbuild-linux-mips64le: 0.15.13
- esbuild-linux-ppc64le: 0.15.13
- esbuild-linux-riscv64: 0.15.13
- esbuild-linux-s390x: 0.15.13
- esbuild-netbsd-64: 0.15.13
- esbuild-openbsd-64: 0.15.13
- esbuild-sunos-64: 0.15.13
- esbuild-windows-32: 0.15.13
- esbuild-windows-64: 0.15.13
- esbuild-windows-arm64: 0.15.13
+ '@esbuild/android-arm': 0.15.14
+ '@esbuild/linux-loong64': 0.15.14
+ esbuild-android-64: 0.15.14
+ esbuild-android-arm64: 0.15.14
+ esbuild-darwin-64: 0.15.14
+ esbuild-darwin-arm64: 0.15.14
+ esbuild-freebsd-64: 0.15.14
+ esbuild-freebsd-arm64: 0.15.14
+ esbuild-linux-32: 0.15.14
+ esbuild-linux-64: 0.15.14
+ esbuild-linux-arm: 0.15.14
+ esbuild-linux-arm64: 0.15.14
+ esbuild-linux-mips64le: 0.15.14
+ esbuild-linux-ppc64le: 0.15.14
+ esbuild-linux-riscv64: 0.15.14
+ esbuild-linux-s390x: 0.15.14
+ esbuild-netbsd-64: 0.15.14
+ esbuild-openbsd-64: 0.15.14
+ esbuild-sunos-64: 0.15.14
+ esbuild-windows-32: 0.15.14
+ esbuild-windows-64: 0.15.14
+ esbuild-windows-arm64: 0.15.14
dev: true
/escalade/3.1.1:
@@ -2195,7 +2195,7 @@ packages:
image-size: 0.5.5
make-dir: 2.1.0
mime: 1.6.0
- needle: 3.1.0
+ needle: 3.2.0
source-map: 0.6.1
transitivePeerDependencies:
- supports-color
@@ -2485,8 +2485,8 @@ packages:
resolution: {integrity: sha512-E9JaHcxh3ere8/BEZHAcnuD10RluTSPyTToBvoFWS9/7DcCx6gyKjbn7M7Bx7E1veCxCuY1iO6h4+gdAf1j73Q==}
dev: false
- /needle/3.1.0:
- resolution: {integrity: sha512-gCE9weDhjVGCRqS8dwDR/D3GTAeyXLXuqp7I8EzH6DllZGXSUyxuqqLh+YX9rMAWaaTFyVAg6rHGL25dqvczKw==}
+ /needle/3.2.0:
+ resolution: {integrity: sha512-oUvzXnyLiVyVGoianLijF9O/RecZUf7TkBfimjGrLM4eQhXyeJwM6GeAWccwfQ9aa4gMCZKqhAOuLaMIcQxajQ==}
engines: {node: '>= 4.4.x'}
hasBin: true
requiresBuild: true
@@ -2802,8 +2802,8 @@ packages:
strip-indent: 4.0.0
dev: true
- /regenerator-runtime/0.13.10:
- resolution: {integrity: sha512-KepLsg4dU12hryUO7bp/axHAKvwGOCV0sGloQtpagJ12ai+ojVDqkeGSiRX1zlq+kjIMZ1t7gpze+26QqtdGqw==}
+ /regenerator-runtime/0.13.11:
+ resolution: {integrity: sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==}
/remove-bom-buffer/3.0.0:
resolution: {integrity: sha512-8v2rWhaakv18qcvNeli2mZ/TMTL2nEyAKRvzo1WtnZBl15SHyEhrCu2/xKlJyUFKHiHgfXIyuY6g2dObJJycXQ==}
@@ -3187,7 +3187,7 @@ packages:
engines: {node: '>=12'}
dev: true
- /ts-node/10.9.1_cbe7ovvae6zqfnmtgctpgpys54:
+ /ts-node/10.9.1_wup25etrarvlqkprac7h35hj7u:
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true
peerDependencies:
@@ -3213,7 +3213,7 @@ packages:
create-require: 1.1.1
diff: 4.0.2
make-error: 1.3.6
- typescript: 4.8.4
+ typescript: 4.9.3
v8-compile-cache-lib: 3.0.1
yn: 3.1.1
dev: true
@@ -3246,8 +3246,8 @@ packages:
resolution: {integrity: sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==}
dev: true
- /typescript/4.8.4:
- resolution: {integrity: sha512-QCh+85mCy+h0IGff8r5XWzOVSbBO+KfeYrMQh7NJ58QujwcE22u+NUSmUxqF+un70P9GXKxa2HCNiTTMJknyjQ==}
+ /typescript/4.9.3:
+ resolution: {integrity: sha512-CIfGzTelbKNEnLpLdGFgdyKhG23CKdKgQPOBc+OUNrkJ2vr+KSzsSV5kq5iWhEQbok+quxgGzrAtGWCyU7tHnA==}
engines: {node: '>=4.2.0'}
hasBin: true
dev: true
@@ -3411,8 +3411,8 @@ packages:
replace-ext: 1.0.1
dev: true
- /vite/3.2.3_sjdpriiyqai3ghwmd5e3ldppum:
- resolution: {integrity: sha512-h8jl1TZ76eGs3o2dIBSsvXDLb1m/Ec1iej8ZMdz+PsaFUsftZeWe2CZOI3qogEsMNaywc17gu0q6cQDzh/weCQ==}
+ /vite/3.2.4_sjdpriiyqai3ghwmd5e3ldppum:
+ resolution: {integrity: sha512-Z2X6SRAffOUYTa+sLy3NQ7nlHFU100xwanq1WDwqaiFiCe+25zdxP1TfCS5ojPV2oDDcXudHIoPnI1Z/66B7Yw==}
engines: {node: ^14.18.0 || >=16.0.0}
hasBin: true
peerDependencies:
@@ -3437,7 +3437,7 @@ packages:
optional: true
dependencies:
'@types/node': 18.11.9
- esbuild: 0.15.13
+ esbuild: 0.15.14
less: 4.1.3
postcss: 8.4.19
resolve: 1.22.1
@@ -3454,7 +3454,7 @@ packages:
he: 1.2.0
dev: true
- /vue-tsc/1.0.9_typescript@4.8.4:
+ /vue-tsc/1.0.9_typescript@4.9.3:
resolution: {integrity: sha512-vRmHD1K6DmBymNhoHjQy/aYKTRQNLGOu2/ESasChG9Vy113K6CdP0NlhR0bzgFJfv2eFB9Ez/9L5kIciUajBxQ==}
hasBin: true
peerDependencies:
@@ -3462,7 +3462,7 @@ packages:
dependencies:
'@volar/vue-language-core': 1.0.9
'@volar/vue-typescript': 1.0.9
- typescript: 4.8.4
+ typescript: 4.9.3
dev: true
/vue-types/3.0.2_vue@3.2.45:
diff --git a/public/libs/actions.js b/public/libs/actions.js
index c21b3d5..e04b46d 100644
--- a/public/libs/actions.js
+++ b/public/libs/actions.js
@@ -307,7 +307,7 @@ actions.prototype._sys_onkeyUp_replay = function (e) {
// T
core.control._replay_toolbox();
else if (e.keyCode == 81)
- // Q
+ // Q_sys_onkeyUp
core.control._replay_equipbox();
else if (e.keyCode == 66)
// B
@@ -490,9 +490,6 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
case 'selectShop':
this._keyUpQuickShop(keyCode);
break;
- case 'toolbox':
- this._keyUpToolbox(keyCode);
- break;
case 'equipbox':
this._keyUpEquipbox(keyCode, altKey);
break;
@@ -2016,33 +2013,6 @@ actions.prototype._keyDownToolbox = function (keycode) {
}
};
-////// 工具栏界面时,放开某个键的操作 //////
-actions.prototype._keyUpToolbox = function (keycode) {
- if (keycode == 81) {
- core.playSound('确定');
- core.ui.closePanel();
- if (core.isReplaying()) core.control._replay_equipbox();
- else core.openEquipbox();
- return;
- }
- if (keycode == 84 || keycode == 27 || keycode == 88) {
- core.playSound('取消');
- core.ui.closePanel();
- var last = core.status.route[core.status.route.length - 1] || '';
- if (last.startsWith('equip:') || last.startsWith('unEquip:')) {
- core.status.route.push('no');
- }
- core.checkAutoEvents();
- return;
- }
- if (core.status.event.data == null) return;
-
- if (keycode == 13 || keycode == 32 || keycode == 67) {
- this._clickToolboxIndex(core.status.event.selection);
- return;
- }
-};
-
////// 装备栏界面时的点击操作 //////
actions.prototype._clickEquipbox = function (x, y, px, py) {
if (x >= this.LAST - 2 && y == 0) {
diff --git a/public/libs/control.js b/public/libs/control.js
index 01e1d64..e3bbc9f 100644
--- a/public/libs/control.js
+++ b/public/libs/control.js
@@ -1,13 +1,12 @@
-
/*
control.js:游戏主要逻辑控制
主要负责status相关内容,以及各种变量获取/存储
寻路算法和人物行走也在此文件内
*/
-"use strict";
+'use strict';
-function control () {
+function control() {
this._init();
}
@@ -19,44 +18,84 @@ control.prototype._init = function () {
this.resizes = [];
this.noAutoEvents = true;
// --- 注册系统的animationFrame
- this.registerAnimationFrame("totalTime", false, this._animationFrame_totalTime);
- this.registerAnimationFrame("autoSave", true, this._animationFrame_autoSave);
- this.registerAnimationFrame("globalAnimate", true, this._animationFrame_globalAnimate);
- this.registerAnimationFrame("animate", true, this._animationFrame_animate);
- this.registerAnimationFrame("heroMoving", true, this._animationFrame_heroMoving);
- this.registerAnimationFrame("weather", true, this._animationFrame_weather);
- this.registerAnimationFrame("tip", true, this._animateFrame_tip);
- this.registerAnimationFrame("parallelDo", false, this._animationFrame_parallelDo);
+ this.registerAnimationFrame(
+ 'totalTime',
+ false,
+ this._animationFrame_totalTime
+ );
+ this.registerAnimationFrame(
+ 'autoSave',
+ true,
+ this._animationFrame_autoSave
+ );
+ this.registerAnimationFrame(
+ 'globalAnimate',
+ true,
+ this._animationFrame_globalAnimate
+ );
+ this.registerAnimationFrame('animate', true, this._animationFrame_animate);
+ this.registerAnimationFrame(
+ 'heroMoving',
+ true,
+ this._animationFrame_heroMoving
+ );
+ this.registerAnimationFrame('weather', true, this._animationFrame_weather);
+ this.registerAnimationFrame('tip', true, this._animateFrame_tip);
+ this.registerAnimationFrame(
+ 'parallelDo',
+ false,
+ this._animationFrame_parallelDo
+ );
// --- 注册系统的天气
- this.registerWeather("rain", this._weather_rain, this._animationFrame_weather_rain);
- this.registerWeather("snow", this._weather_snow, this._animationFrame_weather_snow);
- this.registerWeather("fog", this._weather_fog, this.__animateFrame_weather_image);
- this.registerWeather("cloud", this._weather_cloud, this.__animateFrame_weather_image);
- this.registerWeather("sun", this._weather_sun, this._animationFrame_weather_sun);
+ this.registerWeather(
+ 'rain',
+ this._weather_rain,
+ this._animationFrame_weather_rain
+ );
+ this.registerWeather(
+ 'snow',
+ this._weather_snow,
+ this._animationFrame_weather_snow
+ );
+ this.registerWeather(
+ 'fog',
+ this._weather_fog,
+ this.__animateFrame_weather_image
+ );
+ this.registerWeather(
+ 'cloud',
+ this._weather_cloud,
+ this.__animateFrame_weather_image
+ );
+ this.registerWeather(
+ 'sun',
+ this._weather_sun,
+ this._animationFrame_weather_sun
+ );
// --- 注册系统的replay
- this.registerReplayAction("move", this._replayAction_move);
- this.registerReplayAction("item", this._replayAction_item);
- this.registerReplayAction("equip", this._replayAction_equip);
- this.registerReplayAction("unEquip", this._replayAction_unEquip);
- this.registerReplayAction("saveEquip", this._replayAction_saveEquip);
- this.registerReplayAction("loadEquip", this._replayAction_loadEquip);
- this.registerReplayAction("fly", this._replayAction_fly);
- this.registerReplayAction("shop", this._replayAction_shop);
- this.registerReplayAction("turn", this._replayAction_turn);
- this.registerReplayAction("getNext", this._replayAction_getNext);
- this.registerReplayAction("moveDirectly", this._replayAction_moveDirectly);
- this.registerReplayAction("key", this._replayAction_key);
- this.registerReplayAction("click", this._replayAction_click);
- this.registerReplayAction("ignoreInput", this._replayAction_ignoreInput);
- this.registerReplayAction("no", this._replayAction_no);
+ this.registerReplayAction('move', this._replayAction_move);
+ this.registerReplayAction('item', this._replayAction_item);
+ this.registerReplayAction('equip', this._replayAction_equip);
+ this.registerReplayAction('unEquip', this._replayAction_unEquip);
+ this.registerReplayAction('saveEquip', this._replayAction_saveEquip);
+ this.registerReplayAction('loadEquip', this._replayAction_loadEquip);
+ this.registerReplayAction('fly', this._replayAction_fly);
+ this.registerReplayAction('shop', this._replayAction_shop);
+ this.registerReplayAction('turn', this._replayAction_turn);
+ this.registerReplayAction('getNext', this._replayAction_getNext);
+ this.registerReplayAction('moveDirectly', this._replayAction_moveDirectly);
+ this.registerReplayAction('key', this._replayAction_key);
+ this.registerReplayAction('click', this._replayAction_click);
+ this.registerReplayAction('ignoreInput', this._replayAction_ignoreInput);
+ this.registerReplayAction('no', this._replayAction_no);
// --- 注册系统的resize
- this.registerResize("gameGroup", this._resize_gameGroup);
- this.registerResize("canvas", this._resize_canvas);
- this.registerResize("statusBar", this._resize_statusBar);
- this.registerResize("status", this._resize_status);
- this.registerResize("toolBar", this._resize_toolBar);
- this.registerResize("tools", this._resize_tools);
-}
+ this.registerResize('gameGroup', this._resize_gameGroup);
+ this.registerResize('canvas', this._resize_canvas);
+ this.registerResize('statusBar', this._resize_statusBar);
+ this.registerResize('status', this._resize_status);
+ this.registerResize('toolBar', this._resize_toolBar);
+ this.registerResize('tools', this._resize_tools);
+};
// ------ requestAnimationFrame 相关 ------ //
@@ -65,44 +104,62 @@ control.prototype._init = function () {
// func:要执行的函数,或插件中的函数名;可接受timestamp(从页面加载完毕到当前所经过的时间)作为参数
control.prototype.registerAnimationFrame = function (name, needPlaying, func) {
this.unregisterAnimationFrame(name);
- this.renderFrameFuncs.push({ name: name, needPlaying: needPlaying, func: func });
-}
+ this.renderFrameFuncs.push({
+ name: name,
+ needPlaying: needPlaying,
+ func: func
+ });
+};
////// 注销一个 animationFrame //////
control.prototype.unregisterAnimationFrame = function (name) {
- this.renderFrameFuncs = this.renderFrameFuncs.filter(function (x) { return x.name != name; });
-}
+ this.renderFrameFuncs = this.renderFrameFuncs.filter(function (x) {
+ return x.name != name;
+ });
+};
////// 设置requestAnimationFrame //////
control.prototype._setRequestAnimationFrame = function () {
this._checkRequestAnimationFrame();
- core.animateFrame.totalTime = Math.max(core.animateFrame.totalTime, core.getLocalStorage('totalTime', 0));
+ core.animateFrame.totalTime = Math.max(
+ core.animateFrame.totalTime,
+ core.getLocalStorage('totalTime', 0)
+ );
var loop = function (timestamp) {
core.control.renderFrameFuncs.forEach(function (b) {
if (b.func) {
try {
if (core.isPlaying() || !b.needPlaying)
core.doFunc(b.func, core.control, timestamp);
- }
- catch (e) {
+ } catch (e) {
console.error(e);
- console.error("ERROR in requestAnimationFrame[" + b.name + "]:已自动注销该项。");
+ console.error(
+ 'ERROR in requestAnimationFrame[' +
+ b.name +
+ ']:已自动注销该项。'
+ );
core.unregisterAnimationFrame(b.name);
}
}
- })
+ });
window.requestAnimationFrame(loop);
- }
+ };
window.requestAnimationFrame(loop);
-}
+};
control.prototype._checkRequestAnimationFrame = function () {
(function () {
var lastTime = 0;
var vendors = ['webkit', 'moz'];
- for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
- window.requestAnimationFrame = window[vendors[x] + 'RequestAnimationFrame'];
- window.cancelAnimationFrame = window[vendors[x] + 'CancelAnimationFrame'] || // Webkit中此取消方法的名字变了
+ for (
+ var x = 0;
+ x < vendors.length && !window.requestAnimationFrame;
+ ++x
+ ) {
+ window.requestAnimationFrame =
+ window[vendors[x] + 'RequestAnimationFrame'];
+ window.cancelAnimationFrame =
+ window[vendors[x] + 'CancelAnimationFrame'] || // Webkit中此取消方法的名字变了
window[vendors[x] + 'CancelRequestAnimationFrame'];
}
@@ -122,27 +179,29 @@ control.prototype._checkRequestAnimationFrame = function () {
clearTimeout(id);
};
}
- }());
-}
+ })();
+};
control.prototype._animationFrame_totalTime = function (timestamp) {
core.animateFrame.totalTime += timestamp - core.animateFrame.totalTimeStart;
core.animateFrame.totalTimeStart = timestamp;
if (core.isPlaying()) {
core.status.hero.statistics.totalTime = core.animateFrame.totalTime;
- core.status.hero.statistics.currTime += timestamp - (core.status.hero.statistics.start || timestamp);
+ core.status.hero.statistics.currTime +=
+ timestamp - (core.status.hero.statistics.start || timestamp);
core.status.hero.statistics.start = timestamp;
}
-}
+};
control.prototype._animationFrame_autoSave = function (timestamp) {
if (timestamp - core.saves.autosave.time <= 5000) return;
core.control.checkAutosave();
core.saves.autosave.time = timestamp;
-}
+};
control.prototype._animationFrame_globalAnimate = function (timestamp) {
- if (timestamp - core.animateFrame.globalTime <= core.values.animateSpeed) return;
+ if (timestamp - core.animateFrame.globalTime <= core.values.animateSpeed)
+ return;
core.status.globalAnimateStatus++;
if (core.status.floorId) {
// Global Animate
@@ -151,26 +210,51 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) {
});
// Global floor images
- core.maps._drawFloorImages(core.status.floorId, core.canvas.bg, 'bg', core.status.floorAnimateObjs || [], core.status.globalAnimateStatus);
- core.maps._drawFloorImages(core.status.floorId, core.canvas.fg, 'fg', core.status.floorAnimateObjs || [], core.status.globalAnimateStatus);
+ core.maps._drawFloorImages(
+ core.status.floorId,
+ core.canvas.bg,
+ 'bg',
+ core.status.floorAnimateObjs || [],
+ core.status.globalAnimateStatus
+ );
+ core.maps._drawFloorImages(
+ core.status.floorId,
+ core.canvas.fg,
+ 'fg',
+ core.status.floorAnimateObjs || [],
+ core.status.globalAnimateStatus
+ );
// Global Autotile Animate
core.status.autotileAnimateObjs.forEach(function (block) {
- core.maps._drawAutotileAnimate(block, core.status.globalAnimateStatus);
+ core.maps._drawAutotileAnimate(
+ block,
+ core.status.globalAnimateStatus
+ );
});
// Global hero animate
- if ((core.status.hero || {}).animate && core.status.heroMoving == 0 && main.mode == 'play' && !core.status.preview.enabled) {
+ if (
+ (core.status.hero || {}).animate &&
+ core.status.heroMoving == 0 &&
+ main.mode == 'play' &&
+ !core.status.preview.enabled
+ ) {
core.drawHero('stop', null, core.status.globalAnimateStatus);
}
}
// Box animate
core.drawBoxAnimate();
core.animateFrame.globalTime = timestamp;
-}
+};
control.prototype._animationFrame_animate = function (timestamp) {
- if (timestamp - core.animateFrame.animateTime < 50 || !core.status.animateObjs || core.status.animateObjs.length == 0) return;
+ if (
+ timestamp - core.animateFrame.animateTime < 50 ||
+ !core.status.animateObjs ||
+ core.status.animateObjs.length == 0
+ )
+ return;
core.clearMap('animate');
// 更新帧
for (var i = 0; i < core.status.animateObjs.length; i++) {
@@ -188,13 +272,25 @@ control.prototype._animationFrame_animate = function (timestamp) {
});
core.status.animateObjs.forEach(function (obj) {
if (obj.hero) {
- core.maps._drawAnimateFrame('animate', obj.animate, core.status.heroCenter.px, core.status.heroCenter.py, obj.index++);
+ core.maps._drawAnimateFrame(
+ 'animate',
+ obj.animate,
+ core.status.heroCenter.px,
+ core.status.heroCenter.py,
+ obj.index++
+ );
} else {
- core.maps._drawAnimateFrame('animate', obj.animate, obj.centerX, obj.centerY, obj.index++);
+ core.maps._drawAnimateFrame(
+ 'animate',
+ obj.animate,
+ obj.centerX,
+ obj.centerY,
+ obj.index++
+ );
}
});
core.animateFrame.animateTime = timestamp;
-}
+};
control.prototype._animationFrame_heroMoving = function (timestamp) {
if (core.status.heroMoving <= 0) return;
@@ -203,24 +299,40 @@ control.prototype._animationFrame_heroMoving = function (timestamp) {
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
core.animateFrame.moveTime = timestamp;
}
- core.drawHero(core.animateFrame.leftLeg ? 'leftFoot' : 'rightFoot', 4 * core.status.heroMoving);
-}
+ core.drawHero(
+ core.animateFrame.leftLeg ? 'leftFoot' : 'rightFoot',
+ 4 * core.status.heroMoving
+ );
+};
control.prototype._animationFrame_weather = function (timestamp) {
- var weather = core.animateFrame.weather, type = weather.type;
- if (!core.dymCanvas.weather || !core.control.weathers[type] || !core.control.weathers[type].frameFunc) return;
+ var weather = core.animateFrame.weather,
+ type = weather.type;
+ if (
+ !core.dymCanvas.weather ||
+ !core.control.weathers[type] ||
+ !core.control.weathers[type].frameFunc
+ )
+ return;
try {
- core.doFunc(core.control.weathers[type].frameFunc, core.control, timestamp, core.animateFrame.weather.level);
+ core.doFunc(
+ core.control.weathers[type].frameFunc,
+ core.control,
+ timestamp,
+ core.animateFrame.weather.level
+ );
} catch (e) {
console.error(e);
- console.error("ERROR in weather[" + type + "]:已自动注销该项。");
+ console.error('ERROR in weather[' + type + ']:已自动注销该项。');
core.unregisterWeather(type);
}
-}
+};
control.prototype._animationFrame_weather_rain = function (timestamp, level) {
if (timestamp - core.animateFrame.weather.time < 30) return;
- var ctx = core.dymCanvas.weather, ox = core.bigmap.offsetX, oy = core.bigmap.offsetY;
+ var ctx = core.dymCanvas.weather,
+ ox = core.bigmap.offsetX,
+ oy = core.bigmap.offsetY;
core.clearMap('weather');
ctx.strokeStyle = 'rgba(174,194,224,0.8)';
ctx.lineWidth = 1;
@@ -238,18 +350,19 @@ control.prototype._animationFrame_weather_rain = function (timestamp, level) {
p.x = Math.random() * core.bigmap.width * 32;
p.y = -10;
}
-
});
ctx.fill();
core.animateFrame.weather.time = timestamp;
-}
+};
control.prototype._animationFrame_weather_snow = function (timestamp, level) {
if (timestamp - core.animateFrame.weather.time < 30) return;
- var ctx = core.dymCanvas.weather, ox = core.bigmap.offsetX, oy = core.bigmap.offsetY;
+ var ctx = core.dymCanvas.weather,
+ ox = core.bigmap.offsetX,
+ oy = core.bigmap.offsetY;
core.clearMap('weather');
- ctx.fillStyle = "rgba(255, 255, 255, 0.8)";
+ ctx.fillStyle = 'rgba(255, 255, 255, 0.8)';
ctx.beginPath();
core.animateFrame.weather.data = core.animateFrame.weather.data || 0;
core.animateFrame.weather.data += 0.01;
@@ -261,23 +374,24 @@ control.prototype._animationFrame_weather_snow = function (timestamp, level) {
// update
p.x += Math.sin(angle) * core.animateFrame.weather.level;
p.y += Math.cos(angle + p.d) + 1 + p.r / 2;
- if (p.x > core.bigmap.width * 32 + 5 || p.x < -5 || p.y > core.bigmap.height * 32) {
+ if (
+ p.x > core.bigmap.width * 32 + 5 ||
+ p.x < -5 ||
+ p.y > core.bigmap.height * 32
+ ) {
if (Math.random() > 1 / 3) {
p.x = Math.random() * core.bigmap.width * 32;
p.y = -10;
- }
- else {
- if (Math.sin(angle) > 0)
- p.x = -5;
- else
- p.x = core.bigmap.width * 32 + 5;
+ } else {
+ if (Math.sin(angle) > 0) p.x = -5;
+ else p.x = core.bigmap.width * 32 + 5;
p.y = Math.random() * core.bigmap.height * 32;
}
}
});
ctx.fill();
core.animateFrame.weather.time = timestamp;
-}
+};
control.prototype.__animateFrame_weather_image = function (timestamp, level) {
if (timestamp - core.animateFrame.weather.time < 30) return;
@@ -287,7 +401,8 @@ control.prototype.__animateFrame_weather_image = function (timestamp, level) {
core.clearMap('weather');
core.setAlpha('weather', node.level / 500);
var wind = 1.5;
- var width = image.width, height = image.height;
+ var width = image.width,
+ height = image.height;
node.x += node.dx * wind;
node.y += (2 * node.dy - 1) * wind;
if (node.x + 3 * width <= core._PX_) {
@@ -303,21 +418,29 @@ control.prototype.__animateFrame_weather_image = function (timestamp, level) {
if (node.y + 3 * height <= core._PY_) {
node.y += 4 * height;
while (node.y > 0) node.y -= height;
- }
- else if (node.y >= 0) {
+ } else if (node.y >= 0) {
node.y -= height;
}
for (var i = 0; i < 3; ++i) {
for (var j = 0; j < 3; ++j) {
- if (node.x + (i + 1) * width <= 0 || node.x + i * width >= core._PX_
- || node.y + (j + 1) * height <= 0 || node.y + j * height >= core._PY_)
+ if (
+ node.x + (i + 1) * width <= 0 ||
+ node.x + i * width >= core._PX_ ||
+ node.y + (j + 1) * height <= 0 ||
+ node.y + j * height >= core._PY_
+ )
continue;
- core.drawImage('weather', image, node.x + i * width, node.y + j * height);
+ core.drawImage(
+ 'weather',
+ image,
+ node.x + i * width,
+ node.y + j * height
+ );
}
}
core.setAlpha('weather', 1);
core.animateFrame.weather.time = timestamp;
-}
+};
control.prototype._animationFrame_weather_sun = function (timestamp, level) {
if (timestamp - core.animateFrame.weather.time < 30) return;
@@ -328,7 +451,7 @@ control.prototype._animationFrame_weather_sun = function (timestamp, level) {
node.opacity = opacity;
core.setOpacity('weather', core.clamp(opacity, 0, 1));
core.animateFrame.weather.time = timestamp;
-}
+};
control.prototype._animateFrame_tip = function (timestamp) {
if (core.animateFrame.tip == null) return;
@@ -337,7 +460,7 @@ control.prototype._animateFrame_tip = function (timestamp) {
var delta = timestamp - tip.time;
tip.time = timestamp;
- core.setFont('data', "16px Arial");
+ core.setFont('data', '16px Arial');
core.setTextAlign('data', 'left');
core.clearMap('data', 0, 0, core._PX_, 50);
core.ui._drawTip_drawOne(tip);
@@ -355,11 +478,11 @@ control.prototype._animateFrame_tip = function (timestamp) {
if (tip.opacity <= 0) {
core.animateFrame.tip = null;
}
-}
+};
control.prototype._animationFrame_parallelDo = function (timestamp) {
core.control.controldata.parallelDo(timestamp);
-}
+};
// ------ 标题界面的处理 ------ //
@@ -367,17 +490,20 @@ control.prototype._animationFrame_parallelDo = function (timestamp) {
control.prototype.showStartAnimate = function (noAnimate, callback) {
this._showStartAnimate_resetDom();
if (core.flags.startUsingCanvas || noAnimate)
- return this._showStartAnimate_finished(core.flags.startUsingCanvas, callback);
+ return this._showStartAnimate_finished(
+ core.flags.startUsingCanvas,
+ callback
+ );
core.hideWithAnimate(core.dom.startTop, 20, function () {
core.control._showStartAnimate_finished(false, callback);
});
-}
+};
control.prototype._showStartAnimate_resetDom = function () {
core.dom.startPanel.style.opacity = 1;
- core.dom.startPanel.style.display = "block";
+ core.dom.startPanel.style.display = 'block';
core.dom.startTop.style.opacity = 1;
- core.dom.startTop.style.display = "block";
+ core.dom.startTop.style.display = 'block';
core.dom.startButtonGroup.style.display = 'none';
core.dom.startButtons.style.display = 'block';
core.dom.levelChooseButtons.style.display = 'none';
@@ -389,7 +515,7 @@ control.prototype._showStartAnimate_resetDom = function () {
// 重置音量
core.events.setVolume(1, 0);
core.updateStatusBar();
-}
+};
control.prototype._showStartAnimate_finished = function (start, callback) {
core.dom.startTop.style.display = 'none';
@@ -398,17 +524,17 @@ control.prototype._showStartAnimate_finished = function (start, callback) {
main.selectButton(0);
if (start) core.startGame();
if (callback) callback();
-}
+};
////// 隐藏游戏开始界面 //////
control.prototype.hideStartAnimate = function (callback) {
core.hideWithAnimate(core.dom.startPanel, 20, callback);
-}
+};
////// 游戏是否已经开始 //////
control.prototype.isPlaying = function () {
return core.status.played;
-}
+};
////// 清除游戏状态和数据 //////
control.prototype.clearStatus = function () {
@@ -425,31 +551,37 @@ control.prototype.clearStatus = function () {
core.clearStatusBar();
core.deleteAllCanvas();
core.status.played = false;
-}
+};
control.prototype._initStatistics = function (totalTime) {
if (!core.isset(core.status.hero.statistics))
core.status.hero.statistics = {
- 'totalTime': totalTime,
- 'currTime': 0,
- 'hp': 0,
- "battle": 0,
- 'money': 0,
- 'exp': 0,
- 'battleDamage': 0,
- 'poisonDamage': 0,
- 'extraDamage': 0,
- 'moveDirectly': 0,
- 'ignoreSteps': 0,
- }
-}
+ totalTime: totalTime,
+ currTime: 0,
+ hp: 0,
+ battle: 0,
+ money: 0,
+ exp: 0,
+ battleDamage: 0,
+ poisonDamage: 0,
+ extraDamage: 0,
+ moveDirectly: 0,
+ ignoreSteps: 0
+ };
+};
// ------ 自动寻路,人物行走 ------ //
////// 清除自动寻路路线 //////
control.prototype.clearAutomaticRouteNode = function (x, y) {
- core.clearMap('route', x * 32 + 5 - core.status.automaticRoute.offsetX, y * 32 + 5 - core.status.automaticRoute.offsetY, 27, 27);
-}
+ core.clearMap(
+ 'route',
+ x * 32 + 5 - core.status.automaticRoute.offsetX,
+ y * 32 + 5 - core.status.automaticRoute.offsetY,
+ 27,
+ 27
+ );
+};
////// 停止自动寻路操作 //////
control.prototype.stopAutomaticRoute = function () {
@@ -465,48 +597,59 @@ control.prototype.stopAutomaticRoute = function () {
core.status.heroStop = true;
if (core.status.automaticRoute.moveStepBeforeStop.length == 0)
core.deleteCanvas('route');
-}
+};
////// 保存剩下的寻路,并停止 //////
control.prototype.saveAndStopAutomaticRoute = function () {
var automaticRoute = core.status.automaticRoute;
if (automaticRoute.moveStepBeforeStop.length == 0) {
- automaticRoute.moveStepBeforeStop = automaticRoute.autoStepRoutes.slice(automaticRoute.autoStep - 1);
+ automaticRoute.moveStepBeforeStop = automaticRoute.autoStepRoutes.slice(
+ automaticRoute.autoStep - 1
+ );
if (automaticRoute.moveStepBeforeStop.length >= 1)
- automaticRoute.moveStepBeforeStop[0].step -= automaticRoute.movedStep;
+ automaticRoute.moveStepBeforeStop[0].step -=
+ automaticRoute.movedStep;
}
this.stopAutomaticRoute();
-}
+};
////// 继续剩下的自动寻路操作 //////
control.prototype.continueAutomaticRoute = function () {
// 此函数只应由events.afterOpenDoor和events.afterBattle调用
var moveStep = core.status.automaticRoute.moveStepBeforeStop;
//core.status.automaticRoute.moveStepBeforeStop = [];
- if (moveStep.length === 0 || (moveStep.length === 1 && moveStep[0].step === 1)) {
+ if (
+ moveStep.length === 0 ||
+ (moveStep.length === 1 && moveStep[0].step === 1)
+ ) {
core.status.automaticRoute.moveStepBeforeStop = [];
- }
- else {
+ } else {
core.setAutoHeroMove(moveStep);
}
-}
+};
////// 清空剩下的自动寻路列表 //////
control.prototype.clearContinueAutomaticRoute = function (callback) {
core.deleteCanvas('route');
core.status.automaticRoute.moveStepBeforeStop = [];
if (callback) callback();
-}
+};
////// 设置自动寻路路线 //////
control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
if (!core.status.played || core.status.lockControl) return;
if (this._setAutomaticRoute_isMoving(destX, destY)) return;
if (this._setAutomaticRoute_isTurning(destX, destY, stepPostfix)) return;
- if (this._setAutomaticRoute_clickMoveDirectly(destX, destY, stepPostfix)) return;
+ if (this._setAutomaticRoute_clickMoveDirectly(destX, destY, stepPostfix))
+ return;
// 找寻自动寻路路线
var moveStep = core.automaticRoute(destX, destY);
- if (moveStep.length == 0 && (destX != core.status.hero.loc.x || destY != core.status.hero.loc.y || stepPostfix.length == 0))
+ if (
+ moveStep.length == 0 &&
+ (destX != core.status.hero.loc.x ||
+ destY != core.status.hero.loc.y ||
+ stepPostfix.length == 0)
+ )
return;
moveStep = moveStep.concat(stepPostfix);
core.status.automaticRoute.destX = destX;
@@ -515,17 +658,21 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
this._setAutomaticRoute_setAutoSteps(moveStep);
// 立刻移动
core.setAutoHeroMove();
-}
+};
control.prototype._setAutomaticRoute_isMoving = function (destX, destY) {
if (core.status.automaticRoute.autoHeroMove) {
- var lastX = core.status.automaticRoute.destX, lastY = core.status.automaticRoute.destY;
+ var lastX = core.status.automaticRoute.destX,
+ lastY = core.status.automaticRoute.destY;
core.stopAutomaticRoute();
// 双击瞬移
if (lastX == destX && lastY == destY) {
core.status.automaticRoute.moveDirectly = true;
setTimeout(function () {
- if (core.status.automaticRoute.moveDirectly && core.status.heroMoving == 0) {
+ if (
+ core.status.automaticRoute.moveDirectly &&
+ core.status.heroMoving == 0
+ ) {
core.control.tryMoveDirectly(destX, destY);
}
core.status.automaticRoute.moveDirectly = false;
@@ -534,10 +681,18 @@ control.prototype._setAutomaticRoute_isMoving = function (destX, destY) {
return true;
}
return false;
-}
+};
-control.prototype._setAutomaticRoute_isTurning = function (destX, destY, stepPostfix) {
- if (destX == core.status.hero.loc.x && destY == core.status.hero.loc.y && stepPostfix.length == 0) {
+control.prototype._setAutomaticRoute_isTurning = function (
+ destX,
+ destY,
+ stepPostfix
+) {
+ if (
+ destX == core.status.hero.loc.x &&
+ destY == core.status.hero.loc.y &&
+ stepPostfix.length == 0
+ ) {
if (core.timeout.turnHeroTimeout == null) {
var routeLength = core.status.route.length;
core.timeout.turnHeroTimeout = setTimeout(function () {
@@ -545,8 +700,7 @@ control.prototype._setAutomaticRoute_isTurning = function (destX, destY, stepPos
clearTimeout(core.timeout.turnHeroTimeout);
core.timeout.turnHeroTimeout = null;
}, 250);
- }
- else {
+ } else {
clearTimeout(core.timeout.turnHeroTimeout);
core.timeout.turnHeroTimeout = null;
core.getNextItem();
@@ -555,61 +709,99 @@ control.prototype._setAutomaticRoute_isTurning = function (destX, destY, stepPos
}
if (core.timeout.turnHeroTimeout != null) return true;
return false;
-}
+};
-control.prototype._setAutomaticRoute_clickMoveDirectly = function (destX, destY, stepPostfix) {
+control.prototype._setAutomaticRoute_clickMoveDirectly = function (
+ destX,
+ destY,
+ stepPostfix
+) {
// 单击瞬间移动
if (core.status.heroStop && core.status.heroMoving == 0) {
- if (stepPostfix.length <= 1 && !core.hasFlag('__noClickMove__') && core.control.tryMoveDirectly(destX, destY))
+ if (
+ stepPostfix.length <= 1 &&
+ !core.hasFlag('__noClickMove__') &&
+ core.control.tryMoveDirectly(destX, destY)
+ )
return true;
}
return false;
-}
+};
control.prototype._setAutomaticRoute_drawRoute = function (moveStep) {
// 计算绘制区域的宽高,并尽可能小的创建route层
- var sx = core.bigmap.width * 32, sy = core.bigmap.height * 32, dx = 0, dy = 0;
+ var sx = core.bigmap.width * 32,
+ sy = core.bigmap.height * 32,
+ dx = 0,
+ dy = 0;
moveStep.forEach(function (t) {
- sx = Math.min(sx, t.x * 32); dx = Math.max(dx, t.x * 32);
- sy = Math.min(sy, t.y * 32); dy = Math.max(dy, t.y * 32);
+ sx = Math.min(sx, t.x * 32);
+ dx = Math.max(dx, t.x * 32);
+ sy = Math.min(sy, t.y * 32);
+ dy = Math.max(dy, t.y * 32);
});
core.status.automaticRoute.offsetX = sx;
core.status.automaticRoute.offsetY = sy;
- var ctx = core.createCanvas('route', sx - core.bigmap.offsetX, sy - core.bigmap.offsetY, dx - sx + 32, dy - sy + 32, 95);
+ var ctx = core.createCanvas(
+ 'route',
+ sx - core.bigmap.offsetX,
+ sy - core.bigmap.offsetY,
+ dx - sx + 32,
+ dy - sy + 32,
+ 95
+ );
ctx.fillStyle = '#bfbfbf';
ctx.strokeStyle = '#bfbfbf';
ctx.lineWidth = 8;
for (var m = 0; m < moveStep.length; m++) {
if (m == moveStep.length - 1) {
- ctx.fillRect(moveStep[m].x * 32 + 10 - sx, moveStep[m].y * 32 + 10 - sy, 12, 12);
- }
- else {
+ ctx.fillRect(
+ moveStep[m].x * 32 + 10 - sx,
+ moveStep[m].y * 32 + 10 - sy,
+ 12,
+ 12
+ );
+ } else {
ctx.beginPath();
- var cx = moveStep[m].x * 32 + 16 - sx, cy = moveStep[m].y * 32 + 16 - sy;
- var currDir = moveStep[m].direction, nextDir = moveStep[m + 1].direction;
- ctx.moveTo(cx - core.utils.scan[currDir].x * 11, cy - core.utils.scan[currDir].y * 11);
+ var cx = moveStep[m].x * 32 + 16 - sx,
+ cy = moveStep[m].y * 32 + 16 - sy;
+ var currDir = moveStep[m].direction,
+ nextDir = moveStep[m + 1].direction;
+ ctx.moveTo(
+ cx - core.utils.scan[currDir].x * 11,
+ cy - core.utils.scan[currDir].y * 11
+ );
ctx.lineTo(cx, cy);
- ctx.lineTo(cx + core.utils.scan[nextDir].x * 11, cy + core.utils.scan[nextDir].y * 11);
+ ctx.lineTo(
+ cx + core.utils.scan[nextDir].x * 11,
+ cy + core.utils.scan[nextDir].y * 11
+ );
ctx.stroke();
}
}
-}
+};
control.prototype._setAutomaticRoute_setAutoSteps = function (moveStep) {
// 路线转autoStepRoutes
- var step = 0, currStep = null;
+ var step = 0,
+ currStep = null;
moveStep.forEach(function (t) {
var dir = t.direction;
- if (currStep == null || currStep == dir)
- step++;
+ if (currStep == null || currStep == dir) step++;
else {
- core.status.automaticRoute.autoStepRoutes.push({ 'direction': currStep, 'step': step });
+ core.status.automaticRoute.autoStepRoutes.push({
+ direction: currStep,
+ step: step
+ });
step = 1;
}
currStep = dir;
});
- core.status.automaticRoute.autoStepRoutes.push({ 'direction': currStep, 'step': step });
-}
+ core.status.automaticRoute.autoStepRoutes.push({
+ direction: currStep,
+ step: step
+ });
+};
////// 设置勇士的自动行走路线 //////
control.prototype.setAutoHeroMove = function (steps) {
@@ -620,7 +812,7 @@ control.prototype.setAutoHeroMove = function (steps) {
core.status.automaticRoute.autoStep = 1;
core.status.automaticRoute.destStep = steps[0].step;
core.moveHero(steps[0].direction);
-}
+};
////// 设置行走的效果动画 //////
control.prototype.setHeroMoveInterval = function (callback) {
@@ -644,22 +836,23 @@ control.prototype.setHeroMoveInterval = function (callback) {
core.status.heroMoving = 0;
if (callback) callback();
}
- }, core.values.moveSpeed / 8 * toAdd / core.status.replay.speed);
-}
+ }, ((core.values.moveSpeed / 8) * toAdd) / core.status.replay.speed);
+};
////// 每移动一格后执行的事件 //////
control.prototype.moveOneStep = function (callback) {
return this.controldata.moveOneStep(callback);
-}
+};
////// 实际每一步的行走过程 //////
control.prototype.moveAction = function (callback) {
if (core.status.heroMoving > 0) return;
- var noPass = core.noPass(core.nextX(), core.nextY()), canMove = core.canMoveHero();
+ var noPass = core.noPass(core.nextX(), core.nextY()),
+ canMove = core.canMoveHero();
// 下一个点如果不能走
if (noPass || !canMove) return this._moveAction_noPass(canMove, callback);
this._moveAction_moving(callback);
-}
+};
control.prototype._moveAction_noPass = function (canMove, callback) {
core.status.route.push(core.getHeroLoc('direction'));
@@ -673,7 +866,7 @@ control.prototype._moveAction_noPass = function (canMove, callback) {
core.stopAutomaticRoute();
}
if (callback) callback();
-}
+};
control.prototype._moveAction_moving = function (callback) {
core.setHeroMoveInterval(function () {
@@ -688,7 +881,7 @@ control.prototype._moveAction_moving = function (callback) {
core.checkRouteFolding();
if (callback) callback();
});
-}
+};
control.prototype._moveAction_popAutomaticRoute = function () {
var automaticRoute = core.status.automaticRoute;
@@ -697,30 +890,35 @@ control.prototype._moveAction_popAutomaticRoute = function () {
automaticRoute.movedStep++;
automaticRoute.lastDirection = core.getHeroLoc('direction');
if (automaticRoute.destStep == automaticRoute.movedStep) {
- if (automaticRoute.autoStep == automaticRoute.autoStepRoutes.length) {
+ if (
+ automaticRoute.autoStep == automaticRoute.autoStepRoutes.length
+ ) {
core.clearContinueAutomaticRoute();
core.stopAutomaticRoute();
- }
- else {
+ } else {
automaticRoute.movedStep = 0;
- automaticRoute.destStep = automaticRoute.autoStepRoutes[automaticRoute.autoStep].step;
- core.setHeroLoc('direction', automaticRoute.autoStepRoutes[automaticRoute.autoStep].direction);
+ automaticRoute.destStep =
+ automaticRoute.autoStepRoutes[automaticRoute.autoStep].step;
+ core.setHeroLoc(
+ 'direction',
+ automaticRoute.autoStepRoutes[automaticRoute.autoStep]
+ .direction
+ );
core.status.automaticRoute.autoStep++;
}
}
}
-}
+};
////// 让勇士开始移动 //////
control.prototype.moveHero = function (direction, callback) {
// 如果正在移动,直接return
if (core.status.heroMoving != 0) return;
- if (core.isset(direction))
- core.setHeroLoc('direction', direction);
+ if (core.isset(direction)) core.setHeroLoc('direction', direction);
if (callback) return this.moveAction(callback);
this._moveHero_moving();
-}
+};
control.prototype._moveHero_moving = function () {
// ------ 我已经看不懂这个函数了,反正好用就行23333333
@@ -731,23 +929,33 @@ control.prototype._moveHero_moving = function () {
if (core.hasFlag('debug') && core.status.ctrlDown) {
if (core.status.heroMoving != 0) return;
// 检测是否穿出去
- var nx = core.nextX(), ny = core.nextY();
- if (nx < 0 || nx >= core.bigmap.width || ny < 0 || ny >= core.bigmap.height) return;
- core.eventMoveHero([core.getHeroLoc('direction')], core.values.moveSpeed, move);
- }
- else {
+ var nx = core.nextX(),
+ ny = core.nextY();
+ if (
+ nx < 0 ||
+ nx >= core.bigmap.width ||
+ ny < 0 ||
+ ny >= core.bigmap.height
+ )
+ return;
+ core.eventMoveHero(
+ [core.getHeroLoc('direction')],
+ core.values.moveSpeed,
+ move
+ );
+ } else {
core.moveAction();
setTimeout(move, 50);
}
}
- }
+ };
move();
-}
+};
////// 当前是否正在移动 //////
control.prototype.isMoving = function () {
return !core.status.heroStop || core.status.heroMoving > 0;
-}
+};
////// 停止勇士的一切行动,等待勇士行动结束后,再执行callback //////
control.prototype.waitHeroToStop = function (callback) {
@@ -758,72 +966,95 @@ control.prototype.waitHeroToStop = function (callback) {
core.status.replay.animate = true;
core.lockControl();
core.status.automaticRoute.moveDirectly = false;
- setTimeout(function () {
- core.status.replay.animate = false;
- if (core.isset(lastDirection))
- core.setHeroLoc('direction', lastDirection);
- core.drawHero();
- callback();
- }, core.status.replay.speed == 24 ? 1 : 30);
+ setTimeout(
+ function () {
+ core.status.replay.animate = false;
+ if (core.isset(lastDirection))
+ core.setHeroLoc('direction', lastDirection);
+ core.drawHero();
+ callback();
+ },
+ core.status.replay.speed == 24 ? 1 : 30
+ );
}
-}
+};
////// 转向 //////
control.prototype.turnHero = function (direction) {
if (direction) {
core.setHeroLoc('direction', direction);
core.drawHero();
- core.status.route.push("turn:" + direction);
+ core.status.route.push('turn:' + direction);
return;
}
core.setHeroLoc('direction', core.turnDirection(':right'));
core.drawHero();
- core.status.route.push("turn");
+ core.status.route.push('turn');
core.checkRouteFolding();
-}
+};
////// 瞬间移动 //////
control.prototype.moveDirectly = function (destX, destY, ignoreSteps) {
return this.controldata.moveDirectly(destX, destY, ignoreSteps);
-}
+};
////// 尝试瞬间移动 //////
control.prototype.tryMoveDirectly = function (destX, destY) {
if (this.nearHero(destX, destY)) return false;
var canMoveArray = core.maps.generateMovableArray();
- var dirs = [[destX, destY], [destX - 1, destY, "right"], [destX, destY - 1, "down"], [destX, destY + 1, "up"], [destX + 1, destY, "left"]];
+ var dirs = [
+ [destX, destY],
+ [destX - 1, destY, 'right'],
+ [destX, destY - 1, 'down'],
+ [destX, destY + 1, 'up'],
+ [destX + 1, destY, 'left']
+ ];
var canMoveDirectlyArray = core.canMoveDirectlyArray(dirs, canMoveArray);
for (var i = 0; i < dirs.length; ++i) {
- var d = dirs[i], dx = d[0], dy = d[1], dir = d[2];
- if (dx < 0 || dx >= core.bigmap.width || dy < 0 || dy >= core.bigmap.height) continue;
+ var d = dirs[i],
+ dx = d[0],
+ dy = d[1],
+ dir = d[2];
+ if (
+ dx < 0 ||
+ dx >= core.bigmap.width ||
+ dy < 0 ||
+ dy >= core.bigmap.height
+ )
+ continue;
if (dir && !core.inArray(canMoveArray[dx][dy], dir)) continue;
if (canMoveDirectlyArray[i] < 0) continue;
if (core.control.moveDirectly(dx, dy, canMoveDirectlyArray[i])) {
- if (dir) core.moveHero(dir, function () { });
+ if (dir) core.moveHero(dir, function () {});
return true;
}
}
return false;
-}
+};
////// 绘制勇士 //////
control.prototype.drawHero = function (status, offset, frame) {
- if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
- var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
+ if (!core.isPlaying() || !core.status.floorId || core.status.gameOver)
+ return;
+ var x = core.getHeroLoc('x'),
+ y = core.getHeroLoc('y'),
+ direction = core.getHeroLoc('direction');
status = status || 'stop';
if (!offset) offset = 0;
var way = core.utils.scan2[direction];
- var dx = way.x, dy = way.y;
- var offsetX = typeof offset == 'number' ? dx * offset : (offset.x || 0);
- var offsetY = typeof offset == 'number' ? dy * offset : (offset.y || 0);
+ var dx = way.x,
+ dy = way.y;
+ var offsetX = typeof offset == 'number' ? dx * offset : offset.x || 0;
+ var offsetY = typeof offset == 'number' ? dy * offset : offset.y || 0;
offset = { x: offsetX, y: offsetY, offset: offset };
core.clearAutomaticRouteNode(x + dx, y + dy);
core.clearMap('hero');
core.status.heroCenter.px = 32 * x + offsetX + 16;
- core.status.heroCenter.py = 32 * y + offsetY + 32 - core.material.icons.hero.height / 2;
+ core.status.heroCenter.py =
+ 32 * y + offsetY + 32 - core.material.icons.hero.height / 2;
// 重置hero层画布
core.setGameCanvasTranslate('hero', 0, 0);
@@ -835,57 +1066,109 @@ control.prototype.drawHero = function (status, offset, frame) {
}
this._drawHero_draw(direction, x, y, status, offset, frame);
-}
+};
control.prototype._drawHero_updateViewport = function (x, y, offset) {
- core.bigmap.offsetX = core.clamp((x - core._HALF_WIDTH_) * 32 + offset.x, 0, Math.max(32 * core.bigmap.width - core._PX_, 0));
- core.bigmap.offsetY = core.clamp((y - core._HALF_HEIGHT_) * 32 + offset.y, 0, Math.max(32 * core.bigmap.height - core._PY_, 0));
+ core.bigmap.offsetX = core.clamp(
+ (x - core._HALF_WIDTH_) * 32 + offset.x,
+ 0,
+ Math.max(32 * core.bigmap.width - core._PX_, 0)
+ );
+ core.bigmap.offsetY = core.clamp(
+ (y - core._HALF_HEIGHT_) * 32 + offset.y,
+ 0,
+ Math.max(32 * core.bigmap.height - core._PY_, 0)
+ );
core.control.updateViewport();
-}
+};
-control.prototype._drawHero_draw = function (direction, x, y, status, offset, frame) {
+control.prototype._drawHero_draw = function (
+ direction,
+ x,
+ y,
+ status,
+ offset,
+ frame
+) {
offset = offset || { x: 0, y: 0, offset: 0, px: 0, py: 0 };
- var opacity = core.setAlpha('hero', core.getFlag('__heroOpacity__', 1))
- this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
- core.drawImage('hero', block.img, (block.heroIcon[block.status] + (frame || 0)) % 4 * block.width,
- block.heroIcon.loc * block.height, block.width, block.height,
- block.posx + (32 - block.width) / 2, block.posy + 32 - block.height, block.width, block.height);
- });
+ var opacity = core.setAlpha('hero', core.getFlag('__heroOpacity__', 1));
+ this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(
+ function (block) {
+ core.drawImage(
+ 'hero',
+ block.img,
+ ((block.heroIcon[block.status] + (frame || 0)) % 4) *
+ block.width,
+ block.heroIcon.loc * block.height,
+ block.width,
+ block.height,
+ block.posx + (32 - block.width) / 2,
+ block.posy + 32 - block.height,
+ block.width,
+ block.height
+ );
+ }
+ );
core.setAlpha('hero', opacity);
-}
+};
-control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, offset) {
- var heroIconArr = core.material.icons.hero, drawObjs = [], index = 0;
+control.prototype._drawHero_getDrawObjs = function (
+ direction,
+ x,
+ y,
+ status,
+ offset
+) {
+ var heroIconArr = core.material.icons.hero,
+ drawObjs = [],
+ index = 0;
drawObjs.push({
- "img": core.material.images.hero,
- "width": core.material.icons.hero.width || 32,
- "height": core.material.icons.hero.height,
- "heroIcon": heroIconArr[direction],
- "posx": x * 32 - core.bigmap.offsetX + offset.x,
- "posy": y * 32 - core.bigmap.offsetY + offset.y,
- "status": status,
- "index": index++,
+ img: core.material.images.hero,
+ width: core.material.icons.hero.width || 32,
+ height: core.material.icons.hero.height,
+ heroIcon: heroIconArr[direction],
+ posx: x * 32 - core.bigmap.offsetX + offset.x,
+ posy: y * 32 - core.bigmap.offsetY + offset.y,
+ status: status,
+ index: index++
});
if (typeof offset.offset == 'number') {
core.status.hero.followers.forEach(function (t) {
drawObjs.push({
- "img": core.material.images.images[t.name],
- "width": core.material.images.images[t.name].width / 4,
- "height": core.material.images.images[t.name].height / 4,
- "heroIcon": heroIconArr[t.direction],
- "posx": 32 * t.x - core.bigmap.offsetX + (t.stop ? 0 : core.utils.scan2[t.direction].x * Math.abs(offset.offset)),
- "posy": 32 * t.y - core.bigmap.offsetY + (t.stop ? 0 : core.utils.scan2[t.direction].y * Math.abs(offset.offset)),
- "status": t.stop ? "stop" : status,
- "index": index++
+ img: core.material.images.images[t.name],
+ width: core.material.images.images[t.name].width / 4,
+ height: core.material.images.images[t.name].height / 4,
+ heroIcon: heroIconArr[t.direction],
+ posx:
+ 32 * t.x -
+ core.bigmap.offsetX +
+ (t.stop
+ ? 0
+ : core.utils.scan2[t.direction].x *
+ Math.abs(offset.offset)),
+ posy:
+ 32 * t.y -
+ core.bigmap.offsetY +
+ (t.stop
+ ? 0
+ : core.utils.scan2[t.direction].y *
+ Math.abs(offset.offset)),
+ status: t.stop ? 'stop' : status,
+ index: index++
});
});
}
return drawObjs.sort(function (a, b) {
return a.posy == b.posy ? b.index - a.index : a.posy - b.posy;
});
-}
+};
-control.prototype.setHeroOpacity = function (opacity, moveMode, time, callback) {
+control.prototype.setHeroOpacity = function (
+ opacity,
+ moveMode,
+ time,
+ callback
+) {
time = time || 0;
if (time == 0) {
core.setFlag('__heroOpacity__', opacity);
@@ -893,16 +1176,20 @@ control.prototype.setHeroOpacity = function (opacity, moveMode, time, callback)
if (callback) callback();
return;
}
- time /= Math.max(core.status.replay.speed, 1)
+ time /= Math.max(core.status.replay.speed, 1);
var fromOpacity = core.getFlag('__heroOpacity__', 1);
- var step = 0, steps = parseInt(time / 10);
+ var step = 0,
+ steps = parseInt(time / 10);
if (steps <= 0) steps = 1;
var moveFunc = core.applyEasing(moveMode);
var animate = setInterval(function () {
step++;
- core.setFlag('__heroOpacity__', fromOpacity + (opacity - fromOpacity) * moveFunc(step / steps));
+ core.setFlag(
+ '__heroOpacity__',
+ fromOpacity + (opacity - fromOpacity) * moveFunc(step / steps)
+ );
core.drawHero();
if (step == steps) {
delete core.animateFrame.asyncId[animate];
@@ -913,7 +1200,7 @@ control.prototype.setHeroOpacity = function (opacity, moveMode, time, callback)
core.animateFrame.lastAsyncId = animate;
core.animateFrame.asyncId[animate] = callback;
-}
+};
// ------ 画布、位置、阻激夹域,显伤 ------ //
@@ -927,23 +1214,44 @@ control.prototype.setGameCanvasTranslate = function (canvas, x, y) {
c.style.OTransform = 'translate(' + x + 'px,' + y + 'px)';
c.style.MozTransform = 'translate(' + x + 'px,' + y + 'px)';
if (main.mode === 'editor' && editor.isMobile) {
- c.style.transform = 'translate(' + (x / core._PX_ * 96) + 'vw,' + (y / core._PY_ * 96) + 'vw)';
- c.style.webkitTransform = 'translate(' + (x / core._PX_ * 96) + 'vw,' + (y / core._PY_ * 96) + 'vw)';
- c.style.OTransform = 'translate(' + (x / core._PX_ * 96) + 'vw,' + (y / core._PY_ * 96) + 'vw)';
- c.style.MozTransform = 'translate(' + (x / core._PX_ * 96) + 'vw,' + (y / core._PY_ * 96) + 'vw)';
+ c.style.transform =
+ 'translate(' +
+ (x / core._PX_) * 96 +
+ 'vw,' +
+ (y / core._PY_) * 96 +
+ 'vw)';
+ c.style.webkitTransform =
+ 'translate(' +
+ (x / core._PX_) * 96 +
+ 'vw,' +
+ (y / core._PY_) * 96 +
+ 'vw)';
+ c.style.OTransform =
+ 'translate(' +
+ (x / core._PX_) * 96 +
+ 'vw,' +
+ (y / core._PY_) * 96 +
+ 'vw)';
+ c.style.MozTransform =
+ 'translate(' +
+ (x / core._PX_) * 96 +
+ 'vw,' +
+ (y / core._PY_) * 96 +
+ 'vw)';
}
};
////// 加减画布偏移
control.prototype.addGameCanvasTranslate = function (x, y) {
- for (var ii = 0, canvas; canvas = core.dom.gameCanvas[ii]; ii++) {
+ for (var ii = 0, canvas; (canvas = core.dom.gameCanvas[ii]); ii++) {
var id = canvas.getAttribute('id');
if (id == 'ui' || id == 'data') continue; // UI层和data层不移动
- var offsetX = x, offsetY = y;
+ var offsetX = x,
+ offsetY = y;
if (core.bigmap.canvas.indexOf(id) >= 0) {
if (core.bigmap.v2) {
- offsetX -= (core.bigmap.offsetX - 32 * core.bigmap.posX) + 32;
- offsetY -= (core.bigmap.offsetY - 32 * core.bigmap.posY) + 32;
+ offsetX -= core.bigmap.offsetX - 32 * core.bigmap.posX + 32;
+ offsetY -= core.bigmap.offsetY - 32 * core.bigmap.posY + 32;
} else {
offsetX -= core.bigmap.offsetX;
offsetY -= core.bigmap.offsetY;
@@ -951,16 +1259,18 @@ control.prototype.addGameCanvasTranslate = function (x, y) {
}
core.control.setGameCanvasTranslate(id, offsetX, offsetY);
}
-}
+};
////// 更新视野范围 //////
control.prototype.updateViewport = function () {
// 当前是否应该重绘?
if (core.bigmap.v2) {
- if (core.bigmap.offsetX >= core.bigmap.posX * 32 + 32
- || core.bigmap.offsetX <= core.bigmap.posX * 32 - 32
- || core.bigmap.offsetY >= core.bigmap.posY * 32 + 32
- || core.bigmap.offsetY <= core.bigmap.posY * 32 - 32) {
+ if (
+ core.bigmap.offsetX >= core.bigmap.posX * 32 + 32 ||
+ core.bigmap.offsetX <= core.bigmap.posX * 32 - 32 ||
+ core.bigmap.offsetY >= core.bigmap.posY * 32 + 32 ||
+ core.bigmap.offsetY <= core.bigmap.posY * 32 - 32
+ ) {
core.bigmap.posX = parseInt(core.bigmap.offsetX / 32);
core.bigmap.posY = parseInt(core.bigmap.offsetY / 32);
core.redrawMap();
@@ -968,32 +1278,48 @@ control.prototype.updateViewport = function () {
} else {
core.bigmap.posX = core.bigmap.posY = 0;
}
- var offsetX = core.bigmap.v2 ? -(core.bigmap.offsetX - 32 * core.bigmap.posX) - 32 : -core.bigmap.offsetX;
- var offsetY = core.bigmap.v2 ? -(core.bigmap.offsetY - 32 * core.bigmap.posY) - 32 : -core.bigmap.offsetY;
+ var offsetX = core.bigmap.v2
+ ? -(core.bigmap.offsetX - 32 * core.bigmap.posX) - 32
+ : -core.bigmap.offsetX;
+ var offsetY = core.bigmap.v2
+ ? -(core.bigmap.offsetY - 32 * core.bigmap.posY) - 32
+ : -core.bigmap.offsetY;
core.bigmap.canvas.forEach(function (cn) {
core.control.setGameCanvasTranslate(cn, offsetX, offsetY);
});
// ------ 路线
- core.relocateCanvas('route', core.status.automaticRoute.offsetX - core.bigmap.offsetX, core.status.automaticRoute.offsetY - core.bigmap.offsetY);
+ core.relocateCanvas(
+ 'route',
+ core.status.automaticRoute.offsetX - core.bigmap.offsetX,
+ core.status.automaticRoute.offsetY - core.bigmap.offsetY
+ );
// ------ 所有的大怪物也都需要重定位
for (var one in core.dymCanvas) {
if (one.startsWith('_bigImage_')) {
var ox = core.dymCanvas[one].canvas.getAttribute('_ox');
var oy = core.dymCanvas[one].canvas.getAttribute('_oy');
if (ox != null && oy != null) {
- core.relocateCanvas(one, parseInt(ox) - core.bigmap.offsetX, parseInt(oy) - core.bigmap.offsetY);
+ core.relocateCanvas(
+ one,
+ parseInt(ox) - core.bigmap.offsetX,
+ parseInt(oy) - core.bigmap.offsetY
+ );
}
}
}
-
-}
+};
////// 设置视野范围 //////
control.prototype.setViewport = function (px, py) {
- var originOffsetX = core.bigmap.offsetX, originOffsetY = core.bigmap.offsetY;
+ var originOffsetX = core.bigmap.offsetX,
+ originOffsetY = core.bigmap.offsetY;
core.bigmap.offsetX = core.clamp(px, 0, 32 * core.bigmap.width - core._PX_);
- core.bigmap.offsetY = core.clamp(py, 0, 32 * core.bigmap.height - core._PY_);
+ core.bigmap.offsetY = core.clamp(
+ py,
+ 0,
+ 32 * core.bigmap.height - core._PY_
+ );
this.updateViewport();
// ------ hero层也需要!
var px = parseFloat(core.canvas.hero._px) || 0;
@@ -1003,13 +1329,15 @@ control.prototype.setViewport = function (px, py) {
core.control.setGameCanvasTranslate('hero', px, py);
core.canvas.hero._px = px;
core.canvas.hero._py = py;
-}
+};
////// 移动视野范围 //////
control.prototype.moveViewport = function (x, y, moveMode, time, callback) {
time = time || 0;
- time /= Math.max(core.status.replay.speed, 1)
- var per_time = 10, step = 0, steps = parseInt(time / per_time);
+ time /= Math.max(core.status.replay.speed, 1);
+ var per_time = 10,
+ step = 0,
+ steps = parseInt(time / per_time);
if (steps <= 0) {
this.setViewport(32 * x, 32 * y);
if (callback) callback();
@@ -1023,7 +1351,10 @@ control.prototype.moveViewport = function (x, y, moveMode, time, callback) {
var animate = window.setInterval(function () {
step++;
- core.setViewport(cx + moveFunc(step / steps) * (px - cx), cy + moveFunc(step / steps) * (py - cy));
+ core.setViewport(
+ cx + moveFunc(step / steps) * (px - cx),
+ cy + moveFunc(step / steps) * (py - cy)
+ );
if (step == steps) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
@@ -1034,36 +1365,48 @@ control.prototype.moveViewport = function (x, y, moveMode, time, callback) {
core.animateFrame.lastAsyncId = animate;
core.animateFrame.asyncId[animate] = callback;
-}
+};
////// 获得勇士面对位置的x坐标 //////
control.prototype.nextX = function (n) {
if (n == null) n = 1;
- return core.getHeroLoc('x') + core.utils.scan[core.getHeroLoc('direction')].x * n;
-}
+ return (
+ core.getHeroLoc('x') +
+ core.utils.scan[core.getHeroLoc('direction')].x * n
+ );
+};
////// 获得勇士面对位置的y坐标 //////
control.prototype.nextY = function (n) {
if (n == null) n = 1;
- return core.getHeroLoc('y') + core.utils.scan[core.getHeroLoc('direction')].y * n;
-}
+ return (
+ core.getHeroLoc('y') +
+ core.utils.scan[core.getHeroLoc('direction')].y * n
+ );
+};
////// 某个点是否在勇士旁边 //////
control.prototype.nearHero = function (x, y, n) {
if (n == null) n = 1;
- return Math.abs(x - core.getHeroLoc('x')) + Math.abs(y - core.getHeroLoc('y')) <= n;
-}
+ return (
+ Math.abs(x - core.getHeroLoc('x')) +
+ Math.abs(y - core.getHeroLoc('y')) <=
+ n
+ );
+};
////// 聚集跟随者 //////
control.prototype.gatherFollowers = function () {
- var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), dir = core.getHeroLoc('direction');
+ var x = core.getHeroLoc('x'),
+ y = core.getHeroLoc('y'),
+ dir = core.getHeroLoc('direction');
core.status.hero.followers.forEach(function (t) {
t.x = x;
t.y = y;
t.stop = true;
t.direction = dir;
});
-}
+};
////// 更新跟随者坐标 //////
control.prototype.updateFollowers = function () {
@@ -1072,28 +1415,36 @@ control.prototype.updateFollowers = function () {
t.x += core.utils.scan2[t.direction].x;
t.y += core.utils.scan2[t.direction].y;
}
- })
+ });
- var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
+ var nowx = core.getHeroLoc('x'),
+ nowy = core.getHeroLoc('y');
core.status.hero.followers.forEach(function (t) {
t.stop = true;
- var dx = nowx - t.x, dy = nowy - t.y;
+ var dx = nowx - t.x,
+ dy = nowy - t.y;
for (var dir in core.utils.scan2) {
- if (core.utils.scan2[dir].x == dx && core.utils.scan2[dir].y == dy) {
+ if (
+ core.utils.scan2[dir].x == dx &&
+ core.utils.scan2[dir].y == dy
+ ) {
t.stop = false;
t.direction = dir;
}
}
- nowx = t.x; nowy = t.y;
- })
-}
+ nowx = t.x;
+ nowy = t.y;
+ });
+};
////// 瞬移更新跟随者坐标 //////
control.prototype._moveDirectyFollowers = function (x, y) {
var route = core.automaticRoute(x, y);
- if (route.length == 0) route = [{ x: x, y: y, direction: core.getHeroLoc('direction') }];
+ if (route.length == 0)
+ route = [{ x: x, y: y, direction: core.getHeroLoc('direction') }];
- var nowx = x, nowy = y;
+ var nowx = x,
+ nowy = y;
for (var i = 0; i < core.status.hero.followers.length; ++i) {
var t = core.status.hero.followers[i];
var index = route.length - i - 2;
@@ -1102,31 +1453,40 @@ control.prototype._moveDirectyFollowers = function (x, y) {
t.x = route[index].x;
t.y = route[index].y;
t.direction = route[index].direction;
- var dx = nowx - t.x, dy = nowy - t.y;
+ var dx = nowx - t.x,
+ dy = nowy - t.y;
for (var dir in core.utils.scan2) {
- if (core.utils.scan2[dir].x == dx && core.utils.scan2[dir].y == dy) {
+ if (
+ core.utils.scan2[dir].x == dx &&
+ core.utils.scan2[dir].y == dy
+ ) {
t.stop = false;
t.direction = dir;
}
}
- nowx = t.x; nowy = t.y;
+ nowx = t.x;
+ nowy = t.y;
}
-}
+};
////// 更新领域、夹击、阻击的伤害地图 //////
control.prototype.updateCheckBlock = function (floorId) {
return this.controldata.updateCheckBlock(floorId);
-}
+};
////// 检查并执行领域、夹击、阻击事件 //////
control.prototype.checkBlock = function () {
- var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), loc = x + "," + y;
+ var x = core.getHeroLoc('x'),
+ y = core.getHeroLoc('y'),
+ loc = x + ',' + y;
var damage = core.status.checkBlock.damage[loc];
if (damage) {
core.status.hero.hp -= damage;
- var text = (Object.keys(core.status.checkBlock.type[loc] || {}).join(",")) || "伤害";
- core.drawTip("受到" + text + damage + "点");
- core.drawHeroAnimate("zone");
+ var text =
+ Object.keys(core.status.checkBlock.type[loc] || {}).join(',') ||
+ '伤害';
+ core.drawTip('受到' + text + damage + '点');
+ core.drawHeroAnimate('zone');
this._checkBlock_disableQuickShop();
core.status.hero.statistics.extraDamage += damage;
if (core.status.hero.hp <= 0) {
@@ -1140,7 +1500,7 @@ control.prototype.checkBlock = function () {
}
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
-}
+};
control.prototype._checkBlock_disableQuickShop = function () {
// 禁用快捷商店
@@ -1149,18 +1509,25 @@ control.prototype._checkBlock_disableQuickShop = function () {
core.setShopVisited(shopId, false);
});
}
-}
+};
////// 阻击 //////
control.prototype._checkBlock_repulse = function (repulse) {
if (!repulse || repulse.length == 0) return;
var actions = [];
repulse.forEach(function (t) {
- actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 250, "keep": true, "async": true });
+ actions.push({
+ type: 'move',
+ loc: [t[0], t[1]],
+ steps: [t[3]],
+ time: 250,
+ keep: true,
+ async: true
+ });
});
- actions.push({ "type": "waitAsync" });
+ actions.push({ type: 'waitAsync' });
core.insertAction(actions);
-}
+};
////// 捕捉 //////
control.prototype._checkBlock_ambush = function (ambush) {
@@ -1168,19 +1535,35 @@ control.prototype._checkBlock_ambush = function (ambush) {
// 捕捉效果
var actions = [];
ambush.forEach(function (t) {
- actions.push({ "type": "move", "loc": [t[0], t[1]], "steps": [t[3]], "time": 250, "keep": false, "async": true });
+ actions.push({
+ type: 'move',
+ loc: [t[0], t[1]],
+ steps: [t[3]],
+ time: 250,
+ keep: false,
+ async: true
+ });
});
- actions.push({ "type": "waitAsync" });
+ actions.push({ type: 'waitAsync' });
// 强制战斗
ambush.forEach(function (t) {
actions.push({
- "type": "function", "function": "function() { " +
- "core.battle('" + t[2] + "', " + t[0] + "," + t[1] + ", true, core.doAction); " +
- "}", "async": true
+ type: 'function',
+ function:
+ 'function() { ' +
+ "core.battle('" +
+ t[2] +
+ "', " +
+ t[0] +
+ ',' +
+ t[1] +
+ ', true, core.doAction); ' +
+ '}',
+ async: true
});
});
core.insertAction(actions);
-}
+};
////// 更新全地图显伤 //////
control.prototype.updateDamage = function (floorId, ctx) {
@@ -1193,55 +1576,106 @@ control.prototype.updateDamage = function (floorId, ctx) {
core.status.damage.posX = core.bigmap.posX;
core.status.damage.posY = core.bigmap.posY;
if (!onMap) {
- var width = core.floors[floorId].width, height = core.floors[floorId].height;
+ var width = core.floors[floorId].width,
+ height = core.floors[floorId].height;
// 地图过大的缩略图不绘制显伤
if (width * height > core.bigmap.threshold) return;
}
this._updateDamage_damage(floorId, onMap);
this._updateDamage_extraDamage(floorId, onMap);
this.drawDamage(ctx);
-}
+};
control.prototype._updateDamage_damage = function (floorId, onMap) {
core.status.damage.data = [];
- if (!core.flags.displayEnemyDamage && !core.flags.displayExtraDamage) return;
+ if (!core.flags.displayEnemyDamage && !core.flags.displayExtraDamage)
+ return;
core.extractBlocks(floorId);
core.status.maps[floorId].blocks.forEach(function (block) {
- var x = block.x, y = block.y;
+ var x = block.x,
+ y = block.y;
// v2优化,只绘制范围内的部分
if (onMap && core.bigmap.v2) {
- if (x < core.bigmap.posX - core.bigmap.extend || x > core.bigmap.posX + core._WIDTH_ + core.bigmap.extend
- || y < core.bigmap.posY - core.bigmap.extend || y > core.bigmap.posY + core._HEIGHT_ + core.bigmap.extend) {
+ if (
+ x < core.bigmap.posX - core.bigmap.extend ||
+ x > core.bigmap.posX + core._WIDTH_ + core.bigmap.extend ||
+ y < core.bigmap.posY - core.bigmap.extend ||
+ y > core.bigmap.posY + core._HEIGHT_ + core.bigmap.extend
+ ) {
return;
}
}
- if (!block.disable && block.event.cls.indexOf('enemy') == 0 && block.event.displayDamage !== false) {
+ if (
+ !block.disable &&
+ block.event.cls.indexOf('enemy') == 0 &&
+ block.event.displayDamage !== false
+ ) {
if (core.flags.displayEnemyDamage) {
- var damageString = core.enemys.getDamageString(block.event.id, x, y, floorId);
- core.status.damage.data.push({ text: damageString.damage, px: 32 * x + 1, py: 32 * (y + 1) - 1, color: damageString.color });
+ var damageString = core.enemys.getDamageString(
+ block.event.id,
+ x,
+ y,
+ floorId
+ );
+ core.status.damage.data.push({
+ text: damageString.damage,
+ px: 32 * x + 1,
+ py: 32 * (y + 1) - 1,
+ color: damageString.color
+ });
}
if (core.flags.displayCritical) {
- var critical = core.enemys.nextCriticals(block.event.id, 1, x, y, floorId);
+ var critical = core.enemys.nextCriticals(
+ block.event.id,
+ 1,
+ x,
+ y,
+ floorId
+ );
critical = core.formatBigNumber((critical[0] || [])[0], true);
if (critical == '???') critical = '?';
- core.status.damage.data.push({ text: critical, px: 32 * x + 1, py: 32 * (y + 1) - 11, color: '#FFFFFF' });
+ core.status.damage.data.push({
+ text: critical,
+ px: 32 * x + 1,
+ py: 32 * (y + 1) - 11,
+ color: '#FFFFFF'
+ });
}
}
});
-}
+};
control.prototype._updateDamage_extraDamage = function (floorId, onMap) {
core.status.damage.extraData = [];
if (!core.flags.displayExtraDamage) return;
- var width = core.floors[floorId].width, height = core.floors[floorId].height;
- var startX = onMap && core.bigmap.v2 ? Math.max(0, core.bigmap.posX - core.bigmap.extend) : 0;
- var endX = onMap && core.bigmap.v2 ? Math.min(width, core.bigmap.posX + core._WIDTH_ + core.bigmap.extend + 1) : width;
- var startY = onMap && core.bigmap.v2 ? Math.max(0, core.bigmap.posY - core.bigmap.extend) : 0;
- var endY = onMap && core.bigmap.v2 ? Math.min(height, core.bigmap.posY + core._HEIGHT_ + core.bigmap.extend + 1) : height;
+ var width = core.floors[floorId].width,
+ height = core.floors[floorId].height;
+ var startX =
+ onMap && core.bigmap.v2
+ ? Math.max(0, core.bigmap.posX - core.bigmap.extend)
+ : 0;
+ var endX =
+ onMap && core.bigmap.v2
+ ? Math.min(
+ width,
+ core.bigmap.posX + core._WIDTH_ + core.bigmap.extend + 1
+ )
+ : width;
+ var startY =
+ onMap && core.bigmap.v2
+ ? Math.max(0, core.bigmap.posY - core.bigmap.extend)
+ : 0;
+ var endY =
+ onMap && core.bigmap.v2
+ ? Math.min(
+ height,
+ core.bigmap.posY + core._HEIGHT_ + core.bigmap.extend + 1
+ )
+ : height;
for (var x = startX; x < endX; x++) {
for (var y = startY; y < endY; y++) {
@@ -1250,23 +1684,37 @@ control.prototype._updateDamage_extraDamage = function (floorId, onMap) {
if (core.flags.extraDamageType == 2) alpha = 0;
else if (core.flags.extraDamageType == 1) alpha = 0.6;
}
- var damage = core.status.checkBlock.damage[x + "," + y] || 0;
- if (damage > 0) { // 该点伤害
+ var damage = core.status.checkBlock.damage[x + ',' + y] || 0;
+ if (damage > 0) {
+ // 该点伤害
damage = core.formatBigNumber(damage, true);
- core.status.damage.extraData.push({ text: damage, px: 32 * x + 16, py: 32 * (y + 1) - 14, color: '#ffaa33', alpha: alpha });
- }
- else { // 检查捕捉
- if (core.status.checkBlock.ambush[x + "," + y]) {
- core.status.damage.extraData.push({ text: '!', px: 32 * x + 16, py: 32 * (y + 1) - 14, color: '#ffaa33', alpha: alpha });
+ core.status.damage.extraData.push({
+ text: damage,
+ px: 32 * x + 16,
+ py: 32 * (y + 1) - 14,
+ color: '#ffaa33',
+ alpha: alpha
+ });
+ } else {
+ // 检查捕捉
+ if (core.status.checkBlock.ambush[x + ',' + y]) {
+ core.status.damage.extraData.push({
+ text: '!',
+ px: 32 * x + 16,
+ py: 32 * (y + 1) - 14,
+ color: '#ffaa33',
+ alpha: alpha
+ });
}
}
}
}
-}
+};
////// 重绘地图显伤 //////
control.prototype.drawDamage = function (ctx) {
- if (core.status.gameOver || !core.status.damage || main.mode != 'play') return;
+ if (core.status.gameOver || !core.status.damage || main.mode != 'play')
+ return;
var onMap = false;
if (ctx == null) {
ctx = core.canvas.damage;
@@ -1276,25 +1724,35 @@ control.prototype.drawDamage = function (ctx) {
if (onMap && core.bigmap.v2) {
// 检查是否需要重算...
- if (Math.abs(core.bigmap.posX - core.status.damage.posX) >= core.bigmap.extend - 1
- || Math.abs(core.bigmap.posY - core.status.damage.posY) >= core.bigmap.extend - 1) {
+ if (
+ Math.abs(core.bigmap.posX - core.status.damage.posX) >=
+ core.bigmap.extend - 1 ||
+ Math.abs(core.bigmap.posY - core.status.damage.posY) >=
+ core.bigmap.extend - 1
+ ) {
return this.updateDamage();
}
}
return this._drawDamage_draw(ctx, onMap);
-}
+};
control.prototype._drawDamage_draw = function (ctx, onMap) {
if (!core.hasItem('book')) return;
- core.setFont(ctx, "bold 11px Arial");
+ core.setFont(ctx, 'bold 11px Arial');
core.setTextAlign(ctx, 'left');
core.status.damage.data.forEach(function (one) {
- var px = one.px, py = one.py;
+ var px = one.px,
+ py = one.py;
if (onMap && core.bigmap.v2) {
px -= core.bigmap.posX * 32;
py -= core.bigmap.posY * 32;
- if (px < -32 * 2 || px > core._PX_ + 32 || py < -32 || py > core._PY_ + 32)
+ if (
+ px < -32 * 2 ||
+ px > core._PX_ + 32 ||
+ py < -32 ||
+ py > core._PY_ + 32
+ )
return;
}
core.fillBoldText(ctx, one.text, px, py, one.color);
@@ -1302,36 +1760,54 @@ control.prototype._drawDamage_draw = function (ctx, onMap) {
core.setTextAlign(ctx, 'center');
core.status.damage.extraData.forEach(function (one) {
- var px = one.px, py = one.py;
+ var px = one.px,
+ py = one.py;
if (onMap && core.bigmap.v2) {
px -= core.bigmap.posX * 32;
py -= core.bigmap.posY * 32;
- if (px < -32 || px > core._PX_ + 32 || py < -32 || py > core._PY_ + 32)
+ if (
+ px < -32 ||
+ px > core._PX_ + 32 ||
+ py < -32 ||
+ py > core._PY_ + 32
+ )
return;
}
var alpha = core.setAlpha(ctx, one.alpha);
core.fillBoldText(ctx, one.text, px, py, one.color);
core.setAlpha(ctx, alpha);
});
-}
+};
// ------ 录像相关 ------ //
////// 选择录像文件 //////
control.prototype.chooseReplayFile = function () {
- core.readFile(function (obj) {
- if (obj.name != core.firstData.name) return alert("存档和游戏不一致!");
- if (!obj.route) return alert("无效的录像!");
- var _replay = function () {
- core.startGame(core.flags.startUsingCanvas ? '' : obj.hard || '', obj.seed, core.decodeRoute(obj.route));
- }
- if (obj.version && obj.version != core.firstData.version) {
- core.myconfirm("游戏版本不一致!\n你仍然想播放录像吗?", _replay);
- return;
- }
- _replay();
- }, null, ".h5route");
-}
+ core.readFile(
+ function (obj) {
+ if (obj.name != core.firstData.name)
+ return alert('存档和游戏不一致!');
+ if (!obj.route) return alert('无效的录像!');
+ var _replay = function () {
+ core.startGame(
+ core.flags.startUsingCanvas ? '' : obj.hard || '',
+ obj.seed,
+ core.decodeRoute(obj.route)
+ );
+ };
+ if (obj.version && obj.version != core.firstData.version) {
+ core.myconfirm(
+ '游戏版本不一致!\n你仍然想播放录像吗?',
+ _replay
+ );
+ return;
+ }
+ _replay();
+ },
+ null,
+ '.h5route'
+ );
+};
////// 开始播放 //////
control.prototype.startReplay = function (list) {
@@ -1348,50 +1824,50 @@ control.prototype.startReplay = function (list) {
core.setOpacity('replay', 0.6);
this._replay_drawProgress();
core.updateStatusBar(false, true);
- core.drawTip("开始播放");
+ core.drawTip('开始播放');
this.replay();
-}
+};
////// 更改播放状态 //////
control.prototype.triggerReplay = function () {
if (core.status.replay.pausing) this.resumeReplay();
else this.pauseReplay();
-}
+};
////// 暂停播放 //////
control.prototype.pauseReplay = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
core.status.replay.pausing = true;
core.updateStatusBar(false, true);
- core.drawTip("暂停播放");
-}
+ core.drawTip('暂停播放');
+};
////// 恢复播放 //////
control.prototype.resumeReplay = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
core.status.replay.pausing = false;
core.updateStatusBar(false, true);
- core.drawTip("恢复播放");
+ core.drawTip('恢复播放');
core.replay();
-}
+};
////// 单步播放 //////
control.prototype.stepReplay = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
core.replay(true);
-}
+};
////// 加速播放 //////
control.prototype.speedUpReplay = function () {
@@ -1403,8 +1879,8 @@ control.prototype.speedUpReplay = function () {
break;
}
}
- core.drawTip("x" + core.status.replay.speed + "倍");
-}
+ core.drawTip('x' + core.status.replay.speed + '倍');
+};
////// 减速播放 //////
control.prototype.speedDownReplay = function () {
@@ -1416,15 +1892,15 @@ control.prototype.speedDownReplay = function () {
break;
}
}
- core.drawTip("x" + core.status.replay.speed + "倍");
-}
+ core.drawTip('x' + core.status.replay.speed + '倍');
+};
////// 设置播放速度 //////
control.prototype.setReplaySpeed = function (speed) {
if (!core.isPlaying() || !core.isReplaying()) return;
core.status.replay.speed = speed;
- core.drawTip("x" + core.status.replay.speed + "倍");
-}
+ core.drawTip('x' + core.status.replay.speed + '倍');
+};
////// 停止播放 //////
control.prototype.stopReplay = function (force) {
@@ -1440,55 +1916,56 @@ control.prototype.stopReplay = function (force) {
core.status.replay.save = [];
core.deleteCanvas('replay');
core.updateStatusBar(false, true);
- core.drawTip("停止播放并恢复游戏");
-}
+ core.drawTip('停止播放并恢复游戏');
+};
////// 回退 //////
control.prototype.rewindReplay = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
if (core.status.replay.save.length == 0) {
core.playSound('操作失败');
- return core.drawTip("无法再回到上一个节点");
+ return core.drawTip('无法再回到上一个节点');
}
- var save = core.status.replay.save, data = save.pop();
+ var save = core.status.replay.save,
+ data = save.pop();
core.loadData(data.data, function () {
core.removeFlag('__fromLoad__');
core.status.replay = {
- "replaying": true,
- "pausing": true,
- "animate": false,
- "toReplay": data.replay.toReplay,
- "totalList": data.replay.totalList,
- "speed": core.status.replay.speed,
- "steps": data.replay.steps,
- "save": save
- }
+ replaying: true,
+ pausing: true,
+ animate: false,
+ toReplay: data.replay.toReplay,
+ totalList: data.replay.totalList,
+ speed: core.status.replay.speed,
+ steps: data.replay.steps,
+ save: save
+ };
core.createCanvas('replay', 0, core._PY_ - 40, core._PX_, 40, 199);
core.setOpacity('replay', 0.6);
core.control._replay_drawProgress();
core.updateStatusBar(false, true);
- core.drawTip("成功回退到上一个节点");
+ core.drawTip('成功回退到上一个节点');
});
-}
+};
////// 回放时存档 //////
control.prototype._replay_SL = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
if (core.hasFlag('__forbidSave__')) {
core.playSound('操作失败');
@@ -1499,25 +1976,33 @@ control.prototype._replay_SL = function () {
core.lockControl();
core.status.event.id = 'save';
var saveIndex = core.saves.saveIndex;
- var page = parseInt((saveIndex - 1) / 5), offset = saveIndex - 5 * page;
+ var page = parseInt((saveIndex - 1) / 5),
+ offset = saveIndex - 5 * page;
core.ui._drawSLPanel(10 * page + offset);
-}
+};
////// 回放时查看怪物手册 //////
control.prototype._replay_book = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
- if (core.isMoving() || core.status.replay.animate || (core.status.event.id && core.status.event.id != 'viewMaps')) {
+ if (
+ core.isMoving() ||
+ core.status.replay.animate ||
+ (core.status.event.id && core.status.event.id != 'viewMaps')
+ ) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
if (!core.hasItem('book')) {
core.playSound('操作失败');
- return core.drawTip('你没有' + core.material.items['book'].name, 'book');
+ return core.drawTip(
+ '你没有' + core.material.items['book'].name,
+ 'book'
+ );
}
this._replay_hideProgress();
@@ -1528,78 +2013,83 @@ control.prototype._replay_book = function () {
core.lockControl();
core.status.event.id = 'book';
core.useItem('book', true);
-}
+};
////// 回放录像时浏览地图 //////
control.prototype._replay_viewMap = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
this._replay_hideProgress();
core.lockControl();
core.status.event.id = 'viewMaps';
core.ui._drawViewMaps();
-}
+};
control.prototype._replay_toolbox = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
this._replay_hideProgress();
core.lockControl();
core.status.event.id = 'toolbox';
core.ui._drawToolbox();
-}
+};
control.prototype._replay_equipbox = function () {
if (!core.isPlaying() || !core.isReplaying()) return;
if (!core.status.replay.pausing) {
core.playSound('操作失败');
- return core.drawTip("请先暂停录像");
+ return core.drawTip('请先暂停录像');
}
if (core.isMoving() || core.status.replay.animate || core.status.event.id) {
core.playSound('操作失败');
- return core.drawTip("请等待当前事件的处理结束");
+ return core.drawTip('请等待当前事件的处理结束');
}
this._replay_hideProgress();
core.lockControl();
core.status.event.id = 'equipbox';
core.ui._drawEquipbox();
-}
+};
////// 是否正在播放录像 //////
control.prototype.isReplaying = function () {
return (core.status.replay || {}).replaying;
-}
+};
////// 回放 //////
control.prototype.replay = function (force) {
- if (!core.isPlaying() || !core.isReplaying()
- || core.status.replay.animate || core.status.event.id || core.status.replay.failed) return;
+ if (
+ !core.isPlaying() ||
+ !core.isReplaying() ||
+ core.status.replay.animate ||
+ core.status.event.id ||
+ core.status.replay.failed
+ )
+ return;
if (core.status.replay.pausing && !force) return;
this._replay_drawProgress();
- if (core.status.replay.toReplay.length == 0)
- return this._replay_finished();
+ if (core.status.replay.toReplay.length == 0) return this._replay_finished();
this._replay_save();
var action = core.status.replay.toReplay.shift();
if (this._doReplayAction(action)) return;
this._replay_error(action);
-}
+};
////// 注册一个录像行为 //////
// name:自定义名称,可用于注销使用
@@ -1609,45 +2099,59 @@ control.prototype.replay = function (force) {
control.prototype.registerReplayAction = function (name, func) {
this.unregisterReplayAction(name);
this.replayActions.push({ name: name, func: func });
-}
+};
////// 注销一个录像行为 //////
control.prototype.unregisterReplayAction = function (name) {
- this.replayActions = this.replayActions.filter(function (b) { return b.name != name; });
-}
+ this.replayActions = this.replayActions.filter(function (b) {
+ return b.name != name;
+ });
+};
////// 执行录像行为,会在注册的函数中依次执行直到得到true为止 //////
control.prototype._doReplayAction = function (action) {
for (var i in this.replayActions) {
try {
- if (core.doFunc(this.replayActions[i].func, this, action)) return true;
+ if (core.doFunc(this.replayActions[i].func, this, action))
+ return true;
} catch (e) {
console.error(e);
- console.error("ERROR in replayActions[" + this.replayActions[i].name + "]:已自动注销该项。");
+ console.error(
+ 'ERROR in replayActions[' +
+ this.replayActions[i].name +
+ ']:已自动注销该项。'
+ );
core.unregisterReplayAction(this.replayActions[i].name);
}
}
return false;
-}
+};
control.prototype._replay_finished = function () {
core.status.replay.replaying = false;
core.status.replay.failed = false;
core.status.event.selection = 0;
- var str = "录像播放完毕,你想退出播放吗?";
- if (core.status.route.length != core.status.replay.totalList.length
- || core.subarray(core.status.route, core.status.replay.totalList) == null) {
- str = "录像播放完毕,但记录不一致。\n请检查录像播放时的二次记录问题。\n你想退出播放吗?";
+ var str = '录像播放完毕,你想退出播放吗?';
+ if (
+ core.status.route.length != core.status.replay.totalList.length ||
+ core.subarray(core.status.route, core.status.replay.totalList) == null
+ ) {
+ str =
+ '录像播放完毕,但记录不一致。\n请检查录像播放时的二次记录问题。\n你想退出播放吗?';
}
- core.ui.drawConfirmBox(str, function () {
- core.ui.closePanel();
- core.stopReplay(true);
- }, function () {
- core.status.replay.replaying = true;
- core.ui.closePanel();
- core.pauseReplay();
- });
-}
+ core.ui.drawConfirmBox(
+ str,
+ function () {
+ core.ui.closePanel();
+ core.stopReplay(true);
+ },
+ function () {
+ core.status.replay.replaying = true;
+ core.ui.closePanel();
+ core.pauseReplay();
+ }
+ );
+};
control.prototype._replay_save = function () {
core.status.replay.steps++;
@@ -1655,14 +2159,15 @@ control.prototype._replay_save = function () {
if (core.status.replay.save.length == 30)
core.status.replay.save.shift();
core.status.replay.save.push({
- "data": core.saveData(), "replay": {
- "totalList": core.cloneArray(core.status.replay.totalList),
- "toReplay": core.cloneArray(core.status.replay.toReplay),
- "steps": core.status.replay.steps
+ data: core.saveData(),
+ replay: {
+ totalList: core.cloneArray(core.status.replay.totalList),
+ toReplay: core.cloneArray(core.status.replay.toReplay),
+ steps: core.status.replay.steps
}
});
}
-}
+};
control.prototype._replay_error = function (action, callback) {
core.ui.closePanel();
@@ -1671,75 +2176,97 @@ control.prototype._replay_error = function (action, callback) {
var len = core.status.replay.toReplay.length;
var prevList = core.status.replay.totalList.slice(-len - 11, -len - 1);
var nextList = core.status.replay.toReplay.slice(0, 10);
- console.log("录像文件出错,当前操作:" + action);
- console.log("之前的10个操作是:\n" + prevList.toString());
- console.log("接下来10个操作是:\n" + nextList.toString());
- core.ui.drawConfirmBox("录像文件出错,你想回到上个节点吗?", function () {
- core.status.replay.failed = false;
- core.ui.closePanel();
- if (core.status.replay.save.length > 0) {
- core.status.replay.replaying = true;
- core.status.replay.pausing = true;
- core.rewindReplay();
- }
- else {
- core.playSound('操作失败');
+ console.log('录像文件出错,当前操作:' + action);
+ console.log('之前的10个操作是:\n' + prevList.toString());
+ console.log('接下来10个操作是:\n' + nextList.toString());
+ core.ui.drawConfirmBox(
+ '录像文件出错,你想回到上个节点吗?',
+ function () {
+ core.status.replay.failed = false;
+ core.ui.closePanel();
+ if (core.status.replay.save.length > 0) {
+ core.status.replay.replaying = true;
+ core.status.replay.pausing = true;
+ core.rewindReplay();
+ } else {
+ core.playSound('操作失败');
+ core.stopReplay(true);
+ core.drawTip('无法回到上一个节点');
+ if (callback) callback();
+ }
+ },
+ function () {
+ core.status.replay.failed = false;
+ core.ui.closePanel();
core.stopReplay(true);
- core.drawTip("无法回到上一个节点");
if (callback) callback();
}
- }, function () {
- core.status.replay.failed = false;
- core.ui.closePanel();
- core.stopReplay(true);
- if (callback) callback();
- });
-}
+ );
+};
control.prototype._replay_hideProgress = function () {
- if (core.dymCanvas.replay) core.dymCanvas.replay.canvas.style.display = 'none';
-}
+ if (core.dymCanvas.replay)
+ core.dymCanvas.replay.canvas.style.display = 'none';
+};
control.prototype._replay_drawProgress = function () {
if (!core.dymCanvas.replay) return;
- if (core.dymCanvas.replay.canvas.style.display == 'none') core.dymCanvas.replay.canvas.style.display = 'block';
- var total = core.status.replay.totalList.length, left = total - core.status.replay.toReplay.length;
- var content = '播放进度:' + left + ' / ' + total + '(' + (left / total * 100).toFixed(2) + '%)';
- var width = 26 + core.calWidth('replay', content, "16px Arial");
+ if (core.dymCanvas.replay.canvas.style.display == 'none')
+ core.dymCanvas.replay.canvas.style.display = 'block';
+ var total = core.status.replay.totalList.length,
+ left = total - core.status.replay.toReplay.length;
+ var content =
+ '播放进度:' +
+ left +
+ ' / ' +
+ total +
+ '(' +
+ ((left / total) * 100).toFixed(2) +
+ '%)';
+ var width = 26 + core.calWidth('replay', content, '16px Arial');
core.clearMap('replay');
core.fillRect('replay', 0, 0, width, 40, '#000000');
core.fillText('replay', content, 16, 27, '#FFFFFF');
-}
+};
control.prototype.__replay_getTimeout = function () {
if (core.status.replay.speed == 24) return 0;
return 750 / Math.max(1, core.status.replay.speed);
-}
+};
control.prototype._replayAction_move = function (action) {
- if (["up", "down", "left", "right"].indexOf(action) < 0) return false;
+ if (['up', 'down', 'left', 'right'].indexOf(action) < 0) return false;
core.moveHero(action, core.replay);
return true;
-}
+};
control.prototype._replayAction_item = function (action) {
- if (action.indexOf("item:") != 0) return false;
+ if (action.indexOf('item:') != 0) return false;
var itemId = action.substring(5);
if (!core.canUseItem(itemId)) return false;
- if (core.material.items[itemId].hideInReplay || core.status.replay.speed == 24) {
+ if (
+ core.material.items[itemId].hideInReplay ||
+ core.status.replay.speed == 24
+ ) {
core.useItem(itemId, false, core.replay);
return true;
}
var tools = core.getToolboxItems('tools'),
constants = core.getToolboxItems('constants');
- var index, per = core._WIDTH_ - 1;
+ var index,
+ per = core._WIDTH_ - 1;
if ((index = tools.indexOf(itemId)) >= 0) {
- core.status.event.data = { "toolsPage": Math.floor(index / per) + 1, "constantsPage": 1 };
+ core.status.event.data = {
+ toolsPage: Math.floor(index / per) + 1,
+ constantsPage: 1
+ };
index = index % per;
- }
- else if ((index = constants.indexOf(itemId)) >= 0) {
- core.status.event.data = { "toolsPage": 1, "constantsPage": Math.floor(index / per) + 1 };
- index = index % per + per;
+ } else if ((index = constants.indexOf(itemId)) >= 0) {
+ core.status.event.data = {
+ toolsPage: 1,
+ constantsPage: Math.floor(index / per) + 1
+ };
+ index = (index % per) + per;
}
if (index < 0) return false;
core.ui._drawToolbox(index);
@@ -1748,45 +2275,52 @@ control.prototype._replayAction_item = function (action) {
core.useItem(itemId, false, core.replay);
}, core.control.__replay_getTimeout());
return true;
-}
+};
control.prototype._replayAction_equip = function (action) {
- if (action.indexOf("equip:") != 0) return false;
+ if (action.indexOf('equip:') != 0) return false;
var equipId = action.substring(6);
var ownEquipment = core.getToolboxItems('equips');
- var index = ownEquipment.indexOf(equipId), per = core._WIDTH_ - 1;
+ var index = ownEquipment.indexOf(equipId),
+ per = core._WIDTH_ - 1;
if (index < 0) {
core.removeFlag('__doNotCheckAutoEvents__');
return false;
}
var cb = function () {
- var next = core.status.replay.toReplay[0] || "";
+ var next = core.status.replay.toReplay[0] || '';
if (!next.startsWith('equip:') && !next.startsWith('unEquip:')) {
core.removeFlag('__doNotCheckAutoEvents__');
core.checkAutoEvents();
}
core.replay();
- }
+ };
core.setFlag('__doNotCheckAutoEvents__', true);
core.status.route.push(action);
- if (core.material.items[equipId].hideInReplay || core.status.replay.speed == 24) {
+ if (
+ core.material.items[equipId].hideInReplay ||
+ core.status.replay.speed == 24
+ ) {
core.loadEquip(equipId, cb);
return true;
}
- core.status.event.data = { "page": Math.floor(index / per) + 1, "selectId": null };
- index = index % per + per;
+ core.status.event.data = {
+ page: Math.floor(index / per) + 1,
+ selectId: null
+ };
+ index = (index % per) + per;
core.ui._drawEquipbox(index);
setTimeout(function () {
core.ui.closePanel();
core.loadEquip(equipId, cb);
}, core.control.__replay_getTimeout());
return true;
-}
+};
control.prototype._replayAction_unEquip = function (action) {
- if (action.indexOf("unEquip:") != 0) return false;
+ if (action.indexOf('unEquip:') != 0) return false;
var equipType = parseInt(action.substring(8));
if (!core.isset(equipType)) {
core.removeFlag('__doNotCheckAutoEvents__');
@@ -1794,13 +2328,13 @@ control.prototype._replayAction_unEquip = function (action) {
}
var cb = function () {
- var next = core.status.replay.toReplay[0] || "";
+ var next = core.status.replay.toReplay[0] || '';
if (!next.startsWith('equip:') && !next.startsWith('unEquip:')) {
core.removeFlag('__doNotCheckAutoEvents__');
core.checkAutoEvents();
}
core.replay();
- }
+ };
core.setFlag('__doNotCheckAutoEvents__', true);
core.ui._drawEquipbox(equipType);
@@ -1814,27 +2348,31 @@ control.prototype._replayAction_unEquip = function (action) {
core.unloadEquip(equipType, cb);
}, core.control.__replay_getTimeout());
return true;
-}
+};
control.prototype._replayAction_saveEquip = function (action) {
if (action.indexOf('saveEquip:') != 0) return false;
core.quickSaveEquip(parseInt(action.substring(10)));
core.replay();
return true;
-}
+};
control.prototype._replayAction_loadEquip = function (action) {
if (action.indexOf('loadEquip:') != 0) return false;
core.quickLoadEquip(parseInt(action.substring(10)));
core.replay();
return true;
-}
+};
control.prototype._replayAction_fly = function (action) {
- if (action.indexOf("fly:") != 0) return false;
+ if (action.indexOf('fly:') != 0) return false;
var floorId = action.substring(4);
var toIndex = core.floorIds.indexOf(floorId);
- if (!core.canUseItem('fly') || (core.flags.flyNearStair && !core.nearStair())) return false;
+ if (
+ !core.canUseItem('fly') ||
+ (core.flags.flyNearStair && !core.nearStair())
+ )
+ return false;
core.ui.drawFly(toIndex);
if (core.status.replay.speed == 24) {
if (!core.flyTo(floorId, core.replay))
@@ -1846,10 +2384,10 @@ control.prototype._replayAction_fly = function (action) {
core.control._replay_error(action);
}, core.control.__replay_getTimeout());
return true;
-}
+};
control.prototype._replayAction_shop = function (action) {
- if (action.indexOf("shop:") != 0) return false;
+ if (action.indexOf('shop:') != 0) return false;
var shopId = action.substring(5);
if (core.canUseQuickShop(shopId) != null || !core.canOpenShop(shopId)) {
this._replay_error(shopId);
@@ -1858,7 +2396,7 @@ control.prototype._replayAction_shop = function (action) {
core.openShop(shopId, false);
core.replay();
return true;
-}
+};
control.prototype._replayAction_turn = function (action) {
if (action != 'turn' && action.indexOf('turn:') != 0) return false;
@@ -1866,30 +2404,37 @@ control.prototype._replayAction_turn = function (action) {
else core.turnHero(action.substring(5));
core.replay();
return true;
-}
+};
control.prototype._replayAction_getNext = function (action) {
- if (action != "getNext") return false;
+ if (action != 'getNext') return false;
core.getNextItem();
core.replay();
return true;
-}
+};
control.prototype._replayAction_moveDirectly = function (action) {
- if (action.indexOf("move:") != 0) return false;
+ if (action.indexOf('move:') != 0) return false;
// 忽略连续的瞬移事件;如果大地图某一边超过计算范围则不合并
- if (!core.hasFlag('poison') && core.status.thisMap.width < 2 * core.bigmap.extend + core._WIDTH_
- && core.status.thisMap.height < 2 * core.bigmap.extend + core._HEIGHT_) {
- while (core.status.replay.toReplay.length > 0 &&
- core.status.replay.toReplay[0].indexOf('move:') == 0) {
+ if (
+ !core.hasFlag('poison') &&
+ core.status.thisMap.width < 2 * core.bigmap.extend + core._WIDTH_ &&
+ core.status.thisMap.height < 2 * core.bigmap.extend + core._HEIGHT_
+ ) {
+ while (
+ core.status.replay.toReplay.length > 0 &&
+ core.status.replay.toReplay[0].indexOf('move:') == 0
+ ) {
core.status.route.push(action);
action = core.status.replay.toReplay.shift();
}
}
- var pos = action.substring(5).split(":");
- var x = parseInt(pos[0]), y = parseInt(pos[1]);
- var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
+ var pos = action.substring(5).split(':');
+ var x = parseInt(pos[0]),
+ y = parseInt(pos[1]);
+ var nowx = core.getHeroLoc('x'),
+ nowy = core.getHeroLoc('y');
var ignoreSteps = core.canMoveDirectly(x, y);
if (!core.moveDirectly(x, y, ignoreSteps)) return false;
if (core.status.replay.speed == 24) {
@@ -1897,48 +2442,65 @@ control.prototype._replayAction_moveDirectly = function (action) {
return true;
}
- core.ui.drawArrow('ui', 32 * nowx + 16 - core.bigmap.offsetX, 32 * nowy + 16 - core.bigmap.offsetY,
- 32 * x + 16 - core.bigmap.offsetX, 32 * y + 16 - core.bigmap.offsetY, '#FF0000', 3);
+ core.ui.drawArrow(
+ 'ui',
+ 32 * nowx + 16 - core.bigmap.offsetX,
+ 32 * nowy + 16 - core.bigmap.offsetY,
+ 32 * x + 16 - core.bigmap.offsetX,
+ 32 * y + 16 - core.bigmap.offsetY,
+ '#FF0000',
+ 3
+ );
var timeout = this.__replay_getTimeout();
- if (ignoreSteps < 10) timeout = timeout * ignoreSteps / 10;
+ if (ignoreSteps < 10) timeout = (timeout * ignoreSteps) / 10;
setTimeout(function () {
core.clearMap('ui');
core.replay();
}, timeout);
return true;
-}
+};
control.prototype._replayAction_key = function (action) {
- if (action.indexOf("key:") != 0) return false;
+ if (action.indexOf('key:') != 0) return false;
core.actions.keyUp(parseInt(action.substring(4)), false, true);
core.replay();
return true;
-}
+};
control.prototype._replayAction_click = function (action) {
- if (action.indexOf("click:") != 0) return false;
- var p = action.split(":");
+ if (action.indexOf('click:') != 0) return false;
+ var p = action.split(':');
if (p.length != 4) return false;
- core.actions.doRegisteredAction("onStatusBarClick", parseInt(p[2]), parseInt(p[3]), parseInt(p[1]));
+ core.actions.doRegisteredAction(
+ 'onStatusBarClick',
+ parseInt(p[2]),
+ parseInt(p[3]),
+ parseInt(p[1])
+ );
core.replay();
return true;
-}
+};
control.prototype._replayAction_ignoreInput = function (action) {
- if (action.indexOf('input:') == 0 || action.indexOf('input2:') == 0 || action.indexOf('choices:') == 0 || action.indexOf('random:') == 0) {
+ if (
+ action.indexOf('input:') == 0 ||
+ action.indexOf('input2:') == 0 ||
+ action.indexOf('choices:') == 0 ||
+ action.indexOf('random:') == 0
+ ) {
console.warn('警告!录像播放中出现了未知的 ' + action + '!');
core.replay();
return true;
}
return false;
-}
+};
control.prototype._replayAction_no = function (action) {
if (action != 'no') return false;
core.status.route.push(action);
core.replay();
return true;
-}
+};
// ------ 存读档相关 ------ //
@@ -1948,14 +2510,19 @@ control.prototype.autosave = function (removeLast) {
var x = null;
if (removeLast) {
x = core.status.route.pop();
- core.status.route.push("turn:" + core.getHeroLoc('direction'));
+ core.status.route.push('turn:' + core.getHeroLoc('direction'));
}
- if (core.status.event.id == 'action' && !removeLast) // 事件中自动存档,读档后是否回到事件触发前
- core.setFlag("__events__", core.clone(core.status.event.data));
+ if (core.status.event.id == 'action' && !removeLast)
+ // 事件中自动存档,读档后是否回到事件触发前
+ core.setFlag('__events__', core.clone(core.status.event.data));
if (core.saves.autosave.data == null) {
core.saves.autosave.data = [];
}
- core.saves.autosave.data.splice(core.saves.autosave.now, 0, core.saveData());
+ core.saves.autosave.data.splice(
+ core.saves.autosave.now,
+ 0,
+ core.saveData()
+ );
core.saves.autosave.now += 1;
if (core.saves.autosave.data.length > core.saves.autosave.max) {
if (core.saves.autosave.now < core.saves.autosave.max / 2)
@@ -1967,12 +2534,12 @@ control.prototype.autosave = function (removeLast) {
}
core.saves.autosave.updated = true;
core.saves.ids[0] = true;
- core.removeFlag("__events__");
+ core.removeFlag('__events__');
if (removeLast) {
core.status.route.pop();
if (x) core.status.route.push(x);
}
-}
+};
/////// 实际进行自动存档 //////
control.prototype.checkAutosave = function () {
@@ -1982,21 +2549,33 @@ control.prototype.checkAutosave = function () {
if (autosave.data == null || !autosave.updated || !autosave.storage) return;
autosave.updated = false;
if (autosave.data.length >= 1) {
- core.setLocalForage("autoSave", autosave.data[autosave.now - 1]);
+ core.setLocalForage('autoSave', autosave.data[autosave.now - 1]);
}
-}
+};
////// 实际进行存读档事件 //////
control.prototype.doSL = function (id, type) {
switch (type) {
- case 'save': this._doSL_save(id); break;
- case 'load': this._doSL_load(id, this._doSL_load_afterGet); break;
- case 'reload': this._doSL_reload(id, this._doSL_load_afterGet); break;
- case 'replayLoad': this._doSL_load(id, this._doSL_replayLoad_afterGet); break;
- case 'replayRemain': this._doSL_load(id, this._doSL_replayRemain_afterGet); break;
- case 'replaySince': this._doSL_load(id, this._doSL_replaySince_afterGet); break;
+ case 'save':
+ this._doSL_save(id);
+ break;
+ case 'load':
+ this._doSL_load(id, this._doSL_load_afterGet);
+ break;
+ case 'reload':
+ this._doSL_reload(id, this._doSL_load_afterGet);
+ break;
+ case 'replayLoad':
+ this._doSL_load(id, this._doSL_replayLoad_afterGet);
+ break;
+ case 'replayRemain':
+ this._doSL_load(id, this._doSL_replayRemain_afterGet);
+ break;
+ case 'replaySince':
+ this._doSL_load(id, this._doSL_replaySince_afterGet);
+ break;
}
-}
+};
control.prototype._doSL_save = function (id) {
if (id == 'autoSave') {
@@ -2005,31 +2584,39 @@ control.prototype._doSL_save = function (id) {
}
// 在事件中的存档
if (core.status.event.interval != null)
- core.setFlag("__events__", core.status.event.interval);
+ core.setFlag('__events__', core.status.event.interval);
var data = core.saveData();
if (core.isReplaying() && core.status.replay.toReplay.length > 0) {
data.__toReplay__ = core.encodeRoute(core.status.replay.toReplay);
}
- core.setLocalForage("save" + id, data, function () {
- core.saves.saveIndex = id;
- core.setLocalStorage('saveIndex', core.saves.saveIndex);
- // 恢复事件
- if (!core.events.recoverEvents(core.status.event.interval))
- core.ui.closePanel();
- core.playSound('存档');
- core.drawTip('存档成功!');
- }, function (err) {
- console.error(err);
- alert("存档失败,错误信息:\n" + err);
- });
- core.removeFlag("__events__");
+ core.setLocalForage(
+ 'save' + id,
+ data,
+ function () {
+ core.saves.saveIndex = id;
+ core.setLocalStorage('saveIndex', core.saves.saveIndex);
+ // 恢复事件
+ if (!core.events.recoverEvents(core.status.event.interval))
+ core.ui.closePanel();
+ core.playSound('存档');
+ core.drawTip('存档成功!');
+ },
+ function (err) {
+ console.error(err);
+ alert('存档失败,错误信息:\n' + err);
+ }
+ );
+ core.removeFlag('__events__');
return;
-}
+};
control.prototype._doSL_load = function (id, callback) {
if (id == 'autoSave' && core.saves.autosave.data != null) {
core.saves.autosave.now -= 1;
- var data = core.saves.autosave.data.splice(core.saves.autosave.now, 1)[0];
+ var data = core.saves.autosave.data.splice(
+ core.saves.autosave.now,
+ 1
+ )[0];
if (core.isPlaying() && !core.status.gameOver) {
core.control.autosave(0);
core.saves.autosave.now -= 1;
@@ -2039,173 +2626,226 @@ control.prototype._doSL_load = function (id, callback) {
core.saves.autosave.now += 1;
}
callback(id, data);
- }
- else {
- core.getLocalForage(id == 'autoSave' ? id : "save" + id, null, function (data) {
- if (id == 'autoSave' && data != null) {
- core.saves.autosave.data = data;
- if (!(core.saves.autosave.data instanceof Array)) {
- core.saves.autosave.data = [core.saves.autosave.data];
+ } else {
+ core.getLocalForage(
+ id == 'autoSave' ? id : 'save' + id,
+ null,
+ function (data) {
+ if (id == 'autoSave' && data != null) {
+ core.saves.autosave.data = data;
+ if (!(core.saves.autosave.data instanceof Array)) {
+ core.saves.autosave.data = [core.saves.autosave.data];
+ }
+ core.saves.autosave.now = core.saves.autosave.data.length;
+ return core.control._doSL_load(id, callback);
}
- core.saves.autosave.now = core.saves.autosave.data.length;
- return core.control._doSL_load(id, callback);
+ callback(id, data);
+ },
+ function (err) {
+ console.error(err);
+ alert('无效的存档');
}
- callback(id, data);
- }, function (err) {
- console.error(err);
- alert("无效的存档");
- })
+ );
}
return;
-}
+};
control.prototype._doSL_reload = function (id, callback) {
- if (core.saves.autosave.data != null && core.saves.autosave.now < core.saves.autosave.data.length) {
- var data = core.saves.autosave.data.splice(core.saves.autosave.now, 1)[0];
+ if (
+ core.saves.autosave.data != null &&
+ core.saves.autosave.now < core.saves.autosave.data.length
+ ) {
+ var data = core.saves.autosave.data.splice(
+ core.saves.autosave.now,
+ 1
+ )[0];
core.control.autosave(false);
callback(id, data);
}
return;
-}
+};
control.prototype._doSL_load_afterGet = function (id, data) {
- if (!data) return alert("无效的存档");
+ if (!data) return alert('无效的存档');
var _replay = function () {
- core.startGame(data.hard, data.hero.flags.__seed__, core.decodeRoute(data.route));
+ core.startGame(
+ data.hard,
+ data.hero.flags.__seed__,
+ core.decodeRoute(data.route)
+ );
};
if (data.version != core.firstData.version) {
- core.myconfirm("存档版本不匹配!\n你想回放此存档的录像吗?\n可以随时停止录像播放以继续游戏。", _replay);
+ core.myconfirm(
+ '存档版本不匹配!\n你想回放此存档的录像吗?\n可以随时停止录像播放以继续游戏。',
+ _replay
+ );
return;
}
if (data.hero.flags.__events__ && data.guid != core.getGuid()) {
- core.myconfirm("此存档可能存在风险,你想要播放录像么?", _replay);
+ core.myconfirm('此存档可能存在风险,你想要播放录像么?', _replay);
return;
}
core.ui.closePanel();
core.loadData(data, function () {
core.removeFlag('__fromLoad__');
- core.drawTip("读档成功");
- if (id != "autoSave") {
+ core.drawTip('读档成功');
+ if (id != 'autoSave') {
core.saves.saveIndex = id;
core.setLocalStorage('saveIndex', core.saves.saveIndex);
}
});
-}
+};
control.prototype._doSL_replayLoad_afterGet = function (id, data) {
if (!data) {
core.playSound('操作失败');
- return core.drawTip("无效的存档");
+ return core.drawTip('无效的存档');
}
if (data.version != core.firstData.version) {
core.playSound('操作失败');
- return core.drawTip("存档版本不匹配");
+ return core.drawTip('存档版本不匹配');
}
if (data.hero.flags.__events__ && data.guid != core.getGuid()) {
core.playSound('操作失败');
- return core.drawTip("此存档可能存在风险,无法读档");
+ return core.drawTip('此存档可能存在风险,无法读档');
}
var route = core.subarray(core.status.route, core.decodeRoute(data.route));
if (route == null) {
core.playSound('操作失败');
- return core.drawTip("无法从此存档回放录像");
+ return core.drawTip('无法从此存档回放录像');
}
core.loadData(data, function () {
core.removeFlag('__fromLoad__');
core.startReplay(route);
- core.drawTip("回退到存档节点");
+ core.drawTip('回退到存档节点');
});
-}
+};
control.prototype._doSL_replayRemain_afterGet = function (id, data) {
if (!data) {
core.playSound('操作失败');
- return core.drawTip("无效的存档");
+ return core.drawTip('无效的存档');
}
var route = core.decodeRoute(data.route);
if (core.status.tempRoute) {
var remainRoute = core.subarray(route, core.status.tempRoute);
if (remainRoute == null)
- return alert("无法接续播放录像!\n该存档必须是前一个选择的存档的后续内容。");
+ return alert(
+ '无法接续播放录像!\n该存档必须是前一个选择的存档的后续内容。'
+ );
delete core.status.tempRoute;
core.ui.closePanel();
core.startReplay(remainRoute);
- core.drawTip("接续播放录像");
+ core.drawTip('接续播放录像');
return;
- }
- else if (data.floorId != core.status.floorId || data.hero.loc.x != core.getHeroLoc('x') || data.hero.loc.y != core.getHeroLoc('y'))
- return alert("楼层或坐标不一致!");
+ } else if (
+ data.floorId != core.status.floorId ||
+ data.hero.loc.x != core.getHeroLoc('x') ||
+ data.hero.loc.y != core.getHeroLoc('y')
+ )
+ return alert('楼层或坐标不一致!');
core.status.tempRoute = route;
core.ui.closePanel();
- core.drawText("\t[步骤2]请选择第二个存档。\n\r[yellow]该存档必须是前一个存档的后续。\r\n将尝试播放到此存档。", function () {
- core.status.event.id = 'replayRemain';
- core.lockControl();
- var saveIndex = core.saves.saveIndex;
- var page = parseInt((saveIndex - 1) / 5), offset = saveIndex - 5 * page;
- core.ui._drawSLPanel(10 * page + offset);
- });
-}
+ core.drawText(
+ '\t[步骤2]请选择第二个存档。\n\r[yellow]该存档必须是前一个存档的后续。\r\n将尝试播放到此存档。',
+ function () {
+ core.status.event.id = 'replayRemain';
+ core.lockControl();
+ var saveIndex = core.saves.saveIndex;
+ var page = parseInt((saveIndex - 1) / 5),
+ offset = saveIndex - 5 * page;
+ core.ui._drawSLPanel(10 * page + offset);
+ }
+ );
+};
control.prototype._doSL_replaySince_afterGet = function (id, data) {
- if (data.floorId != core.status.floorId || data.hero.loc.x != core.getHeroLoc('x') || data.hero.loc.y != core.getHeroLoc('y'))
- return alert("楼层或坐标不一致!");
+ if (
+ data.floorId != core.status.floorId ||
+ data.hero.loc.x != core.getHeroLoc('x') ||
+ data.hero.loc.y != core.getHeroLoc('y')
+ )
+ return alert('楼层或坐标不一致!');
if (!data.__toReplay__) return alert('该存档没有剩余录像!');
core.ui.closePanel();
core.startReplay(core.decodeRoute(data.__toReplay__));
- core.drawTip("播放存档剩余录像");
+ core.drawTip('播放存档剩余录像');
return;
-}
+};
////// 同步存档到服务器 //////
control.prototype.syncSave = function (type) {
- core.ui.drawWaiting("正在同步,请稍候...");
+ core.ui.drawWaiting('正在同步,请稍候...');
var callback = function (saves) {
core.control._syncSave_http(type, saves);
- }
+ };
if (type == 'all') core.getAllSaves(callback);
else core.getSave(core.saves.saveIndex, callback);
-}
+};
control.prototype._syncSave_http = function (type, saves) {
- if (!saves) return core.drawText("没有要同步的存档");
+ if (!saves) return core.drawText('没有要同步的存档');
var formData = new FormData();
formData.append('type', 'save');
formData.append('name', core.firstData.name);
formData.append('data', LZString.compressToBase64(JSON.stringify(saves)));
formData.append('shorten', '1');
- core.http("POST", "/games/sync.php", formData, function (data) {
- var response = JSON.parse(data);
- if (response.code < 0) {
- core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因:" + response.msg);
+ core.http(
+ 'POST',
+ '/games/sync.php',
+ formData,
+ function (data) {
+ var response = JSON.parse(data);
+ if (response.code < 0) {
+ core.drawText(
+ '出错啦!\n无法同步存档到服务器。\n错误原因:' +
+ response.msg
+ );
+ } else {
+ core.drawText(
+ (type == 'all'
+ ? '所有存档'
+ : '存档' + core.saves.saveIndex) +
+ '同步成功!\n\n您的存档编号+密码: \r[yellow]' +
+ response.code +
+ response.msg +
+ '\r\n\n请牢记以上信息(如截图等),在从服务器\n同步存档时使用。\n\r[yellow]另外请注意,存档同步只会保存一个月的时间。\r'
+ );
+ }
+ },
+ function (e) {
+ core.drawText('出错啦!\n无法同步存档到服务器。\n错误原因:' + e);
}
- else {
- core.drawText((type == 'all' ? "所有存档" : "存档" + core.saves.saveIndex) + "同步成功!\n\n您的存档编号+密码: \r[yellow]"
- + response.code + response.msg
- + "\r\n\n请牢记以上信息(如截图等),在从服务器\n同步存档时使用。\n\r[yellow]另外请注意,存档同步只会保存一个月的时间。\r")
- }
- }, function (e) {
- core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因:" + e);
- })
-}
+ );
+};
////// 从服务器加载存档 //////
control.prototype.syncLoad = function () {
- core.myprompt("请输入存档编号+密码", null, function (idpassword) {
+ core.myprompt('请输入存档编号+密码', null, function (idpassword) {
if (!idpassword) return core.ui._drawSyncSave();
- if (!/^\d{6}\w{4}$/.test(idpassword) && !/^\d{4}\w{3}$/.test(idpassword)) {
- core.drawText("不合法的存档编号+密码!");
+ if (
+ !/^\d{6}\w{4}$/.test(idpassword) &&
+ !/^\d{4}\w{3}$/.test(idpassword)
+ ) {
+ core.drawText('不合法的存档编号+密码!');
return;
}
- core.ui.drawWaiting("正在同步,请稍候...");
+ core.ui.drawWaiting('正在同步,请稍候...');
if (idpassword.length == 7) {
- core.control._syncLoad_http(idpassword.substring(0, 4), idpassword.substring(4));
+ core.control._syncLoad_http(
+ idpassword.substring(0, 4),
+ idpassword.substring(4)
+ );
} else {
- core.control._syncLoad_http(idpassword.substring(0, 6), idpassword.substring(6));
+ core.control._syncLoad_http(
+ idpassword.substring(0, 6),
+ idpassword.substring(6)
+ );
}
});
-}
+};
control.prototype._syncLoad_http = function (id, password) {
var formData = new FormData();
@@ -2214,66 +2854,81 @@ control.prototype._syncLoad_http = function (id, password) {
formData.append('id', id);
formData.append('password', password);
- core.http("POST", "/games/sync.php", formData, function (data) {
- var response = JSON.parse(data);
- if (response.code == 0) {
- var msg = null;
- try {
- msg = JSON.parse(LZString.decompressFromBase64(response.msg));
- } catch (e) { }
- if (!msg) {
+ core.http(
+ 'POST',
+ '/games/sync.php',
+ formData,
+ function (data) {
+ var response = JSON.parse(data);
+ if (response.code == 0) {
+ var msg = null;
try {
- msg = JSON.parse(response.msg);
- } catch (e) { }
- }
- if (msg) {
- core.control._syncLoad_write(msg);
+ msg = JSON.parse(
+ LZString.decompressFromBase64(response.msg)
+ );
+ } catch (e) {}
+ if (!msg) {
+ try {
+ msg = JSON.parse(response.msg);
+ } catch (e) {}
+ }
+ if (msg) {
+ core.control._syncLoad_write(msg);
+ } else {
+ core.drawText('出错啦!\n存档解析失败!');
+ }
} else {
- core.drawText("出错啦!\n存档解析失败!");
+ core.drawText(
+ '出错啦!\n无法从服务器同步存档。\n错误原因:' +
+ response.msg
+ );
}
+ },
+ function (e) {
+ core.drawText('出错啦!\n无法从服务器同步存档。\n错误原因:' + e);
}
- else {
- core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因:" + response.msg);
- }
- }, function (e) {
- core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因:" + e);
- });
-}
+ );
+};
control.prototype._syncLoad_write = function (data) {
if (data instanceof Array) {
core.status.event.selection = 1;
- core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?", function () {
- for (var i = 1; i <= 5 * (main.savePages || 30); i++) {
- if (i <= data.length)
- core.setLocalForage("save" + i, data[i - 1]);
- else if (core.saves.ids[i])
- core.removeLocalForage("save" + i);
+ core.ui.drawConfirmBox(
+ '所有本地存档都将被覆盖,确认?',
+ function () {
+ for (var i = 1; i <= 5 * (main.savePages || 30); i++) {
+ if (i <= data.length)
+ core.setLocalForage('save' + i, data[i - 1]);
+ else if (core.saves.ids[i])
+ core.removeLocalForage('save' + i);
+ }
+ core.ui.closePanel();
+ core.drawText('同步成功!\n你的本地所有存档均已被覆盖。');
+ },
+ function () {
+ core.status.event.selection = 0;
+ core.ui._drawSyncSave();
}
- core.ui.closePanel();
- core.drawText("同步成功!\n你的本地所有存档均已被覆盖。");
- }, function () {
- core.status.event.selection = 0;
- core.ui._drawSyncSave();
- });
- }
- else {
+ );
+ } else {
// 只覆盖单存档
- core.setLocalForage("save" + core.saves.saveIndex, data, function () {
- core.drawText("同步成功!\n单存档已覆盖至存档" + core.saves.saveIndex);
+ core.setLocalForage('save' + core.saves.saveIndex, data, function () {
+ core.drawText(
+ '同步成功!\n单存档已覆盖至存档' + core.saves.saveIndex
+ );
});
}
-}
+};
////// 存档到本地 //////
control.prototype.saveData = function () {
return this.controldata.saveData();
-}
+};
////// 从本地读档 //////
control.prototype.loadData = function (data, callback) {
return this.controldata.loadData(data, callback);
-}
+};
control.prototype.getSave = function (index, callback) {
if (index == 0) {
@@ -2281,55 +2936,73 @@ control.prototype.getSave = function (index, callback) {
if (core.saves.autosave.data != null)
callback(core.saves.autosave.data);
else {
- core.getLocalForage("autoSave", null, function (data) {
- if (data != null) {
- core.saves.autosave.data = data;
- if (!(core.saves.autosave.data instanceof Array)) {
- core.saves.autosave.data = [core.saves.autosave.data];
+ core.getLocalForage(
+ 'autoSave',
+ null,
+ function (data) {
+ if (data != null) {
+ core.saves.autosave.data = data;
+ if (!(core.saves.autosave.data instanceof Array)) {
+ core.saves.autosave.data = [
+ core.saves.autosave.data
+ ];
+ }
+ core.saves.autosave.now =
+ core.saves.autosave.data.length;
}
- core.saves.autosave.now = core.saves.autosave.data.length;
+ callback(core.saves.autosave.data);
+ },
+ function (err) {
+ console.error(err);
+ callback(null);
}
- callback(core.saves.autosave.data);
- }, function (err) {
- console.error(err);
- callback(null);
- });
+ );
}
return;
}
- core.getLocalForage("save" + index, null, function (data) {
- if (callback) callback(data);
- }, function (err) {
- console.error(err);
- if (callback) callback(null);
- });
-}
+ core.getLocalForage(
+ 'save' + index,
+ null,
+ function (data) {
+ if (callback) callback(data);
+ },
+ function (err) {
+ console.error(err);
+ if (callback) callback(null);
+ }
+ );
+};
control.prototype.getSaves = function (ids, callback) {
if (!(ids instanceof Array)) return this.getSave(ids, callback);
- var count = ids.length, data = {};
+ var count = ids.length,
+ data = {};
for (var i = 0; i < ids.length; ++i) {
(function (i) {
core.getSave(ids[i], function (result) {
data[i] = result;
- if (Object.keys(data).length == count)
- callback(data);
- })
+ if (Object.keys(data).length == count) callback(data);
+ });
})(i);
}
-}
+};
control.prototype.getAllSaves = function (callback) {
- var ids = Object.keys(core.saves.ids).filter(function (x) { return x != 0; })
- .sort(function (a, b) { return a - b; }), saves = [];
+ var ids = Object.keys(core.saves.ids)
+ .filter(function (x) {
+ return x != 0;
+ })
+ .sort(function (a, b) {
+ return a - b;
+ }),
+ saves = [];
this.getSaves(ids, function (data) {
for (var i = 0; i < ids.length; ++i) {
- if (data[i] != null)
- saves.push(data[i]);
+ if (data[i] != null) saves.push(data[i]);
}
callback(saves);
});
-}
+};
////// 获得所有存在存档的存档位 //////
control.prototype.getSaveIndexes = function (callback) {
@@ -2344,25 +3017,27 @@ control.prototype.getSaveIndexes = function (callback) {
});
callback(indexes);
});
-}
+};
control.prototype._getSaveIndexes_getIndex = function (indexes, name) {
- var e = new RegExp('^' + core.firstData.name + "_(save\\d+|autoSave)$").exec(name);
+ var e = new RegExp(
+ '^' + core.firstData.name + '_(save\\d+|autoSave)$'
+ ).exec(name);
if (e) {
if (e[1] == 'autoSave') indexes[0] = true;
else indexes[parseInt(e[1].substring(4))] = true;
}
-}
+};
////// 判断某个存档位是否存在存档 //////
control.prototype.hasSave = function (index) {
return core.saves.ids[index] || false;
-}
+};
////// 删除某个存档
control.prototype.removeSave = function (index, callback) {
- if (index == 0 || index == "autoSave") {
- index = "autoSave";
+ if (index == 0 || index == 'autoSave') {
+ index = 'autoSave';
core.removeLocalForage(index, function () {
core.saves.autosave.data = null;
core.saves.autosave.updated = false;
@@ -2370,30 +3045,38 @@ control.prototype.removeSave = function (index, callback) {
});
return;
}
- core.removeLocalForage("save" + index, function () {
- core.saves.favorite = core.saves.favorite.filter(function (i) { return core.hasSave(i); });
- delete core.saves.favoriteName[index];
- core.control._updateFavoriteSaves();
- if (callback) callback();
- }, function () {
- core.playSound('操作失败');
- core.drawTip("无法删除存档!");
- if (callback) callback();
- });
-}
+ core.removeLocalForage(
+ 'save' + index,
+ function () {
+ core.saves.favorite = core.saves.favorite.filter(function (i) {
+ return core.hasSave(i);
+ });
+ delete core.saves.favoriteName[index];
+ core.control._updateFavoriteSaves();
+ if (callback) callback();
+ },
+ function () {
+ core.playSound('操作失败');
+ core.drawTip('无法删除存档!');
+ if (callback) callback();
+ }
+ );
+};
////// 读取收藏信息
control.prototype._loadFavoriteSaves = function () {
- core.saves.favorite = core.getLocalStorage("favorite", []);
+ core.saves.favorite = core.getLocalStorage('favorite', []);
// --- 移除不存在的收藏
- core.saves.favorite = core.saves.favorite.filter(function (i) { return core.hasSave(i); });
- core.saves.favoriteName = core.getLocalStorage("favoriteName", {});
-}
+ core.saves.favorite = core.saves.favorite.filter(function (i) {
+ return core.hasSave(i);
+ });
+ core.saves.favoriteName = core.getLocalStorage('favoriteName', {});
+};
control.prototype._updateFavoriteSaves = function () {
- core.setLocalStorage("favorite", core.saves.favorite);
- core.setLocalStorage("favoriteName", core.saves.favoriteName);
-}
+ core.setLocalStorage('favorite', core.saves.favorite);
+ core.setLocalStorage('favoriteName', core.saves.favoriteName);
+};
// ------ 属性,状态,位置,buff,变量,锁定控制等 ------ //
@@ -2402,14 +3085,13 @@ control.prototype.setStatus = function (name, value) {
if (!core.status.hero) return;
if (name == 'x' || name == 'y' || name == 'direction')
this.setHeroLoc(name, value);
- else
- core.status.hero[name] = value;
-}
+ else core.status.hero[name] = value;
+};
////// 增减勇士属性 //////
control.prototype.addStatus = function (name, value) {
this.setStatus(name, this.getStatus(name) + value);
-}
+};
////// 获得勇士属性 //////
control.prototype.getStatus = function (name) {
@@ -2420,24 +3102,25 @@ control.prototype.getStatus = function (name) {
return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero[name];
}
return core.status.hero[name];
-}
+};
////// 从status中获得属性,如果不存在则从勇士属性中获取 //////
control.prototype.getStatusOrDefault = function (status, name) {
- if (status && name in status)
- return Math.floor(status[name]);
+ if (status && name in status) return Math.floor(status[name]);
return Math.floor(this.getStatus(name));
-}
+};
////// 获得勇士实际属性(增幅后的) //////
control.prototype.getRealStatus = function (name) {
return this.getRealStatusOrDefault(null, name);
-}
+};
////// 从status中获得实际属性(增幅后的),如果不存在则从勇士属性中获取 //////
control.prototype.getRealStatusOrDefault = function (status, name) {
- return Math.floor(this.getStatusOrDefault(status, name) * this.getBuff(name));
-}
+ return Math.floor(
+ this.getStatusOrDefault(status, name) * this.getBuff(name)
+ );
+};
////// 获得勇士原始属性(无装备和衰弱影响) //////
control.prototype.getNakedStatus = function (name) {
@@ -2449,29 +3132,46 @@ control.prototype.getNakedStatus = function (name) {
value -= core.material.items[v].equip.value[name] || 0;
});
// 衰弱扣除
- if (core.hasFlag('weak') && core.values.weakValue >= 1 && (name == 'atk' || name == 'def')) {
+ if (
+ core.hasFlag('weak') &&
+ core.values.weakValue >= 1 &&
+ (name == 'atk' || name == 'def')
+ ) {
value += core.values.weakValue;
}
return value;
-}
+};
////// 获得某个属性的名字 //////
control.prototype.getStatusLabel = function (name) {
if (this.controldata.getStatusLabel) {
return this.controldata.getStatusLabel(name) || name;
}
- 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: '护盾',
+ money: '金币',
+ exp: '经验',
+ point: '加点',
+ steps: '步数'
+ }[name] || name
+ );
+};
////// 设置某个属性的增幅值 //////
control.prototype.setBuff = function (name, value) {
// 仅保留三位有效buff值
value = parseFloat(value.toFixed(3));
this.setFlag('__' + name + '_buff__', value);
-}
+};
////// 加减某个属性的增幅值 //////
control.prototype.addBuff = function (name, value) {
@@ -2479,17 +3179,17 @@ control.prototype.addBuff = function (name, value) {
// 仅保留三位有效buff值
buff = parseFloat(buff.toFixed(3));
this.setFlag('__' + name + '_buff__', buff);
-}
+};
////// 获得某个属性的增幅值 //////
control.prototype.getBuff = function (name) {
return core.getFlag('__' + name + '_buff__', 1);
-}
+};
////// 获得或移除毒衰咒效果 //////
control.prototype.triggerDebuff = function (action, type) {
return this.controldata.triggerDebuff(action, type);
-}
+};
////// 设置勇士的位置 //////
control.prototype.setHeroLoc = function (name, value, noGather) {
@@ -2499,25 +3199,28 @@ control.prototype.setHeroLoc = function (name, value, noGather) {
this.gatherFollowers();
}
core.ui.drawStatusBar();
-}
+};
////// 获得勇士的位置 //////
control.prototype.getHeroLoc = function (name) {
if (!core.status.hero) return;
if (main.mode == 'editor') {
- if (name == null) return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero.loc;
- return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero.loc[name];
+ if (name == null)
+ return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero.loc;
+ return data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.hero.loc[
+ name
+ ];
}
if (name == null) return core.status.hero.loc;
return core.status.hero.loc[name];
-}
+};
////// 获得某个等级的名称 //////
control.prototype.getLvName = function (lv) {
if (!core.status.hero) return null;
if (lv == null) lv = core.status.hero.lv;
return ((core.firstData.levelUp || [])[lv - 1] || {}).title || lv;
-}
+};
////// 获得下个等级所需经验;如果不存在下个等级,返回null。 //////
control.prototype.getNextLvUpNeed = function () {
@@ -2527,135 +3230,180 @@ control.prototype.getNextLvUpNeed = function () {
if (core.flags.statusBarItems.indexOf('levelUpLeftMode') >= 0)
return Math.max(need - core.getStatus('exp'), 0);
else return need;
-}
+};
////// 设置某个自定义变量或flag //////
control.prototype.setFlag = function (name, value) {
if (value == null) return this.removeFlag(name);
if (!core.status.hero) return;
core.status.hero.flags[name] = value;
-}
+};
////// 增加某个flag数值 //////
control.prototype.addFlag = function (name, value) {
if (!core.status.hero) return;
core.setFlag(name, core.getFlag(name, 0) + value);
-}
+};
////// 获得某个自定义变量或flag //////
control.prototype.getFlag = function (name, defaultValue) {
if (!core.status.hero) return defaultValue;
var value = core.status.hero.flags[name];
return value != null ? value : defaultValue;
-}
+};
////// 是否存在某个自定义变量或flag,且值为true //////
control.prototype.hasFlag = function (name) {
return !!core.getFlag(name);
-}
+};
////// 删除某个自定义变量或flag //////
control.prototype.removeFlag = function (name) {
if (!core.status.hero) return;
delete core.status.hero.flags[name];
-}
+};
////// 获得某个点的独立开关 //////
control.prototype.getSwitch = function (x, y, floorId, name, defaultValue) {
- var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
- return this.getFlag(prefix + "@" + name, defaultValue);
-}
+ var prefix = [
+ floorId || core.status.floorId || ':f',
+ x != null ? x : 'x',
+ y != null ? y : 'y'
+ ].join('@');
+ return this.getFlag(prefix + '@' + name, defaultValue);
+};
////// 设置某个点的独立开关 //////
control.prototype.setSwitch = function (x, y, floorId, name, value) {
- var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
- return this.setFlag(prefix + "@" + name, value);
-}
+ var prefix = [
+ floorId || core.status.floorId || ':f',
+ x != null ? x : 'x',
+ y != null ? y : 'y'
+ ].join('@');
+ return this.setFlag(prefix + '@' + name, value);
+};
////// 增加某个点的独立开关 //////
control.prototype.addSwitch = function (x, y, floorId, name, value) {
- var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
- return this.addFlag(prefix + "@" + name, value);
-}
+ var prefix = [
+ floorId || core.status.floorId || ':f',
+ x != null ? x : 'x',
+ y != null ? y : 'y'
+ ].join('@');
+ return this.addFlag(prefix + '@' + name, value);
+};
////// 判定某个点的独立开关 //////
control.prototype.hasSwitch = function (x, y, floorId, name) {
- var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
- return this.hasFlag(prefix + "@" + name);
-}
+ var prefix = [
+ floorId || core.status.floorId || ':f',
+ x != null ? x : 'x',
+ y != null ? y : 'y'
+ ].join('@');
+ return this.hasFlag(prefix + '@' + name);
+};
////// 删除某个点的独立开关 //////
control.prototype.removeSwitch = function (x, y, floorId, name) {
- var prefix = [floorId || core.status.floorId || ":f", x != null ? x : "x", y != null ? y : "y"].join("@");
- return this.removeFlag(prefix + "@" + name);
-}
+ var prefix = [
+ floorId || core.status.floorId || ':f',
+ x != null ? x : 'x',
+ y != null ? y : 'y'
+ ].join('@');
+ return this.removeFlag(prefix + '@' + name);
+};
////// 锁定状态栏,常常用于事件处理 //////
control.prototype.lockControl = function () {
core.status.lockControl = true;
-}
+};
////// 解锁状态栏 //////
control.prototype.unlockControl = function () {
core.status.lockControl = false;
-}
+};
////// 开启debug模式 //////
control.prototype.debug = function () {
core.setFlag('debug', true);
- core.drawText("\t[调试模式开启]此模式下按住Ctrl键(或Ctrl+Shift键)可以穿墙并忽略一切事件。\n此模式下将无法上传成绩。");
-}
+ core.drawText(
+ '\t[调试模式开启]此模式下按住Ctrl键(或Ctrl+Shift键)可以穿墙并忽略一切事件。\n此模式下将无法上传成绩。'
+ );
+};
control.prototype._bindRoutePush = function () {
core.status.route.push = function (element) {
// 忽视移动、转向、瞬移
- if (["up", "down", "left", "right", "turn"].indexOf(element) < 0 && !element.startsWith("move:")) {
+ if (
+ ['up', 'down', 'left', 'right', 'turn'].indexOf(element) < 0 &&
+ !element.startsWith('move:')
+ ) {
core.clearRouteFolding();
}
Array.prototype.push.call(core.status.route, element);
- }
-}
+ };
+};
////// 清除录像折叠信息 //////
control.prototype.clearRouteFolding = function () {
core.status.routeFolding = {};
-}
+};
////// 检查录像折叠 //////
control.prototype.checkRouteFolding = function () {
// 未开启、未开始游戏、录像播放中、正在事件中:不执行
- if (!core.flags.enableRouteFolding || !core.isPlaying() || core.isReplaying() || core.status.event.id) {
+ if (
+ !core.flags.enableRouteFolding ||
+ !core.isPlaying() ||
+ core.isReplaying() ||
+ core.status.event.id
+ ) {
return this.clearRouteFolding();
}
var hero = core.clone(core.status.hero, function (name, value) {
return name != 'steps' && typeof value == 'number';
});
- var index = [core.getHeroLoc('x'), core.getHeroLoc('y'), core.getHeroLoc('direction').charAt(0)].join(',');
+ var index = [
+ core.getHeroLoc('x'),
+ core.getHeroLoc('y'),
+ core.getHeroLoc('direction').charAt(0)
+ ].join(',');
core.status.routeFolding = core.status.routeFolding || {};
if (core.status.routeFolding[index]) {
var one = core.status.routeFolding[index];
- if (core.same(one.hero, hero) && one.length < core.status.route.length) {
+ if (
+ core.same(one.hero, hero) &&
+ one.length < core.status.route.length
+ ) {
Object.keys(core.status.routeFolding).forEach(function (v) {
- if (core.status.routeFolding[v].length >= one.length) delete core.status.routeFolding[v];
+ if (core.status.routeFolding[v].length >= one.length)
+ delete core.status.routeFolding[v];
});
core.status.route = core.status.route.slice(0, one.length);
this._bindRoutePush();
}
}
- core.status.routeFolding[index] = { hero: hero, length: core.status.route.length };
-}
+ core.status.routeFolding[index] = {
+ hero: hero,
+ length: core.status.route.length
+ };
+};
// ------ 天气,色调,BGM ------ //
control.prototype.getMappedName = function (name) {
- return core.getFlag('__nameMap__', {})[name] || (main.nameMap || {})[name] || name;
-}
+ return (
+ core.getFlag('__nameMap__', {})[name] ||
+ (main.nameMap || {})[name] ||
+ name
+ );
+};
////// 更改天气效果 //////
control.prototype.setWeather = function (type, level) {
// 非雨雪
if (type == null || !this.weathers[type]) {
- core.deleteCanvas('weather')
+ core.deleteCanvas('weather');
core.animateFrame.weather.type = null;
core.animateFrame.weather.nodes = [];
return;
@@ -2663,7 +3411,11 @@ control.prototype.setWeather = function (type, level) {
if (level == null) level = core.animateFrame.weather.level;
level = core.clamp(parseInt(level) || 5, 1, 10);
// 当前天气:则忽略
- if (type == core.animateFrame.weather.type && level == core.animateFrame.weather.level) return;
+ if (
+ type == core.animateFrame.weather.type &&
+ level == core.animateFrame.weather.level
+ )
+ return;
// 计算当前的宽高
core.createCanvas('weather', 0, 0, core._PX_, core._PY_, 80);
@@ -2675,10 +3427,10 @@ control.prototype.setWeather = function (type, level) {
core.doFunc(this.weathers[type].initFunc, this, level);
} catch (e) {
console.error(e);
- console.error("ERROR in weather[" + type + "]:已自动注销该项。");
+ console.error('ERROR in weather[' + type + ']:已自动注销该项。');
core.unregisterWeather(type);
}
-}
+};
////// 注册一个天气 //////
// name为天气类型,如 sun, rain, snow 等
@@ -2687,7 +3439,7 @@ control.prototype.setWeather = function (type, level) {
control.prototype.registerWeather = function (name, initFunc, frameFunc) {
this.unregisterWeather(name);
this.weathers[name] = { initFunc: initFunc, frameFunc: frameFunc };
-}
+};
////// 取消注册一个天气 //////
control.prototype.unregisterWeather = function (name) {
@@ -2695,76 +3447,98 @@ control.prototype.unregisterWeather = function (name) {
if (core.animateFrame.weather.type == name) {
this.setWeather(null);
}
-}
+};
control.prototype._weather_rain = function (level) {
- var number = level * parseInt(20 * core.bigmap.width * core.bigmap.height / (core._WIDTH_ * core._HEIGHT_));
+ var number =
+ level *
+ parseInt(
+ (20 * core.bigmap.width * core.bigmap.height) /
+ (core._WIDTH_ * core._HEIGHT_)
+ );
for (var a = 0; a < number; a++) {
core.animateFrame.weather.nodes.push({
- 'x': Math.random() * core.bigmap.width * 32,
- 'y': Math.random() * core.bigmap.height * 32,
- 'l': Math.random() * 2.5,
- 'xs': -4 + Math.random() * 4 + 2,
- 'ys': Math.random() * 10 + 10
- })
+ x: Math.random() * core.bigmap.width * 32,
+ y: Math.random() * core.bigmap.height * 32,
+ l: Math.random() * 2.5,
+ xs: -4 + Math.random() * 4 + 2,
+ ys: Math.random() * 10 + 10
+ });
}
-}
+};
control.prototype._weather_snow = function (level) {
- var number = level * parseInt(20 * core.bigmap.width * core.bigmap.height / (core._WIDTH_ * core._HEIGHT_));
+ var number =
+ level *
+ parseInt(
+ (20 * core.bigmap.width * core.bigmap.height) /
+ (core._WIDTH_ * core._HEIGHT_)
+ );
for (var a = 0; a < number; a++) {
core.animateFrame.weather.nodes.push({
- 'x': Math.random() * core.bigmap.width * 32,
- 'y': Math.random() * core.bigmap.height * 32,
- 'r': Math.random() * 5 + 1,
- 'd': Math.random() * Math.min(level, 200),
- })
+ x: Math.random() * core.bigmap.width * 32,
+ y: Math.random() * core.bigmap.height * 32,
+ r: Math.random() * 5 + 1,
+ d: Math.random() * Math.min(level, 200)
+ });
}
-}
+};
control.prototype._weather_fog = function (level) {
if (!core.animateFrame.weather.fog) return;
- core.animateFrame.weather.nodes = [{
- 'image': core.animateFrame.weather.fog,
- 'level': 40 * level,
- 'x': 0,
- 'y': -core._PY_ / 2,
- 'dx': -Math.random() * 1.5,
- 'dy': Math.random(),
- 'delta': 0.001,
- }];
-}
+ core.animateFrame.weather.nodes = [
+ {
+ image: core.animateFrame.weather.fog,
+ level: 40 * level,
+ x: 0,
+ y: -core._PY_ / 2,
+ dx: -Math.random() * 1.5,
+ dy: Math.random(),
+ delta: 0.001
+ }
+ ];
+};
control.prototype._weather_cloud = function (level) {
if (!core.animateFrame.weather.cloud) return;
- core.animateFrame.weather.nodes = [{
- 'image': core.animateFrame.weather.cloud,
- 'level': 40 * level,
- 'x': 0,
- 'y': -core._PY_ / 2,
- 'dx': -Math.random() * 1.5,
- 'dy': Math.random(),
- 'delta': 0.001,
- }];
-}
+ core.animateFrame.weather.nodes = [
+ {
+ image: core.animateFrame.weather.cloud,
+ level: 40 * level,
+ x: 0,
+ y: -core._PY_ / 2,
+ dx: -Math.random() * 1.5,
+ dy: Math.random(),
+ delta: 0.001
+ }
+ ];
+};
control.prototype._weather_sun = function (level) {
if (!core.animateFrame.weather.sun) return;
// 直接绘制
core.clearMap('weather');
core.drawImage(
- 'weather', core.animateFrame.weather.sun, 0, 0, core.animateFrame.weather.sun.width, core.animateFrame.weather.sun.height, 0, 0, core._PX_, core._PY_
+ 'weather',
+ core.animateFrame.weather.sun,
+ 0,
+ 0,
+ core.animateFrame.weather.sun.width,
+ core.animateFrame.weather.sun.height,
+ 0,
+ 0,
+ core._PX_,
+ core._PY_
);
core.setOpacity('weather', level / 10);
core.animateFrame.weather.nodes = [{ opacity: level / 10, delta: 0.01 }];
-}
+};
////// 更改画面色调 //////
control.prototype.setCurtain = function (color, time, moveMode, callback) {
if (time == null) time = 750;
if (time <= 0) time = 0;
- if (!core.status.curtainColor)
- core.status.curtainColor = [0, 0, 0, 0];
+ if (!core.status.curtainColor) core.status.curtainColor = [0, 0, 0, 0];
if (!color) color = [0, 0, 0, 0];
if (color[3] == null) color[3] = 1;
color[3] = core.clamp(color[3], 0, 1);
@@ -2772,18 +3546,39 @@ control.prototype.setCurtain = function (color, time, moveMode, callback) {
if (time == 0) {
// 直接变色
core.clearMap('curtain');
- core.fillRect('curtain', 0, 0, core._PX_, core._PY_, core.arrayToRGBA(color));
+ core.fillRect(
+ 'curtain',
+ 0,
+ 0,
+ core._PX_,
+ core._PY_,
+ core.arrayToRGBA(color)
+ );
core.status.curtainColor = color;
if (callback) callback();
return;
}
- this._setCurtain_animate(core.status.curtainColor, color, time, moveMode, callback);
-}
+ this._setCurtain_animate(
+ core.status.curtainColor,
+ color,
+ time,
+ moveMode,
+ callback
+ );
+};
-control.prototype._setCurtain_animate = function (nowColor, color, time, moveMode, callback) {
- time /= Math.max(core.status.replay.speed, 1)
- var per_time = 10, step = 0, steps = parseInt(time / per_time);
+control.prototype._setCurtain_animate = function (
+ nowColor,
+ color,
+ time,
+ moveMode,
+ callback
+) {
+ time /= Math.max(core.status.replay.speed, 1);
+ var per_time = 10,
+ step = 0,
+ steps = parseInt(time / per_time);
if (steps <= 0) steps = 1;
var curr = nowColor;
var moveFunc = core.applyEasing(moveMode);
@@ -2791,17 +3586,24 @@ control.prototype._setCurtain_animate = function (nowColor, color, time, moveMod
var cb = function () {
core.status.curtainColor = curr;
if (callback) callback();
- }
+ };
var animate = setInterval(function () {
step++;
curr = [
nowColor[0] + (color[0] - nowColor[0]) * moveFunc(step / steps),
nowColor[1] + (color[1] - nowColor[1]) * moveFunc(step / steps),
nowColor[2] + (color[2] - nowColor[2]) * moveFunc(step / steps),
- nowColor[3] + (color[3] - nowColor[3]) * moveFunc(step / steps),
- ]
+ nowColor[3] + (color[3] - nowColor[3]) * moveFunc(step / steps)
+ ];
core.clearMap('curtain');
- core.fillRect('curtain', 0, 0, core._PX_, core._PY_, core.arrayToRGBA(curr));
+ core.fillRect(
+ 'curtain',
+ 0,
+ 0,
+ core._PX_,
+ core._PY_,
+ core.arrayToRGBA(curr)
+ );
if (step == steps) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
@@ -2811,23 +3613,35 @@ control.prototype._setCurtain_animate = function (nowColor, color, time, moveMod
core.animateFrame.lastAsyncId = animate;
core.animateFrame.asyncId[animate] = cb;
-}
+};
////// 画面闪烁 //////
-control.prototype.screenFlash = function (color, time, times, moveMode, callback) {
+control.prototype.screenFlash = function (
+ color,
+ time,
+ times,
+ moveMode,
+ callback
+) {
times = times || 1;
time = time / 3;
var nowColor = core.clone(core.status.curtainColor);
core.setCurtain(color, time, moveMode, function () {
core.setCurtain(nowColor, time * 2, moveMode, function () {
if (times > 1)
- core.screenFlash(color, time * 3, times - 1, moveMode, callback);
+ core.screenFlash(
+ color,
+ time * 3,
+ times - 1,
+ moveMode,
+ callback
+ );
else {
if (callback) callback();
}
});
});
-}
+};
////// 播放背景音乐 //////
control.prototype.playBgm = function (bgm, startTime) {
@@ -2839,8 +3653,7 @@ control.prototype.playBgm = function (bgm, startTime) {
core.musicStatus.playingBgm = bgm;
core.musicStatus.lastBgm = bgm;
core.material.bgms[bgm].pause();
- }
- catch (e) {
+ } catch (e) {
console.error(e);
}
return;
@@ -2849,17 +3662,19 @@ control.prototype.playBgm = function (bgm, startTime) {
try {
this._playBgm_play(bgm, startTime);
- }
- catch (e) {
- console.log("无法播放BGM " + bgm);
+ } catch (e) {
+ console.log('无法播放BGM ' + bgm);
console.error(e);
core.musicStatus.playingBgm = null;
}
-}
+};
control.prototype._playBgm_play = function (bgm, startTime) {
// 如果当前正在播放,且和本BGM相同,直接忽略
- if (core.musicStatus.playingBgm == bgm && !core.material.bgms[core.musicStatus.playingBgm].paused) {
+ if (
+ core.musicStatus.playingBgm == bgm &&
+ !core.material.bgms[core.musicStatus.playingBgm].paused
+ ) {
return;
}
// 如果正在播放中,暂停
@@ -2869,13 +3684,14 @@ control.prototype._playBgm_play = function (bgm, startTime) {
// 缓存BGM
core.loader.loadBgm(bgm);
// 播放当前BGM
- core.material.bgms[bgm].volume = core.musicStatus.userVolume * core.musicStatus.designVolume;
+ core.material.bgms[bgm].volume =
+ core.musicStatus.userVolume * core.musicStatus.designVolume;
core.material.bgms[bgm].currentTime = startTime || 0;
core.material.bgms[bgm].play();
core.musicStatus.playingBgm = bgm;
core.musicStatus.lastBgm = bgm;
core.setBgmSpeed(100);
-}
+};
///// 设置当前背景音乐的播放速度 //////
control.prototype.setBgmSpeed = function (speed, usePitch) {
@@ -2887,30 +3703,31 @@ control.prototype.setBgmSpeed = function (speed, usePitch) {
core.musicStatus.bgmSpeed = speed;
if (bgm.preservesPitch != null) {
- if (bgm.__preservesPitch == null) bgm.__preservesPitch = bgm.preservesPitch;
+ if (bgm.__preservesPitch == null)
+ bgm.__preservesPitch = bgm.preservesPitch;
if (usePitch == null) bgm.preservesPitch = bgm.__preservesPitch;
else if (usePitch) bgm.preservesPitch = false;
else bgm.preservesPitch = true;
core.musicStatus.bgmUsePitch = usePitch;
}
-}
+};
////// 暂停背景音乐的播放 //////
control.prototype.pauseBgm = function () {
if (main.mode != 'play') return;
try {
if (core.musicStatus.playingBgm) {
- core.musicStatus.pauseTime = core.material.bgms[core.musicStatus.playingBgm].currentTime;
+ core.musicStatus.pauseTime =
+ core.material.bgms[core.musicStatus.playingBgm].currentTime;
core.material.bgms[core.musicStatus.playingBgm].pause();
core.musicStatus.playingBgm = null;
}
- }
- catch (e) {
- console.log("无法暂停BGM");
+ } catch (e) {
+ console.log('无法暂停BGM');
console.error(e);
}
this.setMusicBtn();
-}
+};
////// 恢复背景音乐的播放 //////
control.prototype.resumeBgm = function (resumeTime) {
@@ -2918,42 +3735,50 @@ control.prototype.resumeBgm = function (resumeTime) {
try {
var speed = core.musicStatus.bgmSpeed;
var usePitch = core.musicStatus.bgmUsePitch;
- core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm || main.startBgm,
- resumeTime ? core.musicStatus.pauseTime : 0);
+ core.playBgm(
+ core.musicStatus.playingBgm ||
+ core.musicStatus.lastBgm ||
+ main.startBgm,
+ resumeTime ? core.musicStatus.pauseTime : 0
+ );
if (resumeTime) {
core.setBgmSpeed(speed, usePitch);
}
- }
- catch (e) {
- console.log("无法恢复BGM");
+ } catch (e) {
+ console.log('无法恢复BGM');
console.error(e);
}
this.setMusicBtn();
-}
+};
control.prototype.setMusicBtn = function () {
if (core.musicStatus.bgmStatus)
- core.dom.musicBtn.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABWVBMVEX///9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmL///8AAAC5ubn+/v6xsbEtLS0MDAxmZmZoaGhvb2/c3Nzd3d38/Pz9/f0oKCgpKSl0dHR1dXW6urrb29v7+/v09PTv7+/39/cgICACAgImJibh4eGFhYWGhoaHh4eOjo5paWm7u7vDw8PMzMwyMjI7OztAQEDe3t5FRUVMTEzj4+Pl5eXm5ubp6enr6+tcXFzi4uL19fVeXl74+PgjIyNkZGQGBgaSkpKYmJiampqenp4DAwMwMDBnZ2cICAivr68eHh63t7cLCwsSEhLw8PBhYWEUFBQVFRXNzc3Pz8/Z2dna2toaGhqkpKSlpaWpqamrq6tFOUNAAAAAc3RSTlMAAwQFBhUWGxwkJSYyO0dISVBRUmpvj5CSk5SVoaOlpqiysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyA0IuUgAAAVdJREFUeF5NkVVbw0AQRTcQrLR4IIEGcidJoaUuQHF3d3d3+P/CkuxCzss8nG++mbnDBJXhNt2CpbeFK1kQpSEKidlc8S9qdATRa6UIdQMoxEpDA0Ov3wUAPfW+qLWACydNv9zMrzkJwPK6FB3oHyOfXfuNxvoBQ+GmBYinhHB77TmiVBxoYUw1AYcEq332AS8OYKosAuTT0nza9uU2USYPRJgGxEiSOFywJ3mNARozgBJJzkfLvfu8JgGDWcC9FEsjWzR+y80gYDEAA8QZ3N6kmP1Fs3fEASB7pob7Hh+Wz5L0ci17Or05J7bH6B6dZv05XWK3rG+myV05Ert592Qo55sPuoIr7hEZHHtieIPWy0RU9DLwc3Mnck/vi8/E8XNrDWQtEVnL/ySKMrv0jPwPp870fprcyYifmiEmqGpHkI5q9ofSFIUk2qiwIGpEMyxYhhZRRcMPz89RJ2s9W8wAAAAASUVORK5CYII=";
+ core.dom.musicBtn.src =
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABWVBMVEX///9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmL///8AAAC5ubn+/v6xsbEtLS0MDAxmZmZoaGhvb2/c3Nzd3d38/Pz9/f0oKCgpKSl0dHR1dXW6urrb29v7+/v09PTv7+/39/cgICACAgImJibh4eGFhYWGhoaHh4eOjo5paWm7u7vDw8PMzMwyMjI7OztAQEDe3t5FRUVMTEzj4+Pl5eXm5ubp6enr6+tcXFzi4uL19fVeXl74+PgjIyNkZGQGBgaSkpKYmJiampqenp4DAwMwMDBnZ2cICAivr68eHh63t7cLCwsSEhLw8PBhYWEUFBQVFRXNzc3Pz8/Z2dna2toaGhqkpKSlpaWpqamrq6tFOUNAAAAAc3RSTlMAAwQFBhUWGxwkJSYyO0dISVBRUmpvj5CSk5SVoaOlpqiysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyA0IuUgAAAVdJREFUeF5NkVVbw0AQRTcQrLR4IIEGcidJoaUuQHF3d3d3+P/CkuxCzss8nG++mbnDBJXhNt2CpbeFK1kQpSEKidlc8S9qdATRa6UIdQMoxEpDA0Ov3wUAPfW+qLWACydNv9zMrzkJwPK6FB3oHyOfXfuNxvoBQ+GmBYinhHB77TmiVBxoYUw1AYcEq332AS8OYKosAuTT0nza9uU2USYPRJgGxEiSOFywJ3mNARozgBJJzkfLvfu8JgGDWcC9FEsjWzR+y80gYDEAA8QZ3N6kmP1Fs3fEASB7pob7Hh+Wz5L0ci17Or05J7bH6B6dZv05XWK3rG+myV05Ert592Qo55sPuoIr7hEZHHtieIPWy0RU9DLwc3Mnck/vi8/E8XNrDWQtEVnL/ySKMrv0jPwPp870fprcyYifmiEmqGpHkI5q9ofSFIUk2qiwIGpEMyxYhhZRRcMPz89RJ2s9W8wAAAAASUVORK5CYII=';
else
- core.dom.musicBtn.src = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABYlBMVEX///9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmL////8/PwAAABmZmZoaGihoaGioqKxsbG5ubnb29vc3Nzd3d3h4eHi4uL9/f3+/v4tLS1nZ2d0dHSUlJSenp66uroMDAz7+/spKSkoKCgUFBRpaWkVFRVvb291dXU7OzuVlZWYmJhkZGQgICAjIyOkpKQCAgK3t7cGBgbv7++pqamrq6seHh4mJiZhYWGamprp6enr6+saGhpeXl7j4+Pl5eXm5uZKSkrw8PD09PT19fW7u7vDw8PMzMwICAgwMDAyMjILCwtAQECGhoaHh4eBgYGFhYUSEhJXV1dZWVlcXFyOjo6SkpLNzc339/fPz8/Z2dna2tqTk5OlpaWxOPeTAAAAdnRSTlMAAwQFBhUWGxwkJSYyO0dISVBRUmpvj5CSk5SVoaOlpqiysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyNuo+uwAAAWJJREFUeF5NkmV34zAQReUm7WbTuJBNunY3bvXGDjNTkZkZlpn5/9eR5FPfbzr3jGb0RkwRiMQMDm7EIgHmRxtLwMOaHHoQjwz4MUKeCM8AWMrmd7u7f/aXAMyOShHiQD1n04DtN5e5FMBFlSauIsm585dKi4CpuSYKJIv1tBDVmvOSqJgEoowFLSBHaQh10XHWiCgHWEGmAw2blPrvOK/KRJUGoLM4kCVSKrWz7HwgoiwQZyaQJ0+9PvxV23BNATAZB25IqX9b3+jTW9fcApwB6NLgUD5NY3mPXnwmFwBezff1ztzRFzTp94FXMy36HDuCa2RafdnnmZqtL818Gl9/qNnEeyrUk2aTPiKj3qMyWBVi/YSuWq5qiwxkbtX3vYWzdz/l8M0k8ERlvViiB1Ygslb7SbVtJezncj+Cx5bYaeGuonZqhZlieAp+no74/s5EAh6JcY35Cepxk4ObcT3IJPe/1lKsDpFCFQAAAABJRU5ErkJggg==";
-}
+ core.dom.musicBtn.src =
+ 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABkAAAAZCAMAAADzN3VRAAABYlBMVEX///9iYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmJiYmL////8/PwAAABmZmZoaGihoaGioqKxsbG5ubnb29vc3Nzd3d3h4eHi4uL9/f3+/v4tLS1nZ2d0dHSUlJSenp66uroMDAz7+/spKSkoKCgUFBRpaWkVFRVvb291dXU7OzuVlZWYmJhkZGQgICAjIyOkpKQCAgK3t7cGBgbv7++pqamrq6seHh4mJiZhYWGamprp6enr6+saGhpeXl7j4+Pl5eXm5uZKSkrw8PD09PT19fW7u7vDw8PMzMwICAgwMDAyMjILCwtAQECGhoaHh4eBgYGFhYUSEhJXV1dZWVlcXFyOjo6SkpLNzc339/fPz8/Z2dna2tqTk5OlpaWxOPeTAAAAdnRSTlMAAwQFBhUWGxwkJSYyO0dISVBRUmpvj5CSk5SVoaOlpqiysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKysrKyNuo+uwAAAWJJREFUeF5NkmV34zAQReUm7WbTuJBNunY3bvXGDjNTkZkZlpn5/9eR5FPfbzr3jGb0RkwRiMQMDm7EIgHmRxtLwMOaHHoQjwz4MUKeCM8AWMrmd7u7f/aXAMyOShHiQD1n04DtN5e5FMBFlSauIsm585dKi4CpuSYKJIv1tBDVmvOSqJgEoowFLSBHaQh10XHWiCgHWEGmAw2blPrvOK/KRJUGoLM4kCVSKrWz7HwgoiwQZyaQJ0+9PvxV23BNATAZB25IqX9b3+jTW9fcApwB6NLgUD5NY3mPXnwmFwBezff1ztzRFzTp94FXMy36HDuCa2RafdnnmZqtL818Gl9/qNnEeyrUk2aTPiKj3qMyWBVi/YSuWq5qiwxkbtX3vYWzdz/l8M0k8ERlvViiB1Ygslb7SbVtJezncj+Cx5bYaeGuonZqhZlieAp+no74/s5EAh6JcY35Cepxk4ObcT3IJPe/1lKsDpFCFQAAAABJRU5ErkJggg==';
+};
////// 更改背景音乐的播放 //////
control.prototype.triggerBgm = function () {
if (main.mode != 'play') return;
core.musicStatus.bgmStatus = !core.musicStatus.bgmStatus;
- if (core.musicStatus.bgmStatus)
- this.resumeBgm();
- else
- this.pauseBgm();
+ if (core.musicStatus.bgmStatus) this.resumeBgm();
+ else this.pauseBgm();
core.setLocalStorage('bgmStatus', core.musicStatus.bgmStatus);
-}
+};
////// 播放音频 //////
control.prototype.playSound = function (sound, pitch, callback) {
sound = core.getMappedName(sound);
- if (main.mode != 'play' || !core.musicStatus.soundStatus || !core.material.sounds[sound]) return;
+ if (
+ main.mode != 'play' ||
+ !core.musicStatus.soundStatus ||
+ !core.material.sounds[sound]
+ )
+ return;
try {
if (core.musicStatus.audioContext != null) {
var source = core.musicStatus.audioContext.createBufferSource();
@@ -2967,23 +3792,21 @@ control.prototype.playSound = function (sound, pitch, callback) {
source.onended = function () {
delete core.musicStatus.playingSounds[id];
if (callback) callback();
- }
+ };
core.musicStatus.playingSounds[id] = source;
if (source.start) source.start(0);
else if (source.noteOn) source.noteOn(0);
return id;
- }
- else {
+ } else {
core.material.sounds[sound].volume = core.musicStatus.userVolume;
core.material.sounds[sound].play();
if (callback) callback();
}
- }
- catch (e) {
- console.log("无法播放SE " + sound);
+ } catch (e) {
+ console.log('无法播放SE ' + sound);
console.error(e);
}
-}
+};
////// 停止所有音频 //////
control.prototype.stopSound = function (id) {
@@ -2998,35 +3821,38 @@ control.prototype.stopSound = function (id) {
try {
if (source.stop) source.stop();
else if (source.noteOff) source.noteOff();
- }
- catch (e) {
+ } catch (e) {
console.error(e);
}
delete core.musicStatus.playingSounds[id];
-}
+};
////// 获得当前正在播放的所有(指定)音效的id列表 //////
control.prototype.getPlayingSounds = function (name) {
name = core.getMappedName(name);
return Object.keys(core.musicStatus.playingSounds).filter(function (one) {
- return name == null || core.musicStatus.playingSounds[one].__name == name
+ return (
+ name == null || core.musicStatus.playingSounds[one].__name == name
+ );
});
-}
+};
////// 检查bgm状态 //////
control.prototype.checkBgm = function () {
core.playBgm(core.musicStatus.playingBgm || main.startBgm);
-}
+};
///// 设置屏幕放缩 //////
control.prototype.setDisplayScale = function (delta) {
var index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
if (index < 0) return;
- index = (index + delta + core.domStyle.availableScale.length) % core.domStyle.availableScale.length;
+ index =
+ (index + delta + core.domStyle.availableScale.length) %
+ core.domStyle.availableScale.length;
core.domStyle.scale = core.domStyle.availableScale[index];
core.setLocalStorage('scale', core.domStyle.scale);
core.resize();
-}
+};
// ------ 状态栏,工具栏等相关 ------ //
@@ -3034,15 +3860,15 @@ control.prototype.setDisplayScale = function (delta) {
control.prototype.clearStatusBar = function () {
Object.keys(core.statusBar).forEach(function (e) {
if (core.statusBar[e].innerHTML != null) {
- core.statusBar[e].innerHTML = " ";
+ core.statusBar[e].innerHTML = ' ';
core.statusBar[e].removeAttribute('_style');
core.statusBar[e].removeAttribute('_value');
}
- })
+ });
core.statusBar.image.book.style.opacity = 0.3;
if (!core.flags.equipboxButton)
core.statusBar.image.fly.style.opacity = 0.3;
-}
+};
////// 更新状态栏 //////
control.prototype.updateStatusBar = function (doNotCheckAutoEvents, immediate) {
@@ -3051,8 +3877,8 @@ control.prototype.updateStatusBar = function (doNotCheckAutoEvents, immediate) {
}
if (!doNotCheckAutoEvents) this.noAutoEvents = false;
if (core.isReplaying()) return this.updateStatusBar_update();
- requestAnimationFrame(this.updateStatusBar_update)
-}
+ requestAnimationFrame(this.updateStatusBar_update);
+};
control.prototype.updateStatusBar_update = function () {
if (!core.isPlaying() || core.hasFlag('__statistics__')) return;
@@ -3061,11 +3887,13 @@ control.prototype.updateStatusBar_update = function () {
core.control._updateStatusBar_setToolboxIcon();
core.clearRouteFolding();
core.control.noAutoEvents = true;
-}
+};
control.prototype._updateStatusBar_setToolboxIcon = function () {
if (core.isReplaying()) {
- core.statusBar.image.book.src = core.status.replay.pausing ? core.statusBar.icons.play.src : core.statusBar.icons.pause.src;
+ core.statusBar.image.book.src = core.status.replay.pausing
+ ? core.statusBar.icons.play.src
+ : core.statusBar.icons.pause.src;
core.statusBar.image.book.style.opacity = 1;
core.statusBar.image.fly.src = core.statusBar.icons.stop.src;
core.statusBar.image.fly.style.opacity = 1;
@@ -3076,15 +3904,17 @@ control.prototype._updateStatusBar_setToolboxIcon = function () {
core.statusBar.image.save.style.opacity = 1;
core.statusBar.image.load.src = core.statusBar.icons.speedUp.src;
core.statusBar.image.settings.src = core.statusBar.icons.save.src;
- }
- else {
+ } else {
core.statusBar.image.book.src = core.statusBar.icons.book.src;
- core.statusBar.image.book.style.opacity = core.hasItem('book') ? 1 : 0.3;
+ core.statusBar.image.book.style.opacity = core.hasItem('book')
+ ? 1
+ : 0.3;
if (!core.flags.equipboxButton) {
core.statusBar.image.fly.src = core.statusBar.icons.fly.src;
- core.statusBar.image.fly.style.opacity = core.hasItem('fly') ? 1 : 0.3;
- }
- else {
+ core.statusBar.image.fly.style.opacity = core.hasItem('fly')
+ ? 1
+ : 0.3;
+ } else {
core.statusBar.image.fly.src = core.statusBar.icons.equipbox.src;
core.statusBar.image.fly.style.opacity = 1;
}
@@ -3092,11 +3922,13 @@ control.prototype._updateStatusBar_setToolboxIcon = function () {
core.statusBar.image.keyboard.src = core.statusBar.icons.keyboard.src;
core.statusBar.image.shop.src = core.statusBar.icons.shop.src;
core.statusBar.image.save.src = core.statusBar.icons.save.src;
- core.statusBar.image.save.style.opacity = core.hasFlag('__forbidSave__') ? 0.3 : 1;
+ core.statusBar.image.save.style.opacity = core.hasFlag('__forbidSave__')
+ ? 0.3
+ : 1;
core.statusBar.image.load.src = core.statusBar.icons.load.src;
core.statusBar.image.settings.src = core.statusBar.icons.settings.src;
}
-}
+};
control.prototype.showStatusBar = function () {
if (main.mode == 'editor') return;
@@ -3110,35 +3942,38 @@ control.prototype.showStatusBar = function () {
this.setToolbarButton(false);
core.dom.tools.hard.style.display = 'block';
core.dom.toolBar.style.display = 'block';
-}
+};
control.prototype.hideStatusBar = function (showToolbox) {
if (main.mode == 'editor') return;
// 如果原本就是隐藏的,则先显示
- if (!core.domStyle.showStatusBar)
- this.showStatusBar();
+ if (!core.domStyle.showStatusBar) this.showStatusBar();
if (core.isReplaying()) showToolbox = true;
- var statusItems = core.dom.status, toolItems = core.dom.tools;
+ var statusItems = core.dom.status,
+ toolItems = core.dom.tools;
core.domStyle.showStatusBar = false;
core.setFlag('hideStatusBar', true);
core.setFlag('showToolbox', showToolbox || null);
// 隐藏
for (var i = 0; i < statusItems.length; ++i)
statusItems[i].style.opacity = 0;
- if ((!core.domStyle.isVertical && !core.flags.extendToolbar) || !showToolbox) {
+ if (
+ (!core.domStyle.isVertical && !core.flags.extendToolbar) ||
+ !showToolbox
+ ) {
for (var i = 0; i < toolItems.length; ++i)
toolItems[i].style.display = 'none';
}
if (!core.domStyle.isVertical && !core.flags.extendToolbar) {
core.dom.toolBar.style.display = 'none';
}
-}
+};
////// 更新状态栏的勇士图标 //////
control.prototype.updateHeroIcon = function (name) {
- name = name || "hero.png";
+ name = name || 'hero.png';
if (core.statusBar.icons.name == name) return;
core.statusBar.icons.name = name;
@@ -3146,16 +3981,18 @@ control.prototype.updateHeroIcon = function (name) {
// 全身图
var w = core.material.icons.hero.width || 32;
var h = core.material.icons.hero.height || 48;
- var ratio = Math.min(w / h, 1), width = 32 * ratio, left = 16 - width / 2;
+ var ratio = Math.min(w / h, 1),
+ width = 32 * ratio,
+ left = 16 - width / 2;
- var canvas = document.createElement("canvas");
- var ctx = canvas.getContext("2d");
+ var canvas = document.createElement('canvas');
+ var ctx = canvas.getContext('2d');
canvas.width = 32;
canvas.height = 32;
core.drawImage(ctx, image, 0, 0, w, h, left, 0, width, 32);
- core.statusBar.image.name.src = canvas.toDataURL("image/png");
-}
+ core.statusBar.image.name.src = canvas.toDataURL('image/png');
+};
////// 改变工具栏为按钮1-8 //////
control.prototype.setToolbarButton = function (useButton) {
@@ -3171,39 +4008,74 @@ control.prototype.setToolbarButton = function (useButton) {
}
if (useButton == null) useButton = core.domStyle.toolbarBtn;
- if ((!core.domStyle.isVertical && !core.flags.extendToolbar)) useButton = false;
+ if (!core.domStyle.isVertical && !core.flags.extendToolbar)
+ useButton = false;
core.domStyle.toolbarBtn = useButton;
if (useButton) {
- ["book", "fly", "toolbox", "keyboard", "shop", "save", "load", "settings"].forEach(function (t) {
+ [
+ 'book',
+ 'fly',
+ 'toolbox',
+ 'keyboard',
+ 'shop',
+ 'save',
+ 'load',
+ 'settings'
+ ].forEach(function (t) {
core.statusBar.image[t].style.display = 'none';
});
- ["btn1", "btn2", "btn3", "btn4", "btn5", "btn6", "btn7", "btn8"].forEach(function (t) {
+ [
+ 'btn1',
+ 'btn2',
+ 'btn3',
+ 'btn4',
+ 'btn5',
+ 'btn6',
+ 'btn7',
+ 'btn8'
+ ].forEach(function (t) {
core.statusBar.image[t].style.display = 'block';
- })
- main.statusBar.image.btn8.style.filter = core.getLocalStorage('altKey') ? 'sepia(1) contrast(1.5)' : '';
- }
- else {
- ["btn1", "btn2", "btn3", "btn4", "btn5", "btn6", "btn7", "btn8"].forEach(function (t) {
+ });
+ main.statusBar.image.btn8.style.filter = core.getLocalStorage('altKey')
+ ? 'sepia(1) contrast(1.5)'
+ : '';
+ } else {
+ [
+ 'btn1',
+ 'btn2',
+ 'btn3',
+ 'btn4',
+ 'btn5',
+ 'btn6',
+ 'btn7',
+ 'btn8'
+ ].forEach(function (t) {
core.statusBar.image[t].style.display = 'none';
});
- ["book", "fly", "toolbox", "save", "load", "settings"].forEach(function (t) {
- core.statusBar.image[t].style.display = 'block';
- });
- core.statusBar.image.keyboard.style.display
- = core.statusBar.image.shop.style.display
- = core.domStyle.isVertical || core.flags.extendToolbar ? "block" : "none";
+ ['book', 'fly', 'toolbox', 'save', 'load', 'settings'].forEach(
+ function (t) {
+ core.statusBar.image[t].style.display = 'block';
+ }
+ );
+ core.statusBar.image.keyboard.style.display =
+ core.statusBar.image.shop.style.display =
+ core.domStyle.isVertical || core.flags.extendToolbar
+ ? 'block'
+ : 'none';
}
-}
+};
////// ------ resize处理 ------ //
control.prototype._shouldDisplayStatus = function (id) {
if (id == null) {
- var toDraw = [], status = core.dom.status;
+ var toDraw = [],
+ status = core.dom.status;
for (var i = 0; i < status.length; ++i) {
- var dom = core.dom.status[i], idCol = dom.id;
- if (idCol.indexOf("Col") != idCol.length - 3) continue;
+ var dom = core.dom.status[i],
+ idCol = dom.id;
+ if (idCol.indexOf('Col') != idCol.length - 3) continue;
var id = idCol.substring(0, idCol.length - 3);
if (!this._shouldDisplayStatus(id)) continue;
toDraw.push(id);
@@ -3211,27 +4083,46 @@ control.prototype._shouldDisplayStatus = function (id) {
return toDraw;
}
var obj = {};
- core.flags.statusBarItems.forEach(function (v) { obj[v] = true; })
+ core.flags.statusBarItems.forEach(function (v) {
+ obj[v] = true;
+ });
switch (id) {
- case 'floor': return obj.enableFloor;
- case 'name': return obj.enableName;
- case 'lv': return obj.enableLv;
- case 'hp': return obj.enableHP;
- case 'hpmax': return obj.enableHPMax;
- case 'mana': return obj.enableMana;
- case 'atk': return obj.enableAtk;
- case 'def': return obj.enableDef;
- case 'mdef': return obj.enableMDef;
- case 'money': return obj.enableMoney;
- case 'exp': return obj.enableExp && !obj.levelUpLeftMode;
- case 'up': return obj.enableLevelUp;
- case 'skill': return obj.enableSkill;
- case 'key': return obj.enableKeys;
- case 'pzf': return obj.enablePZF;
- case 'debuff': return obj.enableDebuff;
- default: return true;
+ case 'floor':
+ return obj.enableFloor;
+ case 'name':
+ return obj.enableName;
+ case 'lv':
+ return obj.enableLv;
+ case 'hp':
+ return obj.enableHP;
+ case 'hpmax':
+ return obj.enableHPMax;
+ case 'mana':
+ return obj.enableMana;
+ case 'atk':
+ return obj.enableAtk;
+ case 'def':
+ return obj.enableDef;
+ case 'mdef':
+ return obj.enableMDef;
+ case 'money':
+ return obj.enableMoney;
+ case 'exp':
+ return obj.enableExp && !obj.levelUpLeftMode;
+ case 'up':
+ return obj.enableLevelUp;
+ case 'skill':
+ return obj.enableSkill;
+ case 'key':
+ return obj.enableKeys;
+ case 'pzf':
+ return obj.enablePZF;
+ case 'debuff':
+ return obj.enableDebuff;
+ default:
+ return true;
}
-}
+};
////// 注册一个resize函数 //////
// name为名称,可供注销使用
@@ -3239,12 +4130,14 @@ control.prototype._shouldDisplayStatus = function (id) {
control.prototype.registerResize = function (name, func) {
this.unregisterResize(name);
this.resizes.push({ name: name, func: func });
-}
+};
////// 注销一个resize函数 //////
control.prototype.unregisterResize = function (name) {
- this.resizes = this.resizes.filter(function (b) { return b.name != name; });
-}
+ this.resizes = this.resizes.filter(function (b) {
+ return b.name != name;
+ });
+};
control.prototype._doResize = function (obj) {
for (var i in this.resizes) {
@@ -3252,38 +4145,50 @@ control.prototype._doResize = function (obj) {
if (core.doFunc(this.resizes[i].func, this, obj)) return true;
} catch (e) {
console.error(e);
- console.error("ERROR in resizes[" + this.resizes[i].name + "]:已自动注销该项。");
+ console.error(
+ 'ERROR in resizes[' +
+ this.resizes[i].name +
+ ']:已自动注销该项。'
+ );
this.unregisterResize(this.resizes[i].name);
}
}
return false;
-}
+};
////// 屏幕分辨率改变后重新自适应 //////
control.prototype.resize = function () {
if (main.mode == 'editor') return;
- var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight;
+ var clientWidth = main.dom.body.clientWidth,
+ clientHeight = main.dom.body.clientHeight;
var BORDER = 3;
var extendToolbar = core.flags.extendToolbar;
var BAR_WIDTH = extendToolbar ? 0 : Math.round(core._PY_ * 0.3);
- var horizontalMaxRatio = (clientHeight - 2 * BORDER - (extendToolbar ? BORDER : 0)) / (core._PY_ + (extendToolbar ? 38 : 0));
+ var horizontalMaxRatio =
+ (clientHeight - 2 * BORDER - (extendToolbar ? BORDER : 0)) /
+ (core._PY_ + (extendToolbar ? 38 : 0));
- if (clientWidth - 3 * BORDER >= core._PX_ + BAR_WIDTH || (clientWidth > clientHeight && horizontalMaxRatio < 1)) {
+ if (
+ clientWidth - 3 * BORDER >= core._PX_ + BAR_WIDTH ||
+ (clientWidth > clientHeight && horizontalMaxRatio < 1)
+ ) {
// 横屏
core.domStyle.isVertical = false;
core.domStyle.availableScale = [];
[1, 1.25, 1.5, 1.75, 2, 2.25, 2.5].forEach(function (v) {
- if (clientWidth - 3 * BORDER >= v * (core._PX_ + BAR_WIDTH) && horizontalMaxRatio >= v) {
+ if (
+ clientWidth - 3 * BORDER >= v * (core._PX_ + BAR_WIDTH) &&
+ horizontalMaxRatio >= v
+ ) {
core.domStyle.availableScale.push(v);
}
});
if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) {
core.domStyle.scale = Math.min(1, horizontalMaxRatio);
}
- }
- else {
+ } else {
// 竖屏
core.domStyle.isVertical = true;
core.domStyle.scale = Math.min((clientWidth - 2 * BORDER) / core._PX_);
@@ -3292,14 +4197,22 @@ control.prototype.resize = function () {
BAR_WIDTH = Math.round(core._PX_ * 0.3);
}
- var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length;
- var statusCanvas = core.flags.statusCanvas, statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3;
+ var statusDisplayArr = this._shouldDisplayStatus(),
+ count = statusDisplayArr.length;
+ var statusCanvas = core.flags.statusCanvas,
+ statusCanvasRows = core.values.statusCanvasRowsOnMobile || 3;
var col = statusCanvas ? statusCanvasRows : Math.ceil(count / 3);
if (col > 5) {
- if (statusCanvas) alert("自绘状态栏的在竖屏下的行数应不超过5!");
- else alert("当前状态栏数目(" + count + ")大于15,请调整到不超过15以避免手机端出现显示问题。");
+ if (statusCanvas) alert('自绘状态栏的在竖屏下的行数应不超过5!');
+ else
+ alert(
+ '当前状态栏数目(' +
+ count +
+ ')大于15,请调整到不超过15以避免手机端出现显示问题。'
+ );
}
- var globalAttribute = core.status.globalAttribute || core.initStatus.globalAttribute;
+ var globalAttribute =
+ core.status.globalAttribute || core.initStatus.globalAttribute;
var obj = {
clientWidth: clientWidth,
@@ -3310,12 +4223,17 @@ control.prototype.resize = function () {
outerWidth: core._PX_ * core.domStyle.scale + 2 * BORDER,
outerHeight: core._PY_ * core.domStyle.scale + 2 * BORDER,
globalAttribute: globalAttribute,
- border: '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid',
+ border:
+ '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid',
statusDisplayArr: statusDisplayArr,
count: count,
col: col,
- statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0,
- toolbarHeightInVertical: core.domStyle.isVertical ? 38 * core.domStyle.scale + 2 * BORDER : 0,
+ statusBarHeightInVertical: core.domStyle.isVertical
+ ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER
+ : 0,
+ toolbarHeightInVertical: core.domStyle.isVertical
+ ? 38 * core.domStyle.scale + 2 * BORDER
+ : 0,
extendToolbar: extendToolbar,
is15x15: false
};
@@ -3323,10 +4241,12 @@ control.prototype.resize = function () {
this._doResize(obj);
this.setToolbarButton();
core.updateStatusBar();
-}
+};
control.prototype._resize_gameGroup = function (obj) {
- var startBackground = core.domStyle.isVertical ? (main.styles.startVerticalBackground || main.styles.startBackground) : main.styles.startBackground;
+ var 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;
@@ -3336,36 +4256,47 @@ control.prototype._resize_gameGroup = function (obj) {
var totalWidth, totalHeight;
if (core.domStyle.isVertical) {
totalWidth = obj.outerWidth;
- totalHeight = obj.outerHeight + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical
+ totalHeight =
+ obj.outerHeight +
+ obj.statusBarHeightInVertical +
+ obj.toolbarHeightInVertical;
+ } else {
+ totalWidth =
+ obj.outerWidth +
+ obj.BAR_WIDTH * core.domStyle.scale +
+ (obj.extendToolbar ? 0 : obj.BORDER);
+ totalHeight =
+ obj.outerHeight +
+ (obj.extendToolbar
+ ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER
+ : 0);
}
- else {
- totalWidth = obj.outerWidth + obj.BAR_WIDTH * core.domStyle.scale + (obj.extendToolbar ? 0 : obj.BORDER);
- totalHeight = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0);
- }
- gameGroup.style.width = totalWidth + "px";
- gameGroup.style.height = totalHeight + "px";
- gameGroup.style.left = (obj.clientWidth - totalWidth) / 2 + "px";
- gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + "px";
+ gameGroup.style.width = totalWidth + 'px';
+ gameGroup.style.height = totalHeight + 'px';
+ gameGroup.style.left = (obj.clientWidth - totalWidth) / 2 + 'px';
+ gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + 'px';
// floorMsgGroup
var floorMsgGroup = core.dom.floorMsgGroup;
floorMsgGroup.style = obj.globalAttribute.floorChangingStyle;
- floorMsgGroup.style.width = obj.outerWidth - 2 * obj.BORDER + "px";
- floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + "px";
- floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + "px";
+ floorMsgGroup.style.width = obj.outerWidth - 2 * obj.BORDER + 'px';
+ floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + 'px';
+ floorMsgGroup.style.fontSize = 16 * core.domStyle.scale + 'px';
// startPanel
- core.dom.startPanel.style.fontSize = 16 * core.domStyle.scale + "px";
+ core.dom.startPanel.style.fontSize = 16 * core.domStyle.scale + 'px';
// musicBtn
if (core.domStyle.isVertical || core.domStyle.scale < 1) {
- core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px";
+ core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = '3px';
+ } else {
+ core.dom.musicBtn.style.right =
+ (obj.clientWidth - totalWidth) / 2 + 'px';
+ core.dom.musicBtn.style.bottom =
+ (obj.clientHeight - totalHeight) / 2 - 27 + 'px';
}
- else {
- core.dom.musicBtn.style.right = (obj.clientWidth - totalWidth) / 2 + "px";
- core.dom.musicBtn.style.bottom = (obj.clientHeight - totalHeight) / 2 - 27 + "px";
- }
-}
+};
control.prototype._resize_canvas = function (obj) {
- var innerWidth = (core._PX_ * core.domStyle.scale) + "px", innerHeight = (core._PY_ * core.domStyle.scale) + "px";
+ var innerWidth = core._PX_ * core.domStyle.scale + 'px',
+ innerHeight = core._PY_ * core.domStyle.scale + 'px';
if (!core.isPlaying()) {
for (var i = 0; i < core.dom.gameCanvas.length; ++i) {
var ctx = core.dom.gameCanvas[i].getContext('2d');
@@ -3387,58 +4318,90 @@ control.prototype._resize_canvas = function (obj) {
core.dom.gif2.style.height = innerHeight;
core.dom.gameDraw.style.width = innerWidth;
core.dom.gameDraw.style.height = innerHeight;
- core.dom.gameDraw.style.top = obj.statusBarHeightInVertical + "px";
+ core.dom.gameDraw.style.top = obj.statusBarHeightInVertical + 'px';
core.dom.gameDraw.style.right = 0;
core.dom.gameDraw.style.border = obj.border;
// resize bigmap
core.bigmap.canvas.forEach(function (cn) {
- var ratio = core.canvas[cn].canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
- core.canvas[cn].canvas.style.width = core.canvas[cn].canvas.width / ratio * core.domStyle.scale + "px";
- core.canvas[cn].canvas.style.height = core.canvas[cn].canvas.height / ratio * core.domStyle.scale + "px";
+ var ratio = core.canvas[cn].canvas.hasAttribute('isHD')
+ ? core.domStyle.ratio
+ : 1;
+ core.canvas[cn].canvas.style.width =
+ (core.canvas[cn].canvas.width / ratio) * core.domStyle.scale + 'px';
+ core.canvas[cn].canvas.style.height =
+ (core.canvas[cn].canvas.height / ratio) * core.domStyle.scale +
+ 'px';
});
// resize dynamic canvas
if (!core.isPlaying()) {
for (var name in core.dymCanvas) {
- var ctx = core.dymCanvas[name], canvas = ctx.canvas;
+ var ctx = core.dymCanvas[name],
+ canvas = ctx.canvas;
// core.maps._setHDCanvasSize(ctx, parseFloat(canvas.getAttribute('_width')), parseFloat(canvas.getAttribute('_height')));
- canvas.style.left = parseFloat(canvas.getAttribute("_left")) * core.domStyle.scale + "px";
- canvas.style.top = parseFloat(canvas.getAttribute("_top")) * 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';
var scale = canvas.getAttribute('_scale') || 1;
- core.resizeCanvas(canvas, canvas.width * scale / core.domStyle.scale, canvas.height * scale / core.domStyle.scale);
+ core.resizeCanvas(
+ canvas,
+ (canvas.width * scale) / core.domStyle.scale,
+ (canvas.height * scale) / core.domStyle.scale
+ );
}
} else {
for (var name in core.dymCanvas) {
- var ctx = core.dymCanvas[name], canvas = ctx.canvas;
+ var ctx = core.dymCanvas[name],
+ canvas = ctx.canvas;
var ratio = canvas.hasAttribute('isHD') ? core.domStyle.ratio : 1;
- canvas.style.width = canvas.width / ratio * core.domStyle.scale + "px";
- canvas.style.height = canvas.height / 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";
+ canvas.style.width =
+ (canvas.width / ratio) * core.domStyle.scale + 'px';
+ canvas.style.height =
+ (canvas.height / 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";
-}
+ 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';
+};
control.prototype._resize_statusBar = function (obj) {
// statusBar
var statusBar = core.dom.statusBar;
if (core.domStyle.isVertical) {
- statusBar.style.width = obj.outerWidth + "px";
- statusBar.style.height = obj.statusBarHeightInVertical + "px";
+ statusBar.style.width = obj.outerWidth + 'px';
+ statusBar.style.height = obj.statusBarHeightInVertical + 'px';
statusBar.style.background = obj.globalAttribute.statusTopBackground;
- statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
- }
- else {
- statusBar.style.width = (obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER) + "px";
- statusBar.style.height = obj.outerHeight + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
+ statusBar.style.fontSize = 16 * core.domStyle.scale + 'px';
+ } else {
+ statusBar.style.width =
+ obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER + 'px';
+ statusBar.style.height =
+ obj.outerHeight +
+ (obj.extendToolbar
+ ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER
+ : 0) +
+ 'px';
statusBar.style.background = obj.globalAttribute.statusLeftBackground;
// --- 计算文字大小
if (obj.extendToolbar) {
- statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
+ statusBar.style.fontSize = 16 * core.domStyle.scale + 'px';
} else {
- statusBar.style.fontSize = 16 * Math.min(1, (core._HEIGHT_ - 4) / obj.count) * core.domStyle.scale + "px";
+ statusBar.style.fontSize =
+ 16 *
+ Math.min(1, (core._HEIGHT_ - 4) / obj.count) *
+ core.domStyle.scale +
+ 'px';
}
}
statusBar.style.display = obj.extendToolbar ? 'none' : 'block';
@@ -3447,43 +4410,78 @@ control.prototype._resize_statusBar = function (obj) {
statusBar.style.borderBottom = core.domStyle.isVertical ? '' : obj.border;
// 自绘状态栏
if (core.domStyle.isVertical) {
- core.dom.statusCanvas.style.width = core._PX_ * core.domStyle.scale + "px";
- core.dom.statusCanvas.style.height = obj.statusBarHeightInVertical - 3 + "px";
- core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, core._PX_, obj.col * 32 + 9);
+ core.dom.statusCanvas.style.width =
+ core._PX_ * core.domStyle.scale + 'px';
+ core.dom.statusCanvas.style.height =
+ obj.statusBarHeightInVertical - 3 + 'px';
+ core.maps._setHDCanvasSize(
+ core.dom.statusCanvasCtx,
+ core._PX_,
+ obj.col * 32 + 9
+ );
+ } else {
+ core.dom.statusCanvas.style.width =
+ obj.BAR_WIDTH * core.domStyle.scale + 'px';
+ core.dom.statusCanvas.style.height =
+ obj.outerHeight -
+ 2 * obj.BORDER +
+ (obj.extendToolbar
+ ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER
+ : 0) +
+ 'px';
+ core.maps._setHDCanvasSize(
+ core.dom.statusCanvasCtx,
+ obj.BAR_WIDTH,
+ core._PY_ +
+ (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0)
+ );
}
- else {
- core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
- core.dom.statusCanvas.style.height = obj.outerHeight - 2 * obj.BORDER + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER : 0) + "px";
- core.maps._setHDCanvasSize(core.dom.statusCanvasCtx, obj.BAR_WIDTH, core._PY_ + (obj.extendToolbar ? obj.TOOLBAR_HEIGHT + obj.BORDER : 0));
- }
- core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.extendToolbar ? "block" : "none";
-}
+ core.dom.statusCanvas.style.display =
+ core.flags.statusCanvas && !obj.extendToolbar ? 'block' : 'none';
+};
control.prototype._resize_status = function (obj) {
var statusHeight;
if (core.domStyle.isVertical) {
statusHeight = 32 * core.domStyle.scale * 0.8;
} else {
- statusHeight = (obj.extendToolbar ? core._HEIGHT_ : core._HEIGHT_ - 4) / obj.count * 32 * core.domStyle.scale * 0.8;
+ statusHeight =
+ ((obj.extendToolbar ? core._HEIGHT_ : core._HEIGHT_ - 4) /
+ obj.count) *
+ 32 *
+ core.domStyle.scale *
+ 0.8;
}
// status
for (var i = 0; i < core.dom.status.length; ++i) {
- var id = core.dom.status[i].id, style = core.dom.status[i].style;
- if (id.endsWith("Col")) id = id.substring(0, id.length - 3);
- style.display = core.flags.statusCanvas || obj.statusDisplayArr.indexOf(id) < 0 ? 'none' : 'block';
- style.margin = 3 * core.domStyle.scale + "px";
- style.height = statusHeight + "px";
- style.maxWidth = obj.BAR_WIDTH * core.domStyle.scale * (core.domStyle.isVertical ? 0.95 : 1) + obj.BORDER + "px";
+ var id = core.dom.status[i].id,
+ style = core.dom.status[i].style;
+ if (id.endsWith('Col')) id = id.substring(0, id.length - 3);
+ style.display =
+ core.flags.statusCanvas || obj.statusDisplayArr.indexOf(id) < 0
+ ? 'none'
+ : 'block';
+ style.margin = 3 * core.domStyle.scale + 'px';
+ style.height = statusHeight + 'px';
+ style.maxWidth =
+ obj.BAR_WIDTH *
+ core.domStyle.scale *
+ (core.domStyle.isVertical ? 0.95 : 1) +
+ obj.BORDER +
+ 'px';
if (obj.is15x15 && !core.domStyle.isVertical)
- style.marginLeft = 11 * core.domStyle.scale + "px";
+ style.marginLeft = 11 * core.domStyle.scale + 'px';
}
// statusLabels, statusTexts
for (var i = 0; i < core.dom.statusLabels.length; ++i) {
- core.dom.statusLabels[i].style.lineHeight = statusHeight + "px";
- core.dom.statusLabels[i].style.marginLeft = 6 * core.domStyle.scale + "px";
+ core.dom.statusLabels[i].style.lineHeight = statusHeight + 'px';
+ core.dom.statusLabels[i].style.marginLeft =
+ 6 * core.domStyle.scale + 'px';
}
for (var i = 0; i < core.dom.statusTexts.length; ++i) {
- core.dom.statusTexts[i].style.color = core.arrayToRGBA(obj.globalAttribute.statusBarColor);
+ core.dom.statusTexts[i].style.color = core.arrayToRGBA(
+ obj.globalAttribute.statusBarColor
+ );
}
// keys
if (core.flags.statusBarItems.indexOf('enableGreenKey') >= 0) {
@@ -3493,66 +4491,87 @@ control.prototype._resize_status = function (obj) {
core.dom.keyCol.style.fontSize = '';
core.statusBar.greenKey.style.display = 'none';
}
-}
+};
control.prototype._resize_toolBar = function (obj) {
// toolBar
var toolBar = core.dom.toolBar;
if (core.domStyle.isVertical) {
toolBar.style.left = 0;
- toolBar.style.right = "";
- toolBar.style.width = obj.outerWidth + "px";
- toolBar.style.top = obj.statusBarHeightInVertical + obj.outerHeight + "px";
- toolBar.style.height = obj.toolbarHeightInVertical + "px";
+ toolBar.style.right = '';
+ toolBar.style.width = obj.outerWidth + 'px';
+ toolBar.style.top =
+ obj.statusBarHeightInVertical + obj.outerHeight + 'px';
+ toolBar.style.height = obj.toolbarHeightInVertical + 'px';
toolBar.style.background = obj.globalAttribute.toolsBackground;
- }
- else {
+ } else {
if (obj.extendToolbar) {
- toolBar.style.left = "";
+ toolBar.style.left = '';
toolBar.style.right = 0;
- toolBar.style.width = obj.outerWidth + "px";
- toolBar.style.top = obj.outerHeight + "px";
- toolBar.style.height = obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER + "px";
+ toolBar.style.width = obj.outerWidth + 'px';
+ toolBar.style.top = obj.outerHeight + 'px';
+ toolBar.style.height =
+ obj.TOOLBAR_HEIGHT * core.domStyle.scale + obj.BORDER + 'px';
toolBar.style.background = obj.globalAttribute.toolsBackground;
} else {
toolBar.style.left = 0;
- toolBar.style.right = "";
- toolBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER + "px";
- toolBar.style.top = 0.75 * obj.outerHeight + "px";
- toolBar.style.height = 0.25 * obj.outerHeight + "px";
+ toolBar.style.right = '';
+ toolBar.style.width =
+ obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER + 'px';
+ toolBar.style.top = 0.75 * obj.outerHeight + 'px';
+ toolBar.style.height = 0.25 * obj.outerHeight + 'px';
toolBar.style.background = 'transparent';
}
}
toolBar.style.borderLeft = obj.border;
- toolBar.style.borderRight = toolBar.style.borderBottom = core.domStyle.isVertical || obj.extendToolbar ? obj.border : '';
- toolBar.style.fontSize = 16 * core.domStyle.scale + "px";
+ toolBar.style.borderRight = toolBar.style.borderBottom =
+ core.domStyle.isVertical || obj.extendToolbar ? obj.border : '';
+ toolBar.style.fontSize = 16 * core.domStyle.scale + 'px';
- if (!core.domStyle.showStatusBar && !core.domStyle.isVertical && !obj.extendToolbar) {
+ if (
+ !core.domStyle.showStatusBar &&
+ !core.domStyle.isVertical &&
+ !obj.extendToolbar
+ ) {
toolBar.style.display = 'none';
} else {
toolBar.style.display = 'block';
}
-}
+};
control.prototype._resize_tools = function (obj) {
- var toolsHeight = 32 * core.domStyle.scale * ((core.domStyle.isVertical || obj.extendToolbar) && !obj.is15x15 ? 0.95 : 1);
+ var toolsHeight =
+ 32 *
+ core.domStyle.scale *
+ ((core.domStyle.isVertical || obj.extendToolbar) && !obj.is15x15
+ ? 0.95
+ : 1);
var toolsMarginLeft;
if (core.domStyle.isVertical || obj.extendToolbar)
toolsMarginLeft = (core._HALF_WIDTH_ - 3) * 3 * core.domStyle.scale;
else
- toolsMarginLeft = (obj.BAR_WIDTH * core.domStyle.scale - 9 - toolsHeight * 3) / 4;
+ toolsMarginLeft =
+ (obj.BAR_WIDTH * core.domStyle.scale - 9 - toolsHeight * 3) / 4;
for (var i = 0; i < core.dom.tools.length; ++i) {
var style = core.dom.tools[i].style;
- style.height = toolsHeight + "px";
- style.marginLeft = toolsMarginLeft + "px";
- style.marginTop = 3 * core.domStyle.scale + "px"
+ style.height = toolsHeight + 'px';
+ style.marginLeft = toolsMarginLeft + 'px';
+ style.marginTop = 3 * core.domStyle.scale + 'px';
}
- core.dom.hard.style.lineHeight = toolsHeight + "px";
+ core.dom.hard.style.lineHeight = toolsHeight + 'px';
if (core.domStyle.isVertical || obj.extendToolbar) {
- core.dom.hard.style.width = obj.outerWidth - 9 * toolsMarginLeft - 8.5 * toolsHeight - 12 + "px";
- }
- else {
- core.dom.hard.style.width = obj.BAR_WIDTH * core.domStyle.scale - 9 - 2 * toolsMarginLeft + "px";
+ core.dom.hard.style.width =
+ obj.outerWidth -
+ 9 * toolsMarginLeft -
+ 8.5 * toolsHeight -
+ 12 +
+ 'px';
+ } else {
+ core.dom.hard.style.width =
+ obj.BAR_WIDTH * core.domStyle.scale -
+ 9 -
+ 2 * toolsMarginLeft +
+ 'px';
if (!obj.is15x15) core.dom.hard.style.marginTop = 0;
}
-}
+};
diff --git a/public/libs/ui.js b/public/libs/ui.js
index 64afac4..16b8740 100644
--- a/public/libs/ui.js
+++ b/public/libs/ui.js
@@ -3223,242 +3223,6 @@ ui.prototype._drawCursor = function () {
////// 绘制怪物手册 //////
ui.prototype.drawBook = function (index) {};
-////// 绘制怪物属性的详细信息 //////
-ui.prototype._drawBookDetail = function (index) {
- var info = this._drawBookDetail_getInfo(index),
- enemy = info[0];
- if (!enemy) return;
- var content = info[1].join('\n');
- core.status.event.id = 'book-detail';
- core.animateFrame.tip = null;
- core.clearMap('data');
-
- var left = 10,
- width = core._PX_ - 2 * left,
- right = left + width;
- var content_left = left + 25,
- validWidth = right - content_left - 13;
- var height = Math.max(
- this.getTextContentHeight(content, {
- fontSize: 16,
- lineHeight: 24,
- maxWidth: validWidth
- }) + 58,
- 80
- ),
- top = (core._PY_ - height) / 2,
- bottom = top + height;
-
- core.setAlpha('data', 0.9);
- core.fillRect('data', left, top, width, height, '#000000');
- core.setAlpha('data', 1);
- core.strokeRect(
- 'data',
- left - 1,
- top - 1,
- width + 1,
- height + 1,
- core.arrayToRGBA(core.status.globalAttribute.borderColor),
- 2
- );
- core.playSound('确定');
- this._drawBookDetail_drawContent(enemy, content, {
- top: top,
- content_left: content_left,
- bottom: bottom,
- validWidth: validWidth
- });
-};
-
-ui.prototype._drawBookDetail_getInfo = function (index) {
- var floorId =
- core.floorIds[(core.status.event.ui || {}).index] ||
- core.status.floorId;
- // 清除浏览地图时的光环缓存
- if (floorId != core.status.floorId && core.status.checkBlock) {
- core.status.checkBlock.cache = {};
- }
- var enemys = core.enemys.getCurrentEnemys(floorId);
- if (enemys.length == 0) return [];
- index = core.clamp(index, 0, enemys.length - 1);
- var enemy = enemys[index],
- enemyId = enemy.id;
- var texts = core.enemys.getSpecialHint(enemyId);
- if (texts.length == 0) texts.push('该怪物无特殊属性。');
- if (enemy.description) texts.push(enemy.description + '\r');
- texts.push('');
- this._drawBookDetail_getTexts(enemy, floorId, texts);
- return [enemy, texts];
-};
-
-ui.prototype._drawBookDetail_getTexts = function (enemy, floorId, texts) {
- // --- 原始数值
- this._drawBookDetail_origin(enemy, texts);
- // --- 模仿临界计算器
- this._drawBookDetail_mofang(enemy, texts);
- // --- 吸血怪最低生命值
- this._drawBookDetail_vampire(enemy, floorId, texts);
- // --- 仇恨伤害
- this._drawBookDetail_hatred(enemy, texts);
- // --- 战斗回合数,临界表
- this._drawBookDetail_turnAndCriticals(enemy, floorId, texts);
-};
-
-ui.prototype._drawBookDetail_origin = function (enemy, texts) {
- // 怪物数值和原始值不一样时,在详细信息页显示原始数值
- var originEnemy = core.enemys._getCurrentEnemys_getEnemy(enemy.id);
- var content = [];
- if (enemy.locs != null && enemy.locs.length >= 0) {
- texts.push(
- '\r[#FF6A6A]\\d怪物坐标:\\d\r[]' + JSON.stringify(enemy.locs)
- );
- }
- ['hp', 'atk', 'def', 'point', 'money', 'exp'].forEach(function (one) {
- if (enemy[one] == null || originEnemy[one] == null) return;
- if (enemy[one] != originEnemy[one]) {
- content.push(core.getStatusLabel(one) + ' ' + originEnemy[one]);
- }
- });
- if (content.length > 0) {
- texts.push('\r[#FF6A6A]\\d原始数值:\\d\r[]' + content.join(';'));
- }
-};
-
-ui.prototype._drawBookDetail_mofang = function (enemy, texts) {
- // 模仿临界计算器
- if (core.enemys.hasSpecial(enemy.special, 10)) {
- var hp = enemy.hp;
- var delta = core.status.hero.atk - core.status.hero.def;
- if (delta < hp && hp <= 10000 && hp > 0) {
- texts.push(
- '\r[#FF6A6A]\\d模仿临界计算器:\\d\r[](当前攻防差' +
- core.formatBigNumber(delta) +
- ')'
- );
- var u = [];
- this._drawBookDetail_mofang_getArray(hp).forEach(function (t) {
- if (u.length < 20) u.push(t);
- else if (Math.abs(t[0] - delta) < Math.abs(u[0][0] - delta)) {
- u.shift();
- u.push(t);
- }
- });
- texts.push(
- JSON.stringify(
- u.map(function (v) {
- return core.formatBigNumber(v[0]) + ':' + v[1];
- })
- )
- );
- }
- }
-};
-
-ui.prototype._drawBookDetail_mofang_getArray = function (hp) {
- var arr = [];
- var last = 0,
- start = 0;
- for (var i = 1; i < hp; i++) {
- var now = parseInt((hp - 1) / i);
- if (now != last) {
- if (last != 0) {
- arr.push([start, last + 'x']);
- }
- last = now;
- start = i;
- }
- }
- if (last != 0) {
- arr.push([start, '1x']);
- arr.push([hp, '0']);
- }
- return arr;
-};
-
-ui.prototype._drawBookDetail_vampire = function (enemy, floorId, texts) {
- if (core.enemys.hasSpecial(enemy.special, 11)) {
- var damage = core.getDamage(enemy.id);
- if (damage != null) {
- // 二分HP
- var start = 1,
- end = 100 * damage;
- var nowHp = core.status.hero.hp;
- while (start < end) {
- var mid = Math.floor((start + end) / 2);
- core.status.hero.hp = mid;
- if (core.canBattle(enemy.id, enemy.x, enemy.y, floorId))
- end = mid;
- else start = mid + 1;
- }
- core.status.hero.hp = start;
- if (core.canBattle(enemy.id)) {
- texts.push(
- '\r[#FF6A6A]\\d打死该怪物最低需要生命值:\\d\r[]' +
- core.formatBigNumber(start)
- );
- }
- core.status.hero.hp = nowHp;
- }
- }
-};
-
-ui.prototype._drawBookDetail_hatred = function (enemy, texts) {
- if (core.enemys.hasSpecial(enemy.special, 17)) {
- texts.push(
- '\r[#FF6A6A]\\d当前仇恨伤害值:\\d\r[]' + core.getFlag('hatred', 0)
- );
- }
-};
-
-ui.prototype._drawBookDetail_turnAndCriticals = function (
- enemy,
- floorId,
- texts
-) {
- var damageInfo = core.getDamageInfo(
- enemy.id,
- null,
- enemy.x,
- enemy.y,
- floorId
- );
- texts.push(
- '\r[#FF6A6A]\\d战斗回合数:\\d\r[]' + ((damageInfo || {}).turn || 0)
- );
- // 临界表
- var criticals = core.enemys
- .nextCriticals(enemy.id, 8, enemy.x, enemy.y, floorId)
- .map(function (v) {
- return (
- core.formatBigNumber(v[0]) + ':' + core.formatBigNumber(v[1])
- );
- });
- while (criticals[0] == '0:0') criticals.shift();
- texts.push('\r[#FF6A6A]\\d临界表:\\d\r[]' + JSON.stringify(criticals));
-};
-
-ui.prototype._drawBookDetail_drawContent = function (enemy, content, pos) {
- // 名称
- core.setTextAlign('data', 'left');
- core.fillText(
- 'data',
- enemy.name,
- pos.content_left,
- pos.top + 30,
- core.status.globalAttribute.selectColor,
- this._buildFont(22, true)
- );
- var content_top = pos.top + 44;
-
- this.drawTextContent('data', content, {
- left: pos.content_left,
- top: content_top,
- maxWidth: pos.validWidth,
- fontSize: 16,
- lineHeight: 24
- });
-};
-
////// 绘制楼层传送器 //////
ui.prototype.drawFly = function (page) {
core.status.event.data = page;
@@ -3762,236 +3526,7 @@ ui.prototype._drawViewMaps_buildData = function (index, x, y) {
};
////// 绘制道具栏 //////
-ui.prototype._drawToolbox = function (index) {
- var info = this._drawToolbox_getInfo(index);
- this._drawToolbox_drawBackground();
-
- // 绘制线
- core.setAlpha('ui', 1);
- core.setStrokeStyle('ui', '#DDDDDD');
- core.canvas.ui.lineWidth = 2;
- core.canvas.ui.strokeWidth = 2;
- core.setTextAlign('ui', 'right');
- var line1 = core._PY_ - 306;
- this._drawToolbox_drawLine(line1, '消耗道具');
- var line2 = core._PY_ - 146;
- this._drawToolbox_drawLine(line2, '永久道具');
-
- this._drawToolbox_drawDescription(info, line1);
-
- this._drawToolbox_drawContent(
- info,
- line1,
- info.tools,
- info.toolsPage,
- true
- );
- this.drawPagination(info.toolsPage, info.toolsTotalPage, core._HEIGHT_ - 6);
- this._drawToolbox_drawContent(
- info,
- line2,
- info.constants,
- info.constantsPage
- );
- this.drawPagination(info.constantsPage, info.constantsTotalPage);
-
- core.setTextAlign('ui', 'center');
- core.fillText(
- 'ui',
- '[装备栏]',
- core._PX_ - 46,
- 25,
- '#DDDDDD',
- this._buildFont(15, true)
- );
- core.fillText('ui', '返回游戏', core._PX_ - 46, core._PY_ - 13);
-};
-
-////// 获得所有应该在道具栏显示的某个类型道具 //////
-ui.prototype.getToolboxItems = function (cls) {
- if (this.uidata.getToolboxItems) {
- return this.uidata.getToolboxItems(cls);
- }
- return Object.keys(core.status.hero.items[cls] || {})
- .filter(function (id) {
- return !core.material.items[id].hideInToolbox;
- })
- .sort();
-};
-
-ui.prototype._drawToolbox_getInfo = function (index) {
- // 设定eventdata
- if (!core.status.event.data || core.status.event.data.toolsPage == null)
- core.status.event.data = {
- toolsPage: 1,
- constantsPage: 1,
- selectId: null
- };
- // 获取物品列表
- var tools = core.getToolboxItems('tools'),
- constants = core.getToolboxItems('constants');
- // 处理页数
- var n = core._WIDTH_ - 1;
- var toolsPage = core.status.event.data.toolsPage;
- var constantsPage = core.status.event.data.constantsPage;
- var toolsTotalPage = Math.ceil(tools.length / n);
- var constantsTotalPage = Math.ceil(constants.length / n);
- // 处理index
- if (index == null)
- index = tools.length == 0 && constants.length > 0 ? n : 0;
- core.status.event.selection = index;
- // 确认选择对象
- var select, selectId;
- if (index < n) {
- select = index + (toolsPage - 1) * n;
- if (select >= tools.length) select = Math.max(0, tools.length - 1);
- selectId = tools[select];
- } else {
- select = (index % n) + (constantsPage - 1) * n;
- if (select >= constants.length)
- select = Math.max(0, constants.length - 1);
- selectId = constants[select];
- }
- if (!core.hasItem(selectId)) selectId = null;
- core.status.event.data.selectId = selectId;
- return {
- index: index,
- tools: tools,
- constants: constants,
- toolsPage: toolsPage,
- constantsPage: constantsPage,
- toolsTotalPage: toolsTotalPage,
- constantsTotalPage: constantsTotalPage,
- selectId: selectId
- };
-};
-
-ui.prototype._drawToolbox_drawBackground = function () {
- // 绘制
- core.clearMap('ui');
- core.setAlpha('ui', 0.85);
- core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
-};
-
-ui.prototype._drawToolbox_drawLine = function (yoffset, text) {
- core.setFillStyle('ui', '#DDDDDD');
- core.canvas.ui.beginPath();
- core.canvas.ui.moveTo(0, yoffset);
- core.canvas.ui.lineTo(core._PX_, yoffset);
- core.canvas.ui.stroke();
- core.canvas.ui.beginPath();
- core.canvas.ui.moveTo(core._PX_, yoffset - 1);
- core.canvas.ui.lineTo(core._PX_, yoffset - 25);
- core.canvas.ui.lineTo(core._PX_ - 72, yoffset - 25);
- core.canvas.ui.lineTo(core._PX_ - 102, yoffset - 1);
- core.canvas.ui.fill();
- core.fillText(
- 'ui',
- text,
- core._PX_ - 5,
- yoffset - 6,
- '#333333',
- this._buildFont(16, true)
- );
-};
-
-ui.prototype._drawToolbox_drawDescription = function (info, max_height) {
- core.setTextAlign('ui', 'left');
- if (!info.selectId) return;
- var item = core.material.items[info.selectId];
- var name = item.name || '未知道具';
- try {
- name = core.replaceText(name);
- } catch (e) {}
- core.fillText(
- 'ui',
- name,
- 10,
- 32,
- core.status.globalAttribute.selectColor,
- this._buildFont(20, true)
- );
- var text = item.text || '该道具暂无描述。';
- try {
- text = core.replaceText(text);
- } catch (e) {}
-
- var height = null;
- for (var fontSize = 17; fontSize >= 9; fontSize -= 2) {
- var config = {
- left: 10,
- top: 46,
- fontSize: fontSize,
- maxWidth: core._PX_ - 15,
- bold: false,
- color: 'white'
- };
- height = 42 + core.getTextContentHeight(text, config);
- if (height < max_height || fontSize == 9) {
- core.drawTextContent('ui', text, config);
- break;
- }
- }
- if (height < max_height - 33) {
- core.fillText(
- 'ui',
- '<继续点击该道具即可进行使用>',
- 10,
- max_height - 15,
- '#CCCCCC',
- this._buildFont(14, false)
- );
- }
-};
-
-ui.prototype._drawToolbox_drawContent = function (
- info,
- line,
- items,
- page,
- drawCount
-) {
- var n = core._HALF_WIDTH_;
- core.setTextAlign('ui', 'right');
- for (var i = 0; i < core._WIDTH_ - 1; i++) {
- var item = items[(core._WIDTH_ - 1) * (page - 1) + i];
- if (!item) continue;
- var yoffset = line + 54 * Math.floor(i / n) + 19;
- var icon = core.material.icons.items[item],
- image = core.material.images.items;
- core.drawImage(
- 'ui',
- image,
- 0,
- 32 * icon,
- 32,
- 32,
- 64 * (i % n) + 21,
- yoffset,
- 32,
- 32
- );
- if (drawCount)
- core.fillText(
- 'ui',
- core.itemCount(item),
- 64 * (i % n) + 56,
- yoffset + 33,
- '#FFFFFF',
- this._buildFont(14, true)
- );
- if (info.selectId == item)
- core.strokeRoundRect(
- 'ui',
- 64 * (i % n) + 17,
- yoffset - 4,
- 40,
- 40,
- 6,
- core.status.globalAttribute.selectColor
- );
- }
-};
+ui.prototype._drawToolbox = function (index) {};
////// 绘制装备界面 //////
ui.prototype._drawEquipbox = function (index) {
diff --git a/public/project/floors/MT1.js b/public/project/floors/MT1.js
index 3309eb8..8557c43 100644
--- a/public/project/floors/MT1.js
+++ b/public/project/floors/MT1.js
@@ -79,7 +79,7 @@ main.floors.MT1=
[20042, 0, 0,201, 0, 0,141, 0,141,202, 17, 0, 0, 0,20040],
[20042,202, 17, 17, 0, 0,205, 31, 0, 28, 17, 28, 0, 32,20040],
[20042, 0, 27, 17, 31,141,141,141,141,201, 17, 17, 17, 17,20040],
- [20042, 32, 0, 17, 0,201, 0, 0,201, 31,202, 0, 32, 0,20040],
+ [20042, 32, 0, 17, 0,201, 47, 0,201, 31,202, 0, 32, 0,20040],
[20036,20033,20033,20033,20033,20033,20034, 93,20032,20033,20033,20033,20033,20033,20035]
],
"bgmap": [
diff --git a/public/project/functions.js b/public/project/functions.js
index d181ab0..d9e1d71 100644
--- a/public/project/functions.js
+++ b/public/project/functions.js
@@ -1128,6 +1128,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// altKey:Alt键是否被按下,为true代表同时按下了Alt键
// 可以在这里任意增加或编辑每个按键的行为
+ if (core.status.lockControl) return;
+
// 如果处于正在行走状态,则不处理
if (core.isMoving()) return;
diff --git a/public/project/plugins.js b/public/project/plugins.js
index de27e68..0f18c40 100644
--- a/public/project/plugins.js
+++ b/public/project/plugins.js
@@ -8328,1363 +8328,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
};
},
- equipBox: function () {
- // 注:///// *** 裹起来的区域: 该区域内参数可以随意更改调整ui绘制 不会影响总体布局
- // 请尽量修改该区域而不是其他区域 修改的时候最好可以对照现有ui修改
-
- ///// *** 道具类型
- // cls对应name
- var itemClsName = {
- constants: '永久道具',
- tools: '消耗道具'
- };
- // 一页最大放的道具数量 将把整个道具左栏分成num份 每份是一个道具项
- var itemNum = 12;
- ///// ***
-
- // 背景设置
- this.drawBoxBackground = function (ctx) {
- core.setTextAlign(ctx, 'left');
- core.clearMap(ctx);
- core.deleteCanvas('_selector');
- var info = core.status.thisUIEventInfo || {};
-
- ///// *** 背景设置
- var max = core.__PIXELS__;
- var x = 2,
- y = x,
- w = max - x * 2,
- h = w;
- var borderWidth = 2,
- borderRadius = 5, // radius:圆角矩形的圆角半径
- borderStyle = '#fff';
- var backgroundColor = 'gray';
- // 设置背景不透明度(0.85)
- var backgroundAlpha = 0.85;
- ///// ***
-
- var start_x = x + borderWidth / 2,
- start_y = y + borderWidth / 2,
- width = max - start_x * 2,
- height = max - start_y * 2;
-
- // 渐变色背景的一个例子(黑色渐变白色):
- // 有关渐变色的具体知识请网上搜索canvas createGradient了解
-
- var grd = ctx.createLinearGradient(x, y, x + w, y);
- grd.addColorStop(0, '#555555');
- grd.addColorStop(1, '#cccccc');
- backgroundColor = grd;
-
- // 使用图片背景要注释掉下面的strokeRect和fillRoundRect
- // 图片背景的一个例子:
- /*
- core.drawImage(ctx, "xxx.png", x, y, w, h);
- core.strokeRect(ctx, x, y, w, h, borderStyle, borderWidth);
- */
- core.setAlpha(ctx, backgroundAlpha);
- core.strokeRoundRect(
- ctx,
- x,
- y,
- w,
- h,
- borderRadius,
- borderStyle,
- borderWidth
- );
- core.fillRoundRect(
- ctx,
- start_x,
- start_y,
- width,
- height,
- borderRadius,
- backgroundColor
- );
- core.setAlpha(ctx, 1);
-
- ///// *** 左栏配置
- var leftbar_height = height;
- // 左边栏宽度(width*0.6) 本身仅为坐标使用 需要与底下的rightbar_width(width*0.4)同时更改
- var leftbar_width = width * 0.6;
- ///// ***
-
- // xxx_right参数 代表最右侧坐标
- var leftbar_right = start_x + leftbar_width - borderWidth / 2;
- var leftbar_bottom = start_y + leftbar_height;
- var leftbar_x = start_x;
- var leftbar_y = start_y;
-
- ///// *** 道具栏配置
- var boxName_color = '#fff';
- var boxName_fontSize = 15;
- var boxName_font = core.ui._buildFont(boxName_fontSize, true);
- var arrow_x = 10 + start_x;
- var arrow_y = 10 + start_y;
- var arrow_width = 20;
- var arrow_style = 'white';
- // 暂时只能是1 否则不太行 等待新样板(2.7.3)之后对drawArrow做优化
- var arrow_lineWidth = 1;
- // 右箭头
- var rightArrow_right = leftbar_right - 10;
- // 道具内栏顶部坐标 本质是通过该项 控制(道具栏顶部文字和箭头)与道具内栏顶部的间隔
- var itembar_top = arrow_y + 15;
- ///// ***
-
- var itembar_right = rightArrow_right;
- var boxName =
- core.status.event.id == 'toolbox'
- ? '\r[yellow]道具栏\r | 装备栏'
- : '道具栏 | \r[yellow]装备栏\r';
- core.drawArrow(
- ctx,
- arrow_x + arrow_width,
- arrow_y,
- arrow_x,
- arrow_y,
- arrow_style,
- arrow_lineWidth
- );
- core.drawArrow(
- ctx,
- rightArrow_right - arrow_width,
- arrow_y,
- rightArrow_right,
- arrow_y,
- arrow_style,
- arrow_lineWidth
- );
- core.setTextAlign(ctx, 'center');
- core.setTextBaseline(ctx, 'middle');
- var changeBox = () => {
- var id = core.status.event.id;
- core.closePanel();
- if (id == 'toolbox') core.openEquipbox();
- else core.openToolbox();
- };
- core.fillText(
- ctx,
- boxName,
- (leftbar_right + leftbar_x) / 2,
- arrow_y + 2,
- boxName_color,
- boxName_font
- );
-
- ///// *** 底栏按钮
- var pageBtn_radius = 8;
- // xxx_left 最左侧坐标
- var pageBtn_left = leftbar_x + 3;
- var pageBtn_right = leftbar_right - 3;
- // xxx_bottom 最底部坐标
- var pageBtn_bottom = leftbar_bottom - 2;
- var pageBtn_borderStyle = '#fff';
- var pageBtn_borderWidth = 2;
- var pageText_color = '#fff';
- // 底部按钮与上面的道具内栏的间隔大小
- var bottomSpace = 8;
- ///// ***
-
- core.drawItemListbox_setPageBtn(
- ctx,
- pageBtn_left,
- pageBtn_right,
- pageBtn_bottom,
- pageBtn_radius,
- pageBtn_borderStyle,
- pageBtn_borderWidth
- );
- var page = info.page || 1;
- var pageFontSize = pageBtn_radius * 2 - 4;
- var pageFont = core.ui._buildFont(pageFontSize);
- core.setPageItems(page);
- var num = itemNum;
- if (core.status.event.id == 'equipbox') num -= 5;
- var maxPage = info.maxPage;
- var pageText = page + ' / ' + maxPage;
- core.setTextAlign(ctx, 'center');
- core.setTextBaseline(ctx, 'bottom');
- core.fillText(
- ctx,
- pageText,
- (leftbar_x + leftbar_right) / 2,
- pageBtn_bottom,
- pageText_color,
- pageFont
- );
- core.addUIEventListener(
- start_x,
- start_y,
- leftbar_right - start_x,
- arrow_y - start_y + 13,
- changeBox
- );
- var itembar_height = Math.ceil(
- pageBtn_bottom -
- pageBtn_radius * 2 -
- pageBtn_borderWidth / 2 -
- bottomSpace -
- itembar_top
- );
- var oneItemHeight = (itembar_height - 4) / itemNum;
- return {
- x: start_x,
- y: start_y,
- width: width,
- height: height,
- leftbar_right: leftbar_right,
- obj: {
- x: arrow_x,
- y: itembar_top,
- width: itembar_right - arrow_x,
- height: itembar_height,
- oneItemHeight: oneItemHeight
- }
- };
- };
-
- this.drawItemListbox = function (ctx, obj) {
- ctx = ctx || core.canvas.ui;
- var itembar_x = obj.x,
- itembar_y = obj.y,
- itembar_width = obj.width,
- itembar_height = obj.height,
- itemNum = obj.itemNum,
- oneItemHeight = obj.oneItemHeight;
- var itembar_right = itembar_x + itembar_width;
- var info = core.status.thisUIEventInfo || {};
- var obj = {};
- var page = info.page || 1,
- index = info.index,
- select = info.select || {};
-
- ///// *** 道具栏内栏配置
- var itembar_style = 'black';
- var itembar_alpha = 0.7;
- // 一个竖屏下减少道具显示的例子:
- // if (core.domStyle.isVertical) itemNum = 10;
- // 每个道具项的上下空隙占总高度的比例
- var itembar_marginHeightRatio = 0.2;
- // 左右间隔空隙
- var item_marginLeft = 2;
- var item_x = itembar_x + 2,
- item_y = itembar_y + 2,
- item_right = itembar_right - 2,
- itemName_color = '#fff';
- // 修改此项以更换闪烁光标
- var item_selector = 'winskin.png';
- ///// ***
-
- core.setAlpha(ctx, itembar_alpha);
- core.fillRect(
- ctx,
- itembar_x,
- itembar_y,
- itembar_width,
- itembar_height,
- itembar_style
- );
- core.setAlpha(ctx, 1);
- var pageItems = core.setPageItems(page);
- var marginHeight = itembar_marginHeightRatio * oneItemHeight;
- core.setTextBaseline(ctx, 'middle');
- var originColor = itemName_color;
- for (var i = 0; i < pageItems.length; i++) {
- itemName_color = originColor;
- var item = pageItems[i];
- // 设置某个的字体颜色的一个例子
- // if (item.id == "xxx") itemName_color = "green";
- core.drawItemListbox_drawItem(
- ctx,
- item_x,
- item_right,
- item_y,
- oneItemHeight,
- item_marginLeft,
- marginHeight,
- itemName_color,
- pageItems[i]
- );
- if (index == i + 1)
- core.ui._drawWindowSelector(
- item_selector,
- item_x + 1,
- item_y - 1,
- item_right - item_x - 2,
- oneItemHeight - 2
- );
- item_y += oneItemHeight;
- }
- };
-
- this.drawToolboxRightbar = function (ctx, obj) {
- ctx = ctx || core.canvas.ui;
- var info = core.status.thisUIEventInfo || {};
- var page = info.page || 1,
- index = info.index || 1,
- select = info.select || {};
- var start_x = obj.x,
- start_y = obj.y,
- width = obj.width,
- height = obj.height;
- var toolboxRight = start_x + width,
- toolboxBottom = start_y + height;
-
- ///// *** 侧边栏(rightbar)背景设置(物品介绍)
- var rightbar_width = width * 0.4;
- var rightbar_height = height;
- var rightbar_lineWidth = 2;
- var rightbar_lineStyle = '#fff';
- ///// ***
-
- var rightbar_x =
- toolboxRight - rightbar_width - rightbar_lineWidth / 2;
- var rightbar_y = start_y;
- core.drawLine(
- ctx,
- rightbar_x,
- rightbar_y,
- rightbar_x,
- rightbar_y + rightbar_height,
- rightbar_lineStyle,
- rightbar_lineWidth
- );
-
- // 获取道具id(有可能为null)
- var itemId = select.id;
- var item = core.material.items[itemId];
-
- ///// *** 侧边栏物品Icon信息
- var iconRect_y = rightbar_y + 10;
- // space:间距
- // 这里布局设定iconRect与侧边栏左边框 itemName与工具栏右边框 itemRect与itemName的间距均为space
- var space = 15;
- var iconRect_x = rightbar_x + space;
- var iconRect_radius = 2,
- iconRect_width = 32,
- iconRect_height = 32,
- iconRect_style = '#fff',
- iconRect_lineWidth = 2;
- ///// ***
-
- var iconRect_bottom = iconRect_y + iconRect_height,
- iconRect_right = iconRect_x + iconRect_width;
-
- ///// *** 侧边栏各项信息
- var itemTextFontSize = 15,
- itemText_x = iconRect_x - 4,
- itemText_y = Math.floor(start_y + rightbar_height * 0.25), // 坐标取整防止模糊
- itemClsFontSize = 15,
- itemClsFont = core.ui._buildFont(itemClsFontSize),
- itemClsColor = '#fff',
- itemCls_x = itemText_x - itemClsFontSize / 2,
- itemCls_middle = (iconRect_bottom + itemText_y) / 2, //_middle代表文字的中心y坐标
- itemNameFontSize = 18,
- itemNameColor = '#fff',
- itemNameFont = core.ui._buildFont(itemNameFontSize, true);
- var itemName_x = iconRect_right + space;
- var itemName_middle =
- iconRect_y + iconRect_height / 2 + iconRect_lineWidth;
- // 修改这里可以编辑未选中道具时的默认值
- var defaultItem = {
- cls: 'constants',
- name: '未知道具',
- text: '没有道具最永久'
- };
- var defaultEquip = {
- cls: 'equips',
- name: '未知装备',
- text: '一无所有,又何尝不是一种装备',
- equip: {
- type: '装备'
- }
- };
- ///// ***
-
- var originItem = item;
- if (core.status.event.id == 'equipbox') item = item || defaultEquip;
- item = item || defaultItem;
- var itemCls = item.cls,
- itemName = item.name,
- itemText = item.text;
- /* 一个根据道具id修改道具名字(右栏)的例子
- * if (item.id == "xxx") itemNameColor = "red";
- */
- var itemClsName = core.getItemClsName(item);
- var itemNameMaxWidth =
- rightbar_width -
- iconRect_width -
- iconRect_lineWidth * 2 -
- space * 2;
- core.strokeRoundRect(
- ctx,
- iconRect_x,
- iconRect_y,
- iconRect_width,
- iconRect_height,
- iconRect_radius,
- iconRect_style,
- iconRect_lineWidth
- );
- if (item.id)
- core.drawIcon(
- ctx,
- item.id,
- iconRect_x + iconRect_lineWidth / 2,
- iconRect_y + iconRect_lineWidth / 2,
- iconRect_width - iconRect_lineWidth,
- iconRect_height - iconRect_lineWidth
- );
- core.setTextAlign(ctx, 'left');
- core.setTextBaseline(ctx, 'middle');
- core.fillText(
- ctx,
- itemName,
- itemName_x,
- itemName_middle,
- itemNameColor,
- itemNameFont,
- itemNameMaxWidth
- );
- core.fillText(
- ctx,
- '【' + itemClsName + '】',
- itemCls_x,
- itemCls_middle,
- itemClsColor,
- itemClsFont
- );
- var statusText = '';
- 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)
- );
- 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
- );
- 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';
- }
- }
- itemText = statusText + itemText;
- core.drawTextContent(ctx, itemText, {
- left: itemText_x,
- top: itemText_y,
- bold: false,
- color: 'white',
- align: 'left',
- fontSize: itemTextFontSize,
- maxWidth:
- rightbar_width -
- (itemText_x - rightbar_x) * 2 +
- itemTextFontSize / 2
- });
-
- ///// *** 退出按钮设置
- var btnRadius = 10;
- var btnBorderWidth = 2;
- var btnRight = toolboxRight - 2;
- var btnBottom = toolboxBottom - 2;
- var btnBorderStyle = '#fff';
- ///// ***
-
- // 获取圆心位置
- var btn_x = btnRight - btnRadius - btnBorderWidth / 2;
- btn_y = btnBottom - btnRadius - btnBorderWidth / 2;
- core.drawToolbox_setExitBtn(
- ctx,
- btn_x,
- btn_y,
- btnRadius,
- btnBorderStyle,
- btnBorderWidth
- );
-
- ///// *** 使用按钮设置
- var useBtnHeight = btnRadius * 2;
- // 这里不设置useBtnWidth而是根据各项数据自动得出width
- var useBtnRadius = useBtnHeight / 2;
- var useBtn_x = rightbar_x + 4,
- useBtn_y = btnBottom - useBtnHeight;
- var useBtnBorderStyle = '#fff';
- var useBtnBorderWidth = btnBorderWidth;
- ///// ***
-
- core.drawToolbox_setUseBtn(
- ctx,
- useBtn_x,
- useBtn_y,
- useBtnRadius,
- useBtnHeight,
- useBtnBorderStyle,
- useBtnBorderWidth
- );
- };
-
- this.drawEquipbox_drawOthers = function (ctx, obj) {
- var info = core.status.thisUIEventInfo;
-
- ///// *** 装备格设置
- var equipList_lineWidth = 2;
- var equipList_boxSize = 32;
- var equipList_borderWidth = 2;
- var equipList_borderStyle = '#fff';
- var equipList_nameColor = '#fff';
- ///// ***
-
- var equipList_x = obj.x + 4,
- equipList_bottom = obj.obj.y - equipList_lineWidth,
- equipList_y =
- equipList_bottom - obj.obj.oneItemHeight * reduceItem - 2,
- equipList_height = equipList_bottom - equipList_y;
- var equipList_right = obj.leftbar_right,
- equipList_width = equipList_right - equipList_x;
- core.drawLine(
- ctx,
- obj.x,
- equipList_bottom + equipList_lineWidth / 2,
- equipList_right,
- equipList_bottom + equipList_lineWidth / 2,
- equipList_borderStyle,
- equipList_lineWidth
- );
- var toDrawList = core.status.globalAttribute.equipName,
- len = toDrawList.length;
-
- ///// *** 装备格设置
- var maxItem = 4;
- var box_width = 32,
- box_height = 32,
- box_borderStyle = '#fff',
- box_selectBorderStyle = 'gold', // 选中的装备格的颜色
- box_borderWidth = 2;
- var boxName_fontSize = 14,
- boxName_space = 2,
- boxName_color = '#fff'; // 装备格名称与上面的装备格框的距离
- var maxLine = Math.ceil(len / maxItem);
- ///// ***
- var l = Math.sqrt(len);
- if (Math.pow(l) == len && len != 4) {
- if (l <= maxItem) maxItem = l;
- }
- maxItem = Math.min(toDrawList.length, maxItem);
- info.equips = maxItem;
-
- var boxName_font = core.ui._buildFont(boxName_fontSize);
- // 总宽高减去所有装备格宽高得到空隙大小
- var oneBoxWidth = box_width + box_borderWidth * 2;
- var oneBoxHeight =
- box_height +
- boxName_fontSize +
- boxName_space +
- 2 * box_borderWidth;
- var space_y =
- (equipList_height - maxLine * oneBoxHeight) / (1 + maxLine),
- space_x =
- (equipList_width - maxItem * oneBoxWidth) / (1 + maxItem);
- var box_x = equipList_x + space_x,
- box_y = equipList_y + space_y;
- for (var i = 0; i < len; i++) {
- var id = core.getEquip(i),
- name = toDrawList[i];
- var selectBorder = false;
- if (core.status.thisUIEventInfo.select.type == i)
- selectBorder = true;
- var borderStyle = selectBorder
- ? box_selectBorderStyle
- : box_borderStyle;
- core.drawEquipbox_drawOne(
- ctx,
- name,
- id,
- box_x,
- box_y,
- box_width,
- box_height,
- boxName_space,
- boxName_font,
- boxName_color,
- borderStyle,
- box_borderWidth
- );
- var todo = new Function(
- "core.clickOneEquipbox('" + id + "'," + i + ')'
- );
- core.addUIEventListener(
- box_x - box_borderWidth / 2,
- box_y - box_borderWidth / 2,
- oneBoxWidth,
- oneBoxHeight,
- todo
- );
- box_x += space_x + oneBoxWidth;
- if ((i + 1) % maxItem == 0) {
- box_x = equipList_x + space_x;
- box_y += space_y + oneBoxHeight;
- }
- }
- };
-
- this.drawToolbox = function (ctx) {
- ctx = ctx || core.canvas.ui;
- core.status.thisEventClickArea = [];
-
- var info = core.drawBoxBackground(ctx);
- info.itemNum = itemNum;
- core.drawItemListbox(ctx, info.obj);
- core.drawToolboxRightbar(ctx, info);
- core.setTextBaseline(ctx, 'alphabetic');
- core.setTextAlign('left');
- };
-
- var reduceItem = 4;
- this.drawEquipbox = function (ctx) {
- ctx = ctx || core.canvas.ui;
- core.status.thisEventClickArea = [];
- var info = core.drawBoxBackground(ctx);
- info.itemNum = itemNum - reduceItem;
- info.obj.y += info.obj.oneItemHeight * reduceItem;
- info.obj.height -= info.obj.oneItemHeight * reduceItem;
- core.drawItemListbox(ctx, info.obj);
- core.drawEquipbox_drawOthers(ctx, info);
- core.drawToolboxRightbar(ctx, info);
- core.setTextBaseline(ctx, 'alphabetic');
- core.setTextAlign('left');
- };
-
- this.drawEquipbox_drawOne = function (
- ctx,
- name,
- id,
- x,
- y,
- width,
- height,
- space,
- font,
- color,
- style,
- lineWidth
- ) {
- if (id)
- core.drawIcon(
- ctx,
- id,
- x + lineWidth / 2,
- y + lineWidth / 2,
- width,
- height
- );
- core.strokeRect(
- ctx,
- x,
- y,
- width + lineWidth,
- height + lineWidth,
- style,
- lineWidth
- );
- core.setTextAlign(ctx, 'center');
- core.setTextBaseline(ctx, 'top');
- var tx = (x + x + lineWidth / 2 + width) / 2,
- ty = y + height + (lineWidth / 2) * 3 + space;
- core.fillText(ctx, name, tx, ty, color, font);
- core.setTextBaseline(ctx, 'alphabetic');
- core.setTextAlign('left');
- };
-
- this.drawItemListbox_drawItem = function (
- ctx,
- left,
- right,
- top,
- height,
- marginLeft,
- marginHeight,
- style,
- id
- ) {
- var info = core.status.thisUIEventInfo;
- var nowClick = info.index;
- var item = core.material.items[id] || {};
- var name = item.name || '???';
- var num = core.itemCount(id) || 0;
- var fontSize = Math.floor(height - marginHeight * 2);
- core.setTextAlign(ctx, 'right');
- var numText = 'x' + num;
- core.fillText(
- ctx,
- numText,
- right - marginLeft,
- top + height / 2,
- style,
- core.ui._buildFont(fontSize)
- );
- if (name != '???')
- core.drawIcon(
- ctx,
- id,
- left + marginLeft,
- top + marginHeight,
- fontSize,
- fontSize
- );
- var text_x = left + marginLeft + fontSize + 2;
- var maxWidth = right - core.calWidth(ctx, numText) - text_x;
- core.setTextAlign(ctx, 'left');
- core.fillText(
- ctx,
- name,
- text_x,
- top + height / 2,
- style,
- core.ui._buildFont(fontSize),
- maxWidth
- );
- var todo = new Function(
- "var id = '" + id + "';\ncore.clickItemFunc(id)"
- );
- core.addUIEventListener(left, top, right - left, height, todo);
- };
-
- this.setPageItems = function (page) {
- var num = itemNum;
- if (core.status.event.id == 'equipbox') num -= reduceItem;
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- page = page || info.page;
- var items = core.getToolboxItems(
- core.status.event.id == 'toolbox' ? 'all' : 'equips'
- );
- info.allItems = items;
- var maxPage = Math.ceil(items.length / num);
- info.maxPage = maxPage;
- var pageItems = items.slice((page - 1) * num, page * num);
- info.pageItems = pageItems;
- info.maxItem = pageItems.length;
- if (items.length == 0 && pageItems.length == 0) info.index = null;
- if (pageItems.length == 0 && info.page > 1) {
- info.page = Math.max(1, info.page - 1);
- return core.setPageItems(info.page);
- }
- return pageItems;
- };
-
- this.drawToolbox_setExitBtn = function (
- ctx,
- x,
- y,
- r,
- style,
- lineWidth
- ) {
- core.strokeCircle(ctx, x, y, r, style, lineWidth);
- ctx.textAlign = 'center';
- ctx.textBaseline = 'middle';
- var textSize = Math.sqrt(2) * r;
- core.fillText(
- ctx,
- 'x',
- x,
- y,
- style,
- core.ui._buildFont(textSize),
- textSize
- );
- core.setTextAlign(ctx, 'start');
- core.setTextBaseline(ctx, 'top');
-
- var todo = () => {
- core.closePanel();
- };
- core.addUIEventListener(x - r, y - r, r * 2, r * 2, todo);
- };
-
- this.drawToolbox_setUseBtn = function (
- ctx,
- x,
- y,
- r,
- h,
- style,
- lineWidth
- ) {
- core.setTextAlign(ctx, 'left');
- core.setTextBaseline(ctx, 'top');
- var fontSize = h - 4;
- var font = core.ui._buildFont(fontSize);
- var text = core.status.event.id == 'toolbox' ? '使用' : '装备';
- if (core.status.thisUIEventInfo.select.action == 'unload')
- text = '卸下';
- var w = core.calWidth(ctx, text, font) + 2 * r + lineWidth / 2;
-
- core.strokeRoundRect(ctx, x, y, w, h, r, style, lineWidth);
- core.fillText(ctx, text, x + r, y + lineWidth / 2 + 2, style, font);
-
- var todo = () => {
- core.useSelectItemInBox();
- };
- core.addUIEventListener(x, y, w, h, todo);
- };
-
- this.drawItemListbox_setPageBtn = function (
- ctx,
- left,
- right,
- bottom,
- r,
- style,
- lineWidth
- ) {
- var offset = lineWidth / 2 + r;
-
- var x = left + offset;
- var y = bottom - offset;
- var pos = (Math.sqrt(2) / 2) * (r - lineWidth / 2);
- core.fillPolygon(
- ctx,
- [
- [x - pos, y],
- [x + pos - 2, y - pos],
- [x + pos - 2, y + pos]
- ],
- style
- );
- core.strokeCircle(ctx, x, y, r, style, lineWidth);
- var todo = () => {
- core.addItemListboxPage(-1);
- };
- core.addUIEventListener(
- x - r - 2,
- y - r - 2,
- r * 2 + 4,
- r * 2 + 4,
- todo
- );
-
- x = right - offset;
- core.fillPolygon(
- ctx,
- [
- [x + pos, y],
- [x - pos + 2, y - pos],
- [x - pos + 2, y + pos]
- ],
- style
- );
- core.strokeCircle(ctx, x, y, r, style, lineWidth);
- var todo = () => {
- core.addItemListboxPage(1);
- };
- core.addUIEventListener(
- x - r - 2,
- y - r - 2,
- r * 2 + 4,
- r * 2 + 4,
- todo
- );
- };
-
- this.clickItemFunc = function (id) {
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- if (info.select.id == id) return core.useSelectItemInBox();
- info.select = {};
- info.select.id = id;
- core.setIndexAndSelect('index');
- core.refreshBox();
- };
-
- this.clickOneEquipbox = function (id, type) {
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- if (info.select.id == id && info.select.type == type)
- core.useSelectItemInBox();
- else
- core.status.thisUIEventInfo.select = {
- id: id,
- type: type,
- action: 'unload'
- };
- return core.refreshBox();
- };
-
- core.ui.getToolboxItems = function (cls) {
- var list = Object.keys(core.status.hero.items[cls] || {});
- if (cls == 'all') {
- for (var name in core.status.hero.items) {
- if (name == 'equips') continue;
- list = list.concat(
- Object.keys(core.status.hero.items[name])
- );
- }
- return list
- .filter(id => {
- return !core.material.items[id].hideInToolbox;
- })
- .sort();
- }
-
- if (this.uidata.getToolboxItems) {
- return this.uidata.getToolboxItems(cls);
- }
- return list
- .filter(id => {
- return !core.material.items[id].hideInToolbox;
- })
- .sort();
- };
-
- this.useSelectItemInBox = function () {
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- if (!info.select.id) return;
- var id = info.select.id;
- if (core.status.event.id == 'toolbox') {
- core.events.tryUseItem(id);
- // core.closePanel();
- } else if (core.status.event.id == 'equipbox') {
- var action = info.select.action || 'load';
- info.index = 1;
- if (action == 'load') {
- var type = core.getEquipTypeById(id);
- core.loadEquip(id, () => {
- core.status.route.push('equip:' + id);
- info.select.type = type;
- core.setIndexAndSelect('select');
- core.drawEquipbox();
- });
- } else {
- var type = info.select.type;
- core.unloadEquip(type, () => {
- core.status.route.push('unEquip:' + type);
- core.setIndexAndSelect('select');
- core.drawEquipbox();
- });
- }
- }
- };
-
- this.setIndexAndSelect = function (toChange) {
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- core.setPageItems(info.page);
- var index = info.index || 1;
- var items = info.pageItems;
- if (info.select.type) {
- var type = info.select.type;
- id = core.getEquip(type);
- info.index = null;
- info.select = {
- id: id,
- action: 'unload',
- type: type
- };
- return;
- } else {
- info.select.type = null;
- }
- if (toChange == 'index')
- info.index = items.indexOf(info.select.id) + 1;
- else {
- var id = info.pageItems[index - 1];
- info.select.id = id;
- }
- };
-
- this.addItemListboxPage = function (num) {
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- var maxPage = info.maxPage || 1;
- info.page = info.page || 1;
- info.page += num;
- if (info.page <= 0) info.page = maxPage;
- if (info.page > maxPage) info.page = 1;
- info.index = 1;
- core.setPageItems(info.page);
- core.setIndexAndSelect('select');
- core.refreshBox();
- };
-
- this.addItemListboxIndex = function (num) {
- var info = core.status.thisUIEventInfo;
- if (!info) return;
- var maxItem = info.maxItem || 0;
- info.index = info.index || 0;
- info.index += num;
- if (info.index <= 0) info.index = 1;
- if (info.index > maxItem) info.index = maxItem;
- core.setIndexAndSelect('select');
- core.refreshBox();
- };
-
- this.addEquipboxType = function (num) {
- var info = core.status.thisUIEventInfo;
- var type = info.select.type;
- if (type == null && num > 0) info.select.type = 0;
- else info.select.type = type + num;
- var max = core.status.globalAttribute.equipName.length;
- if (info.select.type >= max) {
- info.select = {};
- return core.addItemListboxPage(0);
- } else {
- var m = Math.abs(info.select.type);
- if (info.select.type < 0) info.select.type = max - m;
- core.refreshBox();
- return;
- }
- };
-
- core.actions._keyDownToolbox = function (keycode) {
- if (!core.status.thisEventClickArea) return;
- if (keycode == 37) {
- // left
- core.addItemListboxPage(-1);
- return;
- }
- if (keycode == 38) {
- // up
- core.addItemListboxIndex(-1);
- return;
- }
- if (keycode == 39) {
- // right
- core.addItemListboxPage(1);
- return;
- }
- if (keycode == 40) {
- // down
- core.addItemListboxIndex(1);
- return;
- }
- };
-
- ////// 工具栏界面时,放开某个键的操作 //////
- core.actions._keyUpToolbox = function (keycode) {
- if (keycode == 81) {
- core.ui.closePanel();
- if (core.isReplaying()) core.control._replay_equipbox();
- else core.openEquipbox();
- return;
- }
- if (keycode == 84 || keycode == 27 || keycode == 88) {
- core.closePanel();
- return;
- }
- if (keycode == 13 || keycode == 32 || keycode == 67) {
- var info = core.status.thisUIEventInfo;
- if (info.select) {
- core.useSelectItemInBox();
- }
- return;
- }
- };
-
- core.actions._keyDownEquipbox = function (keycode) {
- if (!core.status.thisEventClickArea) return;
- if (keycode == 37) {
- // left
- var info = core.status.thisUIEventInfo;
- if (info.index != null) return core.addItemListboxPage(-1);
- return core.addEquipboxType(-1);
- }
- if (keycode == 38) {
- // up
- var info = core.status.thisUIEventInfo;
- if (info.index == 1) {
- info.select.type =
- core.status.globalAttribute.equipName.length - 1;
- core.setIndexAndSelect();
- return core.refreshBox();
- }
- if (info.index) return core.addItemListboxIndex(-1);
- return core.addEquipboxType(-1 * info.equips);
- }
- if (keycode == 39) {
- // right
- var info = core.status.thisUIEventInfo;
- if (info.index != null) return core.addItemListboxPage(1);
- return core.addEquipboxType(1);
- }
- if (keycode == 40) {
- // down
- var info = core.status.thisUIEventInfo;
- if (info.index) return core.addItemListboxIndex(1);
- return core.addEquipboxType(info.equips);
- }
- };
-
- core.actions._keyUpEquipbox = function (keycode, altKey) {
- if (altKey && keycode >= 48 && keycode <= 57) {
- core.items.quickSaveEquip(keycode - 48);
- return;
- }
- if (keycode == 84) {
- core.ui.closePanel();
- if (core.isReplaying()) core.control._replay_toolbox();
- else core.openToolbox();
- return;
- }
- if (keycode == 81 || keycode == 27 || keycode == 88) {
- core.closePanel();
- return;
- }
- if (keycode == 13 || keycode == 32 || keycode == 67) {
- var info = core.status.thisUIEventInfo;
- if (info.select) core.useSelectItemInBox();
- return;
- }
- };
-
- core.registerAction(
- 'ondown',
- 'inEventClickAction',
- (x, y, px, py) => {
- if (!core.status.thisEventClickArea) return false;
- // console.log(px + "," + py);
- var info = core.status.thisEventClickArea;
- for (var i = 0; i < info.length; i++) {
- var obj = info[i];
- if (
- px >= obj.x &&
- px <= obj.x + obj.width &&
- py > obj.y &&
- py < obj.y + obj.height
- ) {
- if (obj.todo) obj.todo();
- break;
- }
- }
- return true;
- },
- 51
- );
- core.registerAction(
- 'onclick',
- 'stopClick',
- () => {
- if (core.status.thisEventClickArea) return true;
- },
- 51
- );
-
- this.addUIEventListener = function (x, y, width, height, todo) {
- if (!core.status.thisEventClickArea) return;
- var obj = {
- x: x,
- y: y,
- width: width,
- height: height,
- todo: todo
- };
- core.status.thisEventClickArea.push(obj);
- };
-
- this.initThisEventInfo = function () {
- core.status.thisUIEventInfo = {
- page: 1,
- select: {}
- };
- core.status.thisEventClickArea = [];
- };
-
- this.refreshBox = function () {
- if (!core.status.event.id) return;
- if (core.status.event.id == 'toolbox') core.drawToolbox();
- else core.drawEquipbox();
- };
-
- core.ui.closePanel = function () {
- if (core.status.hero && core.status.hero.flags) {
- // 清除全部临时变量
- Object.keys(core.status.hero.flags).forEach(name => {
- if (name.startsWith('@temp@') || /^arg\d+$/.test(name)) {
- delete core.status.hero.flags[name];
- }
- });
- }
- this.clearUI();
- core.maps.generateGroundPattern();
- core.updateStatusBar(true);
- core.unlockControl();
- core.status.event.data = null;
- core.status.event.id = null;
- core.status.event.selection = null;
- core.status.event.ui = null;
- core.status.event.interval = null;
- core.status.thisUIEventInfo = null;
- core.status.thisEventClickArea = null;
- };
-
- this.getItemClsName = function (item) {
- if (item == null) return itemClsName;
- if (item.cls == 'equips') {
- if (typeof item.equip.type == 'string') return item.equip.type;
- var type = core.getEquipTypeById(item.id);
- return core.status.globalAttribute.equipName[type];
- } else return itemClsName[item.cls] || item.cls;
- };
-
- core.events.openToolbox = function (fromUserAction) {
- if (core.isReplaying()) return;
- if (!this._checkStatus('toolbox', fromUserAction)) return;
- core.initThisEventInfo();
- core.drawToolbox();
- };
-
- core.events.openEquipbox = function (fromUserAction) {
- if (core.isReplaying()) return;
- if (!this._checkStatus('equipbox', fromUserAction)) return;
- core.initThisEventInfo();
- core.drawEquipbox();
- };
-
- core.control._replay_toolbox = function () {
- if (!core.isPlaying() || !core.isReplaying()) return;
- if (!core.status.replay.pausing)
- return core.drawTip('请先暂停录像');
- if (
- core.isMoving() ||
- core.status.replay.animate ||
- core.status.event.id
- )
- return core.drawTip('请等待当前事件的处理结束');
-
- core.lockControl();
- core.status.event.id = 'toolbox';
- core.drawToolbox();
- };
-
- core.control._replay_equipbox = function () {
- if (!core.isPlaying() || !core.isReplaying()) return;
- if (!core.status.replay.pausing)
- return core.drawTip('请先暂停录像');
- if (
- core.isMoving() ||
- core.status.replay.animate ||
- core.status.event.id
- )
- return core.drawTip('请等待当前事件的处理结束');
-
- core.lockControl();
- core.status.event.id = 'equipbox';
- core.drawEquipbox();
- };
-
- core.control._replayAction_item = function (action) {
- if (action.indexOf('item:') != 0) return false;
- var itemId = action.substring(5);
- if (!core.canUseItem(itemId)) return false;
- if (
- core.material.items[itemId].hideInReplay ||
- core.status.replay.speed == 24
- ) {
- core.useItem(itemId, false, core.replay);
- return true;
- }
- core.status.event.id = 'toolbox';
- core.initThisEventInfo();
- var info = core.status.thisUIEventInfo;
- var items = core.getToolboxItems('all');
- core.setPageItems(1);
- var index = items.indexOf(itemId) + 1;
- info.page = Math.ceil(index / info.maxItem);
- info.index = index % info.maxItem || info.maxItem;
- core.setIndexAndSelect('select');
- core.setPageItems(info.page);
- core.drawToolbox();
- setTimeout(() => {
- core.ui.closePanel();
- core.useItem(itemId, false, core.replay);
- }, core.control.__replay_getTimeout());
- return true;
- };
-
- core.control._replayAction_equip = function (action) {
- if (action.indexOf('equip:') != 0) return false;
- var itemId = action.substring(6);
- var items = core.getToolboxItems('equips');
- var index = items.indexOf(itemId) + 1;
- if (index < 1) return false;
- core.status.route.push(action);
- if (
- core.material.items[itemId].hideInReplay ||
- core.status.replay.speed == 24
- ) {
- core.loadEquip(itemId, core.replay);
- return true;
- }
- core.status.event.id = 'equipbox';
- core.initThisEventInfo();
- var info = core.status.thisUIEventInfo;
- core.setPageItems(1);
- info.page = Math.ceil(index / info.maxItem);
- info.index = index % info.maxItem || info.maxItem;
- core.setIndexAndSelect('select');
- core.setPageItems(info.page);
- core.drawEquipbox();
- setTimeout(() => {
- core.ui.closePanel();
- core.loadEquip(itemId, core.replay);
- }, core.control.__replay_getTimeout());
- return true;
- };
-
- core.control._replayAction_unEquip = function (action) {
- if (action.indexOf('unEquip:') != 0) return false;
- var equipType = parseInt(action.substring(8));
- if (!core.isset(equipType)) return false;
- core.status.route.push(action);
- if (core.status.replay.speed == 24) {
- core.unloadEquip(equipType, core.replay);
- return true;
- }
- core.status.event.id = 'equipbox';
- core.initThisEventInfo();
- var info = core.status.thisUIEventInfo;
- core.setPageItems(1);
- info.select.type = equipType;
- core.setIndexAndSelect();
- core.drawEquipbox();
- setTimeout(() => {
- core.ui.closePanel();
- core.unloadEquip(equipType, core.replay);
- }, core.control.__replay_getTimeout());
- return true;
- };
- core.registerReplayAction('item', core.control._replayAction_item);
- core.registerReplayAction('equip', core.control._replayAction_equip);
- core.registerReplayAction(
- 'unEquip',
- core.control._replayAction_unEquip
- );
- },
chase: function () {
// 山野追逐战
// 初始变量
@@ -10325,7 +8968,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
link.type = 'text/css';
link.href = data;
document.head.appendChild(link);
- console.log(`hot reload css: ${data}`);
+ console.log(`css hot reload: ${data}`);
}
});
}
@@ -10353,7 +8996,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
core.updateStatusBar(true, true);
}
- console.log(`hot reload floor: ${data}`);
+ console.log(`floor hot reload: ${data}`);
}
/**
@@ -10460,12 +9103,18 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
if (data === 'enemys') {
core.enemys.enemys = after;
+ for (var enemyId in after) {
+ core.enemys.enemys[enemyId].id = enemyId;
+ }
core.material.enemys = core.getEnemys();
} else if (data === 'icons') {
core.icons.icons = after;
core.material.icons = core.getIcons();
} else if (data === 'items') {
core.items.items = after;
+ for (var itemId in after) {
+ core.items.items[itemId].id = itemId;
+ }
core.material.items = core.getItems();
} else if (data === 'maps') {
core.maps.blocksInfo = after;
@@ -10641,8 +9290,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}
},
uiChange: function () {
+ if (main.replayChecking) return;
ui.prototype.drawBook = function () {
+ if (main.replayChecking) return;
return (core.plugin.bookOpened.value = true);
};
+
+ ui.prototype._drawToolbox = function () {
+ if (main.replayChecking) return;
+ return (core.plugin.toolOpened.value = true);
+ };
}
};
diff --git a/public/styles.css b/public/styles.css
index 5958386..75c630b 100644
--- a/public/styles.css
+++ b/public/styles.css
@@ -1,4 +1,5 @@
-html, body {
+html,
+body {
margin: 0;
padding: 0;
width: 100%;
@@ -7,6 +8,15 @@
overflow: hidden;
}
+#game {
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
#gameGroup {
position: absolute;
box-sizing: border-box;
@@ -80,7 +90,7 @@
}
#startTopHint {
- color: #66CCFF;
+ color: #66ccff;
position: absolute;
bottom: 0;
left: 5%;
@@ -89,12 +99,12 @@
}
#startBackground {
- position:absolute;
- top:50%;
- left:50%;
+ position: absolute;
+ top: 50%;
+ left: 50%;
height: 100%;
width: auto;
- transform:translate(-50%,-50%);
+ transform: translate(-50%, -50%);
z-index: 260;
}
@@ -132,11 +142,11 @@
padding: 15px 25px;
min-width: 20%;
/* default value */
- background-color: #32369F;
+ background-color: #32369f;
opacity: 0.85;
- color: #FFFFFF;
- border: #FFFFFF 2px solid;
- caret-color: #FFD700;
+ color: #ffffff;
+ border: #ffffff 2px solid;
+ caret-color: #ffd700;
border-radius: 10px;
}
@@ -207,20 +217,20 @@
left: 0;
padding: 3px;
}
-#statusBar .status{
+#statusBar .status {
user-select: none;
position: relative;
display: block;
float: left;
width: 100%;
}
-.status img{
+.status img {
vertical-align: middle;
width: auto;
height: 100%;
max-height: 1.6em;
}
-#statusBar span{
+#statusBar span {
user-select: none;
font: bold italic 1.1em Verdana;
display: inline;
@@ -245,7 +255,7 @@
display: none;
padding: 3px;
}
-#toolBar .tools{
+#toolBar .tools {
position: relative;
display: block;
float: left;
@@ -257,13 +267,18 @@ p#hard {
vertical-align: middle;
display: inline-block;
color: red;
- font: bold normal 1.1em "Arial Black";
+ font: bold normal 1.1em 'Arial Black';
text-align: center;
margin: 0 6px 6px 0;
word-break: keep-all;
}
-span#poison, span#weak, span#curse, span#pickaxe, span#bomb, span#fly {
+span#poison,
+span#weak,
+span#curse,
+span#pickaxe,
+span#bomb,
+span#fly {
user-select: none;
font-style: normal;
font-size: 1em;
@@ -346,8 +361,8 @@ p#name {
position: fixed;
top: 0;
left: 0;
- background: rgba(127,127,127,0.6);
- z-index: 2000
+ background: rgba(127, 127, 127, 0.6);
+ z-index: 2000;
}
#inputDialog {
@@ -373,7 +388,7 @@ p#name {
margin-bottom: 10px;
padding: 5px 3px;
border: 1px solid;
- background: #F0F0F0;
+ background: #f0f0f0;
}
#inputYes {
@@ -382,24 +397,37 @@ p#name {
}
#inputNo {
- float:right;
+ float: right;
margin-right: 10%;
}
-#_selector, ._uievent_selector {
+#_selector,
+._uievent_selector {
animation: selector 2s ease-in-out 0s infinite normal none running;
}
@-webkit-keyframes selector {
- 0% { opacity: 0.95; }
- 50% { opacity: 0.55; }
- 100% { opacity: 0.95; }
+ 0% {
+ opacity: 0.95;
+ }
+ 50% {
+ opacity: 0.55;
+ }
+ 100% {
+ opacity: 0.95;
+ }
}
@keyframes selector {
- 0% { opacity: 0.95; }
- 50% { opacity: 0.55; }
- 100% { opacity: 0.95; }
+ 0% {
+ opacity: 0.95;
+ }
+ 50% {
+ opacity: 0.55;
+ }
+ 100% {
+ opacity: 0.95;
+ }
}
#next {
@@ -412,8 +440,8 @@ p#name {
border-bottom-style: solid;
border-right-width: 4px;
border-right-style: solid;
- -webkit-animation: next .5s ease-in-out alternate infinite;
- animation: next .5s ease-in-out alternate infinite;
+ -webkit-animation: next 0.5s ease-in-out alternate infinite;
+ animation: next 0.5s ease-in-out alternate infinite;
left: 0;
top: 0;
opacity: 0.7;
@@ -463,15 +491,27 @@ p#name {
}
@-webkit-keyframes startImage {
- 0% { opacity: 0; }
- 60% { opacity: 1; }
- 100% { opacity: 0; }
+ 0% {
+ opacity: 0;
+ }
+ 60% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0;
+ }
}
@keyframes startImage {
- 0% { opacity: 0; }
- 60% { opacity: 1; }
- 100% { opacity: 0; }
+ 0% {
+ opacity: 0;
+ }
+ 60% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0;
+ }
}
.startImageDivAnimation {
@@ -480,13 +520,21 @@ p#name {
}
@-webkit-keyframes startImageDivDisappear {
- 0% { opacity: 1 }
- 100% { opacity: 0 }
+ 0% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0;
+ }
}
@keyframes startImageDivDisappear {
- 0% { opacity: 1 }
- 100% { opacity: 0 }
+ 0% {
+ opacity: 1;
+ }
+ 100% {
+ opacity: 0;
+ }
}
#ui-editor {
@@ -499,4 +547,4 @@ p#name {
@font-face {
font-family: Fira Code;
src: url(../src/fonts/FiraCode-Regular.ttf);
-}
\ No newline at end of file
+}
diff --git a/src/components/boxAnimate.vue b/src/components/boxAnimate.vue
index ae3c24a..65bfee6 100644
--- a/src/components/boxAnimate.vue
+++ b/src/components/boxAnimate.vue
@@ -1,56 +1,78 @@
-
+
diff --git a/src/components/scroll.vue b/src/components/scroll.vue
index 316e6cb..38d27e0 100644
--- a/src/components/scroll.vue
+++ b/src/components/scroll.vue
@@ -11,12 +11,13 @@
+
+