Documentation

Close
*
*

Joy Monster documentation v1.0.0

1. Initializing the plugin

Defining the API Key

The very first thing to do, is to get your API Key, and set it inside the AdJoy window.

For that, simply open the Window -> AdJoy Settings window, and enter your API Key inside the Authentication section.

You can click on the “Test authentication” button to make sure your API Key is valid.

 Calling AdJoyManager.Init()

Then, you’ll just need to call AdJoyManager.Init() at the very start of your game (usually in the Awake method of a script).

Best thing to do, is to make sure this script is one that is called at the very beginning of your game (you can do that using Editor -> Project Settings -> Script Execution Order).

 

2. Displaying the wallet

The wallet screen

You’ll need to add a button called “Wallet” somewhere in your game, that users can click on to display the list of offers available to them. In order to display the wallet, simply call AdJoyManager.ShowWalletScreen() when the user click on this button.

 

 

Displaying offers available

If you want to highlight the wallet button, make it flash or anything, to alert the user that some offers are available in the wallet, you can use the AdJoyManager.GetAPI().HasOffers() method as follows:

 

 

3. The AdJoy Box

Attaching the box

In order to attach an AdJoy box to an object of your choice in your game, you’ll just have to attach the AdJoyBox component at the root of this object. And inside your own script (attached to the object), you’ll just have to call the AttachBox method of the AdJoyBox component, as such:

 

This will automatically attach the AdJoyBox on top of your object in the game, if one is available. If none is available, nothing will happen, so you don’t have to worry about anything.

This is also the place where you can define your own rules, such as only calling AttachBox once in a game, or once every x minutes etc…

Destroying the box

Once the player collected/destroyed/touched your object and it is now “collected”, you’ll also need to trigger the “collect” of the AdJoyBox. In order to do that, simply call the CollectBoxAndDestroySelf method on the AdJoyBox component, as such:

 

This will trigger the animation of the AdJoyBox being destroyed, and add a reward to the wallet of the user.

Releasing the box

In some cases, the player will miss your object thus will not collect the AdJoyBox. In this scenario, you want to “release” the AdJoyBox once it’s out of screen, to be able to reuse it later in the game, when another call to AttachBox will be made. In order to do that, just call the ReleaseBox method on the AdJoyBox component.

In most cases, you already destroy your object when it’s out of screen, if that’s the case, just add the ReleaseBox call inside the OnDestroy callback of your script, so when your object is destroyed, it will also release the AdJoyBox.

 

The reward screen

Finally, at the end of the game, you’ll want to display what is the reward the user collected during the game when he collected an AdJoyBox. In order to do that, when you display your game over screen, you’ll just need to call AdJoyManager.ShowRewardScreen(). Calling this method, will display the reward the user won in fullscreen, and then the reward screen will disappear by itself to bring back your user to the game over screen.

 

WordPress Image Lightbox