fix: bug 1/4

main
tiendat3699 2024-04-02 09:26:53 +07:00
parent 6caaba5ccf
commit 15bb43a4ca
5 changed files with 1955 additions and 1890 deletions

File diff suppressed because it is too large Load Diff

View File

@ -39,9 +39,6 @@ export class MultiBall extends Component {
ball2.node.setWorldPosition(this._portLeft.worldPosition);
ball2.addForce(new Vec2(-20, 0));
ball1.playMultiBallEffect();
ball2.playMultiBallEffect();
this._trigged = false;
}
}

View File

@ -173,10 +173,9 @@ export class GameManager extends Singleton<GameManager>() {
private setCurrentBallInGame(value: number) {
this._currentBallInGame += value;
if (this._currentBallInGame >= 2) {
if (!this._isMultiBall) {
this._isMultiBall = true;
EventManger.instance.emit(GameEvent.MultiBall, true);
}
this._isMultiBall = true;
EventManger.instance.emit(GameEvent.MultiBall, true);
this._ballPool.actives.forEach((ball) => ball.getComponent(Ball).playMultiBallEffect());
}
if (this._currentBallInGame <= 0) {

View File

@ -9,7 +9,15 @@ export default class ObjectPool {
private _expandable;
private _poolHandlerComp: new () => any;
private get all() {
public get actives() {
return [...this._actives];
}
public get inActives() {
return [...this._inactive];
}
public get all() {
return [...this._actives, ...this._inactive];
}

View File

@ -28,6 +28,7 @@ export class GameOverPanel extends Component {
private _pool: ObjectPool;
private _active = false;
private _clicked = false;
protected onLoad(): void {
this._pool = new ObjectPool(this._scorePrefab, 100, true);
@ -59,16 +60,21 @@ export class GameOverPanel extends Component {
}
onClickYesButton() {
if (this._clicked) return;
this._clicked = true;
if (BEConnector.instance.canRelive()) {
BEConnector.instance
.checkGameScoreTicket()
.then(() => {
this._clicked = false;
GameManager.instance.gameRelive();
})
.catch(() => {
this._clicked = false;
GameManager.instance.gameOver();
});
} else {
this._clicked = false;
BEConnector.instance.postMessage();
}
}