0
我剛剛在我的應用中實現了adbuddiz獎勵視頻,它按預期工作,但我有輕微的挑戰。刷新數據更改後的菜單場景(Corona SDK)
看完視頻後,它會爲adbuddiz觸發「didComplete」事件,並將所需值添加到json文件中。
現在的挑戰是價值不會自動反映在屏幕上,除非我走出場景並在新值顯示之前返回。
有沒有辦法刷新屏幕,使新的值立即出現?
注:這一切都發生在點擊一個按鈕
local savecount = Lib.getSaveValue("savecount")
-- Events (rewarded video)
local function listenerRewardedVideo(event)
if event.value == "didFetch" then
print("didFetch")
end
if event.value == "didComplete" then
print("didComplete")
-- Reward user here
print ("savecount")
savecount = savecount + 1
Lib.setSaveValue("savecount", savecount, true);
local alert = native.showAlert("Successful","Count saved successfully!", {"OK"})
end
if event.value == "didNotComplete" then
print("didNotComplete")
end
if event.value == "didFail" then
print("didFail - " .. event.detail)
end
end
Runtime:addEventListener("AdBuddizRewardedVideoEvent", listenerRewardedVideo)
這顯示在菜單場景價值
label_saveme = display.newText({parent=uiGroup, text=savecount, x=0, y=0, font=native.systemFont, fontSize=24})
label_saveme.xScale = 0.92
label_saveme.x = button_buysaveme.x + 22
label_saveme.y = button_buysaveme.y + 6
label_saveme:setFillColor(255/255, 255/255, 255/255)
label_saveme.alpha = 0.4
uiGroup:insert(label_saveme)
感謝