forked from PurePro4561/Just-Fall
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrise.js
More file actions
71 lines (59 loc) · 1.41 KB
/
Copy pathrise.js
File metadata and controls
71 lines (59 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//init the interstitial ads
var interstitialInstance;
var interstitialLoaded = false;
window.playerConfigs = {
'61712797ab1f86000190f30a': {
plugins: {
interstitial: {
enabled: true,
zIndex: 20000,
closeButton: true
}
}
}
}
window.srInterstitialCallback = {
'61712797ab1f86000190f30a': function (error, player) {
if (error) {
console.log(error);
interstitialLoaded = false;
}
interstitialInstance = player;
player.on('interstitialready', function () {
console.log('interstitialready');
interstitialLoaded = true;
});
player.on('interstitialnofill', function () {
console.log('interstitialnofill');
interstitialLoaded = false;
});
player.on('interstitialexpired', function () {
console.log('interstitialexpired');
interstitialLoaded = false;
});
player.on('interstitialcomplete', function () {
console.log('interstitialcomplete');
interstitialLoaded = false;
unityAdFinishedCallback(1);
});
}
}
function requestNewAd() {
console.log("requested AD");
if (interstitialInstance && interstitialLoaded) {
interstitialInstance.displayInterstitial();
}
else {
unityAdFinishedCallback(0);
}
}
// This function calls Unity to tell the ad finished
function unityAdFinishedCallback(isSuccess) {
try {
if(gameInstance)
gameInstance.SendMessage('AdsManager', 'OnWebCallback', isSuccess);
}
catch(error) {
console.log(error);
}
}