xx 1 tahun lalu
induk
melakukan
5cc3d70ddc
32 mengubah file dengan 653 tambahan dan 86 penghapusan
  1. TEMPAT SAMPAH
      assets/resources/audio/ad_bgm_game.MP3
  2. 14 0
      assets/resources/audio/ad_bgm_game.MP3.meta
  3. TEMPAT SAMPAH
      assets/resources/audio/ad_bgm_home.MP3
  4. 14 0
      assets/resources/audio/ad_bgm_home.MP3.meta
  5. TEMPAT SAMPAH
      assets/resources/audio/ad_btn.MP3
  6. 14 0
      assets/resources/audio/ad_btn.MP3.meta
  7. TEMPAT SAMPAH
      assets/resources/audio/ad_car_jia_su.MP3
  8. 14 0
      assets/resources/audio/ad_car_jia_su.MP3.meta
  9. TEMPAT SAMPAH
      assets/resources/audio/ad_car_qi_dong.MP3
  10. 14 0
      assets/resources/audio/ad_car_qi_dong.MP3.meta
  11. TEMPAT SAMPAH
      assets/resources/audio/ad_car_sha_che.MP3
  12. 14 0
      assets/resources/audio/ad_car_sha_che.MP3.meta
  13. TEMPAT SAMPAH
      assets/resources/audio/ad_ci_tie.MP3
  14. 14 0
      assets/resources/audio/ad_ci_tie.MP3.meta
  15. TEMPAT SAMPAH
      assets/resources/audio/ad_dun.MP3
  16. 14 0
      assets/resources/audio/ad_dun.MP3.meta
  17. TEMPAT SAMPAH
      assets/resources/audio/ad_peng_zhuang.MP3
  18. 14 0
      assets/resources/audio/ad_peng_zhuang.MP3.meta
  19. TEMPAT SAMPAH
      assets/resources/audio/ad_win.MP3
  20. 14 0
      assets/resources/audio/ad_win.MP3.meta
  21. TEMPAT SAMPAH
      assets/resources/audio/ad_xing.MP3
  22. 14 0
      assets/resources/audio/ad_xing.MP3.meta
  23. 294 10
      assets/resources/prefabs/game.prefab
  24. 58 39
      assets/scene/main.scene
  25. 13 1
      assets/script/config.ts
  26. 21 1
      assets/script/game/car.ts
  27. 24 0
      assets/script/game/count_time_start.ts
  28. 9 0
      assets/script/game/count_time_start.ts.meta
  29. 7 3
      assets/script/game/game.ts
  30. 5 3
      assets/script/game/results.ts
  31. 65 29
      assets/script/manager/audioManager.ts
  32. 3 0
      assets/script/manager/uiManager.ts

TEMPAT SAMPAH
assets/resources/audio/ad_bgm_game.MP3


+ 14 - 0
assets/resources/audio/ad_bgm_game.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "b7ea593a-9bdf-4d47-a5b3-c2e3a6ef49b4",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_bgm_home.MP3


+ 14 - 0
assets/resources/audio/ad_bgm_home.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "525d6204-5913-45dd-884b-34f073773dd4",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_btn.MP3


+ 14 - 0
assets/resources/audio/ad_btn.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "17764d19-b85e-4dcb-a1a8-e594acd59eb1",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_car_jia_su.MP3


+ 14 - 0
assets/resources/audio/ad_car_jia_su.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "26086e9b-3db4-4b91-abfe-e3da23c53777",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_car_qi_dong.MP3


+ 14 - 0
assets/resources/audio/ad_car_qi_dong.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "6f809e30-00e3-4e67-81e3-9233328b314b",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_car_sha_che.MP3


+ 14 - 0
assets/resources/audio/ad_car_sha_che.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "b8362ece-0c49-4232-b38a-c90d4831e3dc",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_ci_tie.MP3


+ 14 - 0
assets/resources/audio/ad_ci_tie.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "ac79138c-6472-4000-beb1-3e6060aaaa67",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_dun.MP3


+ 14 - 0
assets/resources/audio/ad_dun.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "68bbc5ef-5a3c-44f6-9bd4-731579a355c8",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_peng_zhuang.MP3


+ 14 - 0
assets/resources/audio/ad_peng_zhuang.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "2cb025fb-db06-4192-9e86-677600ff3426",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_win.MP3


+ 14 - 0
assets/resources/audio/ad_win.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "7aa057e4-efb4-4de3-9bc9-c12596d32f8c",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

TEMPAT SAMPAH
assets/resources/audio/ad_xing.MP3


+ 14 - 0
assets/resources/audio/ad_xing.MP3.meta

@@ -0,0 +1,14 @@
+{
+  "ver": "1.0.0",
+  "importer": "audio-clip",
+  "imported": true,
+  "uuid": "516b258a-b207-4fd3-a8b1-10b6f3aea8bd",
+  "files": [
+    ".json",
+    ".mp3"
+  ],
+  "subMetas": {},
+  "userData": {
+    "downloadMode": 0
+  }
+}

+ 294 - 10
assets/resources/prefabs/game.prefab

@@ -38,28 +38,31 @@
       },
       {
         "__id__": 170
+      },
+      {
+        "__id__": 202
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 202
+        "__id__": 214
       },
       {
-        "__id__": 204
+        "__id__": 216
       },
       {
-        "__id__": 206
+        "__id__": 218
       },
       {
-        "__id__": 208
+        "__id__": 220
       },
       {
-        "__id__": 210
+        "__id__": 222
       }
     ],
     "_prefab": {
-      "__id__": 212
+      "__id__": 224
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -4589,18 +4592,296 @@
     "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
+  {
+    "__type__": "cc.Node",
+    "_name": "count_time_start",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 1
+    },
+    "_children": [
+      {
+        "__id__": 203
+      }
+    ],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 209
+      },
+      {
+        "__id__": 211
+      }
+    ],
+    "_prefab": {
+      "__id__": 213
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.Node",
+    "_name": "lab_time",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "_parent": {
+      "__id__": 202
+    },
+    "_children": [],
+    "_active": true,
+    "_components": [
+      {
+        "__id__": 204
+      },
+      {
+        "__id__": 206
+      }
+    ],
+    "_prefab": {
+      "__id__": 208
+    },
+    "_lpos": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_lrot": {
+      "__type__": "cc.Quat",
+      "x": 0,
+      "y": 0,
+      "z": 0,
+      "w": 1
+    },
+    "_lscale": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    },
+    "_mobility": 0,
+    "_layer": 33554432,
+    "_euler": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0,
+      "z": 0
+    },
+    "_id": ""
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
+      "__id__": 203
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 205
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 180,
+      "height": 80
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "b6wjPHp5xHtI1FDD1TD9Bh"
+  },
+  {
+    "__type__": "cc.Label",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 203
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 207
+    },
+    "_customMaterial": null,
+    "_srcBlendFactor": 2,
+    "_dstBlendFactor": 4,
+    "_color": {
+      "__type__": "cc.Color",
+      "r": 255,
+      "g": 255,
+      "b": 255,
+      "a": 255
+    },
+    "_string": "3",
+    "_horizontalAlign": 1,
+    "_verticalAlign": 1,
+    "_actualFontSize": 80,
+    "_fontSize": 80,
+    "_fontFamily": "Arial",
+    "_lineHeight": 80,
+    "_overflow": 0,
+    "_enableWrapText": true,
+    "_font": {
+      "__uuid__": "45a05140-0930-4611-bb56-3f5781a7144b",
+      "__expectedType__": "cc.BitmapFont"
+    },
+    "_isSystemFontUsed": false,
+    "_spacingX": 0,
+    "_isItalic": false,
+    "_isBold": false,
+    "_isUnderline": false,
+    "_underlineHeight": 2,
+    "_cacheMode": 0,
+    "_enableOutline": false,
+    "_outlineColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_outlineWidth": 2,
+    "_enableShadow": false,
+    "_shadowColor": {
+      "__type__": "cc.Color",
+      "r": 0,
+      "g": 0,
+      "b": 0,
+      "a": 255
+    },
+    "_shadowOffset": {
+      "__type__": "cc.Vec2",
+      "x": 2,
+      "y": 2
+    },
+    "_shadowBlur": 2,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "4d3Zr/pOlLW4C0DK3ChY3E"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
       "__id__": 1
     },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "980HdBIiZAnLO4nkBjbeIT",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 202
+    },
     "_enabled": true,
     "__prefab": {
+      "__id__": 210
+    },
+    "_contentSize": {
+      "__type__": "cc.Size",
+      "width": 100,
+      "height": 100
+    },
+    "_anchorPoint": {
+      "__type__": "cc.Vec2",
+      "x": 0.5,
+      "y": 0.5
+    },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "18+68hgMZP7ak3o1Zk8gw6"
+  },
+  {
+    "__type__": "a7a00WVabdEVr2M0cnl7gk7",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 202
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 212
+    },
+    "lab_time": {
       "__id__": 203
     },
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "70w6KvdjRDq6hmmOJ8KQrD"
+  },
+  {
+    "__type__": "cc.PrefabInfo",
+    "root": {
+      "__id__": 1
+    },
+    "asset": {
+      "__id__": 0
+    },
+    "fileId": "feyVg2knxPPo7m42dCONER",
+    "instance": null,
+    "targetOverrides": null,
+    "nestedPrefabInstanceRoots": null
+  },
+  {
+    "__type__": "cc.UITransform",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 215
+    },
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
@@ -4627,7 +4908,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 205
+      "__id__": 217
     },
     "_alignFlags": 45,
     "_target": null,
@@ -4663,7 +4944,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 207
+      "__id__": 219
     },
     "sfList": [
       {
@@ -4752,6 +5033,9 @@
     "touch_node": {
       "__id__": 94
     },
+    "count_time": {
+      "__id__": 202
+    },
     "_id": ""
   },
   {
@@ -4768,7 +5052,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 209
+      "__id__": 221
     },
     "_type": 0,
     "_inverted": false,
@@ -4790,7 +5074,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 211
+      "__id__": 223
     },
     "_customMaterial": null,
     "_srcBlendFactor": 2,

+ 58 - 39
assets/scene/main.scene

@@ -23,7 +23,7 @@
     "_active": true,
     "_components": [],
     "_prefab": {
-      "__id__": 30
+      "__id__": 31
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -54,7 +54,7 @@
     },
     "autoReleaseAssets": false,
     "_globals": {
-      "__id__": 31
+      "__id__": 32
     },
     "_id": "5cad85ad-e393-4bc6-aedf-858b69ac47e3"
   },
@@ -77,20 +77,17 @@
         "__id__": 8
       },
       {
-        "__id__": 13
+        "__id__": 14
       },
       {
-        "__id__": 18
+        "__id__": 19
       },
       {
-        "__id__": 22
+        "__id__": 23
       }
     ],
     "_active": true,
     "_components": [
-      {
-        "__id__": 26
-      },
       {
         "__id__": 27
       },
@@ -99,6 +96,9 @@
       },
       {
         "__id__": 29
+      },
+      {
+        "__id__": 30
       }
     ],
     "_prefab": null,
@@ -338,7 +338,7 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 12
+        "__id__": 13
       }
     ],
     "_prefab": null,
@@ -387,6 +387,9 @@
       },
       {
         "__id__": 11
+      },
+      {
+        "__id__": 12
       }
     ],
     "_prefab": null,
@@ -453,6 +456,22 @@
     "__prefab": null,
     "_id": "48oaqJng5Lo60gtdtiAdXC"
   },
+  {
+    "__type__": "cc.AudioSource",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 9
+    },
+    "_enabled": true,
+    "__prefab": null,
+    "_clip": null,
+    "_loop": false,
+    "_playOnAwake": false,
+    "_volume": 1,
+    "_id": "87res6W3FAuposaT8hPqCI"
+  },
   {
     "__type__": "cc.UITransform",
     "_name": "",
@@ -486,9 +505,6 @@
     "_children": [],
     "_active": true,
     "_components": [
-      {
-        "__id__": 14
-      },
       {
         "__id__": 15
       },
@@ -497,6 +513,9 @@
       },
       {
         "__id__": 17
+      },
+      {
+        "__id__": 18
       }
     ],
     "_prefab": null,
@@ -535,7 +554,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 13
+      "__id__": 14
     },
     "_enabled": true,
     "__prefab": null,
@@ -557,7 +576,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 13
+      "__id__": 14
     },
     "_enabled": true,
     "__prefab": null,
@@ -587,7 +606,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 13
+      "__id__": 14
     },
     "_enabled": false,
     "__prefab": null,
@@ -599,7 +618,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 13
+      "__id__": 14
     },
     "_enabled": true,
     "__prefab": null,
@@ -616,14 +635,14 @@
     "_children": [],
     "_active": false,
     "_components": [
-      {
-        "__id__": 19
-      },
       {
         "__id__": 20
       },
       {
         "__id__": 21
+      },
+      {
+        "__id__": 22
       }
     ],
     "_prefab": null,
@@ -662,7 +681,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 18
+      "__id__": 19
     },
     "_enabled": true,
     "__prefab": null,
@@ -684,7 +703,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 18
+      "__id__": 19
     },
     "_enabled": true,
     "__prefab": null,
@@ -714,7 +733,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 18
+      "__id__": 19
     },
     "_enabled": true,
     "__prefab": null,
@@ -731,14 +750,14 @@
     "_children": [],
     "_active": false,
     "_components": [
-      {
-        "__id__": 23
-      },
       {
         "__id__": 24
       },
       {
         "__id__": 25
+      },
+      {
+        "__id__": 26
       }
     ],
     "_prefab": null,
@@ -777,7 +796,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 22
+      "__id__": 23
     },
     "_enabled": true,
     "__prefab": null,
@@ -799,7 +818,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 22
+      "__id__": 23
     },
     "_enabled": true,
     "__prefab": null,
@@ -829,7 +848,7 @@
     "_objFlags": 0,
     "__editorExtras__": {},
     "node": {
-      "__id__": 22
+      "__id__": 23
     },
     "_enabled": true,
     "__prefab": null,
@@ -917,13 +936,13 @@
       "__id__": 3
     },
     "ui_parent": {
-      "__id__": 13
+      "__id__": 14
     },
     "laoding_view_wait": {
-      "__id__": 18
+      "__id__": 19
     },
     "send_msg_wait": {
-      "__id__": 22
+      "__id__": 23
     },
     "_id": "98LI+pKBxBApv8uU1sf2uQ"
   },
@@ -938,28 +957,28 @@
   {
     "__type__": "cc.SceneGlobals",
     "ambient": {
-      "__id__": 32
+      "__id__": 33
     },
     "shadows": {
-      "__id__": 33
+      "__id__": 34
     },
     "_skybox": {
-      "__id__": 34
+      "__id__": 35
     },
     "fog": {
-      "__id__": 35
+      "__id__": 36
     },
     "octree": {
-      "__id__": 36
+      "__id__": 37
     },
     "skin": {
-      "__id__": 37
+      "__id__": 38
     },
     "lightProbeInfo": {
-      "__id__": 38
+      "__id__": 39
     },
     "postSettings": {
-      "__id__": 39
+      "__id__": 40
     },
     "bakedWithStationaryMainLight": false,
     "bakedWithHighpLightmap": false

+ 13 - 1
assets/script/config.ts

@@ -68,7 +68,19 @@ export class config  {
     }
 
     public static AUDIO={
-        loading_bgm:"bgm/loading_bgm",
+        // loading_bgm:"bgm/loading_bgm",
+        home_bgm:"audio/ad_bgm_home", //主页音效
+        game_bgm:"audio/ad_bgm_game", //游戏音效
+        btn:"audio/ad_btn",//按钮
+        car_jia_su:"audio/ad_car_jia_su",//汽车加速
+        car_qi_dong:"audio/ad_car_qi_dong", //汽车启动
+        car_sha_che:"audio/ad_car_sha_che",//汽车刹车
+        buff_xi:"audio/ad_ci_tie", //buff 吸
+        buff_dun:"audio/ad_dun",//buff 盾
+        buff_xing:"audio/ad_xing",//buff 星
+        win:"audio/ad_win", //失败1
+        // fail_2:"audio/ad_fail2",//失败2
+        peng_zhuang:"audio/ad_peng_zhuang",//碰撞
     }
 
     public static UI = {

+ 21 - 1
assets/script/game/car.ts

@@ -9,6 +9,7 @@ import { DirType, model_content_item_data } from '../data';
 import { config } from '../config';
 import { imageCacheManager } from '../manager/imageCacheManager';
 import { userDataManager } from '../manager/userDataManager';
+import { audioManager } from '../manager/audioManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('car')
@@ -39,7 +40,7 @@ export class car extends Component {
     private carDir:DirType = DirType.NONE
     private canvas_width:number = 1080;
     private isStopY:boolean = false
-    private _curRingPos_1: Vec3 = new Vec3();//当前圆圈坐标
+    private isStartGame:Boolean = false
     @property(Node) spr:Node = null
     public init(m:Node,cb,cb1,g:game){
         this.spr.getComponent(Sprite).spriteFrame = imageCacheManager.getGameCarImageById(userDataManager.user_car_list.default_car_id)
@@ -55,6 +56,7 @@ export class car extends Component {
         this.buff_xing_status = false;
         this.isStopY = false;
         this.canvas_width = View.instance.getVisibleSize().width
+        audioManager.Instance().playSound(config.AUDIO.car_qi_dong)
         // let cd = this.node.getComponent(BoxCollider2D)
         // cd.off(Contact2DType.BEGIN_CONTACT)
         // cd.on(Contact2DType.BEGIN_CONTACT,this.onColliderCoin.bind(this))
@@ -134,6 +136,7 @@ export class car extends Component {
 
     onColliderBox(box_node:Node){
         if(box_node.getComponent(box)!=null){
+            audioManager.Instance().playSound(config.AUDIO.peng_zhuang)
             box_node.getComponent(box).hurt(this.shake.bind(this),this.buff_dun_status)
         }
     }
@@ -197,6 +200,7 @@ export class car extends Component {
         tween(this.lab_hp).delay(0.02).call(()=>{ this.isStopY = false}).start()
         if(this.hp<0){
             Tween.stopAllByTarget(this.node)
+            this.stopGame()
             // this.node.getComponent(RigidBody2D).gravityScale = 0
             // this.node.getComponent(RigidBody2D).linearDamping = 0
             this.over_cb()
@@ -228,6 +232,7 @@ export class car extends Component {
             this.scheduleOnce(this.cancelScheduleBuffXi.bind(this),tools.game_config.buff_xi)
             this.game_manager.getBuffShowView().showBuffXi()
         })
+        audioManager.Instance().playSound(config.AUDIO.buff_xi)
     }
 
     public cancelScheduleBuffXi(){
@@ -243,6 +248,7 @@ export class car extends Component {
             this.scheduleOnce(this.cancelScheduleBuffXing.bind(this),tools.game_config.buff_xing)
             this.game_manager.getBuffShowView().showBuffXing()
         })
+        audioManager.Instance().playSound(config.AUDIO.buff_xing)
     }
 
     public cancelScheduleBuffXing(){
@@ -258,6 +264,7 @@ export class car extends Component {
             this.scheduleOnce(this.cancelScheduleBuffDun.bind(this),tools.game_config.buff_dun)
             this.game_manager.getBuffShowView().showBuffDun()  
         })
+        audioManager.Instance().playSound(config.AUDIO.buff_dun)
     }
 
 
@@ -270,9 +277,18 @@ export class car extends Component {
     public setMoveSpeedX(speed_x:number){
         // this.move_speed_x = speed_x
     }
+    public startGame(){
+        this.isStartGame = true
+    }
+    public stopGame(){
+        this.isStartGame = false
+    }
     check(){
     }
     protected update(dt: number): void {
+        if(!this.isStartGame){
+            return
+        }
         if(this.map!=null&&this.hp>=0){
             let x = 0
             let y = this.isStopY?this.node.position.y:this.node.position.y+this.move_speed_y.valueOf()*dt;
@@ -358,6 +374,10 @@ export class car extends Component {
     public setDisDir(dis:number){
         this.speed_bei = dis / 10
 
+        if(this.speed_bei>5){
+            audioManager.Instance().playSound(config.AUDIO.car_sha_che,0.1)
+        }
+
         if(this.carDir==DirType.LEFT){
             this.mDir = new Vec3(this.node.position.x-dis,this.node.position.y)
         }

+ 24 - 0
assets/script/game/count_time_start.ts

@@ -0,0 +1,24 @@
+import { _decorator, Component, Label, Node } from 'cc';
+const { ccclass, property } = _decorator;
+
+@ccclass('count_time_start')
+export class count_time_start extends Component {
+    @property(Node) lab_time:Node = null
+    private count:number = 0;
+    public startGame(num:number,cb:Function){
+        this.count = num
+        this.lab_time.getComponent(Label).string = this.count + ""
+        this.lab_time.active = true
+        this.schedule(()=>{
+            if(this.count<=0){
+                cb()
+                this.lab_time.active = false
+                this.unscheduleAllCallbacks()
+            }
+            this.lab_time.getComponent(Label).string = this.count + ""
+            this.count--;
+        },1)
+   }
+}
+
+

+ 9 - 0
assets/script/game/count_time_start.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "a7a00595-69b7-4456-bd8c-d1c9e5ee093b",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 7 - 3
assets/script/game/game.ts

@@ -14,6 +14,8 @@ import { Joystick } from './joystick';
 import { touch } from './touch';
 import { config } from '../config';
 import { coin } from './coin';
+import { audioManager } from '../manager/audioManager';
+import { count_time_start } from './count_time_start';
 const { ccclass, property } = _decorator;
 
 @ccclass('game')
@@ -29,18 +31,20 @@ export class game extends Component {
     @property(buff_show) bf_show:buff_show = null
     @property(pool) game_pool_manager:pool = null
     @property(Node) touch_node:Node = null
+    @property(Node) count_time:Node = null
     private mIndex:number = 0;
     private mHeight:number = 0;
-    private start_pos:Vec3 = Vec3.ZERO;
     private move_pos:Vec3 = Vec3.ZERO;
-    private is_move:boolean = false;
     public offsetX:number = 0;
     private gameBoxList:Node[] = []
     private gameWallList:Node[] = []
     private gameCoinList:Node[] = []
     public show(){
         this.removeAll()
-  
+        audioManager.Instance().playMusic(config.AUDIO.game_bgm)
+        this.count_time.getComponent(count_time_start).startGame(3,()=>{
+            this.car.getComponent(car).startGame()
+        })
         this.gameBoxList = []
         this.gameWallList = []
         this.gameCoinList = []

+ 5 - 3
assets/script/game/results.ts

@@ -1,6 +1,7 @@
 import { _decorator, Component, Label, Node } from 'cc';
 import { http } from '../http';
 import { config } from '../config';
+import { audioManager } from '../manager/audioManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('results')
@@ -30,11 +31,12 @@ export class results extends Component {
                 //     console.log("regions",d)
                 // })
 
-                http.get(config.STATIC_API.rankings(0),(err,data)=>{
-                    console.log("rankings",data)
-                })
+                // http.get(config.STATIC_API.rankings(0),(err,data)=>{
+                //     console.log("rankings",data)
+                // })
             }
         })
+        audioManager.Instance().playSound(config.AUDIO.win)
         this.node.active = true
         this.lab_scores.getComponent(Label).string = "积分:"+ scores+""
         this.call_back = call

+ 65 - 29
assets/script/manager/audioManager.ts

@@ -1,47 +1,83 @@
-import { _decorator, AudioClip, AudioSource, Component, Node } from 'cc';
+import { _decorator, AudioClip, AudioSource, Component, Node, tween } from 'cc';
 import { ResourceUtil } from './ResourceUtil';
+import { config } from '../config';
 const { ccclass, property } = _decorator;
 
 @ccclass('audioManager')
 export class audioManager extends Component {
     public arrSound: any = [];
-    public audios: any = {};
+    public audios_map: Map<string,Node> = new Map;
     public musicVolume: number = 0.8;
     public soundVolume: number = 1;
-    public playMusic(clip:AudioClip){
-        if(clip!=null){
+    private static instance:audioManager =null;
+    public static Instance(){
+        return this.instance
+    }
+    protected start(): void {
+        audioManager.instance = this
+        this.init()
+    }
+    protected onLoad(): void {
+        this.scheduleOnce(()=>{
+            this.playMusic(config.AUDIO.home_bgm)
+        },3)
+    }
+    public init(){
+        this.audios_map.clear()
+        for (const key in config.AUDIO) {
+            if (Object.prototype.hasOwnProperty.call( config.AUDIO, key)) {
+                const path = config.AUDIO[key];
+                ResourceUtil.loadRes(path, AudioClip, (err: any, clip: any)=> {
+                    if(!err){
+                        let node = new Node
+                        node.parent = this.node
+                        node.addComponent(AudioSource).clip = clip
+                        this.audios_map.set(path,node)
+                    }
+              
+                });
+            }
+        }
+    }
+    public playBGM(clip:AudioClip){
+        if(this.getSound().clip!=null){
+            this.getSound().stop()
             this.getSound().clip = null;
-            this.getSound().loop = true;
-            this.getSound().clip = clip;
-            this.getSound().play()
+        }
+        this.getSound().clip = clip;
+        this.getSound().loop = true;
+        this.getSound().play()
+    }
+    public playMusic(path:string){
+        if(this.audios_map.get(path)!=null){
+            this.playBGM(this.audios_map.get(path).getComponent(AudioSource).clip)
+        }else{
+            ResourceUtil.loadRes(path, AudioClip, (err: any, clip: any)=> {
+                let node = new Node
+                node.parent = this.node
+                node.addComponent(AudioSource).clip = clip
+                this.audios_map.set(path,node)
+                this.playBGM(node.addComponent(AudioSource).clip)
+            });
         }
     }
-    public playSound(path:string){
+    public playSound(path:string,soundVolume:number = null){
         if(path.length<=0){
             return
         }
         let loop:boolean = false
-        ResourceUtil.loadRes(path, AudioClip, (err: any, clip: any)=> {
-            let tmp = {} as any;
-            tmp.clip = clip;
-            tmp.loop = loop;
-            tmp.isMusic = false;
-            this.arrSound.push(tmp);
-
-            if (loop) {
-                this.audios[path] = tmp;
-                clip.setLoop(loop);
-            }
-
-            clip.setVolume(this.soundVolume);
-            
-            clip.playOneShot();
-
-            clip.once('ended', ()=>{
-                ResourceUtil.remove(this.arrSound, (obj: any)=>{
-                    return obj.clip === tmp.clip;
-                });
-            })
+        let play = (node)=>{
+            node.getComponent(AudioSource).playOneShot(node.getComponent(AudioSource).clip,soundVolume?soundVolume:this.soundVolume)
+        }
+        if(this.audios_map.get(path)){
+            play(this.audios_map.get(path))
+        }
+        ResourceUtil.loadRes(path, AudioClip, (err: any, clip: AudioClip)=> {
+            let node = new Node
+            node.parent = this.node
+            node.addComponent(AudioSource).clip = clip
+            this.audios_map.set(path,node)
+            play(node)
         });
     }
 

+ 3 - 0
assets/script/manager/uiManager.ts

@@ -1,4 +1,6 @@
 import { Node, Prefab, instantiate, resources } from "cc";
+import { audioManager } from "./audioManager";
+import { config } from "../config";
 
 export class uiManager  {
     private static instance:uiManager =null;
@@ -73,6 +75,7 @@ export class uiManager  {
 
     public onButtonListen(btn:Node,call_back){
         btn.on(Node.EventType.TOUCH_END,()=>{
+            audioManager.Instance().playSound(config.AUDIO.btn)
             call_back()
         })
     }