Web to Game Events Listner
To listen to events from ArcPlay's web experience, you can use the window.addEventListener
Here is an example implementation for it:
The data will be in the format { funcName: “string”, …other data }
where funcName
is the name of the event. It can be one of the following:
game_replay
When the user clicks on “Replay” in ArcPlay's web experience. The game needs to restart so it can be played again
game_unlock_item
When the game gets this event, the game must unlock the reward item.
This will contain the reward parameters with key name rewardParams
as an additional parameter. The value of rewardParams
will be the same as the value game had sent while calling the game to web event game_reward_click
game_pause
When the user either leaves ArcPlay or hits the back button on the phone. The game will need to be paused.
game_resume
When the game needs to be resumed from the pause state
game_mute_allsound
When the user leaves ArcPlay or an ad is shown. The game will continue to run in the background, thus needs to be muted
game_restore_allsound
When the game is in the foreground again, the audio must be restored to the state it was in before game_mute_allsound
was fired.
Last updated