AdvertisementService

继承自

描述

播放广告的服务节点

函数

voidPlayAdvertising (int uin, bool success)
指定用户播放广告
广告播放接口回调

代码示例

--目前只支持手机端播放广告
local advertService = game:GetService("AdvertisementService")

-- 播放广告
-- playerUin 指定哪个用户播放
local function PlayAdvertisements(playerUin, isSuccess)
	print('Advertisements start play!')
	adservice:PlayAdvertising(playerUin, isSuccess)
end

local function PlayFinished()
	local function LuaCallBack(msg)
		print("call back msg = ",msg)
		print('Advertisements play finished!')
	end
	adservice:PlayAdvertisingCallback(LuaCallBack)
end

--使用时优先注册广告播放完的回调
PlayFinished()

button.Click:Connect(function()
	-- 点击开始播放广告
	PlayAdvertisements(1000091378, true)
end)
Last Updated: