Skip to content

Commit 8a1d20f

Browse files
authored
Merge pull request #22 from defold/fix_documentation
Fix documentation
2 parents 8e2a38d + fd3d1fe commit 8a1d20f

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

docs/index.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,15 @@ Rewarded breaks allow for a user to choose to watch a rewarded video ad in excha
5555

5656
```lua
5757
-- gameplay stops
58-
poki_sdk.rewarded_break(function(self, success)end)
58+
poki_sdk.rewarded_break(function(self, status)
59+
if status == poki_sdk.REWARDED_BREAK_ERROR then
60+
print("Rewarded break error!")
61+
elseif status == poki_sdk.REWARDED_BREAK_START then
62+
print("Rewarded break start")
63+
elseif status == poki_sdk.REWARDED_BREAK_SUCCESS then
64+
print("Rewarded break success")
65+
end
66+
end)
5967
```
6068

6169
### About the rewarded break timer
@@ -71,9 +79,14 @@ Make sure that audio and keyboard input are disabled during commercialBreaks, so
7179

7280
```lua
7381
-- gameplay stops
74-
-- fire your mute audio function
82+
-- fire your mute audio function, for example:
83+
sound.pause("#music", true)
7584
poki_sdk.commercial_break(function(self)
76-
-- fire your unmute audio function
85+
-- fire your unmute audio function, for example:
86+
if status == poki_sdk.REWARDED_BREAK_ERROR or
87+
status == poki_sdk.REWARDED_BREAK_SUCCESS then
88+
sound.pause("#music", false)
89+
end
7790
-- fire your function to continue to game
7891
end)
7992
```

poki-sdk/api/poki-sdk.script_api

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@
3636
- name: callback
3737
type: function
3838

39+
parameters:
40+
- name: self
41+
type: object
42+
desc: The calling script instance
43+
44+
- name: status
45+
type: number
46+
desc: "One of the statuses:
47+
`poki_sdk.REWARDED_BREAK_ERROR`,
48+
`poki_sdk.REWARDED_BREAK_START`,
49+
`poki_sdk.REWARDED_BREAK_SUCCESS`"
50+
3951
#*****************************************************************************************************
4052

4153
- name: set_debug

0 commit comments

Comments
 (0)