playMaker

Author Topic: New Global Events - onApplicationQuit/Pause/Focus[SOLVED]  (Read 20779 times)

Jos Yule

  • Playmaker Newbie
  • *
  • Posts: 33
New Global Events - onApplicationQuit/Pause/Focus[SOLVED]
« on: May 16, 2012, 04:49:20 PM »
It would be great if we could have onApplicationQuit, onApplicationPause and onApplicationFocus as global events in PM.

For iOS dev, it is important to be able to react to the onApplicationPause event (and its parameter), so you can save any state you need to. This is triggered when the user receives an incoming call, or hits the HOME button.

Really, onApplicationPause is the most important to me, then onApplicationQuit and finally onApplicationFocus (i'm not at all sure of what it does or when it fires, at least on iOS).
« Last Edit: July 18, 2012, 02:38:37 AM by jeanfabre »

smiffy

  • Junior Playmaker
  • **
  • Posts: 54
Re: New Global Events - onApplicationQuit/Pause/Focus
« Reply #1 on: July 16, 2012, 07:26:37 PM »
Agreed, for Android too this is essential. This issue is actually the only thing our publisher is holding us back on as we can't resume to a pause menu from an interrupt. How easy would this be to implement?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: New Global Events - onApplicationQuit/Pause/Focus
« Reply #2 on: July 17, 2012, 07:47:30 AM »
Hi,

 ok, can you try the following script? attach it to anything, an empty gameObject will do.

In your fsm, create the following Global events:

APPLICATION QUIT
APPLICATION PAUSE
APPLICATION FOCUS

What this script will do, is simply broadcast them three global events, so that any fsm can now be informed about them events.

 If you have problems implementing this, let me know, and I'll do a sample

bye,

 Jean

smiffy

  • Junior Playmaker
  • **
  • Posts: 54
Re: New Global Events - onApplicationQuit/Pause/Focus
« Reply #3 on: July 17, 2012, 04:20:49 PM »
It works on android thankyou! Major sigh of relief. Just got to tie it in with the rest of the game and I can re-submit, honestly I can't thank you enough :D

akdhane

  • Playmaker Newbie
  • *
  • Posts: 7
Re: New Global Events - onApplicationQuit/Pause/Focus
« Reply #4 on: January 31, 2013, 03:28:47 AM »
Hi,

I am trying to use your script to do onapplicationpause function. However,

because of my lack of knowledge of programming and others. I am having

trouble implementing your script. If you can give me sample scene it will be

 great.

Thank you.

Allen.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: New Global Events - onApplicationQuit/Pause/Focus[SOLVED]
« Reply #5 on: January 31, 2013, 04:59:34 AM »
Hi,

 what are you trying to do with application pause? just so that I can make a useful example for you.

bye,

 Jean

akdhane

  • Playmaker Newbie
  • *
  • Posts: 7
Re: New Global Events - onApplicationQuit/Pause/Focus[SOLVED]
« Reply #6 on: January 31, 2013, 05:24:58 AM »
Hi,

 what are you trying to do with application pause? just so that I can make a useful example for you.

bye,

 Jean

Hi,


Trying to use it for IOS - home button press/notification/incoming call/sleep button/ I guess regular stuff that will interrupt or exit/leave app.

Thank you.

Allen

akdhane

  • Playmaker Newbie
  • *
  • Posts: 7
Re: New Global Events - onApplicationQuit/Pause/Focus[SOLVED]
« Reply #7 on: February 01, 2013, 10:45:29 PM »
Hi,

 what are you trying to do with application pause? just so that I can make a useful example for you.

bye,

 Jean

It looks like you are busy.. I will write what I did, maybe you can help me with just reply.

I put your script on empty game object and then I made new fsm in that empty game object with 3 global

event. (APPLICATION QUIT/PAUSE/FOCUS)

and after that, on one of my button(pause button) I create new state(not start state) in pause fsm with

APPLICATION PAUSE transition targeting other state with create pause menu.

is this right way to implement it? or am I missing steps.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15537
  • Official Playmaker Support
Re: New Global Events - onApplicationQuit/Pause/Focus[SOLVED]
« Reply #8 on: February 02, 2013, 03:43:42 PM »
Hi,

the pause will mean that your application is out, you will not be able to show anything when paused, your application will not be visible.

Does that make sense? when you press the home button, your app loose focus, and that's when APPLICATION PAUSE is called.

does that help you understand what it does?

if you want to integrate a regular pause system, then this is not what you need.

bye,

 Jean

akdhane

  • Playmaker Newbie
  • *
  • Posts: 7
Re: New Global Events - onApplicationQuit/Pause/Focus[SOLVED]
« Reply #9 on: February 02, 2013, 10:22:22 PM »
Hi,

the pause will mean that your application is out, you will not be able to show anything when paused, your application will not be visible.

Does that make sense? when you press the home button, your app loose focus, and that's when APPLICATION PAUSE is called.

does that help you understand what it does?

if you want to integrate a regular pause system, then this is not what you need.

bye,

 Jean

Hi, Thanks! This explanation actually gave me good understanding what it does and now it all make sense when I was testing with my game. Thank you so much. Now I need to figure out way to implement my pause menu with home button pressing/interruption anyways THANK YOU.