Cancel Score Submit Dialog.

6 posts (showing 1-6)
Ce-eM

Market Level 0Community Level 2
110 posts

How can I tell if the player clicked cancel on the submit score dialog?

There doesn't seem to be an event for that.

EDIT: Nevermind, EVT_INUSE_ENDED works. I was looking for a more specific event.

posted 2014-03-19T23:06:33-07:00 | edited 2014-03-19T23:20:42-07:00
davidgilbert

Market Level 0Community Level 0
9 posts

That worked for me as well. However, the EVT_INUSE_ENDED event is also triggered if you click submit, which causes the high score tables to not be displayed!

I found a way around this by adding an event listener for EVT_SCOREBOARD_ENTRY_SUBMITTED in the same method body as the EVT_INUSE_ENDED event listener, and removing the EVT_INUSE_ENDED event listener in its event handler. However, I cannot seem to find the event that is triggered when the user clicks the close button.

Has anyone found a way around this?

posted 2014-03-25T03:39:49-07:00 | edited 2014-03-25T03:41:36-07:00
Frederik77

Market Level 4Community Level 3
172 posts

l think the only accessible event for the close button is indeed the EVT_INUSE_ENDED. I agree it would be better to have separate events and handlers for the separate buttons instead of one for most interface elements, since this extra checking of the triggering element is often required anyway. (Maybe it can be done with Event.target og Event.currentTarget?) 

posted 2014-03-25T10:43:25-07:00
davidgilbert

Market Level 0Community Level 0
9 posts

I read your thread about adding an EVT_SCOREBOARD_CLOSED event, and I believe that would be a good way to solve the problem. If EVT_INUSE_ENDED was not triggered when the player pressed submit, that would work to.

I will continue trying, and I will post the code I used if I find a workaround.

posted 2014-03-25T14:37:54-07:00
Ce-eM

Market Level 0Community Level 2
110 posts

Please do, I haven't been able to implement the scoreboard the way I had it with mochi because of this.

It seems to me that the GamerSafe api isn't quite finished.

posted 2014-03-25T17:36:04-07:00
davidgilbert

Market Level 0Community Level 0
9 posts

Sorry for taking to long to respond, but I was focusing on other things. I think I might have a workaround to detect when the close button is clicked:

[as3]
private var _closeHighScore:int = 0;

private function GameOver():void {
     //remove event listeners
     GamerSafe.api.showScoreSubmit(_score,"",false, scoreboardID);
     GamerSafe.api.addEventListener(GamerSafe.EVT_SCOREBOARD_ENTRY_SUBMITTED, scoreSubmitted, false, 0, true);
     GamerSafe.api.addEventListener(GamerSafe.EVT_INUSE_ENDED, scoreRemove, false, 0, true);
}
private function scoreSubmitted(event:Event):void {
     GamerSafe.api.removeEventListener(GamerSafe.EVT_SCOREBOARD_ENTRY_SUBMITTED, scoreSubmitted);
     GamerSafe.api.removeEventListener(GamerSafe.EVT_INUSE_ENDED, scoreRemove);
     GamerSafe.api.addEventListener(GamerSafe.EVT_INUSE_CHANGED, onCloseClick, false, 0, true);
}
private function onCloseClick(event:Event):void {
     ++_closeHighScore;
     if(_closeHighScore == 3) {
          GamerSafe.api.removeEventListener(GamerSafe.EVT_INUSE_CHANGED, onCloseClick);
          _closeHighScore = 0;
          //user clicked the close button; resume game.
     }
}
private function scoreRemove(event:Event):void {
     GamerSafe.api.removeEventListener(GamerSafe.EVT_SCOREBOARD_ENTRY_SUBMITTED, scoreSubmitted);
     GamerSafe.api.removeEventListener(GamerSafe.EVT_INUSE_ENDED, scoreRemove);
     //user clicked the cancel button; resume game.
}[/as3]

 

posted 2014-04-21T23:09:13-07:00 | edited 2014-04-21T23:12:07-07:00