diff --git a/assets/bundle1.meta b/assets/bundle1.meta new file mode 100644 index 0000000..6219990 --- /dev/null +++ b/assets/bundle1.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "7a995555-e54a-4884-a1d2-99f976cd83c9", + "files": [], + "subMetas": {}, + "userData": { + "isBundle": true + } +} diff --git a/assets/bundle1/images.meta b/assets/bundle1/images.meta new file mode 100644 index 0000000..ec55844 --- /dev/null +++ b/assets/bundle1/images.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "a1cb63d6-303b-43d6-87c5-72e7193afbab", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/resources/tileMap/Bg2.jpg b/assets/bundle1/images/Bg2.jpg similarity index 100% rename from assets/resources/tileMap/Bg2.jpg rename to assets/bundle1/images/Bg2.jpg diff --git a/assets/resources/tileMap/Bg2.jpg.meta b/assets/bundle1/images/Bg2.jpg.meta similarity index 100% rename from assets/resources/tileMap/Bg2.jpg.meta rename to assets/bundle1/images/Bg2.jpg.meta diff --git a/assets/bundle1/music.meta b/assets/bundle1/music.meta new file mode 100644 index 0000000..cc63388 --- /dev/null +++ b/assets/bundle1/music.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "23e28622-675d-4df7-85ca-7a99241e265a", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/bundle1/music/Attack.mp3 b/assets/bundle1/music/Attack.mp3 new file mode 100644 index 0000000..ceb7642 Binary files /dev/null and b/assets/bundle1/music/Attack.mp3 differ diff --git a/assets/bundle1/music/Attack.mp3.meta b/assets/bundle1/music/Attack.mp3.meta new file mode 100644 index 0000000..8103113 --- /dev/null +++ b/assets/bundle1/music/Attack.mp3.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "5d1cb41c-cc52-4f72-abf1-04e6b5e26278", + "files": [ + ".json", + ".mp3" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/bundle1/music/Bgm.mp3 b/assets/bundle1/music/Bgm.mp3 new file mode 100644 index 0000000..117ff62 Binary files /dev/null and b/assets/bundle1/music/Bgm.mp3 differ diff --git a/assets/bundle1/music/Bgm.mp3.meta b/assets/bundle1/music/Bgm.mp3.meta new file mode 100644 index 0000000..b3a792c --- /dev/null +++ b/assets/bundle1/music/Bgm.mp3.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "87656531-d490-442b-9f0e-e51ae6468158", + "files": [ + ".json", + ".mp3" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/bundle1/music/Failed.mp3 b/assets/bundle1/music/Failed.mp3 new file mode 100644 index 0000000..0da98c6 Binary files /dev/null and b/assets/bundle1/music/Failed.mp3 differ diff --git a/assets/bundle1/music/Failed.mp3.meta b/assets/bundle1/music/Failed.mp3.meta new file mode 100644 index 0000000..43b6fe8 --- /dev/null +++ b/assets/bundle1/music/Failed.mp3.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "863e3e99-2900-4c45-b170-a9a72611887b", + "files": [ + ".json", + ".mp3" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/bundle1/music/Run.mp3 b/assets/bundle1/music/Run.mp3 new file mode 100644 index 0000000..0c5ca6d Binary files /dev/null and b/assets/bundle1/music/Run.mp3 differ diff --git a/assets/bundle1/music/Run.mp3.meta b/assets/bundle1/music/Run.mp3.meta new file mode 100644 index 0000000..de176eb --- /dev/null +++ b/assets/bundle1/music/Run.mp3.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.0.0", + "importer": "audio-clip", + "imported": true, + "uuid": "68342fce-3f17-4aa8-9598-fff07c731a54", + "files": [ + ".json", + ".mp3" + ], + "subMetas": {}, + "userData": { + "downloadMode": 0 + } +} diff --git a/assets/scenes/main.scene b/assets/scenes/main.scene index 3de60bd..660f1a5 100644 --- a/assets/scenes/main.scene +++ b/assets/scenes/main.scene @@ -52,7 +52,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 146 + "__id__": 150 }, "_id": "58132e64-0171-4c7f-89be-a2984ca7de6b" }, @@ -75,58 +75,64 @@ "__id__": 29 }, { - "__id__": 37 + "__id__": 39 }, { - "__id__": 40 + "__id__": 42 }, { - "__id__": 54 + "__id__": 56 }, { - "__id__": 63 + "__id__": 65 }, { - "__id__": 72 + "__id__": 74 }, { - "__id__": 81 + "__id__": 83 }, { - "__id__": 90 + "__id__": 92 }, { - "__id__": 99 + "__id__": 101 }, { - "__id__": 108 + "__id__": 110 }, { - "__id__": 117 + "__id__": 119 }, { - "__id__": 126 + "__id__": 128 }, { - "__id__": 135 + "__id__": 137 }, { "__id__": 6 }, { "__id__": 33 + }, + { + "__id__": 37 + }, + { + "__id__": 146 } ], "_active": true, "_components": [ { - "__id__": 144 + "__id__": 148 }, { "__id__": 32 }, { - "__id__": 145 + "__id__": 149 } ], "_prefab": null, @@ -1193,6 +1199,9 @@ "pathfinder": { "__id__": 28 }, + "attackAudio": { + "__id__": 37 + }, "moveSpeed": 300, "mapWidth": 1080, "mapHeight": 1920, @@ -1351,7 +1360,7 @@ }, { "__type__": "cc.Node", - "_name": "Manager", + "_name": "Attack", "_objFlags": 0, "__editorExtras__": {}, "_parent": { @@ -1362,9 +1371,73 @@ "_components": [ { "__id__": 38 + } + ], + "_prefab": null, + "_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": "38XXFhq2NMY6gzeaFF7lWk" + }, + { + "__type__": "cc.AudioSource", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 37 + }, + "_enabled": true, + "__prefab": null, + "_clip": { + "__uuid__": "5d1cb41c-cc52-4f72-abf1-04e6b5e26278", + "__expectedType__": "cc.AudioClip" + }, + "_loop": true, + "_playOnAwake": false, + "_volume": 1, + "_id": "73BrdnBedC5Yy6rg1H7I4I" + }, + { + "__type__": "cc.Node", + "_name": "Manager", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 40 }, { - "__id__": 39 + "__id__": 41 } ], "_prefab": null, @@ -1403,7 +1476,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 39 }, "_enabled": true, "__prefab": null, @@ -1425,7 +1498,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 37 + "__id__": 39 }, "_enabled": true, "__prefab": null, @@ -1447,22 +1520,22 @@ }, "_children": [ { - "__id__": 41 + "__id__": 43 }, { - "__id__": 44 + "__id__": 46 }, { - "__id__": 47 + "__id__": 49 }, { - "__id__": 50 + "__id__": 52 } ], "_active": true, "_components": [ { - "__id__": 53 + "__id__": 55 } ], "_prefab": null, @@ -1501,16 +1574,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 40 + "__id__": 42 }, "_children": [], "_active": true, "_components": [ { - "__id__": 42 + "__id__": 44 }, { - "__id__": 43 + "__id__": 45 } ], "_prefab": null, @@ -1549,7 +1622,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 41 + "__id__": 43 }, "_enabled": true, "__prefab": null, @@ -1571,7 +1644,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 41 + "__id__": 43 }, "_enabled": true, "__prefab": null, @@ -1610,16 +1683,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 40 + "__id__": 42 }, "_children": [], "_active": true, "_components": [ { - "__id__": 45 + "__id__": 47 }, { - "__id__": 46 + "__id__": 48 } ], "_prefab": null, @@ -1658,7 +1731,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 44 + "__id__": 46 }, "_enabled": true, "__prefab": null, @@ -1680,7 +1753,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 44 + "__id__": 46 }, "_enabled": true, "__prefab": null, @@ -1719,16 +1792,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 40 + "__id__": 42 }, "_children": [], "_active": true, "_components": [ { - "__id__": 48 + "__id__": 50 }, { - "__id__": 49 + "__id__": 51 } ], "_prefab": null, @@ -1767,7 +1840,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 49 }, "_enabled": true, "__prefab": null, @@ -1789,7 +1862,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 47 + "__id__": 49 }, "_enabled": true, "__prefab": null, @@ -1828,16 +1901,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 40 + "__id__": 42 }, "_children": [], "_active": true, "_components": [ { - "__id__": 51 + "__id__": 53 }, { - "__id__": 52 + "__id__": 54 } ], "_prefab": null, @@ -1876,7 +1949,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 50 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1898,7 +1971,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 50 + "__id__": 52 }, "_enabled": true, "__prefab": null, @@ -1937,7 +2010,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 40 + "__id__": 42 }, "_enabled": true, "__prefab": null, @@ -1963,17 +2036,11 @@ }, "_children": [ { - "__id__": 55 + "__id__": 57 } ], "_active": true, "_components": [ - { - "__id__": 58 - }, - { - "__id__": 59 - }, { "__id__": 60 }, @@ -1982,6 +2049,12 @@ }, { "__id__": 62 + }, + { + "__id__": 63 + }, + { + "__id__": 64 } ], "_prefab": null, @@ -2020,16 +2093,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 54 + "__id__": 56 }, "_children": [], "_active": true, "_components": [ { - "__id__": 56 + "__id__": 58 }, { - "__id__": 57 + "__id__": 59 } ], "_prefab": null, @@ -2068,7 +2141,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 55 + "__id__": 57 }, "_enabled": true, "__prefab": null, @@ -2090,7 +2163,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 55 + "__id__": 57 }, "_enabled": true, "__prefab": null, @@ -2152,7 +2225,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -2174,7 +2247,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -2213,7 +2286,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -2244,7 +2317,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -2272,7 +2345,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 54 + "__id__": 56 }, "_enabled": true, "__prefab": null, @@ -2304,17 +2377,11 @@ }, "_children": [ { - "__id__": 64 + "__id__": 66 } ], "_active": true, "_components": [ - { - "__id__": 67 - }, - { - "__id__": 68 - }, { "__id__": 69 }, @@ -2323,6 +2390,12 @@ }, { "__id__": 71 + }, + { + "__id__": 72 + }, + { + "__id__": 73 } ], "_prefab": null, @@ -2361,16 +2434,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 63 + "__id__": 65 }, "_children": [], "_active": true, "_components": [ { - "__id__": 65 + "__id__": 67 }, { - "__id__": 66 + "__id__": 68 } ], "_prefab": null, @@ -2409,7 +2482,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -2431,7 +2504,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 64 + "__id__": 66 }, "_enabled": true, "__prefab": null, @@ -2493,7 +2566,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2515,7 +2588,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2554,7 +2627,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2585,7 +2658,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2613,7 +2686,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 63 + "__id__": 65 }, "_enabled": true, "__prefab": null, @@ -2645,17 +2718,11 @@ }, "_children": [ { - "__id__": 73 + "__id__": 75 } ], "_active": true, "_components": [ - { - "__id__": 76 - }, - { - "__id__": 77 - }, { "__id__": 78 }, @@ -2664,6 +2731,12 @@ }, { "__id__": 80 + }, + { + "__id__": 81 + }, + { + "__id__": 82 } ], "_prefab": null, @@ -2702,16 +2775,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 72 + "__id__": 74 }, "_children": [], "_active": true, "_components": [ { - "__id__": 74 + "__id__": 76 }, { - "__id__": 75 + "__id__": 77 } ], "_prefab": null, @@ -2750,7 +2823,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 73 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2772,7 +2845,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 73 + "__id__": 75 }, "_enabled": true, "__prefab": null, @@ -2834,7 +2907,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2856,7 +2929,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2895,7 +2968,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2926,7 +2999,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2954,7 +3027,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 72 + "__id__": 74 }, "_enabled": true, "__prefab": null, @@ -2986,17 +3059,11 @@ }, "_children": [ { - "__id__": 82 + "__id__": 84 } ], "_active": true, "_components": [ - { - "__id__": 85 - }, - { - "__id__": 86 - }, { "__id__": 87 }, @@ -3005,6 +3072,12 @@ }, { "__id__": 89 + }, + { + "__id__": 90 + }, + { + "__id__": 91 } ], "_prefab": null, @@ -3043,16 +3116,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 81 + "__id__": 83 }, "_children": [], "_active": true, "_components": [ { - "__id__": 83 + "__id__": 85 }, { - "__id__": 84 + "__id__": 86 } ], "_prefab": null, @@ -3091,7 +3164,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 82 + "__id__": 84 }, "_enabled": true, "__prefab": null, @@ -3113,7 +3186,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 82 + "__id__": 84 }, "_enabled": true, "__prefab": null, @@ -3175,7 +3248,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 81 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -3197,7 +3270,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 81 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -3236,7 +3309,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 81 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -3267,7 +3340,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 81 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -3295,7 +3368,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 81 + "__id__": 83 }, "_enabled": true, "__prefab": null, @@ -3327,17 +3400,11 @@ }, "_children": [ { - "__id__": 91 + "__id__": 93 } ], "_active": true, "_components": [ - { - "__id__": 94 - }, - { - "__id__": 95 - }, { "__id__": 96 }, @@ -3346,6 +3413,12 @@ }, { "__id__": 98 + }, + { + "__id__": 99 + }, + { + "__id__": 100 } ], "_prefab": null, @@ -3384,16 +3457,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 90 + "__id__": 92 }, "_children": [], "_active": true, "_components": [ { - "__id__": 92 + "__id__": 94 }, { - "__id__": 93 + "__id__": 95 } ], "_prefab": null, @@ -3432,7 +3505,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 91 + "__id__": 93 }, "_enabled": true, "__prefab": null, @@ -3454,7 +3527,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 91 + "__id__": 93 }, "_enabled": true, "__prefab": null, @@ -3516,7 +3589,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -3538,7 +3611,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -3577,7 +3650,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -3608,7 +3681,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -3636,7 +3709,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 90 + "__id__": 92 }, "_enabled": true, "__prefab": null, @@ -3668,17 +3741,11 @@ }, "_children": [ { - "__id__": 100 + "__id__": 102 } ], "_active": true, "_components": [ - { - "__id__": 103 - }, - { - "__id__": 104 - }, { "__id__": 105 }, @@ -3687,6 +3754,12 @@ }, { "__id__": 107 + }, + { + "__id__": 108 + }, + { + "__id__": 109 } ], "_prefab": null, @@ -3725,16 +3798,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 99 + "__id__": 101 }, "_children": [], "_active": true, "_components": [ { - "__id__": 101 + "__id__": 103 }, { - "__id__": 102 + "__id__": 104 } ], "_prefab": null, @@ -3773,7 +3846,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 100 + "__id__": 102 }, "_enabled": true, "__prefab": null, @@ -3795,7 +3868,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 100 + "__id__": 102 }, "_enabled": true, "__prefab": null, @@ -3857,7 +3930,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -3879,7 +3952,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -3918,7 +3991,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -3949,7 +4022,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -3977,7 +4050,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 99 + "__id__": 101 }, "_enabled": true, "__prefab": null, @@ -4009,17 +4082,11 @@ }, "_children": [ { - "__id__": 109 + "__id__": 111 } ], "_active": true, "_components": [ - { - "__id__": 112 - }, - { - "__id__": 113 - }, { "__id__": 114 }, @@ -4028,6 +4095,12 @@ }, { "__id__": 116 + }, + { + "__id__": 117 + }, + { + "__id__": 118 } ], "_prefab": null, @@ -4066,16 +4139,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 108 + "__id__": 110 }, "_children": [], "_active": true, "_components": [ { - "__id__": 110 + "__id__": 112 }, { - "__id__": 111 + "__id__": 113 } ], "_prefab": null, @@ -4114,7 +4187,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 109 + "__id__": 111 }, "_enabled": true, "__prefab": null, @@ -4136,7 +4209,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 109 + "__id__": 111 }, "_enabled": true, "__prefab": null, @@ -4198,7 +4271,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -4220,7 +4293,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -4259,7 +4332,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -4290,7 +4363,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -4318,7 +4391,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 108 + "__id__": 110 }, "_enabled": true, "__prefab": null, @@ -4350,17 +4423,11 @@ }, "_children": [ { - "__id__": 118 + "__id__": 120 } ], "_active": true, "_components": [ - { - "__id__": 121 - }, - { - "__id__": 122 - }, { "__id__": 123 }, @@ -4369,6 +4436,12 @@ }, { "__id__": 125 + }, + { + "__id__": 126 + }, + { + "__id__": 127 } ], "_prefab": null, @@ -4407,16 +4480,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 117 + "__id__": 119 }, "_children": [], "_active": true, "_components": [ { - "__id__": 119 + "__id__": 121 }, { - "__id__": 120 + "__id__": 122 } ], "_prefab": null, @@ -4455,7 +4528,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 118 + "__id__": 120 }, "_enabled": true, "__prefab": null, @@ -4477,7 +4550,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 118 + "__id__": 120 }, "_enabled": true, "__prefab": null, @@ -4539,7 +4612,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 117 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -4561,7 +4634,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 117 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -4600,7 +4673,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 117 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -4631,7 +4704,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 117 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -4659,7 +4732,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 117 + "__id__": 119 }, "_enabled": true, "__prefab": null, @@ -4691,17 +4764,11 @@ }, "_children": [ { - "__id__": 127 + "__id__": 129 } ], "_active": true, "_components": [ - { - "__id__": 130 - }, - { - "__id__": 131 - }, { "__id__": 132 }, @@ -4710,6 +4777,12 @@ }, { "__id__": 134 + }, + { + "__id__": 135 + }, + { + "__id__": 136 } ], "_prefab": null, @@ -4748,16 +4821,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 126 + "__id__": 128 }, "_children": [], "_active": true, "_components": [ { - "__id__": 128 + "__id__": 130 }, { - "__id__": 129 + "__id__": 131 } ], "_prefab": null, @@ -4796,7 +4869,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 127 + "__id__": 129 }, "_enabled": true, "__prefab": null, @@ -4818,7 +4891,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 127 + "__id__": 129 }, "_enabled": true, "__prefab": null, @@ -4880,7 +4953,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 128 }, "_enabled": true, "__prefab": null, @@ -4902,7 +4975,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 128 }, "_enabled": true, "__prefab": null, @@ -4941,7 +5014,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 128 }, "_enabled": true, "__prefab": null, @@ -4972,7 +5045,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 128 }, "_enabled": true, "__prefab": null, @@ -5000,7 +5073,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 126 + "__id__": 128 }, "_enabled": true, "__prefab": null, @@ -5032,17 +5105,11 @@ }, "_children": [ { - "__id__": 136 + "__id__": 138 } ], "_active": true, "_components": [ - { - "__id__": 139 - }, - { - "__id__": 140 - }, { "__id__": 141 }, @@ -5051,6 +5118,12 @@ }, { "__id__": 143 + }, + { + "__id__": 144 + }, + { + "__id__": 145 } ], "_prefab": null, @@ -5089,16 +5162,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 135 + "__id__": 137 }, "_children": [], "_active": true, "_components": [ { - "__id__": 137 + "__id__": 139 }, { - "__id__": 138 + "__id__": 140 } ], "_prefab": null, @@ -5137,7 +5210,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 136 + "__id__": 138 }, "_enabled": true, "__prefab": null, @@ -5159,7 +5232,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 136 + "__id__": 138 }, "_enabled": true, "__prefab": null, @@ -5221,7 +5294,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 135 + "__id__": 137 }, "_enabled": true, "__prefab": null, @@ -5243,7 +5316,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 135 + "__id__": 137 }, "_enabled": true, "__prefab": null, @@ -5282,7 +5355,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 135 + "__id__": 137 }, "_enabled": true, "__prefab": null, @@ -5313,7 +5386,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 135 + "__id__": 137 }, "_enabled": true, "__prefab": null, @@ -5341,7 +5414,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 135 + "__id__": 137 }, "_enabled": true, "__prefab": null, @@ -5363,6 +5436,70 @@ }, "_id": "8fSg2JDOJHeagIqakOhwiB" }, + { + "__type__": "cc.Node", + "_name": "Bgm", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 147 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -360, + "y": -667, + "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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "2ffE4Rv0hKnYOeEDsMe9h3" + }, + { + "__type__": "cc.AudioSource", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 146 + }, + "_enabled": true, + "__prefab": null, + "_clip": { + "__uuid__": "87656531-d490-442b-9f0e-e51ae6468158", + "__expectedType__": "cc.AudioClip" + }, + "_loop": true, + "_playOnAwake": true, + "_volume": 1, + "_id": "b6klUdp/NFF4ZPGqWCwuBG" + }, { "__type__": "cc.UITransform", "_name": "", @@ -5418,29 +5555,29 @@ { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 147 - }, - "shadows": { - "__id__": 148 - }, - "_skybox": { - "__id__": 149 - }, - "fog": { - "__id__": 150 - }, - "octree": { "__id__": 151 }, - "skin": { + "shadows": { "__id__": 152 }, - "lightProbeInfo": { + "_skybox": { "__id__": 153 }, - "postSettings": { + "fog": { "__id__": 154 }, + "octree": { + "__id__": 155 + }, + "skin": { + "__id__": 156 + }, + "lightProbeInfo": { + "__id__": 157 + }, + "postSettings": { + "__id__": 158 + }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false }, diff --git a/assets/scenes/start.scene b/assets/scenes/start.scene new file mode 100644 index 0000000..f6a96e5 --- /dev/null +++ b/assets/scenes/start.scene @@ -0,0 +1,468 @@ +[ + { + "__type__": "cc.SceneAsset", + "_name": "start", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "scene": { + "__id__": 1 + } + }, + { + "__type__": "cc.Scene", + "_name": "start", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_components": [], + "_prefab": null, + "_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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "autoReleaseAssets": false, + "_globals": { + "__id__": 9 + }, + "_id": "eccd00c2-333a-4c29-ae63-fd35cf9b87d1" + }, + { + "__type__": "cc.Node", + "_name": "Canvas", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + } + ], + "_active": true, + "_components": [ + { + "__id__": 5 + }, + { + "__id__": 6 + }, + { + "__id__": 7 + }, + { + "__id__": 8 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 360, + "y": 667, + "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": "beI88Z2HpFELqR4T5EMHpg" + }, + { + "__type__": "cc.Node", + "_name": "Camera", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 1000 + }, + "_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": 1073741824, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "ebFwiq8gBFaYpqYbdoDODe" + }, + { + "__type__": "cc.Camera", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": null, + "_projection": 0, + "_priority": 0, + "_fov": 45, + "_fovAxis": 0, + "_orthoHeight": 667, + "_near": 0, + "_far": 2000, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": 1, + "_stencil": 0, + "_clearFlags": 7, + "_rect": { + "__type__": "cc.Rect", + "x": 0, + "y": 0, + "width": 1, + "height": 1 + }, + "_aperture": 19, + "_shutter": 7, + "_iso": 0, + "_screenScale": 1, + "_visibility": 1108344832, + "_targetTexture": null, + "_postProcess": null, + "_usePostProcess": false, + "_cameraType": -1, + "_trackingType": 0, + "_id": "63WIch3o5BEYRlXzTT0oWc" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 720, + "height": 1334 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "d6rUX5yfhMlKoWX2bSbawx" + }, + { + "__type__": "cc.Canvas", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_cameraComponent": { + "__id__": 4 + }, + "_alignCanvasWithScreen": true, + "_id": "12O/ljcVlEqLmVm3U2gEOQ" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 5.684341886080802e-14, + "_bottom": 5.684341886080802e-14, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 2, + "_lockFlags": 0, + "_id": "c5V1EV8IpMtrIvY1OE9t2u" + }, + { + "__type__": "e4e64bK2C9KxIsdCD5z8bBb", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "bundlesToLoad": [ + "bundle1" + ], + "targetScene": "main", + "_id": "d5tUALobRHR5p1X1I3XA07" + }, + { + "__type__": "cc.SceneGlobals", + "ambient": { + "__id__": 10 + }, + "shadows": { + "__id__": 11 + }, + "_skybox": { + "__id__": 12 + }, + "fog": { + "__id__": 13 + }, + "octree": { + "__id__": 14 + }, + "skin": { + "__id__": 15 + }, + "lightProbeInfo": { + "__id__": 16 + }, + "postSettings": { + "__id__": 17 + }, + "bakedWithStationaryMainLight": false, + "bakedWithHighpLightmap": false + }, + { + "__type__": "cc.AmbientInfo", + "_skyColorHDR": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0.520833125 + }, + "_skyColor": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0.520833125 + }, + "_skyIllumHDR": 20000, + "_skyIllum": 20000, + "_groundAlbedoHDR": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0 + }, + "_groundAlbedo": { + "__type__": "cc.Vec4", + "x": 0, + "y": 0, + "z": 0, + "w": 0 + }, + "_skyColorLDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.5, + "z": 0.8, + "w": 1 + }, + "_skyIllumLDR": 20000, + "_groundAlbedoLDR": { + "__type__": "cc.Vec4", + "x": 0.2, + "y": 0.2, + "z": 0.2, + "w": 1 + } + }, + { + "__type__": "cc.ShadowsInfo", + "_enabled": false, + "_type": 0, + "_normal": { + "__type__": "cc.Vec3", + "x": 0, + "y": 1, + "z": 0 + }, + "_distance": 0, + "_planeBias": 1, + "_shadowColor": { + "__type__": "cc.Color", + "r": 76, + "g": 76, + "b": 76, + "a": 255 + }, + "_maxReceived": 4, + "_size": { + "__type__": "cc.Vec2", + "x": 512, + "y": 512 + } + }, + { + "__type__": "cc.SkyboxInfo", + "_envLightingType": 0, + "_envmapHDR": null, + "_envmap": null, + "_envmapLDR": null, + "_diffuseMapHDR": null, + "_diffuseMapLDR": null, + "_enabled": false, + "_useHDR": true, + "_editableMaterial": null, + "_reflectionHDR": null, + "_reflectionLDR": null, + "_rotationAngle": 0 + }, + { + "__type__": "cc.FogInfo", + "_type": 0, + "_fogColor": { + "__type__": "cc.Color", + "r": 200, + "g": 200, + "b": 200, + "a": 255 + }, + "_enabled": false, + "_fogDensity": 0.3, + "_fogStart": 0.5, + "_fogEnd": 300, + "_fogAtten": 5, + "_fogTop": 1.5, + "_fogRange": 1.2, + "_accurate": false + }, + { + "__type__": "cc.OctreeInfo", + "_enabled": false, + "_minPos": { + "__type__": "cc.Vec3", + "x": -1024, + "y": -1024, + "z": -1024 + }, + "_maxPos": { + "__type__": "cc.Vec3", + "x": 1024, + "y": 1024, + "z": 1024 + }, + "_depth": 8 + }, + { + "__type__": "cc.SkinInfo", + "_enabled": false, + "_blurRadius": 0.01, + "_sssIntensity": 3 + }, + { + "__type__": "cc.LightProbeInfo", + "_giScale": 1, + "_giSamples": 1024, + "_bounces": 2, + "_reduceRinging": 0, + "_showProbe": true, + "_showWireframe": true, + "_showConvex": false, + "_data": null, + "_lightProbeSphereVolume": 1 + }, + { + "__type__": "cc.PostSettingsInfo", + "_toneMappingType": 0 + } +] \ No newline at end of file diff --git a/assets/scenes/start.scene.meta b/assets/scenes/start.scene.meta new file mode 100644 index 0000000..34be265 --- /dev/null +++ b/assets/scenes/start.scene.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.1.50", + "importer": "scene", + "imported": true, + "uuid": "eccd00c2-333a-4c29-ae63-fd35cf9b87d1", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/assets/scripts/PlayerController.ts b/assets/scripts/PlayerController.ts index 41c2a73..95d9c6d 100644 --- a/assets/scripts/PlayerController.ts +++ b/assets/scripts/PlayerController.ts @@ -1,4 +1,4 @@ -import { _decorator, Component, Node, Vec3, input, Input, EventTouch, Camera, view, tween, Animation, Collider2D, Contact2DType, Label, Color, Canvas, UITransform } from 'cc'; +import { _decorator, Component, Node, Vec3, input, Input, EventTouch, Camera, view, tween, Animation, Collider2D, Contact2DType, Label, Color, Canvas, UITransform, AudioSource } from 'cc'; import { TiledMapPathfinder } from './TiledMapPathfinder'; const { ccclass, property } = _decorator; @@ -19,6 +19,9 @@ export class PlayerController extends Component { @property(TiledMapPathfinder) pathfinder: TiledMapPathfinder | null = null; // 寻路组件 + @property(Node) + attackAudio: Node | null = null; // 攻击音效节点 + @property({ range: [1, 300] }) moveSpeed: number = 300; // 移动速度(像素/秒) @@ -400,6 +403,15 @@ export class PlayerController extends Component { const monsterHp = parseInt(monsterLabel.string) || 0; console.log('玩家生命值:', playerHp, '怪物生命值:', monsterHp); + // 播放攻击音效 + if (this.attackAudio) { + const audioSource = this.attackAudio.getComponent(AudioSource); + if (audioSource) { + audioSource.play(); + console.log('播放攻击音效'); + } + } + // 播放攻击动画 const monsterAnimation = otherCollider.node.getComponent(Animation); if (monsterAnimation) { @@ -469,6 +481,15 @@ export class PlayerController extends Component { } this.isAttacking = false; + + // 停止攻击音效 + if (this.attackAudio) { + const audioSource = this.attackAudio.getComponent(AudioSource); + if (audioSource) { + audioSource.stop(); + console.log('停止攻击音效'); + } + } }, 2); } diff --git a/assets/scripts/Start.ts b/assets/scripts/Start.ts new file mode 100644 index 0000000..36fa0bd --- /dev/null +++ b/assets/scripts/Start.ts @@ -0,0 +1,111 @@ +import { _decorator, Component, Node, assetManager, AssetManager, director, Scene } from 'cc'; +const { ccclass, property } = _decorator; + +@ccclass('Start') +export class Start extends Component { + // 需要加载的 bundle 列表 - 可以根据实际情况修改 + @property({ type: [String], tooltip: '需要加载的 bundle 名称列表' }) + private bundlesToLoad: string[] = ['bundle1']; + + // 目标场景名称 + @property({ type: String, tooltip: '加载完成后跳转的场景名称' }) + private targetScene: string = 'main'; + + // 已加载的 bundle 数量 + private loadedBundleCount: number = 0; + + // 存储已加载的 bundle + private loadedBundles: Map = new Map(); + + protected onLoad(): void { + // 加载所有 bundle + this.loadAllBundles(); + } + + start() { + + } + + update(deltaTime: number) { + + } + + /** + * 加载所有 bundle + */ + private loadAllBundles(): void { + if (this.bundlesToLoad.length === 0) { + console.log('没有需要加载的 bundle,直接跳转到目标场景'); + this.loadTargetScene(); + return; + } + + console.log(`开始加载 ${this.bundlesToLoad.length} 个 bundle:`, this.bundlesToLoad); + + for (const bundleName of this.bundlesToLoad) { + this.loadBundle(bundleName); + } + } + + /** + * 加载单个 bundle + */ + private loadBundle(bundleName: string): void { + assetManager.loadBundle(bundleName, (err: Error | null, bundle: AssetManager.Bundle | null) => { + if (err) { + console.error(`加载 ${bundleName} 分包失败:`, err); + // 即使加载失败也继续,确保不会因为一个 bundle 失败而卡住 + this.onBundleLoadComplete(); + return; + } + + if (bundle) { + console.log(`${bundleName} 分包加载成功`); + this.loadedBundles.set(bundleName, bundle); + this.onBundleLoadComplete(); + } + }); + } + + /** + * bundle 加载完成后的处理 + */ + private onBundleLoadComplete(): void { + this.loadedBundleCount++; + console.log(`已加载 ${this.loadedBundleCount}/${this.bundlesToLoad.length} 个 bundle`); + + // 检查是否所有 bundle 都已加载完成 + if (this.loadedBundleCount >= this.bundlesToLoad.length) { + this.onAllBundlesLoaded(); + } + } + + /** + * 所有 bundle 加载完成后的回调 + */ + private onAllBundlesLoaded(): void { + console.log('所有 bundle 加载完成!'); + console.log('成功加载的 bundles:', Array.from(this.loadedBundles.keys())); + + // 所有 bundle 加载完成后,跳转到目标场景 + this.loadTargetScene(); + } + + /** + * 加载目标场景 + */ + private loadTargetScene(): void { + console.log(`开始加载 ${this.targetScene} 场景...`); + + director.loadScene(this.targetScene, (err: Error | null, scene: Scene | null) => { + if (err) { + console.error(`加载 ${this.targetScene} 场景失败:`, err); + return; + } + + if (scene) { + console.log(`${this.targetScene} 场景加载成功!`); + } + }); + } +} diff --git a/assets/scripts/Start.ts.meta b/assets/scripts/Start.ts.meta new file mode 100644 index 0000000..dc68c99 --- /dev/null +++ b/assets/scripts/Start.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "e4e646ca-d82f-4ac4-8b1d-083e73f1b05b", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/settings/v2/packages/builder.json b/settings/v2/packages/builder.json index 7526e40..aaee9f7 100644 --- a/settings/v2/packages/builder.json +++ b/settings/v2/packages/builder.json @@ -1,3 +1,39 @@ { - "__version__": "1.3.9" + "__version__": "1.3.9", + "bundleConfig": { + "custom": { + "default": { + "displayName": "i18n:builder.asset_bundle.defaultConfig", + "configs": { + "native": { + "preferredOptions": { + "isRemote": false, + "compressionType": "merge_dep" + } + }, + "web": { + "preferredOptions": { + "isRemote": false, + "compressionType": "merge_dep" + }, + "fallbackOptions": { + "compressionType": "merge_dep" + } + }, + "miniGame": { + "fallbackOptions": { + "isRemote": false, + "compressionType": "merge_dep" + }, + "configMode": "fallback", + "overwriteSettings": { + "wechatgame": { + "compressionType": "subpackage" + } + } + } + } + } + } + } }