├── .gitignore ├── README.md ├── assets ├── audio.meta ├── audio │ ├── countdown_1.mp3 │ ├── countdown_1.mp3.meta │ ├── countdown_10.mp3 │ ├── countdown_10.mp3.meta │ ├── countdown_2.mp3 │ ├── countdown_2.mp3.meta │ ├── fail.wav │ ├── fail.wav.meta │ ├── success.wav │ └── success.wav.meta ├── font.meta ├── font │ ├── mikado_outline_shadow.fnt │ ├── mikado_outline_shadow.fnt.meta │ ├── mikado_outline_shadow.png │ └── mikado_outline_shadow.png.meta ├── scene.meta ├── scene │ ├── Game.fire │ ├── Game.fire.meta │ ├── Result.fire │ └── Result.fire.meta ├── scripts.meta ├── scripts │ ├── Game.ts │ ├── Game.ts.meta │ ├── Qa.ts │ ├── Qa.ts.meta │ ├── mock.ts │ └── mock.ts.meta ├── textures.meta └── textures │ ├── brn_blue_item.png │ ├── brn_blue_item.png.meta │ ├── brn_blue_item_pressed.png.png │ ├── brn_blue_item_pressed.png.png.meta │ ├── btn_blue.png │ ├── btn_blue.png.meta │ ├── btn_green.png │ ├── btn_green.png.meta │ ├── btn_green_ round_pressed.png │ ├── btn_green_ round_pressed.png.meta │ ├── btn_green_round.png │ ├── btn_green_round.png.meta │ ├── btn_grey.png │ ├── btn_grey.png.meta │ ├── img_bg_1.png │ ├── img_bg_1.png.meta │ ├── ui_item_bg.png │ ├── ui_item_bg.png.meta │ ├── ui_item_bg_1.png │ ├── ui_item_bg_1.png.meta │ ├── ui_progress.png │ ├── ui_progress.png.meta │ ├── ui_progress_bar.png │ └── ui_progress_bar.png.meta ├── build ├── web-mobile │ ├── cocos2d-js-min.js │ ├── index.html │ ├── main.js │ ├── res │ │ ├── import │ │ │ ├── 0b │ │ │ │ └── 0b04dfdf3.json │ │ │ └── 0d │ │ │ │ └── 0df4bb847.json │ │ ├── raw-assets │ │ │ ├── audio │ │ │ │ ├── countdown_1.mp3 │ │ │ │ ├── countdown_2.mp3 │ │ │ │ ├── fail.wav │ │ │ │ └── success.wav │ │ │ ├── font │ │ │ │ └── mikado_outline_shadow.png │ │ │ └── textures │ │ │ │ ├── btn_blue.png │ │ │ │ ├── btn_green.png │ │ │ │ ├── btn_grey.png │ │ │ │ ├── img_bg_1.png │ │ │ │ ├── ui_progress.png │ │ │ │ └── ui_progress_bar.png │ │ └── raw-internal │ │ │ └── image │ │ │ ├── default_btn_disabled.png │ │ │ ├── default_btn_normal.png │ │ │ ├── default_btn_pressed.png │ │ │ └── default_panel.png │ ├── splash.png │ ├── src │ │ ├── project.js │ │ └── settings.js │ ├── style-desktop.css │ └── style-mobile.css └── wechatgame │ ├── cocos2d-js-min.js │ ├── game.js │ ├── game.json │ ├── libs │ ├── weapp-adapter │ │ ├── Audio.js │ │ ├── Canvas.js │ │ ├── Element.js │ │ ├── Event.js │ │ ├── EventIniter │ │ │ ├── MouseEvent.js │ │ │ ├── TouchEvent.js │ │ │ └── index.js │ │ ├── EventTarget.js │ │ ├── FileReader.js │ │ ├── HTMLAudioElement.js │ │ ├── HTMLCanvasElement.js │ │ ├── HTMLElement.js │ │ ├── HTMLImageElement.js │ │ ├── HTMLMediaElement.js │ │ ├── HTMLVideoElement.js │ │ ├── Image.js │ │ ├── ImageBitmap.js │ │ ├── Node.js │ │ ├── WebGLRenderingContext.js │ │ ├── WebSocket.js │ │ ├── WindowProperties.js │ │ ├── Worker.js │ │ ├── XMLHttpRequest.js │ │ ├── document.js │ │ ├── engine │ │ │ ├── DeviceMotionEvent.js │ │ │ ├── downloader.js │ │ │ └── index.js │ │ ├── index.js │ │ ├── localStorage.js │ │ ├── location.js │ │ ├── navigator.js │ │ ├── util │ │ │ └── index.js │ │ └── window.js │ ├── wx-downloader.js │ └── xmldom │ │ ├── dom-parser.js │ │ ├── dom.js │ │ ├── entities.js │ │ └── sax.js │ ├── main.js │ ├── project.config.json │ ├── res │ ├── import │ │ ├── 0b │ │ │ └── 0b04dfdf3.json │ │ └── 0d │ │ │ └── 0df4bb847.json │ ├── raw-assets │ │ ├── audio │ │ │ ├── countdown_1.mp3 │ │ │ ├── countdown_2.mp3 │ │ │ ├── fail.wav │ │ │ └── success.wav │ │ ├── font │ │ │ └── mikado_outline_shadow.png │ │ └── textures │ │ │ ├── btn_blue.png │ │ │ ├── btn_green.png │ │ │ ├── btn_grey.png │ │ │ ├── img_bg_1.png │ │ │ ├── ui_progress.png │ │ │ └── ui_progress_bar.png │ └── raw-internal │ │ └── image │ │ ├── default_btn_disabled.png │ │ ├── default_btn_normal.png │ │ ├── default_btn_pressed.png │ │ └── default_panel.png │ └── src │ ├── project.js │ └── settings.js ├── creator.d.ts ├── jsconfig.json ├── project.json └── settings ├── builder.json └── project.json /.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/ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # brainstorming 2 | cocos creator 答题小游戏 3 | 4 | 学习 + 练习 5 | 6 | demo https://geekgray.github.io/brainstorming/build/web-mobile/ 7 | -------------------------------------------------------------------------------- /assets/audio.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "d8fa9a25-89c5-47b5-a22d-7467f95dbd69", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/audio/countdown_1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/audio/countdown_1.mp3 -------------------------------------------------------------------------------- /assets/audio/countdown_1.mp3.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "998cb273-67bb-4491-bdd5-a4ef868f5166", 4 | "downloadMode": 0, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/audio/countdown_10.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/audio/countdown_10.mp3 -------------------------------------------------------------------------------- /assets/audio/countdown_10.mp3.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "73db5782-fdfe-4912-a7b6-e6751c5b009e", 4 | "downloadMode": 0, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/audio/countdown_2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/audio/countdown_2.mp3 -------------------------------------------------------------------------------- /assets/audio/countdown_2.mp3.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "4415a859-c971-412a-a48e-832ea5e13538", 4 | "downloadMode": 0, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/audio/fail.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/audio/fail.wav -------------------------------------------------------------------------------- /assets/audio/fail.wav.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "424ff60d-f4b8-42b1-8256-2066b21dd791", 4 | "downloadMode": 0, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/audio/success.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/audio/success.wav -------------------------------------------------------------------------------- /assets/audio/success.wav.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "21dc6e6a-f42f-43bd-9255-153fd4df4590", 4 | "downloadMode": 0, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/font.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "8b70d81d-cddf-4f89-80ed-b2a29b681be6", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/font/mikado_outline_shadow.fnt: -------------------------------------------------------------------------------- 1 | info face="Mikado" size=36 bold=1 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=2,2 2 | common lineHeight=49 base=36 scaleW=512 scaleH=256 pages=1 packed=0 3 | page id=0 file="mikado_outline_shadow.png" 4 | chars count=95 5 | char id=32 x=294 y=208 width=0 height=0 xoffset=0 yoffset=40 xadvance=7 page=0 chnl=0 letter="space" 6 | char id=33 x=460 y=132 width=18 height=37 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=0 letter="!" 7 | char id=34 x=131 y=208 width=23 height=22 xoffset=0 yoffset=3 xadvance=15 page=0 chnl=0 letter=""" 8 | char id=35 x=68 y=132 width=31 height=37 xoffset=-0 yoffset=3 xadvance=22 page=0 chnl=0 letter="#" 9 | char id=36 x=122 y=2 width=30 height=44 xoffset=0 yoffset=-1 xadvance=21 page=0 chnl=0 letter="$" 10 | char id=37 x=128 y=51 width=39 height=38 xoffset=-0 yoffset=3 xadvance=30 page=0 chnl=0 letter="%" 11 | char id=38 x=242 y=51 width=33 height=38 xoffset=1 yoffset=3 xadvance=25 page=0 chnl=0 letter="&" 12 | char id=39 x=156 y=208 width=15 height=22 xoffset=0 yoffset=3 xadvance=7 page=0 chnl=0 letter="'" 13 | char id=40 x=251 y=2 width=23 height=42 xoffset=0 yoffset=3 xadvance=14 page=0 chnl=0 letter="(" 14 | char id=41 x=276 y=2 width=23 height=42 xoffset=-1 yoffset=3 xadvance=14 page=0 chnl=0 letter=")" 15 | char id=42 x=50 y=208 width=23 height=24 xoffset=0 yoffset=1 xadvance=15 page=0 chnl=0 letter="*" 16 | char id=43 x=232 y=171 width=28 height=30 xoffset=-0 yoffset=9 xadvance=19 page=0 chnl=0 letter="+" 17 | char id=44 x=30 y=208 width=18 height=26 xoffset=0 yoffset=21 xadvance=10 page=0 chnl=0 letter="," 18 | char id=45 x=246 y=208 width=22 height=16 xoffset=1 yoffset=16 xadvance=14 page=0 chnl=0 letter="-" 19 | char id=46 x=196 y=208 width=18 height=19 xoffset=0 yoffset=22 xadvance=10 page=0 chnl=0 letter="." 20 | char id=47 x=223 y=2 width=26 height=42 xoffset=-0 yoffset=1 xadvance=17 page=0 chnl=0 letter="/" 21 | char id=48 x=134 y=92 width=30 height=38 xoffset=0 yoffset=3 xadvance=22 page=0 chnl=0 letter="0" 22 | char id=49 x=435 y=132 width=23 height=37 xoffset=-1 yoffset=3 xadvance=15 page=0 chnl=0 letter="1" 23 | char id=50 x=349 y=132 width=27 height=37 xoffset=-0 yoffset=3 xadvance=19 page=0 chnl=0 letter="2" 24 | char id=51 x=351 y=92 width=28 height=38 xoffset=-0 yoffset=2 xadvance=19 page=0 chnl=0 letter="3" 25 | char id=52 x=35 y=132 width=31 height=37 xoffset=-1 yoffset=3 xadvance=21 page=0 chnl=0 letter="4" 26 | char id=53 x=321 y=92 width=28 height=38 xoffset=-0 yoffset=2 xadvance=19 page=0 chnl=0 letter="5" 27 | char id=54 x=259 y=92 width=29 height=38 xoffset=0 yoffset=2 xadvance=20 page=0 chnl=0 letter="6" 28 | char id=55 x=378 y=132 width=27 height=37 xoffset=-0 yoffset=3 xadvance=17 page=0 chnl=0 letter="7" 29 | char id=56 x=228 y=92 width=29 height=38 xoffset=0 yoffset=3 xadvance=21 page=0 chnl=0 letter="8" 30 | char id=57 x=290 y=92 width=29 height=38 xoffset=-0 yoffset=2 xadvance=20 page=0 chnl=0 letter="9" 31 | char id=58 x=456 y=171 width=18 height=30 xoffset=0 yoffset=11 xadvance=10 page=0 chnl=0 letter=":" 32 | char id=59 x=480 y=132 width=18 height=37 xoffset=1 yoffset=10 xadvance=11 page=0 chnl=0 letter=";" 33 | char id=60 x=2 y=208 width=26 height=27 xoffset=-0 yoffset=10 xadvance=17 page=0 chnl=0 letter="<" 34 | char id=61 x=103 y=208 width=26 height=22 xoffset=1 yoffset=13 xadvance=19 page=0 chnl=0 letter="=" 35 | char id=62 x=476 y=171 width=26 height=28 xoffset=0 yoffset=11 xadvance=18 page=0 chnl=0 letter=">" 36 | char id=63 x=381 y=92 width=25 height=38 xoffset=-0 yoffset=2 xadvance=17 page=0 chnl=0 letter="?" 37 | char id=64 x=17 y=2 width=44 height=46 xoffset=0 yoffset=3 xadvance=36 page=0 chnl=0 letter="@" 38 | char id=65 x=427 y=92 width=35 height=37 xoffset=-0 yoffset=3 xadvance=26 page=0 chnl=0 letter="A" 39 | char id=66 x=101 y=132 width=30 height=37 xoffset=1 yoffset=3 xadvance=23 page=0 chnl=0 letter="B" 40 | char id=67 x=2 y=92 width=32 height=38 xoffset=0 yoffset=3 xadvance=23 page=0 chnl=0 letter="C" 41 | char id=68 x=464 y=92 width=32 height=37 xoffset=1 yoffset=3 xadvance=25 page=0 chnl=0 letter="D" 42 | char id=69 x=260 y=132 width=28 height=37 xoffset=1 yoffset=3 xadvance=21 page=0 chnl=0 letter="E" 43 | char id=70 x=290 y=132 width=28 height=37 xoffset=1 yoffset=3 xadvance=21 page=0 chnl=0 letter="F" 44 | char id=71 x=312 y=51 width=33 height=38 xoffset=0 yoffset=3 xadvance=25 page=0 chnl=0 letter="G" 45 | char id=72 x=277 y=51 width=33 height=38 xoffset=1 yoffset=3 xadvance=27 page=0 chnl=0 letter="H" 46 | char id=73 x=408 y=92 width=17 height=38 xoffset=1 yoffset=3 xadvance=11 page=0 chnl=0 letter="I" 47 | char id=74 x=407 y=132 width=26 height=37 xoffset=-1 yoffset=3 xadvance=17 page=0 chnl=0 letter="J" 48 | char id=75 x=36 y=92 width=32 height=38 xoffset=1 yoffset=3 xadvance=24 page=0 chnl=0 letter="K" 49 | char id=76 x=320 y=132 width=27 height=37 xoffset=1 yoffset=3 xadvance=19 page=0 chnl=0 letter="L" 50 | char id=77 x=85 y=51 width=41 height=38 xoffset=-0 yoffset=3 xadvance=32 page=0 chnl=0 letter="M" 51 | char id=78 x=417 y=51 width=33 height=38 xoffset=1 yoffset=3 xadvance=27 page=0 chnl=0 letter="N" 52 | char id=79 x=169 y=51 width=35 height=38 xoffset=0 yoffset=3 xadvance=27 page=0 chnl=0 letter="O" 53 | char id=80 x=165 y=132 width=30 height=37 xoffset=1 yoffset=3 xadvance=23 page=0 chnl=0 letter="P" 54 | char id=81 x=85 y=2 width=35 height=45 xoffset=0 yoffset=3 xadvance=27 page=0 chnl=0 letter="Q" 55 | char id=82 x=2 y=132 width=31 height=37 xoffset=1 yoffset=4 xadvance=24 page=0 chnl=0 letter="R" 56 | char id=83 x=197 y=132 width=30 height=37 xoffset=-0 yoffset=3 xadvance=21 page=0 chnl=0 letter="S" 57 | char id=84 x=133 y=132 width=30 height=37 xoffset=-1 yoffset=3 xadvance=21 page=0 chnl=0 letter="T" 58 | char id=85 x=452 y=51 width=32 height=38 xoffset=1 yoffset=3 xadvance=26 page=0 chnl=0 letter="U" 59 | char id=86 x=206 y=51 width=34 height=38 xoffset=-1 yoffset=2 xadvance=24 page=0 chnl=0 letter="V" 60 | char id=87 x=40 y=51 width=43 height=38 xoffset=-0 yoffset=3 xadvance=34 page=0 chnl=0 letter="W" 61 | char id=88 x=382 y=51 width=33 height=38 xoffset=-1 yoffset=3 xadvance=23 page=0 chnl=0 letter="X" 62 | char id=89 x=347 y=51 width=33 height=38 xoffset=-1 yoffset=3 xadvance=23 page=0 chnl=0 letter="Y" 63 | char id=90 x=229 y=132 width=29 height=37 xoffset=0 yoffset=3 xadvance=21 page=0 chnl=0 letter="Z" 64 | char id=91 x=200 y=2 width=21 height=43 xoffset=1 yoffset=3 xadvance=13 page=0 chnl=0 letter="[" 65 | char id=92 x=387 y=2 width=25 height=40 xoffset=-0 yoffset=1 xadvance=16 page=0 chnl=0 letter="\" 66 | char id=93 x=301 y=2 width=21 height=42 xoffset=-0 yoffset=3 xadvance=13 page=0 chnl=0 letter="]" 67 | char id=94 x=75 y=208 width=26 height=23 xoffset=-0 yoffset=2 xadvance=17 page=0 chnl=0 letter="^" 68 | char id=95 x=270 y=208 width=22 height=15 xoffset=1 yoffset=30 xadvance=15 page=0 chnl=0 letter="_" 69 | char id=96 x=173 y=208 width=21 height=19 xoffset=1 yoffset=2 xadvance=14 page=0 chnl=0 letter="`" 70 | char id=97 x=321 y=171 width=26 height=30 xoffset=-0 yoffset=10 xadvance=18 page=0 chnl=0 letter="a" 71 | char id=98 x=324 y=2 width=30 height=40 xoffset=-0 yoffset=1 xadvance=21 page=0 chnl=0 letter="b" 72 | char id=99 x=349 y=171 width=26 height=30 xoffset=-0 yoffset=11 xadvance=17 page=0 chnl=0 letter="c" 73 | char id=100 x=414 y=2 width=30 height=39 xoffset=0 yoffset=2 xadvance=22 page=0 chnl=0 letter="d" 74 | char id=101 x=292 y=171 width=27 height=30 xoffset=-0 yoffset=10 xadvance=18 page=0 chnl=0 letter="e" 75 | char id=102 x=476 y=2 width=26 height=39 xoffset=-1 yoffset=2 xadvance=15 page=0 chnl=0 letter="f" 76 | char id=103 x=102 y=92 width=30 height=38 xoffset=0 yoffset=10 xadvance=22 page=0 chnl=0 letter="g" 77 | char id=104 x=446 y=2 width=28 height=39 xoffset=1 yoffset=1 xadvance=21 page=0 chnl=0 letter="h" 78 | char id=105 x=2 y=51 width=17 height=39 xoffset=1 yoffset=1 xadvance=10 page=0 chnl=0 letter="i" 79 | char id=106 x=63 y=2 width=20 height=46 xoffset=-2 yoffset=2 xadvance=10 page=0 chnl=0 letter="j" 80 | char id=107 x=356 y=2 width=29 height=40 xoffset=0 yoffset=1 xadvance=20 page=0 chnl=0 letter="k" 81 | char id=108 x=21 y=51 width=17 height=39 xoffset=1 yoffset=1 xadvance=9 page=0 chnl=0 letter="l" 82 | char id=109 x=68 y=171 width=38 height=30 xoffset=1 yoffset=10 xadvance=31 page=0 chnl=0 letter="m" 83 | char id=110 x=202 y=171 width=28 height=30 xoffset=1 yoffset=10 xadvance=21 page=0 chnl=0 letter="n" 84 | char id=111 x=171 y=171 width=29 height=30 xoffset=-0 yoffset=10 xadvance=20 page=0 chnl=0 letter="o" 85 | char id=112 x=70 y=92 width=30 height=38 xoffset=1 yoffset=10 xadvance=22 page=0 chnl=0 letter="p" 86 | char id=113 x=197 y=92 width=29 height=38 xoffset=0 yoffset=11 xadvance=21 page=0 chnl=0 letter="q" 87 | char id=114 x=431 y=171 width=23 height=30 xoffset=1 yoffset=10 xadvance=14 page=0 chnl=0 letter="r" 88 | char id=115 x=377 y=171 width=25 height=30 xoffset=-0 yoffset=11 xadvance=16 page=0 chnl=0 letter="s" 89 | char id=116 x=2 y=171 width=24 height=35 xoffset=-0 yoffset=6 xadvance=15 page=0 chnl=0 letter="t" 90 | char id=117 x=262 y=171 width=28 height=30 xoffset=1 yoffset=11 xadvance=21 page=0 chnl=0 letter="u" 91 | char id=118 x=108 y=171 width=30 height=30 xoffset=-0 yoffset=11 xadvance=20 page=0 chnl=0 letter="v" 92 | char id=119 x=28 y=171 width=38 height=30 xoffset=-0 yoffset=11 xadvance=29 page=0 chnl=0 letter="w" 93 | char id=120 x=140 y=171 width=29 height=30 xoffset=-1 yoffset=11 xadvance=19 page=0 chnl=0 letter="x" 94 | char id=121 x=166 y=92 width=29 height=38 xoffset=-1 yoffset=10 xadvance=19 page=0 chnl=0 letter="y" 95 | char id=122 x=404 y=171 width=25 height=30 xoffset=-0 yoffset=10 xadvance=16 page=0 chnl=0 letter="z" 96 | char id=123 x=154 y=2 width=21 height=43 xoffset=-1 yoffset=3 xadvance=12 page=0 chnl=0 letter="{" 97 | char id=124 x=2 y=2 width=13 height=47 xoffset=1 yoffset=1 xadvance=7 page=0 chnl=0 letter="|" 98 | char id=125 x=177 y=2 width=21 height=43 xoffset=-0 yoffset=3 xadvance=12 page=0 chnl=0 letter="}" 99 | char id=126 x=216 y=208 width=28 height=18 xoffset=0 yoffset=14 xadvance=20 page=0 chnl=0 letter="~" 100 | -------------------------------------------------------------------------------- /assets/font/mikado_outline_shadow.fnt.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.1.0", 3 | "uuid": "b7286687-a863-4d94-9e75-8c940716fec3", 4 | "textureUuid": "a8344109-4f95-418c-a56d-e87621246bee", 5 | "fontSize": 36, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/font/mikado_outline_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/font/mikado_outline_shadow.png -------------------------------------------------------------------------------- /assets/font/mikado_outline_shadow.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "a8344109-4f95-418c-a56d-e87621246bee", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "mikado_outline_shadow": { 9 | "ver": "1.0.3", 10 | "uuid": "e794ecb5-7eef-42df-a0ea-1483023b909a", 11 | "rawTextureUuid": "a8344109-4f95-418c-a56d-e87621246bee", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -4.5, 16 | "offsetY": 9, 17 | "trimX": 3, 18 | "trimY": 3, 19 | "width": 497, 20 | "height": 232, 21 | "rawWidth": 512, 22 | "rawHeight": 256, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/scene.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "312d1bd9-fc80-4b57-a01a-169136514607", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/scene/Game.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "7d888499-a4e9-4979-aa9c-798af56a4ad6", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scene/Result.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_rawFiles": null, 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 | "_tag": -1, 21 | "_active": true, 22 | "_components": [], 23 | "_prefab": null, 24 | "_id": "87636fc8-3c19-488a-a3aa-c785a8e2e330", 25 | "_opacity": 255, 26 | "_color": { 27 | "__type__": "cc.Color", 28 | "r": 255, 29 | "g": 255, 30 | "b": 255, 31 | "a": 255 32 | }, 33 | "_cascadeOpacityEnabled": true, 34 | "_anchorPoint": { 35 | "__type__": "cc.Vec2", 36 | "x": 0, 37 | "y": 0 38 | }, 39 | "_contentSize": { 40 | "__type__": "cc.Size", 41 | "width": 0, 42 | "height": 0 43 | }, 44 | "_localZOrder": 0, 45 | "_globalZOrder": 0, 46 | "_opacityModifyRGB": false, 47 | "groupIndex": 0, 48 | "autoReleaseAssets": false 49 | }, 50 | { 51 | "__type__": "cc.Node", 52 | "_name": "Canvas", 53 | "_objFlags": 0, 54 | "_parent": { 55 | "__id__": 1 56 | }, 57 | "_children": [ 58 | { 59 | "__id__": 3 60 | } 61 | ], 62 | "_tag": -1, 63 | "_active": true, 64 | "_components": [ 65 | { 66 | "__id__": 10 67 | } 68 | ], 69 | "_prefab": null, 70 | "_id": "4czp2X1QVAGJqIIoFeZFwu", 71 | "_opacity": 255, 72 | "_color": { 73 | "__type__": "cc.Color", 74 | "r": 255, 75 | "g": 255, 76 | "b": 255, 77 | "a": 255 78 | }, 79 | "_cascadeOpacityEnabled": true, 80 | "_anchorPoint": { 81 | "__type__": "cc.Vec2", 82 | "x": 0.5, 83 | "y": 0.5 84 | }, 85 | "_contentSize": { 86 | "__type__": "cc.Size", 87 | "width": 750, 88 | "height": 1334 89 | }, 90 | "_rotationX": 0, 91 | "_rotationY": 0, 92 | "_scaleX": 1, 93 | "_scaleY": 1, 94 | "_position": { 95 | "__type__": "cc.Vec2", 96 | "x": 375, 97 | "y": 667 98 | }, 99 | "_skewX": 0, 100 | "_skewY": 0, 101 | "_localZOrder": 0, 102 | "_globalZOrder": 0, 103 | "_opacityModifyRGB": false, 104 | "groupIndex": 0 105 | }, 106 | { 107 | "__type__": "cc.Node", 108 | "_name": "Layout", 109 | "_objFlags": 0, 110 | "_parent": { 111 | "__id__": 2 112 | }, 113 | "_children": [ 114 | { 115 | "__id__": 4 116 | } 117 | ], 118 | "_tag": -1, 119 | "_active": true, 120 | "_components": [ 121 | { 122 | "__id__": 7 123 | }, 124 | { 125 | "__id__": 8 126 | }, 127 | { 128 | "__id__": 9 129 | } 130 | ], 131 | "_prefab": null, 132 | "_id": "8fVwH2SWRN2IrpbaGK9zRd", 133 | "_opacity": 255, 134 | "_color": { 135 | "__type__": "cc.Color", 136 | "r": 40, 137 | "g": 78, 138 | "b": 119, 139 | "a": 255 140 | }, 141 | "_cascadeOpacityEnabled": true, 142 | "_anchorPoint": { 143 | "__type__": "cc.Vec2", 144 | "x": 0.5, 145 | "y": 0.5 146 | }, 147 | "_contentSize": { 148 | "__type__": "cc.Size", 149 | "width": 707.5471698113207, 150 | "height": 1258.4905660377358 151 | }, 152 | "_rotationX": 0, 153 | "_rotationY": 0, 154 | "_scaleX": 1.06, 155 | "_scaleY": 1.06, 156 | "_position": { 157 | "__type__": "cc.Vec2", 158 | "x": 0, 159 | "y": 0 160 | }, 161 | "_skewX": 0, 162 | "_skewY": 0, 163 | "_localZOrder": 0, 164 | "_globalZOrder": 0, 165 | "_opacityModifyRGB": false, 166 | "groupIndex": 0 167 | }, 168 | { 169 | "__type__": "cc.Node", 170 | "_name": "background", 171 | "_objFlags": 0, 172 | "_parent": { 173 | "__id__": 3 174 | }, 175 | "_children": [], 176 | "_tag": -1, 177 | "_active": true, 178 | "_components": [ 179 | { 180 | "__id__": 5 181 | }, 182 | { 183 | "__id__": 6 184 | } 185 | ], 186 | "_prefab": null, 187 | "_id": "7fRVFktM1KV5+iZ49n7+H3", 188 | "_opacity": 180, 189 | "_color": { 190 | "__type__": "cc.Color", 191 | "r": 255, 192 | "g": 255, 193 | "b": 255, 194 | "a": 255 195 | }, 196 | "_cascadeOpacityEnabled": true, 197 | "_anchorPoint": { 198 | "__type__": "cc.Vec2", 199 | "x": 0.5, 200 | "y": 0.5 201 | }, 202 | "_contentSize": { 203 | "__type__": "cc.Size", 204 | "width": 707.5471698113207, 205 | "height": 1258.4905660377358 206 | }, 207 | "_rotationX": 0, 208 | "_rotationY": 0, 209 | "_scaleX": 1, 210 | "_scaleY": 1, 211 | "_position": { 212 | "__type__": "cc.Vec2", 213 | "x": 0, 214 | "y": 0 215 | }, 216 | "_skewX": 0, 217 | "_skewY": 0, 218 | "_localZOrder": 0, 219 | "_globalZOrder": 0, 220 | "_opacityModifyRGB": false, 221 | "groupIndex": 0 222 | }, 223 | { 224 | "__type__": "cc.Sprite", 225 | "_name": "", 226 | "_objFlags": 0, 227 | "node": { 228 | "__id__": 4 229 | }, 230 | "_enabled": true, 231 | "_spriteFrame": { 232 | "__uuid__": "974c888b-b6d9-4ff3-bb2e-a0631eea9fca" 233 | }, 234 | "_type": 0, 235 | "_sizeMode": 0, 236 | "_fillType": 0, 237 | "_fillCenter": { 238 | "__type__": "cc.Vec2", 239 | "x": 0, 240 | "y": 0 241 | }, 242 | "_fillStart": 0, 243 | "_fillRange": 0, 244 | "_isTrimmedMode": true, 245 | "_srcBlendFactor": 770, 246 | "_dstBlendFactor": 771, 247 | "_atlas": null 248 | }, 249 | { 250 | "__type__": "cc.Widget", 251 | "_name": "", 252 | "_objFlags": 0, 253 | "node": { 254 | "__id__": 4 255 | }, 256 | "_enabled": true, 257 | "isAlignOnce": true, 258 | "_target": null, 259 | "_alignFlags": 45, 260 | "_left": 0, 261 | "_right": 0, 262 | "_top": 0, 263 | "_bottom": 0, 264 | "_verticalCenter": 0, 265 | "_horizontalCenter": 0, 266 | "_isAbsLeft": true, 267 | "_isAbsRight": true, 268 | "_isAbsTop": true, 269 | "_isAbsBottom": true, 270 | "_isAbsHorizontalCenter": true, 271 | "_isAbsVerticalCenter": true, 272 | "_originalWidth": 652, 273 | "_originalHeight": 1203 274 | }, 275 | { 276 | "__type__": "cc.Sprite", 277 | "_name": "", 278 | "_objFlags": 0, 279 | "node": { 280 | "__id__": 3 281 | }, 282 | "_enabled": true, 283 | "_spriteFrame": { 284 | "__uuid__": "9bbda31e-ad49-43c9-aaf2-f7d9896bac69" 285 | }, 286 | "_type": 1, 287 | "_sizeMode": 0, 288 | "_fillType": 0, 289 | "_fillCenter": { 290 | "__type__": "cc.Vec2", 291 | "x": 0, 292 | "y": 0 293 | }, 294 | "_fillStart": 0, 295 | "_fillRange": 0, 296 | "_isTrimmedMode": false, 297 | "_srcBlendFactor": 770, 298 | "_dstBlendFactor": 771, 299 | "_atlas": null 300 | }, 301 | { 302 | "__type__": "cc.Layout", 303 | "_name": "", 304 | "_objFlags": 0, 305 | "node": { 306 | "__id__": 3 307 | }, 308 | "_enabled": true, 309 | "_layoutSize": { 310 | "__type__": "cc.Size", 311 | "width": 707.5471698113207, 312 | "height": 1258.4905660377358 313 | }, 314 | "_resize": 0, 315 | "_N$layoutType": 0, 316 | "_N$padding": 0, 317 | "_N$cellSize": { 318 | "__type__": "cc.Size", 319 | "width": 40, 320 | "height": 40 321 | }, 322 | "_N$startAxis": 0, 323 | "_N$paddingLeft": 0, 324 | "_N$paddingRight": 0, 325 | "_N$paddingTop": 0, 326 | "_N$paddingBottom": 0, 327 | "_N$spacingX": 0, 328 | "_N$spacingY": 0, 329 | "_N$verticalDirection": 1, 330 | "_N$horizontalDirection": 0 331 | }, 332 | { 333 | "__type__": "cc.Widget", 334 | "_name": "", 335 | "_objFlags": 0, 336 | "node": { 337 | "__id__": 3 338 | }, 339 | "_enabled": true, 340 | "isAlignOnce": true, 341 | "_target": null, 342 | "_alignFlags": 45, 343 | "_left": 0, 344 | "_right": 0, 345 | "_top": 0, 346 | "_bottom": 0, 347 | "_verticalCenter": 0, 348 | "_horizontalCenter": 0, 349 | "_isAbsLeft": true, 350 | "_isAbsRight": true, 351 | "_isAbsTop": true, 352 | "_isAbsBottom": true, 353 | "_isAbsHorizontalCenter": true, 354 | "_isAbsVerticalCenter": true, 355 | "_originalWidth": 200, 356 | "_originalHeight": 150 357 | }, 358 | { 359 | "__type__": "cc.Canvas", 360 | "_name": "", 361 | "_objFlags": 0, 362 | "node": { 363 | "__id__": 2 364 | }, 365 | "_enabled": true, 366 | "_designResolution": { 367 | "__type__": "cc.Size", 368 | "width": 750, 369 | "height": 1334 370 | }, 371 | "_fitWidth": false, 372 | "_fitHeight": true 373 | } 374 | ] -------------------------------------------------------------------------------- /assets/scene/Result.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "87636fc8-3c19-488a-a3aa-c785a8e2e330", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "324c5534-417a-4a01-9943-e23aa9e8241a", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/scripts/Game.ts: -------------------------------------------------------------------------------- 1 | import data from './mock'; 2 | const { ccclass, property } = cc._decorator; 3 | 4 | @ccclass 5 | export default class Game extends cc.Component { 6 | 7 | @property(cc.Node) 8 | mark: cc.Node = null; // 第 ?题 9 | 10 | @property(cc.Node) 11 | qaNode: cc.Node = null; 12 | 13 | @property(cc.Node) 14 | progressBarNode: cc.Node = null; // 进度条 15 | 16 | @property(cc.Node) 17 | readyCountdownNode: cc.Node = null; // ready go 倒计时 18 | 19 | @property(cc.Node) 20 | btnStart: cc.Node = null; // 开始游戏按钮 21 | 22 | @property(cc.AudioClip) 23 | countdownAudio_1: cc.AudioClip = null; 24 | 25 | @property(cc.AudioClip) 26 | countdownAudio_2: cc.AudioClip = null; 27 | 28 | @property(cc.Integer) 29 | countdownTime: number = 0; // 小题 答题倒计时(s) 30 | 31 | @property(cc.Integer) 32 | questionTotal: number = 0; // 题目数量 33 | 34 | progressBar: cc.ProgressBar = null; 35 | readyCountdown: cc.Label = null; 36 | 37 | currentTime: number = 0; // 小题 答题使用时间(s) 38 | roundSchedule: cc.Scheduler; // 小题 答题计时器 39 | 40 | current: number = 0; // 当前小题 41 | 42 | inProgress: boolean = false; // 是否在进行中 (小题) 43 | 44 | qdata: Array = null; 45 | 46 | onLoad() { 47 | this.init(); 48 | var oReq = new XMLHttpRequest(); 49 | oReq.onload = () => { 50 | const res = JSON.parse(oReq.responseText); 51 | if (res.status == 0) { 52 | this.qdata = new Array(); 53 | res.result.list.every((item, i) => { 54 | if ((item.answer === 'A' || item.answer === 'B' || item.answer === 'C' || item.answer === 'D') && !item.pic) { 55 | // if (item.pic) { 56 | let q = { 57 | id: i, 58 | title: item.question, 59 | right: item.answer, 60 | pic: item.pic, 61 | answer: [ 62 | { 63 | id: 'A', 64 | txt: item.option1 65 | }, 66 | { 67 | id: 'B', 68 | txt: item.option2 69 | }, 70 | { 71 | id: 'C', 72 | txt: item.option3 73 | }, 74 | { 75 | id: 'D', 76 | txt: item.option4 77 | }, 78 | ] 79 | }; 80 | this.qdata.push(q); 81 | if (this.qdata.length >= this.questionTotal) { 82 | return false; 83 | } 84 | } 85 | return true; 86 | }); 87 | console.log(this.qdata); 88 | } 89 | }; 90 | // https://jisujiakao.market.alicloudapi.com 91 | oReq.open('get', 'https://jisujiakao.market.alicloudapi.com/driverexam/query?pagenum=1&pagesize=100&sort=rand&subject=1&type=C1', true); 92 | oReq.setRequestHeader('Authorization', 'APPCODE d1f7d1f2048841eca46b1a56a941554b'); 93 | console.log(oReq.send()); 94 | } 95 | 96 | init(): void { 97 | // init progressBar 98 | this.progressBarNode.active = false; 99 | this.progressBar = this.progressBarNode.getComponent(cc.ProgressBar); 100 | this.progressBar.progress = 1; 101 | // init readyCountdown 102 | this.readyCountdownNode.active = false; 103 | this.readyCountdown = this.readyCountdownNode.getComponent(cc.Label); 104 | // init qa node 105 | this.qaNode.active = false; 106 | this.qaNode.opacity = 0; 107 | // init btnStart 108 | this.btnStart.active = true; 109 | // init current 110 | this.current = 0; 111 | // init mark 112 | this.mark.active = false; 113 | } 114 | 115 | ready(): void { 116 | let startCountingDown: number = 2; 117 | // enable readyCountdown 118 | this.readyCountdownNode.active = true; 119 | this.readyCountdown.string = 'Ready'; 120 | const action = cc.sequence(cc.scaleTo(.2, 1.6), cc.scaleTo(.6, .8)); // 倒计时 action 121 | const actionEnd = cc.sequence(cc.scaleTo(.2, 1.6), cc.callFunc(() => { // 倒计时 GO action 122 | console.log('anim end!'); 123 | setTimeout(() => { 124 | // 记录初始位置 125 | const { x, y } = this.readyCountdownNode.position; 126 | this.readyCountdownNode.runAction(cc.sequence(cc.moveTo(.5, 0, 1000), cc.callFunc(() => { 127 | // 复位 128 | this.readyCountdownNode.active = false; 129 | this.readyCountdownNode.x = x; 130 | this.readyCountdownNode.y = y; 131 | this.readyCountdownNode.scale = 1; 132 | // 激活进度条 133 | this.progressBarNode.active = true; 134 | // 激活问答 135 | this.qaNode.active = true; 136 | // 开始游戏 137 | this.starRound(); 138 | }))); 139 | }, 300) 140 | })); 141 | this.readyCountdownNode.runAction(action); 142 | this.schedule(() => { 143 | // console.log(startCountingDown); 144 | if (startCountingDown <= 0) { 145 | this.readyCountdown.string = 'Go'; 146 | this.readyCountdownNode.runAction(actionEnd); 147 | return; 148 | } 149 | this.readyCountdown.string = startCountingDown.toString(); 150 | this.readyCountdownNode.runAction(action); 151 | startCountingDown -= 1; 152 | }, 1, startCountingDown, 0); 153 | this.scheduleOnce(() => { 154 | cc.audioEngine.play(this.countdownAudio_1 as any, false, 1); 155 | }, 1) 156 | } 157 | 158 | startGame(): void { 159 | this.btnStart.active = false; 160 | this.ready(); 161 | } 162 | 163 | starRound(): void { 164 | if (this.current >= this.qdata.length) { 165 | // cc.director.loadScene("Result"); 166 | this.init(); 167 | this.unschedule(this.updateCountdownTime); 168 | // unbind scedule 169 | return; 170 | } 171 | 172 | this.mark.active = true; 173 | this.mark.getComponent(cc.Label).string = `第 ${this.current + 1} 题` 174 | this.mark.runAction(cc.sequence(cc.scaleTo(.2, 1.2), cc.scaleTo(.2, 1), cc.callFunc(() => { 175 | this.scheduleOnce(() => { 176 | this.mark.active = false; 177 | // realy start 178 | this.qaNode.runAction(cc.fadeIn(.2)); 179 | this.inProgress = true; // 回合开始 180 | this.qaNode.getComponent('Qa').initQa(this.qdata[this.current]); 181 | this.progressBar.progress = 1; 182 | this.schedule(this.updateCountdownTime, 1); 183 | this.current += 1; 184 | }, 1); 185 | }))) 186 | } 187 | 188 | endRound(): void { 189 | this.currentTime = 0; 190 | this.inProgress = false; 191 | const actionOut = cc.sequence(cc.fadeOut(.2), cc.callFunc(() => { 192 | this.qaNode.getComponent('Qa').resetStatus(); 193 | this.scheduleOnce(() => { 194 | this.starRound(); 195 | }, .5) 196 | })) 197 | this.qaNode.runAction(actionOut); 198 | } 199 | 200 | stopSchedule(): void { 201 | this.unschedule(this.updateCountdownTime); 202 | } 203 | 204 | updateCountdownTime(): void { 205 | this.currentTime += 1; 206 | this.progressBar.progress = 1 - this.currentTime / this.countdownTime; 207 | // console.log(this.currentTime); 208 | cc.audioEngine.play(this.countdownAudio_2 as any, false, 1); 209 | if (this.currentTime >= this.countdownTime) { 210 | this.unschedule(this.updateCountdownTime); 211 | this.endRound(); 212 | } 213 | } 214 | } 215 | -------------------------------------------------------------------------------- /assets/scripts/Game.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "3bbc4344-d75c-46c9-96b3-730f3079d990", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/Qa.ts: -------------------------------------------------------------------------------- 1 | const { ccclass, property } = cc._decorator; 2 | 3 | @ccclass 4 | export default class Qa extends cc.Component { 5 | 6 | @property(cc.Node) 7 | questionNode: cc.Node = null; 8 | @property(cc.Node) 9 | btnAnswerNode_1: cc.Node = null; 10 | @property(cc.Node) 11 | btnAnswerNode_2: cc.Node = null; 12 | @property(cc.Node) 13 | btnAnswerNode_3: cc.Node = null; 14 | @property(cc.Node) 15 | btnAnswerNode_4: cc.Node = null; 16 | 17 | @property(cc.Node) 18 | game: cc.Node = null; 19 | 20 | @property(cc.AudioClip) 21 | faildAudio: cc.AudioClip = null; 22 | 23 | @property(cc.AudioClip) 24 | successAudio: cc.AudioClip = null; 25 | 26 | btnAnswerNodeArray: Array = new Array(); 27 | 28 | currentNode: cc.Node = null; // 选择答案的节点 29 | rightNode: cc.Node = null; // 正确答案的节点 30 | 31 | right: number; // 正确答案的id 32 | answer: number; // 选择的id 33 | isAnswer: boolean; // 是否已经回答了 34 | 35 | onLoad(): void { 36 | this.btnAnswerNodeArray = [ 37 | this.btnAnswerNode_1, 38 | this.btnAnswerNode_2, 39 | this.btnAnswerNode_3, 40 | this.btnAnswerNode_4, 41 | ] 42 | } 43 | 44 | answerClick(event, option): void { 45 | if (!this.isAnswer && this.game.getComponent('Game').inProgress) { 46 | this.isAnswer = true; 47 | this.currentNode = this.btnAnswerNodeArray[option]; 48 | // judge 49 | this.answer = Number(option); 50 | if (this.right === Number(option)) { 51 | this.correct(); 52 | return; 53 | } 54 | this.wrong(); 55 | } 56 | } 57 | 58 | initQa(question): void { 59 | // init status 60 | this.isAnswer = false; 61 | // init q & a 62 | this.questionNode.getComponent(cc.Label).string = question.title; 63 | const [A, B, C, D] = question.answer; 64 | this.getChildrenLabel(this.btnAnswerNode_1).string = `${A.txt}`; // A. 65 | this.getChildrenLabel(this.btnAnswerNode_2).string = `${B.txt}`; // B. 66 | this.getChildrenLabel(this.btnAnswerNode_3).string = `${C.txt}`; // C. 67 | this.getChildrenLabel(this.btnAnswerNode_4).string = `${D.txt}`; // D. 68 | // init right 69 | this.right = question.answer.findIndex(item => item.id === question.right); 70 | this.rightNode = this.btnAnswerNodeArray[this.right]; 71 | // init pic 72 | // if (question.pic) { 73 | // this.picNode.active = true; 74 | // this.picNode.getComponent(cc.WebView).url = question.pic; 75 | // } 76 | } 77 | 78 | correct(): void { 79 | this.animStart(); 80 | cc.audioEngine.play(this.successAudio as any, false, 1); 81 | this.currentNode.color = new cc.Color(88, 165, 92); 82 | } 83 | 84 | wrong(): void { 85 | this.animStart(); 86 | cc.audioEngine.play(this.faildAudio as any, false, 1); 87 | this.currentNode.color = new cc.Color(217, 80, 84); 88 | } 89 | 90 | animStart(): void { 91 | const seqAction = cc.sequence(cc.scaleTo(.2, 1.1), cc.callFunc(this.animOver, this)); 92 | this.currentNode.runAction(seqAction); 93 | const isRight = this.right === this.answer; 94 | this.currentNode.getChildByName('Label').color = cc.Color.WHITE; 95 | this.btnAnswerNodeArray.forEach(node => { 96 | if (!isRight && this.rightNode === node) { 97 | // 答错了把正确答案也展示给用户 98 | node.color = new cc.Color(88, 165, 92); 99 | node.getChildByName('Label').color = cc.Color.WHITE; 100 | return; 101 | } 102 | if (this.currentNode !== node) { 103 | node.runAction(cc.scaleTo(.2, 0)); 104 | } 105 | }) 106 | } 107 | 108 | animOver(): void { 109 | this.game.getComponent('Game').stopSchedule(); 110 | this.scheduleOnce(() => { 111 | this.game.getComponent('Game').endRound(); 112 | }, 1) 113 | } 114 | 115 | resetStatus(): void { 116 | if (this.currentNode) { 117 | // 将正确答案缩放重置 118 | this.currentNode.runAction(cc.scaleTo(.2, 1)); 119 | // 将错误答案和正确答案背景颜色重置 120 | this.currentNode.color = cc.Color.WHITE; 121 | this.rightNode.color = cc.Color.WHITE; 122 | // 将lable颜色重置 123 | this.rightNode.getChildByName('Label').color = cc.Color.BLACK; 124 | this.currentNode.getChildByName('Label').color = cc.Color.BLACK; 125 | 126 | this.btnAnswerNodeArray.forEach(node => { 127 | if (this.currentNode !== node) { 128 | node.runAction(cc.scaleTo(.2, 1)); 129 | } 130 | }) 131 | this.currentNode = null; 132 | } 133 | } 134 | 135 | getChildrenLabel(node: cc.Node): cc.Label { 136 | return node.getChildByName('Label').getComponent(cc.Label); 137 | } 138 | 139 | } 140 | -------------------------------------------------------------------------------- /assets/scripts/Qa.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "43a45584-256d-4faf-8cbd-85f2c9417989", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/mock.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | { 3 | id: 111, 4 | title: '小舅子是对妻子什么亲戚的称谓?', 5 | right: 111, 6 | answer: [{ 7 | id: 111, 8 | txt: '弟弟' 9 | }, 10 | { 11 | id: 112, 12 | txt: '奶奶' 13 | }, 14 | { 15 | id: 113, 16 | txt: '侄子' 17 | }, 18 | { 19 | id: 114, 20 | txt: '外甥' 21 | }, 22 | ] 23 | }, 24 | { 25 | id: 112, 26 | title: '“李小鹏挂”是哪个体操项目中的动作?', 27 | right: 114, 28 | answer: [{ 29 | id: 111, 30 | txt: '撑杆跳' 31 | }, 32 | { 33 | id: 112, 34 | txt: '体操' 35 | }, 36 | { 37 | id: 113, 38 | txt: '单杠' 39 | }, 40 | { 41 | id: 114, 42 | txt: '双杠' 43 | }] 44 | }, 45 | // { 46 | // id: 1, 47 | // title: '感冒忌用下列哪一种食物?', 48 | // right: 11, 49 | // answer: [{ 50 | // id: 11, 51 | // txt: '海鱼' 52 | // }, 53 | // { 54 | // id: 12, 55 | // txt: '豆浆' 56 | // }, 57 | // { 58 | // id: 13, 59 | // txt: '青菜' 60 | // }, 61 | // { 62 | // id: 14, 63 | // txt: '生姜' 64 | // }, 65 | // ] 66 | // }, 67 | // { 68 | // id: 2, 69 | // title: '老年人一天吃几只鸡蛋才合适?', 70 | // right: 22, 71 | // answer: [{ 72 | // id: 21, 73 | // txt: '100只' 74 | // }, 75 | // { 76 | // id: 22, 77 | // txt: '1~2只' 78 | // }, 79 | // { 80 | // id: 23, 81 | // txt: '不吃' 82 | // }, 83 | // { 84 | // id: 24, 85 | // txt: '50只' 86 | // }, 87 | // ] 88 | // }, 89 | // { 90 | // id: 3, 91 | // title: '柠檬汁有哪些营养含量?', 92 | // right: 33, 93 | // answer: [{ 94 | // id: 31, 95 | // txt: '维生素Z' 96 | // }, 97 | // { 98 | // id: 32, 99 | // txt: 'VB' 100 | // }, 101 | // { 102 | // id: 33, 103 | // txt: 'VC、VA' 104 | // }, 105 | // { 106 | // id: 34, 107 | // txt: '蛋白质' 108 | // }, 109 | // ] 110 | // }, 111 | // { 112 | // id: 5, 113 | // title: '苹果中含有增强记忆力的微量元素是?', 114 | // right: 54, 115 | // answer: [{ 116 | // id: 51, 117 | // txt: '铁' 118 | // }, 119 | // { 120 | // id: 52, 121 | // txt: '钙' 122 | // }, 123 | // { 124 | // id: 53, 125 | // txt: '碘伏' 126 | // }, 127 | // { 128 | // id: 54, 129 | // txt: '❤' 130 | // }, 131 | // ] 132 | // }, 133 | // { 134 | // id: 6, 135 | // title: '吃太多手摇爆米花机爆出的米花会导致', 136 | // right: 62, 137 | // answer: [{ 138 | // id: 61, 139 | // txt: '锡中毒' 140 | // }, 141 | // { 142 | // id: 62, 143 | // txt: '铅中毒' 144 | // }, 145 | // { 146 | // id: 63, 147 | // txt: '铬中毒' 148 | // }, 149 | // { 150 | // id: 64, 151 | // txt: '变脑残' 152 | // }, 153 | // ] 154 | // }, 155 | // { 156 | // id: 7, 157 | // title: '方便面里必然有哪种食品添加剂', 158 | // right: 72, 159 | // answer: [{ 160 | // id: 71, 161 | // txt: '防腐剂' 162 | // }, 163 | // { 164 | // id: 72, 165 | // txt: '合成抗氧化剂' 166 | // }, 167 | // { 168 | // id: 73, 169 | // txt: '食用色素' 170 | // }, 171 | // { 172 | // id: 74, 173 | // txt: '漂白剂搜索' 174 | // }, 175 | // ] 176 | // }, 177 | // { 178 | // id: 8, 179 | // title: '关于合理饮食有利于健康的下列说法正确的是', 180 | // right: 83, 181 | // answer: [{ 182 | // id: 81, 183 | // txt: '没有水就没有生命' 184 | // }, 185 | // { 186 | // id: 82, 187 | // txt: '饮用水越纯净越好' 188 | // }, 189 | // { 190 | // id: 83, 191 | // txt: '养成良好的饮食习惯,多吃蔬菜、水果等碱性食物 ' 192 | // }, 193 | // { 194 | // id: 84, 195 | // txt: '调味剂和营养剂加得越多越好' 196 | // }, 197 | // ] 198 | // }, 199 | // { 200 | // id: 9, 201 | // title: '低盐饮食有利于预防什么疾病?', 202 | // right: 93, 203 | // answer: [{ 204 | // id: 91, 205 | // txt: '乙型肝炎' 206 | // }, 207 | // { 208 | // id: 92, 209 | // txt: '糖尿病' 210 | // }, 211 | // { 212 | // id: 93, 213 | // txt: '高血压 ' 214 | // }, 215 | // { 216 | // id: 94, 217 | // txt: '贫血' 218 | // }, 219 | // ] 220 | // }, 221 | // { 222 | // id: 10, 223 | // title: '碘缺乏会导致儿童、青少年', 224 | // right: 104, 225 | // answer: [{ 226 | // id: 101, 227 | // txt: '甲亢' 228 | // }, 229 | // { 230 | // id: 102, 231 | // txt: '无力' 232 | // }, 233 | // { 234 | // id: 103, 235 | // txt: '心理疾病 ' 236 | // }, 237 | // { 238 | // id: 104, 239 | // txt: '生长发育和智力受影响' 240 | // }, 241 | // ] 242 | // }, 243 | ] -------------------------------------------------------------------------------- /assets/scripts/mock.ts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "2c8d90e0-a437-417d-8861-767a388f6e8a", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/textures.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "c47f8859-64b0-46c4-a9b1-84ab720235d1", 4 | "subMetas": {} 5 | } -------------------------------------------------------------------------------- /assets/textures/brn_blue_item.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/brn_blue_item.png -------------------------------------------------------------------------------- /assets/textures/brn_blue_item.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "9781a2d3-4da7-41e6-b8da-d963651074c0", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "brn_blue_item": { 9 | "ver": "1.0.3", 10 | "uuid": "4d377f96-62eb-4b8c-85e4-bac07d9d9c13", 11 | "rawTextureUuid": "9781a2d3-4da7-41e6-b8da-d963651074c0", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 132, 20 | "height": 71, 21 | "rawWidth": 132, 22 | "rawHeight": 71, 23 | "borderTop": 11, 24 | "borderBottom": 11, 25 | "borderLeft": 12, 26 | "borderRight": 11, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/brn_blue_item_pressed.png.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/brn_blue_item_pressed.png.png -------------------------------------------------------------------------------- /assets/textures/brn_blue_item_pressed.png.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "2c3edd63-d03a-43d0-97f0-4d4825749a0b", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "brn_blue_item_pressed.png": { 9 | "ver": "1.0.3", 10 | "uuid": "2c97d6c5-2d17-4e06-97f6-37e022031362", 11 | "rawTextureUuid": "2c3edd63-d03a-43d0-97f0-4d4825749a0b", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 132, 20 | "height": 71, 21 | "rawWidth": 132, 22 | "rawHeight": 71, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/btn_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/btn_blue.png -------------------------------------------------------------------------------- /assets/textures/btn_blue.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "f68d847f-d049-4cc6-b03d-c114d40fd7d4", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "btn_blue": { 9 | "ver": "1.0.3", 10 | "uuid": "987b485c-575b-4c49-8217-e1e93b53f4c0", 11 | "rawTextureUuid": "f68d847f-d049-4cc6-b03d-c114d40fd7d4", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 103, 20 | "height": 102, 21 | "rawWidth": 103, 22 | "rawHeight": 102, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/btn_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/btn_green.png -------------------------------------------------------------------------------- /assets/textures/btn_green.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "093a1270-5d8c-4d70-8abd-fd9b8e4075a8", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "btn_green": { 9 | "ver": "1.0.3", 10 | "uuid": "baa86457-8d49-409c-a326-9037e4e9786e", 11 | "rawTextureUuid": "093a1270-5d8c-4d70-8abd-fd9b8e4075a8", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 103, 20 | "height": 102, 21 | "rawWidth": 103, 22 | "rawHeight": 102, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/btn_green_ round_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/btn_green_ round_pressed.png -------------------------------------------------------------------------------- /assets/textures/btn_green_ round_pressed.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "13240f0f-5d4b-429c-80d6-b50df29a1589", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "btn_green_ round_pressed": { 9 | "ver": "1.0.3", 10 | "uuid": "7f8dd537-afa0-4a82-9a23-cd0ca8d9b545", 11 | "rawTextureUuid": "13240f0f-5d4b-429c-80d6-b50df29a1589", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 43, 20 | "height": 48, 21 | "rawWidth": 43, 22 | "rawHeight": 48, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/btn_green_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/btn_green_round.png -------------------------------------------------------------------------------- /assets/textures/btn_green_round.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "2f2a8c28-acb0-48bb-94db-bf15b1e7098f", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "btn_green_round": { 9 | "ver": "1.0.3", 10 | "uuid": "ddaf1737-914b-4af7-a3ac-f58ee4b3015b", 11 | "rawTextureUuid": "2f2a8c28-acb0-48bb-94db-bf15b1e7098f", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 59, 20 | "height": 59, 21 | "rawWidth": 59, 22 | "rawHeight": 59, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/btn_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/btn_grey.png -------------------------------------------------------------------------------- /assets/textures/btn_grey.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "cc564ca5-a25e-40c8-87d5-af631b206316", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "btn_grey": { 9 | "ver": "1.0.3", 10 | "uuid": "c456cc67-38c3-4625-ac64-ab047832fb71", 11 | "rawTextureUuid": "cc564ca5-a25e-40c8-87d5-af631b206316", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 103, 20 | "height": 102, 21 | "rawWidth": 103, 22 | "rawHeight": 102, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/img_bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/img_bg_1.png -------------------------------------------------------------------------------- /assets/textures/img_bg_1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "09632b81-c6b5-4e30-a44d-64ef8ec1ded0", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "img_bg_1": { 9 | "ver": "1.0.3", 10 | "uuid": "974c888b-b6d9-4ff3-bb2e-a0631eea9fca", 11 | "rawTextureUuid": "09632b81-c6b5-4e30-a44d-64ef8ec1ded0", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -7, 16 | "offsetY": -65.5, 17 | "trimX": 42, 18 | "trimY": 131, 19 | "width": 652, 20 | "height": 1203, 21 | "rawWidth": 750, 22 | "rawHeight": 1334, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/ui_item_bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/ui_item_bg.png -------------------------------------------------------------------------------- /assets/textures/ui_item_bg.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "88ad3b80-f368-4b69-a989-42e7bb6a3bb2", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "ui_item_bg": { 9 | "ver": "1.0.3", 10 | "uuid": "94217726-9f70-4a65-ac1a-38f043730ff1", 11 | "rawTextureUuid": "88ad3b80-f368-4b69-a989-42e7bb6a3bb2", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 305, 20 | "height": 114, 21 | "rawWidth": 305, 22 | "rawHeight": 114, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/ui_item_bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/ui_item_bg_1.png -------------------------------------------------------------------------------- /assets/textures/ui_item_bg_1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "29361c13-5fc7-4043-9bed-571843a19f8c", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "ui_item_bg_1": { 9 | "ver": "1.0.3", 10 | "uuid": "26d61fcc-3c30-4d04-9a71-0acc91d38f56", 11 | "rawTextureUuid": "29361c13-5fc7-4043-9bed-571843a19f8c", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 143, 20 | "height": 96, 21 | "rawWidth": 143, 22 | "rawHeight": 96, 23 | "borderTop": 32, 24 | "borderBottom": 33, 25 | "borderLeft": 39, 26 | "borderRight": 28, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/ui_progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/ui_progress.png -------------------------------------------------------------------------------- /assets/textures/ui_progress.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "c56989e5-4bb2-421f-8eda-bf49ddb5a7e5", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "ui_progress": { 9 | "ver": "1.0.3", 10 | "uuid": "bf36ac11-05f1-4934-a968-9becd29cfbbc", 11 | "rawTextureUuid": "c56989e5-4bb2-421f-8eda-bf49ddb5a7e5", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 360, 20 | "height": 24, 21 | "rawWidth": 360, 22 | "rawHeight": 24, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 15, 26 | "borderRight": 15, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/textures/ui_progress_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/assets/textures/ui_progress_bar.png -------------------------------------------------------------------------------- /assets/textures/ui_progress_bar.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "e210397f-c09f-4657-a48c-fb074d2facaf", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "ui_progress_bar": { 9 | "ver": "1.0.3", 10 | "uuid": "6a341d24-89b9-47fc-9325-d70cebb60901", 11 | "rawTextureUuid": "e210397f-c09f-4657-a48c-fb074d2facaf", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 364, 20 | "height": 24, 21 | "rawWidth": 364, 22 | "rawHeight": 24, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 12, 26 | "borderRight": 15, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /build/web-mobile/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Cocos Creator | wordpk 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 | 48 |
49 |
50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /build/web-mobile/main.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | function boot () { 4 | 5 | var settings = window._CCSettings; 6 | window._CCSettings = undefined; 7 | 8 | if ( !settings.debug ) { 9 | var uuids = settings.uuids; 10 | 11 | var rawAssets = settings.rawAssets; 12 | var assetTypes = settings.assetTypes; 13 | var realRawAssets = settings.rawAssets = {}; 14 | for (var mount in rawAssets) { 15 | var entries = rawAssets[mount]; 16 | var realEntries = realRawAssets[mount] = {}; 17 | for (var id in entries) { 18 | var entry = entries[id]; 19 | var type = entry[1]; 20 | // retrieve minified raw asset 21 | if (typeof type === 'number') { 22 | entry[1] = assetTypes[type]; 23 | } 24 | // retrieve uuid 25 | realEntries[uuids[id] || id] = entry; 26 | } 27 | } 28 | 29 | var scenes = settings.scenes; 30 | for (var i = 0; i < scenes.length; ++i) { 31 | var scene = scenes[i]; 32 | if (typeof scene.uuid === 'number') { 33 | scene.uuid = uuids[scene.uuid]; 34 | } 35 | } 36 | 37 | var packedAssets = settings.packedAssets; 38 | for (var packId in packedAssets) { 39 | var packedIds = packedAssets[packId]; 40 | for (var j = 0; j < packedIds.length; ++j) { 41 | if (typeof packedIds[j] === 'number') { 42 | packedIds[j] = uuids[packedIds[j]]; 43 | } 44 | } 45 | } 46 | } 47 | 48 | // init engine 49 | var canvas; 50 | 51 | if (cc.sys.isBrowser) { 52 | canvas = document.getElementById('GameCanvas'); 53 | } 54 | 55 | if (false) { 56 | var ORIENTATIONS = { 57 | 'portrait': 1, 58 | 'landscape left': 2, 59 | 'landscape right': 3 60 | }; 61 | BK.Director.screenMode = ORIENTATIONS[settings.orientation]; 62 | initAdapter(); 63 | } 64 | 65 | function setLoadingDisplay () { 66 | // Loading splash scene 67 | var splash = document.getElementById('splash'); 68 | var progressBar = splash.querySelector('.progress-bar span'); 69 | cc.loader.onProgress = function (completedCount, totalCount, item) { 70 | var percent = 100 * completedCount / totalCount; 71 | if (progressBar) { 72 | progressBar.style.width = percent.toFixed(2) + '%'; 73 | } 74 | }; 75 | splash.style.display = 'block'; 76 | progressBar.style.width = '0%'; 77 | 78 | cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () { 79 | splash.style.display = 'none'; 80 | }); 81 | } 82 | 83 | var onStart = function () { 84 | if (false) { 85 | BK.Script.loadlib(); 86 | } 87 | 88 | cc.view.resizeWithBrowserSize(true); 89 | 90 | if (!false && !false) { 91 | // UC browser on many android devices have performance issue with retina display 92 | if (cc.sys.os !== cc.sys.OS_ANDROID || cc.sys.browserType !== cc.sys.BROWSER_TYPE_UC) { 93 | cc.view.enableRetina(true); 94 | } 95 | if (cc.sys.isBrowser) { 96 | setLoadingDisplay(); 97 | } 98 | 99 | if (cc.sys.isMobile) { 100 | if (settings.orientation === 'landscape') { 101 | cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE); 102 | } 103 | else if (settings.orientation === 'portrait') { 104 | cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT); 105 | } 106 | cc.view.enableAutoFullScreen([ 107 | cc.sys.BROWSER_TYPE_BAIDU, 108 | cc.sys.BROWSER_TYPE_WECHAT, 109 | cc.sys.BROWSER_TYPE_MOBILE_QQ, 110 | cc.sys.BROWSER_TYPE_MIUI, 111 | ].indexOf(cc.sys.browserType) < 0); 112 | } 113 | 114 | // Limit downloading max concurrent task to 2, 115 | // more tasks simultaneously may cause performance draw back on some android system / brwosers. 116 | // You can adjust the number based on your own test result, you have to set it before any loading process to take effect. 117 | if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) { 118 | cc.macro.DOWNLOAD_MAX_CONCURRENT = 2; 119 | } 120 | } 121 | 122 | // init assets 123 | cc.AssetLibrary.init({ 124 | libraryPath: 'res/import', 125 | rawAssetsBase: 'res/raw-', 126 | rawAssets: settings.rawAssets, 127 | packedAssets: settings.packedAssets, 128 | md5AssetsMap: settings.md5AssetsMap 129 | }); 130 | 131 | if (false) { 132 | cc.Pipeline.Downloader.PackDownloader._doPreload("WECHAT_SUBDOMAIN", settings.WECHAT_SUBDOMAIN_DATA); 133 | } 134 | 135 | var launchScene = settings.launchScene; 136 | 137 | // load scene 138 | cc.director.loadScene(launchScene, null, 139 | function () { 140 | if (cc.sys.isBrowser) { 141 | // show canvas 142 | canvas.style.visibility = ''; 143 | var div = document.getElementById('GameDiv'); 144 | if (div) { 145 | div.style.backgroundImage = ''; 146 | } 147 | } 148 | cc.loader.onProgress = null; 149 | console.log('Success to load scene: ' + launchScene); 150 | } 151 | ); 152 | }; 153 | 154 | // jsList 155 | var jsList = settings.jsList; 156 | 157 | if (!false) { 158 | var bundledScript = settings.debug ? 'src/project.dev.js' : 'src/project.js'; 159 | if (jsList) { 160 | jsList = jsList.map(function (x) { 161 | return 'src/' + x; 162 | }); 163 | jsList.push(bundledScript); 164 | } 165 | else { 166 | jsList = [bundledScript]; 167 | } 168 | } 169 | 170 | // anysdk scripts 171 | if (cc.sys.isNative && cc.sys.isMobile) { 172 | jsList = jsList.concat(['src/anysdk/jsb_anysdk.js', 'src/anysdk/jsb_anysdk_constants.js']); 173 | } 174 | 175 | var option = { 176 | //width: width, 177 | //height: height, 178 | id: 'GameCanvas', 179 | scenes: settings.scenes, 180 | debugMode: settings.debug ? cc.DebugMode.INFO : cc.DebugMode.ERROR, 181 | showFPS: (!false && !false) && settings.debug, 182 | frameRate: 60, 183 | jsList: jsList, 184 | groupList: settings.groupList, 185 | collisionMatrix: settings.collisionMatrix, 186 | renderMode: 0 187 | } 188 | 189 | cc.game.run(option, onStart); 190 | } 191 | 192 | if (false) { 193 | BK.Script.loadlib('GameRes://libs/qqplay-adapter.js'); 194 | BK.Script.loadlib('GameRes://src/settings.js'); 195 | BK.Script.loadlib(); 196 | BK.Script.loadlib('GameRes://libs/qqplay-downloader.js'); 197 | qqPlayDownloader.REMOTE_SERVER_ROOT = ""; 198 | var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; 199 | cc.loader.insertPipeAfter(prevPipe, qqPlayDownloader); 200 | // 201 | boot(); 202 | return; 203 | } 204 | 205 | if (false) { 206 | require(window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js'); 207 | require('./libs/weapp-adapter/engine/index.js'); 208 | var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; 209 | cc.loader.insertPipeAfter(prevPipe, wxDownloader); 210 | boot(); 211 | return; 212 | } 213 | 214 | if (window.jsb) { 215 | require('src/settings.js'); 216 | require('src/jsb_polyfill.js'); 217 | boot(); 218 | return; 219 | } 220 | 221 | if (window.document) { 222 | var splash = document.getElementById('splash'); 223 | splash.style.display = 'block'; 224 | 225 | var cocos2d = document.createElement('script'); 226 | cocos2d.async = true; 227 | cocos2d.src = window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js'; 228 | 229 | var engineLoaded = function () { 230 | document.body.removeChild(cocos2d); 231 | cocos2d.removeEventListener('load', engineLoaded, false); 232 | window.eruda && eruda.init() && eruda.get('console').config.set('displayUnenumerable', false); 233 | boot(); 234 | }; 235 | cocos2d.addEventListener('load', engineLoaded, false); 236 | document.body.appendChild(cocos2d); 237 | } 238 | 239 | })(); 240 | -------------------------------------------------------------------------------- /build/web-mobile/res/import/0b/0b04dfdf3.json: -------------------------------------------------------------------------------- 1 | [[{"__type__":"cc.SceneAsset","_name":"Result","scene":{"__id__":1},"asyncLoadAssets":null},{"__type__":"cc.Scene","_name":"New Node","_children":[{"__id__":2}],"_anchorPoint":{"__type__":"cc.Vec2"},"autoReleaseAssets":false},{"__type__":"cc.Node","_name":"Canvas","_parent":{"__id__":1},"_children":[{"__id__":3}],"_components":[{"__type__":"cc.Canvas","node":{"__id__":2},"_designResolution":{"__type__":"cc.Size","width":750,"height":1334}}],"_id":"4czp2X1QVAGJqIIoFeZFwu","_contentSize":{"__type__":"cc.Size","width":750,"height":1334},"_position":{"__type__":"cc.Vec2","x":375,"y":667}},{"__type__":"cc.Node","_name":"Layout","_parent":{"__id__":2},"_children":[{"__id__":4}],"_components":[{"__type__":"cc.Sprite","node":{"__id__":3},"_spriteFrame":{"__uuid__":"9bvaMerUlDyary99mJa6xp"},"_type":1,"_sizeMode":0,"_isTrimmedMode":false},{"__type__":"cc.Layout","node":{"__id__":3},"_layoutSize":{"__type__":"cc.Size","width":707.5471698113207,"height":1258.4905660377358}},{"__type__":"cc.Widget","node":{"__id__":3},"_alignFlags":45,"_originalWidth":200,"_originalHeight":150}],"_color":{"__type__":"cc.Color","r":40,"g":78,"b":119},"_contentSize":{"__type__":"cc.Size","width":707.5471698113207,"height":1258.4905660377358},"_scaleX":1.06,"_scaleY":1.06},{"__type__":"cc.Node","_name":"background","_parent":{"__id__":3},"_components":[{"__type__":"cc.Sprite","node":{"__id__":4},"_spriteFrame":{"__uuid__":"97TIiLttlP87suoGMe6p/K"},"_sizeMode":0},{"__type__":"cc.Widget","node":{"__id__":4},"_alignFlags":45,"_originalWidth":652,"_originalHeight":1203}],"_opacity":180,"_contentSize":{"__type__":"cc.Size","width":707.5471698113207,"height":1258.4905660377358}}],{"__type__":"cc.SpriteFrame","content":{"name":"img_bg_1","texture":"09YyuBxrVOMKRNZO+Owd7Q","rect":[42,131,652,1203],"offset":[-7,-65.5],"originalSize":[750,1334]}},{"__type__":"cc.SpriteFrame","content":{"name":"default_panel","texture":"d8HsitJHxOYqo801xBk8ev","rect":[0,0,20,20],"offset":[0,0],"originalSize":[20,20],"capInsets":[4,3,4,3]}}] -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/audio/countdown_1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/audio/countdown_1.mp3 -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/audio/countdown_2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/audio/countdown_2.mp3 -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/audio/fail.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/audio/fail.wav -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/audio/success.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/audio/success.wav -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/font/mikado_outline_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/font/mikado_outline_shadow.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/textures/btn_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/textures/btn_blue.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/textures/btn_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/textures/btn_green.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/textures/btn_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/textures/btn_grey.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/textures/img_bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/textures/img_bg_1.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/textures/ui_progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/textures/ui_progress.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-assets/textures/ui_progress_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-assets/textures/ui_progress_bar.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-internal/image/default_btn_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-internal/image/default_btn_disabled.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-internal/image/default_btn_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-internal/image/default_btn_normal.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-internal/image/default_btn_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-internal/image/default_btn_pressed.png -------------------------------------------------------------------------------- /build/web-mobile/res/raw-internal/image/default_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/res/raw-internal/image/default_panel.png -------------------------------------------------------------------------------- /build/web-mobile/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/web-mobile/splash.png -------------------------------------------------------------------------------- /build/web-mobile/src/project.js: -------------------------------------------------------------------------------- 1 | require=function i(c,d,s){function a(e,t){if(!d[e]){if(!c[e]){var o="function"==typeof require&&require;if(!t&&o)return o(e,!0);if(u)return u(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var r=d[e]={exports:{}};c[e][0].call(r.exports,function(t){return a(c[e][1][t]||t)},r,r.exports,i,c,d,s)}return d[e].exports}for(var u="function"==typeof require&&require,t=0;t=n.questionTotal)return!1}return!0}),console.log(n.qdata))},e.open("get","https://jisujiakao.market.alicloudapi.com/driverexam/query?pagenum=1&pagesize=100&sort=rand&subject=1&type=C1",!0),e.setRequestHeader("Authorization","APPCODE d1f7d1f2048841eca46b1a56a941554b"),console.log(e.send())},t.prototype.init=function(){this.progressBarNode.active=!1,this.progressBar=this.progressBarNode.getComponent(cc.ProgressBar),this.progressBar.progress=1,this.readyCountdownNode.active=!1,this.readyCountdown=this.readyCountdownNode.getComponent(cc.Label),this.qaNode.active=!1,this.qaNode.opacity=0,this.btnStart.active=!0,this.current=0,this.mark.active=!1},t.prototype.ready=function(){var n=this,t=2;this.readyCountdownNode.active=!0,this.readyCountdown.string="Ready";var e=cc.sequence(cc.scaleTo(.2,1.6),cc.scaleTo(.6,.8)),o=cc.sequence(cc.scaleTo(.2,1.6),cc.callFunc(function(){console.log("anim end!"),setTimeout(function(){var t=n.readyCountdownNode.position,e=t.x,o=t.y;n.readyCountdownNode.runAction(cc.sequence(cc.moveTo(.5,0,1e3),cc.callFunc(function(){n.readyCountdownNode.active=!1,n.readyCountdownNode.x=e,n.readyCountdownNode.y=o,n.readyCountdownNode.scale=1,n.progressBarNode.active=!0,n.qaNode.active=!0,n.starRound()})))},300)}));this.readyCountdownNode.runAction(e),this.schedule(function(){if(t<=0)return n.readyCountdown.string="Go",void n.readyCountdownNode.runAction(o);n.readyCountdown.string=t.toString(),n.readyCountdownNode.runAction(e),t-=1},1,t,0),this.scheduleOnce(function(){cc.audioEngine.play(n.countdownAudio_1,!1,1)},1)},t.prototype.startGame=function(){this.btnStart.active=!1,this.ready()},t.prototype.starRound=function(){var t=this;if(this.current>=this.qdata.length)return this.init(),void this.unschedule(this.updateCountdownTime);this.mark.active=!0,this.mark.getComponent(cc.Label).string="第 "+(this.current+1)+" 题",this.mark.runAction(cc.sequence(cc.scaleTo(.2,1.2),cc.scaleTo(.2,1),cc.callFunc(function(){t.scheduleOnce(function(){t.mark.active=!1,t.qaNode.runAction(cc.fadeIn(.2)),t.inProgress=!0,t.qaNode.getComponent("Qa").initQa(t.qdata[t.current]),t.progressBar.progress=1,t.schedule(t.updateCountdownTime,1),t.current+=1},1)})))},t.prototype.endRound=function(){var t=this;this.currentTime=0,this.inProgress=!1;var e=cc.sequence(cc.fadeOut(.2),cc.callFunc(function(){t.qaNode.getComponent("Qa").resetStatus(),t.scheduleOnce(function(){t.starRound()},.5)}));this.qaNode.runAction(e)},t.prototype.stopSchedule=function(){this.unschedule(this.updateCountdownTime)},t.prototype.updateCountdownTime=function(){this.currentTime+=1,this.progressBar.progress=1-this.currentTime/this.countdownTime,cc.audioEngine.play(this.countdownAudio_2,!1,1),this.currentTime>=this.countdownTime&&(this.unschedule(this.updateCountdownTime),this.endRound())},__decorate([i(cc.Node)],t.prototype,"mark",void 0),__decorate([i(cc.Node)],t.prototype,"qaNode",void 0),__decorate([i(cc.Node)],t.prototype,"progressBarNode",void 0),__decorate([i(cc.Node)],t.prototype,"readyCountdownNode",void 0),__decorate([i(cc.Node)],t.prototype,"btnStart",void 0),__decorate([i(cc.AudioClip)],t.prototype,"countdownAudio_1",void 0),__decorate([i(cc.AudioClip)],t.prototype,"countdownAudio_2",void 0),__decorate([i(cc.Integer)],t.prototype,"countdownTime",void 0),__decorate([i(cc.Integer)],t.prototype,"questionTotal",void 0),t=__decorate([r],t)}(cc.Component);o.default=c,cc._RF.pop()},{}],Qa:[function(t,e,o){"use strict";cc._RF.push(e,"43a45WEJW1Pr4y9hfLJQXmJ","Qa"),Object.defineProperty(o,"__esModule",{value:!0});var n=cc._decorator,r=n.ccclass,i=n.property,c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.questionNode=null,t.btnAnswerNode_1=null,t.btnAnswerNode_2=null,t.btnAnswerNode_3=null,t.btnAnswerNode_4=null,t.game=null,t.faildAudio=null,t.successAudio=null,t.btnAnswerNodeArray=new Array,t.currentNode=null,t.rightNode=null,t}return __extends(t,e),t.prototype.onLoad=function(){this.btnAnswerNodeArray=[this.btnAnswerNode_1,this.btnAnswerNode_2,this.btnAnswerNode_3,this.btnAnswerNode_4]},t.prototype.answerClick=function(t,e){if(!this.isAnswer&&this.game.getComponent("Game").inProgress){if(this.isAnswer=!0,this.currentNode=this.btnAnswerNodeArray[e],this.answer=Number(e),this.right===Number(e))return void this.correct();this.wrong()}},t.prototype.initQa=function(e){this.isAnswer=!1,this.questionNode.getComponent(cc.Label).string=e.title;var t=e.answer,o=t[0],n=t[1],r=t[2],i=t[3];this.getChildrenLabel(this.btnAnswerNode_1).string=""+o.txt,this.getChildrenLabel(this.btnAnswerNode_2).string=""+n.txt,this.getChildrenLabel(this.btnAnswerNode_3).string=""+r.txt,this.getChildrenLabel(this.btnAnswerNode_4).string=""+i.txt,this.right=e.answer.findIndex(function(t){return t.id===e.right}),this.rightNode=this.btnAnswerNodeArray[this.right]},t.prototype.correct=function(){this.animStart(),cc.audioEngine.play(this.successAudio,!1,1),this.currentNode.color=new cc.Color(88,165,92)},t.prototype.wrong=function(){this.animStart(),cc.audioEngine.play(this.faildAudio,!1,1),this.currentNode.color=new cc.Color(217,80,84)},t.prototype.animStart=function(){var e=this,t=cc.sequence(cc.scaleTo(.2,1.1),cc.callFunc(this.animOver,this));this.currentNode.runAction(t);var o=this.right===this.answer;this.currentNode.getChildByName("Label").color=cc.Color.WHITE,this.btnAnswerNodeArray.forEach(function(t){if(!o&&e.rightNode===t)return t.color=new cc.Color(88,165,92),void(t.getChildByName("Label").color=cc.Color.WHITE);e.currentNode!==t&&t.runAction(cc.scaleTo(.2,0))})},t.prototype.animOver=function(){var t=this;this.game.getComponent("Game").stopSchedule(),this.scheduleOnce(function(){t.game.getComponent("Game").endRound()},1)},t.prototype.resetStatus=function(){var e=this;this.currentNode&&(this.currentNode.runAction(cc.scaleTo(.2,1)),this.currentNode.color=cc.Color.WHITE,this.rightNode.color=cc.Color.WHITE,this.rightNode.getChildByName("Label").color=cc.Color.BLACK,this.currentNode.getChildByName("Label").color=cc.Color.BLACK,this.btnAnswerNodeArray.forEach(function(t){e.currentNode!==t&&t.runAction(cc.scaleTo(.2,1))}),this.currentNode=null)},t.prototype.getChildrenLabel=function(t){return t.getChildByName("Label").getComponent(cc.Label)},__decorate([i(cc.Node)],t.prototype,"questionNode",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_1",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_2",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_3",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_4",void 0),__decorate([i(cc.Node)],t.prototype,"game",void 0),__decorate([i(cc.AudioClip)],t.prototype,"faildAudio",void 0),__decorate([i(cc.AudioClip)],t.prototype,"successAudio",void 0),t=__decorate([r],t)}(cc.Component);o.default=c,cc._RF.pop()},{}],mock:[function(t,e,o){"use strict";cc._RF.push(e,"2c8d9DgpDdBfYhhdno4j26K","mock"),Object.defineProperty(o,"__esModule",{value:!0}),o.default=[{id:111,title:"小舅子是对妻子什么亲戚的称谓?",right:111,answer:[{id:111,txt:"弟弟"},{id:112,txt:"奶奶"},{id:113,txt:"侄子"},{id:114,txt:"外甥"}]},{id:112,title:"“李小鹏挂”是哪个体操项目中的动作?",right:114,answer:[{id:111,txt:"撑杆跳"},{id:112,txt:"体操"},{id:113,txt:"单杠"},{id:114,txt:"双杠"}]}],cc._RF.pop()},{}]},{},["Game","Qa","mock"]); -------------------------------------------------------------------------------- /build/web-mobile/src/settings.js: -------------------------------------------------------------------------------- 1 | window._CCSettings={platform:"web-mobile",groupList:["default"],collisionMatrix:[[true]],rawAssets:{assets:{"99jLJzZ7tEkb3VpO+Gj1Fm":["audio/countdown_1.mp3",0],"44FahZyXFBKqSOgy6l4TU4":["audio/countdown_2.mp3",0],"42T/YN9LhCsYJWIGayHdeR":["audio/fail.wav",0],"213G5q9C9DvZJVFT/U30WQ":["audio/success.wav",0],a8NEEJT5VBjKVt6HYhJGvu:["font/mikado_outline_shadow.png",1],"f6jYR/0ElMxrA9wRTUD9fU":["textures/btn_blue.png",1],"09OhJwXYxNcIq9/ZuOQHWo":["textures/btn_green.png",1],ccVkylol5AyIfVr2MbIGMW:["textures/btn_grey.png",1],"09YyuBxrVOMKRNZO+Owd7Q":["textures/img_bg_1.png",1],c5aYnlS7JCH47av0ndtafl:["textures/ui_progress.png",1],"e2EDl/wJ9GV6SM+wdNL6yv":["textures/ui_progress_bar.png",1]},internal:{"71VhFCTINJM6/Ky3oX9nBT":["image/default_btn_disabled.png",1],"e8Ueib+qJEhL6mXAHdnwbi":["image/default_btn_normal.png",1],"b4P/PCArtIdIH38t6mlw8Y":["image/default_btn_pressed.png",1],d8HsitJHxOYqo801xBk8ev:["image/default_panel.png",1]}},assetTypes:["cc.AudioClip","cc.Texture2D"],launchScene:"db://assets/scene/Game.fire",scenes:[{url:"db://assets/scene/Game.fire",uuid:1},{url:"db://assets/scene/Result.fire",uuid:0}],packedAssets:{"0b04dfdf3":[0,2,3],"0df4bb847":["29FYIk+N1GYaeWH/q1NxQO","6aNB0kiblH/JMl1wzrtgkB",1,2,"98e0hcV1tMSYIX4ek7U/TA",3,"b7KGaHqGNNlJ51jJQHFv7D","baqGRXjUlAnKMmkDfk6Xhu","bfNqwRBfFJNKlom+zSnPu8","c4VsxnOMNGJaxkqwR4Mvtx","e7lOy1fu9C36DqFIMCO5Ca","e97GVMl6JHh5Ml5qEDdSGa","f0BIwQ8D5Ml7nTNQbh1YlS"]},orientation:"",uuids:["87Y2/IPBlIiqOqx4Wo4uMw","7diISZpOlJeaqceYr1akrW","97TIiLttlP87suoGMe6p/K","9bvaMerUlDyary99mJa6xp"]}; -------------------------------------------------------------------------------- /build/web-mobile/style-desktop.css: -------------------------------------------------------------------------------- 1 | body { 2 | cursor: default; 3 | padding: 0; 4 | border: 0; 5 | margin: 0; 6 | 7 | text-align: center; 8 | background-color: white; 9 | font-family: Helvetica, Verdana, Arial, sans-serif; 10 | } 11 | 12 | body, canvas, div { 13 | outline: none; 14 | -moz-user-select: none; 15 | -webkit-user-select: none; 16 | -ms-user-select: none; 17 | -khtml-user-select: none; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | /* Remove spin of input type number */ 22 | input::-webkit-outer-spin-button, 23 | input::-webkit-inner-spin-button { 24 | /* display: none; <- Crashes Chrome on hover */ 25 | -webkit-appearance: none; 26 | margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ 27 | } 28 | 29 | #Cocos2dGameContainer { 30 | position: absolute; 31 | margin: 0; 32 | overflow: hidden; 33 | left: 0px; 34 | top: 0px; 35 | } 36 | 37 | canvas { 38 | background-color: rgba(0, 0, 0, 0); 39 | } 40 | 41 | a:link, a:visited { 42 | color: #000; 43 | } 44 | 45 | a:active, a:hover { 46 | color: #666; 47 | } 48 | 49 | p.header { 50 | font-size: small; 51 | } 52 | 53 | p.footer { 54 | font-size: x-small; 55 | } 56 | 57 | #splash { 58 | position: absolute; 59 | top: 0; 60 | left: 0; 61 | width: 100%; 62 | height: 100%; 63 | 64 | background: #171717 url(./splash.png) no-repeat center; 65 | background-size: 40%; 66 | } 67 | 68 | .progress-bar { 69 | background-color: #1a1a1a; 70 | position: absolute; 71 | left: 50%; 72 | top: 80%; 73 | height: 26px; 74 | padding: 5px; 75 | width: 350px; 76 | margin: 0 -175px; 77 | border-radius: 5px; 78 | box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444; 79 | } 80 | 81 | .progress-bar span { 82 | display: block; 83 | height: 100%; 84 | border-radius: 3px; 85 | box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; 86 | transition: width .4s ease-in-out; 87 | background-color: #34c2e3; 88 | } 89 | 90 | .stripes span { 91 | background-size: 30px 30px; 92 | background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, 93 | transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, 94 | transparent 75%, transparent); 95 | 96 | animation: animate-stripes 1s linear infinite; 97 | } 98 | 99 | @keyframes animate-stripes { 100 | 0% {background-position: 0 0;} 100% {background-position: 60px 0;} 101 | } 102 | 103 | h1 { 104 | color: #444; 105 | text-shadow: 3px 3px 15px; 106 | } 107 | 108 | #GameDiv { 109 | width: 800px; 110 | height: 450px; 111 | margin: 0 auto; 112 | background: black; 113 | position:relative; 114 | border:5px solid black; 115 | border-radius: 10px; 116 | box-shadow: 0 5px 50px #333 117 | } 118 | -------------------------------------------------------------------------------- /build/web-mobile/style-mobile.css: -------------------------------------------------------------------------------- 1 | html { 2 | -ms-touch-action: none; 3 | } 4 | 5 | body, canvas, div { 6 | display: block; 7 | outline: none; 8 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 9 | 10 | -moz-user-select: none; 11 | -webkit-user-select: none; 12 | -ms-user-select: none; 13 | -khtml-user-select: none; 14 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 15 | } 16 | 17 | /* Remove spin of input type number */ 18 | input::-webkit-outer-spin-button, 19 | input::-webkit-inner-spin-button { 20 | /* display: none; <- Crashes Chrome on hover */ 21 | -webkit-appearance: none; 22 | margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ 23 | } 24 | 25 | body { 26 | position: absolute; 27 | top: 0; 28 | left: 0; 29 | width: 100%; 30 | height: 100%; 31 | padding: 0; 32 | border: 0; 33 | margin: 0; 34 | 35 | cursor: default; 36 | color: #888; 37 | background-color: #333; 38 | 39 | text-align: center; 40 | font-family: Helvetica, Verdana, Arial, sans-serif; 41 | 42 | display: flex; 43 | flex-direction: column; 44 | } 45 | 46 | #Cocos2dGameContainer { 47 | position: absolute; 48 | margin: 0; 49 | overflow: hidden; 50 | left: 0px; 51 | top: 0px; 52 | 53 | display: -webkit-box; 54 | -webkit-box-orient: horizontal; 55 | -webkit-box-align: center; 56 | -webkit-box-pack: center; 57 | } 58 | 59 | canvas { 60 | background-color: rgba(0, 0, 0, 0); 61 | } 62 | 63 | a:link, a:visited { 64 | color: #666; 65 | } 66 | 67 | a:active, a:hover { 68 | color: #666; 69 | } 70 | 71 | p.header { 72 | font-size: small; 73 | } 74 | 75 | p.footer { 76 | font-size: x-small; 77 | } 78 | 79 | #splash { 80 | position: absolute; 81 | top: 0; 82 | left: 0; 83 | width: 100%; 84 | height: 100%; 85 | background: #171717 url(./splash.png) no-repeat center; 86 | background-size: 40%; 87 | } 88 | 89 | .progress-bar { 90 | background-color: #1a1a1a; 91 | position: absolute; 92 | left: 25%; 93 | top: 80%; 94 | height: 15px; 95 | padding: 5px; 96 | width: 50%; 97 | /*margin: 0 -175px; */ 98 | border-radius: 5px; 99 | box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444; 100 | } 101 | 102 | .progress-bar span { 103 | display: block; 104 | height: 100%; 105 | border-radius: 3px; 106 | box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; 107 | transition: width .4s ease-in-out; 108 | background-color: #34c2e3; 109 | } 110 | 111 | .stripes span { 112 | background-size: 30px 30px; 113 | background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, 114 | transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, 115 | transparent 75%, transparent); 116 | 117 | animation: animate-stripes 1s linear infinite; 118 | } 119 | 120 | @keyframes animate-stripes { 121 | 0% {background-position: 0 0;} 100% {background-position: 60px 0;} 122 | } 123 | -------------------------------------------------------------------------------- /build/wechatgame/game.js: -------------------------------------------------------------------------------- 1 | require('libs/weapp-adapter/index'); 2 | var Parser = require('libs/xmldom/dom-parser'); 3 | window.DOMParser = Parser.DOMParser; 4 | require('libs/wx-downloader.js'); 5 | wxDownloader.REMOTE_SERVER_ROOT = ""; 6 | wxDownloader.SUBCONTEXT_ROOT = ""; 7 | require('src/settings'); 8 | require('main'); -------------------------------------------------------------------------------- /build/wechatgame/game.json: -------------------------------------------------------------------------------- 1 | { 2 | "deviceOrientation": "portrait", 3 | "openDataContext": "", 4 | "networkTimeout": { 5 | "request": 5000, 6 | "connectSocket": 5000, 7 | "uploadFile": 5000, 8 | "downloadFile": 5000 9 | } 10 | } -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Audio.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _HTMLAudioElement2 = require('./HTMLAudioElement'); 11 | 12 | var _HTMLAudioElement3 = _interopRequireDefault(_HTMLAudioElement2); 13 | 14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 15 | 16 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 17 | 18 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 19 | 20 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 21 | 22 | var HAVE_NOTHING = 0; 23 | var HAVE_METADATA = 1; 24 | var HAVE_CURRENT_DATA = 2; 25 | var HAVE_FUTURE_DATA = 3; 26 | var HAVE_ENOUGH_DATA = 4; 27 | 28 | var _innerAudioContext = new WeakMap(); 29 | var _src = new WeakMap(); 30 | var _loop = new WeakMap(); 31 | var _autoplay = new WeakMap(); 32 | 33 | var Audio = function (_HTMLAudioElement) { 34 | _inherits(Audio, _HTMLAudioElement); 35 | 36 | function Audio(url) { 37 | _classCallCheck(this, Audio); 38 | 39 | var _this = _possibleConstructorReturn(this, (Audio.__proto__ || Object.getPrototypeOf(Audio)).call(this)); 40 | 41 | _this.HAVE_NOTHING = HAVE_NOTHING; 42 | _this.HAVE_METADATA = HAVE_METADATA; 43 | _this.HAVE_CURRENT_DATA = HAVE_CURRENT_DATA; 44 | _this.HAVE_FUTURE_DATA = HAVE_FUTURE_DATA; 45 | _this.HAVE_ENOUGH_DATA = HAVE_ENOUGH_DATA; 46 | _this.readyState = HAVE_NOTHING; 47 | 48 | 49 | _src.set(_this, ''); 50 | 51 | var innerAudioContext = wx.createInnerAudioContext(); 52 | 53 | _innerAudioContext.set(_this, innerAudioContext); 54 | 55 | innerAudioContext.onCanplay(function () { 56 | _this.dispatchEvent({ type: 'load' }); 57 | _this.dispatchEvent({ type: 'loadend' }); 58 | _this.dispatchEvent({ type: 'canplay' }); 59 | _this.dispatchEvent({ type: 'canplaythrough' }); 60 | _this.dispatchEvent({ type: 'loadedmetadata' }); 61 | _this.readyState = HAVE_CURRENT_DATA; 62 | }); 63 | innerAudioContext.onPlay(function () { 64 | _this._paused = _innerAudioContext.get(_this).paused; 65 | _this.dispatchEvent({ type: 'play' }); 66 | }); 67 | innerAudioContext.onPause(function () { 68 | _this._paused = _innerAudioContext.get(_this).paused; 69 | _this.dispatchEvent({ type: 'pause' }); 70 | }); 71 | innerAudioContext.onEnded(function () { 72 | _this._paused = _innerAudioContext.get(_this).paused; 73 | if (_innerAudioContext.get(_this).loop === false) { 74 | _this.dispatchEvent({ type: 'ended' }); 75 | } 76 | _this.readyState = HAVE_ENOUGH_DATA; 77 | }); 78 | innerAudioContext.onError(function () { 79 | _this._paused = _innerAudioContext.get(_this).paused; 80 | _this.dispatchEvent({ type: 'error' }); 81 | }); 82 | 83 | if (url) { 84 | _innerAudioContext.get(_this).src = url; 85 | } 86 | _this._paused = innerAudioContext.paused; 87 | _this._volume = innerAudioContext.volume; 88 | _this._muted = false; 89 | return _this; 90 | } 91 | 92 | _createClass(Audio, [{ 93 | key: 'load', 94 | value: function load() { 95 | console.warn('HTMLAudioElement.load() is not implemented.'); 96 | } 97 | }, { 98 | key: 'play', 99 | value: function play() { 100 | _innerAudioContext.get(this).play(); 101 | } 102 | }, { 103 | key: 'pause', 104 | value: function pause() { 105 | _innerAudioContext.get(this).pause(); 106 | } 107 | }, { 108 | key: 'destroy', 109 | value: function destroy() { 110 | _innerAudioContext.get(this).destroy(); 111 | } 112 | }, { 113 | key: 'canPlayType', 114 | value: function canPlayType() { 115 | var mediaType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 116 | 117 | if (typeof mediaType !== 'string') { 118 | return ''; 119 | } 120 | 121 | if (mediaType.indexOf('audio/mpeg') > -1 || mediaType.indexOf('audio/mp4')) { 122 | return 'probably'; 123 | } 124 | return ''; 125 | } 126 | }, { 127 | key: 'cloneNode', 128 | value: function cloneNode() { 129 | var newAudio = new Audio(); 130 | newAudio.loop = _innerAudioContext.get(this).loop; 131 | newAudio.autoplay = _innerAudioContext.get(this).autoplay; 132 | newAudio.src = this.src; 133 | return newAudio; 134 | } 135 | }, { 136 | key: 'currentTime', 137 | get: function get() { 138 | return _innerAudioContext.get(this).currentTime; 139 | }, 140 | set: function set(value) { 141 | _innerAudioContext.get(this).seek(value); 142 | } 143 | }, { 144 | key: 'duration', 145 | get: function get() { 146 | return _innerAudioContext.get(this).duration; 147 | } 148 | }, { 149 | key: 'src', 150 | get: function get() { 151 | return _src.get(this); 152 | }, 153 | set: function set(value) { 154 | _src.set(this, value); 155 | _innerAudioContext.get(this).src = value; 156 | } 157 | }, { 158 | key: 'loop', 159 | get: function get() { 160 | return _innerAudioContext.get(this).loop; 161 | }, 162 | set: function set(value) { 163 | _innerAudioContext.get(this).loop = value; 164 | } 165 | }, { 166 | key: 'autoplay', 167 | get: function get() { 168 | return _innerAudioContext.get(this).autoplay; 169 | }, 170 | set: function set(value) { 171 | _innerAudioContext.get(this).autoplay = value; 172 | } 173 | }, { 174 | key: 'paused', 175 | get: function get() { 176 | return this._paused; 177 | } 178 | }, { 179 | key: 'volume', 180 | get: function get() { 181 | return this._volume; 182 | }, 183 | set: function set(value) { 184 | this._volume = value; 185 | if (!this._muted) { 186 | _innerAudioContext.get(this).volume = value; 187 | } 188 | } 189 | }, { 190 | key: 'muted', 191 | get: function get() { 192 | return this._muted; 193 | }, 194 | set: function set(value) { 195 | this._muted = value; 196 | if (value) { 197 | _innerAudioContext.get(this).volume = 0; 198 | } else { 199 | _innerAudioContext.get(this).volume = this._volume; 200 | } 201 | } 202 | }]); 203 | 204 | return Audio; 205 | }(_HTMLAudioElement3.default); 206 | 207 | exports.default = Audio; 208 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Canvas.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = Canvas; 7 | 8 | var _WindowProperties = require('./WindowProperties'); 9 | 10 | var hasModifiedCanvasPrototype = false; // import HTMLCanvasElement from './HTMLCanvasElement' 11 | 12 | var hasInit2DContextConstructor = false; 13 | var hasInitWebGLContextConstructor = false; 14 | 15 | function Canvas() { 16 | var canvas = wx.createCanvas(); 17 | 18 | canvas.type = 'canvas'; 19 | 20 | // canvas.__proto__.__proto__.__proto__ = new HTMLCanvasElement() 21 | 22 | var _getContext = canvas.getContext; 23 | 24 | canvas.getBoundingClientRect = function () { 25 | var ret = { 26 | top: 0, 27 | left: 0, 28 | width: window.innerWidth, 29 | height: window.innerHeight 30 | }; 31 | return ret; 32 | }; 33 | 34 | canvas.style = { 35 | top: '0px', 36 | left: '0px', 37 | width: _WindowProperties.innerWidth + 'px', 38 | height: _WindowProperties.innerHeight + 'px' 39 | }; 40 | 41 | canvas.addEventListener = function (type, listener) { 42 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 43 | 44 | // console.log('canvas.addEventListener', type); 45 | document.addEventListener(type, listener, options); 46 | }; 47 | 48 | canvas.removeEventListener = function (type, listener) { 49 | // console.log('canvas.removeEventListener', type); 50 | document.removeEventListener(type, listener); 51 | }; 52 | 53 | canvas.dispatchEvent = function () { 54 | var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 55 | 56 | console.log('canvas.dispatchEvent', event.type, event); 57 | // nothing to do 58 | }; 59 | 60 | Object.defineProperty(canvas, 'clientWidth', { 61 | enumerable: true, 62 | get: function get() { 63 | return _WindowProperties.innerWidth; 64 | } 65 | }); 66 | 67 | Object.defineProperty(canvas, 'clientHeight', { 68 | enumerable: true, 69 | get: function get() { 70 | return _WindowProperties.innerHeight; 71 | } 72 | }); 73 | 74 | return canvas; 75 | } 76 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Element.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _Node2 = require('./Node'); 9 | 10 | var _Node3 = _interopRequireDefault(_Node2); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 15 | 16 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 17 | 18 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 19 | 20 | var Element = function (_Node) { 21 | _inherits(Element, _Node); 22 | 23 | function Element() { 24 | _classCallCheck(this, Element); 25 | 26 | var _this = _possibleConstructorReturn(this, (Element.__proto__ || Object.getPrototypeOf(Element)).call(this)); 27 | 28 | _this.className = ''; 29 | _this.children = []; 30 | return _this; 31 | } 32 | 33 | return Element; 34 | }(_Node3.default); 35 | 36 | exports.default = Element; 37 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Event.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _util = require('./util'); 9 | 10 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11 | 12 | var Event = function Event(type) { 13 | _classCallCheck(this, Event); 14 | 15 | this.cancelBubble = false; 16 | this.cancelable = false; 17 | this.target = null; 18 | this.timestampe = Date.now(); 19 | this.preventDefault = _util.noop; 20 | this.stopPropagation = _util.noop; 21 | 22 | this.type = type; 23 | }; 24 | 25 | exports.default = Event; 26 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/EventIniter/MouseEvent.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | var MouseEvent = function MouseEvent() { 10 | _classCallCheck(this, MouseEvent); 11 | }; 12 | 13 | exports.default = MouseEvent; 14 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/EventIniter/TouchEvent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _index = require('../util/index.js'); 9 | 10 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 11 | 12 | var TouchEvent = function TouchEvent(type) { 13 | _classCallCheck(this, TouchEvent); 14 | 15 | this.touches = []; 16 | this.targetTouches = []; 17 | this.changedTouches = []; 18 | this.preventDefault = _index.noop; 19 | this.stopPropagation = _index.noop; 20 | 21 | this.type = type; 22 | this.target = window.canvas; 23 | this.currentTarget = window.canvas; 24 | }; 25 | 26 | exports.default = TouchEvent; 27 | 28 | 29 | function touchEventHandlerFactory(type) { 30 | return function (event) { 31 | var touchEvent = new TouchEvent(type); 32 | 33 | touchEvent.touches = event.touches; 34 | touchEvent.targetTouches = Array.prototype.slice.call(event.touches); 35 | touchEvent.changedTouches = event.changedTouches; 36 | touchEvent.timeStamp = event.timeStamp; 37 | document.dispatchEvent(touchEvent); 38 | }; 39 | } 40 | 41 | wx.onTouchStart(touchEventHandlerFactory('touchstart')); 42 | wx.onTouchMove(touchEventHandlerFactory('touchmove')); 43 | wx.onTouchEnd(touchEventHandlerFactory('touchend')); 44 | wx.onTouchCancel(touchEventHandlerFactory('touchcancel')); 45 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/EventIniter/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.MouseEvent = exports.TouchEvent = undefined; 7 | 8 | var _TouchEvent2 = require('./TouchEvent'); 9 | 10 | var _TouchEvent3 = _interopRequireDefault(_TouchEvent2); 11 | 12 | var _MouseEvent2 = require('./MouseEvent'); 13 | 14 | var _MouseEvent3 = _interopRequireDefault(_MouseEvent2); 15 | 16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 17 | 18 | exports.TouchEvent = _TouchEvent3.default; 19 | exports.MouseEvent = _MouseEvent3.default; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/EventTarget.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10 | 11 | var _events = new WeakMap(); 12 | 13 | var EventTarget = function () { 14 | function EventTarget() { 15 | _classCallCheck(this, EventTarget); 16 | 17 | _events.set(this, {}); 18 | } 19 | 20 | _createClass(EventTarget, [{ 21 | key: "addEventListener", 22 | value: function addEventListener(type, listener) { 23 | var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 24 | 25 | var events = _events.get(this); 26 | 27 | if (!events) { 28 | events = {}; 29 | _events.set(this, events); 30 | } 31 | if (!events[type]) { 32 | events[type] = []; 33 | } 34 | events[type].push(listener); 35 | 36 | if (options.capture) { 37 | // console.warn('EventTarget.addEventListener: options.capture is not implemented.') 38 | } 39 | if (options.once) { 40 | // console.warn('EventTarget.addEventListener: options.once is not implemented.') 41 | } 42 | if (options.passive) { 43 | // console.warn('EventTarget.addEventListener: options.passive is not implemented.') 44 | } 45 | } 46 | }, { 47 | key: "removeEventListener", 48 | value: function removeEventListener(type, listener) { 49 | var listeners = _events.get(this)[type]; 50 | 51 | if (listeners && listeners.length > 0) { 52 | for (var i = listeners.length; i--; i > 0) { 53 | if (listeners[i] === listener) { 54 | listeners.splice(i, 1); 55 | break; 56 | } 57 | } 58 | } 59 | } 60 | }, { 61 | key: "dispatchEvent", 62 | value: function dispatchEvent() { 63 | var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 64 | 65 | var listeners = _events.get(this)[event.type]; 66 | 67 | if (listeners) { 68 | for (var i = 0; i < listeners.length; i++) { 69 | listeners[i](event); 70 | } 71 | } 72 | } 73 | }]); 74 | 75 | return EventTarget; 76 | }(); 77 | 78 | exports.default = EventTarget; 79 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/FileReader.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 10 | 11 | /* 12 | * TODO 使用 wx.readFile 来封装 FileReader 13 | */ 14 | var FileReader = function () { 15 | function FileReader() { 16 | _classCallCheck(this, FileReader); 17 | } 18 | 19 | _createClass(FileReader, [{ 20 | key: "construct", 21 | value: function construct() {} 22 | }]); 23 | 24 | return FileReader; 25 | }(); 26 | 27 | exports.default = FileReader; 28 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/HTMLAudioElement.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _HTMLMediaElement2 = require('./HTMLMediaElement'); 9 | 10 | var _HTMLMediaElement3 = _interopRequireDefault(_HTMLMediaElement2); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 15 | 16 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 17 | 18 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 19 | 20 | var HTMLAudioElement = function (_HTMLMediaElement) { 21 | _inherits(HTMLAudioElement, _HTMLMediaElement); 22 | 23 | function HTMLAudioElement() { 24 | _classCallCheck(this, HTMLAudioElement); 25 | 26 | return _possibleConstructorReturn(this, (HTMLAudioElement.__proto__ || Object.getPrototypeOf(HTMLAudioElement)).call(this, 'audio')); 27 | } 28 | 29 | return HTMLAudioElement; 30 | }(_HTMLMediaElement3.default); 31 | 32 | exports.default = HTMLAudioElement; 33 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/HTMLCanvasElement.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _Canvas = require('./Canvas'); 8 | 9 | var _Canvas2 = _interopRequireDefault(_Canvas); 10 | 11 | var _HTMLElement = require('./HTMLElement'); 12 | 13 | var _HTMLElement2 = _interopRequireDefault(_HTMLElement); 14 | 15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 16 | 17 | // import HTMLElement from './HTMLElement'; 18 | 19 | // export default class HTMLCanvasElement extends HTMLElement 20 | // { 21 | // constructor(){ 22 | // super('canvas') 23 | // } 24 | // }; 25 | 26 | GameGlobal.screencanvas = GameGlobal.screencanvas || new _Canvas2.default(); 27 | var canvas = GameGlobal.screencanvas; 28 | 29 | var canvasConstructor = canvas.constructor; 30 | 31 | // canvasConstructor.__proto__.__proto__ = new HTMLElement(); 32 | 33 | exports.default = canvasConstructor; 34 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/HTMLElement.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _Element2 = require('./Element'); 11 | 12 | var _Element3 = _interopRequireDefault(_Element2); 13 | 14 | var _index = require('./util/index.js'); 15 | 16 | var _WindowProperties = require('./WindowProperties'); 17 | 18 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 19 | 20 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 21 | 22 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 23 | 24 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 25 | 26 | var HTMLElement = function (_Element) { 27 | _inherits(HTMLElement, _Element); 28 | 29 | function HTMLElement() { 30 | var tagName = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 31 | 32 | _classCallCheck(this, HTMLElement); 33 | 34 | var _this = _possibleConstructorReturn(this, (HTMLElement.__proto__ || Object.getPrototypeOf(HTMLElement)).call(this)); 35 | 36 | _this.className = ''; 37 | _this.childern = []; 38 | _this.style = { 39 | width: _WindowProperties.innerWidth + 'px', 40 | height: _WindowProperties.innerHeight + 'px' 41 | }; 42 | _this.insertBefore = _index.noop; 43 | _this.innerHTML = ''; 44 | 45 | _this.tagName = tagName.toUpperCase(); 46 | return _this; 47 | } 48 | 49 | _createClass(HTMLElement, [{ 50 | key: 'setAttribute', 51 | value: function setAttribute(name, value) { 52 | this[name] = value; 53 | } 54 | }, { 55 | key: 'getAttribute', 56 | value: function getAttribute(name) { 57 | return this[name]; 58 | } 59 | }, { 60 | key: 'getBoundingClientRect', 61 | value: function getBoundingClientRect() { 62 | return { 63 | top: 0, 64 | left: 0, 65 | width: _WindowProperties.innerWidth, 66 | height: _WindowProperties.innerHeight 67 | }; 68 | } 69 | }, { 70 | key: 'focus', 71 | value: function focus() {} 72 | }, { 73 | key: 'clientWidth', 74 | get: function get() { 75 | var ret = parseInt(this.style.fontSize, 10) * this.innerHTML.length; 76 | 77 | return Number.isNaN(ret) ? 0 : ret; 78 | } 79 | }, { 80 | key: 'clientHeight', 81 | get: function get() { 82 | var ret = parseInt(this.style.fontSize, 10); 83 | 84 | return Number.isNaN(ret) ? 0 : ret; 85 | } 86 | }]); 87 | 88 | return HTMLElement; 89 | }(_Element3.default); 90 | 91 | exports.default = HTMLElement; 92 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/HTMLImageElement.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _HTMLElement = require('./HTMLElement'); 8 | 9 | var _HTMLElement2 = _interopRequireDefault(_HTMLElement); 10 | 11 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 12 | 13 | var imageConstructor = wx.createImage().constructor; 14 | 15 | // imageConstructor.__proto__.__proto__ = new HTMLElement(); 16 | 17 | // import HTMLElement from './HTMLElement'; 18 | 19 | // export default class HTMLImageElement extends HTMLElement 20 | // { 21 | // constructor(){ 22 | // super('img') 23 | // } 24 | // }; 25 | 26 | exports.default = imageConstructor; 27 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/HTMLMediaElement.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _HTMLElement2 = require('./HTMLElement'); 11 | 12 | var _HTMLElement3 = _interopRequireDefault(_HTMLElement2); 13 | 14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 15 | 16 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 17 | 18 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 19 | 20 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 21 | 22 | var HTMLMediaElement = function (_HTMLElement) { 23 | _inherits(HTMLMediaElement, _HTMLElement); 24 | 25 | function HTMLMediaElement(type) { 26 | _classCallCheck(this, HTMLMediaElement); 27 | 28 | return _possibleConstructorReturn(this, (HTMLMediaElement.__proto__ || Object.getPrototypeOf(HTMLMediaElement)).call(this, type)); 29 | } 30 | 31 | _createClass(HTMLMediaElement, [{ 32 | key: 'addTextTrack', 33 | value: function addTextTrack() {} 34 | }, { 35 | key: 'captureStream', 36 | value: function captureStream() {} 37 | }, { 38 | key: 'fastSeek', 39 | value: function fastSeek() {} 40 | }, { 41 | key: 'load', 42 | value: function load() {} 43 | }, { 44 | key: 'pause', 45 | value: function pause() {} 46 | }, { 47 | key: 'play', 48 | value: function play() {} 49 | }]); 50 | 51 | return HTMLMediaElement; 52 | }(_HTMLElement3.default); 53 | 54 | exports.default = HTMLMediaElement; 55 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/HTMLVideoElement.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _HTMLMediaElement2 = require('./HTMLMediaElement'); 9 | 10 | var _HTMLMediaElement3 = _interopRequireDefault(_HTMLMediaElement2); 11 | 12 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 13 | 14 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 15 | 16 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 17 | 18 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 19 | 20 | var HTMLVideoElement = function (_HTMLMediaElement) { 21 | _inherits(HTMLVideoElement, _HTMLMediaElement); 22 | 23 | function HTMLVideoElement() { 24 | _classCallCheck(this, HTMLVideoElement); 25 | 26 | return _possibleConstructorReturn(this, (HTMLVideoElement.__proto__ || Object.getPrototypeOf(HTMLVideoElement)).call(this, 'video')); 27 | } 28 | 29 | return HTMLVideoElement; 30 | }(_HTMLMediaElement3.default); 31 | 32 | exports.default = HTMLVideoElement; 33 | ; 34 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Image.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | exports.default = function () { 8 | var image = wx.createImage(); 9 | 10 | // image.__proto__.__proto__.__proto__ = new HTMLImageElement(); 11 | 12 | return image; 13 | }; 14 | 15 | var _HTMLImageElement = require('./HTMLImageElement'); 16 | 17 | var _HTMLImageElement2 = _interopRequireDefault(_HTMLImageElement); 18 | 19 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 20 | 21 | ; 22 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/ImageBitmap.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | var ImageBitmap = function ImageBitmap() { 10 | // TODO 11 | 12 | _classCallCheck(this, ImageBitmap); 13 | }; 14 | 15 | exports.default = ImageBitmap; 16 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Node.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _EventTarget2 = require('./EventTarget.js'); 11 | 12 | var _EventTarget3 = _interopRequireDefault(_EventTarget2); 13 | 14 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 15 | 16 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 17 | 18 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 19 | 20 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 21 | 22 | var Node = function (_EventTarget) { 23 | _inherits(Node, _EventTarget); 24 | 25 | function Node() { 26 | _classCallCheck(this, Node); 27 | 28 | var _this = _possibleConstructorReturn(this, (Node.__proto__ || Object.getPrototypeOf(Node)).call(this)); 29 | 30 | _this.childNodes = []; 31 | return _this; 32 | } 33 | 34 | _createClass(Node, [{ 35 | key: 'appendChild', 36 | value: function appendChild(node) { 37 | this.childNodes.push(node); 38 | // if (node instanceof Node) { 39 | // this.childNodes.push(node) 40 | // } else { 41 | // throw new TypeError('Failed to executed \'appendChild\' on \'Node\': parameter 1 is not of type \'Node\'.') 42 | // } 43 | } 44 | }, { 45 | key: 'cloneNode', 46 | value: function cloneNode() { 47 | var copyNode = Object.create(this); 48 | 49 | Object.assign(copyNode, this); 50 | return copyNode; 51 | } 52 | }, { 53 | key: 'removeChild', 54 | value: function removeChild(node) { 55 | var index = this.childNodes.findIndex(function (child) { 56 | return child === node; 57 | }); 58 | 59 | if (index > -1) { 60 | return this.childNodes.splice(index, 1); 61 | } 62 | return null; 63 | } 64 | }]); 65 | 66 | return Node; 67 | }(_EventTarget3.default); 68 | 69 | exports.default = Node; 70 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/WebGLRenderingContext.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 8 | 9 | var WebGLRenderingContext = function WebGLRenderingContext() { 10 | // TODO 11 | 12 | _classCallCheck(this, WebGLRenderingContext); 13 | }; 14 | 15 | exports.default = WebGLRenderingContext; 16 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/WebSocket.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 8 | 9 | var _class, _temp; 10 | 11 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12 | 13 | var _socketTask = new WeakMap(); 14 | 15 | var WebSocket = (_temp = _class = function () { 16 | // TODO 更新 binaryType 17 | // The connection is in the process of closing. 18 | // The connection is not yet open. 19 | function WebSocket(url) { 20 | var _this = this; 21 | 22 | var protocols = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; 23 | 24 | _classCallCheck(this, WebSocket); 25 | 26 | this.binaryType = ''; 27 | this.bufferedAmount = 0; 28 | this.extensions = ''; 29 | this.onclose = null; 30 | this.onerror = null; 31 | this.onmessage = null; 32 | this.onopen = null; 33 | this.protocol = ''; 34 | this.readyState = 3; 35 | 36 | if (typeof url !== 'string' || !/(^ws:\/\/)|(^wss:\/\/)/.test(url)) { 37 | throw new TypeError('Failed to construct \'WebSocket\': The URL \'' + url + '\' is invalid'); 38 | } 39 | 40 | this.url = url; 41 | this.readyState = WebSocket.CONNECTING; 42 | 43 | var socketTask = wx.connectSocket({ 44 | url: url, 45 | protocols: Array.isArray(protocols) ? protocols : [protocols] 46 | }); 47 | 48 | _socketTask.set(this, socketTask); 49 | 50 | socketTask.onClose(function (res) { 51 | _this.readyState = WebSocket.CLOSED; 52 | if (typeof _this.onclose === 'function') { 53 | _this.onclose(res); 54 | } 55 | }); 56 | 57 | socketTask.onMessage(function (res) { 58 | if (typeof _this.onmessage === 'function') { 59 | _this.onmessage(res); 60 | } 61 | }); 62 | 63 | socketTask.onOpen(function () { 64 | _this.readyState = WebSocket.OPEN; 65 | if (typeof _this.onopen === 'function') { 66 | _this.onopen(); 67 | } 68 | }); 69 | 70 | socketTask.onError(function (res) { 71 | if (typeof _this.onerror === 'function') { 72 | _this.onerror(new Error(res.errMsg)); 73 | } 74 | }); 75 | 76 | return this; 77 | } // TODO 小程序内目前获取不到,实际上需要根据服务器选择的 sub-protocol 返回 78 | // TODO 更新 bufferedAmount 79 | // The connection is closed or couldn't be opened. 80 | 81 | // The connection is open and ready to communicate. 82 | 83 | 84 | _createClass(WebSocket, [{ 85 | key: 'close', 86 | value: function close(code, reason) { 87 | this.readyState = WebSocket.CLOSING; 88 | var socketTask = _socketTask.get(this); 89 | 90 | socketTask.close({ 91 | code: code, 92 | reason: reason 93 | }); 94 | } 95 | }, { 96 | key: 'send', 97 | value: function send(data) { 98 | if (typeof data !== 'string' && !(data instanceof ArrayBuffer)) { 99 | throw new TypeError('Failed to send message: The data ' + data + ' is invalid'); 100 | } 101 | 102 | var socketTask = _socketTask.get(this); 103 | 104 | socketTask.send({ 105 | data: data 106 | }); 107 | } 108 | }]); 109 | 110 | return WebSocket; 111 | }(), _class.CONNECTING = 0, _class.OPEN = 1, _class.CLOSING = 2, _class.CLOSED = 3, _temp); 112 | exports.default = WebSocket; 113 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/WindowProperties.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _wx$getSystemInfoSync = wx.getSystemInfoSync(), 8 | screenWidth = _wx$getSystemInfoSync.screenWidth, 9 | screenHeight = _wx$getSystemInfoSync.screenHeight, 10 | devicePixelRatio = _wx$getSystemInfoSync.devicePixelRatio; 11 | 12 | var innerWidth = exports.innerWidth = screenWidth; 13 | var innerHeight = exports.innerHeight = screenHeight; 14 | exports.devicePixelRatio = devicePixelRatio; 15 | var screen = exports.screen = { 16 | width: screenWidth, 17 | height: screenHeight, 18 | availWidth: innerWidth, 19 | availHeight: innerHeight, 20 | availLeft: 0, 21 | availTop: 0 22 | }; 23 | 24 | var performance = wx.getPerformance ? wx.getPerformance() : {}; 25 | performance.now = Date.now; 26 | 27 | var ontouchstart = exports.ontouchstart = null; 28 | var ontouchmove = exports.ontouchmove = null; 29 | var ontouchend = exports.ontouchend = null; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/Worker.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | exports.default = function (file) { 8 | var worker = wx.createWorker(file); 9 | 10 | return worker; 11 | }; 12 | 13 | ; 14 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/XMLHttpRequest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.default = undefined; 7 | 8 | var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 9 | 10 | var _class, _temp; 11 | 12 | var _EventTarget2 = require('./EventTarget.js'); 13 | 14 | var _EventTarget3 = _interopRequireDefault(_EventTarget2); 15 | 16 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 17 | 18 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 19 | 20 | function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 21 | 22 | function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 23 | 24 | var _url = new WeakMap(); 25 | var _method = new WeakMap(); 26 | var _requestHeader = new WeakMap(); 27 | var _responseHeader = new WeakMap(); 28 | var _requestTask = new WeakMap(); 29 | 30 | function _triggerEvent(type) { 31 | if (typeof this['on' + type] === 'function') { 32 | for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 33 | args[_key - 1] = arguments[_key]; 34 | } 35 | 36 | this['on' + type].apply(this, args); 37 | } 38 | } 39 | 40 | function _changeReadyState(readyState) { 41 | this.readyState = readyState; 42 | _triggerEvent.call(this, 'readystatechange'); 43 | } 44 | 45 | var XMLHttpRequest = (_temp = _class = function (_EventTarget) { 46 | _inherits(XMLHttpRequest, _EventTarget); 47 | 48 | // TODO 没法模拟 HEADERS_RECEIVED 和 LOADING 两个状态 49 | function XMLHttpRequest() { 50 | _classCallCheck(this, XMLHttpRequest); 51 | 52 | var _this2 = _possibleConstructorReturn(this, (XMLHttpRequest.__proto__ || Object.getPrototypeOf(XMLHttpRequest)).call(this)); 53 | 54 | _this2.onabort = null; 55 | _this2.onerror = null; 56 | _this2.onload = null; 57 | _this2.onloadstart = null; 58 | _this2.onprogress = null; 59 | _this2.ontimeout = null; 60 | _this2.onloadend = null; 61 | _this2.onreadystatechange = null; 62 | _this2.readyState = 0; 63 | _this2.response = null; 64 | _this2.responseText = null; 65 | _this2.responseType = ''; 66 | _this2.responseXML = null; 67 | _this2.status = 0; 68 | _this2.statusText = ''; 69 | _this2.upload = {}; 70 | _this2.withCredentials = false; 71 | 72 | 73 | _requestHeader.set(_this2, { 74 | 'content-type': 'application/x-www-form-urlencoded' 75 | }); 76 | _responseHeader.set(_this2, {}); 77 | return _this2; 78 | } 79 | 80 | /* 81 | * TODO 这一批事件应该是在 XMLHttpRequestEventTarget.prototype 上面的 82 | */ 83 | 84 | 85 | _createClass(XMLHttpRequest, [{ 86 | key: 'abort', 87 | value: function abort() { 88 | var myRequestTask = _requestTask.get(this); 89 | 90 | if (myRequestTask) { 91 | myRequestTask.abort(); 92 | } 93 | } 94 | }, { 95 | key: 'getAllResponseHeaders', 96 | value: function getAllResponseHeaders() { 97 | var responseHeader = _responseHeader.get(this); 98 | 99 | return Object.keys(responseHeader).map(function (header) { 100 | return header + ': ' + responseHeader[header]; 101 | }).join('\n'); 102 | } 103 | }, { 104 | key: 'getResponseHeader', 105 | value: function getResponseHeader(header) { 106 | return _responseHeader.get(this)[header]; 107 | } 108 | }, { 109 | key: 'open', 110 | value: function open(method, url /* async, user, password 这几个参数在小程序内不支持*/) { 111 | _method.set(this, method); 112 | _url.set(this, url); 113 | _changeReadyState.call(this, XMLHttpRequest.OPENED); 114 | } 115 | }, { 116 | key: 'overrideMimeType', 117 | value: function overrideMimeType() {} 118 | }, { 119 | key: 'send', 120 | value: function send() { 121 | var _this3 = this; 122 | 123 | var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; 124 | 125 | if (this.readyState !== XMLHttpRequest.OPENED) { 126 | throw new Error("Failed to execute 'send' on 'XMLHttpRequest': The object's state must be OPENED."); 127 | } else { 128 | wx.request({ 129 | data: data, 130 | url: _url.get(this), 131 | method: _method.get(this), 132 | header: _requestHeader.get(this), 133 | responseType: this.responseType, 134 | success: function success(_ref) { 135 | var data = _ref.data, 136 | statusCode = _ref.statusCode, 137 | header = _ref.header; 138 | 139 | if (typeof data !== 'string' && !(data instanceof ArrayBuffer)) { 140 | try { 141 | data = JSON.stringify(data); 142 | } catch (e) { 143 | data = data; 144 | } 145 | } 146 | 147 | _this3.status = statusCode; 148 | _responseHeader.set(_this3, header); 149 | _triggerEvent.call(_this3, 'loadstart'); 150 | _changeReadyState.call(_this3, XMLHttpRequest.HEADERS_RECEIVED); 151 | _changeReadyState.call(_this3, XMLHttpRequest.LOADING); 152 | 153 | _this3.response = data; 154 | 155 | if (data instanceof ArrayBuffer) { 156 | _this3.responseText = ''; 157 | var bytes = new Uint8Array(data); 158 | var len = bytes.byteLength; 159 | 160 | for (var i = 0; i < len; i++) { 161 | _this3.responseText += String.fromCharCode(bytes[i]); 162 | } 163 | } else { 164 | _this3.responseText = data; 165 | } 166 | _changeReadyState.call(_this3, XMLHttpRequest.DONE); 167 | _triggerEvent.call(_this3, 'load'); 168 | _triggerEvent.call(_this3, 'loadend'); 169 | }, 170 | fail: function fail(_ref2) { 171 | var errMsg = _ref2.errMsg; 172 | 173 | // TODO 规范错误 174 | if (errMsg.indexOf('abort') !== -1) { 175 | _triggerEvent.call(_this3, 'abort'); 176 | } else { 177 | _triggerEvent.call(_this3, 'error', errMsg); 178 | } 179 | _triggerEvent.call(_this3, 'loadend'); 180 | } 181 | }); 182 | } 183 | } 184 | }, { 185 | key: 'setRequestHeader', 186 | value: function setRequestHeader(header, value) { 187 | var myHeader = _requestHeader.get(this); 188 | 189 | myHeader[header] = value; 190 | _requestHeader.set(this, myHeader); 191 | } 192 | }, { 193 | key: 'addEventListener', 194 | value: function addEventListener(type, listener) { 195 | if (typeof listener === 'function') { 196 | var _this = this; 197 | var event = { target: _this }; 198 | this['on' + type] = function (event) { 199 | listener.call(_this, event); 200 | }; 201 | } 202 | } 203 | }]); 204 | 205 | return XMLHttpRequest; 206 | }(_EventTarget3.default), _class.UNSEND = 0, _class.OPENED = 1, _class.HEADERS_RECEIVED = 2, _class.LOADING = 3, _class.DONE = 4, _temp); 207 | exports.default = XMLHttpRequest; 208 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/document.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _window = require('./window'); 8 | 9 | var window = _interopRequireWildcard(_window); 10 | 11 | var _HTMLElement = require('./HTMLElement'); 12 | 13 | var _HTMLElement2 = _interopRequireDefault(_HTMLElement); 14 | 15 | var _HTMLVideoElement = require('./HTMLVideoElement'); 16 | 17 | var _HTMLVideoElement2 = _interopRequireDefault(_HTMLVideoElement); 18 | 19 | var _Image = require('./Image'); 20 | 21 | var _Image2 = _interopRequireDefault(_Image); 22 | 23 | var _Audio = require('./Audio'); 24 | 25 | var _Audio2 = _interopRequireDefault(_Audio); 26 | 27 | var _Canvas = require('./Canvas'); 28 | 29 | var _Canvas2 = _interopRequireDefault(_Canvas); 30 | 31 | require('./EventIniter/index.js'); 32 | 33 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 34 | 35 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 36 | 37 | var events = {}; 38 | 39 | var document = { 40 | readyState: 'complete', 41 | visibilityState: 'visible', 42 | documentElement: window, 43 | hidden: false, 44 | style: {}, 45 | location: window.location, 46 | ontouchstart: null, 47 | ontouchmove: null, 48 | ontouchend: null, 49 | 50 | head: new _HTMLElement2.default('head'), 51 | body: new _HTMLElement2.default('body'), 52 | 53 | createElement: function createElement(tagName) { 54 | if (tagName === 'canvas') { 55 | return new _Canvas2.default(); 56 | } else if (tagName === 'audio') { 57 | return new _Audio2.default(); 58 | } else if (tagName === 'img') { 59 | return new _Image2.default(); 60 | } else if (tagName === 'video') { 61 | return new _HTMLVideoElement2.default(); 62 | } 63 | 64 | return new _HTMLElement2.default(tagName); 65 | }, 66 | createElementNS: function createElementNS(nameSpace, tagName) { 67 | return this.createElement(tagName); 68 | }, 69 | getElementById: function getElementById(id) { 70 | if (id === window.canvas.id) { 71 | return window.canvas; 72 | } 73 | return null; 74 | }, 75 | getElementsByTagName: function getElementsByTagName(tagName) { 76 | if (tagName === 'head') { 77 | return [document.head]; 78 | } else if (tagName === 'body') { 79 | return [document.body]; 80 | } else if (tagName === 'canvas') { 81 | return [window.canvas]; 82 | } 83 | return []; 84 | }, 85 | getElementsByName: function getElementsByName(tagName) { 86 | if (tagName === 'head') { 87 | return [document.head]; 88 | } else if (tagName === 'body') { 89 | return [document.body]; 90 | } else if (tagName === 'canvas') { 91 | return [window.canvas]; 92 | } 93 | return []; 94 | }, 95 | querySelector: function querySelector(query) { 96 | if (query === 'head') { 97 | return document.head; 98 | } else if (query === 'body') { 99 | return document.body; 100 | } else if (query === 'canvas') { 101 | return window.canvas; 102 | } else if (query === '#' + window.canvas.id) { 103 | return window.canvas; 104 | } 105 | return null; 106 | }, 107 | querySelectorAll: function querySelectorAll(query) { 108 | if (query === 'head') { 109 | return [document.head]; 110 | } else if (query === 'body') { 111 | return [document.body]; 112 | } else if (query === 'canvas') { 113 | return [window.canvas]; 114 | } 115 | return []; 116 | }, 117 | addEventListener: function addEventListener(type, listener) { 118 | if (!events[type]) { 119 | events[type] = []; 120 | } 121 | events[type].push(listener); 122 | }, 123 | removeEventListener: function removeEventListener(type, listener) { 124 | var listeners = events[type]; 125 | 126 | if (listeners && listeners.length > 0) { 127 | for (var i = listeners.length; i--; i > 0) { 128 | if (listeners[i] === listener) { 129 | listeners.splice(i, 1); 130 | break; 131 | } 132 | } 133 | } 134 | }, 135 | dispatchEvent: function dispatchEvent(event) { 136 | var listeners = events[event.type]; 137 | 138 | if (listeners) { 139 | for (var i = 0; i < listeners.length; i++) { 140 | listeners[i](event); 141 | } 142 | } 143 | } 144 | }; 145 | 146 | exports.default = document; 147 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/engine/DeviceMotionEvent.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4 | 5 | var DeviceMotionEvent = function DeviceMotionEvent() { 6 | _classCallCheck(this, DeviceMotionEvent); 7 | 8 | this.type = 'devicemotion'; 9 | this.accelerationIncludingGravity = null; 10 | }; 11 | 12 | var registerFunc = _cc.inputManager._registerAccelerometerEvent.bind(_cc.inputManager); 13 | _cc.inputManager._registerAccelerometerEvent = function () { 14 | // register engine AccelerationEventListener to get acceleration data from wx 15 | registerFunc(); 16 | 17 | wx.onAccelerometerChange && wx.onAccelerometerChange(function (res) { 18 | var deviceMotionEvent = new DeviceMotionEvent(); 19 | var resCpy = {}; 20 | resCpy.x = res.x; 21 | resCpy.y = res.y; 22 | resCpy.z = res.z; 23 | 24 | var gravityFactor = 10; 25 | var systemInfo = wx.getSystemInfoSync(); 26 | var windowWidth = systemInfo.windowWidth; 27 | var windowHeight = systemInfo.windowHeight; 28 | if (windowHeight < windowWidth) { 29 | // landscape view 30 | var tmp = resCpy.x; 31 | resCpy.x = resCpy.y; 32 | resCpy.y = tmp; 33 | 34 | resCpy.x *= gravityFactor; 35 | resCpy.y *= -gravityFactor; 36 | 37 | // TODO adjust x y axis when the view flips upside down 38 | } else { 39 | // portrait view 40 | resCpy.x *= -gravityFactor; 41 | resCpy.y *= -gravityFactor; 42 | } 43 | deviceMotionEvent.accelerationIncludingGravity = resCpy; 44 | 45 | document.dispatchEvent(deviceMotionEvent); 46 | }); 47 | }; 48 | 49 | var unregisterFunc = _cc.inputManager._unregisterAccelerometerEvent.bind(_cc.inputManager); 50 | _cc.inputManager._unregisterAccelerometerEvent = function () { 51 | // unregister engine AccelerationEventListener 52 | unregisterFunc(); 53 | 54 | wx.stopAccelerometer && wx.stopAccelerometer({ 55 | fail: function fail() { 56 | cc.error('unregister AccelerometerEvent failed !'); 57 | }, 58 | success: function success() {}, 59 | complete: function complete() {} 60 | }); 61 | }; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/engine/downloader.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | cc.loader.downloader.loadSubpackage = function (name, completeCallback) { 4 | wx.loadSubpackage({ 5 | name: name, 6 | success: function success() { 7 | if (completeCallback) completeCallback(); 8 | }, 9 | fail: function fail() { 10 | if (completeCallback) completeCallback(new Error("Failed to load subpackage " + name)); 11 | } 12 | }); 13 | }; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/engine/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | require('./DeviceMotionEvent'); 4 | require('./downloader'); -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var _window2 = require('./window'); 4 | 5 | var _window = _interopRequireWildcard(_window2); 6 | 7 | var _document = require('./document'); 8 | 9 | var _document2 = _interopRequireDefault(_document); 10 | 11 | var _HTMLElement = require('./HTMLElement'); 12 | 13 | var _HTMLElement2 = _interopRequireDefault(_HTMLElement); 14 | 15 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 16 | 17 | function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } 18 | 19 | var global = GameGlobal; 20 | 21 | function inject() { 22 | _window.document = _document2.default; 23 | 24 | _window.addEventListener = function (type, listener) { 25 | _window.document.addEventListener(type, listener); 26 | }; 27 | _window.removeEventListener = function (type, listener) { 28 | _window.document.removeEventListener(type, listener); 29 | }; 30 | _window.dispatchEvent = function () { 31 | var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 32 | 33 | console.log('window.dispatchEvent', event.type, event); 34 | // nothing to do 35 | }; 36 | 37 | var _wx$getSystemInfoSync = wx.getSystemInfoSync(), 38 | platform = _wx$getSystemInfoSync.platform; 39 | 40 | // 开发者工具无法重定义 window 41 | 42 | 43 | if (typeof __devtoolssubcontext === 'undefined' && platform === 'devtools') { 44 | for (var key in _window) { 45 | var descriptor = Object.getOwnPropertyDescriptor(global, key); 46 | 47 | if (!descriptor || descriptor.configurable === true) { 48 | Object.defineProperty(window, key, { 49 | value: _window[key] 50 | }); 51 | } 52 | } 53 | 54 | for (var _key in _window.document) { 55 | var _descriptor = Object.getOwnPropertyDescriptor(global.document, _key); 56 | 57 | if (!_descriptor || _descriptor.configurable === true) { 58 | Object.defineProperty(global.document, _key, { 59 | value: _window.document[_key] 60 | }); 61 | } 62 | } 63 | window.parent = window; 64 | } else { 65 | for (var _key2 in _window) { 66 | global[_key2] = _window[_key2]; 67 | } 68 | global.window = _window; 69 | window = global; 70 | window.top = window.parent = window; 71 | } 72 | } 73 | 74 | if (!GameGlobal.__isAdapterInjected) { 75 | GameGlobal.__isAdapterInjected = true; 76 | inject(); 77 | } -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/localStorage.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var localStorage = { 7 | get length() { 8 | var _wx$getStorageInfoSyn = wx.getStorageInfoSync(), 9 | keys = _wx$getStorageInfoSyn.keys; 10 | 11 | return keys.length; 12 | }, 13 | 14 | key: function key(n) { 15 | var _wx$getStorageInfoSyn2 = wx.getStorageInfoSync(), 16 | keys = _wx$getStorageInfoSyn2.keys; 17 | 18 | return keys[n]; 19 | }, 20 | getItem: function getItem(key) { 21 | return wx.getStorageSync(key); 22 | }, 23 | setItem: function setItem(key, value) { 24 | return wx.setStorageSync(key, value); 25 | }, 26 | removeItem: function removeItem(key) { 27 | wx.removeStorageSync(key); 28 | }, 29 | clear: function clear() { 30 | wx.clearStorageSync(); 31 | } 32 | }; 33 | 34 | exports.default = localStorage; 35 | module.exports = exports["default"]; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/location.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | var location = { 7 | href: 'game.js', 8 | reload: function reload() {} 9 | }; 10 | 11 | exports.default = location; 12 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/navigator.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _index = require('./util/index.js'); 8 | 9 | // TODO 需要 wx.getSystemInfo 获取更详细信息 10 | var systemInfo = wx.getSystemInfoSync(); 11 | console.log(systemInfo); 12 | 13 | var system = systemInfo.system; 14 | var platform = systemInfo.platform; 15 | var language = systemInfo.language; 16 | 17 | var android = system.toLowerCase().indexOf('android') !== -1; 18 | 19 | var uaDesc = android ? 'Android; CPU Android 6.0' : 'iPhone; CPU iPhone OS 10_3_1 like Mac OS X'; 20 | var ua = 'Mozilla/5.0 (' + uaDesc + ') AppleWebKit/603.1.30 (KHTML, like Gecko) Mobile/14E8301 MicroMessenger/6.6.0 MiniGame NetType/WIFI Language/' + language; 21 | 22 | var navigator = { 23 | platform: platform, 24 | language: language, 25 | appVersion: '5.0 (' + uaDesc + ') AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13B143 Safari/601.1', 26 | userAgent: ua, 27 | onLine: true, // TODO 用 wx.getNetworkStateChange 和 wx.onNetworkStateChange 来返回真实的状态 28 | 29 | // TODO 用 wx.getLocation 来封装 geolocation 30 | geolocation: { 31 | getCurrentPosition: _index.noop, 32 | watchPosition: _index.noop, 33 | clearWatch: _index.noop 34 | } 35 | }; 36 | 37 | if (wx.onNetworkStatusChange) { 38 | wx.onNetworkStatusChange(function (event) { 39 | navigator.onLine = event.isConnected; 40 | }); 41 | } 42 | 43 | exports.default = navigator; 44 | module.exports = exports['default']; -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/util/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.noop = noop; 7 | function noop() {} -------------------------------------------------------------------------------- /build/wechatgame/libs/weapp-adapter/window.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | exports.cancelAnimationFrame = exports.requestAnimationFrame = exports.clearInterval = exports.clearTimeout = exports.setInterval = exports.setTimeout = exports.canvas = exports.location = exports.localStorage = exports.DeviceMotionEvent = exports.MouseEvent = exports.TouchEvent = exports.WebGLRenderingContext = exports.HTMLVideoElement = exports.HTMLAudioElement = exports.HTMLMediaElement = exports.HTMLCanvasElement = exports.HTMLImageElement = exports.HTMLElement = exports.FileReader = exports.Audio = exports.ImageBitmap = exports.Image = exports.WebSocket = exports.XMLHttpRequest = exports.navigator = undefined; 7 | 8 | var _index = require('./EventIniter/index.js'); 9 | 10 | Object.defineProperty(exports, 'TouchEvent', { 11 | enumerable: true, 12 | get: function get() { 13 | return _index.TouchEvent; 14 | } 15 | }); 16 | Object.defineProperty(exports, 'MouseEvent', { 17 | enumerable: true, 18 | get: function get() { 19 | return _index.MouseEvent; 20 | } 21 | }); 22 | Object.defineProperty(exports, 'DeviceMotionEvent', { 23 | enumerable: true, 24 | get: function get() { 25 | return _index.DeviceMotionEvent; 26 | } 27 | }); 28 | 29 | var _WindowProperties = require('./WindowProperties'); 30 | 31 | Object.keys(_WindowProperties).forEach(function (key) { 32 | if (key === "default" || key === "__esModule") return; 33 | Object.defineProperty(exports, key, { 34 | enumerable: true, 35 | get: function get() { 36 | return _WindowProperties[key]; 37 | } 38 | }); 39 | }); 40 | 41 | var _Canvas = require('./Canvas'); 42 | 43 | var _Canvas2 = _interopRequireDefault(_Canvas); 44 | 45 | var _navigator2 = require('./navigator'); 46 | 47 | var _navigator3 = _interopRequireDefault(_navigator2); 48 | 49 | var _XMLHttpRequest2 = require('./XMLHttpRequest'); 50 | 51 | var _XMLHttpRequest3 = _interopRequireDefault(_XMLHttpRequest2); 52 | 53 | var _WebSocket2 = require('./WebSocket'); 54 | 55 | var _WebSocket3 = _interopRequireDefault(_WebSocket2); 56 | 57 | var _Image2 = require('./Image'); 58 | 59 | var _Image3 = _interopRequireDefault(_Image2); 60 | 61 | var _ImageBitmap2 = require('./ImageBitmap'); 62 | 63 | var _ImageBitmap3 = _interopRequireDefault(_ImageBitmap2); 64 | 65 | var _Audio2 = require('./Audio'); 66 | 67 | var _Audio3 = _interopRequireDefault(_Audio2); 68 | 69 | var _FileReader2 = require('./FileReader'); 70 | 71 | var _FileReader3 = _interopRequireDefault(_FileReader2); 72 | 73 | var _HTMLElement2 = require('./HTMLElement'); 74 | 75 | var _HTMLElement3 = _interopRequireDefault(_HTMLElement2); 76 | 77 | var _HTMLImageElement2 = require('./HTMLImageElement'); 78 | 79 | var _HTMLImageElement3 = _interopRequireDefault(_HTMLImageElement2); 80 | 81 | var _HTMLCanvasElement2 = require('./HTMLCanvasElement'); 82 | 83 | var _HTMLCanvasElement3 = _interopRequireDefault(_HTMLCanvasElement2); 84 | 85 | var _HTMLMediaElement2 = require('./HTMLMediaElement'); 86 | 87 | var _HTMLMediaElement3 = _interopRequireDefault(_HTMLMediaElement2); 88 | 89 | var _HTMLAudioElement2 = require('./HTMLAudioElement'); 90 | 91 | var _HTMLAudioElement3 = _interopRequireDefault(_HTMLAudioElement2); 92 | 93 | var _HTMLVideoElement2 = require('./HTMLVideoElement'); 94 | 95 | var _HTMLVideoElement3 = _interopRequireDefault(_HTMLVideoElement2); 96 | 97 | var _WebGLRenderingContext2 = require('./WebGLRenderingContext'); 98 | 99 | var _WebGLRenderingContext3 = _interopRequireDefault(_WebGLRenderingContext2); 100 | 101 | var _localStorage2 = require('./localStorage'); 102 | 103 | var _localStorage3 = _interopRequireDefault(_localStorage2); 104 | 105 | var _location2 = require('./location'); 106 | 107 | var _location3 = _interopRequireDefault(_location2); 108 | 109 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 110 | 111 | exports.navigator = _navigator3.default; 112 | exports.XMLHttpRequest = _XMLHttpRequest3.default; 113 | exports.WebSocket = _WebSocket3.default; 114 | exports.Image = _Image3.default; 115 | exports.ImageBitmap = _ImageBitmap3.default; 116 | exports.Audio = _Audio3.default; 117 | exports.FileReader = _FileReader3.default; 118 | exports.HTMLElement = _HTMLElement3.default; 119 | exports.HTMLImageElement = _HTMLImageElement3.default; 120 | exports.HTMLCanvasElement = _HTMLCanvasElement3.default; 121 | exports.HTMLMediaElement = _HTMLMediaElement3.default; 122 | exports.HTMLAudioElement = _HTMLAudioElement3.default; 123 | exports.HTMLVideoElement = _HTMLVideoElement3.default; 124 | exports.WebGLRenderingContext = _WebGLRenderingContext3.default; 125 | exports.localStorage = _localStorage3.default; 126 | exports.location = _location3.default; 127 | 128 | 129 | // 暴露全局的 canvas 130 | GameGlobal.screencanvas = GameGlobal.screencanvas || new _Canvas2.default(); 131 | var canvas = GameGlobal.screencanvas; 132 | 133 | exports.canvas = canvas; 134 | exports.setTimeout = setTimeout; 135 | exports.setInterval = setInterval; 136 | exports.clearTimeout = clearTimeout; 137 | exports.clearInterval = clearInterval; 138 | exports.requestAnimationFrame = requestAnimationFrame; 139 | exports.cancelAnimationFrame = cancelAnimationFrame; -------------------------------------------------------------------------------- /build/wechatgame/libs/xmldom/dom-parser.js: -------------------------------------------------------------------------------- 1 | function DOMParser(options){ 2 | this.options = options ||{locator:{}}; 3 | 4 | } 5 | 6 | DOMParser.prototype.parseFromString = function(source,mimeType){ 7 | var options = this.options; 8 | var sax = new XMLReader(); 9 | var domBuilder = options.domBuilder || new DOMHandler();//contentHandler and LexicalHandler 10 | var errorHandler = options.errorHandler; 11 | var locator = options.locator; 12 | var defaultNSMap = options.xmlns||{}; 13 | var isHTML = /\/x?html?$/.test(mimeType);//mimeType.toLowerCase().indexOf('html') > -1; 14 | var entityMap = isHTML?htmlEntity.entityMap:{'lt':'<','gt':'>','amp':'&','quot':'"','apos':"'"}; 15 | if(locator){ 16 | domBuilder.setDocumentLocator(locator) 17 | } 18 | 19 | sax.errorHandler = buildErrorHandler(errorHandler,domBuilder,locator); 20 | sax.domBuilder = options.domBuilder || domBuilder; 21 | if(isHTML){ 22 | defaultNSMap['']= 'http://www.w3.org/1999/xhtml'; 23 | } 24 | defaultNSMap.xml = defaultNSMap.xml || 'http://www.w3.org/XML/1998/namespace'; 25 | if(source){ 26 | sax.parse(source,defaultNSMap,entityMap); 27 | }else{ 28 | sax.errorHandler.error("invalid doc source"); 29 | } 30 | return domBuilder.doc; 31 | } 32 | function buildErrorHandler(errorImpl,domBuilder,locator){ 33 | if(!errorImpl){ 34 | if(domBuilder instanceof DOMHandler){ 35 | return domBuilder; 36 | } 37 | errorImpl = domBuilder ; 38 | } 39 | var errorHandler = {} 40 | var isCallback = errorImpl instanceof Function; 41 | locator = locator||{} 42 | function build(key){ 43 | var fn = errorImpl[key]; 44 | if(!fn && isCallback){ 45 | fn = errorImpl.length == 2?function(msg){errorImpl(key,msg)}:errorImpl; 46 | } 47 | errorHandler[key] = fn && function(msg){ 48 | fn('[xmldom '+key+']\t'+msg+_locator(locator)); 49 | }||function(){}; 50 | } 51 | build('warning'); 52 | build('error'); 53 | build('fatalError'); 54 | return errorHandler; 55 | } 56 | 57 | //console.log('#\n\n\n\n\n\n\n####') 58 | /** 59 | * +ContentHandler+ErrorHandler 60 | * +LexicalHandler+EntityResolver2 61 | * -DeclHandler-DTDHandler 62 | * 63 | * DefaultHandler:EntityResolver, DTDHandler, ContentHandler, ErrorHandler 64 | * DefaultHandler2:DefaultHandler,LexicalHandler, DeclHandler, EntityResolver2 65 | * @link http://www.saxproject.org/apidoc/org/xml/sax/helpers/DefaultHandler.html 66 | */ 67 | function DOMHandler() { 68 | this.cdata = false; 69 | } 70 | function position(locator,node){ 71 | node.lineNumber = locator.lineNumber; 72 | node.columnNumber = locator.columnNumber; 73 | } 74 | /** 75 | * @see org.xml.sax.ContentHandler#startDocument 76 | * @link http://www.saxproject.org/apidoc/org/xml/sax/ContentHandler.html 77 | */ 78 | DOMHandler.prototype = { 79 | startDocument : function() { 80 | this.doc = new DOMImplementation().createDocument(null, null, null); 81 | if (this.locator) { 82 | this.doc.documentURI = this.locator.systemId; 83 | } 84 | }, 85 | startElement:function(namespaceURI, localName, qName, attrs) { 86 | var doc = this.doc; 87 | var el = doc.createElementNS(namespaceURI, qName||localName); 88 | var len = attrs.length; 89 | appendElement(this, el); 90 | this.currentElement = el; 91 | 92 | this.locator && position(this.locator,el) 93 | for (var i = 0 ; i < len; i++) { 94 | var namespaceURI = attrs.getURI(i); 95 | var value = attrs.getValue(i); 96 | var qName = attrs.getQName(i); 97 | var attr = doc.createAttributeNS(namespaceURI, qName); 98 | this.locator &&position(attrs.getLocator(i),attr); 99 | attr.value = attr.nodeValue = value; 100 | el.setAttributeNode(attr) 101 | } 102 | }, 103 | endElement:function(namespaceURI, localName, qName) { 104 | var current = this.currentElement 105 | var tagName = current.tagName; 106 | this.currentElement = current.parentNode; 107 | }, 108 | startPrefixMapping:function(prefix, uri) { 109 | }, 110 | endPrefixMapping:function(prefix) { 111 | }, 112 | processingInstruction:function(target, data) { 113 | var ins = this.doc.createProcessingInstruction(target, data); 114 | this.locator && position(this.locator,ins) 115 | appendElement(this, ins); 116 | }, 117 | ignorableWhitespace:function(ch, start, length) { 118 | }, 119 | characters:function(chars, start, length) { 120 | chars = _toString.apply(this,arguments) 121 | //console.log(chars) 122 | if(chars){ 123 | if (this.cdata) { 124 | var charNode = this.doc.createCDATASection(chars); 125 | } else { 126 | var charNode = this.doc.createTextNode(chars); 127 | } 128 | if(this.currentElement){ 129 | this.currentElement.appendChild(charNode); 130 | }else if(/^\s*$/.test(chars)){ 131 | this.doc.appendChild(charNode); 132 | //process xml 133 | } 134 | this.locator && position(this.locator,charNode) 135 | } 136 | }, 137 | skippedEntity:function(name) { 138 | }, 139 | endDocument:function() { 140 | this.doc.normalize(); 141 | }, 142 | setDocumentLocator:function (locator) { 143 | if(this.locator = locator){// && !('lineNumber' in locator)){ 144 | locator.lineNumber = 0; 145 | } 146 | }, 147 | //LexicalHandler 148 | comment:function(chars, start, length) { 149 | chars = _toString.apply(this,arguments) 150 | var comm = this.doc.createComment(chars); 151 | this.locator && position(this.locator,comm) 152 | appendElement(this, comm); 153 | }, 154 | 155 | startCDATA:function() { 156 | //used in characters() methods 157 | this.cdata = true; 158 | }, 159 | endCDATA:function() { 160 | this.cdata = false; 161 | }, 162 | 163 | startDTD:function(name, publicId, systemId) { 164 | var impl = this.doc.implementation; 165 | if (impl && impl.createDocumentType) { 166 | var dt = impl.createDocumentType(name, publicId, systemId); 167 | this.locator && position(this.locator,dt) 168 | appendElement(this, dt); 169 | } 170 | }, 171 | /** 172 | * @see org.xml.sax.ErrorHandler 173 | * @link http://www.saxproject.org/apidoc/org/xml/sax/ErrorHandler.html 174 | */ 175 | warning:function(error) { 176 | console.warn('[xmldom warning]\t'+error,_locator(this.locator)); 177 | }, 178 | error:function(error) { 179 | console.error('[xmldom error]\t'+error,_locator(this.locator)); 180 | }, 181 | fatalError:function(error) { 182 | console.error('[xmldom fatalError]\t'+error,_locator(this.locator)); 183 | throw error; 184 | } 185 | } 186 | function _locator(l){ 187 | if(l){ 188 | return '\n@'+(l.systemId ||'')+'#[line:'+l.lineNumber+',col:'+l.columnNumber+']' 189 | } 190 | } 191 | function _toString(chars,start,length){ 192 | if(typeof chars == 'string'){ 193 | return chars.substr(start,length) 194 | }else{//java sax connect width xmldom on rhino(what about: "? && !(chars instanceof String)") 195 | if(chars.length >= start+length || start){ 196 | return new java.lang.String(chars,start,length)+''; 197 | } 198 | return chars; 199 | } 200 | } 201 | 202 | /* 203 | * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/LexicalHandler.html 204 | * used method of org.xml.sax.ext.LexicalHandler: 205 | * #comment(chars, start, length) 206 | * #startCDATA() 207 | * #endCDATA() 208 | * #startDTD(name, publicId, systemId) 209 | * 210 | * 211 | * IGNORED method of org.xml.sax.ext.LexicalHandler: 212 | * #endDTD() 213 | * #startEntity(name) 214 | * #endEntity(name) 215 | * 216 | * 217 | * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/DeclHandler.html 218 | * IGNORED method of org.xml.sax.ext.DeclHandler 219 | * #attributeDecl(eName, aName, type, mode, value) 220 | * #elementDecl(name, model) 221 | * #externalEntityDecl(name, publicId, systemId) 222 | * #internalEntityDecl(name, value) 223 | * @link http://www.saxproject.org/apidoc/org/xml/sax/ext/EntityResolver2.html 224 | * IGNORED method of org.xml.sax.EntityResolver2 225 | * #resolveEntity(String name,String publicId,String baseURI,String systemId) 226 | * #resolveEntity(publicId, systemId) 227 | * #getExternalSubset(name, baseURI) 228 | * @link http://www.saxproject.org/apidoc/org/xml/sax/DTDHandler.html 229 | * IGNORED method of org.xml.sax.DTDHandler 230 | * #notationDecl(name, publicId, systemId) {}; 231 | * #unparsedEntityDecl(name, publicId, systemId, notationName) {}; 232 | */ 233 | "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(key){ 234 | DOMHandler.prototype[key] = function(){return null} 235 | }) 236 | 237 | /* Private static helpers treated below as private instance methods, so don't need to add these to the public API; we might use a Relator to also get rid of non-standard public properties */ 238 | function appendElement (hander,node) { 239 | if (!hander.currentElement) { 240 | hander.doc.appendChild(node); 241 | } else { 242 | hander.currentElement.appendChild(node); 243 | } 244 | }//appendChild and setAttributeNS are preformance key 245 | 246 | //if(typeof require == 'function'){ 247 | var htmlEntity = require('./entities'); 248 | var XMLReader = require('./sax').XMLReader; 249 | var DOMImplementation = exports.DOMImplementation = require('./dom').DOMImplementation; 250 | exports.XMLSerializer = require('./dom').XMLSerializer ; 251 | exports.DOMParser = DOMParser; 252 | //} 253 | -------------------------------------------------------------------------------- /build/wechatgame/libs/xmldom/entities.js: -------------------------------------------------------------------------------- 1 | exports.entityMap = { 2 | lt: '<', 3 | gt: '>', 4 | amp: '&', 5 | quot: '"', 6 | apos: "'", 7 | Agrave: "À", 8 | Aacute: "Á", 9 | Acirc: "Â", 10 | Atilde: "Ã", 11 | Auml: "Ä", 12 | Aring: "Å", 13 | AElig: "Æ", 14 | Ccedil: "Ç", 15 | Egrave: "È", 16 | Eacute: "É", 17 | Ecirc: "Ê", 18 | Euml: "Ë", 19 | Igrave: "Ì", 20 | Iacute: "Í", 21 | Icirc: "Î", 22 | Iuml: "Ï", 23 | ETH: "Ð", 24 | Ntilde: "Ñ", 25 | Ograve: "Ò", 26 | Oacute: "Ó", 27 | Ocirc: "Ô", 28 | Otilde: "Õ", 29 | Ouml: "Ö", 30 | Oslash: "Ø", 31 | Ugrave: "Ù", 32 | Uacute: "Ú", 33 | Ucirc: "Û", 34 | Uuml: "Ü", 35 | Yacute: "Ý", 36 | THORN: "Þ", 37 | szlig: "ß", 38 | agrave: "à", 39 | aacute: "á", 40 | acirc: "â", 41 | atilde: "ã", 42 | auml: "ä", 43 | aring: "å", 44 | aelig: "æ", 45 | ccedil: "ç", 46 | egrave: "è", 47 | eacute: "é", 48 | ecirc: "ê", 49 | euml: "ë", 50 | igrave: "ì", 51 | iacute: "í", 52 | icirc: "î", 53 | iuml: "ï", 54 | eth: "ð", 55 | ntilde: "ñ", 56 | ograve: "ò", 57 | oacute: "ó", 58 | ocirc: "ô", 59 | otilde: "õ", 60 | ouml: "ö", 61 | oslash: "ø", 62 | ugrave: "ù", 63 | uacute: "ú", 64 | ucirc: "û", 65 | uuml: "ü", 66 | yacute: "ý", 67 | thorn: "þ", 68 | yuml: "ÿ", 69 | nbsp: " ", 70 | iexcl: "¡", 71 | cent: "¢", 72 | pound: "£", 73 | curren: "¤", 74 | yen: "¥", 75 | brvbar: "¦", 76 | sect: "§", 77 | uml: "¨", 78 | copy: "©", 79 | ordf: "ª", 80 | laquo: "«", 81 | not: "¬", 82 | shy: "­­", 83 | reg: "®", 84 | macr: "¯", 85 | deg: "°", 86 | plusmn: "±", 87 | sup2: "²", 88 | sup3: "³", 89 | acute: "´", 90 | micro: "µ", 91 | para: "¶", 92 | middot: "·", 93 | cedil: "¸", 94 | sup1: "¹", 95 | ordm: "º", 96 | raquo: "»", 97 | frac14: "¼", 98 | frac12: "½", 99 | frac34: "¾", 100 | iquest: "¿", 101 | times: "×", 102 | divide: "÷", 103 | forall: "∀", 104 | part: "∂", 105 | exist: "∃", 106 | empty: "∅", 107 | nabla: "∇", 108 | isin: "∈", 109 | notin: "∉", 110 | ni: "∋", 111 | prod: "∏", 112 | sum: "∑", 113 | minus: "−", 114 | lowast: "∗", 115 | radic: "√", 116 | prop: "∝", 117 | infin: "∞", 118 | ang: "∠", 119 | and: "∧", 120 | or: "∨", 121 | cap: "∩", 122 | cup: "∪", 123 | 'int': "∫", 124 | there4: "∴", 125 | sim: "∼", 126 | cong: "≅", 127 | asymp: "≈", 128 | ne: "≠", 129 | equiv: "≡", 130 | le: "≤", 131 | ge: "≥", 132 | sub: "⊂", 133 | sup: "⊃", 134 | nsub: "⊄", 135 | sube: "⊆", 136 | supe: "⊇", 137 | oplus: "⊕", 138 | otimes: "⊗", 139 | perp: "⊥", 140 | sdot: "⋅", 141 | Alpha: "Α", 142 | Beta: "Β", 143 | Gamma: "Γ", 144 | Delta: "Δ", 145 | Epsilon: "Ε", 146 | Zeta: "Ζ", 147 | Eta: "Η", 148 | Theta: "Θ", 149 | Iota: "Ι", 150 | Kappa: "Κ", 151 | Lambda: "Λ", 152 | Mu: "Μ", 153 | Nu: "Ν", 154 | Xi: "Ξ", 155 | Omicron: "Ο", 156 | Pi: "Π", 157 | Rho: "Ρ", 158 | Sigma: "Σ", 159 | Tau: "Τ", 160 | Upsilon: "Υ", 161 | Phi: "Φ", 162 | Chi: "Χ", 163 | Psi: "Ψ", 164 | Omega: "Ω", 165 | alpha: "α", 166 | beta: "β", 167 | gamma: "γ", 168 | delta: "δ", 169 | epsilon: "ε", 170 | zeta: "ζ", 171 | eta: "η", 172 | theta: "θ", 173 | iota: "ι", 174 | kappa: "κ", 175 | lambda: "λ", 176 | mu: "μ", 177 | nu: "ν", 178 | xi: "ξ", 179 | omicron: "ο", 180 | pi: "π", 181 | rho: "ρ", 182 | sigmaf: "ς", 183 | sigma: "σ", 184 | tau: "τ", 185 | upsilon: "υ", 186 | phi: "φ", 187 | chi: "χ", 188 | psi: "ψ", 189 | omega: "ω", 190 | thetasym: "ϑ", 191 | upsih: "ϒ", 192 | piv: "ϖ", 193 | OElig: "Œ", 194 | oelig: "œ", 195 | Scaron: "Š", 196 | scaron: "š", 197 | Yuml: "Ÿ", 198 | fnof: "ƒ", 199 | circ: "ˆ", 200 | tilde: "˜", 201 | ensp: " ", 202 | emsp: " ", 203 | thinsp: " ", 204 | zwnj: "‌", 205 | zwj: "‍", 206 | lrm: "‎", 207 | rlm: "‏", 208 | ndash: "–", 209 | mdash: "—", 210 | lsquo: "‘", 211 | rsquo: "’", 212 | sbquo: "‚", 213 | ldquo: "“", 214 | rdquo: "”", 215 | bdquo: "„", 216 | dagger: "†", 217 | Dagger: "‡", 218 | bull: "•", 219 | hellip: "…", 220 | permil: "‰", 221 | prime: "′", 222 | Prime: "″", 223 | lsaquo: "‹", 224 | rsaquo: "›", 225 | oline: "‾", 226 | euro: "€", 227 | trade: "™", 228 | larr: "←", 229 | uarr: "↑", 230 | rarr: "→", 231 | darr: "↓", 232 | harr: "↔", 233 | crarr: "↵", 234 | lceil: "⌈", 235 | rceil: "⌉", 236 | lfloor: "⌊", 237 | rfloor: "⌋", 238 | loz: "◊", 239 | spades: "♠", 240 | clubs: "♣", 241 | hearts: "♥", 242 | diams: "♦" 243 | }; 244 | //for(var n in exports.entityMap){console.log(exports.entityMap[n].charCodeAt())} -------------------------------------------------------------------------------- /build/wechatgame/main.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | 3 | function boot () { 4 | 5 | var settings = window._CCSettings; 6 | window._CCSettings = undefined; 7 | 8 | if ( !settings.debug ) { 9 | var uuids = settings.uuids; 10 | 11 | var rawAssets = settings.rawAssets; 12 | var assetTypes = settings.assetTypes; 13 | var realRawAssets = settings.rawAssets = {}; 14 | for (var mount in rawAssets) { 15 | var entries = rawAssets[mount]; 16 | var realEntries = realRawAssets[mount] = {}; 17 | for (var id in entries) { 18 | var entry = entries[id]; 19 | var type = entry[1]; 20 | // retrieve minified raw asset 21 | if (typeof type === 'number') { 22 | entry[1] = assetTypes[type]; 23 | } 24 | // retrieve uuid 25 | realEntries[uuids[id] || id] = entry; 26 | } 27 | } 28 | 29 | var scenes = settings.scenes; 30 | for (var i = 0; i < scenes.length; ++i) { 31 | var scene = scenes[i]; 32 | if (typeof scene.uuid === 'number') { 33 | scene.uuid = uuids[scene.uuid]; 34 | } 35 | } 36 | 37 | var packedAssets = settings.packedAssets; 38 | for (var packId in packedAssets) { 39 | var packedIds = packedAssets[packId]; 40 | for (var j = 0; j < packedIds.length; ++j) { 41 | if (typeof packedIds[j] === 'number') { 42 | packedIds[j] = uuids[packedIds[j]]; 43 | } 44 | } 45 | } 46 | } 47 | 48 | // init engine 49 | var canvas; 50 | 51 | if (cc.sys.isBrowser) { 52 | canvas = document.getElementById('GameCanvas'); 53 | } 54 | 55 | if (false) { 56 | var ORIENTATIONS = { 57 | 'portrait': 1, 58 | 'landscape left': 2, 59 | 'landscape right': 3 60 | }; 61 | BK.Director.screenMode = ORIENTATIONS[settings.orientation]; 62 | initAdapter(); 63 | } 64 | 65 | function setLoadingDisplay () { 66 | // Loading splash scene 67 | var splash = document.getElementById('splash'); 68 | var progressBar = splash.querySelector('.progress-bar span'); 69 | cc.loader.onProgress = function (completedCount, totalCount, item) { 70 | var percent = 100 * completedCount / totalCount; 71 | if (progressBar) { 72 | progressBar.style.width = percent.toFixed(2) + '%'; 73 | } 74 | }; 75 | splash.style.display = 'block'; 76 | progressBar.style.width = '0%'; 77 | 78 | cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () { 79 | splash.style.display = 'none'; 80 | }); 81 | } 82 | 83 | var onStart = function () { 84 | if (false) { 85 | BK.Script.loadlib(); 86 | } 87 | 88 | cc.view.resizeWithBrowserSize(true); 89 | 90 | if (!true && !false) { 91 | // UC browser on many android devices have performance issue with retina display 92 | if (cc.sys.os !== cc.sys.OS_ANDROID || cc.sys.browserType !== cc.sys.BROWSER_TYPE_UC) { 93 | cc.view.enableRetina(true); 94 | } 95 | if (cc.sys.isBrowser) { 96 | setLoadingDisplay(); 97 | } 98 | 99 | if (cc.sys.isMobile) { 100 | if (settings.orientation === 'landscape') { 101 | cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE); 102 | } 103 | else if (settings.orientation === 'portrait') { 104 | cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT); 105 | } 106 | cc.view.enableAutoFullScreen([ 107 | cc.sys.BROWSER_TYPE_BAIDU, 108 | cc.sys.BROWSER_TYPE_WECHAT, 109 | cc.sys.BROWSER_TYPE_MOBILE_QQ, 110 | cc.sys.BROWSER_TYPE_MIUI, 111 | ].indexOf(cc.sys.browserType) < 0); 112 | } 113 | 114 | // Limit downloading max concurrent task to 2, 115 | // more tasks simultaneously may cause performance draw back on some android system / brwosers. 116 | // You can adjust the number based on your own test result, you have to set it before any loading process to take effect. 117 | if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) { 118 | cc.macro.DOWNLOAD_MAX_CONCURRENT = 2; 119 | } 120 | } 121 | 122 | // init assets 123 | cc.AssetLibrary.init({ 124 | libraryPath: 'res/import', 125 | rawAssetsBase: 'res/raw-', 126 | rawAssets: settings.rawAssets, 127 | packedAssets: settings.packedAssets, 128 | md5AssetsMap: settings.md5AssetsMap 129 | }); 130 | 131 | if (false) { 132 | cc.Pipeline.Downloader.PackDownloader._doPreload("WECHAT_SUBDOMAIN", settings.WECHAT_SUBDOMAIN_DATA); 133 | } 134 | 135 | var launchScene = settings.launchScene; 136 | 137 | // load scene 138 | cc.director.loadScene(launchScene, null, 139 | function () { 140 | if (cc.sys.isBrowser) { 141 | // show canvas 142 | canvas.style.visibility = ''; 143 | var div = document.getElementById('GameDiv'); 144 | if (div) { 145 | div.style.backgroundImage = ''; 146 | } 147 | } 148 | cc.loader.onProgress = null; 149 | console.log('Success to load scene: ' + launchScene); 150 | } 151 | ); 152 | }; 153 | 154 | // jsList 155 | var jsList = settings.jsList; 156 | 157 | if (!false) { 158 | var bundledScript = settings.debug ? 'src/project.dev.js' : 'src/project.js'; 159 | if (jsList) { 160 | jsList = jsList.map(function (x) { 161 | return 'src/' + x; 162 | }); 163 | jsList.push(bundledScript); 164 | } 165 | else { 166 | jsList = [bundledScript]; 167 | } 168 | } 169 | 170 | // anysdk scripts 171 | if (cc.sys.isNative && cc.sys.isMobile) { 172 | jsList = jsList.concat(['src/anysdk/jsb_anysdk.js', 'src/anysdk/jsb_anysdk_constants.js']); 173 | } 174 | 175 | var option = { 176 | //width: width, 177 | //height: height, 178 | id: 'GameCanvas', 179 | scenes: settings.scenes, 180 | debugMode: settings.debug ? cc.DebugMode.INFO : cc.DebugMode.ERROR, 181 | showFPS: (!true && !false) && settings.debug, 182 | frameRate: 60, 183 | jsList: jsList, 184 | groupList: settings.groupList, 185 | collisionMatrix: settings.collisionMatrix, 186 | renderMode: 0 187 | } 188 | 189 | cc.game.run(option, onStart); 190 | } 191 | 192 | if (false) { 193 | BK.Script.loadlib('GameRes://libs/qqplay-adapter.js'); 194 | BK.Script.loadlib('GameRes://src/settings.js'); 195 | BK.Script.loadlib(); 196 | BK.Script.loadlib('GameRes://libs/qqplay-downloader.js'); 197 | qqPlayDownloader.REMOTE_SERVER_ROOT = ""; 198 | var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; 199 | cc.loader.insertPipeAfter(prevPipe, qqPlayDownloader); 200 | // 201 | boot(); 202 | return; 203 | } 204 | 205 | if (true) { 206 | require(window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js'); 207 | require('./libs/weapp-adapter/engine/index.js'); 208 | var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; 209 | cc.loader.insertPipeAfter(prevPipe, wxDownloader); 210 | boot(); 211 | return; 212 | } 213 | 214 | if (window.jsb) { 215 | require('src/settings.js'); 216 | require('src/jsb_polyfill.js'); 217 | boot(); 218 | return; 219 | } 220 | 221 | if (window.document) { 222 | var splash = document.getElementById('splash'); 223 | splash.style.display = 'block'; 224 | 225 | var cocos2d = document.createElement('script'); 226 | cocos2d.async = true; 227 | cocos2d.src = window._CCSettings.debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js'; 228 | 229 | var engineLoaded = function () { 230 | document.body.removeChild(cocos2d); 231 | cocos2d.removeEventListener('load', engineLoaded, false); 232 | window.eruda && eruda.init() && eruda.get('console').config.set('displayUnenumerable', false); 233 | boot(); 234 | }; 235 | cocos2d.addEventListener('load', engineLoaded, false); 236 | document.body.appendChild(cocos2d); 237 | } 238 | 239 | })(); 240 | -------------------------------------------------------------------------------- /build/wechatgame/project.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "description": "项目配置文件。", 3 | "miniprogramRoot": "./", 4 | "setting": { 5 | "urlCheck": true, 6 | "es6": false, 7 | "postcss": true, 8 | "minified": true, 9 | "newFeature": false 10 | }, 11 | "compileType": "game", 12 | "libVersion": "game", 13 | "appid": "wx3fa17c4754ee6b67", 14 | "projectname": "wordpk", 15 | "condition": { 16 | "search": { 17 | "current": -1, 18 | "list": [] 19 | }, 20 | "conversation": { 21 | "current": -1, 22 | "list": [] 23 | }, 24 | "game": { 25 | "currentL": -1, 26 | "list": [], 27 | "current": -1 28 | }, 29 | "miniprogram": { 30 | "current": -1, 31 | "list": [] 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /build/wechatgame/res/import/0b/0b04dfdf3.json: -------------------------------------------------------------------------------- 1 | [[{"__type__":"cc.SceneAsset","_name":"Result","scene":{"__id__":1},"asyncLoadAssets":null},{"__type__":"cc.Scene","_name":"New Node","_children":[{"__id__":2}],"_anchorPoint":{"__type__":"cc.Vec2"},"autoReleaseAssets":false},{"__type__":"cc.Node","_name":"Canvas","_parent":{"__id__":1},"_children":[{"__id__":3}],"_components":[{"__type__":"cc.Canvas","node":{"__id__":2},"_designResolution":{"__type__":"cc.Size","width":750,"height":1334}}],"_id":"4czp2X1QVAGJqIIoFeZFwu","_contentSize":{"__type__":"cc.Size","width":750,"height":1334},"_position":{"__type__":"cc.Vec2","x":375,"y":667}},{"__type__":"cc.Node","_name":"Layout","_parent":{"__id__":2},"_children":[{"__id__":4}],"_components":[{"__type__":"cc.Sprite","node":{"__id__":3},"_spriteFrame":{"__uuid__":"9bvaMerUlDyary99mJa6xp"},"_type":1,"_sizeMode":0,"_isTrimmedMode":false},{"__type__":"cc.Layout","node":{"__id__":3},"_layoutSize":{"__type__":"cc.Size","width":707.5471698113207,"height":1258.4905660377358}},{"__type__":"cc.Widget","node":{"__id__":3},"_alignFlags":45,"_originalWidth":200,"_originalHeight":150}],"_color":{"__type__":"cc.Color","r":40,"g":78,"b":119},"_contentSize":{"__type__":"cc.Size","width":707.5471698113207,"height":1258.4905660377358},"_scaleX":1.06,"_scaleY":1.06},{"__type__":"cc.Node","_name":"background","_parent":{"__id__":3},"_components":[{"__type__":"cc.Sprite","node":{"__id__":4},"_spriteFrame":{"__uuid__":"97TIiLttlP87suoGMe6p/K"},"_sizeMode":0},{"__type__":"cc.Widget","node":{"__id__":4},"_alignFlags":45,"_originalWidth":652,"_originalHeight":1203}],"_opacity":180,"_contentSize":{"__type__":"cc.Size","width":707.5471698113207,"height":1258.4905660377358}}],{"__type__":"cc.SpriteFrame","content":{"name":"img_bg_1","texture":"09YyuBxrVOMKRNZO+Owd7Q","rect":[42,131,652,1203],"offset":[-7,-65.5],"originalSize":[750,1334]}},{"__type__":"cc.SpriteFrame","content":{"name":"default_panel","texture":"d8HsitJHxOYqo801xBk8ev","rect":[0,0,20,20],"offset":[0,0],"originalSize":[20,20],"capInsets":[4,3,4,3]}}] -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/audio/countdown_1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/audio/countdown_1.mp3 -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/audio/countdown_2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/audio/countdown_2.mp3 -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/audio/fail.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/audio/fail.wav -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/audio/success.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/audio/success.wav -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/font/mikado_outline_shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/font/mikado_outline_shadow.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/textures/btn_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/textures/btn_blue.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/textures/btn_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/textures/btn_green.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/textures/btn_grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/textures/btn_grey.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/textures/img_bg_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/textures/img_bg_1.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/textures/ui_progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/textures/ui_progress.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-assets/textures/ui_progress_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-assets/textures/ui_progress_bar.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-internal/image/default_btn_disabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-internal/image/default_btn_disabled.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-internal/image/default_btn_normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-internal/image/default_btn_normal.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-internal/image/default_btn_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-internal/image/default_btn_pressed.png -------------------------------------------------------------------------------- /build/wechatgame/res/raw-internal/image/default_panel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/zhongyao-x/brainstorming/c7838f42ddc6a2e52917cb36233064551ade3ef4/build/wechatgame/res/raw-internal/image/default_panel.png -------------------------------------------------------------------------------- /build/wechatgame/src/project.js: -------------------------------------------------------------------------------- 1 | require=function i(c,d,s){function a(e,t){if(!d[e]){if(!c[e]){var o="function"==typeof require&&require;if(!t&&o)return o(e,!0);if(u)return u(e,!0);var n=new Error("Cannot find module '"+e+"'");throw n.code="MODULE_NOT_FOUND",n}var r=d[e]={exports:{}};c[e][0].call(r.exports,function(t){return a(c[e][1][t]||t)},r,r.exports,i,c,d,s)}return d[e].exports}for(var u="function"==typeof require&&require,t=0;t=n.questionTotal)return!1}return!0}),console.log(n.qdata))},e.open("get","https://jisujiakao.market.alicloudapi.com/driverexam/query?pagenum=1&pagesize=100&sort=rand&subject=1&type=C1",!0),e.setRequestHeader("Authorization","APPCODE d1f7d1f2048841eca46b1a56a941554b"),console.log(e.send())},t.prototype.init=function(){this.progressBarNode.active=!1,this.progressBar=this.progressBarNode.getComponent(cc.ProgressBar),this.progressBar.progress=1,this.readyCountdownNode.active=!1,this.readyCountdown=this.readyCountdownNode.getComponent(cc.Label),this.qaNode.active=!1,this.qaNode.opacity=0,this.btnStart.active=!0,this.current=0,this.mark.active=!1},t.prototype.ready=function(){var n=this,t=2;this.readyCountdownNode.active=!0,this.readyCountdown.string="Ready";var e=cc.sequence(cc.scaleTo(.2,1.6),cc.scaleTo(.6,.8)),o=cc.sequence(cc.scaleTo(.2,1.6),cc.callFunc(function(){console.log("anim end!"),setTimeout(function(){var t=n.readyCountdownNode.position,e=t.x,o=t.y;n.readyCountdownNode.runAction(cc.sequence(cc.moveTo(.5,0,1e3),cc.callFunc(function(){n.readyCountdownNode.active=!1,n.readyCountdownNode.x=e,n.readyCountdownNode.y=o,n.readyCountdownNode.scale=1,n.progressBarNode.active=!0,n.qaNode.active=!0,n.starRound()})))},300)}));this.readyCountdownNode.runAction(e),this.schedule(function(){if(t<=0)return n.readyCountdown.string="Go",void n.readyCountdownNode.runAction(o);n.readyCountdown.string=t.toString(),n.readyCountdownNode.runAction(e),t-=1},1,t,0),this.scheduleOnce(function(){cc.audioEngine.play(n.countdownAudio_1,!1,1)},1)},t.prototype.startGame=function(){this.btnStart.active=!1,this.ready()},t.prototype.starRound=function(){var t=this;if(this.current>=this.qdata.length)return this.init(),void this.unschedule(this.updateCountdownTime);this.mark.active=!0,this.mark.getComponent(cc.Label).string="第 "+(this.current+1)+" 题",this.mark.runAction(cc.sequence(cc.scaleTo(.2,1.2),cc.scaleTo(.2,1),cc.callFunc(function(){t.scheduleOnce(function(){t.mark.active=!1,t.qaNode.runAction(cc.fadeIn(.2)),t.inProgress=!0,t.qaNode.getComponent("Qa").initQa(t.qdata[t.current]),t.progressBar.progress=1,t.schedule(t.updateCountdownTime,1),t.current+=1},1)})))},t.prototype.endRound=function(){var t=this;this.currentTime=0,this.inProgress=!1;var e=cc.sequence(cc.fadeOut(.2),cc.callFunc(function(){t.qaNode.getComponent("Qa").resetStatus(),t.scheduleOnce(function(){t.starRound()},.5)}));this.qaNode.runAction(e)},t.prototype.stopSchedule=function(){this.unschedule(this.updateCountdownTime)},t.prototype.updateCountdownTime=function(){this.currentTime+=1,this.progressBar.progress=1-this.currentTime/this.countdownTime,cc.audioEngine.play(this.countdownAudio_2,!1,1),this.currentTime>=this.countdownTime&&(this.unschedule(this.updateCountdownTime),this.endRound())},__decorate([i(cc.Node)],t.prototype,"mark",void 0),__decorate([i(cc.Node)],t.prototype,"qaNode",void 0),__decorate([i(cc.Node)],t.prototype,"progressBarNode",void 0),__decorate([i(cc.Node)],t.prototype,"readyCountdownNode",void 0),__decorate([i(cc.Node)],t.prototype,"btnStart",void 0),__decorate([i(cc.AudioClip)],t.prototype,"countdownAudio_1",void 0),__decorate([i(cc.AudioClip)],t.prototype,"countdownAudio_2",void 0),__decorate([i(cc.Integer)],t.prototype,"countdownTime",void 0),__decorate([i(cc.Integer)],t.prototype,"questionTotal",void 0),t=__decorate([r],t)}(cc.Component);o.default=c,cc._RF.pop()},{}],Qa:[function(t,e,o){"use strict";cc._RF.push(e,"43a45WEJW1Pr4y9hfLJQXmJ","Qa"),Object.defineProperty(o,"__esModule",{value:!0});var n=cc._decorator,r=n.ccclass,i=n.property,c=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.questionNode=null,t.btnAnswerNode_1=null,t.btnAnswerNode_2=null,t.btnAnswerNode_3=null,t.btnAnswerNode_4=null,t.game=null,t.faildAudio=null,t.successAudio=null,t.btnAnswerNodeArray=new Array,t.currentNode=null,t.rightNode=null,t}return __extends(t,e),t.prototype.onLoad=function(){this.btnAnswerNodeArray=[this.btnAnswerNode_1,this.btnAnswerNode_2,this.btnAnswerNode_3,this.btnAnswerNode_4]},t.prototype.answerClick=function(t,e){if(!this.isAnswer&&this.game.getComponent("Game").inProgress){if(this.isAnswer=!0,this.currentNode=this.btnAnswerNodeArray[e],this.answer=Number(e),this.right===Number(e))return void this.correct();this.wrong()}},t.prototype.initQa=function(e){this.isAnswer=!1,this.questionNode.getComponent(cc.Label).string=e.title;var t=e.answer,o=t[0],n=t[1],r=t[2],i=t[3];this.getChildrenLabel(this.btnAnswerNode_1).string=""+o.txt,this.getChildrenLabel(this.btnAnswerNode_2).string=""+n.txt,this.getChildrenLabel(this.btnAnswerNode_3).string=""+r.txt,this.getChildrenLabel(this.btnAnswerNode_4).string=""+i.txt,this.right=e.answer.findIndex(function(t){return t.id===e.right}),this.rightNode=this.btnAnswerNodeArray[this.right]},t.prototype.correct=function(){this.animStart(),cc.audioEngine.play(this.successAudio,!1,1),this.currentNode.color=new cc.Color(88,165,92)},t.prototype.wrong=function(){this.animStart(),cc.audioEngine.play(this.faildAudio,!1,1),this.currentNode.color=new cc.Color(217,80,84)},t.prototype.animStart=function(){var e=this,t=cc.sequence(cc.scaleTo(.2,1.1),cc.callFunc(this.animOver,this));this.currentNode.runAction(t);var o=this.right===this.answer;this.currentNode.getChildByName("Label").color=cc.Color.WHITE,this.btnAnswerNodeArray.forEach(function(t){if(!o&&e.rightNode===t)return t.color=new cc.Color(88,165,92),void(t.getChildByName("Label").color=cc.Color.WHITE);e.currentNode!==t&&t.runAction(cc.scaleTo(.2,0))})},t.prototype.animOver=function(){var t=this;this.game.getComponent("Game").stopSchedule(),this.scheduleOnce(function(){t.game.getComponent("Game").endRound()},1)},t.prototype.resetStatus=function(){var e=this;this.currentNode&&(this.currentNode.runAction(cc.scaleTo(.2,1)),this.currentNode.color=cc.Color.WHITE,this.rightNode.color=cc.Color.WHITE,this.rightNode.getChildByName("Label").color=cc.Color.BLACK,this.currentNode.getChildByName("Label").color=cc.Color.BLACK,this.btnAnswerNodeArray.forEach(function(t){e.currentNode!==t&&t.runAction(cc.scaleTo(.2,1))}),this.currentNode=null)},t.prototype.getChildrenLabel=function(t){return t.getChildByName("Label").getComponent(cc.Label)},__decorate([i(cc.Node)],t.prototype,"questionNode",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_1",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_2",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_3",void 0),__decorate([i(cc.Node)],t.prototype,"btnAnswerNode_4",void 0),__decorate([i(cc.Node)],t.prototype,"game",void 0),__decorate([i(cc.AudioClip)],t.prototype,"faildAudio",void 0),__decorate([i(cc.AudioClip)],t.prototype,"successAudio",void 0),t=__decorate([r],t)}(cc.Component);o.default=c,cc._RF.pop()},{}],mock:[function(t,e,o){"use strict";cc._RF.push(e,"2c8d9DgpDdBfYhhdno4j26K","mock"),Object.defineProperty(o,"__esModule",{value:!0}),o.default=[{id:111,title:"小舅子是对妻子什么亲戚的称谓?",right:111,answer:[{id:111,txt:"弟弟"},{id:112,txt:"奶奶"},{id:113,txt:"侄子"},{id:114,txt:"外甥"}]},{id:112,title:"“李小鹏挂”是哪个体操项目中的动作?",right:114,answer:[{id:111,txt:"撑杆跳"},{id:112,txt:"体操"},{id:113,txt:"单杠"},{id:114,txt:"双杠"}]}],cc._RF.pop()},{}]},{},["Game","Qa","mock"]); -------------------------------------------------------------------------------- /build/wechatgame/src/settings.js: -------------------------------------------------------------------------------- 1 | window._CCSettings={platform:"wechatgame",groupList:["default"],collisionMatrix:[[true]],rawAssets:{assets:{"99jLJzZ7tEkb3VpO+Gj1Fm":["audio/countdown_1.mp3",0],"44FahZyXFBKqSOgy6l4TU4":["audio/countdown_2.mp3",0],"42T/YN9LhCsYJWIGayHdeR":["audio/fail.wav",0],"213G5q9C9DvZJVFT/U30WQ":["audio/success.wav",0],a8NEEJT5VBjKVt6HYhJGvu:["font/mikado_outline_shadow.png",1],"f6jYR/0ElMxrA9wRTUD9fU":["textures/btn_blue.png",1],"09OhJwXYxNcIq9/ZuOQHWo":["textures/btn_green.png",1],ccVkylol5AyIfVr2MbIGMW:["textures/btn_grey.png",1],"09YyuBxrVOMKRNZO+Owd7Q":["textures/img_bg_1.png",1],c5aYnlS7JCH47av0ndtafl:["textures/ui_progress.png",1],"e2EDl/wJ9GV6SM+wdNL6yv":["textures/ui_progress_bar.png",1]},internal:{"71VhFCTINJM6/Ky3oX9nBT":["image/default_btn_disabled.png",1],"e8Ueib+qJEhL6mXAHdnwbi":["image/default_btn_normal.png",1],"b4P/PCArtIdIH38t6mlw8Y":["image/default_btn_pressed.png",1],d8HsitJHxOYqo801xBk8ev:["image/default_panel.png",1]}},assetTypes:["cc.AudioClip","cc.Texture2D"],launchScene:"db://assets/scene/Game.fire",scenes:[{url:"db://assets/scene/Game.fire",uuid:1},{url:"db://assets/scene/Result.fire",uuid:0}],packedAssets:{"0b04dfdf3":[0,2,3],"0df4bb847":["29FYIk+N1GYaeWH/q1NxQO","6aNB0kiblH/JMl1wzrtgkB",1,2,"98e0hcV1tMSYIX4ek7U/TA",3,"b7KGaHqGNNlJ51jJQHFv7D","baqGRXjUlAnKMmkDfk6Xhu","bfNqwRBfFJNKlom+zSnPu8","c4VsxnOMNGJaxkqwR4Mvtx","e7lOy1fu9C36DqFIMCO5Ca","e97GVMl6JHh5Ml5qEDdSGa","f0BIwQ8D5Ml7nTNQbh1YlS"]},orientation:"",uuids:["87Y2/IPBlIiqOqx4Wo4uMw","7diISZpOlJeaqceYr1akrW","97TIiLttlP87suoGMe6p/K","9bvaMerUlDyary99mJa6xp"]}; -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "appKey": "", 3 | "appSecret": "", 4 | "encryptJs": true, 5 | "excludeScenes": [], 6 | "fb-instant-games": {}, 7 | "includeAnySDK": false, 8 | "includeSDKBox": false, 9 | "inlineSpriteFrames": true, 10 | "inlineSpriteFrames_native": true, 11 | "jailbreakPlatform": false, 12 | "md5Cache": false, 13 | "mergeStartScene": false, 14 | "oauthLoginServer": "", 15 | "optimizeHotUpdate": false, 16 | "orientation": { 17 | "landscapeLeft": true, 18 | "landscapeRight": true, 19 | "portrait": false, 20 | "upsideDown": false 21 | }, 22 | "packageName": "org.cocos2d.wordpk", 23 | "privateKey": "", 24 | "qqplay": { 25 | "REMOTE_SERVER_ROOT": "", 26 | "orientation": "portrait" 27 | }, 28 | "renderMode": "0", 29 | "startScene": "7d888499-a4e9-4979-aa9c-798af56a4ad6", 30 | "title": "wordpk", 31 | "webOrientation": "auto", 32 | "wechatgame": { 33 | "REMOTE_SERVER_ROOT": "", 34 | "appid": "wx3fa17c4754ee6b67", 35 | "isSubdomain": false, 36 | "orientation": "portrait", 37 | "subContext": "" 38 | }, 39 | "xxteaKey": "b20ef7a3-1672-49", 40 | "zipCompressJs": true 41 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "start-scene": "current", 3 | "group-list": [ 4 | "default" 5 | ], 6 | "collision-matrix": [ 7 | [ 8 | true 9 | ] 10 | ], 11 | "excluded-modules": [], 12 | "design-resolution-width": 960, 13 | "design-resolution-height": 640, 14 | "fit-width": false, 15 | "fit-height": true, 16 | "use-project-simulator-setting": false, 17 | "simulator-orientation": false, 18 | "use-customize-simulator": false, 19 | "simulator-resolution": { 20 | "width": 960, 21 | "height": 640 22 | }, 23 | "cocos-analytics": { 24 | "enable": false, 25 | "appID": "13798", 26 | "appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2" 27 | } 28 | } --------------------------------------------------------------------------------