woso_javan il y a 4 mois
Parent
commit
17dc9047f7

+ 8 - 2
assets/module_movecar/RoosterMoveCar.ts

@@ -85,6 +85,8 @@ export class RoosterMoveCar extends Component {
         CarColorsGlobalInstance.instance.carSysterm.clearAll();
         const { level } = LevelManager.instance.levelModel;
         LevelManager.instance.loadLevel(level);
+
+        this.updateScrewsLen();
     }
 
     private onClickSet(): void {
@@ -203,6 +205,11 @@ export class RoosterMoveCar extends Component {
     }
 
     onUpdateLeftNail() {
+        this.updateScrewsLen();
+        this.onUpdateLvl();
+    }
+
+    updateScrewsLen() {
         const levels = find('Canvas/Scene/Levels')!;
         const lbScrews = find('Canvas/GameUI/Pai/LbScrews')!.getComponent(Label);
         const children = levels.children;
@@ -211,9 +218,8 @@ export class RoosterMoveCar extends Component {
 
         const levelComp = children[0].getComponent(LevelAction)!;
         const pins = levelComp.get_pin_color();
+        console.log(`钉子数量:${pins.length}`)
         lbScrews.string = `${pins.length}`;
-
-        this.onUpdateLvl();
     }
 
     onUpdateLvl() {

+ 1 - 0
assets/module_movecar/Script/LevelAction.ts

@@ -86,6 +86,7 @@ export class LevelAction extends Component {
             if (index > 3) {
                 element.name = `empty-lock${index}`;
                 element.getChildByName('Barricade')!.active = true;
+                element.getChildByName('Barricade')!.getChildByName('Ad')!.active = true;
 
                 const childrenToRemove = element.children.slice(1);
                 childrenToRemove.forEach(child => child.destroy());