适用于广告的 break 方法

break(
  o: {
     type: '<type>',
     name: '<name>',
     beforeAd: () => {},
     afterAd: () => {},
     beforeReward: (showAdFn) => {},
     adDismissed: () => {},
     adViewed: () => {},
     adBreakDone: (placementInfo) => {},
  }
): void;

此方法用于在游戏中投放插页式广告和激励广告。

此方法封装了 Ad Placement API 中的 adBreak,且支持相同的参数。o 应为包含 adBreak 参数的对象。

如需了解详情,请参阅 Ad Placement API 文档

注意

beforeRewardadDismissedadViewed 等参数仅适用于激励广告。

游戏不应直接注入 adsbygoogle.js 或使用 Ad Placement API。

要求

请参阅变现要求

示例

在游戏关卡之间展示的插页式广告:

GameSnacks.ad.break({type: 'next', ...});

激励广告:

GameSnacks.ad.break({type: 'reward', ...});