Advertisement entry status callback||doc136060

September 20, 2022

Format

AdHelper:registerEnableVideoAdChange(callBack)
  • The class to which the function belongs:AdHelper

Description

Register the callback function for the state change of the watch advertisement entrance


Parameters

Variable name type Description
callBack function Callback


Value Returned

type Description
function Cancel the function executed by the result callback function


Parameters of the callback function

Variable name type Description
adEnable boolean Whether the advertisement entrance is open


Code Samples

Register the callback function for watching the state change of the advertisement entrance, open the advertisement ui when the advertisement entrance is opened, and close the ui when the advertisement entrance is closed

local AdHelper = Game.GetService("AdHelper")
local cancelFunc = AdHelper:registerEnableVideoAdChange(function(adEnable)
  if adEnable then
    UI:openWindow("advertisingWnd")
  else
    UI:closeWindow("advertisingWnd")
  end
end)