├── .gitignore ├── LICENSE ├── README.md ├── assets ├── Main.fire ├── Main.fire.meta ├── images.meta ├── images │ ├── 6663691.jpeg │ └── 6663691.jpeg.meta ├── materials.meta ├── materials │ ├── Blur.effect │ ├── Blur.effect.meta │ ├── Blur.mtl │ └── Blur.mtl.meta ├── scripts.meta └── scripts │ ├── BlurMask.ts │ ├── BlurMask.ts.meta │ ├── Doge.ts │ ├── Doge.ts.meta │ ├── Logic.ts │ ├── Logic.ts.meta │ ├── lib.meta │ └── lib │ ├── utils.js │ ├── utils.js.meta │ ├── wheen.js │ ├── wheen.js.meta │ ├── whevent.js │ └── whevent.js.meta ├── creator.d.ts ├── jsconfig.json ├── project.json ├── settings ├── builder.json ├── project.json └── services.json ├── tsconfig.json ├── wheen.d.ts └── whevent.d.ts /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | library/ 6 | temp/ 7 | local/ 8 | build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # Logs and databases 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | *.log 15 | *.sql 16 | *.sqlite 17 | 18 | #///////////////////////////////////////////////////////////////////////////// 19 | # files for debugger 20 | #///////////////////////////////////////////////////////////////////////////// 21 | 22 | *.sln 23 | *.csproj 24 | *.pidb 25 | *.unityproj 26 | *.suo 27 | 28 | #///////////////////////////////////////////////////////////////////////////// 29 | # OS generated files 30 | #///////////////////////////////////////////////////////////////////////////// 31 | 32 | .DS_Store 33 | ehthumbs.db 34 | Thumbs.db 35 | 36 | #///////////////////////////////////////////////////////////////////////////// 37 | # exvim files 38 | #///////////////////////////////////////////////////////////////////////////// 39 | 40 | *UnityVS.meta 41 | *.err 42 | *.err.meta 43 | *.exvim 44 | *.exvim.meta 45 | *.vimentry 46 | *.vimentry.meta 47 | *.vimproject 48 | *.vimproject.meta 49 | .vimfiles.*/ 50 | .exvim.*/ 51 | quick_gen_project_*_autogen.bat 52 | quick_gen_project_*_autogen.bat.meta 53 | quick_gen_project_*_autogen.sh 54 | quick_gen_project_*_autogen.sh.meta 55 | .exvim.app 56 | 57 | #///////////////////////////////////////////////////////////////////////////// 58 | # webstorm files 59 | #///////////////////////////////////////////////////////////////////////////// 60 | 61 | .idea/ 62 | 63 | #////////////////////////// 64 | # VS Code 65 | #////////////////////////// 66 | 67 | .vscode/ -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2019 wheatup 4 | 5 | Permission is hereby granted, free of charge, 6 | to any person obtaining a copy of this software and 7 | associated documentation files (the "Software"), to 8 | deal in the Software without restriction, including 9 | without limitation the rights to use, copy, modify, 10 | merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom 12 | the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice 16 | shall be included in all copies or substantial portions of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 19 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 20 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 21 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 22 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 23 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | * [中文](#Cocos-Creator-实现背景模糊效果) 3 | * [English](#Backdrop-Blur-for-Cocos-Creator) 4 | 5 | # Cocos Creator 实现背景模糊效果 6 | 7 | 用于凸显前景,让背景模糊并降低亮度 8 | 9 | ### 版本 10 | 11 | > 针对Cocos Creator `2.1.1` 及以上。 12 | 13 | ### 效果 14 | 15 | ![效果](https://i.imgur.com/TGXDHlq.gif) 16 | 17 | ### 在线预览 18 | 19 | > [https://wheatup.github.io/blur-effect/](https://wheatup.github.io/blur-effect/) 20 | 21 | ---- 22 | 23 | ### 更新日志 24 | 25 | #### 2019-09-03 26 | 27 | * 修复了与 `Mask` 对象并用时模糊失效的问题。 28 | 29 | #### 2019-05-27 30 | 31 | * 排除对象现在也会排除其所有子物体。 32 | 33 | #### 2019-05-10 34 | 35 | * 现在不在BlurMask节点包围盒以内的背景将不会被模糊,局部打码不是梦。 36 | * 现在可以排除不需要渲染模糊的对象。 37 | * 大幅优化了性能。 38 | * 支持自定义渲染参数,可以指定模糊程度和亮度。 39 | 40 | #### 2019-05-09 41 | 42 | * 修复手机无法正常显示的bug 43 | * 略微优化了性能 44 | 45 | * Fixed a bug that it might not work correctly on mobile devices. 46 | * Slightly increased the performance. 47 | 48 | --- 49 | 50 | # Backdrop Blur for Cocos Creator 51 | 52 | Blur and dim the backdrop for highlighting the foreground(such as an alert box). 53 | 54 | ## Target Version 55 | 56 | > For Cocos Creator `2.1.x` and above. 57 | 58 | ### Preview 59 | 60 | ![Preview](https://i.imgur.com/TGXDHlq.gif) 61 | 62 | ### Live Preview 63 | 64 | > [https://wheatup.github.io/blur-effect/](https://wheatup.github.io/blur-effect/) 65 | 66 | ---- 67 | 68 | ### Change Logs 69 | 70 | #### 2019-09-03 71 | 72 | * Fixed a bug that the BlurMask doesn't work when a node with `Mask` component also exists. 73 | 74 | #### 2019-05-27 75 | 76 | * The children of excluded nodes will also be ignored. 77 | 78 | #### 2019-05-10 79 | 80 | * Now the content outside of the bounding box of the BlurMask not will not be affected. 81 | * You can now exclude nodes that the renderer will ignore them. 82 | * Drastically increased the performance. 83 | * Cusomizable rendering attributes, you can now adjust the blurriness and brightness of the mask. 84 | 85 | #### 2019-05-09 86 | 87 | * Fixed a bug that it might not work correctly on mobile devices. 88 | * Slightly increased the performance. -------------------------------------------------------------------------------- /assets/Main.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | }, 19 | { 20 | "__id__": 39 21 | }, 22 | { 23 | "__id__": 5 24 | } 25 | ], 26 | "_active": true, 27 | "_level": 0, 28 | "_components": [], 29 | "_prefab": null, 30 | "_opacity": 255, 31 | "_color": { 32 | "__type__": "cc.Color", 33 | "r": 255, 34 | "g": 255, 35 | "b": 255, 36 | "a": 255 37 | }, 38 | "_contentSize": { 39 | "__type__": "cc.Size", 40 | "width": 0, 41 | "height": 0 42 | }, 43 | "_anchorPoint": { 44 | "__type__": "cc.Vec2", 45 | "x": 0, 46 | "y": 0 47 | }, 48 | "_scale": { 49 | "__type__": "cc.Vec3", 50 | "x": 1, 51 | "y": 1, 52 | "z": 1 53 | }, 54 | "_eulerAngles": { 55 | "__type__": "cc.Vec3", 56 | "x": 0, 57 | "y": 0, 58 | "z": 0 59 | }, 60 | "_is3DNode": true, 61 | "groupIndex": 0, 62 | "autoReleaseAssets": false, 63 | "_id": "796e4182-84ab-431c-8718-3fc803eea9eb" 64 | }, 65 | { 66 | "__type__": "cc.Node", 67 | "_name": "Logic", 68 | "_objFlags": 0, 69 | "_parent": { 70 | "__id__": 1 71 | }, 72 | "_children": [], 73 | "_active": true, 74 | "_level": 1, 75 | "_components": [ 76 | { 77 | "__id__": 3 78 | } 79 | ], 80 | "_prefab": null, 81 | "_opacity": 255, 82 | "_color": { 83 | "__type__": "cc.Color", 84 | "r": 255, 85 | "g": 255, 86 | "b": 255, 87 | "a": 255 88 | }, 89 | "_contentSize": { 90 | "__type__": "cc.Size", 91 | "width": 0, 92 | "height": 0 93 | }, 94 | "_anchorPoint": { 95 | "__type__": "cc.Vec2", 96 | "x": 0.5, 97 | "y": 0.5 98 | }, 99 | "_position": { 100 | "__type__": "cc.Vec3", 101 | "x": 320, 102 | "y": 480, 103 | "z": 0 104 | }, 105 | "_scale": { 106 | "__type__": "cc.Vec3", 107 | "x": 1, 108 | "y": 1, 109 | "z": 1 110 | }, 111 | "_eulerAngles": { 112 | "__type__": "cc.Vec3", 113 | "x": 0, 114 | "y": 0, 115 | "z": 0 116 | }, 117 | "_skewX": 0, 118 | "_skewY": 0, 119 | "_is3DNode": false, 120 | "groupIndex": 0, 121 | "_id": "c8fgWF6VxBLbRGLu0hOOxM" 122 | }, 123 | { 124 | "__type__": "af53bc0Q9tAIJfCsDhJTKrS", 125 | "_name": "", 126 | "_objFlags": 0, 127 | "node": { 128 | "__id__": 2 129 | }, 130 | "_enabled": true, 131 | "tapReceiver": { 132 | "__id__": 4 133 | }, 134 | "mask": { 135 | "__id__": 31 136 | }, 137 | "panel": { 138 | "__id__": 34 139 | }, 140 | "_id": "ec/Ry6ti5ERKBr6EnlA/uF" 141 | }, 142 | { 143 | "__type__": "cc.Node", 144 | "_name": "UIRoot", 145 | "_objFlags": 0, 146 | "_parent": { 147 | "__id__": 5 148 | }, 149 | "_children": [ 150 | { 151 | "__id__": 9 152 | }, 153 | { 154 | "__id__": 11 155 | }, 156 | { 157 | "__id__": 14 158 | }, 159 | { 160 | "__id__": 31 161 | }, 162 | { 163 | "__id__": 34 164 | } 165 | ], 166 | "_active": true, 167 | "_level": 2, 168 | "_components": [ 169 | { 170 | "__id__": 38 171 | } 172 | ], 173 | "_prefab": null, 174 | "_opacity": 255, 175 | "_color": { 176 | "__type__": "cc.Color", 177 | "r": 255, 178 | "g": 255, 179 | "b": 255, 180 | "a": 255 181 | }, 182 | "_contentSize": { 183 | "__type__": "cc.Size", 184 | "width": 640, 185 | "height": 960 186 | }, 187 | "_anchorPoint": { 188 | "__type__": "cc.Vec2", 189 | "x": 0.5, 190 | "y": 0.5 191 | }, 192 | "_position": { 193 | "__type__": "cc.Vec3", 194 | "x": 0, 195 | "y": 0, 196 | "z": 0 197 | }, 198 | "_scale": { 199 | "__type__": "cc.Vec3", 200 | "x": 1, 201 | "y": 1, 202 | "z": 1 203 | }, 204 | "_eulerAngles": { 205 | "__type__": "cc.Vec3", 206 | "x": 0, 207 | "y": 0, 208 | "z": 0 209 | }, 210 | "_skewX": 0, 211 | "_skewY": 0, 212 | "_is3DNode": false, 213 | "groupIndex": 0, 214 | "_id": "81FWftWTVLCouZRmiCHScY" 215 | }, 216 | { 217 | "__type__": "cc.Node", 218 | "_name": "Canvas", 219 | "_objFlags": 0, 220 | "_parent": { 221 | "__id__": 1 222 | }, 223 | "_children": [ 224 | { 225 | "__id__": 6 226 | }, 227 | { 228 | "__id__": 4 229 | } 230 | ], 231 | "_active": true, 232 | "_level": 1, 233 | "_components": [ 234 | { 235 | "__id__": 8 236 | } 237 | ], 238 | "_prefab": null, 239 | "_opacity": 255, 240 | "_color": { 241 | "__type__": "cc.Color", 242 | "r": 255, 243 | "g": 255, 244 | "b": 255, 245 | "a": 255 246 | }, 247 | "_contentSize": { 248 | "__type__": "cc.Size", 249 | "width": 640, 250 | "height": 960 251 | }, 252 | "_anchorPoint": { 253 | "__type__": "cc.Vec2", 254 | "x": 0.5, 255 | "y": 0.5 256 | }, 257 | "_position": { 258 | "__type__": "cc.Vec3", 259 | "x": 320, 260 | "y": 480, 261 | "z": 0 262 | }, 263 | "_scale": { 264 | "__type__": "cc.Vec3", 265 | "x": 1, 266 | "y": 1, 267 | "z": 1 268 | }, 269 | "_eulerAngles": { 270 | "__type__": "cc.Vec3", 271 | "x": 0, 272 | "y": 0, 273 | "z": 0 274 | }, 275 | "_skewX": 0, 276 | "_skewY": 0, 277 | "_is3DNode": false, 278 | "groupIndex": 0, 279 | "_rotationX": 0, 280 | "_rotationY": 0, 281 | "_id": "eaXTGioQlFYq/L4oUMcveY" 282 | }, 283 | { 284 | "__type__": "cc.Node", 285 | "_name": "Main Camera", 286 | "_objFlags": 0, 287 | "_parent": { 288 | "__id__": 5 289 | }, 290 | "_children": [], 291 | "_active": true, 292 | "_level": 2, 293 | "_components": [ 294 | { 295 | "__id__": 7 296 | } 297 | ], 298 | "_prefab": null, 299 | "_opacity": 255, 300 | "_color": { 301 | "__type__": "cc.Color", 302 | "r": 255, 303 | "g": 255, 304 | "b": 255, 305 | "a": 255 306 | }, 307 | "_contentSize": { 308 | "__type__": "cc.Size", 309 | "width": 0, 310 | "height": 0 311 | }, 312 | "_anchorPoint": { 313 | "__type__": "cc.Vec2", 314 | "x": 0.5, 315 | "y": 0.5 316 | }, 317 | "_position": { 318 | "__type__": "cc.Vec3", 319 | "x": 0, 320 | "y": 0, 321 | "z": 0 322 | }, 323 | "_scale": { 324 | "__type__": "cc.Vec3", 325 | "x": 1, 326 | "y": 1, 327 | "z": 1 328 | }, 329 | "_eulerAngles": { 330 | "__type__": "cc.Vec3", 331 | "x": 0, 332 | "y": 0, 333 | "z": 0 334 | }, 335 | "_skewX": 0, 336 | "_skewY": 0, 337 | "_is3DNode": false, 338 | "groupIndex": 0, 339 | "_id": "c0yNndlrdBobeb4DKvU45k" 340 | }, 341 | { 342 | "__type__": "cc.Camera", 343 | "_name": "", 344 | "_objFlags": 0, 345 | "node": { 346 | "__id__": 6 347 | }, 348 | "_enabled": true, 349 | "_cullingMask": 4294967295, 350 | "_clearFlags": 7, 351 | "_backgroundColor": { 352 | "__type__": "cc.Color", 353 | "r": 0, 354 | "g": 0, 355 | "b": 0, 356 | "a": 255 357 | }, 358 | "_depth": -1, 359 | "_zoomRatio": 1, 360 | "_targetTexture": null, 361 | "_fov": 60, 362 | "_orthoSize": 10, 363 | "_nearClip": 0.1, 364 | "_farClip": 4096, 365 | "_ortho": true, 366 | "_rect": { 367 | "__type__": "cc.Rect", 368 | "x": 0, 369 | "y": 0, 370 | "width": 1, 371 | "height": 1 372 | }, 373 | "_renderStages": 1, 374 | "_id": "a47XUxvbNDS7DH5Mm+RDWv" 375 | }, 376 | { 377 | "__type__": "cc.Canvas", 378 | "_name": "", 379 | "_objFlags": 0, 380 | "node": { 381 | "__id__": 5 382 | }, 383 | "_enabled": true, 384 | "_designResolution": { 385 | "__type__": "cc.Size", 386 | "width": 640, 387 | "height": 960 388 | }, 389 | "_fitWidth": false, 390 | "_fitHeight": true, 391 | "_id": "60UdrtHqRKp7INqYBRLffA" 392 | }, 393 | { 394 | "__type__": "cc.Node", 395 | "_name": "Main Camera", 396 | "_objFlags": 0, 397 | "_parent": { 398 | "__id__": 4 399 | }, 400 | "_children": [], 401 | "_active": true, 402 | "_level": 3, 403 | "_components": [ 404 | { 405 | "__id__": 10 406 | } 407 | ], 408 | "_prefab": null, 409 | "_opacity": 255, 410 | "_color": { 411 | "__type__": "cc.Color", 412 | "r": 255, 413 | "g": 255, 414 | "b": 255, 415 | "a": 255 416 | }, 417 | "_contentSize": { 418 | "__type__": "cc.Size", 419 | "width": 0, 420 | "height": 0 421 | }, 422 | "_anchorPoint": { 423 | "__type__": "cc.Vec2", 424 | "x": 0.5, 425 | "y": 0.5 426 | }, 427 | "_position": { 428 | "__type__": "cc.Vec3", 429 | "x": 0, 430 | "y": 0, 431 | "z": 0 432 | }, 433 | "_scale": { 434 | "__type__": "cc.Vec3", 435 | "x": 1, 436 | "y": 1, 437 | "z": 1 438 | }, 439 | "_eulerAngles": { 440 | "__type__": "cc.Vec3", 441 | "x": 0, 442 | "y": 0, 443 | "z": 0 444 | }, 445 | "_skewX": 0, 446 | "_skewY": 0, 447 | "_is3DNode": false, 448 | "groupIndex": 0, 449 | "_rotationX": 0, 450 | "_rotationY": 0, 451 | "_id": "a9WwsxsjRHs5aOeqgV4xvh" 452 | }, 453 | { 454 | "__type__": "cc.Camera", 455 | "_name": "", 456 | "_objFlags": 0, 457 | "node": { 458 | "__id__": 9 459 | }, 460 | "_enabled": true, 461 | "_cullingMask": -1, 462 | "_clearFlags": 7, 463 | "_backgroundColor": { 464 | "__type__": "cc.Color", 465 | "r": 0, 466 | "g": 0, 467 | "b": 0, 468 | "a": 255 469 | }, 470 | "_depth": -1, 471 | "_zoomRatio": 1, 472 | "_targetTexture": null, 473 | "_fov": 60, 474 | "_orthoSize": 10, 475 | "_nearClip": 0.1, 476 | "_farClip": 4096, 477 | "_ortho": true, 478 | "_rect": { 479 | "__type__": "cc.Rect", 480 | "x": 0, 481 | "y": 0, 482 | "width": 1, 483 | "height": 1 484 | }, 485 | "_renderStages": 1, 486 | "_id": "2drZjStHZPcJ0Us/D5EY3T" 487 | }, 488 | { 489 | "__type__": "cc.Node", 490 | "_name": "BG", 491 | "_objFlags": 0, 492 | "_parent": { 493 | "__id__": 4 494 | }, 495 | "_children": [], 496 | "_active": true, 497 | "_level": 3, 498 | "_components": [ 499 | { 500 | "__id__": 12 501 | }, 502 | { 503 | "__id__": 13 504 | } 505 | ], 506 | "_prefab": null, 507 | "_opacity": 255, 508 | "_color": { 509 | "__type__": "cc.Color", 510 | "r": 140, 511 | "g": 166, 512 | "b": 231, 513 | "a": 255 514 | }, 515 | "_contentSize": { 516 | "__type__": "cc.Size", 517 | "width": 640, 518 | "height": 960 519 | }, 520 | "_anchorPoint": { 521 | "__type__": "cc.Vec2", 522 | "x": 0.5, 523 | "y": 0.5 524 | }, 525 | "_position": { 526 | "__type__": "cc.Vec3", 527 | "x": 0, 528 | "y": 0, 529 | "z": 0 530 | }, 531 | "_scale": { 532 | "__type__": "cc.Vec3", 533 | "x": 1, 534 | "y": 1, 535 | "z": 1 536 | }, 537 | "_eulerAngles": { 538 | "__type__": "cc.Vec3", 539 | "x": 0, 540 | "y": 0, 541 | "z": 0 542 | }, 543 | "_skewX": 0, 544 | "_skewY": 0, 545 | "_is3DNode": false, 546 | "groupIndex": 0, 547 | "_rotationX": 0, 548 | "_rotationY": 0, 549 | "_id": "2dBDX6m7BGE65M7sSdHLFW" 550 | }, 551 | { 552 | "__type__": "cc.Sprite", 553 | "_name": "", 554 | "_objFlags": 0, 555 | "node": { 556 | "__id__": 11 557 | }, 558 | "_enabled": true, 559 | "_materials": [ 560 | { 561 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 562 | } 563 | ], 564 | "_srcBlendFactor": 770, 565 | "_dstBlendFactor": 771, 566 | "_spriteFrame": { 567 | "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" 568 | }, 569 | "_type": 0, 570 | "_sizeMode": 0, 571 | "_fillType": 0, 572 | "_fillCenter": { 573 | "__type__": "cc.Vec2", 574 | "x": 0, 575 | "y": 0 576 | }, 577 | "_fillStart": 0, 578 | "_fillRange": 0, 579 | "_isTrimmedMode": true, 580 | "_atlas": null, 581 | "_id": "eax9R20v5L+5pCVefNqtdk" 582 | }, 583 | { 584 | "__type__": "cc.Widget", 585 | "_name": "", 586 | "_objFlags": 0, 587 | "node": { 588 | "__id__": 11 589 | }, 590 | "_enabled": true, 591 | "alignMode": 1, 592 | "_target": null, 593 | "_alignFlags": 45, 594 | "_left": 0, 595 | "_right": 0, 596 | "_top": 0, 597 | "_bottom": 0, 598 | "_verticalCenter": 0, 599 | "_horizontalCenter": 0, 600 | "_isAbsLeft": true, 601 | "_isAbsRight": true, 602 | "_isAbsTop": true, 603 | "_isAbsBottom": true, 604 | "_isAbsHorizontalCenter": true, 605 | "_isAbsVerticalCenter": true, 606 | "_originalWidth": 100, 607 | "_originalHeight": 100, 608 | "_id": "fftycvtLFOLqSED8xlV+Bx" 609 | }, 610 | { 611 | "__type__": "cc.Node", 612 | "_name": "Container", 613 | "_objFlags": 0, 614 | "_parent": { 615 | "__id__": 4 616 | }, 617 | "_children": [ 618 | { 619 | "__id__": 15 620 | }, 621 | { 622 | "__id__": 18 623 | }, 624 | { 625 | "__id__": 21 626 | }, 627 | { 628 | "__id__": 24 629 | }, 630 | { 631 | "__id__": 27 632 | } 633 | ], 634 | "_active": true, 635 | "_level": 3, 636 | "_components": [ 637 | { 638 | "__id__": 30 639 | } 640 | ], 641 | "_prefab": null, 642 | "_opacity": 255, 643 | "_color": { 644 | "__type__": "cc.Color", 645 | "r": 255, 646 | "g": 255, 647 | "b": 255, 648 | "a": 255 649 | }, 650 | "_contentSize": { 651 | "__type__": "cc.Size", 652 | "width": 640, 653 | "height": 960 654 | }, 655 | "_anchorPoint": { 656 | "__type__": "cc.Vec2", 657 | "x": 0.5, 658 | "y": 0.5 659 | }, 660 | "_position": { 661 | "__type__": "cc.Vec3", 662 | "x": 0, 663 | "y": 0, 664 | "z": 0 665 | }, 666 | "_scale": { 667 | "__type__": "cc.Vec3", 668 | "x": 1, 669 | "y": 1, 670 | "z": 1 671 | }, 672 | "_eulerAngles": { 673 | "__type__": "cc.Vec3", 674 | "x": 0, 675 | "y": 0, 676 | "z": 0 677 | }, 678 | "_skewX": 0, 679 | "_skewY": 0, 680 | "_is3DNode": false, 681 | "groupIndex": 0, 682 | "_id": "41xnG7zblAELUtPpdbFmwL" 683 | }, 684 | { 685 | "__type__": "cc.Node", 686 | "_name": "Doge", 687 | "_objFlags": 0, 688 | "_parent": { 689 | "__id__": 14 690 | }, 691 | "_children": [], 692 | "_active": true, 693 | "_level": 4, 694 | "_components": [ 695 | { 696 | "__id__": 16 697 | }, 698 | { 699 | "__id__": 17 700 | } 701 | ], 702 | "_prefab": null, 703 | "_opacity": 255, 704 | "_color": { 705 | "__type__": "cc.Color", 706 | "r": 255, 707 | "g": 255, 708 | "b": 255, 709 | "a": 255 710 | }, 711 | "_contentSize": { 712 | "__type__": "cc.Size", 713 | "width": 184, 714 | "height": 184 715 | }, 716 | "_anchorPoint": { 717 | "__type__": "cc.Vec2", 718 | "x": 0.5, 719 | "y": 0.5 720 | }, 721 | "_position": { 722 | "__type__": "cc.Vec3", 723 | "x": -102, 724 | "y": -34, 725 | "z": 0 726 | }, 727 | "_scale": { 728 | "__type__": "cc.Vec3", 729 | "x": 1, 730 | "y": 1, 731 | "z": 1 732 | }, 733 | "_eulerAngles": { 734 | "__type__": "cc.Vec3", 735 | "x": 0, 736 | "y": 0, 737 | "z": 0 738 | }, 739 | "_skewX": 0, 740 | "_skewY": 0, 741 | "_is3DNode": false, 742 | "groupIndex": 0, 743 | "_id": "7axsmLci9HeJytMrLd+NkV" 744 | }, 745 | { 746 | "__type__": "cc.Sprite", 747 | "_name": "", 748 | "_objFlags": 0, 749 | "node": { 750 | "__id__": 15 751 | }, 752 | "_enabled": true, 753 | "_materials": [ 754 | { 755 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 756 | } 757 | ], 758 | "_srcBlendFactor": 770, 759 | "_dstBlendFactor": 771, 760 | "_spriteFrame": { 761 | "__uuid__": "d1a708f0-9c81-48c8-a59f-f874e6fef541" 762 | }, 763 | "_type": 0, 764 | "_sizeMode": 1, 765 | "_fillType": 0, 766 | "_fillCenter": { 767 | "__type__": "cc.Vec2", 768 | "x": 0, 769 | "y": 0 770 | }, 771 | "_fillStart": 0, 772 | "_fillRange": 0, 773 | "_isTrimmedMode": true, 774 | "_atlas": null, 775 | "_id": "5dzxWO8BFJdrgHcTymWbRw" 776 | }, 777 | { 778 | "__type__": "a9db2Elhj9G0LB//IMXXrAZ", 779 | "_name": "", 780 | "_objFlags": 0, 781 | "node": { 782 | "__id__": 15 783 | }, 784 | "_enabled": true, 785 | "_id": "6e1TxBXslB3pB4zvP6lUcG" 786 | }, 787 | { 788 | "__type__": "cc.Node", 789 | "_name": "Doge", 790 | "_objFlags": 0, 791 | "_parent": { 792 | "__id__": 14 793 | }, 794 | "_children": [], 795 | "_active": true, 796 | "_level": 4, 797 | "_components": [ 798 | { 799 | "__id__": 19 800 | }, 801 | { 802 | "__id__": 20 803 | } 804 | ], 805 | "_prefab": null, 806 | "_opacity": 255, 807 | "_color": { 808 | "__type__": "cc.Color", 809 | "r": 255, 810 | "g": 255, 811 | "b": 255, 812 | "a": 255 813 | }, 814 | "_contentSize": { 815 | "__type__": "cc.Size", 816 | "width": 184, 817 | "height": 184 818 | }, 819 | "_anchorPoint": { 820 | "__type__": "cc.Vec2", 821 | "x": 0.5, 822 | "y": 0.5 823 | }, 824 | "_position": { 825 | "__type__": "cc.Vec3", 826 | "x": 186, 827 | "y": -223, 828 | "z": 0 829 | }, 830 | "_scale": { 831 | "__type__": "cc.Vec3", 832 | "x": 1, 833 | "y": 1, 834 | "z": 1 835 | }, 836 | "_eulerAngles": { 837 | "__type__": "cc.Vec3", 838 | "x": 0, 839 | "y": 0, 840 | "z": 0 841 | }, 842 | "_skewX": 0, 843 | "_skewY": 0, 844 | "_is3DNode": false, 845 | "groupIndex": 0, 846 | "_id": "1em6+r02FMYKJ3sfGNxQ+V" 847 | }, 848 | { 849 | "__type__": "cc.Sprite", 850 | "_name": "", 851 | "_objFlags": 0, 852 | "node": { 853 | "__id__": 18 854 | }, 855 | "_enabled": true, 856 | "_materials": [ 857 | { 858 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 859 | } 860 | ], 861 | "_srcBlendFactor": 770, 862 | "_dstBlendFactor": 771, 863 | "_spriteFrame": { 864 | "__uuid__": "d1a708f0-9c81-48c8-a59f-f874e6fef541" 865 | }, 866 | "_type": 0, 867 | "_sizeMode": 1, 868 | "_fillType": 0, 869 | "_fillCenter": { 870 | "__type__": "cc.Vec2", 871 | "x": 0, 872 | "y": 0 873 | }, 874 | "_fillStart": 0, 875 | "_fillRange": 0, 876 | "_isTrimmedMode": true, 877 | "_atlas": null, 878 | "_id": "654cI+zrtBKYSflCYiMfPW" 879 | }, 880 | { 881 | "__type__": "a9db2Elhj9G0LB//IMXXrAZ", 882 | "_name": "", 883 | "_objFlags": 0, 884 | "node": { 885 | "__id__": 18 886 | }, 887 | "_enabled": true, 888 | "_id": "4bnwy154pHspdiJo2S+HHD" 889 | }, 890 | { 891 | "__type__": "cc.Node", 892 | "_name": "Doge", 893 | "_objFlags": 0, 894 | "_parent": { 895 | "__id__": 14 896 | }, 897 | "_children": [], 898 | "_active": true, 899 | "_level": 4, 900 | "_components": [ 901 | { 902 | "__id__": 22 903 | }, 904 | { 905 | "__id__": 23 906 | } 907 | ], 908 | "_prefab": null, 909 | "_opacity": 255, 910 | "_color": { 911 | "__type__": "cc.Color", 912 | "r": 255, 913 | "g": 255, 914 | "b": 255, 915 | "a": 255 916 | }, 917 | "_contentSize": { 918 | "__type__": "cc.Size", 919 | "width": 184, 920 | "height": 184 921 | }, 922 | "_anchorPoint": { 923 | "__type__": "cc.Vec2", 924 | "x": 0.5, 925 | "y": 0.5 926 | }, 927 | "_position": { 928 | "__type__": "cc.Vec3", 929 | "x": 186, 930 | "y": 342, 931 | "z": 0 932 | }, 933 | "_scale": { 934 | "__type__": "cc.Vec3", 935 | "x": 1, 936 | "y": 1, 937 | "z": 1 938 | }, 939 | "_eulerAngles": { 940 | "__type__": "cc.Vec3", 941 | "x": 0, 942 | "y": 0, 943 | "z": 0 944 | }, 945 | "_skewX": 0, 946 | "_skewY": 0, 947 | "_is3DNode": false, 948 | "groupIndex": 0, 949 | "_id": "5bAxFJgthF2YMgKtbnwMzj" 950 | }, 951 | { 952 | "__type__": "cc.Sprite", 953 | "_name": "", 954 | "_objFlags": 0, 955 | "node": { 956 | "__id__": 21 957 | }, 958 | "_enabled": true, 959 | "_materials": [ 960 | { 961 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 962 | } 963 | ], 964 | "_srcBlendFactor": 770, 965 | "_dstBlendFactor": 771, 966 | "_spriteFrame": { 967 | "__uuid__": "d1a708f0-9c81-48c8-a59f-f874e6fef541" 968 | }, 969 | "_type": 0, 970 | "_sizeMode": 1, 971 | "_fillType": 0, 972 | "_fillCenter": { 973 | "__type__": "cc.Vec2", 974 | "x": 0, 975 | "y": 0 976 | }, 977 | "_fillStart": 0, 978 | "_fillRange": 0, 979 | "_isTrimmedMode": true, 980 | "_atlas": null, 981 | "_id": "11eCE67LZKQp8K+cuU0a8k" 982 | }, 983 | { 984 | "__type__": "a9db2Elhj9G0LB//IMXXrAZ", 985 | "_name": "", 986 | "_objFlags": 0, 987 | "node": { 988 | "__id__": 21 989 | }, 990 | "_enabled": true, 991 | "_id": "dbwt0OB4tMPKo4AhGrB4FT" 992 | }, 993 | { 994 | "__type__": "cc.Node", 995 | "_name": "Doge", 996 | "_objFlags": 0, 997 | "_parent": { 998 | "__id__": 14 999 | }, 1000 | "_children": [], 1001 | "_active": true, 1002 | "_level": 4, 1003 | "_components": [ 1004 | { 1005 | "__id__": 25 1006 | }, 1007 | { 1008 | "__id__": 26 1009 | } 1010 | ], 1011 | "_prefab": null, 1012 | "_opacity": 255, 1013 | "_color": { 1014 | "__type__": "cc.Color", 1015 | "r": 255, 1016 | "g": 255, 1017 | "b": 255, 1018 | "a": 255 1019 | }, 1020 | "_contentSize": { 1021 | "__type__": "cc.Size", 1022 | "width": 184, 1023 | "height": 184 1024 | }, 1025 | "_anchorPoint": { 1026 | "__type__": "cc.Vec2", 1027 | "x": 0.5, 1028 | "y": 0.5 1029 | }, 1030 | "_position": { 1031 | "__type__": "cc.Vec3", 1032 | "x": -129, 1033 | "y": -295, 1034 | "z": 0 1035 | }, 1036 | "_scale": { 1037 | "__type__": "cc.Vec3", 1038 | "x": 1, 1039 | "y": 1, 1040 | "z": 1 1041 | }, 1042 | "_eulerAngles": { 1043 | "__type__": "cc.Vec3", 1044 | "x": 0, 1045 | "y": 0, 1046 | "z": 0 1047 | }, 1048 | "_skewX": 0, 1049 | "_skewY": 0, 1050 | "_is3DNode": false, 1051 | "groupIndex": 0, 1052 | "_id": "f3Px8LkzBGOYpCp3qGmNX3" 1053 | }, 1054 | { 1055 | "__type__": "cc.Sprite", 1056 | "_name": "", 1057 | "_objFlags": 0, 1058 | "node": { 1059 | "__id__": 24 1060 | }, 1061 | "_enabled": true, 1062 | "_materials": [ 1063 | { 1064 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 1065 | } 1066 | ], 1067 | "_srcBlendFactor": 770, 1068 | "_dstBlendFactor": 771, 1069 | "_spriteFrame": { 1070 | "__uuid__": "d1a708f0-9c81-48c8-a59f-f874e6fef541" 1071 | }, 1072 | "_type": 0, 1073 | "_sizeMode": 1, 1074 | "_fillType": 0, 1075 | "_fillCenter": { 1076 | "__type__": "cc.Vec2", 1077 | "x": 0, 1078 | "y": 0 1079 | }, 1080 | "_fillStart": 0, 1081 | "_fillRange": 0, 1082 | "_isTrimmedMode": true, 1083 | "_atlas": null, 1084 | "_id": "42d2QdVbVPta0rXxLPVUMy" 1085 | }, 1086 | { 1087 | "__type__": "a9db2Elhj9G0LB//IMXXrAZ", 1088 | "_name": "", 1089 | "_objFlags": 0, 1090 | "node": { 1091 | "__id__": 24 1092 | }, 1093 | "_enabled": true, 1094 | "_id": "21d6g0igFHtYk/9q1MkF2N" 1095 | }, 1096 | { 1097 | "__type__": "cc.Node", 1098 | "_name": "Doge", 1099 | "_objFlags": 0, 1100 | "_parent": { 1101 | "__id__": 14 1102 | }, 1103 | "_children": [], 1104 | "_active": true, 1105 | "_level": 4, 1106 | "_components": [ 1107 | { 1108 | "__id__": 28 1109 | }, 1110 | { 1111 | "__id__": 29 1112 | } 1113 | ], 1114 | "_prefab": null, 1115 | "_opacity": 255, 1116 | "_color": { 1117 | "__type__": "cc.Color", 1118 | "r": 255, 1119 | "g": 255, 1120 | "b": 255, 1121 | "a": 255 1122 | }, 1123 | "_contentSize": { 1124 | "__type__": "cc.Size", 1125 | "width": 184, 1126 | "height": 184 1127 | }, 1128 | "_anchorPoint": { 1129 | "__type__": "cc.Vec2", 1130 | "x": 0.5, 1131 | "y": 0.5 1132 | }, 1133 | "_position": { 1134 | "__type__": "cc.Vec3", 1135 | "x": 0, 1136 | "y": 170, 1137 | "z": 0 1138 | }, 1139 | "_scale": { 1140 | "__type__": "cc.Vec3", 1141 | "x": 1, 1142 | "y": 1, 1143 | "z": 1 1144 | }, 1145 | "_eulerAngles": { 1146 | "__type__": "cc.Vec3", 1147 | "x": 0, 1148 | "y": 0, 1149 | "z": 0 1150 | }, 1151 | "_skewX": 0, 1152 | "_skewY": 0, 1153 | "_is3DNode": false, 1154 | "groupIndex": 0, 1155 | "_id": "b1x/REM2hO77558f7lRwIT" 1156 | }, 1157 | { 1158 | "__type__": "cc.Sprite", 1159 | "_name": "", 1160 | "_objFlags": 0, 1161 | "node": { 1162 | "__id__": 27 1163 | }, 1164 | "_enabled": true, 1165 | "_materials": [ 1166 | { 1167 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 1168 | } 1169 | ], 1170 | "_srcBlendFactor": 770, 1171 | "_dstBlendFactor": 771, 1172 | "_spriteFrame": { 1173 | "__uuid__": "d1a708f0-9c81-48c8-a59f-f874e6fef541" 1174 | }, 1175 | "_type": 0, 1176 | "_sizeMode": 1, 1177 | "_fillType": 0, 1178 | "_fillCenter": { 1179 | "__type__": "cc.Vec2", 1180 | "x": 0, 1181 | "y": 0 1182 | }, 1183 | "_fillStart": 0, 1184 | "_fillRange": 0, 1185 | "_isTrimmedMode": true, 1186 | "_atlas": null, 1187 | "_id": "9bHef1tpdPF78XSLQCsxZ3" 1188 | }, 1189 | { 1190 | "__type__": "a9db2Elhj9G0LB//IMXXrAZ", 1191 | "_name": "", 1192 | "_objFlags": 0, 1193 | "node": { 1194 | "__id__": 27 1195 | }, 1196 | "_enabled": true, 1197 | "_id": "5dE3Q241VNj77pgtKX10Jh" 1198 | }, 1199 | { 1200 | "__type__": "cc.Widget", 1201 | "_name": "", 1202 | "_objFlags": 0, 1203 | "node": { 1204 | "__id__": 14 1205 | }, 1206 | "_enabled": true, 1207 | "alignMode": 1, 1208 | "_target": null, 1209 | "_alignFlags": 45, 1210 | "_left": 0, 1211 | "_right": 0, 1212 | "_top": 0, 1213 | "_bottom": 0, 1214 | "_verticalCenter": 0, 1215 | "_horizontalCenter": 0, 1216 | "_isAbsLeft": true, 1217 | "_isAbsRight": true, 1218 | "_isAbsTop": true, 1219 | "_isAbsBottom": true, 1220 | "_isAbsHorizontalCenter": true, 1221 | "_isAbsVerticalCenter": true, 1222 | "_originalWidth": 0, 1223 | "_originalHeight": 0, 1224 | "_id": "fcKY1VhGJERaZE3oo444UJ" 1225 | }, 1226 | { 1227 | "__type__": "cc.Node", 1228 | "_name": "Blur", 1229 | "_objFlags": 0, 1230 | "_parent": { 1231 | "__id__": 4 1232 | }, 1233 | "_children": [], 1234 | "_active": true, 1235 | "_level": 3, 1236 | "_components": [ 1237 | { 1238 | "__id__": 32 1239 | }, 1240 | { 1241 | "__id__": 33 1242 | } 1243 | ], 1244 | "_prefab": null, 1245 | "_opacity": 255, 1246 | "_color": { 1247 | "__type__": "cc.Color", 1248 | "r": 255, 1249 | "g": 255, 1250 | "b": 255, 1251 | "a": 255 1252 | }, 1253 | "_contentSize": { 1254 | "__type__": "cc.Size", 1255 | "width": 640, 1256 | "height": 960 1257 | }, 1258 | "_anchorPoint": { 1259 | "__type__": "cc.Vec2", 1260 | "x": 0.5, 1261 | "y": 0.5 1262 | }, 1263 | "_position": { 1264 | "__type__": "cc.Vec3", 1265 | "x": 0, 1266 | "y": 0, 1267 | "z": 0 1268 | }, 1269 | "_scale": { 1270 | "__type__": "cc.Vec3", 1271 | "x": 1, 1272 | "y": 1, 1273 | "z": 1 1274 | }, 1275 | "_eulerAngles": { 1276 | "__type__": "cc.Vec3", 1277 | "x": 0, 1278 | "y": 0, 1279 | "z": 0 1280 | }, 1281 | "_skewX": 0, 1282 | "_skewY": 0, 1283 | "_is3DNode": false, 1284 | "groupIndex": 0, 1285 | "_id": "0cWqV2mqdM5rghGJAuu5qy" 1286 | }, 1287 | { 1288 | "__type__": "cc.Widget", 1289 | "_name": "", 1290 | "_objFlags": 0, 1291 | "node": { 1292 | "__id__": 31 1293 | }, 1294 | "_enabled": true, 1295 | "alignMode": 1, 1296 | "_target": null, 1297 | "_alignFlags": 45, 1298 | "_left": 0, 1299 | "_right": 0, 1300 | "_top": 0, 1301 | "_bottom": 0, 1302 | "_verticalCenter": 0, 1303 | "_horizontalCenter": 0, 1304 | "_isAbsLeft": true, 1305 | "_isAbsRight": true, 1306 | "_isAbsTop": true, 1307 | "_isAbsBottom": true, 1308 | "_isAbsHorizontalCenter": true, 1309 | "_isAbsVerticalCenter": true, 1310 | "_originalWidth": 500, 1311 | "_originalHeight": 500, 1312 | "_id": "45bxIhPF9JfpzPBvY0irBl" 1313 | }, 1314 | { 1315 | "__type__": "f351aoLeYRFMJ0SkjRFg/yo", 1316 | "_name": "", 1317 | "_objFlags": 0, 1318 | "node": { 1319 | "__id__": 31 1320 | }, 1321 | "_enabled": true, 1322 | "material": { 1323 | "__uuid__": "cc0dbfd1-2ac5-4a88-b414-7e9e502f965c" 1324 | }, 1325 | "ignoredNodes": [ 1326 | { 1327 | "__id__": 34 1328 | } 1329 | ], 1330 | "bightness": 0.5, 1331 | "blurAmount": 0.5, 1332 | "_id": "39c7C9WhRBMYAblx+fsqA1" 1333 | }, 1334 | { 1335 | "__type__": "cc.Node", 1336 | "_name": "AlertBox", 1337 | "_objFlags": 0, 1338 | "_parent": { 1339 | "__id__": 4 1340 | }, 1341 | "_children": [ 1342 | { 1343 | "__id__": 35 1344 | } 1345 | ], 1346 | "_active": true, 1347 | "_level": 3, 1348 | "_components": [ 1349 | { 1350 | "__id__": 37 1351 | } 1352 | ], 1353 | "_prefab": null, 1354 | "_opacity": 255, 1355 | "_color": { 1356 | "__type__": "cc.Color", 1357 | "r": 255, 1358 | "g": 255, 1359 | "b": 255, 1360 | "a": 255 1361 | }, 1362 | "_contentSize": { 1363 | "__type__": "cc.Size", 1364 | "width": 500, 1365 | "height": 200 1366 | }, 1367 | "_anchorPoint": { 1368 | "__type__": "cc.Vec2", 1369 | "x": 0.5, 1370 | "y": 0.5 1371 | }, 1372 | "_position": { 1373 | "__type__": "cc.Vec3", 1374 | "x": 0, 1375 | "y": 0, 1376 | "z": 0 1377 | }, 1378 | "_scale": { 1379 | "__type__": "cc.Vec3", 1380 | "x": 1, 1381 | "y": 1, 1382 | "z": 1 1383 | }, 1384 | "_eulerAngles": { 1385 | "__type__": "cc.Vec3", 1386 | "x": 0, 1387 | "y": 0, 1388 | "z": 0 1389 | }, 1390 | "_skewX": 0, 1391 | "_skewY": 0, 1392 | "_is3DNode": false, 1393 | "groupIndex": 0, 1394 | "_rotationX": 0, 1395 | "_rotationY": 0, 1396 | "_id": "de/Yo2SEhKH4nFIRckcK8N" 1397 | }, 1398 | { 1399 | "__type__": "cc.Node", 1400 | "_name": "label", 1401 | "_objFlags": 0, 1402 | "_parent": { 1403 | "__id__": 34 1404 | }, 1405 | "_children": [], 1406 | "_active": true, 1407 | "_level": 4, 1408 | "_components": [ 1409 | { 1410 | "__id__": 36 1411 | } 1412 | ], 1413 | "_prefab": null, 1414 | "_opacity": 255, 1415 | "_color": { 1416 | "__type__": "cc.Color", 1417 | "r": 0, 1418 | "g": 0, 1419 | "b": 0, 1420 | "a": 255 1421 | }, 1422 | "_contentSize": { 1423 | "__type__": "cc.Size", 1424 | "width": 320, 1425 | "height": 50.4 1426 | }, 1427 | "_anchorPoint": { 1428 | "__type__": "cc.Vec2", 1429 | "x": 0.5, 1430 | "y": 0.5 1431 | }, 1432 | "_position": { 1433 | "__type__": "cc.Vec3", 1434 | "x": 0, 1435 | "y": 0, 1436 | "z": 0 1437 | }, 1438 | "_scale": { 1439 | "__type__": "cc.Vec3", 1440 | "x": 1, 1441 | "y": 1, 1442 | "z": 1 1443 | }, 1444 | "_eulerAngles": { 1445 | "__type__": "cc.Vec3", 1446 | "x": 0, 1447 | "y": 0, 1448 | "z": 0 1449 | }, 1450 | "_skewX": 0, 1451 | "_skewY": 0, 1452 | "_is3DNode": false, 1453 | "groupIndex": 0, 1454 | "_rotationX": 0, 1455 | "_rotationY": 0, 1456 | "_id": "betNfED09N26OlunpmwZMQ" 1457 | }, 1458 | { 1459 | "__type__": "cc.Label", 1460 | "_name": "", 1461 | "_objFlags": 0, 1462 | "node": { 1463 | "__id__": 35 1464 | }, 1465 | "_enabled": true, 1466 | "_materials": [ 1467 | { 1468 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 1469 | } 1470 | ], 1471 | "_useOriginalSize": false, 1472 | "_string": "提示:背景已模糊", 1473 | "_N$string": "提示:背景已模糊", 1474 | "_fontSize": 40, 1475 | "_lineHeight": 40, 1476 | "_enableWrapText": true, 1477 | "_N$file": null, 1478 | "_isSystemFontUsed": true, 1479 | "_spacingX": 0, 1480 | "_batchAsBitmap": false, 1481 | "_N$horizontalAlign": 1, 1482 | "_N$verticalAlign": 1, 1483 | "_N$fontFamily": "Arial", 1484 | "_N$overflow": 0, 1485 | "_N$cacheMode": 0, 1486 | "_id": "99IlJAd1lMlJ+m5AEtGXhr" 1487 | }, 1488 | { 1489 | "__type__": "cc.Sprite", 1490 | "_name": "", 1491 | "_objFlags": 0, 1492 | "node": { 1493 | "__id__": 34 1494 | }, 1495 | "_enabled": true, 1496 | "_materials": [ 1497 | { 1498 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 1499 | } 1500 | ], 1501 | "_srcBlendFactor": 770, 1502 | "_dstBlendFactor": 771, 1503 | "_spriteFrame": { 1504 | "__uuid__": "9bbda31e-ad49-43c9-aaf2-f7d9896bac69" 1505 | }, 1506 | "_type": 1, 1507 | "_sizeMode": 0, 1508 | "_fillType": 0, 1509 | "_fillCenter": { 1510 | "__type__": "cc.Vec2", 1511 | "x": 0, 1512 | "y": 0 1513 | }, 1514 | "_fillStart": 0, 1515 | "_fillRange": 0, 1516 | "_isTrimmedMode": true, 1517 | "_atlas": null, 1518 | "_id": "162MAt6ppJNIqyY62D4lOR" 1519 | }, 1520 | { 1521 | "__type__": "cc.Widget", 1522 | "_name": "", 1523 | "_objFlags": 0, 1524 | "node": { 1525 | "__id__": 4 1526 | }, 1527 | "_enabled": true, 1528 | "alignMode": 1, 1529 | "_target": null, 1530 | "_alignFlags": 45, 1531 | "_left": 0, 1532 | "_right": 0, 1533 | "_top": 0, 1534 | "_bottom": 0, 1535 | "_verticalCenter": 0, 1536 | "_horizontalCenter": 0, 1537 | "_isAbsLeft": true, 1538 | "_isAbsRight": true, 1539 | "_isAbsTop": true, 1540 | "_isAbsBottom": true, 1541 | "_isAbsHorizontalCenter": true, 1542 | "_isAbsVerticalCenter": true, 1543 | "_originalWidth": 0, 1544 | "_originalHeight": 0, 1545 | "_id": "3a7kW4J7VJEqXVvFvSZDXQ" 1546 | }, 1547 | { 1548 | "__type__": "cc.Node", 1549 | "_name": "Main Camera", 1550 | "_objFlags": 0, 1551 | "_parent": { 1552 | "__id__": 1 1553 | }, 1554 | "_children": [], 1555 | "_active": true, 1556 | "_level": 1, 1557 | "_components": [ 1558 | { 1559 | "__id__": 40 1560 | } 1561 | ], 1562 | "_prefab": null, 1563 | "_opacity": 255, 1564 | "_color": { 1565 | "__type__": "cc.Color", 1566 | "r": 255, 1567 | "g": 255, 1568 | "b": 255, 1569 | "a": 255 1570 | }, 1571 | "_contentSize": { 1572 | "__type__": "cc.Size", 1573 | "width": 0, 1574 | "height": 0 1575 | }, 1576 | "_anchorPoint": { 1577 | "__type__": "cc.Vec2", 1578 | "x": 0.5, 1579 | "y": 0.5 1580 | }, 1581 | "_position": { 1582 | "__type__": "cc.Vec3", 1583 | "x": 320, 1584 | "y": 480, 1585 | "z": 0 1586 | }, 1587 | "_scale": { 1588 | "__type__": "cc.Vec3", 1589 | "x": 1, 1590 | "y": 1, 1591 | "z": 1 1592 | }, 1593 | "_eulerAngles": { 1594 | "__type__": "cc.Vec3", 1595 | "x": 0, 1596 | "y": 0, 1597 | "z": 0 1598 | }, 1599 | "_skewX": 0, 1600 | "_skewY": 0, 1601 | "_is3DNode": false, 1602 | "groupIndex": 0, 1603 | "_id": "42wBoOVjdGML6pdItjsXYN" 1604 | }, 1605 | { 1606 | "__type__": "cc.Camera", 1607 | "_name": "", 1608 | "_objFlags": 0, 1609 | "node": { 1610 | "__id__": 39 1611 | }, 1612 | "_enabled": true, 1613 | "_cullingMask": 4294967295, 1614 | "_clearFlags": 7, 1615 | "_backgroundColor": { 1616 | "__type__": "cc.Color", 1617 | "r": 0, 1618 | "g": 0, 1619 | "b": 0, 1620 | "a": 255 1621 | }, 1622 | "_depth": -1, 1623 | "_zoomRatio": 1, 1624 | "_targetTexture": null, 1625 | "_fov": 60, 1626 | "_orthoSize": 10, 1627 | "_nearClip": 0.1, 1628 | "_farClip": 4096, 1629 | "_ortho": true, 1630 | "_rect": { 1631 | "__type__": "cc.Rect", 1632 | "x": 0, 1633 | "y": 0, 1634 | "width": 1, 1635 | "height": 1 1636 | }, 1637 | "_renderStages": 1, 1638 | "_id": "51QWmihJxDCos4zFCclbch" 1639 | } 1640 | ] -------------------------------------------------------------------------------- /assets/Main.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "796e4182-84ab-431c-8718-3fc803eea9eb", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/images.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "60f31a22-2346-4077-a44a-507db61f02d9", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/images/6663691.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wheatup/cocos-creator-blur-mask/fd428f99ff8e9a67b65bbff0bfb4a8194e55afb4/assets/images/6663691.jpeg -------------------------------------------------------------------------------- /assets/images/6663691.jpeg.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "256aca17-50a4-4a64-bdab-67c5ab98bfb2", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "6663691": { 11 | "ver": "1.0.4", 12 | "uuid": "d1a708f0-9c81-48c8-a59f-f874e6fef541", 13 | "rawTextureUuid": "256aca17-50a4-4a64-bdab-67c5ab98bfb2", 14 | "trimType": "auto", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 184, 22 | "height": 184, 23 | "rawWidth": 184, 24 | "rawHeight": 184, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/materials.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "981b1c95-6248-40f9-a65c-085c03f4f58e", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/materials/Blur.effect: -------------------------------------------------------------------------------- 1 | /** 2 | * 模糊shader 3 | * @author wheatup 4 | * @reference https://github.com/ShawnZhang2015/ShaderHelper/blob/master/assets/shader/GaussBlurs.js 5 | * @version 1.0 6 | */ 7 | 8 | %{ 9 | techniques : [ 10 | { 11 | passes : [ 12 | { 13 | vert : vs 14 | frag : fs 15 | cullMode : none 16 | blend : true 17 | } 18 | ] 19 | layer : 0 20 | } 21 | ] 22 | properties : { 23 | texture : { 24 | type : sampler2D 25 | value : null 26 | } 27 | } 28 | %} 29 | 30 | %% vs { 31 | precision highp float; 32 | 33 | uniform mat4 cc_matViewProj; 34 | attribute vec3 a_position; 35 | attribute mediump vec2 a_uv0; 36 | varying mediump vec2 v_uv0; 37 | 38 | void main() { 39 | gl_Position = cc_matViewProj * vec4(a_position, 1); 40 | v_uv0 = a_uv0; 41 | } 42 | } 43 | 44 | %% fs { 45 | // float低精度(反正都模糊了,精度无所谓) 46 | precision lowp float; 47 | // 贴图采样器,来自于v2f管线 48 | uniform sampler2D texture; 49 | // 亮度,外界属性 50 | uniform float bightness; 51 | // 模糊度,外界属性 52 | uniform float blurAmount; 53 | // 当前点uv 54 | varying lowp vec2 v_uv0; 55 | 56 | // 随机值 57 | float rand(vec2 co) { 58 | return fract(sin(dot(co.xy , vec2(12.9898, 78.233))) * 43758.5453); 59 | } 60 | 61 | // 降低亮度 62 | vec4 dim(vec4 col, float factor) { 63 | return vec4(col.r * factor, col.g * factor, col.b * factor, col.a); 64 | } 65 | 66 | vec4 blur(vec2 uv){ 67 | // 重复次数,值越大模糊质量越高,但性能越低 68 | #define repeats 16.0 69 | 70 | // 模糊值 71 | float _blurAmount = 0.08 * blurAmount; 72 | 73 | vec4 blurred = vec4(0.0); 74 | 75 | // 重复采样 76 | for(float i = 0.0; i < repeats; i ++ ) { 77 | // 第一采样点 78 | vec2 q = vec2(cos(degrees((i / repeats) * 360.0)), sin(degrees((i / repeats) * 360.0))) * (rand(vec2(i, uv.x + uv.y)) + _blurAmount); 79 | vec2 uv2 = uv + (q * _blurAmount); 80 | blurred += texture2D(texture, uv).rgba / 2.0; 81 | 82 | // 第二采样点 83 | q = vec2(cos(degrees((i / repeats) * 360.0)), sin(degrees((i / repeats) * 360.0))) * (rand(vec2(i + 2.0, uv.x + uv.y + 24.0)) + _blurAmount); 84 | uv2 = uv + (q * _blurAmount); 85 | blurred += texture2D(texture, uv2).rgba / 2.0; 86 | } 87 | 88 | // 中和 89 | blurred /= repeats; 90 | 91 | return blurred; 92 | } 93 | 94 | // 入口函数 95 | void main() { 96 | gl_FragColor = vec4(dim(blur(v_uv0), bightness)); 97 | } 98 | } -------------------------------------------------------------------------------- /assets/materials/Blur.effect.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.15", 3 | "uuid": "3eaafe6d-187a-4175-9669-7b03d92d4d6d", 4 | "compiledShaders": [ 5 | { 6 | "vert": "\n#define _IS_VERT_SHADER 1\n\n\tprecision highp float;\n\t\n\tuniform mat4 cc_matViewProj;\n\tattribute vec3 a_position;\n\tattribute mediump vec2 a_uv0;\n\tvarying mediump vec2 v_uv0;\n\t\n\tvoid main() {\n\t\tgl_Position = cc_matViewProj * vec4(a_position, 1);\n\t\tv_uv0 = a_uv0;\n\t}\n\n\n", 7 | "frag": "\n#define _IS_FRAG_SHADER 1\n\n\t\n\tprecision lowp float;\n\t\n\tuniform sampler2D texture;\n\t\n\tuniform float bightness;\n\t\n\tuniform float blurAmount;\n\t\n\tvarying lowp vec2 v_uv0;\n\t\n\tvec4 blur(vec2 uv){\n\t\t\n\t\t#define repeats 16.0\n\n\t\t\n\t\tfloat _blurAmount = 0.08 * blurAmount;\n\n\t\tvec4 blurred = vec4(0.0);\n\n\t\t\n\t\tfor(float i = 0.0; i < repeats; i ++ ) {\n\t\t\t\n\t\t\tvec2 q = vec2(cos(degrees((i / repeats) * 360.0)), sin(degrees((i / repeats) * 360.0))) * (rand(vec2(i, uv.x + uv.y)) + _blurAmount);\n\t\t\tvec2 uv2 = uv + (q * _blurAmount);\n\t\t\tblurred += texture2D(texture, uv).rgba / 2.0;\n\t\t\t\n\t\t\t\n\t\t\tq = vec2(cos(degrees((i / repeats) * 360.0)), sin(degrees((i / repeats) * 360.0))) * (rand(vec2(i + 2.0, uv.x + uv.y + 24.0)) + _blurAmount);\n\t\t\tuv2 = uv + (q * _blurAmount);\n\t\t\tblurred += texture2D(texture, uv).rgba / 2.0;\n\t\t}\n\n\t\t\n\t\tblurred /= repeats;\n\n\t\treturn blurred;\n\t}\n\t\n\t\n\tfloat rand(vec2 co) {\n\t\treturn fract(sin(dot(co.xy , vec2(12.9898, 78.233))) * 43758.5453);\n\t}\n\t\n\t\n\tvec4 dim(vec4 col, float factor) {\n\t\treturn vec4(col.r * factor, col.g * factor, col.b * factor, col.a);\n\t}\n\t\n\t\n\tvoid main() {\n\t\tgl_FragColor = vec4(dim(blur(v_uv0), bightness));\n\t}\n\n\n" 8 | } 9 | ], 10 | "subMetas": {} 11 | } -------------------------------------------------------------------------------- /assets/materials/Blur.mtl: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "", 4 | "_objFlags": 0, 5 | "_native": "", 6 | "_effectAsset": { 7 | "__uuid__": "3eaafe6d-187a-4175-9669-7b03d92d4d6d" 8 | }, 9 | "_defines": {}, 10 | "_props": { 11 | "bightness": 0.5, 12 | "blurAmount": 1.0 13 | } 14 | } -------------------------------------------------------------------------------- /assets/materials/Blur.mtl.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "cc0dbfd1-2ac5-4a88-b414-7e9e502f965c", 4 | "dataAsSubAsset": null, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/scripts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "1011ca8d-ded4-4a4d-ad7f-03ccadf968a3", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/BlurMask.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 模糊节点控制器 3 | * @author wheatup 4 | * @version 1.0 5 | */ 6 | 7 | const { ccclass, property } = cc._decorator; 8 | 9 | @ccclass 10 | export default class BlurMask extends cc.Component { 11 | camera: cc.Camera = null; 12 | texture: cc.RenderTexture = null; 13 | spriteFrame: cc.SpriteFrame = null; 14 | sprite: cc.Sprite = null; 15 | 16 | _lastSize = new cc.Size(0, 0); 17 | _cullingMask = 0x10000000; 18 | 19 | @property({ 20 | // @ts-ignore 21 | type: cc.Material, 22 | displayName: "模糊材质", 23 | tooltip: "用于应用模糊所用的材质,如无特殊需求请保持默认" 24 | }) 25 | material = null; 26 | 27 | @property({ 28 | type: [cc.Node], 29 | displayName: "忽略节点列表", 30 | tooltip: "在此列表内的节点将不会被模糊遮罩渲染" 31 | }) 32 | ignoredNodes = []; 33 | 34 | @property({ 35 | type: cc.Float, 36 | displayName: "亮度", 37 | tooltip: "降低背景的亮度", 38 | min: 0, 39 | max: 1 40 | }) 41 | bightness: number = 0.5; 42 | 43 | @property({ 44 | type: cc.Float, 45 | displayName: "模糊度", 46 | tooltip: "背景的模糊程度", 47 | min: 0, 48 | max: 1 49 | }) 50 | blurAmount: number = 0.5; 51 | 52 | start() { 53 | // 截图图像是翻转的,所以y轴镜像 54 | this.node.scaleY = -1; 55 | 56 | // 创建渲染贴图对象 57 | this.texture = new cc.RenderTexture(); 58 | this.texture.initWithSize(this.node.width, this.node.height, cc.game['_renderContext']['STENCIL_INDEX8']); 59 | 60 | // 在node上创建摄影机 61 | this.camera = this.node.addComponent(cc.Camera); 62 | // 不渲染0x10000000的cullingMask对象 63 | this.camera.cullingMask = 0xffffffff ^ this._cullingMask; 64 | this.camera.targetTexture = this.texture; 65 | // 关闭摄影机,否则每一帧它会自动进行渲染 66 | this.camera.enabled = false; 67 | 68 | // 将自身与忽略对象排除渲染 69 | this.cull(this.node); 70 | this.ignoredNodes.map(node => this.cull(node)); 71 | 72 | // 创建一个sprite组件,由其进行渲染 73 | this.spriteFrame = new cc.SpriteFrame(); 74 | this.sprite = this.node.addComponent(cc.Sprite); 75 | this.sprite.spriteFrame = this.spriteFrame; 76 | this.material["_props"]["bightness"] = this.bightness; 77 | this.material["_props"]["blurAmount"] = this.blurAmount; 78 | this.sprite["_materials"][0] = this.material; 79 | } 80 | 81 | // 截图并模糊 82 | snapshot() { 83 | let size = this.node.getContentSize(); 84 | if (size.width !== this._lastSize.width || size.height !== this._lastSize.height) { 85 | // 大小发生改变,重新设置texture大小 86 | this.texture.initWithSize(this.node.width, this.node.height, cc.game['_renderContext']['STENCIL_INDEX8']); 87 | this.camera.targetTexture = this.texture; 88 | } 89 | this._lastSize.width = size.width; 90 | this._lastSize.height = size.height; 91 | 92 | // 手动渲染摄影机,保存截图 93 | this.camera.render(cc.Canvas.instance.node); 94 | 95 | // 应用刚刚截图的贴图到sprite身上进行渲染 96 | this.spriteFrame.setTexture(this.texture); 97 | } 98 | 99 | update(dt) { 100 | // 每一帧都进行截图处理,可以换成需要的时候再调用,比较省资源 101 | this.snapshot(); 102 | } 103 | 104 | // 排除忽略渲染对象及其子对象 105 | private cull(node: cc.Node) { 106 | if (node) { 107 | node["_cullingMask"] = this._cullingMask; 108 | if (node.childrenCount > 0) { 109 | node.children.map(child => this.cull(child)); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /assets/scripts/BlurMask.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "f351aa0b-7984-4530-9d12-92344583fca8", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/Doge.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 背景doge 3 | * @author wheatup 4 | * @version 1.0 5 | */ 6 | 7 | const { ccclass, property } = cc._decorator; 8 | 9 | @ccclass 10 | export default class Doge extends cc.Component { 11 | 12 | xDir: number = 1; 13 | yDir: number = 1; 14 | 15 | // 让doge在屏幕上跑来跑去 16 | update(dt) { 17 | this.node.x += dt * 100 * this.xDir; 18 | this.node.y += dt * 100 * this.yDir; 19 | 20 | let width = (cc.Canvas.instance.node.width - this.node.width) * 0.5; 21 | let height = (cc.Canvas.instance.node.height - this.node.height) * 0.5; 22 | 23 | if (this.node.x < -width) { 24 | this.xDir = 1; 25 | } else if (this.node.x > width) { 26 | this.xDir = -1; 27 | } 28 | 29 | if (this.node.y < -height) { 30 | this.yDir = 1; 31 | } else if (this.node.y > height) { 32 | this.yDir = -1; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /assets/scripts/Doge.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "a9db2125-863f-46d0-b07f-fc83175eb019", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/Logic.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 点击面板弹出提示框行为 3 | * @author wheatup 4 | * @version 1.0 5 | */ 6 | 7 | const { ccclass, property } = cc._decorator; 8 | 9 | @ccclass 10 | export default class Logic extends cc.Component { 11 | 12 | // 点击对象 13 | @property(cc.Node) 14 | tapReceiver: cc.Node = null; 15 | 16 | @property(cc.Node) 17 | mask: cc.Node = null; 18 | 19 | @property(cc.Node) 20 | panel: cc.Node = null; 21 | 22 | showing: boolean = false; 23 | 24 | onLoad() { 25 | this.panel.active = false; 26 | this.panel.opacity = 0; 27 | this.panel.scale = 0.2; 28 | 29 | this.mask.active = false; 30 | this.mask.opacity = 0; 31 | 32 | this.tapReceiver.on('touchstart', () => this.showing ? this.hide() : this.show(), this); 33 | } 34 | 35 | show() { 36 | this.showing = true; 37 | this.mask.active = true; 38 | this.panel.active = true; 39 | 40 | Wheen.stop(this.mask); 41 | new Wheen(this.mask) 42 | .to({ opacity: 255 }, 500, Wheen.Easing.Cubic.easeOut) 43 | .start(); 44 | 45 | Wheen.stop(this.panel); 46 | new Wheen(this.panel) 47 | .to({ opacity: 255, scale: 1 }, 500, Wheen.Easing.Back.easeOut) 48 | .start(); 49 | } 50 | 51 | hide() { 52 | this.showing = false; 53 | this.panel.active = true; 54 | 55 | Wheen.stop(this.mask); 56 | new Wheen(this.mask) 57 | .to({ opacity: 0 }, 500, Wheen.Easing.Cubic.easeOut) 58 | .callFunc(() => this.panel.active = false) 59 | .start(); 60 | 61 | Wheen.stop(this.panel); 62 | new Wheen(this.panel) 63 | .to({ opacity: 0, scale: 0 }, 500, Wheen.Easing.Back.easeIn) 64 | .callFunc(() => this.panel.active = false) 65 | .start(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /assets/scripts/Logic.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "af53b734-43db-4020-97c2-b038494caad2", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/lib.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "86216913-ac47-4ea2-8707-d7e3f02a4218", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/lib/utils.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Util class 3 | * @author wheatup 4 | */ 5 | 6 | class Utils { 7 | /** 8 | * Interpolate between two colors 9 | * @param color1 starting color 10 | * @param color2 target color 11 | * @param factor a number between 0 to 1 12 | */ 13 | static interpolateColor(color1, color2, factor) { 14 | var result = { r: 255, g: 255, b: 255, a: 255 }; 15 | result.r = Math.round(color1.r + factor * (color2.r - color1.r)); 16 | result.g = Math.round(color1.g + factor * (color2.g - color1.g)); 17 | result.b = Math.round(color1.b + factor * (color2.b - color1.b)); 18 | result.a = Math.round(color1.a + factor * (color2.a - color1.a)); 19 | return result; 20 | } 21 | 22 | /** 23 | * Calculate distant between two points. 24 | * @param vec1 point1 25 | * @param vec2 point2 26 | */ 27 | static distance(vec1, vec2) { 28 | return Math.sqrt(Math.pow(vec1.x - vec2.x, 2) + Math.pow(vec1.y - vec2.y, 2)); 29 | } 30 | 31 | /** 32 | * Apply a matrix to a vector 33 | * @param mat2 2 dimensional matrix 34 | * @param vec2 2 dimesional vector 35 | */ 36 | static matrix2d(vec2, mat2) { 37 | let x = vec2.x * mat2[0] + vec2.y * mat2[1]; 38 | let y = vec2.x * mat2[2] + vec2.y * mat2[3]; 39 | return { x, y }; 40 | } 41 | 42 | /** 43 | * Switch the parent of the node without changing the transformation 44 | * @param node target node 45 | * @param newParent new parent 46 | */ 47 | static switchParent(node, newParent) { 48 | let localPos = (node.parent || node).convertToWorldSpaceAR(node.getPosition()); 49 | let worldPos = newParent.convertToNodeSpaceAR(localPos); 50 | 51 | let rotationAttr = typeof node.rotation === 'undefined' ? 'angle' : 'rotation'; 52 | let localScaleX = 1; 53 | let localScaleY = 1; 54 | let localAngleX = 0; 55 | let localAngleY = 0; 56 | for (let parent = node; parent; parent = parent.parent) { 57 | localScaleX *= parent.scaleX; 58 | localScaleY *= parent.scaleY; 59 | localAngleX += parent[rotationAttr + 'X']; 60 | localAngleY += parent[rotationAttr + 'Y']; 61 | } 62 | 63 | let worldScaleX = 1; 64 | let worldScaleY = 1; 65 | let worldAngleX = 0; 66 | let worldAngleY = 0; 67 | for (let parent = newParent; parent; parent = parent.parent) { 68 | worldScaleX /= parent.scaleX; 69 | worldScaleY /= parent.scaleY; 70 | worldAngleX -= parent[rotationAttr + 'X']; 71 | worldAngleY -= parent[rotationAttr + 'Y']; 72 | } 73 | 74 | node.setParent(newParent); 75 | node[rotationAttr + 'X'] = localAngleX + worldAngleX; 76 | node[rotationAttr + 'Y'] = localAngleY + worldAngleY; 77 | node.setScale(localScaleX * worldScaleX, localScaleY * worldScaleY); 78 | node.setPosition(worldPos); 79 | } 80 | } 81 | 82 | window.Utils = Utils; 83 | -------------------------------------------------------------------------------- /assets/scripts/lib/utils.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "b6467984-5c64-406a-8576-7801f989717f", 4 | "isPlugin": true, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/lib/wheen.js: -------------------------------------------------------------------------------- 1 | class Wheen { 2 | constructor(target) { 3 | if (target) { 4 | this.apply(target); 5 | } 6 | 7 | this._running = false; 8 | this._tweenChain = []; 9 | this._chainIndex = 0; 10 | this._flags = {}; 11 | this._lastUpdateTime = 0; 12 | this._completed = false; 13 | this._integrated = false; 14 | this._class = null; 15 | 16 | this._update = this._update.bind(this); 17 | 18 | // Cocos Creater integration 19 | if (typeof window !== 'undefined') { 20 | let cc = window.cc; 21 | if (typeof cc !== 'undefined' && cc.ENGINE_VERSION) { 22 | let ud = this._update; 23 | if (cc.Canvas.instance) { 24 | try { 25 | this._class = cc.Class({ 26 | extends: cc.Component, 27 | update: ud 28 | }); 29 | 30 | cc.Canvas.instance.node.addComponent(this._class); 31 | this._integrated = true; 32 | } catch (ex) { 33 | console.error(ex); 34 | } 35 | } 36 | } 37 | } 38 | } 39 | 40 | static stop(target) { 41 | if (target.__wheens__) { 42 | target.__wheens__.forEach(wheen => { 43 | wheen.stop(); 44 | }); 45 | } 46 | } 47 | 48 | static pause(target) { 49 | if (target.__wheens__) { 50 | target.__wheens__.forEach(wheen => { 51 | wheen.pause(); 52 | }); 53 | } 54 | } 55 | 56 | static resume(target) { 57 | if (target.__wheens__) { 58 | target.__wheens__.forEach(wheen => { 59 | wheen.resume(); 60 | }); 61 | } 62 | } 63 | 64 | static start(target) { 65 | if (target.__wheens__) { 66 | target.__wheens__.forEach(wheen => { 67 | wheen.start(); 68 | }); 69 | } 70 | } 71 | 72 | apply(target) { 73 | this.target = target; 74 | if (typeof target.__wheens__ === 'undefined' || !target.__wheens__) { 75 | target.__wheens__ = []; 76 | } 77 | target.__wheens__.push(this); 78 | return this; 79 | } 80 | 81 | from(args) { 82 | this._tweenChain.push({ args, type: 'from' }); 83 | return this; 84 | } 85 | 86 | to(args, time, easing) { 87 | let chain = { args, time, easing, type: 'to' }; 88 | this._tweenChain.push(chain); 89 | return this; 90 | } 91 | 92 | wait(time) { 93 | this._tweenChain.push({ time, type: 'wait', elapsedTime: 0 }); 94 | return this; 95 | } 96 | 97 | setFlag(flag) { 98 | this._flags[flag] = this._tweenChain.length; 99 | return this; 100 | } 101 | 102 | loop(count, flag) { 103 | this._tweenChain.push({ count, flag, type: 'loop', currentLap: 0 }); 104 | return this; 105 | } 106 | 107 | callFunc(func, self, ...args) { 108 | this._tweenChain.push({ func, self, args, type: 'callFunc' }); 109 | return this; 110 | } 111 | 112 | on(event, func, self) { 113 | if (!this._events) { 114 | this._events = {}; 115 | } 116 | this._events[event] = { func, self }; 117 | return this; 118 | } 119 | 120 | start() { 121 | if (!this.target) { 122 | throw new Error('You have to assign the animation to a target!'); 123 | } 124 | 125 | this._chainIndex = 0; 126 | this._running = true; 127 | this._lastUpdateTime = new Date().getTime(); 128 | 129 | // Use the from value immediately 130 | this._tweenChain.forEach(chain => { 131 | if (chain.type === 'from') { 132 | assign(this.target, chain.args); 133 | } 134 | }); 135 | 136 | if (!this._integrated) { 137 | window.requestAnimationFrame(() => this._update()); 138 | } 139 | 140 | if (this._events && this._events['start']) { 141 | if (this._events['start']['self']) { 142 | this._events['start'].func.call(this._events['start']['self']); 143 | } else { 144 | this._events['start'].func(); 145 | } 146 | } 147 | 148 | return this; 149 | } 150 | 151 | pause() { 152 | this._running = false; 153 | return this; 154 | } 155 | 156 | resume() { 157 | this._running = true; 158 | return this; 159 | } 160 | 161 | stop() { 162 | this._running = false; 163 | this._completed = true; 164 | this._remove(); 165 | if (this._class) { 166 | cc.Canvas.instance.node.removeComponent(this._class); 167 | } 168 | 169 | if (this._events && this._events['finish']) { 170 | if (this._events['finish']['self']) { 171 | this._events['finish'].func.call(this._events['finish']['self']); 172 | } else { 173 | this._events['finish'].func(); 174 | } 175 | } 176 | 177 | return this; 178 | } 179 | 180 | _remove() { 181 | if (this.target.__wheens__) { 182 | let index = this.target.__wheens__.indexOf(this); 183 | if (index > -1) { 184 | this.target.__wheens__.splice(index, 1); 185 | } 186 | if (this.target.__wheens__.length <= 0) { 187 | delete this.target.__wheens__; 188 | } 189 | } 190 | } 191 | 192 | _update(dt) { 193 | if (this._integrated && dt) { 194 | dt *= 1000; 195 | } else { 196 | dt = new Date().getTime() - this._lastUpdateTime; 197 | } 198 | 199 | let callImmediately = false; 200 | 201 | if (this._running && !this._completed) { 202 | let chain = this._tweenChain[this._chainIndex]; 203 | if (!chain || !this.target || (this._integrated && this.target instanceof cc.Node && !this.target.isValid)) { 204 | this.stop(); 205 | } else { 206 | switch (chain.type) { 207 | case 'from': 208 | this._chainIndex++; 209 | callImmediately = true; 210 | break; 211 | case 'to': 212 | if (chain.time <= 0) { 213 | assign(this.target, chain.args); 214 | this._chainIndex++; 215 | } else { 216 | if (!chain.org) { 217 | chain.org = {}; 218 | for (let arg in chain.args) { 219 | chain.org[arg] = _get(this.target, arg); 220 | } 221 | } 222 | 223 | if (!chain.elapsedTime) { 224 | chain.elapsedTime = dt; 225 | } else { 226 | chain.elapsedTime += dt; 227 | } 228 | 229 | let args = {}; 230 | 231 | if (chain.elapsedTime >= chain.time) { 232 | chain.elapsedTime = chain.time; 233 | assign(this.target, chain.args); 234 | assign(args, chain.args); 235 | this._chainIndex++; 236 | } else { 237 | if (!chain.easing) { 238 | chain.easing = Wheen.Easing.Linear; 239 | } 240 | 241 | for (let arg in chain.args) { 242 | if (chain.elapsedTime === chain.time) { 243 | _set(this.target, arg, _get(this.target, arg)); 244 | } else { 245 | _set(this.target, arg, chain.easing(chain.elapsedTime, chain.org[arg], chain.args[arg] - chain.org[arg], chain.time)); 246 | } 247 | args[arg] = _get(this.target, arg); 248 | } 249 | } 250 | 251 | if (this._events && this._events['update']) { 252 | if (this._events['update']['self']) { 253 | this._events['update'].func.call(this._events['update']['self'], args); 254 | } else { 255 | this._events['update'].func(args); 256 | } 257 | } 258 | } 259 | break; 260 | case 'wait': 261 | chain.elapsedTime += dt; 262 | if (chain.elapsedTime > chain.time) { 263 | this._chainIndex++; 264 | } 265 | break; 266 | case 'loop': 267 | chain.currentLap++; 268 | if (!chain.count || chain.count <= 0 || chain.currentLap < chain.count) { 269 | let backtrack = (chain.flag && this._flags[chain.flag]) || 0; 270 | 271 | // reset the children's states 272 | for (let i = backtrack; i < this._chainIndex; i++) { 273 | let _chain = this._tweenChain[i]; 274 | let _forWechat = _chain.elapsedTime; 275 | if (_chain.type === 'loop') { 276 | _chain.currentLap = 0; 277 | } else if (_chain.type === 'wait') { 278 | _chain.elapsedTime = 0; 279 | } else if (_chain.type === 'to') { 280 | _chain.elapsedTime = 0; 281 | delete _chain.org; 282 | } 283 | // For some fucking reason, if you don't add this statement, loop will not work in WeChat Minigames. 284 | if (_forWechat) { 285 | _forWechat.toString(); 286 | } 287 | } 288 | this._chainIndex = backtrack; 289 | } else { 290 | this._chainIndex++; 291 | callImmediately = true; 292 | } 293 | break; 294 | case 'callFunc': 295 | if (chain.func) { 296 | if (chain.self) { 297 | chain.func.call(chain.self, ...chain.args); 298 | } else { 299 | chain.func(...chain.args); 300 | } 301 | this._chainIndex++; 302 | break; 303 | } 304 | } 305 | } 306 | } 307 | 308 | this._lastUpdateTime += dt; 309 | if (callImmediately) { 310 | this._update(); 311 | } else if (!this._completed) { 312 | if (!this._integrated) { 313 | window.requestAnimationFrame(() => this._update()); 314 | } 315 | } 316 | } 317 | } 318 | 319 | Wheen.Easing = { 320 | Linear: function (t, s, e, i) { 321 | return (e * t) / i + s; 322 | }, 323 | Quad: { 324 | easeIn: function (t, s, e, i) { 325 | return e * (t /= i) * t + s; 326 | }, 327 | easeOut: function (t, s, e, i) { 328 | return -e * (t /= i) * (t - 2) + s; 329 | }, 330 | easeInOut: function (t, s, e, i) { 331 | return (t /= i / 2) < 1 ? (e / 2) * t * t + s : (-e / 2) * (--t * (t - 2) - 1) + s; 332 | } 333 | }, 334 | Cubic: { 335 | easeIn: function (t, s, e, i) { 336 | return e * (t /= i) * t * t + s; 337 | }, 338 | easeOut: function (t, s, e, i) { 339 | return e * ((t = t / i - 1) * t * t + 1) + s; 340 | }, 341 | easeInOut: function (t, s, e, i) { 342 | return (t /= i / 2) < 1 ? (e / 2) * t * t * t + s : (e / 2) * ((t -= 2) * t * t + 2) + s; 343 | } 344 | }, 345 | Quart: { 346 | easeIn: function (t, s, e, i) { 347 | return e * (t /= i) * t * t * t + s; 348 | }, 349 | easeOut: function (t, s, e, i) { 350 | return -e * ((t = t / i - 1) * t * t * t - 1) + s; 351 | }, 352 | easeInOut: function (t, s, e, i) { 353 | return (t /= i / 2) < 1 ? (e / 2) * t * t * t * t + s : (-e / 2) * ((t -= 2) * t * t * t - 2) + s; 354 | } 355 | }, 356 | Quint: { 357 | easeIn: function (t, s, e, i) { 358 | return e * (t /= i) * t * t * t * t + s; 359 | }, 360 | easeOut: function (t, s, e, i) { 361 | return e * ((t = t / i - 1) * t * t * t * t + 1) + s; 362 | }, 363 | easeInOut: function (t, s, e, i) { 364 | return (t /= i / 2) < 1 ? (e / 2) * t * t * t * t * t + s : (e / 2) * ((t -= 2) * t * t * t * t + 2) + s; 365 | } 366 | }, 367 | Sine: { 368 | easeIn: function (t, s, e, i) { 369 | return -e * Math.cos((t / i) * (Math.PI / 2)) + e + s; 370 | }, 371 | easeOut: function (t, s, e, i) { 372 | return e * Math.sin((t / i) * (Math.PI / 2)) + s; 373 | }, 374 | easeInOut: function (t, s, e, i) { 375 | return (-e / 2) * (Math.cos((Math.PI * t) / i) - 1) + s; 376 | } 377 | }, 378 | Expo: { 379 | easeIn: function (t, s, e, i) { 380 | return 0 == t ? s : e * Math.pow(2, 10 * (t / i - 1)) + s; 381 | }, 382 | easeOut: function (t, s, e, i) { 383 | return t == i ? s + e : e * (1 - Math.pow(2, (-10 * t) / i)) + s; 384 | }, 385 | easeInOut: function (t, s, e, i) { 386 | return 0 == t ? s : t == i ? s + e : (t /= i / 2) < 1 ? (e / 2) * Math.pow(2, 10 * (t - 1)) + s : (e / 2) * (2 - Math.pow(2, -10 * --t)) + s; 387 | } 388 | }, 389 | Circ: { 390 | easeIn: function (t, s, e, i) { 391 | return -e * (Math.sqrt(1 - (t /= i) * t) - 1) + s; 392 | }, 393 | easeOut: function (t, s, e, i) { 394 | return e * Math.sqrt(1 - (t = t / i - 1) * t) + s; 395 | }, 396 | easeInOut: function (t, s, e, i) { 397 | return (t /= i / 2) < 1 ? (-e / 2) * (Math.sqrt(1 - t * t) - 1) + s : (e / 2) * (Math.sqrt(1 - (t -= 2) * t) + 1) + s; 398 | } 399 | }, 400 | Elastic: { 401 | easeIn: function (t, s, e, i, n, h) { 402 | if (0 == t) return s; 403 | if (1 == (t /= i)) return s + e; 404 | if ((h || (h = 0.3 * i), !n || n < Math.abs(e))) { 405 | n = e; 406 | var a = h / 4; 407 | } else a = (h / (2 * Math.PI)) * Math.asin(e / n); 408 | return -n * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t * i - a) * (2 * Math.PI)) / h) + s; 409 | }, 410 | easeOut: function (t, s, e, i, n, h) { 411 | if (0 == t) return s; 412 | if (1 == (t /= i)) return s + e; 413 | if ((h || (h = 0.3 * i), !n || n < Math.abs(e))) { 414 | n = e; 415 | var a = h / 4; 416 | } else a = (h / (2 * Math.PI)) * Math.asin(e / n); 417 | return n * Math.pow(2, -10 * t) * Math.sin(((t * i - a) * (2 * Math.PI)) / h) + e + s; 418 | }, 419 | easeInOut: function (t, s, e, i, n, h) { 420 | if (0 == t) return s; 421 | if (2 == (t /= i / 2)) return s + e; 422 | if ((h || (h = i * (0.3 * 1.5)), !n || n < Math.abs(e))) { 423 | n = e; 424 | var a = h / 4; 425 | } else a = (h / (2 * Math.PI)) * Math.asin(e / n); 426 | return t < 1 427 | ? n * Math.pow(2, 10 * (t -= 1)) * Math.sin(((t * i - a) * (2 * Math.PI)) / h) * -0.5 + s 428 | : n * Math.pow(2, -10 * (t -= 1)) * Math.sin(((t * i - a) * (2 * Math.PI)) / h) * 0.5 + e + s; 429 | } 430 | }, 431 | Back: { 432 | easeIn: function (t, s, e, i, n) { 433 | return null == n && (n = 1.70158), e * (t /= i) * t * ((n + 1) * t - n) + s; 434 | }, 435 | easeOut: function (t, s, e, i, n) { 436 | return null == n && (n = 1.70158), e * ((t = t / i - 1) * t * ((n + 1) * t + n) + 1) + s; 437 | }, 438 | easeInOut: function (t, s, e, i, n) { 439 | return null == n && (n = 1.70158), (t /= i / 2) < 1 ? (e / 2) * (t * t * ((1 + (n *= 1.525)) * t - n)) + s : (e / 2) * ((t -= 2) * t * ((1 + (n *= 1.525)) * t + n) + 2) + s; 440 | } 441 | }, 442 | Bounce: { 443 | easeIn: function (t, s, e, i) { 444 | return e - Easing.Bounce.easeOut(i - t, 0, e, i) + s; 445 | }, 446 | easeOut: function (t, s, e, i) { 447 | return (t /= i) < 1 / 2.75 448 | ? e * (7.5625 * t * t) + s 449 | : t < 2 / 2.75 450 | ? e * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + s 451 | : t < 2.5 / 2.75 452 | ? e * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + s 453 | : e * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + s; 454 | }, 455 | easeInOut: function (t, s, e, i) { 456 | return t < i / 2 ? 0.5 * Easing.Bounce.easeIn(2 * t, 0, e, i) + s : 0.5 * Easing.Bounce.easeOut(2 * t - i, 0, e, i) + 0.5 * e + s; 457 | } 458 | } 459 | }; 460 | 461 | function _set(target, attr, value) { 462 | let levels = attr.split('.'); 463 | if (levels.length > 1 && target[levels[0]] !== undefined) { 464 | let depth = 0; 465 | let current = target; 466 | while (depth < levels.length) { 467 | current = current[levels[depth]]; 468 | depth++; 469 | if (depth === levels.length - 1) { 470 | current[levels[depth]] = value; 471 | } 472 | } 473 | } else { 474 | target[attr] = value; 475 | } 476 | } 477 | 478 | function _get(target, attr) { 479 | let levels = attr.split('.'); 480 | // console.log(levels); 481 | if (levels.length > 1) { 482 | let depth = 0; 483 | let current = target; 484 | while (depth < levels.length) { 485 | current = current[levels[depth]]; 486 | if (current === undefined) { 487 | return target[attr]; 488 | } 489 | depth++; 490 | } 491 | return current; 492 | } else { 493 | return target[attr]; 494 | } 495 | } 496 | 497 | // TODO: Use lodash .set function 498 | function assign(target, source) { 499 | for (let key in source) { 500 | _set(target, key, source[key]); 501 | } 502 | } 503 | 504 | if (typeof module !== 'undefined') { 505 | module.exports = Wheen; 506 | } 507 | -------------------------------------------------------------------------------- /assets/scripts/lib/wheen.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "29d25ca2-51f8-4452-9ecb-f7350e10a2b2", 4 | "isPlugin": true, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/lib/whevent.js: -------------------------------------------------------------------------------- 1 | window.whevent = { 2 | // debug mode, the call will be printed by the logger 3 | debugMode: false, 4 | // the logger object, used for debug mode, if not assigned, use console.log instead 5 | logger: null, 6 | // the last event object that called 7 | lastEvent: null, 8 | 9 | _callStacks: {}, 10 | 11 | 12 | // bind the event object 13 | bind: function(signal, func, self){ 14 | if(!this._callStacks[signal]){ 15 | this._callStacks[signal] = []; 16 | } 17 | this._callStacks[signal].push({func:func, self:self, once: false}); 18 | }, 19 | 20 | // make sure this is the first one get called 21 | bindPriority: function(signal, func, self){ 22 | if(!this._callStacks[signal]){ 23 | this._callStacks[signal] = []; 24 | } 25 | this._callStacks[signal].splice(0, 0, {func:func, self:self, once: false}); 26 | }, 27 | 28 | // destory the bind after it get called 29 | bindOnce: function(signal, func, self){ 30 | if(!this._callStacks[signal]){ 31 | this._callStacks[signal] = []; 32 | } 33 | this._callStacks[signal].push({func:func, self:self, once: true}); 34 | }, 35 | 36 | // make sure this is the first one get called destory the bind after it get called 37 | bindOncePriority: function(signal, func, self){ 38 | if(!this._callStacks[signal]){ 39 | this._callStacks[signal] = []; 40 | } 41 | this._callStacks[signal].splice(0, 0, {func:func, self:self, once: true}); 42 | }, 43 | 44 | // unbind the event 45 | unbind: function(signal, func, self){ 46 | if(!this._callStacks[signal]){return;} 47 | for(var i = 0; i < this._callStacks[signal].length; i++){ 48 | if(this._callStacks[signal][i].func === func && (!self || this._callStacks[signal][i].self === self)){ 49 | this._callStacks[signal].splice(i, 1); 50 | return; 51 | } 52 | } 53 | 54 | if(this._callStacks[signal].length <= 0){ 55 | this._callStacks[signal] = undefined; 56 | } 57 | }, 58 | 59 | // destroy a signal 60 | destroy: function(signal){ 61 | this._callStacks[signal] = undefined; 62 | }, 63 | 64 | // dispatch the event 65 | call: function(signal, data){ 66 | if(this.debugMode){ 67 | if(!this.logger){ 68 | this.logger = console.log; 69 | } 70 | this.logger('CALL: ' + signal, data); 71 | } 72 | if(this.lastEvent){ 73 | this.lastEvent.signal = signal; 74 | this.lastEvent.data = data; 75 | }else{ 76 | this.lastEvent = {signal: signal, data: data}; 77 | } 78 | 79 | if(!this._callStacks[signal]){return;} 80 | var eves = this._callStacks[signal]; 81 | for(var i = 0; i < eves.length; i++){ 82 | if(eves[i].func){ 83 | eves[i].func.call(eves[i].self, data); 84 | if(eves[i]){ 85 | eves[i]._processed = true; 86 | } 87 | } 88 | if(eves[i].once){ 89 | eves.splice(i, 1); 90 | i--; 91 | } 92 | } 93 | 94 | if(eves.length <= 0){ 95 | this.destroy(signal); 96 | } 97 | } 98 | }; 99 | 100 | // Aliases 101 | whevent.on = whevent.bind; 102 | whevent.onOnce = whevent.bindOnce; 103 | whevent.onPriority = whevent.bindPriority; 104 | whevent.onOncePriority = whevent.bindOncePriority; 105 | whevent.off = whevent.unbind; 106 | whevent.emit = whevent.call; 107 | 108 | if(typeof module !== 'undefined'){ 109 | module.exports = whevent; 110 | } 111 | -------------------------------------------------------------------------------- /assets/scripts/lib/whevent.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "93e7eae0-2194-41af-9478-abc90dbc9b34", 4 | "isPlugin": true, 5 | "loadPluginInWeb": false, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": true, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "experimentalDecorators": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | ".vscode", 10 | "library", 11 | "local", 12 | "settings", 13 | "temp" 14 | ] 15 | } -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos-creator-js", 3 | "packages": "packages", 4 | "version": "2.1.2" 5 | } -------------------------------------------------------------------------------- /settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "android-instant": { 3 | "REMOTE_SERVER_ROOT": "", 4 | "host": "", 5 | "pathPattern": "", 6 | "recordPath": "", 7 | "scheme": "https", 8 | "skipRecord": false 9 | }, 10 | "appBundle": false, 11 | "baidugame": { 12 | "REMOTE_SERVER_ROOT": "", 13 | "appid": "testappid", 14 | "orientation": "portrait", 15 | "subContext": "" 16 | }, 17 | "encryptJs": true, 18 | "excludeScenes": [], 19 | "fb-instant-games": {}, 20 | "includeSDKBox": false, 21 | "inlineSpriteFrames": true, 22 | "inlineSpriteFrames_native": true, 23 | "md5Cache": false, 24 | "mergeStartScene": false, 25 | "optimizeHotUpdate": false, 26 | "orientation": { 27 | "landscapeLeft": true, 28 | "landscapeRight": true, 29 | "portrait": false, 30 | "upsideDown": false 31 | }, 32 | "packageName": "org.cocos2d.Playground", 33 | "qqplay": { 34 | "REMOTE_SERVER_ROOT": "", 35 | "orientation": "portrait", 36 | "zip": false 37 | }, 38 | "startScene": "796e4182-84ab-431c-8718-3fc803eea9eb", 39 | "title": "Playground", 40 | "webOrientation": "auto", 41 | "wechatgame": { 42 | "REMOTE_SERVER_ROOT": "", 43 | "appid": "wx6ac3f5090a6b99c5", 44 | "orientation": "portrait", 45 | "subContext": "" 46 | }, 47 | "xxteaKey": "fe1ce5d0-1340-42", 48 | "zipCompressJs": true 49 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets-sort-type": "name", 3 | "collision-matrix": [ 4 | [ 5 | true 6 | ] 7 | ], 8 | "design-resolution-height": 640, 9 | "design-resolution-width": 960, 10 | "excluded-modules": [ 11 | "Dynamic Atlas", 12 | "Label Effect", 13 | "ParticleSystem", 14 | "TiledMap", 15 | "Spine Skeleton", 16 | "DragonBones", 17 | "RichText", 18 | "MotionStreak", 19 | "Button", 20 | "ProgressBar", 21 | "ScrollBar", 22 | "ScrollView", 23 | "Toggle", 24 | "PageView", 25 | "PageViewIndicator", 26 | "Slider", 27 | "Layout", 28 | "EditBox", 29 | "VideoPlayer", 30 | "WebView", 31 | "Audio", 32 | "AudioSource", 33 | "Animation", 34 | "Collider", 35 | "Action", 36 | "Physics", 37 | "NodePool", 38 | "StudioComponent", 39 | "Intersection", 40 | "Native Socket" 41 | ], 42 | "facebook": { 43 | "appID": "", 44 | "audience": { 45 | "enable": false 46 | }, 47 | "enable": false, 48 | "live": { 49 | "enable": false 50 | } 51 | }, 52 | "fit-height": true, 53 | "fit-width": false, 54 | "group-list": [ 55 | "default" 56 | ], 57 | "last-module-event-record-time": 1557289167039, 58 | "simulator-orientation": false, 59 | "simulator-resolution": { 60 | "height": 640, 61 | "width": 960 62 | }, 63 | "use-customize-simulator": true, 64 | "use-project-simulator-setting": false, 65 | "start-scene": "current" 66 | } -------------------------------------------------------------------------------- /settings/services.json: -------------------------------------------------------------------------------- 1 | { 2 | "services": [ 3 | { 4 | "service_id": "242", 5 | "service_name": "Agora Voice", 6 | "service_icon": "https://account.cocos.com/uploads/client_icon/2019-07-16/273952d155b4cdb72d2b1bc61de91ade.png", 7 | "service_desc": "Build the future of communications with the world’s leading voice、video、and interactive broadcasting platform. Agora delivers easy to embed Real-Time Engagement APIs which includes all the development tools and cloud infrastructure needed for mobile、web、and desktop applications.", 8 | "service_title": "SDKBuilt-in real-time Audio SDK", 9 | "service_guide_url": "https://docs.agora.io/en/Interactive Gaming/game_c?platform=Cocos Creator", 10 | "service_sample_url": "https://github.com/AgoraIO/Voice-Call-for-Mobile-Gaming/tree/master/Basic-Voice-Call-for-Gaming/Hello-CocosCreator-Voice-Agora", 11 | "service_dev_url": "https://sso.agora.io/api/oauth/cocos/login", 12 | "service_type": "3", 13 | "service_type_zh": "公司和个人游戏", 14 | "support_platform": [ 15 | "Android", 16 | "iOS", 17 | "HTML5" 18 | ], 19 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-agora/1.0.2_2.2.3.20_2.5.2.zip", 20 | "package_version_desc": "解决Bug:onAudioVolumeIndication 回调收不到.", 21 | "service_component_name": "service-agora", 22 | "package_versions": [ 23 | "1.0.1_2.2.3.20_2.5.2", 24 | "1.0.2_2.2.3.20_2.5.2" 25 | ], 26 | "build_platform": [ 27 | "web-mobile", 28 | "web-desktop", 29 | "android", 30 | "ios" 31 | ], 32 | "require_verify": 1, 33 | "service_price": "The service according to usage billing, billing rules ,the fees incurred by the third party from your Cocos balances .", 34 | "packpage_version_desc": "", 35 | "service_protocol": "Game for the first time to open the service,the Cocos after notification service for game on service and initialization parameters,service party may according to need to get your Cocos account information,such as account basic information,game basic information,account balance,click on the confirm open button that is seen as you agree to the service to access your account information,See < a href='http://auth.cocos.com/CocosServiceAgreement.html'>Cocos user service agreement and Cocos privacy policy " 36 | } 37 | ], 38 | "game": { 39 | "name": "UNKNOW GAME", 40 | "appid": "UNKNOW" 41 | } 42 | } -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "lib": [ "dom", "es5", "es2015.promise" ], 5 | "target": "es5", 6 | "experimentalDecorators": true, 7 | "skipLibCheck": true 8 | }, 9 | "exclude": [ 10 | "node_modules", 11 | "library", 12 | "local", 13 | "temp", 14 | "build", 15 | "settings" 16 | ] 17 | } -------------------------------------------------------------------------------- /wheen.d.ts: -------------------------------------------------------------------------------- 1 | declare interface EasingFunction{ 2 | 3 | } 4 | 5 | declare class Wheen { 6 | /** 7 | * create a new animation with given target. 8 | * @param target target 9 | */ 10 | constructor(target?: any); 11 | 12 | /** 13 | * apply the animation to the target. 14 | * @param target target 15 | */ 16 | apply(target: any): Wheen; 17 | 18 | /** 19 | * set the starting point. 20 | * @param args attributes for starting point 21 | */ 22 | from(args: any): Wheen; 23 | 24 | /** 25 | * lerp to given attributes 26 | * @param args target attributes 27 | * @param time total time, milliseconds 28 | * @param easing easing function 29 | * 30 | */ 31 | to(args: any, time: number, easing?: EasingFunction): Wheen; 32 | 33 | /** 34 | * event system 35 | * @param event event name 36 | * @param func function needs to be called 37 | * @param self caller 38 | * 39 | */ 40 | on(event: 'start'|'finish'|'update', func: Function, self?: any): Wheen; 41 | 42 | /** 43 | * wait a specific time 44 | * @param time target attributes 45 | */ 46 | wait(time: number): Wheen; 47 | 48 | /** 49 | * set a flag for looping 50 | * @param flag flag name 51 | */ 52 | setFlag(flag: string|number|symbol): Wheen; 53 | 54 | /** 55 | * loop animation 56 | * @param count loop count, if less or equal 0, it's infinite 57 | * @param flag flag name 58 | */ 59 | loop(count?: number, flag?: string|number|symbol): Wheen; 60 | 61 | /** 62 | * call a function 63 | * @param func the function need to be called 64 | * @param self this context 65 | * @param args arguments 66 | */ 67 | callFunc(func: Function, self?: any, ...args: any): Wheen; 68 | 69 | /** 70 | * start the animation 71 | */ 72 | start(); 73 | 74 | /** 75 | * pause the animation 76 | */ 77 | pause(); 78 | 79 | /** 80 | * resume the animation 81 | */ 82 | resume(); 83 | 84 | /** 85 | * stop the animation 86 | */ 87 | stop(); 88 | 89 | /** 90 | * stop all animations from an object 91 | * @param target target 92 | */ 93 | static stop(target: any); 94 | 95 | /** 96 | * start all animations from an object 97 | * @param target target 98 | */ 99 | static start(target: any); 100 | 101 | /** 102 | * pause all animations from an object 103 | * @param target target 104 | */ 105 | static pause(target: any); 106 | 107 | /** 108 | * resume all animations from an object 109 | * @param target target 110 | */ 111 | static resume(target: any); 112 | 113 | static Easing: { 114 | static Linear: EasingFunction; 115 | 116 | static Quad: { 117 | static easeIn: EasingFunction; 118 | static easeOut: EasingFunction; 119 | static easeInOut: EasingFunction; 120 | } 121 | 122 | static Cubic: { 123 | static easeIn: EasingFunction; 124 | static easeOut: EasingFunction; 125 | static easeInOut: EasingFunction; 126 | } 127 | 128 | static Quart: { 129 | static easeIn: EasingFunction; 130 | static easeOut: EasingFunction; 131 | static easeInOut: EasingFunction; 132 | } 133 | 134 | static Quint: { 135 | static easeIn: EasingFunction; 136 | static easeOut: EasingFunction; 137 | static easeInOut: EasingFunction; 138 | } 139 | 140 | static Sine: { 141 | static easeIn: EasingFunction; 142 | static easeOut: EasingFunction; 143 | static easeInOut: EasingFunction; 144 | } 145 | 146 | static Expo: { 147 | static easeIn: EasingFunction; 148 | static easeOut: EasingFunction; 149 | static easeInOut: EasingFunction; 150 | } 151 | 152 | static Circ: { 153 | static easeIn: EasingFunction; 154 | static easeOut: EasingFunction; 155 | static easeInOut: EasingFunction; 156 | } 157 | 158 | static Elastic: { 159 | static easeIn: EasingFunction; 160 | static easeOut: EasingFunction; 161 | static easeInOut: EasingFunction; 162 | } 163 | 164 | static Back: { 165 | static easeIn: EasingFunction; 166 | static easeOut: EasingFunction; 167 | static easeInOut: EasingFunction; 168 | } 169 | 170 | static Bounce: { 171 | static easeIn: EasingFunction; 172 | static easeOut: EasingFunction; 173 | static easeInOut: EasingFunction; 174 | } 175 | } 176 | } -------------------------------------------------------------------------------- /whevent.d.ts: -------------------------------------------------------------------------------- 1 | declare module whevent { 2 | export var debugMode: boolean; 3 | 4 | export var logger: function; 5 | 6 | export var lastEvent: any; 7 | 8 | /** 9 | * Bind a signal with given function 10 | * @param signal Signal 11 | * @param func Function 12 | * @param self This boject 13 | */ 14 | @deprecated 15 | export function bind(signal: string, func: function, self?: any); 16 | 17 | /** 18 | * Bind a signal with given function 19 | * @param signal Signal 20 | * @param func Function 21 | * @param self This boject 22 | */ 23 | export function on(signal: string, func: function, self?: any); 24 | 25 | /** 26 | * Bind a signal with given function, once the signal is broadcasted, that function always get called first. 27 | * @param signal Signal 28 | * @param func Function 29 | * @param self This boject 30 | */ 31 | @deprecated 32 | export function bindPriority(signal: string, func: function, self?: any); 33 | /** 34 | * Bind a signal with given function, once the signal is broadcasted, that function always get called first. 35 | * @param signal Signal 36 | * @param func Function 37 | * @param self This boject 38 | */ 39 | export function onPriority(signal: string, func: function, self?: any); 40 | 41 | /** 42 | * Bind a signal with given function, once the signal is broadcasted, the binding between this signal and this function will be destroyed. 43 | * @param signal Signal 44 | * @param func Function 45 | * @param self This boject 46 | */ 47 | @deprecated 48 | export function bindOnce(signal: string, func: function, self?: any); 49 | /** 50 | * Bind a signal with given function, once the signal is broadcasted, the binding between this signal and this function will be destroyed. 51 | * @param signal Signal 52 | * @param func Function 53 | * @param self This boject 54 | */ 55 | export function onOnce(signal: string, func: function, self?: any); 56 | 57 | /** 58 | * Bind a signal with given function, once the signal is broadcasted, that function always get called first, after that the binding between this signal and this function will be destroyed. 59 | * @param signal Signal 60 | * @param func Function 61 | * @param self This boject 62 | */ 63 | @deprecated 64 | 65 | export function bindOncePriority(signal: string, func: function, self?: any); 66 | /** 67 | * Bind a signal with given function, once the signal is broadcasted, that function always get called first, after that the binding between this signal and this function will be destroyed. 68 | * @param signal Signal 69 | * @param func Function 70 | * @param self This boject 71 | */ 72 | export function onOncePriority(signal: string, func: function, self?: any); 73 | 74 | /** 75 | * Destroy the binding between given signal and function. 76 | * @param signal Signal 77 | * @param func Function 78 | * @param self This boject 79 | */ 80 | @deprecated 81 | export function unbind(signal: string, func: function, self?: any); 82 | 83 | /** 84 | * Destroy the binding between given signal and function. 85 | * @param signal Signal 86 | * @param func Function 87 | * @param self This boject 88 | */ 89 | export function off(signal: string, func: function, self?: any); 90 | 91 | /** 92 | * Destroy a signal, all bindings with this signal will be destroyed. 93 | * @param signal Signal 94 | */ 95 | export function destroy(signal: string); 96 | 97 | /** 98 | * Broadcast a signal, triggers all binded functions. 99 | * @param signal Signal 100 | */ 101 | @deprecated 102 | export function call(signal: string, data?: any); 103 | 104 | /** 105 | * Broadcast a signal, triggers all binded functions. 106 | * @param signal Signal 107 | */ 108 | export function emit(signal: string, data?: any); 109 | } 110 | --------------------------------------------------------------------------------