Add AdServer documentation
This commit is contained in:
parent
b4bdcf092f
commit
1d40552e26
1 changed files with 71 additions and 0 deletions
71
content/AdServer.md
Normal file
71
content/AdServer.md
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
---
|
||||||
|
title: "AdServer"
|
||||||
|
# description: "description"
|
||||||
|
# layout: "definition"
|
||||||
|
page_status:
|
||||||
|
see_also:
|
||||||
|
- "[Ad Server @ Smash Hit Lab](https://antifandom.com/smashhitlab/wiki/Ad_Server) (Used as an source for most of the content)"
|
||||||
|
---
|
||||||
|
|
||||||
|
The Ad Server provides data used by the game to serve advertisements,
|
||||||
|
in form of an UI xml file (`ads.xml`), an icon (`ads-icon.png`)
|
||||||
|
and the full banner (`ads-front.png`).
|
||||||
|
|
||||||
|
## Details
|
||||||
|
|
||||||
|
### Retrieving
|
||||||
|
|
||||||
|
To check for ads, the game sends an HTTP GET request for:
|
||||||
|
|
||||||
|
```plain
|
||||||
|
http://grannysmithgame.com/ads/ads.php?product={product}&platform={platform}&version={version}&rev={rev}
|
||||||
|
```
|
||||||
|
|
||||||
|
- `product`: most likely used to indicate if the game is a `full` version or the
|
||||||
|
`free` one
|
||||||
|
- `platform`: platform that the game is on, for example android
|
||||||
|
- `version`: game version
|
||||||
|
- `rev`: most likely an advertisement revision
|
||||||
|
|
||||||
|
The server responds with an zero length document if no advertisements are available.
|
||||||
|
If there are any ads to show, then the server will respond with an xml document:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<ads revision="{revision}" showfront="{showfront}" onlyfree="{onlyfree}" sale="{sale}" folder="{folder}"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
- `revision`: current advert revision.
|
||||||
|
If zero, then none are available and no other field needs to be filled
|
||||||
|
- `showfront`: unknown
|
||||||
|
- `onlyfree`: most likely used to show ads only to the users of Granny Smith Free
|
||||||
|
- `sale`: unknown
|
||||||
|
- `folder`: a subfolder where advertisement files are stored.
|
||||||
|
|
||||||
|
### Display
|
||||||
|
|
||||||
|
The advertisements use UI xml files and are shown
|
||||||
|
when clicking the icon in the top-left corner of the screen.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
Example response for an ad listing might look like this:
|
||||||
|
```xml
|
||||||
|
<ads revision="1" showfront="1" onlyfree="0" sale="0" folder="data"/>
|
||||||
|
```
|
||||||
|
|
||||||
|
For the following files:
|
||||||
|
```plain
|
||||||
|
http://grannysmithgame.com/ads/data/ads.xml
|
||||||
|
http://grannysmithgame.com/ads/data/ads-front.png
|
||||||
|
http://grannysmithgame.com/ads/data/ads-icon.png
|
||||||
|
```
|
||||||
|
|
||||||
|
Example `ads.xml` file:
|
||||||
|
```xml
|
||||||
|
<ui texture="user://ads-front.png" selected="user://ads-front.png">
|
||||||
|
<outside cmd="script:hideads"/>
|
||||||
|
<!-- Note: you should change the width and height to banner image's dimensions -->
|
||||||
|
<rect coords="0 0 500 281" cmd="game.url https://grannysmithgame.com"/>
|
||||||
|
</ui>
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue