|
@@ -44,6 +44,7 @@ export class RoosterMoveCar extends Component {
|
|
|
|
|
|
registerListener() {
|
|
registerListener() {
|
|
EventDispatcher.instance.on(GameEvent.EVENT_CLICK_CAR, this.onTouchCar, this);
|
|
EventDispatcher.instance.on(GameEvent.EVENT_CLICK_CAR, this.onTouchCar, this);
|
|
|
|
+ EventDispatcher.instance.on(GameEvent.EVENT_BATTLE_SUCCESS_LEVEL_UP, this.onUpdateLvl, this);
|
|
EventDispatcher.instance.on(GameEvent.EVENT_UPDATE_LEFT_NAIL, this.onUpdateLeftNail, this);
|
|
EventDispatcher.instance.on(GameEvent.EVENT_UPDATE_LEFT_NAIL, this.onUpdateLeftNail, this);
|
|
EventDispatcher.instance.on(GameEvent.EVENT_CHECK_ELEMENT_CHILDREN, this.onUpdateLeftNail, this);
|
|
EventDispatcher.instance.on(GameEvent.EVENT_CHECK_ELEMENT_CHILDREN, this.onUpdateLeftNail, this);
|
|
|
|
|
|
@@ -205,9 +206,20 @@ export class RoosterMoveCar extends Component {
|
|
const levels = find('Canvas/Scene/Levels')!;
|
|
const levels = find('Canvas/Scene/Levels')!;
|
|
const lbScrews = find('Canvas/GameUI/Pai/LbScrews')!.getComponent(Label);
|
|
const lbScrews = find('Canvas/GameUI/Pai/LbScrews')!.getComponent(Label);
|
|
const children = levels.children;
|
|
const children = levels.children;
|
|
|
|
+ if (children.length <= 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
const levelComp = children[0].getComponent(LevelAction)!;
|
|
const levelComp = children[0].getComponent(LevelAction)!;
|
|
const pins = levelComp.get_pin_color();
|
|
const pins = levelComp.get_pin_color();
|
|
lbScrews.string = `${pins.length}`;
|
|
lbScrews.string = `${pins.length}`;
|
|
|
|
+
|
|
|
|
+ this.onUpdateLvl();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ onUpdateLvl() {
|
|
|
|
+ const lbScrews = find('Canvas/GameUI/TopLeft/TitleLvl/LbLvl')!.getComponent(Label);
|
|
|
|
+ const { level } = LevelManager.instance.levelModel;
|
|
|
|
+ lbScrews.string = `${level}`;
|
|
}
|
|
}
|
|
|
|
|
|
/** 获取停车位坐标*/
|
|
/** 获取停车位坐标*/
|