怪物手册初步

This commit is contained in:
unanmed 2022-11-16 23:01:23 +08:00
parent da771dae91
commit 8517dbdabf
34 changed files with 5179 additions and 1858 deletions

View File

@ -1 +1,2 @@
vite.config.ts
public/project/*.js

2
components.d.ts vendored
View File

@ -7,8 +7,10 @@ export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
ADivider: typeof import('ant-design-vue/es')['Divider']
BookOne: typeof import('./src/components/bookOne.vue')['default']
BoxAnimate: typeof import('./src/components/boxAnimate.vue')['default']
EnemyOne: typeof import('./src/components/enemyOne.vue')['default']
Scroll: typeof import('./src/components/scroll.vue')['default']
}
}

View File

@ -39,8 +39,8 @@
## 成就
- 学坏了:学习电摇嘲讽
- 学坏了:学习敌人的电摇嘲讽技能
- 我就是傻子:不学习反抢夺通过第二章
- 真能刷:勇气之路的刷血怪刷到 15w 以上的血
- 满腹经纶:把所有怪物技能都学一遍
- 满腹经纶:把所有能学的怪物技能都学一遍
- 冰与火之舞:通过第二章特殊战的困难难度

View File

@ -8,5 +8,5 @@ function defineConfig(config: MotaConfig): MotaConfig {
export default defineConfig({
// 这里修改塔的name请保持与全塔属性的完全相同否则发布之后可能无法进行游玩
name: 'template'
name: 'HumanBreak'
});

View File

@ -27,6 +27,7 @@
"@types/node": "^18.11.7",
"@vitejs/plugin-legacy": "^2.3.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^2.1.1",
"compressing": "^1.6.2",
"fontmin": "^0.9.9",
"form-data": "^4.0.0",

View File

@ -9,6 +9,7 @@ specifiers:
'@types/node': ^18.11.7
'@vitejs/plugin-legacy': ^2.3.0
'@vitejs/plugin-vue': ^3.2.0
'@vitejs/plugin-vue-jsx': ^2.1.1
ant-design-vue: ^3.2.13
axios: ^1.1.3
compressing: ^1.6.2
@ -44,6 +45,7 @@ devDependencies:
'@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
compressing: 1.6.2
fontmin: 0.9.9
form-data: 4.0.0
@ -58,6 +60,14 @@ devDependencies:
packages:
/@ampproject/remapping/2.2.0:
resolution: {integrity: sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==}
engines: {node: '>=6.0.0'}
dependencies:
'@jridgewell/gen-mapping': 0.1.1
'@jridgewell/trace-mapping': 0.3.17
dev: true
/@ant-design/colors/6.0.0:
resolution: {integrity: sha512-qAZRvPzfdWHtfameEGP2Qvuf838NhergR35o+EuVyB5XvSA98xod5r4utvi4TJ3ywmevm290g9nsCG5MryrdWQ==}
dependencies:
@ -89,6 +99,170 @@ packages:
'@babel/highlight': 7.18.6
dev: true
/@babel/compat-data/7.20.1:
resolution: {integrity: sha512-EWZ4mE2diW3QALKvDMiXnbZpRvlj+nayZ112nK93SnhqOtpdsbVD4W+2tEoT3YNBAG9RBR0ISY758ZkOgsn6pQ==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/core/7.20.2:
resolution: {integrity: sha512-w7DbG8DtMrJcFOi4VrLm+8QM4az8Mo+PuLBKLp2zrYRCow8W/f9xiXm5sN53C8HksCyDQwCKha9JiDoIyPjT2g==}
engines: {node: '>=6.9.0'}
dependencies:
'@ampproject/remapping': 2.2.0
'@babel/code-frame': 7.18.6
'@babel/generator': 7.20.4
'@babel/helper-compilation-targets': 7.20.0_@babel+core@7.20.2
'@babel/helper-module-transforms': 7.20.2
'@babel/helpers': 7.20.1
'@babel/parser': 7.20.3
'@babel/template': 7.18.10
'@babel/traverse': 7.20.1
'@babel/types': 7.20.2
convert-source-map: 1.9.0
debug: 4.3.4
gensync: 1.0.0-beta.2
json5: 2.2.1
semver: 6.3.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/generator/7.20.4:
resolution: {integrity: sha512-luCf7yk/cm7yab6CAW1aiFnmEfBJplb/JojV56MYEK7ziWfGmFlTfmL9Ehwfy4gFhbjBfWO1wj7/TuSbVNEEtA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
'@jridgewell/gen-mapping': 0.3.2
jsesc: 2.5.2
dev: true
/@babel/helper-annotate-as-pure/7.18.6:
resolution: {integrity: sha512-duORpUiYrEpzKIop6iNbjnwKLAKnJ47csTyRACyEmWj0QdUrm5aqNJGHSSEQSUAvNW0ojX0dOmK9dZduvkfeXA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-compilation-targets/7.20.0_@babel+core@7.20.2:
resolution: {integrity: sha512-0jp//vDGp9e8hZzBc6N/KwA5ZK3Wsm/pfm4CrY7vzegkVxc65SgSn6wYOnwHe9Js9HRQ1YTCKLGPzDtaS3RoLQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/compat-data': 7.20.1
'@babel/core': 7.20.2
'@babel/helper-validator-option': 7.18.6
browserslist: 4.21.4
semver: 6.3.0
dev: true
/@babel/helper-create-class-features-plugin/7.20.2_@babel+core@7.20.2:
resolution: {integrity: sha512-k22GoYRAHPYr9I+Gvy2ZQlAe5mGy8BqWst2wRt8cwIufWTxrsVshhIBvYNqC80N0GSFWTsqRVexOtfzlgOEDvA==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0
dependencies:
'@babel/core': 7.20.2
'@babel/helper-annotate-as-pure': 7.18.6
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.19.0
'@babel/helper-member-expression-to-functions': 7.18.9
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/helper-replace-supers': 7.19.1
'@babel/helper-split-export-declaration': 7.18.6
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-environment-visitor/7.18.9:
resolution: {integrity: sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-function-name/7.19.0:
resolution: {integrity: sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.10
'@babel/types': 7.20.2
dev: true
/@babel/helper-hoist-variables/7.18.6:
resolution: {integrity: sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-member-expression-to-functions/7.18.9:
resolution: {integrity: sha512-RxifAh2ZoVU67PyKIO4AMi1wTenGfMR/O/ae0CCRqwgBAt5v7xjdtRw7UoSbsreKrQn5t7r89eruK/9JjYHuDg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-module-imports/7.18.6:
resolution: {integrity: sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-module-transforms/7.20.2:
resolution: {integrity: sha512-zvBKyJXRbmK07XhMuujYoJ48B5yvvmM6+wcpv6Ivj4Yg6qO7NOZOSnvZN9CRl1zz1Z4cKf8YejmCMh8clOoOeA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-module-imports': 7.18.6
'@babel/helper-simple-access': 7.20.2
'@babel/helper-split-export-declaration': 7.18.6
'@babel/helper-validator-identifier': 7.19.1
'@babel/template': 7.18.10
'@babel/traverse': 7.20.1
'@babel/types': 7.20.2
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-optimise-call-expression/7.18.6:
resolution: {integrity: sha512-HP59oD9/fEHQkdcbgFCnbmgH5vIQTJbxh2yf+CdM89/glUNnuzr87Q8GIjGEnOktTROemO0Pe0iPAYbqZuOUiA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-plugin-utils/7.20.2:
resolution: {integrity: sha512-8RvlJG2mj4huQ4pZ+rU9lqKi9ZKiRmuvGuM2HlWmkmgOhbs6zEAw6IEiJ5cQqGbDzGZOhwuOQNtZMi/ENLjZoQ==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helper-replace-supers/7.19.1:
resolution: {integrity: sha512-T7ahH7wV0Hfs46SFh5Jz3s0B6+o8g3c+7TMxu7xKfmHikg7EAZ3I2Qk9LFhjxXq8sL7UkP5JflezNwoZa8WvWw==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-member-expression-to-functions': 7.18.9
'@babel/helper-optimise-call-expression': 7.18.6
'@babel/traverse': 7.20.1
'@babel/types': 7.20.2
transitivePeerDependencies:
- supports-color
dev: true
/@babel/helper-simple-access/7.20.2:
resolution: {integrity: sha512-+0woI/WPq59IrqDYbVGfshjT5Dmk/nnbdpcF8SnMhhXObpTq2KNBdLFRFrkVdbDOyUmHBCxzm5FHV1rACIkIbA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-split-export-declaration/7.18.6:
resolution: {integrity: sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/types': 7.20.2
dev: true
/@babel/helper-string-parser/7.19.4:
resolution: {integrity: sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==}
engines: {node: '>=6.9.0'}
@ -97,6 +271,22 @@ packages:
resolution: {integrity: sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==}
engines: {node: '>=6.9.0'}
/@babel/helper-validator-option/7.18.6:
resolution: {integrity: sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==}
engines: {node: '>=6.9.0'}
dev: true
/@babel/helpers/7.20.1:
resolution: {integrity: sha512-J77mUVaDTUJFZ5BpP6mMn6OIl3rEWymk2ZxDBQJUG3P+PbmyMcF3bYWvz0ma69Af1oobDqT/iAsvzhB58xhQUg==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/template': 7.18.10
'@babel/traverse': 7.20.1
'@babel/types': 7.20.2
transitivePeerDependencies:
- supports-color
dev: true
/@babel/highlight/7.18.6:
resolution: {integrity: sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==}
engines: {node: '>=6.9.0'}
@ -113,6 +303,40 @@ packages:
dependencies:
'@babel/types': 7.20.2
/@babel/plugin-syntax-jsx/7.18.6_@babel+core@7.20.2:
resolution: {integrity: sha512-6mmljtAedFGTWu2p/8WIORGwy+61PLgOMPOdazc7YoJ9ZCWUyFy3A6CpPkRKLKD1ToAesxX8KGEViAiLo9N+7Q==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.20.2
'@babel/helper-plugin-utils': 7.20.2
dev: true
/@babel/plugin-syntax-typescript/7.20.0_@babel+core@7.20.2:
resolution: {integrity: sha512-rd9TkG+u1CExzS4SM1BlMEhMXwFLKVjOAFFCDx9PbX5ycJWDoWMcwdJH9RhkPu1dOgn5TrxLot/Gx6lWFuAUNQ==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.20.2
'@babel/helper-plugin-utils': 7.20.2
dev: true
/@babel/plugin-transform-typescript/7.20.2_@babel+core@7.20.2:
resolution: {integrity: sha512-jvS+ngBfrnTUBfOQq8NfGnSbF9BrqlR6hjJ2yVxMkmO5nL/cdifNbI30EfjRlN4g5wYWNnMPyj5Sa6R1pbLeag==}
engines: {node: '>=6.9.0'}
peerDependencies:
'@babel/core': ^7.0.0-0
dependencies:
'@babel/core': 7.20.2
'@babel/helper-create-class-features-plugin': 7.20.2_@babel+core@7.20.2
'@babel/helper-plugin-utils': 7.20.2
'@babel/plugin-syntax-typescript': 7.20.0_@babel+core@7.20.2
transitivePeerDependencies:
- supports-color
dev: true
/@babel/runtime/7.20.1:
resolution: {integrity: sha512-mrzLkl6U9YLF8qpqI7TB82PESyEGjm/0Ly91jG575eVxMMlb8fYfOXFZIJ8XfLrJZQbm7dlKry2bJmXBUEkdFg==}
engines: {node: '>=6.9.0'}
@ -125,6 +349,33 @@ packages:
engines: {node: '>=6.9.0'}
dev: true
/@babel/template/7.18.10:
resolution: {integrity: sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/parser': 7.20.3
'@babel/types': 7.20.2
dev: true
/@babel/traverse/7.20.1:
resolution: {integrity: sha512-d3tN8fkVJwFLkHkBN479SOsw4DMZnz8cdbL/gvuDuzy3TS6Nfw80HuQqhw1pITbIruHyh7d1fMA47kWzmcUEGA==}
engines: {node: '>=6.9.0'}
dependencies:
'@babel/code-frame': 7.18.6
'@babel/generator': 7.20.4
'@babel/helper-environment-visitor': 7.18.9
'@babel/helper-function-name': 7.19.0
'@babel/helper-hoist-variables': 7.18.6
'@babel/helper-split-export-declaration': 7.18.6
'@babel/parser': 7.20.3
'@babel/types': 7.20.2
debug: 4.3.4
globals: 11.12.0
transitivePeerDependencies:
- supports-color
dev: true
/@babel/types/7.20.2:
resolution: {integrity: sha512-FnnvsNWgZCr232sqtXggapvlkk/tuwR/qhGzcmxI0GXLCjmPYQPzio2FbdlWuY6y1sHFfQKk+rRbUZ9VStQMog==}
engines: {node: '>=6.9.0'}
@ -167,6 +418,14 @@ packages:
resolution: {integrity: sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==}
dev: true
/@jridgewell/gen-mapping/0.1.1:
resolution: {integrity: sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==}
engines: {node: '>=6.0.0'}
dependencies:
'@jridgewell/set-array': 1.1.2
'@jridgewell/sourcemap-codec': 1.4.14
dev: true
/@jridgewell/gen-mapping/0.3.2:
resolution: {integrity: sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==}
engines: {node: '>=6.0.0'}
@ -343,6 +602,22 @@ packages:
vite: 3.2.3_sjdpriiyqai3ghwmd5e3ldppum
dev: true
/@vitejs/plugin-vue-jsx/2.1.1_vite@3.2.3+vue@3.2.45:
resolution: {integrity: sha512-JgDhxstQlwnHBvZ1BSnU5mbmyQ14/t5JhREc6YH5kWyu2QdAAOsLF6xgHoIWarj8tddaiwFrNzLbWJPudpXKYA==}
engines: {node: ^14.18.0 || >=16.0.0}
peerDependencies:
vite: ^3.0.0
vue: ^3.0.0
dependencies:
'@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
vue: 3.2.45
transitivePeerDependencies:
- supports-color
dev: true
/@vitejs/plugin-vue/3.2.0_vite@3.2.3+vue@3.2.45:
resolution: {integrity: sha512-E0tnaL4fr+qkdCNxJ+Xd0yM31UwMkQje76fsDVBBUCoGOUPexu2VDUYHL8P4CwV+zMvWw6nlRw19OnRKmYAJpw==}
engines: {node: ^14.18.0 || >=16.0.0}
@ -394,6 +669,27 @@ packages:
'@volar/vue-language-core': 1.0.9
dev: true
/@vue/babel-helper-vue-transform-on/1.0.2:
resolution: {integrity: sha512-hz4R8tS5jMn8lDq6iD+yWL6XNB699pGIVLk7WSJnn1dbpjaazsjZQkieJoRX6gW5zpYSCFqQ7jUquPNY65tQYA==}
dev: true
/@vue/babel-plugin-jsx/1.1.1_@babel+core@7.20.2:
resolution: {integrity: sha512-j2uVfZjnB5+zkcbc/zsOc0fSNGCMMjaEXP52wdwdIfn0qjFfEYpYZBFKFg+HHnQeJCVrjOeO0YxgaL7DMrym9w==}
dependencies:
'@babel/helper-module-imports': 7.18.6
'@babel/plugin-syntax-jsx': 7.18.6_@babel+core@7.20.2
'@babel/template': 7.18.10
'@babel/traverse': 7.20.1
'@babel/types': 7.20.2
'@vue/babel-helper-vue-transform-on': 1.0.2
camelcase: 6.3.0
html-tags: 3.2.0
svg-tags: 1.0.0
transitivePeerDependencies:
- '@babel/core'
- supports-color
dev: true
/@vue/compiler-core/3.2.45:
resolution: {integrity: sha512-rcMj7H+PYe5wBV3iYeUgbCglC+pbpN8hBLTJvRiK2eKQiWqu+fG9F+8sW99JdL4LQi7Re178UOxn09puSXvn4A==}
dependencies:
@ -656,6 +952,17 @@ packages:
fill-range: 7.0.1
dev: true
/browserslist/4.21.4:
resolution: {integrity: sha512-CBHJJdDmgjl3daYjN5Cp5kbTf1mUhZoS+beLklHIvkOWscs83YAhLlF3Wsh/lciQYAcbBJgTOD44VtG31ZM4Hw==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001431
electron-to-chromium: 1.4.284
node-releases: 2.0.6
update-browserslist-db: 1.0.10_browserslist@4.21.4
dev: true
/buffer-alloc-unsafe/1.1.0:
resolution: {integrity: sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==}
dev: true
@ -749,6 +1056,10 @@ packages:
engines: {node: '>=10'}
dev: true
/caniuse-lite/1.0.30001431:
resolution: {integrity: sha512-zBUoFU0ZcxpvSt9IU66dXVT/3ctO1cy4y9cscs1szkPlcWb6pasYM144GqrUygUbT+k7cmUCW61cvskjcv0enQ==}
dev: true
/chalk/2.4.2:
resolution: {integrity: sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==}
engines: {node: '>=4'}
@ -1008,6 +1319,10 @@ packages:
stream-shift: 1.0.1
dev: true
/electron-to-chromium/1.4.284:
resolution: {integrity: sha512-M8WEXFuKXMYMVr45fo8mq0wUrrJHheiKZf6BArTKk9ZBYCKJEOU5H8cdWgDT+qCVZf7Na4lVUaZsA+h6uA9+PA==}
dev: true
/emoji-regex/8.0.0:
resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==}
dev: true
@ -1260,6 +1575,11 @@ packages:
esbuild-windows-arm64: 0.15.13
dev: true
/escalade/3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
engines: {node: '>=6'}
dev: true
/escape-string-regexp/1.0.5:
resolution: {integrity: sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==}
engines: {node: '>=0.8.0'}
@ -1446,6 +1766,11 @@ packages:
wide-align: 1.1.5
dev: true
/gensync/1.0.0-beta.2:
resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==}
engines: {node: '>=6.9.0'}
dev: true
/get-intrinsic/1.1.3:
resolution: {integrity: sha512-QJVz1Tj7MS099PevUG5jvnt9tSkXN8K14dxQlikJuPt4uD9hHAHjLyLBiLR5zELelBdD9QNRAXZzsJx0WaDL9A==}
dependencies:
@ -1515,6 +1840,11 @@ packages:
once: 1.4.0
dev: true
/globals/11.12.0:
resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==}
engines: {node: '>=4'}
dev: true
/graceful-fs/4.2.10:
resolution: {integrity: sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==}
dev: true
@ -1563,6 +1893,11 @@ packages:
lru-cache: 6.0.0
dev: true
/html-tags/3.2.0:
resolution: {integrity: sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==}
engines: {node: '>=8'}
dev: true
/http-cache-semantics/4.1.0:
resolution: {integrity: sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==}
dev: true
@ -1792,6 +2127,12 @@ packages:
/js-tokens/4.0.0:
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
/jsesc/2.5.2:
resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==}
engines: {node: '>=4'}
hasBin: true
dev: true
/json-parse-even-better-errors/2.3.1:
resolution: {integrity: sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==}
dev: true
@ -1800,6 +2141,12 @@ packages:
resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==}
dev: true
/json5/2.2.1:
resolution: {integrity: sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==}
engines: {node: '>=6'}
hasBin: true
dev: true
/jsonfile/6.1.0:
resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==}
dependencies:
@ -2170,6 +2517,10 @@ packages:
- supports-color
dev: true
/node-releases/2.0.6:
resolution: {integrity: sha512-PiVXnNuFm5+iYkLBNeq5211hvO38y63T0i2KKh2KnUs3RpzJ+JtODFjkD8yjLwnDkTYF1eKXheUwdssR+NRZdg==}
dev: true
/nopt/6.0.0:
resolution: {integrity: sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==}
engines: {node: ^12.13.0 || ^14.15.0 || >=16.0.0}
@ -2563,6 +2914,11 @@ packages:
dev: true
optional: true
/semver/6.3.0:
resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==}
hasBin: true
dev: true
/semver/7.3.8:
resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==}
engines: {node: '>=10'}
@ -2721,6 +3077,10 @@ packages:
engines: {node: '>= 0.4'}
dev: true
/svg-tags/1.0.0:
resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==}
dev: true
/systemjs/6.13.0:
resolution: {integrity: sha512-P3cgh2bpaPvAO2NE3uRp/n6hmk4xPX4DQf+UzTlCAycssKdqhp6hjw+ENWe+aUS7TogKRFtptMosTSFeC6R55g==}
dev: true
@ -2951,6 +3311,17 @@ packages:
webpack-virtual-modules: 0.4.6
dev: true
/update-browserslist-db/1.0.10_browserslist@4.21.4:
resolution: {integrity: sha512-OztqDenkfFkbSG+tRxBeAnCVPckDBcvibKd35yDONx6OU8N7sqgwc7rCbkJ/WcYtVRZ4ba68d6byhC21GFh7sQ==}
hasBin: true
peerDependencies:
browserslist: '>= 4.21.0'
dependencies:
browserslist: 4.21.4
escalade: 3.1.1
picocolors: 1.0.0
dev: true
/util-deprecate/1.0.2:
resolution: {integrity: sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==}
dev: true

View File

@ -1,5 +1,4 @@
"use strict";
'use strict';
function icons() {
this._init();
@ -11,23 +10,22 @@ icons.prototype._init = function () {
// tileset的起点
this.tilesetStartOffset = 10000;
}
};
icons.prototype.getIcons = function () {
var icons = core.clone(this.icons);
icons.hero.leftup = icons.hero.leftdown = icons.hero.left;
icons.hero.rightup = icons.hero.rightdown = icons.hero.right;
return icons;
}
};
////// 根据道具ID获得其cls //////
icons.prototype.getClsFromId = function (id) {
for (var cls in core.material.icons) {
if (cls != 'hero' && id in core.material.icons[cls])
return cls;
if (cls != 'hero' && id in core.material.icons[cls]) return cls;
}
return null;
}
};
icons.prototype.getAllIconIds = function () {
if (this.allIconIds) return this.allIconIds;
@ -36,9 +34,9 @@ icons.prototype.getAllIconIds = function () {
this.allIconIds = this.allIconIds.concat(Object.keys(this.icons[type]));
}
return this.allIconIds;
}
};
icons.prototype._getAnimateFrames = function (cls) {
icons.prototype.getAnimateFrames = function (cls) {
if (cls == 'enemys' || cls == 'npcs') {
return 2;
}
@ -46,18 +44,16 @@ icons.prototype._getAnimateFrames = function (cls) {
return 4;
}
return 1;
}
};
////// 根据图块数字或ID获得所在的tileset和坐标信息 //////
icons.prototype.getTilesetOffset = function (id) {
if (typeof id == 'string') {
id = core.getIdOfThis(id);
// Tileset的ID必须是 X+数字 的形式
if (!/^X\d+$/.test(id)) return null;
id = parseInt(id.substring(1));
}
else if (typeof id != 'number') {
} else if (typeof id != 'number') {
return null;
}
@ -66,12 +62,14 @@ icons.prototype.getTilesetOffset = function (id) {
for (var i in core.tilesets) {
var imgName = core.tilesets[i];
var img = core.material.images.tilesets[imgName];
var width = Math.floor(parseInt(img.getAttribute('_width')) / 32), height = Math.floor(parseInt(img.getAttribute('_height')) / 32);
var width = Math.floor(parseInt(img.getAttribute('_width')) / 32),
height = Math.floor(parseInt(img.getAttribute('_height')) / 32);
if (id >= startOffset && id < startOffset + width * height) {
var x = (id - startOffset) % width, y = parseInt((id - startOffset) / width);
return { "image": imgName, "x": x, "y": y };
var x = (id - startOffset) % width,
y = parseInt((id - startOffset) / width);
return { image: imgName, x: x, y: y };
}
startOffset += this.tilesetStartOffset;
}
return null;
}
};

View File

@ -1,27 +1,24 @@
/*
loader.js负责对资源的加载
*/
"use strict";
'use strict';
function loader() {
this._init();
}
loader.prototype._init = function () {
}
loader.prototype._init = function () {};
////// 设置加载进度条进度 //////
loader.prototype._setStartProgressVal = function (val) {
core.dom.startTopProgress.style.width = val + '%';
}
};
////// 设置加载进度条提示文字 //////
loader.prototype._setStartLoadTipText = function (text) {
core.dom.startTopLoadTips.innerText = text;
}
};
loader.prototype._load = function (callback) {
if (main.useCompress) {
@ -29,7 +26,7 @@ loader.prototype._load = function (callback) {
} else {
this._load_sync(callback);
}
}
};
loader.prototype._load_sync = function (callback) {
this._loadAnimates_sync();
@ -38,10 +35,10 @@ loader.prototype._load_sync = function (callback) {
core.loader._loadExtraImages_sync(function () {
core.loader._loadAutotiles_sync(function () {
core.loader._loadTilesets_sync(callback);
})
})
});
}
});
});
};
loader.prototype._load_async = function (callback) {
core.loader._setStartLoadTipText('正在加载资源文件...');
@ -52,23 +49,32 @@ loader.prototype._load_async = function (callback) {
return function (loaded, total) {
all[name].loaded = loaded;
all[name].total = total;
var allLoaded = 0, allTotal = 0;
var allLoaded = 0,
allTotal = 0;
for (var one in all) {
allLoaded += all[one].loaded;
allTotal += all[one].total;
}
if (allTotal > 0) {
if (allLoaded == allTotal) {
core.loader._setStartLoadTipText("正在处理资源文件... 请稍候...");
core.loader._setStartLoadTipText(
'正在处理资源文件... 请稍候...'
);
} else {
core.loader._setStartLoadTipText('正在加载资源文件... ' +
core.formatSize(allLoaded) + " / " + core.formatSize(allTotal) +
" (" + (allLoaded / allTotal * 100).toFixed(2) + "%)");
core.loader._setStartLoadTipText(
'正在加载资源文件... ' +
core.formatSize(allLoaded) +
' / ' +
core.formatSize(allTotal) +
' (' +
((allLoaded / allTotal) * 100).toFixed(2) +
'%)'
);
}
core.loader._setStartProgressVal(allLoaded / allTotal * 100);
core.loader._setStartProgressVal((allLoaded / allTotal) * 100);
}
};
}
};
var _makeOnFinished = function (name) {
return function () {
setTimeout(function () {
@ -78,33 +84,59 @@ loader.prototype._load_async = function (callback) {
}
callback();
});
}
}
};
};
this._loadAnimates_async(_makeOnProgress('animates'), _makeOnFinished('animates'));
this._loadAnimates_async(
_makeOnProgress('animates'),
_makeOnFinished('animates')
);
this._loadMusic_async(_makeOnProgress('sounds'), _makeOnFinished('sounds'));
this._loadMaterials_async(_makeOnProgress('materials'), _makeOnFinished('materials'));
this._loadExtraImages_async(_makeOnProgress('images'), _makeOnFinished('images'));
this._loadAutotiles_async(_makeOnProgress('autotiles'), _makeOnFinished('autotiles'));
this._loadTilesets_async(_makeOnProgress('tilesets'), _makeOnFinished('tilesets'));
}
this._loadMaterials_async(
_makeOnProgress('materials'),
_makeOnFinished('materials')
);
this._loadExtraImages_async(
_makeOnProgress('images'),
_makeOnFinished('images')
);
this._loadAutotiles_async(
_makeOnProgress('autotiles'),
_makeOnFinished('autotiles')
);
this._loadTilesets_async(
_makeOnProgress('tilesets'),
_makeOnFinished('tilesets')
);
};
// ----- 加载资源文件 ------ //
loader.prototype._loadMaterials_sync = function (callback) {
this._setStartLoadTipText("正在加载资源文件...");
this.loadImages("materials", core.materials, core.material.images, function () {
this._setStartLoadTipText('正在加载资源文件...');
this.loadImages(
'materials',
core.materials,
core.material.images,
function () {
core.loader._loadMaterials_afterLoad();
callback();
});
}
);
};
loader.prototype._loadMaterials_async = function (onprogress, onfinished) {
this.loadImagesFromZip('project/materials/materials.h5data', core.materials, core.material.images, onprogress, function () {
this.loadImagesFromZip(
'project/materials/materials.h5data',
core.materials,
core.material.images,
onprogress,
function () {
core.loader._loadMaterials_afterLoad();
onfinished();
});
}
);
};
loader.prototype._loadMaterials_afterLoad = function () {
var images = core.splitImage(core.material.images['icons']);
@ -115,15 +147,20 @@ loader.prototype._loadMaterials_afterLoad = function () {
core.statusBar.image[key].src = core.statusBar.icons[key].src;
}
}
}
};
// ------ 加载使用的图片 ------ //
loader.prototype._loadExtraImages_sync = function (callback) {
core.material.images.images = {};
this._setStartLoadTipText("正在加载图片文件...");
core.loadImages("images", core.images, core.material.images.images, callback);
}
this._setStartLoadTipText('正在加载图片文件...');
core.loadImages(
'images',
core.images,
core.material.images.images,
callback
);
};
loader.prototype._loadExtraImages_async = function (onprogress, onfinished) {
core.material.images.images = {};
@ -137,16 +174,22 @@ loader.prototype._loadExtraImages_async = function (onprogress, onfinished) {
return !name.toLowerCase().endsWith('.gif');
});
this.loadImagesFromZip('project/images/images.h5data', images, core.material.images.images, onprogress, onfinished);
this.loadImagesFromZip(
'project/images/images.h5data',
images,
core.material.images.images,
onprogress,
onfinished
);
// gif没有被压缩在zip中延迟加载...
gifs.forEach(function (gif) {
this.loadImage("images", gif, function (id, image) {
this.loadImage('images', gif, function (id, image) {
if (image != null) {
core.material.images.images[gif] = image;
}
});
}, this);
}
};
// ------ 加载自动元件 ------ //
@ -155,23 +198,29 @@ loader.prototype._loadAutotiles_sync = function (callback) {
var keys = Object.keys(core.material.icons.autotile);
var autotiles = {};
this._setStartLoadTipText("正在加载自动元件...");
this.loadImages("autotiles", keys, autotiles, function () {
this._setStartLoadTipText('正在加载自动元件...');
this.loadImages('autotiles', keys, autotiles, function () {
core.loader._loadAutotiles_afterLoad(keys, autotiles);
callback();
});
}
};
loader.prototype._loadAutotiles_async = function (onprogress, onfinished) {
core.material.images.autotile = {};
var keys = Object.keys(core.material.icons.autotile);
var autotiles = {};
this.loadImagesFromZip('project/autotiles/autotiles.h5data', keys, autotiles, onprogress, function () {
this.loadImagesFromZip(
'project/autotiles/autotiles.h5data',
keys,
autotiles,
onprogress,
function () {
core.loader._loadAutotiles_afterLoad(keys, autotiles);
onfinished();
});
}
);
};
loader.prototype._loadAutotiles_afterLoad = function (keys, autotiles) {
// autotile需要保证顺序
@ -182,40 +231,50 @@ loader.prototype._loadAutotiles_afterLoad = function (keys, autotiles) {
setTimeout(function () {
core.maps._makeAutotileEdges();
});
}
};
// ------ 加载额外素材 ------ //
loader.prototype._loadTilesets_sync = function (callback) {
core.material.images.tilesets = {};
this._setStartLoadTipText("正在加载额外素材...");
this.loadImages("tilesets", core.tilesets, core.material.images.tilesets, function () {
this._setStartLoadTipText('正在加载额外素材...');
this.loadImages(
'tilesets',
core.tilesets,
core.material.images.tilesets,
function () {
core.loader._loadTilesets_afterLoad();
callback();
});
}
);
};
loader.prototype._loadTilesets_async = function (onprogress, onfinished) {
core.material.images.tilesets = {};
this.loadImagesFromZip('project/tilesets/tilesets.h5data', core.tilesets, core.material.images.tilesets, onprogress, function () {
this.loadImagesFromZip(
'project/tilesets/tilesets.h5data',
core.tilesets,
core.material.images.tilesets,
onprogress,
function () {
core.loader._loadTilesets_afterLoad();
onfinished();
});
}
);
};
loader.prototype._loadTilesets_afterLoad = function () {
// 检查宽高是32倍数如果出错在控制台报错
for (var imgName in core.material.images.tilesets) {
var img = core.material.images.tilesets[imgName];
if (img.width % 32 != 0 || img.height % 32 != 0) {
console.warn("警告!" + imgName + "的宽或高不是32的倍数");
console.warn('警告!' + imgName + '的宽或高不是32的倍数');
}
if (img.width * img.height > 32 * 32 * 3000) {
console.warn("警告!" + imgName + "上的图块素材个数大于3000");
}
console.warn('警告!' + imgName + '上的图块素材个数大于3000');
}
}
};
// ------ 实际加载一系列图片 ------ //
@ -227,10 +286,9 @@ loader.prototype.loadImages = function (dir, names, toSave, callback) {
var items = 0;
for (var i = 0; i < names.length; i++) {
this.loadImage(dir, names[i], function (id, image) {
core.loader._setStartLoadTipText('正在加载图片 ' + id + "...");
core.loader._setStartLoadTipText('正在加载图片 ' + id + '...');
if (toSave[id] !== undefined) {
if (image != null)
toSave[id] = image;
if (image != null) toSave[id] = image;
return;
}
toSave[id] = image;
@ -239,42 +297,47 @@ loader.prototype.loadImages = function (dir, names, toSave, callback) {
if (items == names.length) {
if (callback) callback();
}
})
}
});
}
};
loader.prototype.loadImage = function (dir, imgName, callback) {
try {
var name = imgName;
if (name.indexOf(".") < 0)
name = name + ".png";
if (name.indexOf('.') < 0) name = name + '.png';
var image = new Image();
image.onload = function () {
image.setAttribute('_width', image.width);
image.setAttribute('_height', image.height);
callback(imgName, image);
}
};
image.onerror = function () {
callback(imgName, null);
}
image.src = 'project/' + dir + '/' + name + "?v=" + main.version;
if (name.endsWith('.gif'))
callback(imgName, null);
}
catch (e) {
};
image.src = 'project/' + dir + '/' + name + '?v=' + main.version;
if (name.endsWith('.gif')) callback(imgName, null);
} catch (e) {
console.error(e);
}
}
};
// ------ 从zip中加载一系列图片 ------ //
loader.prototype.loadImagesFromZip = function (url, names, toSave, onprogress, onfinished) {
loader.prototype.loadImagesFromZip = function (
url,
names,
toSave,
onprogress,
onfinished
) {
if (!names || names.length == 0) {
if (onfinished) onfinished();
return;
}
core.unzip(url + "?v=" + main.version, function (data) {
core.unzip(
url + '?v=' + main.version,
function (data) {
var cnt = 1;
names.forEach(function (name) {
var imgName = name;
@ -289,59 +352,90 @@ loader.prototype.loadImagesFromZip = function (url, names, toSave, onprogress, o
img.setAttribute('_width', img.width);
img.setAttribute('_height', img.height);
if (cnt == 0 && onfinished) onfinished();
}
};
img.src = url;
toSave[name] = img;
}
});
cnt--;
if (cnt == 0 && onfinished) onfinished();
}, null, false, onprogress);
}
},
null,
false,
onprogress
);
};
// ------ 加载动画文件 ------ //
loader.prototype._loadAnimates_sync = function () {
this._setStartLoadTipText("正在加载动画文件...");
this._setStartLoadTipText('正在加载动画文件...');
if (main.supportBunch) {
if (core.animates.length > 0) {
core.http('GET', '__all_animates__?v=' + main.version + '&id=' + core.animates.join(','), null, function (content) {
core.http(
'GET',
'/all/__all_animates__?v=' +
main.version +
'&id=' +
core.animates.join(','),
null,
function (content) {
var u = content.split('@@@~~~###~~~@@@');
for (var i = 0; i < core.animates.length; ++i) {
if (u[i] != '') {
core.material.animates[core.animates[i]] = core.loader._loadAnimate(u[i]);
core.material.animates[core.animates[i]] =
core.loader._loadAnimate(u[i]);
} else {
console.error('无法找到动画文件' + core.animates[i] + '');
console.error(
'无法找到动画文件' + core.animates[i] + ''
);
}
}
}, "text/plain; charset=x-user-defined");
},
'text/plain; charset=x-user-defined'
);
}
return;
}
core.animates.forEach(function (t) {
core.http('GET', 'project/animates/' + t + ".animate?v=" + main.version, null, function (content) {
core.http(
'GET',
'project/animates/' + t + '.animate?v=' + main.version,
null,
function (content) {
core.material.animates[t] = core.loader._loadAnimate(content);
}, function (e) {
},
function (e) {
console.error(e);
core.material.animates[t] = null;
}, "text/plain; charset=x-user-defined")
},
'text/plain; charset=x-user-defined'
);
});
}
};
loader.prototype._loadAnimates_async = function (onprogress, onfinished) {
core.unzip('project/animates/animates.h5data?v=' + main.version, function (animates) {
core.unzip(
'project/animates/animates.h5data?v=' + main.version,
function (animates) {
for (var name in animates) {
if (name.endsWith(".animate")) {
if (name.endsWith('.animate')) {
var t = name.substring(0, name.length - 8);
if (core.animates.indexOf(t) >= 0)
core.material.animates[t] = core.loader._loadAnimate(animates[name]);
core.material.animates[t] = core.loader._loadAnimate(
animates[name]
);
}
}
onfinished();
}, null, true, onprogress);
}
},
null,
true,
onprogress
);
};
loader.prototype._loadAnimate = function (content) {
try {
@ -354,8 +448,7 @@ loader.prototype._loadAnimate = function (content) {
content.bitmaps.forEach(function (t2) {
if (!t2) {
data.images.push(null);
}
else {
} else {
try {
var image = new Image();
image.src = t2;
@ -365,36 +458,35 @@ loader.prototype._loadAnimate = function (content) {
data.images.push(null);
}
}
})
});
data.frame = content.frame_max;
data.frames = [];
content.frames.forEach(function (t2) {
var info = [];
t2.forEach(function (t3) {
info.push({
'index': t3[0],
'x': t3[1],
'y': t3[2],
'zoom': t3[3],
'opacity': t3[4],
'mirror': t3[5] || 0,
'angle': t3[6] || 0,
})
})
index: t3[0],
x: t3[1],
y: t3[2],
zoom: t3[3],
opacity: t3[4],
mirror: t3[5] || 0,
angle: t3[6] || 0
});
});
data.frames.push(info);
});
return data;
}
catch (e) {
} catch (e) {
console.error(e);
return null;
}
}
};
// ------ 加载音乐和音效 ------ //
loader.prototype._loadMusic_sync = function () {
this._setStartLoadTipText("正在加载音效文件...");
this._setStartLoadTipText('正在加载音效文件...');
core.bgms.forEach(function (t) {
core.loader.loadOneMusic(t);
});
@ -403,13 +495,15 @@ loader.prototype._loadMusic_sync = function () {
});
// 直接开始播放
core.playBgm(main.startBgm);
}
};
loader.prototype._loadMusic_async = function (onprogress, onfinished) {
core.bgms.forEach(function (t) {
core.loader.loadOneMusic(t);
});
core.unzip('project/sounds/sounds.h5data?v=' + main.version, function (data) {
core.unzip(
'project/sounds/sounds.h5data?v=' + main.version,
function (data) {
// 延迟解析
setTimeout(function () {
for (var name in data) {
@ -419,29 +513,42 @@ loader.prototype._loadMusic_async = function (onprogress, onfinished) {
}
});
onfinished();
}, null, false, onprogress);
},
null,
false,
onprogress
);
// 直接开始播放
core.playBgm(main.startBgm);
}
};
loader.prototype.loadOneMusic = function (name) {
var music = new Audio();
music.preload = 'none';
if (main.bgmRemote) music.src = main.bgmRemoteRoot + core.firstData.name + '/' + name;
if (main.bgmRemote)
music.src = main.bgmRemoteRoot + core.firstData.name + '/' + name;
else music.src = 'project/bgms/' + name;
music.loop = 'loop';
core.material.bgms[name] = music;
}
};
loader.prototype.loadOneSound = function (name) {
core.http('GET', 'project/sounds/' + name + "?v=" + main.version, null, function (data) {
core.http(
'GET',
'project/sounds/' + name + '?v=' + main.version,
null,
function (data) {
core.loader._loadOneSound_decodeData(name, data);
}, function (e) {
},
function (e) {
console.error(e);
core.material.sounds[name] = null;
}, null, 'arraybuffer');
}
},
null,
'arraybuffer'
);
};
loader.prototype._loadOneSound_decodeData = function (name, data) {
if (data instanceof Blob) {
@ -449,23 +556,26 @@ loader.prototype._loadOneSound_decodeData = function (name, data) {
blobReader.init(function () {
blobReader.readUint8Array(0, blobReader.size, function (uint8) {
core.loader._loadOneSound_decodeData(name, uint8.buffer);
})
});
});
return;
}
try {
core.musicStatus.audioContext.decodeAudioData(data, function (buffer) {
core.musicStatus.audioContext.decodeAudioData(
data,
function (buffer) {
core.material.sounds[name] = buffer;
}, function (e) {
console.error(e);
core.material.sounds[name] = null;
})
}
catch (e) {
},
function (e) {
console.error(e);
core.material.sounds[name] = null;
}
);
} catch (e) {
console.error(e);
core.material.sounds[name] = null;
}
};
loader.prototype.loadBgm = function (name) {
name = core.getMappedName(name);
@ -476,34 +586,38 @@ loader.prototype.loadBgm = function (name) {
var index = core.musicStatus.cachedBgms.indexOf(name);
if (index >= 0) {
core.musicStatus.cachedBgms.splice(index, 1);
}
else {
} else {
// 预加载BGM
this._preloadBgm(core.material.bgms[name]);
// core.material.bgms[name].load();
// 清理尾巴
if (core.musicStatus.cachedBgms.length == core.musicStatus.cachedBgmCount) {
if (
core.musicStatus.cachedBgms.length ==
core.musicStatus.cachedBgmCount
) {
this.freeBgm(core.musicStatus.cachedBgms.pop());
}
}
// 移动到缓存最前方
core.musicStatus.cachedBgms.unshift(name);
}
};
loader.prototype._preloadBgm = function (bgm) {
bgm.volume = 0;
bgm.play();
}
};
loader.prototype.freeBgm = function (name) {
name = core.getMappedName(name);
if (!core.material.bgms[name]) return;
// 从cachedBgms中删除
core.musicStatus.cachedBgms = core.musicStatus.cachedBgms.filter(function (t) {
core.musicStatus.cachedBgms = core.musicStatus.cachedBgms.filter(function (
t
) {
return t != name;
});
// 清掉缓存
core.material.bgms[name].removeAttribute("src");
core.material.bgms[name].removeAttribute('src');
core.material.bgms[name].load();
core.material.bgms[name] = null;
if (name == core.musicStatus.playingBgm) {
@ -513,4 +627,4 @@ loader.prototype.freeBgm = function (name) {
setTimeout(function () {
core.loader.loadOneMusic(name);
}, 3000);
}
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -374,7 +374,7 @@ main.prototype.loadFloors = function (callback) {
// 高层塔优化
var script = document.createElement('script');
script.src =
'__all_floors__.js?v=' +
'/all/__all_floors__.js?v=' +
this.version +
'&id=' +
main.floorIds.join(',');

View File

@ -2,84 +2,84 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
{
"greenSlime": {"name":"绿头怪","hp":100,"atk":11,"def":3,"money":0,"exp":1,"point":0,"special":[]},
"redSlime": {"name":"红头怪","hp":120,"atk":16,"def":6,"money":0,"exp":2,"point":0,"special":[],"value":10},
"blackSlime": {"name":"青头怪","hp":170,"atk":20,"def":8,"money":0,"exp":3,"point":0,"special":0},
"blackSlime": {"name":"青头怪","hp":170,"atk":20,"def":8,"money":0,"exp":3,"point":0,"special":[]},
"slimelord": {"name":"粘液王","hp":200,"atk":58,"def":24,"money":0,"exp":8,"point":0,"special":[]},
"bat": {"name":"小蝙蝠","hp":60,"atk":15,"def":0,"money":0,"exp":2,"point":0,"special":[4]},
"bigBat": {"name":"大蝙蝠","hp":150,"atk":17,"def":5,"money":0,"exp":4,"point":0,"special":[4]},
"redBat": {"name":"恐怖蝙蝠","hp":1200,"atk":260,"def":110,"money":1,"exp":32,"point":0,"special":[5]},
"vampire": {"name":"冥灵魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"vampire": {"name":"冥灵魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeleton": {"name":"骷髅人","hp":300,"atk":80,"def":10,"money":0,"exp":9,"point":0,"special":[1],"crit":300},
"skeletonCaptain": {"name":"骷髅队长","hp":750,"atk":200,"def":50,"money":0,"exp":21,"point":0,"special":[1],"crit":1000},
"zombie": {"name":"兽人","hp":150,"atk":43,"def":14,"money":0,"exp":6,"point":0,"special":0},
"zombieKnight": {"name":"兽人武士","hp":480,"atk":62,"def":30,"money":0,"exp":15,"point":0,"special":0},
"zombie": {"name":"兽人","hp":150,"atk":43,"def":14,"money":0,"exp":6,"point":0,"special":[]},
"zombieKnight": {"name":"兽人武士","hp":480,"atk":62,"def":30,"money":0,"exp":15,"point":0,"special":[]},
"rock": {"name":"洞穴巨石","hp":31,"atk":25,"def":0,"money":0,"exp":4,"point":0,"special":[3]},
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":2},
"redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":15,"value":100,"range":2},
"redWizard": {"name":"高级巫师","hp":1000,"atk":1200,"def":0,"money":160,"exp":0,"point":0,"special":15,"value":200,"zoneSquare":true},
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[2]},
"redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":[15],"value":100,"range":2},
"redWizard": {"name":"高级巫师","hp":1000,"atk":1200,"def":0,"money":160,"exp":0,"point":0,"special":[15],"value":200,"zoneSquare":true},
"swordsman": {"name":"野蛮剑士","hp":250,"atk":55,"def":27,"money":0,"exp":9,"point":0,"special":[15],"value":75},
"soldier": {"name":"冥战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"soldier": {"name":"冥战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"yellowKnight": {"name":"勇气骑士","hp":2000,"atk":500,"def":250,"money":1,"exp":30,"point":0,"special":[11],"charge":500},
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blueKnight": {"name":"蓝骑士","hp":100,"atk":120,"def":0,"money":9,"exp":0,"point":0,"special":8},
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blueKnight": {"name":"蓝骑士","hp":100,"atk":120,"def":0,"money":9,"exp":0,"point":0,"special":[8]},
"goldSlime": {"name":"黄头怪","hp":1000,"atk":50,"def":50,"money":0,"exp":18,"point":0,"special":[2]},
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"poisonBat": {"name":"山间蝙蝠","hp":800,"atk":170,"def":50,"money":1,"exp":24,"point":0,"special":[5]},
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":18,"value":20},
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"evilHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":[18],"value":20},
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"evilHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"goldHornSlime": {"name":"尖角怪","hp":1500,"atk":366,"def":166,"money":1,"exp":35,"point":0,"special":[]},
"silverSlime": {"name":"银头怪","hp":250,"atk":50,"def":20,"money":0,"exp":11,"point":0,"special":[2]},
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redSwordsman": {"name":"山间盗贼","hp":1000,"atk":175,"def":40,"money":1,"exp":24,"point":0,"special":[4],"n":8},
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"exp":0,"point":0,"special":12},
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"princessEnemy": {"name":"假公主","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"steelGuard": {"name":"铁守卫","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":18,"value":20},
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"exp":0,"point":0,"special":[12]},
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"princessEnemy": {"name":"假公主","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"steelGuard": {"name":"铁守卫","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[18],"value":20},
"evilBat": {"name":"邪恶蝙蝠","hp":1000,"atk":800,"def":350,"money":1,"exp":40,"point":0,"special":[2]},
"frozenSkeleton": {"name":"冻死骨","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"silverSlimelord": {"name":"银怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"goldSlimelord": {"name":"金怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"frozenSkeleton": {"name":"冻死骨","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"silverSlimelord": {"name":"银怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"goldSlimelord": {"name":"金怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonWarrior": {"name":"骷髅士兵","hp":500,"atk":100,"def":20,"money":0,"exp":12,"point":0,"special":[1],"crit":500},
"whiteSlimeman": {"name":"水银史莱姆人","hp":750,"atk":100,"def":45,"money":0,"exp":20,"point":0,"special":[4]},
"slimeman": {"name":"莱姆人","hp":125,"atk":30,"def":10,"money":0,"exp":4,"point":0,"special":[4],"atkValue":2,"defValue":3},
"yellowGateKeeper": {"name":"神秘卫兵","hp":375,"atk":200,"def":15,"money":1,"exp":25,"point":0,"special":[1],"crit":5000},
"blueGateKeeper": {"name":"神秘雕像","hp":1000,"atk":275,"def":120,"money":1,"exp":38,"point":0,"special":[1],"crit":1000},
"redGateKeeper": {"name":"勇气卫兵","hp":1000,"atk":450,"def":250,"money":1,"exp":30,"point":0,"special":[1],"crit":2000},
"magicMaster": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"exp":0,"point":0,"special":11,"value":0.3333333333333333,"add":true,"notBomb":true},
"devilWarrior": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"fairyEnemy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"dragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonKnight": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonPresbyter": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"magicMaster": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"exp":0,"point":0,"special":[11],"value":0.3333333333333333,"add":true,"notBomb":true},
"devilWarrior": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"fairyEnemy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"dragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonKnight": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonPresbyter": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"ironRock": {"name":"山间巨石","hp":750,"atk":150,"def":0,"money":0,"exp":20,"point":0,"special":[3]},
"grayRock": {"name":"林间巨石","hp":100,"atk":60,"def":0,"money":0,"exp":12,"point":0,"special":[3]},
"yellowPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"evilPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blademaster": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"evilFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blueRock": {"name":"勇气之石","hp":2000,"atk":450,"def":230,"money":1,"exp":30,"point":0,"special":0},
"yellowPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"evilPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blademaster": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"evilFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blueRock": {"name":"勇气之石","hp":2000,"atk":450,"def":230,"money":1,"exp":30,"point":0,"special":[]},
"skeletonLite": {"name":"骷髅精英","hp":2000,"atk":275,"def":240,"money":1,"exp":35,"point":0,"special":[9]},
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"bowman": {"name":"猎人","hp":500,"atk":100,"def":50,"money":0,"exp":16,"point":0,"special":[24],"value":75},
"liteBowman": {"name":"山间猎手","hp":1200,"atk":200,"def":60,"money":1,"exp":27,"point":0,"special":[24]},
"crimsonZombie": {"name":"勇气之兽","hp":1800,"atk":2000,"def":-100,"money":1,"exp":35,"point":0,"special":[]},
"watcherSlime": {"name":"邪眼怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"mutantSlimeman": {"name":"变异史莱姆人","hp":350,"atk":70,"def":27,"money":0,"exp":13,"point":0,"special":0},
"devilKnight": {"name":"恶灵骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"watcherSlime": {"name":"邪眼怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"mutantSlimeman": {"name":"变异史莱姆人","hp":350,"atk":70,"def":27,"money":0,"exp":13,"point":0,"special":[]},
"devilKnight": {"name":"恶灵骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"grayPriest": {"name":"智慧法王","hp":3000,"atk":600,"def":250,"money":1,"exp":40,"point":0,"special":[13]},
"greenGateKeeper": {"name":"卫兵队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"ghostSoldier": {"name":"山间骷髅","hp":750,"atk":180,"def":40,"money":0,"exp":18,"point":0,"special":0},
"frostBat": {"name":"寒蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blackKing": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"exp":1000,"point":0,"special":0,"notBomb":true},
"yellowKing": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"greenKing": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"redKing": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blueKing": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"exp":0,"point":0,"special":16},
"greenGateKeeper": {"name":"卫兵队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"ghostSoldier": {"name":"山间骷髅","hp":750,"atk":180,"def":40,"money":0,"exp":18,"point":0,"special":[]},
"frostBat": {"name":"寒蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blackKing": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"exp":1000,"point":0,"special":[],"notBomb":true},
"yellowKing": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"greenKing": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redKing": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blueKing": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"exp":0,"point":0,"special":[16]},
"E368": {"name":"绿头武装怪","hp":400,"atk":75,"def":30,"money":0,"exp":14,"point":0,"special":[]},
"E369": {"name":"红头武装怪","hp":450,"atk":85,"def":35,"money":0,"exp":17,"point":0,"special":[]},
"E370": {"name":"青头武装怪","hp":600,"atk":100,"def":50,"money":0,"exp":20,"point":0,"special":[1],"crit":400},

View File

@ -1,57 +1,79 @@
main.floors.MT2=
{
"floorId": "MT2",
"title": "洞穴",
"name": "2",
"width": 15,
"height": 15,
"canFlyTo": true,
"canFlyFrom": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"images": [],
"ratio": 1,
"defaultGround": "T331",
"bgm": "cave.mp3",
"firstArrive": [],
"eachArrive": [],
"parallelDo": "",
"events": {},
"changeFloor": {
"14,4": {
"floorId": "MT1",
"loc": [
0,
4
]
main.floors.MT2 = {
floorId: 'MT2',
title: '洞穴',
name: '2',
width: 15,
height: 15,
canFlyTo: true,
canFlyFrom: true,
canUseQuickShop: true,
cannotViewMap: false,
images: [],
ratio: 1,
defaultGround: 'T331',
bgm: 'cave.mp3',
firstArrive: [],
eachArrive: [],
parallelDo: '',
events: {},
changeFloor: {
'14,4': {
floorId: 'MT1',
loc: [0, 4]
}
},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"autoEvent": {},
"cannotMove": {},
"map": [
[20041,20041,20044,20049,20049,20049,20049,20049,20049,20049,20049,20049,20049,20049,20043],
[20041,20041,20042,20057,20057,20057,20057,20057,20057,20057,20057,20057,20057,20057,20048],
[20041,20041,20042,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20065,20056],
[20041,20041,20042, 0,336, 32, 0, 27, 0,206,141, 34,141, 0,20064],
[20041,20041,20042, 0,336,336,203,333,333, 0,141,203,141, 0, 94],
afterBattle: {},
afterGetItem: {},
afterOpenDoor: {},
autoEvent: {},
cannotMove: {},
map: [
[
20041, 20041, 20044, 20049, 20049, 20049, 20049, 20049, 20049,
20049, 20049, 20049, 20049, 20049, 20043
],
[
20041, 20041, 20042, 20057, 20057, 20057, 20057, 20057, 20057,
20057, 20057, 20057, 20057, 20057, 20048
],
[
20041, 20041, 20042, 20065, 20065, 20065, 20065, 20065, 20065,
20065, 20065, 20065, 20065, 20065, 20056
],
[
20041, 20041, 20042, 0, 336, 32, 0, 27, 0, 206, 141, 34, 141, 0,
20064
],
[
20041, 20041, 20042, 0, 336, 336, 203, 333, 333, 0, 141, 203, 141,
0, 94
],
[20041, 20041, 20042, 0, 0, 31, 0, 0, 205, 0, 201, 34, 201, 0, 20032],
[20041,20041,20042,336,202,333,333, 0,340, 31,141,202,141,141,20040],
[
20041, 20041, 20042, 336, 202, 333, 333, 0, 340, 31, 141, 202, 141,
141, 20040
],
[20041, 20041, 20042, 34, 27, 0, 333, 0, 340, 0, 141, 0, 31, 31, 20040],
[20041,20041,20042,345,345,201,333,205,141,141,141,141,141, 0,20040],
[
20041, 20041, 20042, 345, 345, 201, 333, 205, 141, 141, 141, 141,
141, 0, 20040
],
[20041, 20041, 20042, 0, 202, 0, 0, 31, 0, 0, 206, 0, 141, 141, 20040],
[20041, 20041, 20042, 0, 336, 31, 0, 336, 0, 31, 141, 0, 28, 0, 20040],
[20041,20041,20042, 28,336,336,336,336,345,202,141, 27, 0, 32,20040],
[20041,20041,20042, 0,336, 0, 32,345, 0, 0,141,141,141,141,20040],
[
20041, 20041, 20042, 28, 336, 336, 336, 336, 345, 202, 141, 27, 0,
32, 20040
],
[
20041, 20041, 20042, 0, 336, 0, 32, 345, 0, 0, 141, 141, 141, 141,
20040
],
[20041, 20041, 20042, 32, 336, 28, 0, 206, 0, 0, 203, 0, 27, 31, 20040],
[20041,20041,20036,20033,20033,20033,20033,20033,20033,20033,20033,20033,20033,20033,20035]
],
"bgmap": [
],
"fgmap": [
[
20041, 20041, 20036, 20033, 20033, 20033, 20033, 20033, 20033,
20033, 20033, 20033, 20033, 20033, 20035
]
}
],
bgmap: [],
fgmap: []
};

View File

@ -1,82 +1,74 @@
main.floors.tower4=
{
"floorId": "tower4",
"title": "智慧之塔",
"name": "4",
"width": 15,
"height": 15,
"canFlyTo": true,
"canFlyFrom": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"images": [],
"ratio": 2,
"defaultGround": "T526",
"bgm": "tower.mp3",
"firstArrive": [],
"eachArrive": [],
"parallelDo": "",
"events": {},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"autoEvent": {},
"cannotMove": {},
"map": [
[527,527,527,527,527,527,527,543,527,527,527,527,527,527,527],
main.floors.tower4 = {
floorId: 'tower4',
title: '智慧之塔',
name: '4',
width: 15,
height: 15,
canFlyTo: true,
canFlyFrom: true,
canUseQuickShop: true,
cannotViewMap: false,
images: [],
ratio: 2,
defaultGround: 'T526',
bgm: 'tower.mp3',
firstArrive: [],
eachArrive: [],
parallelDo: '',
events: {},
afterBattle: {},
afterGetItem: {},
afterOpenDoor: {},
autoEvent: {},
cannotMove: {},
map: [
[
527, 527, 527, 527, 527, 527, 527, 543, 527, 527, 527, 527, 527,
527, 527
],
[527, 31, 31, 536, 0, 528, 0, 547, 0, 31, 0, 544, 0, 381, 527],
[527, 31, 31, 528, 28, 492, 29, 528, 528, 0, 28, 528, 0, 528, 527],
[527, 528, 528, 528, 0, 528, 28, 34, 492, 492, 528, 528, 547, 0, 527],
[527, 381, 0, 550, 0, 528, 528, 528, 528, 0, 31, 528, 0, 528, 527],
[527, 0, 528, 0, 528, 528, 31, 0, 536, 27, 0, 556, 381, 378, 527],
[527, 0, 528, 27, 0, 544, 0, 403, 0, 528, 528, 0, 528, 528, 527],
[527,550,528,528,528,528,492,528,550,528, 34,381,556,376,527],
[
527, 550, 528, 528, 528, 528, 492, 528, 550, 528, 34, 381, 556, 376,
527
],
[527, 0, 0, 31, 492, 88, 403, 528, 31, 528, 27, 32, 528, 0, 527],
[527, 528, 528, 0, 528, 403, 34, 547, 0, 492, 492, 528, 528, 556, 527],
[527, 0, 528, 546, 528, 528, 546, 528, 528, 528, 0, 28, 0, 0, 527],
[527, 0, 544, 32, 0, 536, 32, 528, 32, 0, 536, 528, 528, 556, 527],
[527, 27, 492, 0, 27, 528, 27, 492, 0, 528, 528, 528, 0, 0, 527],
[527, 31, 528, 32, 0, 528, 32, 546, 0, 494, 87, 381, 28, 0, 527],
[527,527,527,527,527,527,527,540,527,527,527,527,527,527,527]
[
527, 527, 527, 527, 527, 527, 527, 540, 527, 527, 527, 527, 527,
527, 527
]
],
"beforeBattle": {},
"bgmap": [
],
"fgmap": [
],
"bg2map": [],
"fg2map": [],
"cannotMoveIn": {},
"changeFloor": {
"5,8": {
"floorId": "tower3",
"loc": [
5,
8
]
beforeBattle: {},
bgmap: [],
fgmap: [],
bg2map: [],
fg2map: [],
cannotMoveIn: {},
changeFloor: {
'5,8': {
floorId: 'tower3',
loc: [5, 8]
},
"7,0": {
"floorId": "tower6",
"loc": [
1,
15
]
'7,0': {
floorId: 'tower6',
loc: [1, 15]
},
"7,14": {
"floorId": "tower6",
"loc": [
12,
15
]
'7,14': {
floorId: 'tower6',
loc: [12, 15]
},
"10,13": {
"floorId": "tower5",
"loc": [
10,
13
]
}
'10,13': {
floorId: 'tower5',
loc: [10, 13]
}
}
};

File diff suppressed because it is too large Load Diff

View File

@ -9016,11 +9016,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
core.status.maps[data] = floor;
delete core.status.mapBlockObjs[data];
core.extractBlocks(data);
if (data === core.status.floorId) {
core.drawMap(data);
core.setWeather(
core.animateFrame.weather.type,
core.animateFrame.weather.level
);
}
core.updateStatusBar(true, true);
}
console.log(`hot reload floor: ${data}`);
@ -9187,5 +9189,127 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
}, 1000);
}
})();
},
hide: function () {
if (main.mode === 'editor' || main.replayChecking) return;
/**
* 所有的会被视为房间的墙
*/
const WALLS = [
'yellowWall',
'yellowDoor',
'blueDoor',
'redDoor',
'greenDoor'
];
/**
* 房间的最大大小
*/
const MAX_AREA = 25;
/**
* 要隐藏的点
*/
const HIDE_POS = [
['MT1', 2, 3],
['MT2', 4, 5],
['MT3', 7, 1]
];
let showed = {};
/// 初始化游戏
events.prototype.resetGame = function (
hero,
hard,
floorId,
maps,
values
) {
this.eventdata.resetGame(hero, hard, floorId, maps, values);
showed = core.getFlag('__showed__', {});
flags.__showed__ = flags.__showed__ ?? {};
hide();
};
/**
* 显示一个区域
* @param {string} floor
* @param {number} x
* @param {number} y
*/
this.showHidden = function (floor, x, y) {
const pos = bfs(floor, x, y);
for (const [x, y] of pos) {
core.setBgFgBlock('fg', 0, x, y, floor);
const id = `${floor}_${x}_${y}`;
showed[id] = true;
flags.__showed__[id] = true;
}
};
/**
* 隐藏
*/
function hide() {
for (const pos of HIDE_POS) {
const id = pos.join('_');
if (showed[id]) continue;
const p = bfs(...pos);
if (p.length >= MAX_AREA) continue;
for (const [x, y] of p) {
core.setBgFgBlock('fg', 4, x, y, pos[0]);
const id = `${pos[0]}_${x}_${y}`;
showed[id] = true;
flags.__showed__[id] = false;
}
}
}
/**
* @returns {[number, number][]}
*/
function bfs(floorId, x, y) {
core.extractBlocks(floorId);
const blocks = core.getMapBlocksObj(floorId);
const mapped = {
[`${x},${y}`]: true
};
const queue = [[x, y]];
/** @type {[direction, number, number][]} */
const dir = Object.entries(core.utils.scan).map(v => [
v[0],
v[1].x,
v[1].y
]);
const res = [[x, y]];
while (queue.length > 0) {
const [nx, ny] = queue.shift();
dir.forEach(v => {
const [tx, ty] = [nx + v[1], ny + v[2]];
const floor = core.status.maps[floorId];
if (
tx < 0 ||
ty < 0 ||
tx >= floor.width ||
ty >= floor.height
)
return;
const loc = `${tx},${ty}`;
if (mapped[loc]) return;
const block = blocks[loc];
mapped[loc] = true;
if (!block) {
queue.push([tx, ty]);
res.push([tx, ty]);
return;
}
if (WALLS.includes(block.event.id)) return;
queue.push([tx, ty]);
res.push([tx, ty]);
});
}
return res;
}
}
};

View File

@ -263,7 +263,7 @@ async function extract(...dirs) {
});
} else if (/\/\*.\w+$/.test(v)) {
// 匹配文件夹中的后缀名
const suffix = /.\w+$/.exec(v)[0];
const suffix = /\.\w+$/.exec(v)[0];
const d = v.split(`/*${suffix}`)[0];
const dir = path.resolve(__dirname, d);
fs.readdir(dir).then(files => {
@ -314,15 +314,13 @@ async function watch() {
});
// 楼层,热重载
const floors = await extract('project/floors/');
floors.forEach(v => {
const dir = path.resolve(__dirname, v);
fss.watchFile(dir, option, () => {
const floorId = /\/\w+.js$/.exec(v)[0].slice(1, -3);
fss.watch(path.resolve(__dirname, 'project/floors/'), (a, b) => {
if (!/^\w+\.js$/.test(b)) return;
const floorId = b.slice(0, -3);
if (hotReloadData.includes(`@@floor:${floorId}`)) return;
hotReloadData += `@@floor:${floorId}`;
console.log(`floor hot reload: ${floorId}`);
});
});
// 脚本编辑 及 插件 热重载
const scripts = await extract('project/functions.js', 'project/plugins.js');

View File

@ -19,4 +19,11 @@ import { uiStack } from './plugin/uiController';
justify-content: center;
overflow: hidden;
}
@media screen and(max-width:600px) {
#ui {
width: 100%;
height: 100%;
}
}
</style>

View File

@ -0,0 +1,55 @@
<template>
<canvas
ref="canvas"
:width="width ?? 32"
:height="height ?? 32"
id="canvas"
></canvas>
</template>
<script lang="tsx" setup>
import { onMounted, onUnmounted, ref } from 'vue';
import { addAnimate, removeAnimate } from '../plugin/animateController';
const props = defineProps<{
id: string;
width?: number;
height?: number;
}>();
const canvas = ref<HTMLCanvasElement>();
onMounted(() => {
const c = canvas.value!;
const ctx = c.getContext('2d')!;
const cls = core.getClsFromId(props.id);
const frames = core.getAnimateFrames(cls);
const scale = window.devicePixelRatio;
c.style.width = `${c.width}px`;
c.style.height = `${c.height}px`;
c.width *= scale;
c.height *= scale;
ctx.scale(scale, scale);
const fn = (time: number) => {
core.clearMap(ctx);
const frame = core.status.globalAnimateStatus % frames;
core.drawIcon(ctx, props.id, 0, 0, props.width, props.height, frame);
};
addAnimate(fn);
onUnmounted(() => {
removeAnimate(fn);
});
});
</script>
<style lang="less" scoped>
#canvas {
border: 1.5px solid #ddd;
background-color: #222;
}
</style>

195
src/components/enemyOne.vue Normal file
View File

@ -0,0 +1,195 @@
<template>
<div class="enemy-container">
<div class="info">
<div class="leftbar">
<span class="name">{{ enemy.name }}</span>
<BoxAnimate
:id="enemy.id"
:width="isMobile ? 32 : 50"
:height="isMobile ? 32 : 50"
style="margin: 5%"
></BoxAnimate>
<div
class="special-text"
v-if="has(enemy.special) && enemy.special.length > 0"
>
<span
v-for="(text, i) in enemy.toShowSpecial"
:style="{ color: enemy.toShowColor![i] }"
>{{ text }}</span
>
</div>
<div class="special-text" v-else>无属性</div>
</div>
<a-divider
type="vertical"
dashed
style="height: 100%; margin: 0 3% 0 3%; border-color: #ddd4"
></a-divider>
<div class="rightbar">
<div class="detail">
<div class="detail-info">
<span style="color: lightgreen"
>生命&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.hp)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightcoral"
>攻击&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.atk)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightblue"
>防御&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.def)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightyellow"
>金币&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.money)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lawngreen"
>经验&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.money)
}}</span
>
</div>
<div class="detail-info">
<span style="color: cyan"
>{{
core.status.thisMap.ratio
}}&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.money)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightsalmon"
>临界&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.critical)
}}</span
>
</div>
<div class="detail-info">
<span style="color: lightpink"
>减伤&nbsp;&nbsp;&nbsp;&nbsp;<span
:style="{
color:
enemy.criticalDamage < 0
? 'gold'
: 'lightpink'
}"
>{{
core.formatBigNumber(
enemy.criticalDamage,
false,
enemy.criticalDamage < 0
)
}}</span
></span
>
</div>
<div class="detail-info">
<span :style="{color: enemy.damageColor!}"
>伤害&nbsp;&nbsp;&nbsp;&nbsp;{{
core.formatBigNumber(enemy.damage)
}}</span
>
</div>
</div>
</div>
</div>
</div>
</template>
<script lang="ts" setup>
import { has } from '../plugin/utils';
import BoxAnimate from '../components/boxAnimate.vue';
import { isMobile } from '../plugin/use';
const props = defineProps<{
enemy: Enemy & DetailedEnemy;
}>();
const core = window.core;
</script>
<style lang="less" scoped>
.enemy-container {
border: 1.5px solid transparent;
border-radius: 20px;
transition: all 0.2s linear;
height: 100%;
.info {
flex-basis: 100%;
display: flex;
flex-direction: row;
align-items: center;
justify-content: stretch;
height: 100%;
}
}
.enemy-container:hover {
border: 1.5px solid gold;
border-radius: 20px;
}
.leftbar {
width: 10%;
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: 1.3vw;
}
.name {
text-align: center;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
}
.special-text {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
display: block;
}
.rightbar {
font-size: 1.3vw;
width: 100%;
height: 100%;
padding: 1.5vh 0 1.5vh 0;
.detail {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100%;
.detail-info {
flex-basis: 33%;
line-height: 0;
display: flex;
flex-direction: column;
justify-content: center;
}
}
}
</style>

View File

@ -1,6 +1,6 @@
<template>
<div id="scroll">
<div>
<div :id="`scroll-div-${id}`" class="scroll-main">
<div class="main-div">
<div :id="`content-${id}`" class="content">
<slot></slot>
</div>
@ -10,34 +10,57 @@
</template>
<script lang="ts" setup>
import { onMounted, onUpdated } from 'vue';
import { onMounted, onUnmounted, onUpdated } from 'vue';
import { useDrag, useWheel } from '../plugin/use';
const props = defineProps<{
type?: 'vertical' | 'horizontal';
}>();
let now = 0;
let total = 0;
const id = (1e8 * Math.random()).toFixed(0);
const scale = window.devicePixelRatio;
const cssTarget = props.type === 'horizontal' ? 'left' : 'top';
const canvasAttr = props.type === 'horizontal' ? 'width' : 'height';
let ctx: CanvasRenderingContext2D;
let content: HTMLDivElement;
const resize = () => {
calHeight();
draw();
};
/** 绘制 */
function draw() {
if (total === 0) return;
if (now > total - ctx.canvas.height / scale) {
now = total - ctx.canvas.height / scale;
if (total < ctx.canvas[canvasAttr] / scale) {
now = 0;
} else if (now > total - ctx.canvas[canvasAttr] / scale) {
now = total - ctx.canvas[canvasAttr] / scale;
} else if (now < 0) {
now = 0;
}
const length =
Math.min(ctx.canvas.height / total / scale, 1) * ctx.canvas.height;
const py = (now / total) * ctx.canvas.height;
Math.min(ctx.canvas[canvasAttr] / total / scale, 1) *
ctx.canvas[canvasAttr];
const py = (now / total) * ctx.canvas[canvasAttr];
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
ctx.beginPath();
ctx.moveTo(20, Math.max(py + 5, 5));
ctx.lineTo(20, Math.min(py + length - 5, ctx.canvas.height - 5));
if (props.type === 'horizontal') {
ctx.moveTo(Math.max(py + 5, 5), 20 * scale);
ctx.lineTo(Math.min(py + length - 5, ctx.canvas.width - 5), 20 * scale);
} else {
ctx.moveTo(20 * scale, Math.max(py + 5, 5));
ctx.lineTo(
20 * scale,
Math.min(py + length - 5, ctx.canvas.height - 5)
);
}
ctx.lineCap = 'round';
ctx.lineWidth = 6;
ctx.strokeStyle = '#fff';
@ -48,15 +71,13 @@ function draw() {
* 计算元素总长度
*/
function calHeight() {
const div = document.getElementById(`content-${id}`) as HTMLDivElement;
content = div;
const style = getComputedStyle(div);
total = parseFloat(style.height);
const style = getComputedStyle(content);
total = parseFloat(style[canvasAttr]);
}
function scroll() {
draw();
content.style.top = `${-now}px`;
content.style[cssTarget] = `${-now}px`;
}
onUpdated(() => {
@ -65,32 +86,47 @@ onUpdated(() => {
});
onMounted(() => {
calHeight();
const div = document.getElementById(`scroll-div-${id}`) as HTMLDivElement;
const canvas = document.getElementById(`scroll-${id}`) as HTMLCanvasElement;
const d = document.getElementById(`content-${id}`) as HTMLDivElement;
ctx = canvas.getContext('2d') as CanvasRenderingContext2D;
content = d;
calHeight();
content.addEventListener('resize', resize);
const style = getComputedStyle(canvas);
canvas.width = 40 * scale;
canvas.height = parseFloat(style.height) * scale;
if (props.type === 'horizontal') {
div.style.flexDirection = 'column';
canvas.style.height = '40px';
canvas.style.width = '98%';
canvas.style.margin = '0 1% 0 1%';
canvas.width = parseFloat(style.width) * scale;
canvas.height = 40 * scale;
}
draw();
let lastY: number;
let last: number;
let contentLast: number;
//
useDrag(
canvas,
(x, y) => {
const dy = y - lastY;
lastY = y;
if (canvas.height < total * scale)
now += ((dy * total) / canvas.height) * scale;
const d = props.type === 'horizontal' ? x : y;
const dy = d - last;
last = d;
if (canvas[canvasAttr] < total * scale)
now += ((dy * total) / canvas[canvasAttr]) * scale;
content.style.transition = '';
scroll();
},
(x, y) => {
lastY = y;
last = props.type === 'horizontal' ? x : y;
},
true
);
@ -99,28 +135,37 @@ onMounted(() => {
useDrag(
content,
(x, y) => {
const dy = y - contentLast;
contentLast = y;
if (canvas.height < total * scale) now -= dy;
const d = props.type === 'horizontal' ? x : y;
const dy = d - contentLast;
contentLast = d;
if (canvas[canvasAttr] < total * scale) now -= dy;
content.style.transition = '';
scroll();
},
(x, y) => {
contentLast = y;
contentLast = props.type === 'horizontal' ? x : y;
},
true
);
useWheel(content, (x, y) => {
if (!core.domStyle.isVertical && Math.abs(y) > 50) {
content.style.transition = 'top 0.2s ease-out';
const d = x !== 0 ? x : y;
if (!core.domStyle.isVertical) {
if (Math.abs(d) > 50) {
content.style.transition = `${cssTarget} 0.2s ease-out`;
}
} else {
content.style.transition = '';
}
now += y;
now += d;
scroll();
});
});
onUnmounted(() => {
content.removeEventListener('resize', resize);
});
</script>
<style lang="less" scoped>
@ -141,14 +186,21 @@ onMounted(() => {
opacity: 0.6;
}
#scroll {
.scroll-main {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
flex-basis: content;
max-width: 100%;
max-height: 100%;
justify-content: stretch;
}
.content {
width: 100%;
position: relative;
}
.main-div {
flex-basis: 100%;
overflow: hidden;
}
</style>

View File

@ -1,10 +1,13 @@
// 需要引入所有的插件
import pop from './plugin/pop';
import ui from './plugin/uiController';
import use from './plugin/use';
import animate from './plugin/animateController';
import utils from './plugin/utils';
window.addEventListener('load', () => {
// 每个引入的插件都要在这里执行,否则不会被转发
const toForward: any[] = [pop(), ui()];
const toForward: any[] = [pop(), ui(), use(), animate(), utils()];
// 初始化所有插件并转发到core上
(async function () {

View File

@ -1,5 +1,6 @@
import { createApp } from 'vue';
import App from './App.vue';
import './styles.less';
import 'ant-design-vue/dist/antd.dark.css';
createApp(App).mount('#root');

View File

@ -0,0 +1,32 @@
const animation: ((time: number) => void)[] = [];
let animateTime = 0;
export default function init() {
core.registerAnimationFrame('animate', true, time => {
if (time - animateTime <= core.values.animateSpeed) return;
for (const fn of animation) {
fn(time);
}
animateTime = core.animateFrame.animateTime;
});
return { addAnimate, removeAnimate };
}
/**
*
* @param fn
*/
export function addAnimate(fn: (time: number) => void) {
animation.push(fn);
}
/**
*
* @param fn
*/
export function removeAnimate(fn: (time: number) => void) {
const index = animation.findIndex(v => v === fn);
if (index === -1)
throw new ReferenceError('No such function in animation.');
}

View File

@ -1,5 +1,5 @@
export default function init() {
return { useDrag, useWheel };
return { useDrag, useWheel, isMobile };
}
/**
@ -55,3 +55,8 @@ export function useWheel(
fn(e.deltaX, e.deltaY, e.deltaZ, e);
});
}
/**
*
*/
export const isMobile = matchMedia('(max-width: 600px)').matches;

27
src/plugin/utils.ts Normal file
View File

@ -0,0 +1,27 @@
import { isNil } from 'lodash';
export default function init() {
return { has, getDamageColor };
}
/**
* undefined或null
* @param value
*/
export function has<T>(value: T): value is NonNullable<T> {
return !isNil(value);
}
/**
*
* @param damage
*/
export function getDamageColor(damage: number): string {
if (typeof damage !== 'number') return '#f00';
if (damage === 0) return '#2f2';
if (damage < 0) return '#7f7';
if (damage < core.status.hero.hp / 3) return '#fff';
if (damage < (core.status.hero.hp * 2) / 3) return '#ff4';
if (damage < core.status.hero.hp) return '#f22';
return '#f00';
}

8
src/types/core.d.ts vendored
View File

@ -161,6 +161,10 @@ type Core = {
readonly icons: { [x: string]: HTMLImageElement };
};
readonly values: {
animateSpeed: number;
};
readonly materials: string[];
readonly control: control;
@ -317,3 +321,7 @@ declare const main: main;
declare const core: Core;
declare const flags: { [x: string]: any };
declare const hero: HeroStatus;
interface Window {
readonly core: Core;
}

View File

@ -131,7 +131,7 @@ declare class enemys {
* @param floorId id
* @returns
*/
getCurrentEnemys(floorId?: string): Enemy[];
getCurrentEnemys(floorId?: string): (Enemy & DetailedEnemy)[];
/**
*

8
src/types/icon.d.ts vendored
View File

@ -4,11 +4,17 @@ declare class icons {
getIcons(): void;
/** 根据ID获得其类型 */
getClsFromId(id?: string): string;
getClsFromId(id?: string): BlockCls;
/** 获得所有图标的ID */
getAllIconIds(): void;
/** 根据图块数字或ID获得所在的tileset和坐标信息 */
getTilesetOffset(id?: string): void;
/**
*
* @param cls
*/
getAnimateFrames(cls: BlockCls): 1 | 2 | 4;
}

31
src/types/plugin.d.ts vendored
View File

@ -4,7 +4,7 @@ type Ref<T> = {
value: T;
};
interface PluginDeclaration {
interface PluginDeclaration extends PluginUtils {
/**
* 使core.addPop或core.plugin.addPop调用
* @param px
@ -25,6 +25,9 @@ interface PluginDeclaration {
/** ui栈 */
readonly uiStack: Ref<Component[]>;
/** 是否是移动设备 */
readonly isMobile: boolean;
/**
*
* @param ele
@ -48,6 +51,32 @@ interface PluginDeclaration {
ele: HTMLElement,
fn: (x: number, y: number, z: number, e: WheelEvent) => void
): void;
/**
*
* @param fn
*/
addAnimate(fn: (time: number) => void);
/**
*
* @param fn
*/
removeAnimate(fn: (time: number) => void);
}
interface PluginUtils {
/**
* undefined或null
* @param value
*/
has<T>(value: T): value is NonNullable<T>;
/**
*
* @param damage
*/
getDamageColor(damage: number): string;
}
type Forward<T> = {

27
src/types/util.d.ts vendored
View File

@ -100,7 +100,7 @@ declare class utils {
* @param onMap true表示用于地图显伤56
* @returns
*/
formatBigNumber(x: number, onMap?: boolean): string;
formatBigNumber(x: number, onMap?: boolean, onCritical?: boolean): string;
/** 变速移动 */
applyEasing(mode?: string): (number) => number;
@ -402,6 +402,16 @@ type direction = 'up' | 'down' | 'left' | 'right';
type move = 'forward' | direction;
type loc = { direction: direction; x: number; y: number };
type rgbarray = [number, number, number, number];
type BlockCls =
| 'terrain'
| 'animate'
| 'enemy'
| 'item'
| 'enemy48'
| 'npcs'
| 'npc48'
| 'autotile'
| 'tilesets';
type Events = MotaAction[] | string;
@ -515,7 +525,7 @@ type Enemy = {
id: string;
name: string;
displayIdInBook: string;
special: number | number[];
special: number[];
hp: number;
atk: number;
def: number;
@ -525,6 +535,19 @@ type Enemy = {
[key: string]: any;
};
type DetailedEnemy = {
name: string;
specialText: string[];
specialColor: (string | rgbarray)[];
damage: number;
critical: number;
criticalDamage: number;
defDamage: number;
toShowSpecial?: string[];
toShowColor?: any[];
damageColor?: string;
};
type Item = {
cls: string;
[key: string]: any;

View File

@ -1,20 +1,87 @@
<!-- 怪物手册ui -->
<template>
<Scroll>
<div v-for="i of 100" class="test">test{{ i }}</div>
<div id="book">
<div v-if="enemy.length === 0" id="none">
<div>本层无怪物</div>
</div>
<Scroll v-else style="width: 100%; height: 100%; font-family: normal">
<div v-for="e of enemy" class="enemy">
<EnemyOne :enemy="e"></EnemyOne>
<a-divider
dashed
style="width: 100%; border-color: #ddd4"
></a-divider>
</div>
</Scroll>
</div>
</template>
<script setup lang="tsx">
import { cloneDeep } from 'lodash';
import { onMounted } from 'vue';
import EnemyOne from '../components/enemyOne.vue';
import Scroll from '../components/scroll.vue';
import { getDamageColor } from '../plugin/utils';
const floorId = core.floorIds[core.status.event?.ui] ?? core.status.floorId;
const enemy = core.getCurrentEnemys(floorId);
//
enemy.forEach(v => {
const l = v.specialText.length;
v.toShowSpecial = cloneDeep(v.specialText);
v.toShowColor = cloneDeep(v.specialColor);
if (l >= 3) {
v.toShowSpecial = v.specialText.slice(0, 2).concat(['...']);
v.toShowColor = v.specialColor.slice(0, 2).concat(['#fff']);
}
v.toShowColor = v.toShowColor.map(v => {
if (typeof v === 'string') return v;
else return core.arrayToRGBA(v);
});
v.damageColor = getDamageColor(v.damage);
});
onMounted(() => {
const div = document.getElementById('book') as HTMLDivElement;
div.style.opacity = '1';
});
</script>
<style lang="less" scoped>
.test {
color: white;
#book {
opacity: 0;
background-color: #000d;
transition: opacity 0.6s linear;
user-select: none;
width: 80%;
height: 100%;
font-family: 'normal';
overflow: hidden;
}
@media screen and (max-width: 600px) {
#book {
width: 100%;
padding: 5% 0 5% 5%;
}
}
#none {
width: 100%;
height: 100%;
font-size: 10vw;
display: flex;
justify-content: center;
align-items: center;
font-family: 'normal';
}
.enemy {
display: flex;
flex-direction: column;
height: 20vh;
width: 100%;
padding: 0 1% 0 1%;
}
</style>

View File

@ -2,6 +2,7 @@ import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import legacy from '@vitejs/plugin-legacy';
import components from 'unplugin-vue-components/vite';
import vuejsx from '@vitejs/plugin-vue-jsx'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers';
import motaConfig from './mota.config';
@ -11,6 +12,7 @@ const FSHOST = 'http://127.0.0.1:3000/';
export default defineConfig({
plugins: [
vue(),
vuejsx(),
legacy({
targets: ['defaults', 'not IE 11'],
polyfills: true,