Tuesday, September 20, 2022
HomeGame DevelopmentDownside With Pausing The Sport - Cocos Creator

Downside With Pausing The Sport – Cocos Creator


Hello Everybody ! …
So in my recreation when the battle is happening and that i press on the “pause” button the pase
menu opens and the sport pauses till i click on on resume … however i’m going through an issue
when i exploit both browser or simulator and reduce the window or go to a different tab and return to the sport the sport robotically resumes despite the fact that the pause menu continues to be open … i hope somebody may help me with this ! Thanks
that is the code for pausing :
waitBtn() { // pause button

    let all = cc.discover("Canvas");

    let button = cc.discover("Canvas/AllBtn/WaitBtn")

    //Resume all contact click on occasions

    //Delayed execution pause

    this.scheduleOnce(operate() {

        all.pauseSystemEvents(true); //Pause all contact click on occasions

        this.Menu.lively = true

        this.Menu.resumeSystemEvents(true);

        // Elevated  zIndex Property To Menu

        this.Menu.zIndex = 100

        cc.recreation.pause();

    }, 0.15);

    button.interactable = false

},


cc.recreation.on(cc.recreation.EVENT_SHOW, operate () {
      // do one thing
});

this occasion triggered when recreation again to foreground,you’ll be able to re-pause within the callback



1 Like

Thanks ! i’ll strive it

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments