-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathext.js
79 lines (64 loc) · 1.77 KB
/
ext.js
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
72
73
74
75
76
77
78
79
function gdAdAsyncCallback(ev, ad, stat) {
var map = {};
map["id"] = "gamedistribution";
map["event"] = ev;
map["ad_slot"] = ad;
map["status"] = stat;
GMS_API.send_async_event_social(map);
}
function gd_debug_mode(d) {
// From GML boolean to Javascript boolean <<
if (d>=0.5) {
GD_OPTIONS.debug = true;
} else {
GD_OPTIONS.debug = false;
}
}
function gd_open_console() {
gdsdk.openConsole();
}
function gd_ads_available() {
if (typeof gdsdk !== 'undefined' && gdsdk.showAd !== 'undefined') {
return true;
}
return false;
}
function gd_rewarded_available() {
if (gdsdk !== 'undefined' && gdsdk.preloadAd !== 'undefined') {
return true;
}
return false;
}
function gd_ads_show() {
if (gd_ads_available()) {
gdsdk.showAd().then(function(res){
gdAdAsyncCallback("SHOW_ADS", "interstitial", 1);
})
.catch(function(err){
gdAdAsyncCallback("SHOW_ADS", "interstitial", 0);
});
}
}
function gd_rewarded_preload(ad) {
if (gd_rewarded_available()) {
gdsdk.preloadAd(ad)
.then(response => {
gdAdAsyncCallback("PRELOAD_REWARDED", ad, 1);
})
.catch(error => {
gdAdAsyncCallback("PRELOAD_REWARDED", ad, 0);
});
} else {
gdAdAsyncCallback("PRELOAD_REWARDED", ad, -1 );
}
}
function gd_rewarded_show(ad) {
if (gd_ads_available() && gd_rewarded_available()) {
gdsdk.showAd(ad).then(function(res){
gdAdAsyncCallback("SHOW_REWARDED", ad, 1);
})
.catch(function(err){
gdAdAsyncCallback("SHOW_REWARDED", ad, 0);
});
}
}