Commit 7ce649fa authored by unknown's avatar unknown

修复重新加载注册的事件回调bug

parent 62bcc43e
......@@ -138,6 +138,13 @@ export class FaceRecognitionCtr extends Component {
this.startGame();
}
onDestroy(){
director.off("face_rg_anwser");
director.off("answer_one");
director.off("answer_two");
director.off("continue_game");
}
update(deltaTime: number) {
// [4]
this.countdownTime(deltaTime);
......
......@@ -98,6 +98,13 @@ export class BuyTicketCtr extends Component {
this.gameStart();
}
onDestroy(){
director.off("issue_start");
director.off("issue_end");
director.off("add_score");
director.off("begin_countdown_end");
}
update(deltaTime: number) {
// [4]
this.countdownTime(deltaTime);
......
......@@ -132,6 +132,12 @@ export class ClassifyCtr_1 extends Component {
find("Canvas")?.getComponent(ClassifyGuideCtr_1)?.init();
});
}
onDestroy(){
director.off("continue_game");
director.off("begin_countdown_end");
}
resetGame() {
this.isPlayCountdownMus = false;
this.succScoreLab.string = "通关≥" + this.succScore + "分";
......
......@@ -124,6 +124,12 @@ export class ClassifyCtr extends Component {
find("Canvas")?.getComponent(ClassifyGuideCtr)?.init();
});
}
onDestroy(){
director.off("continue_game");
director.off("begin_countdown_end");
}
resetGame() {
this.isPlayCountdownMus = false;
this.succScoreLab.string = "通关≥" + this.succScore + "分";
......
......@@ -108,6 +108,13 @@ export class FoodForThePartyCtr extends Component {
this.gameStart();
}
onDestroy(){
director.off("issue_end");
director.off("continue_game");
director.off("begin_countdown_end");
director.off("add_score");
}
update(deltaTime: number) {
// [4]
this.runRoundCd(deltaTime);
......
......@@ -127,6 +127,11 @@ export class PasswordMatrixCtr extends Component {
this.gameStart();
}
onDestroy(){
director.off("begin_countdown_end");
director.off("continue_game");
}
gameStart() {
//测试
this.gameState = GAME_TYPE.READY;
......
......@@ -80,6 +80,11 @@ export class QuickQuizCtr extends Component {
this.gameStart();
}
onDestroy(){
director.off("continue_game");
director.off("begin_countdown_end");
}
update(deltaTime: number) {
// [4]
this.countdownTime(deltaTime);
......
......@@ -223,6 +223,11 @@ export class TransientCtr_1 extends Component {
this.startGame();
}
onDestroy(){
director.off("click_square");
director.off("continue_game");
}
startGame() {
this.costTime = 0;
this.stopShake();
......
......@@ -214,6 +214,12 @@ export class UniqueCtr_1 extends Component {
// [3]
}
onDestroy(){
director.off("click_item");
director.off("continue_game");
director.off("begin_countdown_end");
}
startGame() {
this.isPlayCountdownMus = false;
this.curScore = 0;
......
......@@ -218,6 +218,12 @@ export class UniqueCtr_2 extends Component {
// [3]
}
onDestroy(){
director.off("click_item");
director.off("continue_game");
director.off("begin_countdown_end");
}
startGame() {
this.isPlayCountdownMus = false;
this.curScore = 0;
......
......@@ -223,6 +223,12 @@ export class UniqueCtr extends Component {
// [3]
}
onDestroy(){
director.off("click_item");
director.off("continue_game");
director.off("begin_countdown_end");
}
startGame() {
this.isPlayCountdownMus = false;
this.curScore = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment