hiepdh-playable-toolkit 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +10 -1
- package/setup.js +0 -0
- package/ironSource_api.js +0 -86
package/package.json
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hiepdh-playable-toolkit",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"main": "setup.js",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"fs-extra": "^11.1.0",
|
|
7
7
|
"adm-zip": "^0.5.10"
|
|
8
8
|
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"hiepdh-setup": "setup.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"2x",
|
|
14
|
+
"3x",
|
|
15
|
+
"setup.js",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
9
18
|
"keywords": [],
|
|
10
19
|
"author": "HiepDH",
|
|
11
20
|
"license": "ISC",
|
package/setup.js
CHANGED
|
File without changes
|
package/ironSource_api.js
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
function userClickedDownloadButton(url) {
|
|
2
|
-
if (typeof mraid !== "undefined") {
|
|
3
|
-
mraid.open(url);
|
|
4
|
-
} else {
|
|
5
|
-
console.log("Open Store clicked (No MRAID environment)", url);
|
|
6
|
-
if(url) window.open(url, "_blank");
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
(function () {
|
|
11
|
-
var mraid = window.mraid;
|
|
12
|
-
var isMraidLoaded = typeof mraid !== "undefined";
|
|
13
|
-
|
|
14
|
-
function handleAudioLogic() {
|
|
15
|
-
if (!isMraidLoaded) return;
|
|
16
|
-
|
|
17
|
-
var isViewable = mraid.isViewable();
|
|
18
|
-
var currentVolume = 100;
|
|
19
|
-
|
|
20
|
-
try {
|
|
21
|
-
if (typeof mraid.getAudioVolume === "function") {
|
|
22
|
-
currentVolume = mraid.getAudioVolume();
|
|
23
|
-
}
|
|
24
|
-
} catch (e) {
|
|
25
|
-
console.log("MRAID getAudioVolume not supported");
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var shouldMute = !isViewable || (currentVolume === 0);
|
|
29
|
-
|
|
30
|
-
if (shouldMute) {
|
|
31
|
-
console.log("MRAID: Audio OFF (Viewable: " + isViewable + ", Volume: " + currentVolume + ")");
|
|
32
|
-
if (typeof window.gamePause === 'function') window.gamePause();
|
|
33
|
-
localStorage.setItem("cocosSoundState", 2); // Tắt tiếng
|
|
34
|
-
} else {
|
|
35
|
-
console.log("MRAID: Audio ON (Viewable: " + isViewable + ", Volume: " + currentVolume + ")");
|
|
36
|
-
if (typeof window.gameResume === 'function') window.gameResume();
|
|
37
|
-
localStorage.setItem("cocosSoundState", 1); // Bật tiếng
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function onReady() {
|
|
42
|
-
console.log("MRAID is Ready");
|
|
43
|
-
|
|
44
|
-
mraid.addEventListener("viewableChange", function (viewable) {
|
|
45
|
-
console.log("MRAID Event: viewableChange -> " + viewable);
|
|
46
|
-
handleAudioLogic();
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
if (mraid.supports && mraid.supports("audioVolumeChange")) {
|
|
50
|
-
mraid.addEventListener("audioVolumeChange", function (volume) {
|
|
51
|
-
console.log("MRAID Event: audioVolumeChange -> " + volume);
|
|
52
|
-
handleAudioLogic();
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
handleAudioLogic();
|
|
57
|
-
|
|
58
|
-
if (mraid.isViewable()) {
|
|
59
|
-
startGame();
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function startGame() {
|
|
64
|
-
if (typeof window.onReadyCallback === "function") {
|
|
65
|
-
window.onReadyCallback();
|
|
66
|
-
} else {
|
|
67
|
-
var checkGameLoad = setInterval(function() {
|
|
68
|
-
if (typeof window.onReadyCallback === "function") {
|
|
69
|
-
window.onReadyCallback();
|
|
70
|
-
clearInterval(checkGameLoad);
|
|
71
|
-
}
|
|
72
|
-
}, 100);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
if (isMraidLoaded) {
|
|
77
|
-
if (mraid.getState() === "loading") {
|
|
78
|
-
mraid.addEventListener("ready", onReady);
|
|
79
|
-
} else {
|
|
80
|
-
onReady();
|
|
81
|
-
}
|
|
82
|
-
} else {
|
|
83
|
-
console.log("MRAID not found, auto starting game for testing...");
|
|
84
|
-
setTimeout(startGame, 500);
|
|
85
|
-
}
|
|
86
|
-
})();
|