Selaa lähdekoodia

feat:修复碰撞与关卡bug

zouwuqiang 1 vuosi sitten
vanhempi
commit
a3a7f92403

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
assets/bundle/config/game/CheckpointLevel.json


+ 40 - 16
assets/bundle/game/prefab/level.prefab

@@ -22,17 +22,17 @@
         "__id__": 2
       },
       {
-        "__id__": 10
+        "__id__": 12
       }
     ],
     "_active": true,
     "_components": [
       {
-        "__id__": 18
+        "__id__": 20
       }
     ],
     "_prefab": {
-      "__id__": 20
+      "__id__": 22
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -109,6 +109,9 @@
       },
       {
         "__id__": 9
+      },
+      {
+        "__id__": 10
       }
     ],
     "removedComponents": []
@@ -175,6 +178,27 @@
       "z": 0
     }
   },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 11
+    },
+    "propertyPath": [
+      "_lscale"
+    ],
+    "value": {
+      "__type__": "cc.Vec3",
+      "x": 0.95,
+      "y": 1,
+      "z": 0.98
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "236EXh76Rd8aA1CxeoKsyl"
+    ]
+  },
   {
     "__type__": "cc.Node",
     "_objFlags": 0,
@@ -182,14 +206,14 @@
       "__id__": 1
     },
     "_prefab": {
-      "__id__": 11
+      "__id__": 13
     },
     "__editorExtras__": {}
   },
   {
     "__type__": "cc.PrefabInfo",
     "root": {
-      "__id__": 10
+      "__id__": 12
     },
     "asset": {
       "__uuid__": "39745771-ef67-4bcb-bf21-5e70199dfd6a@87aed",
@@ -197,7 +221,7 @@
     },
     "fileId": "00knp1gOxWX7tvjA9HJdYE",
     "instance": {
-      "__id__": 12
+      "__id__": 14
     },
     "targetOverrides": null
   },
@@ -211,16 +235,16 @@
     "mountedComponents": [],
     "propertyOverrides": [
       {
-        "__id__": 13
+        "__id__": 15
       },
       {
-        "__id__": 15
+        "__id__": 17
       },
       {
-        "__id__": 16
+        "__id__": 18
       },
       {
-        "__id__": 17
+        "__id__": 19
       }
     ],
     "removedComponents": []
@@ -228,7 +252,7 @@
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 14
+      "__id__": 16
     },
     "propertyPath": [
       "_name"
@@ -244,7 +268,7 @@
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 14
+      "__id__": 16
     },
     "propertyPath": [
       "_lpos"
@@ -259,7 +283,7 @@
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 14
+      "__id__": 16
     },
     "propertyPath": [
       "_lrot"
@@ -275,7 +299,7 @@
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 14
+      "__id__": 16
     },
     "propertyPath": [
       "_euler"
@@ -297,7 +321,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 19
+      "__id__": 21
     },
     "_id": ""
   },
@@ -318,7 +342,7 @@
     "targetOverrides": null,
     "nestedPrefabInstanceRoots": [
       {
-        "__id__": 10
+        "__id__": 12
       },
       {
         "__id__": 2

+ 92 - 44
assets/bundle/game/prefab/man.prefab

@@ -25,14 +25,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 22
+        "__id__": 30
       },
       {
-        "__id__": 24
+        "__id__": 32
       }
     ],
     "_prefab": {
-      "__id__": 26
+      "__id__": 34
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -109,24 +109,30 @@
         "__id__": 13
       },
       {
-        "__id__": 14
+        "__id__": 15
       },
       {
-        "__id__": 15
+        "__id__": 17
       },
       {
-        "__id__": 16
+        "__id__": 19
       },
       {
-        "__id__": 18
+        "__id__": 21
       },
       {
-        "__id__": 19
+        "__id__": 23
+      },
+      {
+        "__id__": 25
+      },
+      {
+        "__id__": 27
       }
     ],
     "removedComponents": [
       {
-        "__id__": 21
+        "__id__": 29
       }
     ]
   },
@@ -238,7 +244,7 @@
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 12
+      "__id__": 14
     },
     "propertyPath": [
       "_lpos"
@@ -250,10 +256,16 @@
       "z": 0.1
     }
   },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "f7/ZtQD0BWzrM82vzqL/si"
+    ]
+  },
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 12
+      "__id__": 16
     },
     "propertyPath": [
       "_lrot"
@@ -266,10 +278,16 @@
       "w": 6.123233995736766e-17
     }
   },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "f7/ZtQD0BWzrM82vzqL/si"
+    ]
+  },
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 12
+      "__id__": 18
     },
     "propertyPath": [
       "_euler"
@@ -281,10 +299,16 @@
       "z": 0
     }
   },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "f7/ZtQD0BWzrM82vzqL/si"
+    ]
+  },
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 17
+      "__id__": 20
     },
     "propertyPath": [
       "_shadowReceivingMode"
@@ -300,7 +324,7 @@
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 17
+      "__id__": 22
     },
     "propertyPath": [
       "_skinningRoot"
@@ -309,10 +333,16 @@
       "__id__": 2
     }
   },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "bcr4cT7E5YpL/rBqgMqCFC"
+    ]
+  },
   {
     "__type__": "CCPropertyOverrideInfo",
     "targetInfo": {
-      "__id__": 20
+      "__id__": 24
     },
     "propertyPath": [
       "_active"
@@ -325,6 +355,48 @@
       "0dHi82Kftf97r0Z4mo4ow0"
     ]
   },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 26
+    },
+    "propertyPath": [
+      "_lscale"
+    ],
+    "value": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "0dHi82Kftf97r0Z4mo4ow0"
+    ]
+  },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 28
+    },
+    "propertyPath": [
+      "_lscale"
+    ],
+    "value": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "f7/ZtQD0BWzrM82vzqL/si"
+    ]
+  },
   {
     "__type__": "cc.TargetInfo",
     "localID": [
@@ -341,7 +413,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 23
+      "__id__": 31
     },
     "ske": {
       "__id__": 7
@@ -362,17 +434,17 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 25
+      "__id__": 33
     },
     "_material": null,
     "_isTrigger": false,
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.46,
+      "y": 0.3,
       "z": 0.1
     },
-    "_radius": 0.2,
+    "_radius": 0.15,
     "_cylinderHeight": 0.4,
     "_direction": 1,
     "_id": ""
@@ -391,35 +463,11 @@
     },
     "fileId": "f70CVRTetOVJ68YqxHhCCz",
     "instance": null,
-    "targetOverrides": [
-      {
-        "__id__": 27
-      }
-    ],
+    "targetOverrides": [],
     "nestedPrefabInstanceRoots": [
       {
         "__id__": 2
       }
     ]
-  },
-  {
-    "__type__": "cc.TargetOverrideInfo",
-    "source": null,
-    "sourceInfo": null,
-    "propertyPath": [
-      "ske"
-    ],
-    "target": {
-      "__id__": 2
-    },
-    "targetInfo": {
-      "__id__": 28
-    }
-  },
-  {
-    "__type__": "cc.TargetInfo",
-    "localID": [
-      "b2aCB3cnhGG5oKUHZc99cE"
-    ]
   }
 ]

+ 29 - 11
assets/bundle/game/prefab/man_balloon.prefab

@@ -25,14 +25,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 30
+        "__id__": 31
       },
       {
-        "__id__": 32
+        "__id__": 33
       }
     ],
     "_prefab": {
-      "__id__": 34
+      "__id__": 35
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -152,6 +152,9 @@
       },
       {
         "__id__": 29
+      },
+      {
+        "__id__": 30
       }
     ],
     "removedComponents": []
@@ -454,6 +457,21 @@
       "z": 0
     }
   },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 28
+    },
+    "propertyPath": [
+      "_lscale"
+    ],
+    "value": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    }
+  },
   {
     "__type__": "89a4fQ+54lH0bCd57qgAA2W",
     "_name": "",
@@ -464,7 +482,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 31
+      "__id__": 32
     },
     "ske": null,
     "_id": ""
@@ -483,24 +501,24 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 33
+      "__id__": 34
     },
     "_material": null,
     "_isTrigger": false,
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.46,
+      "y": 0.3,
       "z": 0.1
     },
-    "_radius": 0.2,
+    "_radius": 0.15,
     "_cylinderHeight": 0.4,
     "_direction": 1,
     "_id": ""
   },
   {
     "__type__": "cc.CompPrefabInfo",
-    "fileId": "390/Vq3GBIY4F8ayi3BneR"
+    "fileId": "4bTZkR35VH7qMwj2vlxNgC"
   },
   {
     "__type__": "cc.PrefabInfo",
@@ -514,7 +532,7 @@
     "instance": null,
     "targetOverrides": [
       {
-        "__id__": 35
+        "__id__": 36
       }
     ],
     "nestedPrefabInstanceRoots": [
@@ -526,7 +544,7 @@
   {
     "__type__": "cc.TargetOverrideInfo",
     "source": {
-      "__id__": 30
+      "__id__": 31
     },
     "sourceInfo": null,
     "propertyPath": [
@@ -536,7 +554,7 @@
       "__id__": 2
     },
     "targetInfo": {
-      "__id__": 36
+      "__id__": 37
     }
   },
   {

+ 35 - 11
assets/bundle/game/prefab/man_cane.prefab

@@ -25,14 +25,14 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 26
+        "__id__": 28
       },
       {
-        "__id__": 28
+        "__id__": 30
       }
     ],
     "_prefab": {
-      "__id__": 30
+      "__id__": 32
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -143,6 +143,9 @@
       },
       {
         "__id__": 25
+      },
+      {
+        "__id__": 26
       }
     ],
     "removedComponents": []
@@ -394,6 +397,27 @@
     ],
     "value": true
   },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 27
+    },
+    "propertyPath": [
+      "_lscale"
+    ],
+    "value": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "45fsTPZ3tX46s4/U8bCLsR"
+    ]
+  },
   {
     "__type__": "89a4fQ+54lH0bCd57qgAA2W",
     "_name": "",
@@ -404,7 +428,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 27
+      "__id__": 29
     },
     "ske": null,
     "_id": ""
@@ -423,24 +447,24 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 29
+      "__id__": 31
     },
     "_material": null,
     "_isTrigger": false,
     "_center": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 0.46,
+      "y": 0.3,
       "z": 0.1
     },
-    "_radius": 0.2,
+    "_radius": 0.15,
     "_cylinderHeight": 0.4,
     "_direction": 1,
     "_id": ""
   },
   {
     "__type__": "cc.CompPrefabInfo",
-    "fileId": "a4PxRc88NNUYSAISSFiGrh"
+    "fileId": "07G3Ub84lJPLNzDqWSWkY7"
   },
   {
     "__type__": "cc.PrefabInfo",
@@ -454,7 +478,7 @@
     "instance": null,
     "targetOverrides": [
       {
-        "__id__": 31
+        "__id__": 33
       }
     ],
     "nestedPrefabInstanceRoots": [
@@ -466,7 +490,7 @@
   {
     "__type__": "cc.TargetOverrideInfo",
     "source": {
-      "__id__": 26
+      "__id__": 28
     },
     "sourceInfo": null,
     "propertyPath": [
@@ -476,7 +500,7 @@
       "__id__": 2
     },
     "targetInfo": {
-      "__id__": 32
+      "__id__": 34
     }
   },
   {

+ 65 - 9
assets/bundle/game/prefab/man_hat.prefab

@@ -25,14 +25,17 @@
     "_active": true,
     "_components": [
       {
-        "__id__": 24
+        "__id__": 26
       },
       {
-        "__id__": 26
+        "__id__": 28
+      },
+      {
+        "__id__": 30
       }
     ],
     "_prefab": {
-      "__id__": 28
+      "__id__": 32
     },
     "_lpos": {
       "__type__": "cc.Vec3",
@@ -137,6 +140,9 @@
       },
       {
         "__id__": 23
+      },
+      {
+        "__id__": 24
       }
     ],
     "removedComponents": []
@@ -360,6 +366,27 @@
     ],
     "value": true
   },
+  {
+    "__type__": "CCPropertyOverrideInfo",
+    "targetInfo": {
+      "__id__": 25
+    },
+    "propertyPath": [
+      "_lscale"
+    ],
+    "value": {
+      "__type__": "cc.Vec3",
+      "x": 1,
+      "y": 1,
+      "z": 1
+    }
+  },
+  {
+    "__type__": "cc.TargetInfo",
+    "localID": [
+      "cbyTOlS39flqFsU1+BuMJb"
+    ]
+  },
   {
     "__type__": "89a4fQ+54lH0bCd57qgAA2W",
     "_name": "",
@@ -370,7 +397,7 @@
     },
     "_enabled": true,
     "__prefab": {
-      "__id__": 25
+      "__id__": 27
     },
     "ske": null,
     "_id": ""
@@ -387,9 +414,9 @@
     "node": {
       "__id__": 1
     },
-    "_enabled": true,
+    "_enabled": false,
     "__prefab": {
-      "__id__": 27
+      "__id__": 29
     },
     "_material": null,
     "_isTrigger": false,
@@ -408,6 +435,35 @@
     "__type__": "cc.CompPrefabInfo",
     "fileId": "034fDp+lNKdqJ8wKs2PDO2"
   },
+  {
+    "__type__": "cc.CapsuleCollider",
+    "_name": "",
+    "_objFlags": 0,
+    "__editorExtras__": {},
+    "node": {
+      "__id__": 1
+    },
+    "_enabled": true,
+    "__prefab": {
+      "__id__": 31
+    },
+    "_material": null,
+    "_isTrigger": false,
+    "_center": {
+      "__type__": "cc.Vec3",
+      "x": 0,
+      "y": 0.3,
+      "z": 0.1
+    },
+    "_radius": 0.15,
+    "_cylinderHeight": 0.4,
+    "_direction": 1,
+    "_id": ""
+  },
+  {
+    "__type__": "cc.CompPrefabInfo",
+    "fileId": "94ShLPUEhOtLSKaf3K5bhx"
+  },
   {
     "__type__": "cc.PrefabInfo",
     "root": {
@@ -420,7 +476,7 @@
     "instance": null,
     "targetOverrides": [
       {
-        "__id__": 29
+        "__id__": 33
       }
     ],
     "nestedPrefabInstanceRoots": [
@@ -432,7 +488,7 @@
   {
     "__type__": "cc.TargetOverrideInfo",
     "source": {
-      "__id__": 24
+      "__id__": 26
     },
     "sourceInfo": null,
     "propertyPath": [
@@ -442,7 +498,7 @@
       "__id__": 2
     },
     "targetInfo": {
-      "__id__": 30
+      "__id__": 34
     }
   },
   {

+ 4 - 2
assets/bundle/gui/game/game.prefab

@@ -458,7 +458,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 301.3,
-      "y": 437.89,
+      "y": 398.862,
       "z": 0
     },
     "_lrot": {
@@ -573,7 +573,7 @@
     "_target": null,
     "_left": 0,
     "_right": 16.69999999999999,
-    "_top": 164.61,
+    "_top": 203.63799999999998,
     "_bottom": 0,
     "_horizontalCenter": 0,
     "_verticalCenter": 0,
@@ -3453,6 +3453,8 @@
       "__id__": 0
     },
     "fileId": "faWoQXg8pKZbx5Y0cHl+VU",
+    "instance": null,
+    "targetOverrides": null,
     "nestedPrefabInstanceRoots": null
   },
   {

+ 2 - 2
assets/main.scene

@@ -177,8 +177,8 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": -0.15,
-      "y": 11.116,
-      "z": 10.34
+      "y": 10.116,
+      "z": 9.84
     },
     "_lrot": {
       "__type__": "cc.Quat",

+ 31 - 18
assets/script/game/checkpoint/bll/FullVehicleOperation.ts

@@ -54,27 +54,40 @@ export class FullVehicleOperationSystem extends ecs.ComblockSystem implements ec
         }
         if (count < needCount) {
             const subways = e.CheckpointModel.subways
+            let runCount = 0
+            let timerArr = []
             for (let index = 0; index < subways.length; index++) {
                 const subway = subways[index];
-                const peopleIndex = subway.SubwayModel.colorArr.findIndex(val => val === color)
-                if (peopleIndex > -1) {
-                    count += 1
-                    subway.SubwayModel.colorArr.splice(peopleIndex, 1)
-                    subway.SubwayView.updateCount(subway.SubwayModel.colorArr.length)
-                    const tempPuppet = this.creatPuppet(color)
-                    const account = smc.initialize.account
-                    tempPuppet.load(account.checkpoint.CheckpointView.node, color, subway.SubwayView.node.position.clone(), account.AccountModel.skin);
-                    e.addChild(tempPuppet)
-
-                    tempPuppet.PuppetView.animator.onRunComplete = () => {
-                        e.CheckpointModel.curVehicle.VehicleView.createPuppet()
-                        e.removeChild(tempPuppet)
-                        tempPuppet.destroy()
-                        e.CheckpointModel.peopleCount -= 1
+                for (let index = 0; index < subway.SubwayModel.colorArr.length; index++) {
+                    const element = subway.SubwayModel.colorArr[index];
+                    if (element === color) {
+                        count += 1
+                        // console.log('需要人数',count,needCount)
+                        subway.SubwayModel.colorArr.splice(index, 1)
+                        index--
+                        subway.SubwayView.updateCount(subway.SubwayModel.colorArr.length)
+                        const tempPuppet = this.creatPuppet(color)
+                        const account = smc.initialize.account
+                        tempPuppet.load(account.checkpoint.CheckpointView.node, color, subway.SubwayView.node.position.clone(), account.AccountModel.skin);
+                        e.addChild(tempPuppet)
+    
+                        tempPuppet.PuppetView.animator.onRunComplete = () => {
+                            e.CheckpointModel.curVehicle.VehicleView.createPuppet()
+                            e.removeChild(tempPuppet)
+                            tempPuppet.destroy()
+                            e.CheckpointModel.peopleCount -= 1
+                            timerArr.forEach(v=>clearTimeout(v))
+                        }
+                        e.CheckpointModel.curVehicle.VehicleModel.useSit += 1
+                        timerArr.push(setTimeout(()=>{
+                            tempPuppet.PuppetView.animator.moveToTarget(e.CheckpointModel.curVehicle.VehicleView.node.position.clone())
+                        },200*runCount))
+                        runCount+=1
+    
+                    }
+                    if (count >= needCount) {
+                        break
                     }
-                    e.CheckpointModel.curVehicle.VehicleModel.useSit += 1
-                    tempPuppet.PuppetView.animator.moveToTarget(e.CheckpointModel.curVehicle.VehicleView.node.position.clone())
-
                 }
                 if (count >= needCount) {
                     break

+ 5 - 3
assets/script/game/checkpoint/bll/InitCheckpoint.ts

@@ -175,7 +175,7 @@ export class InitCheckpointSystem extends ecs.ComblockSystem implements ecs.IEnt
     distributePeopleToColorsByArray(totalPeople: number, colors: string[]) {
         // 验证输入
         if (totalPeople % 3 !== 0) {
-           console.error('配置自动生成生成不是3的倍数,将去除余数')
+            console.error('配置自动生成生成不是3的倍数,将去除余数')
         }
         const adapTotalPeople = totalPeople - totalPeople % 3
 
@@ -331,12 +331,14 @@ export class InitCheckpointSystem extends ecs.ComblockSystem implements ecs.IEnt
         checkpoint_model.grids = Array.from({ length: row }, () => new Array(col).fill(null));
         checkpoint_model.cells = Array.from({ length: row }, () => new Array(col).fill(null));
         checkpoint_model.path_grid = Array.from({ length: row }, () => new Array(col).fill(null));
-        const start_point = row % 2 === 0 ? v3(-row / 2 * 0.5 + 0.1, 0, 2.7) : v3(-row / 2 * 0.75, 0, 2.7)
+        const width = 0.442;
+        const gap = 0.025;
+        const start_point = row % 2 === 0 ? v3(-(row / 2 * (width + gap) - gap / 2)+0.08, 0, 2.7) : v3(-(Math.floor(row / 2) * (width+gap) + width / 2), 0, 2.7)
         for (let index = 0; index < row; index++) {
             for (let j = 0; j < col; j++) {
                 const gridEnt = ecs.getEntity<Grid>(Grid);
                 // 添加关卡到场景
-                const pos = v3(start_point.x + j * 0.5, 0, start_point.z + index * 0.5)
+                const pos = v3(start_point.x + j * (width+gap), 0, start_point.z + index * (width+gap))
                 gridEnt.load(checkpoint_root, pos);
                 e.addChild(gridEnt)
                 checkpoint_model.grids[index][j] = gridEnt

+ 3 - 0
assets/script/game/checkpoint/view/CheckpointMainViewComp.ts

@@ -158,6 +158,9 @@ export class CheckpointMainViewComp extends CCComp {
 
                 break;
             case "btn_leave":
+                // ecs.getSingleton(SingletonModuleComp).account.checkpoint.add(FullVehicleOperationComp)
+                // ecs.getSingleton(SingletonModuleComp).account.checkpoint.CheckpointModelBase.vm.leaveCount += 1
+                // return
                 if (checkpoint.CheckpointModelBase.vm.leaveCount >= 3) {
                     oops.gui.toast('该关卡使用次数已满')
                     return

+ 29 - 3
assets/script/game/checkpoint/view/CheckpointViewController.ts

@@ -1,4 +1,4 @@
-import { Component, _decorator, Node, EventTouch, systemEvent, input, Input, geometry, Camera, PhysicsSystem, director, v3, Vec3 } from "cc";
+import { Component, _decorator, Node, EventTouch, systemEvent, input, Input, geometry, Camera, PhysicsSystem, director, v3, Vec3, Color, Line, GradientRange, CurveRange } from "cc";
 import { Checkpoint } from "../Checkpoint";
 import { PuppetViewComp } from "../../puppet/view/PuppetViewComp";
 import { oops } from "../../../../../extensions/oops-plugin-framework/assets/core/Oops";
@@ -18,22 +18,48 @@ export class CheckpointViewController extends Component {
 
     // @property({ type: Node, tooltip: '待触摸物体' })
     // public node_touch_1: Node | null = null;
+    private line: Line = null;
 
     private _ray: geometry.Ray = new geometry.Ray();
 
     onLoad() {
         const cameras = director.getScene().getComponentsInChildren(Camera);
         this.mainCamera = cameras.find(camera => camera.node.name === 'MainCamera');
-        input.on(Input.EventType.TOUCH_END, this.onTouchStart, this);
+        input.on(Input.EventType.TOUCH_START, this.onTouchStart, this);
+        // this.createLine();
     }
 
     onDestory() {
-        input.off(Input.EventType.TOUCH_END, this.onTouchStart, this);
+        input.off(Input.EventType.TOUCH_START, this.onTouchStart, this);
     }
 
+    createLine() {
+        const lineNode = new Node('Line');
+        lineNode.setParent(this.node);
+        this.line = lineNode.addComponent(Line);
+        const grad = new GradientRange()
+        grad.color = Color.RED;
+        this.line.color = grad;
+    }
+
+    drawRay(ray: geometry.Ray) {
+        const rayStart = ray.o;
+        const rayEnd = new Vec3();
+        Vec3.multiplyScalar(rayEnd, ray.d, 1000); // 假设射线长度为1000
+        Vec3.add(rayEnd, rayStart, rayEnd);
+        this.line.worldSpace = true;
+        const curve = new CurveRange()
+        curve.mode = CurveRange.Mode.Constant
+        curve.constant = 0.1
+        this.line.width = curve;
+        this.line.positions = [rayStart, rayEnd];
+    }
+
+
     onTouchStart(event: EventTouch) {
         // 基于摄像机 画射线
         this.mainCamera?.screenPointToRay(event.getLocation().x, event.getLocation().y, this._ray);
+        // this.drawRay(this._ray)
         if (PhysicsSystem.instance.raycast(this._ray)) {
             const r = PhysicsSystem.instance.raycastResults;
             if (r.length > 0) {

+ 20 - 2
assets/script/platform/ad/AdManager.ts

@@ -10,9 +10,11 @@ export class AdManager {
 
     // 广告单元ID,请替换为你的实际广告单元ID
     private adUnitId: string = 'adunit-d8e3c2b4bcfdc32e';
-    private dyAdUnitId:string = '3620da76lobm18tpb5'
+    private dyAdUnitId: string = '3620da76lobm18tpb5'
 
-    private constructor() {}
+    private isCanShow = true;
+
+    private constructor() { }
 
     // 获取AdManager的单例对象
     public static getInstance(): AdManager {
@@ -41,6 +43,13 @@ export class AdManager {
 
     // 显示激励视频广告
     public showRewardVideoAd(successCallback?: () => void, failCallback?: (err: any) => void) {
+        if (!this.isCanShow) {
+            oops.gui.toast('点击得太快了哟')
+            return;
+        }
+        this.isCanShow = false;
+
+
         if (this.rewardVideoAd) {
             this.rewardVideoAd.show().then(() => {
                 console.log('Rewarded video ad displayed!');
@@ -49,6 +58,7 @@ export class AdManager {
                 console.error('Failed to display rewarded video ad:', err);
                 this.rewardVideoAd.load().then(() => this.rewardVideoAd.show());
                 failCallback && failCallback(err);
+                failCallback = null
                 oops.audio.resumeAll()
             });
 
@@ -58,20 +68,28 @@ export class AdManager {
                 if (res && res.isEnded) {
                     console.log('Rewarded video ad watched till the end');
                     successCallback && successCallback();
+                    successCallback = null
                     oops.audio.resumeAll()
                 } else {
                     // 用户提前关闭广告
                     console.log('Rewarded video ad was closed before completion');
                     failCallback && failCallback(new Error('Ad was closed before completion'));
+                    failCallback = null
                     oops.audio.resumeAll()
                 }
             });
         } else {
             console.error('Reward video ad is not initialized.');
             failCallback && failCallback(new Error('Reward video ad is not initialized'));
+            failCallback = null
             // successCallback && successCallback();
             oops.audio.resumeAll()
         }
+        // 0.5秒后重新开启按钮点击
+        const timer = setTimeout(() => {
+            this.isCanShow = true;
+            clearTimeout(timer)
+        }, 1500);
     }
 }
 

BIN
excel/CheckpointLevel.xlsx


Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä