2016-09-16 3 views
1

タップボタンが表示された時点でインタースティシャル広告を表示している時点で、コロナ(LUA)に関する質問があります。コロナインタースティシャルタップ数

local ads = require("ads") 
local interstitialAppID = "ca-app-pub-xxxxxxxxxx/xxxxxxxx21" 
local testMode = true 

local adProvider = "admob" 
local function adListener(event) 

if (event.isError) then 
    print ("Error en el anuncio!", msg) 

elseif (event.phase == "loaded") then 
    print ("Anuncio cargado!", msg) 

elseif (event.phase == "shown") then 
    print ("Cargando nuevo anuncio!", msg) 
    ads.load ("interstitial", { appId = interstitialAppID, testMode = isTestMode }) 
end 
end 

ads.init("admob", interstitialAppID, adListener) 
ads.load ("interstitial", { appId = interstitialAppID, testMode = isTestMode }) 

-- INTERSTITIAL AD 
local function Adinterstatial(self, event) 
ads.show("interstitial", { appId = interstitialAppID, testMode = isTestMode 
}) 
end  

local test = display.newImageRect("Lore/0.png", 50, 50) 
test.x = 150 
test.y = 150 
test.tap = Adinterstatial 
test:addEventListener("tap") 

私は例えばこれをしたい:すべての20個のタップ(すべてのアプリ上の)私はこれとその作業を(時にはロードし、広告する5-10-15秒のようになります、私はなぜ知らない持っていますinteristitial広告が表示されます。 はこの可能でしょうか?私はそれを行うことができますどのように ?

感謝。

答えて

0

あなたはRuntimeタップイベントを追加することができます。これは、画面上のすべてのタップを取得する、それがどこかは関係ありません。どのオブジェクトがタップされたかを示します。例:

local numTaps = 0 
local function countTaps() 
    numTaps = numTaps + 1 
    if numTaps % 20 == 0 then 
     -- Show the add here. 
    end 
end 

Runtime:addEventListener("tap", countTaps) 

%は、除算の残余者をnumTaps20の間にします。つまり、20タップごとに0になります。