function i(e, o) { if (!(e instanceof o)) { throw new TypeError("Cannot call a class as a function"); } } function n(e, o) { for (var t = 0; t < o.length; t++) { var i = o[t]; i.enumerable = i.enumerable || false; i.configurable = true; "value" in i && (i.writable = true); Object.defineProperty(e, i.key, i); } } function a(e, o, t) { o && n(e.prototype, o); t && n(e, t); return e; } var c = function () { function e() { i(this, e); this.SystemInformation = null; this.BannerInstance = null; this.VideoInstance = null; this.VideoSuccessCallBack = null; this.VideoFailureCallBack = null; this.InterstitialInstance = null; this.InterstitialTimer = null; this.widthScreen = null; this.heightScreen = null; } a(e, [{ key: "doInitialize", value: function () { this.ChaPingCishu = 0; if (window.h5api) { console.log("当前是H5"); window.H5box = false; this.H5Web = true; } else { window.H5box = true; this.H5Web = false; console.log("当前是游戏盒"); } if (!this.H5Web) { gamebox.login({ success: function (e) { e.code || console.log("登录失败!" + e.errMsg); } }); var e = gamebox.getSystemInfoSync(); console.log("获取设备信息 " + JSON.stringify(e)); if (e) { this.widthScreen = e.screenWidth; this.heightScreen = e.screenHeight; } this.GaiLv(window.GameConfig.randomkaiping) && this.executeShowAwardVideo(null, null); } } }, { key: "executeShowBanner", value: function () { var e = this; if (!this.H5Web) { this.BannerInstance = gamebox.createBannerAd({ style: { left: this.widthScreen - .15 * this.widthScreen, top: this.widthScreen + 100, width: .5 * this.widthScreen, height: .4 * this.widthScreen * .3 } }); this.BannerInstance.onLoad(function () { console.log("4399banner广告加载中..."); e.BannerInstance.show(); }); this.BannerInstance.onError(function (o) { console.log("4399banner广告加载失败 " + JSON.stringify(o)); e.BannerInstance.offError(); e.BannerInstance.offLoad(); }); } } }, { key: "executeHideBanner", value: function () { this.H5Web || null != this.BannerInstance && (this.BannerInstance.hide(), this.BannerInstance.destroy(), this.BannerInstance = null); } }, { key: "Suijivideo", value: function (e) {} }, { key: "GaiLv", value: function (e) { return 1 + Math.floor(100 * Math.random()) <= e; } }, { key: "executeJieSuanChaPing", value: function () { if (!this.H5Web) { var e = gamebox.createInterstitialAd(); e.onLoad(function () { console.log("4399插屏广告加载中..."); e.show(); }); e.onError(function (o) { console.log("4399插屏广告加载失败 " + JSON.stringify(o)); e.offError(function () {}); e.offLoad(function () {}); e.offClose(function () {}); e.destroy(); }); e.onClose(function () { console.log("4399插屏广告关闭"); e.offError(function () {}); e.offLoad(function () {}); e.offClose(function () {}); e.destroy(); }); } } }, { key: "executeShowInterstitial", value: function () {} }, { key: "executeShowAwardVideo", value: function (e, o) { var t = this; if (this.H5Web) { this.showH5Video(e, o); } else { this.VideoSuccessCallBack = e; this.VideoFailureCallBack = o; var i = gamebox.createRewardedVideoAd(); i.onLoad(function () { console.log("4399视频广告加载中..."); i.show(); }); i.onError(function (e) { t.videoDisplayFailureCallBack(); console.log("4399视频广告加载失败 " + JSON.stringify(e)); i.offError(function () {}); i.offLoad(function () {}); i.offClose(function () {}); i.destroy(); }); i.onClose(function () { console.log("4399视频广告关闭"); i.offError(function () {}); i.offLoad(function () {}); i.offClose(function () {}); i.destroy(); }); i.onCompleted(function () { t.videoDisplaySuccessCallBack(); }); } } }, { key: "showH5Video", value: function (e, o) { var t = this; this.VideoSuccessCallBack = e; this.VideoFailureCallBack = o; window.h5api.canPlayAd(function (e) { console.log("是否可播放广告", e.canPlayAd, "剩余次数", e.remain); window.h5api.playAd(function (e) { console.log("代码:" + e.code + ",消息:" + e.message); if (1e4 === e.code) { cc.director.pause(); console.log("开始播放"); } else if (10001 === e.code) { console.log("播放结束"); cc.director.resume(); t.videoDisplaySuccessCallBack(); } else { console.log("广告异常"); cc.director.resume(); t.videoDisplayFailureCallBack(); } }); }); } }, { key: "videoDisplaySuccessCallBack", value: function () { if (null != this.VideoSuccessCallBack) { this.VideoSuccessCallBack(); this.VideoSuccessCallBack = null; } } }, { key: "videoDisplayFailureCallBack", value: function () { if (null != this.VideoFailureCallBack) { this.VideoFailureCallBack(); this.VideoFailureCallBack = null; } } }, { key: "executeRecorder", value: function () {} }, { key: "stopRecorder", value: function () {} }, { key: "executeShareRecorder", value: function (e, o) {} }, { key: "executeShowPushBox", value: function () {} }, { key: "isInstalledShortcut", value: function () {} }, { key: "sendDesktopShortcut", value: function () {} }, { key: "executeBlockAdShow", value: function () {} }]); return e; }(); module.exports = new c();