DybAd.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. var t = require;
  2. var e = module;
  3. var i = exports;
  4. Object.defineProperty(i, "__esModule", {value: !0}), (i.DybAd = void 0);
  5. const s = t("GameText"),
  6. o = t("Toast");
  7. t("ADManageBase");
  8. i.DybAd = class {
  9. constructor(t) {
  10. (this.dybSdk = window.dyb),
  11. (this.onLoadAdComplete = null),
  12. (this.onLoadAdFail = null),
  13. (this.adState = 0),
  14. (this.id = t);
  15. }
  16. init() {
  17. this.initAd();
  18. }
  19. initAd() {
  20. console.log("adUnitId:", this.id), (this.adState = 2);
  21. }
  22. load() {
  23. this.onLoadAdComplete();
  24. }
  25. show() {
  26. this.dybSdk.createVideoAd(this.id, t => {
  27. console.log(JSON.stringify(t), "createRewardedVideoAd");
  28. let e = {code: 1};
  29. "close" == t.state && t.isEnded
  30. ? ((e.code = 0), console.log("//视频完整看完,进行发送奖励"))
  31. : console.log("//视频没看完"),
  32. this.onShowAdComplete(e),
  33. "error" == t.state && o.default.launch(s.GameText.getText(62));
  34. });
  35. }
  36. };