@cc-component/cc-ex-component 1.1.0 → 1.1.2
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/assets/ex/BaseEx.ts +1 -10
- package/assets/platform/Interface.ts +73 -0
- package/assets/platform/Interface.ts.meta +9 -0
- package/assets/platform/android/AndroidSDK.ts +176 -0
- package/assets/platform/android/AndroidSDK.ts.meta +1 -0
- package/assets/platform/android/AnyThinkAds/ATBanner.ts +266 -0
- package/assets/platform/android/AnyThinkAds/ATBanner.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATInterstitial.ts +185 -0
- package/assets/platform/android/AnyThinkAds/ATInterstitial.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATInterstitialAuto.ts +180 -0
- package/assets/platform/android/AnyThinkAds/ATInterstitialAuto.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATNative.ts +256 -0
- package/assets/platform/android/AnyThinkAds/ATNative.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATRewardedAutoVideo.ts +175 -0
- package/assets/platform/android/AnyThinkAds/ATRewardedAutoVideo.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATRewardedVideo.ts +243 -0
- package/assets/platform/android/AnyThinkAds/ATRewardedVideo.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATSDK.ts +222 -0
- package/assets/platform/android/AnyThinkAds/ATSDK.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/ATSplash.ts +155 -0
- package/assets/platform/android/AnyThinkAds/ATSplash.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidBannerTS.ts +71 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidBannerTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialAutoTS.ts +52 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialAutoTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialTS.ts +41 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidNativeTS.ts +47 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidNativeTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoAutoTS.ts +52 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoAutoTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoTS.ts +41 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidSplashTS.ts +42 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidSplashTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidTS.ts +73 -0
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/Android.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSBannerTS.ts +66 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSBannerTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitiaAutolTS.ts +54 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitiaAutolTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitialTS.ts +43 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitialTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSNativeTS.ts +47 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSNativeTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedAutoVideoTS.ts +55 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedAutoVideoTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedVideoTS.ts +43 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedVideoTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSSplashTS.ts +47 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSSplashTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSTS.ts +76 -0
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSTS.ts.meta +9 -0
- package/assets/platform/android/AnyThinkAds/iOS.meta +9 -0
- package/assets/platform/android/AnyThinkAds.meta +9 -0
- package/assets/platform/android/iOSSDK.ts +14 -0
- package/assets/platform/android/iOSSDK.ts.meta +1 -0
- package/assets/platform/android.meta +11 -0
- package/assets/platform/base/EditorSDK.ts +29 -0
- package/assets/platform/base/EditorSDK.ts.meta +1 -0
- package/assets/platform/base/PlatfprmModule.ts +138 -0
- package/assets/platform/base/PlatfprmModule.ts.meta +9 -0
- package/assets/platform/base/SDKBase.ts +59 -0
- package/assets/platform/base/SDKBase.ts.meta +9 -0
- package/assets/platform/base/SDKEnum.ts +127 -0
- package/assets/platform/base/SDKEnum.ts.meta +9 -0
- package/assets/platform/base/TTSDK.ts +355 -0
- package/assets/platform/base/TTSDK.ts.meta +9 -0
- package/assets/platform/base/WXSDK.ts +150 -0
- package/assets/platform/base/WXSDK.ts.meta +1 -0
- package/assets/platform/base.meta +9 -0
- package/assets/platform/wx/MiniSDK.ts +1001 -0
- package/assets/platform/wx/MiniSDK.ts.meta +9 -0
- package/assets/platform/wx/lib.douyin.d.ts +168 -0
- package/assets/platform/wx/lib.douyin.d.ts.meta +9 -0
- package/assets/platform/wx/wxmini.d.ts +2452 -0
- package/assets/platform/wx/wxmini.d.ts.meta +9 -0
- package/assets/platform/wx.meta +9 -0
- package/assets/platform.meta +9 -0
- package/assets/video/IVideo.ts +2 -2
- package/assets/video/Interface.ts +0 -1
- package/assets/video/VideoComponent.ts +1 -1
- package/assets/video/VideoManager.ts +5 -1
- package/assets/video/VideoModule.ts +30 -7
- package/assets/video/VideoPlayTT.ts +22 -3
- package/assets/video/VideoPlayWX.ts +34 -6
- package/assets/video/VideoPlayWeb.ts +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import {ATAndroidInterstitialTS} from "./Android/ATAndroidInterstitialTS";
|
|
2
|
+
import {ATiOSInterstitialTS} from "./iOS/ATiOSInterstitialTS";
|
|
3
|
+
import {sys} from 'cc';
|
|
4
|
+
|
|
5
|
+
const initPlatformBridge = function () {
|
|
6
|
+
if (sys.os === sys.OS.IOS) {
|
|
7
|
+
return ATiOSInterstitialTS;
|
|
8
|
+
} else if (sys.os === sys.OS.ANDROID) {
|
|
9
|
+
return ATAndroidInterstitialTS;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platformBridge = initPlatformBridge();
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const ATInterstitialSDK = {
|
|
17
|
+
|
|
18
|
+
UseInterstitialAsInterstitial: "UseInterstitialAsInterstitial",
|
|
19
|
+
|
|
20
|
+
ATInterstitialListener: {
|
|
21
|
+
developerCallback: null, onInterstitialAdLoaded: function (placementId: any) {
|
|
22
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdLoaded != null) {
|
|
23
|
+
this.developerCallback.onInterstitialAdLoaded(placementId);
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
|
|
27
|
+
onInterstitialAdLoadFail: function (placementId: any, errorInfo: any) {
|
|
28
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdLoadFail != null) {
|
|
29
|
+
this.developerCallback.onInterstitialAdLoadFail(placementId, errorInfo);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
|
|
33
|
+
onInterstitialAdShow: function (placementId: any, callbackInfo: any) {
|
|
34
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdShow != null) {
|
|
35
|
+
this.developerCallback.onInterstitialAdShow(placementId, callbackInfo);
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
|
|
39
|
+
onInterstitialAdStartPlayingVideo: function (placementId: any, callbackInfo: any) {
|
|
40
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdStartPlayingVideo != null) {
|
|
41
|
+
this.developerCallback.onInterstitialAdStartPlayingVideo(placementId, callbackInfo);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
|
|
45
|
+
onInterstitialAdEndPlayingVideo: function (placementId: any, callbackInfo: any) {
|
|
46
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdEndPlayingVideo != null) {
|
|
47
|
+
this.developerCallback.onInterstitialAdEndPlayingVideo(placementId, callbackInfo);
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
|
|
51
|
+
onInterstitialAdFailedToPlayVideo: function (placementId: any, errorInfo: any) {
|
|
52
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdFailedToPlayVideo != null) {
|
|
53
|
+
this.developerCallback.onInterstitialAdFailedToPlayVideo(placementId, errorInfo);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
onInterstitialAdFailedToShow: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
58
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdFailedToShow != null) {
|
|
59
|
+
this.developerCallback.onInterstitialAdFailedToShow(placementId, errorInfo, callbackInfo);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
|
|
63
|
+
onInterstitialAdClose: function (placementId: any, callbackInfo: any) {
|
|
64
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdClose != null) {
|
|
65
|
+
this.developerCallback.onInterstitialAdClose(placementId, callbackInfo);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
onInterstitialAdClick: function (placementId: any, callbackInfo: any) {
|
|
70
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdClick != null) {
|
|
71
|
+
this.developerCallback.onInterstitialAdClick(placementId, callbackInfo);
|
|
72
|
+
}
|
|
73
|
+
}, //added v5.8.10
|
|
74
|
+
onAdSourceBiddingAttempt: function (placementId: any, callbackInfo: any) {
|
|
75
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingAttempt != null) {
|
|
76
|
+
this.developerCallback.onAdSourceBiddingAttempt(placementId, callbackInfo);
|
|
77
|
+
}
|
|
78
|
+
}, onAdSourceBiddingFilled: function (placementId: any, callbackInfo: any) {
|
|
79
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingFilled != null) {
|
|
80
|
+
this.developerCallback.onAdSourceBiddingFilled(placementId, callbackInfo);
|
|
81
|
+
}
|
|
82
|
+
}, onAdSourceBiddingFail: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
83
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingFail != null) {
|
|
84
|
+
this.developerCallback.onAdSourceBiddingFail(placementId, errorInfo, callbackInfo);
|
|
85
|
+
}
|
|
86
|
+
}, onAdSourceAttemp: function (placementId: any, callbackInfo: any) {
|
|
87
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceAttemp != null) {
|
|
88
|
+
this.developerCallback.onAdSourceAttemp(placementId, callbackInfo);
|
|
89
|
+
}
|
|
90
|
+
}, onAdSourceLoadFilled: function (placementId: any, callbackInfo: any) {
|
|
91
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceLoadFilled != null) {
|
|
92
|
+
this.developerCallback.onAdSourceLoadFilled(placementId, callbackInfo);
|
|
93
|
+
}
|
|
94
|
+
}, onAdSourceLoadFail: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
95
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceLoadFail != null) {
|
|
96
|
+
this.developerCallback.onAdSourceLoadFail(placementId, errorInfo, callbackInfo);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
loadAd: function (placementId: any, settings = {}) {
|
|
103
|
+
|
|
104
|
+
if (platformBridge != null) {
|
|
105
|
+
platformBridge.loadInterstitial(placementId, JSON.stringify(settings));
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
|
|
109
|
+
setAdListener: function (listener: any) {
|
|
110
|
+
const eventJSON = {};
|
|
111
|
+
eventJSON[LoadedCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdLoaded", eventJSON[LoadFailCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdLoadFail", eventJSON[PlayStartCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdStartPlayingVideo", eventJSON[PlayEndCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdEndPlayingVideo", eventJSON[PlayFailCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdFailedToPlayVideo", eventJSON[CloseCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdClose", eventJSON[ClickCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdClick", eventJSON[ShowCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdShow", eventJSON[ShowFailCallbackKey] = "ATInterstitialSDK.ATInterstitialListener.onInterstitialAdFailedToShow", //added v5.8.10
|
|
112
|
+
eventJSON[BiddingAttempt] = "ATInterstitialSDK.ATInterstitialListener.onAdSourceBiddingAttempt", eventJSON[BiddingFilled] = "ATInterstitialSDK.ATInterstitialListener.onAdSourceBiddingFilled", eventJSON[BiddingFail] = "ATInterstitialSDK.ATInterstitialListener.onAdSourceBiddingFail", eventJSON[Attemp] = "ATInterstitialSDK.ATInterstitialListener.onAdSourceAttemp", eventJSON[LoadFilled] = "ATInterstitialSDK.ATInterstitialListener.onAdSourceLoadFilled", eventJSON[LoadFail] = "ATInterstitialSDK.ATInterstitialListener.onAdSourceLoadFail"
|
|
113
|
+
|
|
114
|
+
if (undefined != platformBridge) {
|
|
115
|
+
platformBridge.setAdListener(JSON.stringify(eventJSON));
|
|
116
|
+
} else {
|
|
117
|
+
console.log("You must run on Android or iOS.");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this.ATInterstitialListener.developerCallback = listener;
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
hasAdReady: function (placementId: any) {
|
|
124
|
+
if (undefined != platformBridge) {
|
|
125
|
+
return platformBridge.hasAdReady(placementId);
|
|
126
|
+
} else {
|
|
127
|
+
console.log("You must run on Android or iOS.");
|
|
128
|
+
}
|
|
129
|
+
return false;
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
checkAdStatus: function (placementId: any) {
|
|
133
|
+
if (undefined != platformBridge) {
|
|
134
|
+
return platformBridge.checkAdStatus(placementId);
|
|
135
|
+
} else {
|
|
136
|
+
console.log("You must run on Android or iOS.");
|
|
137
|
+
}
|
|
138
|
+
return "";
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
showAd: function (placementId: any) {
|
|
142
|
+
if (undefined != platformBridge) {
|
|
143
|
+
platformBridge.showAd(placementId);
|
|
144
|
+
} else {
|
|
145
|
+
console.log("You must run on Android or iOS.");
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
|
|
149
|
+
showAdInScenario: function (placementId: any, scenario: any) {
|
|
150
|
+
if (undefined != platformBridge) {
|
|
151
|
+
platformBridge.showAdInScenario(placementId, scenario);
|
|
152
|
+
} else {
|
|
153
|
+
console.log("You must run on Android or iOS.");
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
|
|
157
|
+
entryAdScenario: function (placementId: any, scenario: any) {
|
|
158
|
+
if (undefined != platformBridge) {
|
|
159
|
+
platformBridge.entryAdScenario(placementId, scenario);
|
|
160
|
+
} else {
|
|
161
|
+
console.log("You must run on Android or iOS.");
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const LoadedCallbackKey = "InterstitialLoaded";
|
|
169
|
+
const LoadFailCallbackKey = "InterstitialLoadFail";
|
|
170
|
+
const PlayStartCallbackKey = "InterstitialPlayStart";
|
|
171
|
+
const PlayEndCallbackKey = "InterstitialPlayEnd";
|
|
172
|
+
const PlayFailCallbackKey = "InterstitialPlayFail";
|
|
173
|
+
const CloseCallbackKey = "InterstitialClose";
|
|
174
|
+
const ClickCallbackKey = "InterstitialClick";
|
|
175
|
+
const ShowCallbackKey = "InterstitialAdShow";
|
|
176
|
+
const ShowFailCallbackKey = "InterstitialAdShowFail";
|
|
177
|
+
|
|
178
|
+
const BiddingAttempt = "InterstitialBiddingAttempt";
|
|
179
|
+
const BiddingFilled = "InterstitialBiddingFilled";
|
|
180
|
+
const BiddingFail = "InterstitialBiddingFail";
|
|
181
|
+
const Attemp = "InterstitialAttemp";
|
|
182
|
+
const LoadFilled = "InterstitialLoadFilled";
|
|
183
|
+
const LoadFail = "InterstitialLoadFail";
|
|
184
|
+
|
|
185
|
+
window["ATInterstitialSDK"] = ATInterstitialSDK;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import {ATAndroidInterstitialAutoAdTS} from "./Android/ATAndroidInterstitialAutoTS";
|
|
2
|
+
import {ATiOSInterstitialAutoAdTS} from "./iOS/ATiOSInterstitiaAutolTS";
|
|
3
|
+
import {sys} from 'cc';
|
|
4
|
+
|
|
5
|
+
const initPlatformBridge = function () {
|
|
6
|
+
if (sys.os === sys.OS.IOS) {
|
|
7
|
+
return ATiOSInterstitialAutoAdTS;
|
|
8
|
+
} else if (sys.os === sys.OS.ANDROID) {
|
|
9
|
+
return ATAndroidInterstitialAutoAdTS;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platformBridge = initPlatformBridge();
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const ATInterstitialAutoAdSDK = {
|
|
17
|
+
|
|
18
|
+
UseInterstitialAsInterstitial: "UseInterstitialAsInterstitial",
|
|
19
|
+
UseRewardedVideoAsInterstitial: "UseRewardedVideoAsInterstitial",
|
|
20
|
+
ATInterstitialListener: {
|
|
21
|
+
developerCallback: null,
|
|
22
|
+
|
|
23
|
+
onInterstitialAdLoaded: function (placementId: any) {
|
|
24
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdLoaded != null) {
|
|
25
|
+
this.developerCallback.onInterstitialAdLoaded(placementId);
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
onInterstitialAdLoadFail: function (placementId: any, errorInfo: any) {
|
|
30
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdLoadFail != null) {
|
|
31
|
+
this.developerCallback.onInterstitialAdLoadFail(placementId, errorInfo);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
onInterstitialAdShow: function (placementId: any, callbackInfo: any) {
|
|
36
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdShow != null) {
|
|
37
|
+
this.developerCallback.onInterstitialAdShow(placementId, callbackInfo);
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
onInterstitialAdStartPlayingVideo: function (placementId: any, callbackInfo: any) {
|
|
42
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdStartPlayingVideo != null) {
|
|
43
|
+
this.developerCallback.onInterstitialAdStartPlayingVideo(placementId, callbackInfo);
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
|
|
47
|
+
onInterstitialAdEndPlayingVideo: function (placementId: any, callbackInfo: any) {
|
|
48
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdEndPlayingVideo != null) {
|
|
49
|
+
this.developerCallback.onInterstitialAdEndPlayingVideo(placementId, callbackInfo);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
|
|
53
|
+
onInterstitialAdFailedToPlayVideo: function (placementId: any, errorInfo: any) {
|
|
54
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdFailedToPlayVideo != null) {
|
|
55
|
+
this.developerCallback.onInterstitialAdFailedToPlayVideo(placementId, errorInfo);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
|
|
59
|
+
onInterstitialAdFailedToShow: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
60
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdFailedToShow != null) {
|
|
61
|
+
this.developerCallback.onInterstitialAdFailedToShow(placementId, errorInfo, callbackInfo);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
onInterstitialAdClose: function (placementId: any, callbackInfo: any) {
|
|
66
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdClose != null) {
|
|
67
|
+
this.developerCallback.onInterstitialAdClose(placementId, callbackInfo);
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
|
|
71
|
+
onInterstitialAdClick: function (placementId: any, callbackInfo: any) {
|
|
72
|
+
if (this.developerCallback != null && this.developerCallback.onInterstitialAdClick != null) {
|
|
73
|
+
this.developerCallback.onInterstitialAdClick(placementId, callbackInfo);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
setAdExtraData: function (placementId: any, settings = {}) {
|
|
79
|
+
|
|
80
|
+
if (undefined != platformBridge) {
|
|
81
|
+
platformBridge.setAdExtraData(placementId, JSON.stringify(settings));
|
|
82
|
+
} else {
|
|
83
|
+
console.log("You must run on Android or iOS.");
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
addPlacementIds: function (placementIds: string[]) {
|
|
88
|
+
|
|
89
|
+
if (undefined != platformBridge) {
|
|
90
|
+
platformBridge.addPlacementIds(JSON.stringify(placementIds));
|
|
91
|
+
} else {
|
|
92
|
+
console.log("You must run on Android or iOS.");
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
removePlacementId: function (placementIds: any) {
|
|
97
|
+
|
|
98
|
+
if (undefined != platformBridge) {
|
|
99
|
+
platformBridge.removePlacementId(JSON.stringify(placementIds));
|
|
100
|
+
} else {
|
|
101
|
+
console.log("You must run on Android or iOS.");
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
setAdListener: function (listener: any) {
|
|
106
|
+
const eventJSON = {};
|
|
107
|
+
eventJSON[LoadedCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdLoaded";
|
|
108
|
+
eventJSON[LoadFailCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdLoadFail";
|
|
109
|
+
eventJSON[PlayStartCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdStartPlayingVideo";
|
|
110
|
+
eventJSON[PlayEndCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdEndPlayingVideo";
|
|
111
|
+
eventJSON[PlayFailCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdFailedToPlayVideo";
|
|
112
|
+
eventJSON[CloseCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdClose";
|
|
113
|
+
eventJSON[ClickCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdClick";
|
|
114
|
+
eventJSON[ShowCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdShow";
|
|
115
|
+
eventJSON[ShowFailCallbackKey] = "ATInterstitialAutoAdSDK.ATInterstitialListener.onInterstitialAdFailedToShow";
|
|
116
|
+
|
|
117
|
+
if (undefined != platformBridge) {
|
|
118
|
+
platformBridge.setAdListener(JSON.stringify(eventJSON));
|
|
119
|
+
} else {
|
|
120
|
+
console.log("You must run on Android or iOS.");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.ATInterstitialListener.developerCallback = listener;
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
hasAdReady: function (placementId: any) {
|
|
127
|
+
if (undefined != platformBridge) {
|
|
128
|
+
return platformBridge.hasAdReady(placementId);
|
|
129
|
+
} else {
|
|
130
|
+
console.log("You must run on Android or iOS.");
|
|
131
|
+
}
|
|
132
|
+
return false;
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
checkAdStatus: function (placementId: any) {
|
|
136
|
+
if (undefined != platformBridge) {
|
|
137
|
+
return platformBridge.checkAdStatus(placementId);
|
|
138
|
+
} else {
|
|
139
|
+
console.log("You must run on Android or iOS.");
|
|
140
|
+
}
|
|
141
|
+
return "";
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
showAd: function (placementId: any) {
|
|
145
|
+
if (undefined != platformBridge) {
|
|
146
|
+
platformBridge.showAd(placementId);
|
|
147
|
+
} else {
|
|
148
|
+
console.log("You must run on Android or iOS.");
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
showAdInScenario: function (placementId: any, scenario: any) {
|
|
153
|
+
if (undefined != platformBridge) {
|
|
154
|
+
platformBridge.showAdInScenario(placementId, scenario);
|
|
155
|
+
} else {
|
|
156
|
+
console.log("You must run on Android or iOS.");
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
entryAdScenario: function (placementId: any, scenario: any) {
|
|
161
|
+
if (undefined != platformBridge) {
|
|
162
|
+
platformBridge.entryAdScenario(placementId, scenario);
|
|
163
|
+
} else {
|
|
164
|
+
console.log("You must run on Android or iOS.");
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const LoadedCallbackKey = "InterstitialAutoAdLoaded";
|
|
171
|
+
const LoadFailCallbackKey = "InterstitialAutoAdLoadFail";
|
|
172
|
+
const PlayStartCallbackKey = "InterstitialAutoAdPlayStart";
|
|
173
|
+
const PlayEndCallbackKey = "InterstitialAutoAdPlayEnd";
|
|
174
|
+
const PlayFailCallbackKey = "InterstitialAutoAdPlayFail";
|
|
175
|
+
const CloseCallbackKey = "InterstitialAutoAdClose";
|
|
176
|
+
const ClickCallbackKey = "InterstitialAutoAdClick";
|
|
177
|
+
const ShowCallbackKey = "InterstitialAutoAdAdShow";
|
|
178
|
+
const ShowFailCallbackKey = "InterstitialAutoAdShowFail";
|
|
179
|
+
|
|
180
|
+
window["ATInterstitialAutoAdSDK"] = ATInterstitialAutoAdSDK;
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
import {ATiOSNativeTS} from "./iOS/ATiOSNativeTS"
|
|
2
|
+
import {ATAndroidNativeTS} from "./Android/ATAndroidNativeTS"
|
|
3
|
+
import {Component, sys} from 'cc';
|
|
4
|
+
|
|
5
|
+
const initPlatformBridge = function () {
|
|
6
|
+
if (sys.os === sys.OS.IOS) {
|
|
7
|
+
return ATiOSNativeTS;
|
|
8
|
+
} else if (sys.os === sys.OS.ANDROID) {
|
|
9
|
+
return ATAndroidNativeTS;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const platformBridge = initPlatformBridge();
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
export const ATNativeSDK = {
|
|
17
|
+
ATNativeListener: {
|
|
18
|
+
developerCallback: null, onNativeAdLoaded: function (placementId: any) {
|
|
19
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdLoaded != null) {
|
|
20
|
+
this.developerCallback.onNativeAdLoaded(placementId);
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
onNativeAdLoadFail: function (placementId: any, errorInfo: any) {
|
|
25
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdLoadFail != null) {
|
|
26
|
+
this.developerCallback.onNativeAdLoadFail(placementId, errorInfo);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
onNativeAdShow: function (placementId: any, callbackInfo: any) {
|
|
31
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdShow != null) {
|
|
32
|
+
this.developerCallback.onNativeAdShow(placementId, callbackInfo);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
onNativeAdClick: function (placementId: any, callbackInfo: any) {
|
|
37
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdClick != null) {
|
|
38
|
+
this.developerCallback.onNativeAdClick(placementId, callbackInfo);
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
|
|
42
|
+
onNativeAdVideoStart: function (placementId: any) {
|
|
43
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdVideoStart != null) {
|
|
44
|
+
this.developerCallback.onNativeAdVideoStart(placementId,);
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
onNativeAdVideoEnd: function (placementId: any) {
|
|
49
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdVideoEnd != null) {
|
|
50
|
+
this.developerCallback.onNativeAdVideoEnd(placementId);
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
|
|
54
|
+
onNativeAdCloseButtonTapped: function (placementId: any, callbackInfo: any) {
|
|
55
|
+
if (this.developerCallback != null && this.developerCallback.onNativeAdCloseButtonTapped != null) {
|
|
56
|
+
this.developerCallback.onNativeAdCloseButtonTapped(placementId, callbackInfo);
|
|
57
|
+
}
|
|
58
|
+
}, //added v5.8.10
|
|
59
|
+
onAdSourceBiddingAttempt: function (placementId: any, callbackInfo: any) {
|
|
60
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingAttempt != null) {
|
|
61
|
+
this.developerCallback.onAdSourceBiddingAttempt(placementId, callbackInfo);
|
|
62
|
+
}
|
|
63
|
+
}, onAdSourceBiddingFilled: function (placementId: any, callbackInfo: any) {
|
|
64
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingFilled != null) {
|
|
65
|
+
this.developerCallback.onAdSourceBiddingFilled(placementId, callbackInfo);
|
|
66
|
+
}
|
|
67
|
+
}, onAdSourceBiddingFail: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
68
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingFail != null) {
|
|
69
|
+
this.developerCallback.onAdSourceBiddingFail(placementId, errorInfo, callbackInfo);
|
|
70
|
+
}
|
|
71
|
+
}, onAdSourceAttemp: function (placementId: any, callbackInfo: any) {
|
|
72
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceAttemp != null) {
|
|
73
|
+
this.developerCallback.onAdSourceAttemp(placementId, callbackInfo);
|
|
74
|
+
}
|
|
75
|
+
}, onAdSourceLoadFilled: function (placementId: any, callbackInfo: any) {
|
|
76
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceLoadFilled != null) {
|
|
77
|
+
this.developerCallback.onAdSourceLoadFilled(placementId, callbackInfo);
|
|
78
|
+
}
|
|
79
|
+
}, onAdSourceLoadFail: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
80
|
+
if (this.developerCallback != null && this.developerCallback.onAdSourceLoadFail != null) {
|
|
81
|
+
this.developerCallback.onAdSourceLoadFail(placementId, errorInfo, callbackInfo);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
loadAd: function (placementId: any, settings = {}) {
|
|
88
|
+
|
|
89
|
+
if (undefined != platformBridge) {
|
|
90
|
+
platformBridge.loadNative(placementId, JSON.stringify(settings));
|
|
91
|
+
} else {
|
|
92
|
+
console.log("You must run on Android or iOS.");
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
setAdListener: function (listener: any) {
|
|
97
|
+
const eventJSON = {};
|
|
98
|
+
eventJSON[LoadedCallbackKey] = "ATNative.ATNativeListener.onNativeAdLoaded", eventJSON[LoadFailCallbackKey] = "ATNative.ATNativeListener.onNativeAdLoadFail", eventJSON[CloseCallbackKey] = "ATNative.ATNativeListener.onNativeAdCloseButtonTapped", eventJSON[ClickCallbackKey] = "ATNative.ATNativeListener.onNativeAdClick", eventJSON[ShowCallbackKey] = "ATNative.ATNativeListener.onNativeAdShow", eventJSON[VideoStartKey] = "ATNative.ATNativeListener.onNativeAdVideoStart", eventJSON[VideoEndKey] = "ATNative.ATNativeListener.onNativeAdVideoEnd", //added v5.8.10
|
|
99
|
+
eventJSON[BiddingAttempt] = "ATNative.ATNativeListener.onAdSourceBiddingAttempt", eventJSON[BiddingFilled] = "ATNative.ATNativeListener.onAdSourceBiddingFilled", eventJSON[BiddingFail] = "ATNative.ATNativeListener.onAdSourceBiddingFail", eventJSON[Attemp] = "ATNative.ATNativeListener.onAdSourceAttemp", eventJSON[LoadFilled] = "ATNative.ATNativeListener.onAdSourceLoadFilled", eventJSON[LoadFail] = "ATNative.ATNativeListener.onAdSourceLoadFail"
|
|
100
|
+
|
|
101
|
+
if (undefined != platformBridge) {
|
|
102
|
+
platformBridge.setAdListener(JSON.stringify(eventJSON));
|
|
103
|
+
} else {
|
|
104
|
+
console.log("You must run on Android or iOS.");
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
this.ATNativeListener.developerCallback = listener;
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
hasAdReady: function (placementId: any) {
|
|
111
|
+
if (undefined != platformBridge) {
|
|
112
|
+
return platformBridge.hasAdReady(placementId);
|
|
113
|
+
} else {
|
|
114
|
+
console.log("You must run on Android or iOS.");
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
checkAdStatus: function (placementId: any) {
|
|
120
|
+
if (undefined != platformBridge) {
|
|
121
|
+
return platformBridge.checkAdStatus(placementId);
|
|
122
|
+
} else {
|
|
123
|
+
console.log("You must run on Android or iOS.");
|
|
124
|
+
}
|
|
125
|
+
return "";
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
showAd: function (placementId: any, adViewProperty: { getAdViewProperty: () => any; }) {
|
|
129
|
+
if (undefined != platformBridge) {
|
|
130
|
+
platformBridge.showAd(placementId, JSON.stringify(adViewProperty.getAdViewProperty()));
|
|
131
|
+
} else {
|
|
132
|
+
console.log("You must run on Android or iOS.");
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
|
|
136
|
+
showAdInScenario: function (placementId: any, adViewProperty: { getAdViewProperty: () => any; }, scenario: any) {
|
|
137
|
+
if (undefined != platformBridge) {
|
|
138
|
+
platformBridge.showAdInScenario(placementId, JSON.stringify(adViewProperty.getAdViewProperty()), scenario);
|
|
139
|
+
} else {
|
|
140
|
+
console.log("You must run on Android or iOS.");
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
entryAdScenario: function (placementId: any, scenario: any) {
|
|
145
|
+
if (undefined != platformBridge) {
|
|
146
|
+
platformBridge.entryAdScenario(placementId, scenario);
|
|
147
|
+
} else {
|
|
148
|
+
console.log("You must run on Android or iOS.");
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
removeAd: function (placementId: any) {
|
|
153
|
+
if (undefined != platformBridge) {
|
|
154
|
+
platformBridge.removeAd(placementId);
|
|
155
|
+
} else {
|
|
156
|
+
console.log("You must run on Android or iOS.");
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
|
|
160
|
+
createLoadAdSize: function (width: any, height: any) {
|
|
161
|
+
const loadAdSize = {};
|
|
162
|
+
loadAdSize["width"] = width;
|
|
163
|
+
loadAdSize["height"] = height;
|
|
164
|
+
return loadAdSize;
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export class AdViewProperty extends Component {
|
|
170
|
+
|
|
171
|
+
parent = null
|
|
172
|
+
appIcon = null
|
|
173
|
+
mainImage = null
|
|
174
|
+
title = null
|
|
175
|
+
desc = null
|
|
176
|
+
adLogo = null
|
|
177
|
+
cta = null
|
|
178
|
+
rating = null
|
|
179
|
+
dislike = null
|
|
180
|
+
elements = null
|
|
181
|
+
|
|
182
|
+
createItemViewProperty(x: number, y: number, width: number, height: number, backgroundColor: string, textColor: string, textSize: number, isCustomClick = false) {
|
|
183
|
+
const itemProperty = {};
|
|
184
|
+
itemProperty["x"] = x;
|
|
185
|
+
itemProperty["y"] = y;
|
|
186
|
+
itemProperty["width"] = width;
|
|
187
|
+
itemProperty["height"] = height;
|
|
188
|
+
itemProperty["backgroundColor"] = backgroundColor;
|
|
189
|
+
itemProperty["textColor"] = textColor;
|
|
190
|
+
itemProperty["textSize"] = textSize;
|
|
191
|
+
itemProperty["isCustomClick"] = isCustomClick;
|
|
192
|
+
|
|
193
|
+
return itemProperty;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
getAdViewProperty() {
|
|
197
|
+
const nativeViewProperty = {};
|
|
198
|
+
|
|
199
|
+
if (this.parent != null) {
|
|
200
|
+
nativeViewProperty["parent"] = this.parent;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if (this.appIcon != null) {
|
|
204
|
+
nativeViewProperty["icon"] = this.appIcon;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
if (this.mainImage != null) {
|
|
208
|
+
nativeViewProperty["mainImage"] = this.mainImage;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (this.title != null) {
|
|
212
|
+
nativeViewProperty["title"] = this.title;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (this.desc != null) {
|
|
216
|
+
nativeViewProperty["desc"] = this.desc;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (this.adLogo != null) {
|
|
220
|
+
nativeViewProperty["adLogo"] = this.adLogo;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (this.cta != null) {
|
|
224
|
+
nativeViewProperty["cta"] = this.cta;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
if (this.rating != null) {
|
|
228
|
+
nativeViewProperty["rating"] = this.rating;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
if (this.dislike != null) {
|
|
232
|
+
nativeViewProperty["dislike"] = this.dislike;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (this.elements != null) {
|
|
236
|
+
nativeViewProperty["elements"] = this.elements
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
return nativeViewProperty;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const LoadedCallbackKey = "NativeLoaded";
|
|
244
|
+
const LoadFailCallbackKey = "NativeLoadFail";
|
|
245
|
+
const CloseCallbackKey = "NativeCloseButtonTapped";
|
|
246
|
+
const ClickCallbackKey = "NativeClick";
|
|
247
|
+
const ShowCallbackKey = "NativeShow";
|
|
248
|
+
const VideoStartKey = "NativeVideoStart";
|
|
249
|
+
const VideoEndKey = "NativeVideoEnd";
|
|
250
|
+
const BiddingAttempt = "NativeBiddingAttempt";
|
|
251
|
+
const BiddingFilled = "NativeBiddingFilled";
|
|
252
|
+
const BiddingFail = "NativeBiddingFail";
|
|
253
|
+
const Attemp = "NativeAttemp";
|
|
254
|
+
const LoadFilled = "NativeLoadFilled";
|
|
255
|
+
const LoadFail = "NativeLoadFail";
|
|
256
|
+
window["ATNative"] = ATNativeSDK;
|