Files
tothvillar e896e2ead4 init
2026-07-09 15:04:14 +08:00

203 lines
5.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.Banner = null;
this.Video = null;
}
a(e, [{
key: "doInitialize",
value: function () {
window.ServerConfigBd = null;
window.ServerConfigBd = window.GameConfig;
console.log("获取到的开关是" + JSON.stringify(window.ServerConfigBd));
setTimeout(function () {}, 1e3);
this.loadvideo();
}
}, {
key: "executeShowBanner",
value: function () {
window.ServerConfigBd.showHutui && this.loadbanner();
}
}, {
key: "showBanner",
value: function (e, o) {}
}, {
key: "destroyBanner",
value: function () {
this.Banner && (this.Banner.active = false);
}
}, {
key: "showMoreGames",
value: function () {}
}, {
key: "GaiLv",
value: function (e) {
return 1 + Math.floor(100 * Math.random()) <= e;
}
}, {
key: "Suijivideo",
value: function (e, o) {
var t = this;
console.log("触发Baidu随机视频1111:" + e);
if (this.GaiLv(e)) {
this.video_success = o;
this.video_failure = o;
cc.audioEngine.pauseAll();
this.Video.load().then(function () {
console.log("广告加载成功, 开始显示广告");
t.Video.show().catch(function (e) {
t.Video.load().then(function () {
return t.Video.show();
});
});
}).catch(function (e) {
console.log("百度视频onload失败:", e);
cc.audioEngine.resumeAll();
});
} else {
console.log("=========概率不够");
}
}
}, {
key: "executeShowInterstitial",
value: function () {}
}, {
key: "executeRecorder",
value: function () {}
}, {
key: "stopRecorder",
value: function () {}
}, {
key: "executeShareRecorder",
value: function (e, o) {}
}, {
key: "executeShowPushBox",
value: function () {
window.ServerConfigBd.showHutui && this.loadbox();
}
}, {
key: "sendToDesktop",
value: function (e) {}
}, {
key: "executeShowAwardVideo",
value: function (e, o) {
var t = this;
if (new Date().getTime() - this.preClickTime <= 2e3) {
cc.Utils.AssetMgr.showMessage("广告加载中....");
} else {
console.log("触发Baidu激励视频");
this.video_success = e;
this.video_failure = o;
cc.audioEngine.pauseAll();
this.Video.load().then(function () {
console.log("广告加载成功, 开始显示广告");
t.Video.show().catch(function (e) {
t.Video.load().then(function () {
return t.Video.show();
});
});
}).catch(function (e) {
console.log("百度视频onload失败:", e);
cc.audioEngine.resumeAll();
});
}
}
}, {
key: "loadbox",
value: function () {
cc.loader.loadRes("Platform/Native/Prefab/gamePush_yu/gameList_push", function (e, o) {
if (e) {
console.log("载入预制资源失败, 原因:" + e);
} else if (o instanceof cc.Prefab) {
var t = cc.instantiate(o);
t.parent = cc.director.getScene();
t.zIndex = 9e3;
t.name = "gameList_push";
} else {
console.log("你载入的不是预制资源!");
}
}.bind(this));
}
}, {
key: "loadbanner",
value: function () {
cc.loader.loadRes("Platform/Native/Prefab/gamePush_yu/gameList_banner", function (e, o) {
if (e) {
console.log("载入预制资源失败, 原因:" + e);
} else if (o instanceof cc.Prefab) {
var t = cc.instantiate(o);
t.parent = cc.director.getScene();
t.zIndex = 9999;
t.name = "gameList_banner";
} else {
console.log("你载入的不是预制资源!");
}
}.bind(this));
}
}, {
key: "loadvideo",
value: function () {
var e = this;
this.Video = window.swan.createRewardedVideoAd({
adUnitId: "7690329",
appSid: "c33a7cf1"
});
this.Video.onClose(function (o) {
if (o.isEnded) {
console.log("激励视频完整播放后关闭");
cc.audioEngine.resumeAll();
e.video_success && e.video_success();
} else if (window.ServerConfigBd.showModal) {
window.swan.showModal({
title: "未观看完视频",
content: "观看完视频才能获得奖励哦",
success: function (o) {
if (o.confirm) {
e.Video.show().then(function () {
console.log("激励视频 广告显示");
}).catch(function () {
e.Video.load().then(function () {
return e.Video.show();
}).catch(function (e) {
console.log("激励视频 广告显示失败");
});
});
} else if (o.cancel) {
cc.audioEngine.resumeAll(), e.video_failure && e.video_failure();
}
},
fail: function (o) {
cc.audioEngine.resumeAll();
e.video_failure && e.video_failure();
}
});
} else {
console.log("激励视频中途被关闭");
cc.audioEngine.resumeAll();
e.video_failure && e.video_failure();
}
});
}
}]);
return e;
}();
module.exports = new c();