-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathadmediator_houseads.lua
42 lines (31 loc) · 1.03 KB
/
admediator_houseads.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
------------------------------------------------------------
------------------------------------------------------------
-- Ad Mediator for Corona
--
-- Ad network mediation module for Ansca Corona
-- by Deniz Aydinoglu
--
-- he2apps.com
--
-- GitHub repository and documentation:
-- https://github.com/deniza/Ad-Mediator-for-Corona
------------------------------------------------------------
------------------------------------------------------------
local instance = {}
local houseAds = {}
local currentHouseAdIdx = 1
function instance:init(networkParams)
print("houseads init")
for _,p in ipairs(networkParams) do
houseAds[#houseAds+1] = p
print(p.image,p.target)
end
end
function instance:requestAd()
Runtime:dispatchEvent({name="adMediator_adResponse",available=true,imageUrl=houseAds[currentHouseAdIdx].image,adUrl=houseAds[currentHouseAdIdx].target})
currentHouseAdIdx = currentHouseAdIdx + 1
if currentHouseAdIdx > #houseAds then
currentHouseAdIdx = 1
end
end
return instance