@cc-component/cc-ex-component 1.2.5 → 1.2.7
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 +1 -1
- package/assets/platform/Interface.ts +0 -80
- package/assets/platform/Interface.ts.meta +0 -9
- package/assets/platform/android/AndroidModule.ts +0 -12
- package/assets/platform/android/AndroidModule.ts.meta +0 -9
- package/assets/platform/android/AndroidSDK.ts +0 -186
- package/assets/platform/android/AndroidSDK.ts.meta +0 -1
- package/assets/platform/android/AnyThinkAds/ATBanner.ts +0 -266
- package/assets/platform/android/AnyThinkAds/ATBanner.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATInterstitial.ts +0 -185
- package/assets/platform/android/AnyThinkAds/ATInterstitial.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATInterstitialAuto.ts +0 -180
- package/assets/platform/android/AnyThinkAds/ATInterstitialAuto.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATNative.ts +0 -256
- package/assets/platform/android/AnyThinkAds/ATNative.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATRewardedAutoVideo.ts +0 -175
- package/assets/platform/android/AnyThinkAds/ATRewardedAutoVideo.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATRewardedVideo.ts +0 -243
- package/assets/platform/android/AnyThinkAds/ATRewardedVideo.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATSDK.ts +0 -222
- package/assets/platform/android/AnyThinkAds/ATSDK.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/ATSplash.ts +0 -155
- package/assets/platform/android/AnyThinkAds/ATSplash.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidBannerTS.ts +0 -71
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidBannerTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialAutoTS.ts +0 -52
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialAutoTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialTS.ts +0 -41
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidInterstitialTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidNativeTS.ts +0 -47
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidNativeTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoAutoTS.ts +0 -52
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoAutoTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoTS.ts +0 -41
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidRewardedVideoTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidSplashTS.ts +0 -42
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidSplashTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidTS.ts +0 -73
- package/assets/platform/android/AnyThinkAds/Android/ATAndroidTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/Android.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSBannerTS.ts +0 -66
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSBannerTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitiaAutolTS.ts +0 -54
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitiaAutolTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitialTS.ts +0 -43
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSInterstitialTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSNativeTS.ts +0 -47
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSNativeTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedAutoVideoTS.ts +0 -55
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedAutoVideoTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedVideoTS.ts +0 -43
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSRewardedVideoTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSSplashTS.ts +0 -47
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSSplashTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSTS.ts +0 -76
- package/assets/platform/android/AnyThinkAds/iOS/ATiOSTS.ts.meta +0 -9
- package/assets/platform/android/AnyThinkAds/iOS.meta +0 -9
- package/assets/platform/android/AnyThinkAds.meta +0 -9
- package/assets/platform/android/iOSSDK.ts +0 -14
- package/assets/platform/android/iOSSDK.ts.meta +0 -1
- package/assets/platform/android.meta +0 -11
- package/assets/platform/base/EditorSDK.ts +0 -30
- package/assets/platform/base/EditorSDK.ts.meta +0 -1
- package/assets/platform/base/PlatfprmModule.ts +0 -152
- package/assets/platform/base/PlatfprmModule.ts.meta +0 -9
- package/assets/platform/base/SDKBase.ts +0 -59
- package/assets/platform/base/SDKBase.ts.meta +0 -9
- package/assets/platform/base/SDKEnum.ts +0 -127
- package/assets/platform/base/SDKEnum.ts.meta +0 -9
- package/assets/platform/base/TTSDK.ts +0 -366
- package/assets/platform/base/TTSDK.ts.meta +0 -9
- package/assets/platform/base/WXSDK.ts +0 -149
- package/assets/platform/base/WXSDK.ts.meta +0 -1
- package/assets/platform/base.meta +0 -9
- package/assets/platform/wx/MiniSDK.ts +0 -1039
- package/assets/platform/wx/MiniSDK.ts.meta +0 -9
- package/assets/platform/wx/lib.douyin.d.ts +0 -168
- package/assets/platform/wx/lib.douyin.d.ts.meta +0 -9
- package/assets/platform/wx/wxmini.d.ts +0 -2452
- package/assets/platform/wx/wxmini.d.ts.meta +0 -9
- package/assets/platform/wx.meta +0 -9
- package/assets/platform.meta +0 -9
package/package.json
CHANGED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { _decorator, Node } from 'cc';
|
|
2
|
-
import { AdsCall, AdsData, ButtonTouch, PositonData, SDKBuyParam, SDKLoginData, SDKStatus, TTBaseData, TTData, UserInfoData } from './base/SDKEnum';
|
|
3
|
-
import { ICreateUserInfoButton } from './wx/MiniSDK';
|
|
4
|
-
import { SDKBase } from './base/SDKBase';
|
|
5
|
-
declare global {
|
|
6
|
-
namespace PlatfprmModule {
|
|
7
|
-
/**小游戏:按钮触摸 需要在按钮onTouchEnd中调用的方法 使用这个属性*/
|
|
8
|
-
const buttonTouch: ButtonTouch;
|
|
9
|
-
//#region 通用==============
|
|
10
|
-
/**模块初始化 */
|
|
11
|
-
export function Init(): Promise<boolean>
|
|
12
|
-
/**登录 */
|
|
13
|
-
export function Login(data?: string): Promise<SDKLoginData>
|
|
14
|
-
/**抖音:打开侧边栏
|
|
15
|
-
* callBack: 从侧边栏点击进入 游戏回调
|
|
16
|
-
*/
|
|
17
|
-
export function NavigateToScene(param?: { scene?: string; callBack?: () => void })
|
|
18
|
-
/**cocos node坐标转换为原生坐标 */
|
|
19
|
-
export function ToPosition(node: Node): PositonData
|
|
20
|
-
/**添加到桌面 */
|
|
21
|
-
export function AddShortcut(): Promise<boolean>
|
|
22
|
-
/**激励视频初始化 */
|
|
23
|
-
export function InitRewardedVideo(param: AdsData);
|
|
24
|
-
/**激励视频显示 */
|
|
25
|
-
export function ShowRewardedVideo(param: AdsCall): Promise<boolean>
|
|
26
|
-
//开放数据域
|
|
27
|
-
export function InitOpenDataLayout(node: Node)
|
|
28
|
-
export function SendMessageToOpenData(params: { type: string, event: string })
|
|
29
|
-
/** 更新开放数据榜单数据 */
|
|
30
|
-
export function UpdateCloudRank(key: string, score: number): Promise<boolean>
|
|
31
|
-
export function ShowRank(keyList: string[], openId?: string)
|
|
32
|
-
|
|
33
|
-
//#region 安卓相关===========
|
|
34
|
-
/**退出登录 */
|
|
35
|
-
export function Logout(): Promise<SDKStatus>
|
|
36
|
-
/**支付--目前只有安卓接入了 */
|
|
37
|
-
export function Pay(param: SDKBuyParam): Promise<SDKStatus>
|
|
38
|
-
|
|
39
|
-
//#region 微信相关===========
|
|
40
|
-
/**创建游戏圈按钮 */
|
|
41
|
-
export function CreateGameClubButton(): any
|
|
42
|
-
/**创建用户信息按钮 */
|
|
43
|
-
export function CreateUserInfoButton(param: ICreateUserInfoButton, callBack: (userInfo: UserInfoData) => void)
|
|
44
|
-
/**检查是否显示隐私条约 */
|
|
45
|
-
export function CheckShowPrivacy(): any
|
|
46
|
-
/**打开隐私条约 */
|
|
47
|
-
export function OpenPrivacyCUrl(): any
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
//#region 抖音相关===========
|
|
51
|
-
/**初始化视频流场景 */
|
|
52
|
-
export function InitTTFeedScene()
|
|
53
|
-
/**抖音订阅视频流回调 */
|
|
54
|
-
export function RequestFeedSubscribe(call: (success: boolean) => void);
|
|
55
|
-
/**抖音:上报抖音场景 */
|
|
56
|
-
export function ReportScene()
|
|
57
|
-
export function ReportFeed(data: TTBaseData)
|
|
58
|
-
/**抖音:上报抖音订阅视频流数据 */
|
|
59
|
-
export function StoreFeedData(data: TTData): Promise<boolean>
|
|
60
|
-
/**抖音:获取抖音订阅视频流数据 */
|
|
61
|
-
export function GetFeedData(data: TTBaseData): Promise<boolean>
|
|
62
|
-
/**抖音:检查抖音订阅视频流状态 */
|
|
63
|
-
export function CheckFeedSubscribeStatus(): Promise<boolean>
|
|
64
|
-
/**抖音:检查抖音场景状态 默认:scene=sidebar*/
|
|
65
|
-
export function CheckScene(scene?: string): Promise<boolean>
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
namespace AndroidModule {
|
|
70
|
-
export function Init()
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//暂时不用这种方式
|
|
76
|
-
// declare module "cc" {
|
|
77
|
-
// namespace PlatfprmModule {
|
|
78
|
-
// function ToSideBar(): void;
|
|
79
|
-
// }
|
|
80
|
-
// }
|
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import { _decorator, Component, Node } from 'cc';
|
|
2
|
-
import { SDKBase } from '../base/SDKBase';
|
|
3
|
-
import { AdsCall, AdsData, PositonData, SDKBuyParam, SDKEnum, SDKInitParam, SDKLoginData, SDKStatus } from '../base/SDKEnum';
|
|
4
|
-
import { native } from 'cc';
|
|
5
|
-
import { sys } from 'cc';
|
|
6
|
-
import { ATRewardedVideoAutoAdSDK } from './AnyThinkAds/ATRewardedAutoVideo';
|
|
7
|
-
import { ATSDK } from './AnyThinkAds/ATSDK';
|
|
8
|
-
import { assetManager } from 'cc';
|
|
9
|
-
const { ccclass, property } = _decorator;
|
|
10
|
-
|
|
11
|
-
@ccclass('AndroidSDK')
|
|
12
|
-
export class AndroidSDK extends SDKBase {
|
|
13
|
-
|
|
14
|
-
private _loginResolve: ((value: [boolean, string] | PromiseLike<[boolean, string]>) => void) | null = null;
|
|
15
|
-
private _logoutResolve: ((value: SDKStatus | PromiseLike<SDKStatus>) => void) | null = null;
|
|
16
|
-
private _showAdResolve: ((value: SDKStatus | PromiseLike<SDKStatus>) => void) | null = null;
|
|
17
|
-
private _buyResolve: ((value: SDKStatus | PromiseLike<SDKStatus>) => void) | null = null;
|
|
18
|
-
|
|
19
|
-
initParam: SDKInitParam = {
|
|
20
|
-
gameId: '',
|
|
21
|
-
deviceId: '',
|
|
22
|
-
deviceOs: '',
|
|
23
|
-
region: '',
|
|
24
|
-
mac: '',
|
|
25
|
-
oaid: '',
|
|
26
|
-
idfa: '',
|
|
27
|
-
androidid: '',
|
|
28
|
-
ip: '',
|
|
29
|
-
gameRoleID: '',
|
|
30
|
-
userId: ''
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
//广告
|
|
34
|
-
// ads_id = "a68897c135273e"
|
|
35
|
-
// ads_key = "a3f3913b21437f71fe9c55b1656963ffd"
|
|
36
|
-
// ads_placement_id = "b68897c26d1c09"
|
|
37
|
-
// ads_scenario = "your scenario id"
|
|
38
|
-
ads_load_resolve: any = null
|
|
39
|
-
|
|
40
|
-
adsParam: AdsData;
|
|
41
|
-
adsCall: AdsCall;
|
|
42
|
-
|
|
43
|
-
init(): Promise<boolean> {
|
|
44
|
-
native.bridge.onNative = (func: string, param?: string | null): void => {
|
|
45
|
-
switch (func) {
|
|
46
|
-
case SDKEnum.Init:
|
|
47
|
-
console.log('初始化成功')
|
|
48
|
-
break;
|
|
49
|
-
case SDKEnum.Login:
|
|
50
|
-
break;
|
|
51
|
-
case SDKEnum.Logout:
|
|
52
|
-
this._logoutResolve?.(SDKStatus.success);
|
|
53
|
-
break;
|
|
54
|
-
case SDKEnum.DeviceInfo:
|
|
55
|
-
const data = JSON.parse(param);
|
|
56
|
-
this.initParam.deviceId = data._deviceId || "";
|
|
57
|
-
this.initParam.region = data._region || "";
|
|
58
|
-
this.initParam.mac = data._mac || "";
|
|
59
|
-
this.initParam.oaid = data._oaid || "";
|
|
60
|
-
this.initParam.idfa = data._idfa || "";
|
|
61
|
-
this.initParam.androidid = data._androidid || "";
|
|
62
|
-
this.initParam.ip = data._ip || "";
|
|
63
|
-
console.log(SDKEnum.DeviceInfo, param);
|
|
64
|
-
break;
|
|
65
|
-
case SDKEnum.LoginSuccess:
|
|
66
|
-
this._loginResolve?.([true, param]);
|
|
67
|
-
break;
|
|
68
|
-
case SDKEnum.LoginFailed:
|
|
69
|
-
break;
|
|
70
|
-
case SDKEnum.PseudoID:
|
|
71
|
-
this.initParam.deviceId = param;
|
|
72
|
-
break
|
|
73
|
-
case SDKEnum.Buy:
|
|
74
|
-
this._buyResolve?.(Number(param));
|
|
75
|
-
break;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
native.bridge.sendToNative(SDKEnum.DeviceInfo);
|
|
79
|
-
return new Promise<boolean>((resolve, reject) => {
|
|
80
|
-
assetManager.loadBundle('android', (error, bundle) => {
|
|
81
|
-
if (error) {
|
|
82
|
-
console.error('加载bundle android 失败', error)
|
|
83
|
-
resolve(false)
|
|
84
|
-
} else {
|
|
85
|
-
resolve(true)
|
|
86
|
-
}
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
public async login(data?: string): Promise<SDKLoginData> {
|
|
91
|
-
return new Promise<SDKLoginData>(async (resolve, reject) => {
|
|
92
|
-
if (this._loginResolve != null) {
|
|
93
|
-
this._loginResolve([false, "登录请求未完成"]);
|
|
94
|
-
}
|
|
95
|
-
let [success, code] = await new Promise<[boolean, string]>((resolve, reject) => {
|
|
96
|
-
this._loginResolve = resolve;
|
|
97
|
-
native.bridge.sendToNative(SDKEnum.Init, data);
|
|
98
|
-
});
|
|
99
|
-
this._loginResolve = null;
|
|
100
|
-
resolve({ success, code });
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
public async logout(): Promise<SDKStatus> {
|
|
104
|
-
const status = await new Promise<SDKStatus>((resolve) => {
|
|
105
|
-
native.bridge.sendToNative(SDKEnum.Logout);
|
|
106
|
-
this._logoutResolve = resolve;
|
|
107
|
-
});
|
|
108
|
-
this._logoutResolve = null;
|
|
109
|
-
return status;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
public async pay(param: SDKBuyParam): Promise<SDKStatus> {
|
|
113
|
-
// param.description = "安卓sdk"
|
|
114
|
-
// param.userId = this.initParam.userId
|
|
115
|
-
// param.gameRoleID = this.initParam.gameRoleID
|
|
116
|
-
const status = await new Promise<SDKStatus>((resolve) => {
|
|
117
|
-
native.bridge.sendToNative(SDKEnum.Buy, JSON.stringify(param));
|
|
118
|
-
this._buyResolve = resolve;
|
|
119
|
-
});
|
|
120
|
-
this._buyResolve = null;
|
|
121
|
-
return status;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
//#region 广告======================================
|
|
125
|
-
public initRewardedVideo(param: AdsData) {
|
|
126
|
-
this.adsParam = param;
|
|
127
|
-
ATSDK.initSDK(param.appId, param.appKey);
|
|
128
|
-
// ATSDK.setLogDebug(true);
|
|
129
|
-
// ATSDK.showDebuggerUI(this.ads_key);
|
|
130
|
-
//ATRewardedVideoSDK.setAdListener(this.RewardedVideoListener);
|
|
131
|
-
ATRewardedVideoAutoAdSDK.setAdListener(this.AutoRewardedVideoListener);
|
|
132
|
-
ATRewardedVideoAutoAdSDK.addPlacementIds([this.adsParam.adUnitId]);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
public showRewardedVideo(param: AdsCall) {
|
|
136
|
-
this.adsCall = param;
|
|
137
|
-
ATRewardedVideoAutoAdSDK.entryAdScenario(this.adsParam.adUnitId, "your scenario id")
|
|
138
|
-
if (ATRewardedVideoAutoAdSDK.hasAdReady(this.adsParam.adUnitId)) {
|
|
139
|
-
ATRewardedVideoAutoAdSDK.showAdInScenario(this.adsParam.adUnitId, "your scenario id");
|
|
140
|
-
} else {
|
|
141
|
-
param.error?.('视频没有准备好,请重试!')
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
private AutoRewardedVideoListener = {
|
|
146
|
-
onRewardedVideoAdLoaded: (placementId: any) => {
|
|
147
|
-
console.log("已加载", placementId)
|
|
148
|
-
this.ads_load_resolve?.(true)
|
|
149
|
-
},
|
|
150
|
-
onRewardedVideoAdFailed: (placementId: any, errorInfo: any) => {
|
|
151
|
-
this.ads_load_resolve?.(false)
|
|
152
|
-
console.log("加载失败", placementId, errorInfo)
|
|
153
|
-
this.adsCall?.error?.(errorInfo);
|
|
154
|
-
},
|
|
155
|
-
onRewardedVideoAdPlayStart: (placementId: any, callbackInfo: any) => {
|
|
156
|
-
console.log("开始播放", placementId, callbackInfo)
|
|
157
|
-
},
|
|
158
|
-
onRewardedVideoAdPlayEnd: (placementId: any, callbackInfo: any) => {
|
|
159
|
-
console.log("播放结束", placementId, callbackInfo)
|
|
160
|
-
this.adsCall?.show?.();
|
|
161
|
-
},
|
|
162
|
-
onRewardedVideoAdPlayFailed: (placementId: any, errorInfo: any, callbackInfo: any) => {
|
|
163
|
-
console.log("播放失败", placementId, callbackInfo, errorInfo)
|
|
164
|
-
this.adsCall?.fail?.(errorInfo);
|
|
165
|
-
},
|
|
166
|
-
onRewardedVideoAdClosed: (placementId: any, callbackInfo: any) => {
|
|
167
|
-
console.log("关闭视频", placementId, callbackInfo)
|
|
168
|
-
this.adsCall?.close?.();
|
|
169
|
-
},
|
|
170
|
-
onRewardedVideoAdPlayClicked: (placementId: any, callbackInfo: any) => {
|
|
171
|
-
console.log("点击视频", placementId)
|
|
172
|
-
this.adsCall?.click?.();
|
|
173
|
-
// this.adsStatus = AdsStatus.click;
|
|
174
|
-
},
|
|
175
|
-
onReward: (placementId: any, callbackInfo: any) => {
|
|
176
|
-
console.log("奖励", placementId, callbackInfo)
|
|
177
|
-
this.adsCall?.success?.();
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
public toPosition(node: Node): PositonData {
|
|
182
|
-
return null
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"ver":"4.0.24","importer":"typescript","imported":true,"uuid":"937d378e-b39e-4175-a7c6-52c526c9593b","files":[],"subMetas":{},"userData":{}}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import {ATAndroidBannerTS} from "./Android/ATAndroidBannerTS";
|
|
2
|
-
import {ATiOSBannerTS} from "./iOS/ATiOSBannerTS";
|
|
3
|
-
import {sys} from 'cc';
|
|
4
|
-
|
|
5
|
-
const initPlatformBridge = function () {
|
|
6
|
-
if (sys.os === sys.OS.IOS) {
|
|
7
|
-
return ATiOSBannerTS;
|
|
8
|
-
} else if (sys.os === sys.OS.ANDROID) {
|
|
9
|
-
return ATAndroidBannerTS;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const platformBridge = initPlatformBridge();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export const ATBannerSDK = {
|
|
17
|
-
kATBannerAdLoadingExtraBannerAdSizeStruct: "banner_ad_size_struct",
|
|
18
|
-
kATBannerAdShowingPositionTop: "top",
|
|
19
|
-
kATBannerAdShowingPositionBottom: "bottom",
|
|
20
|
-
|
|
21
|
-
kATBannerAdInlineAdaptiveWidth: "inline_adaptive_width",
|
|
22
|
-
kATBannerAdInlineAdaptiveOrientation: "inline_adaptive_orientation",
|
|
23
|
-
kATBannerAdInlineAdaptiveOrientationCurrent: 0,
|
|
24
|
-
kATBannerAdInlineAdaptiveOrientationPortrait: 1,
|
|
25
|
-
kATBannerAdInlineAdaptiveOrientationLandscape: 2,
|
|
26
|
-
|
|
27
|
-
kATBannerAdAdaptiveWidth: "adaptive_width",
|
|
28
|
-
kATBannerAdAdaptiveOrientation: "adaptive_orientation",
|
|
29
|
-
kATBannerAdAdaptiveOrientationCurrent: 0,
|
|
30
|
-
kATBannerAdAdaptiveOrientationPortrait: 1,
|
|
31
|
-
kATBannerAdAdaptiveOrientationLandscape: 2,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
ATBannerListener: {
|
|
35
|
-
developerCallback: null, onBannerAdLoaded: function (placementId: any) {
|
|
36
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdLoaded != null) {
|
|
37
|
-
this.developerCallback.onBannerAdLoaded(placementId);
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
onBannerAdLoadFail: function (placementId: any, errorInfo: any) {
|
|
42
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdLoadFail != null) {
|
|
43
|
-
this.developerCallback.onBannerAdLoadFail(placementId, errorInfo);
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
onBannerAdShow: function (placementId: any, callbackInfo: any) {
|
|
48
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdShow != null) {
|
|
49
|
-
this.developerCallback.onBannerAdShow(placementId, callbackInfo);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
|
|
53
|
-
onBannerAdClick: function (placementId: any, callbackInfo: any) {
|
|
54
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdClick != null) {
|
|
55
|
-
this.developerCallback.onBannerAdClick(placementId, callbackInfo);
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
|
|
59
|
-
onBannerAdAutoRefresh: function (placementId: any, callbackInfo: any) {
|
|
60
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdAutoRefresh != null) {
|
|
61
|
-
this.developerCallback.onBannerAdAutoRefresh(placementId, callbackInfo);
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
onBannerAdAutoRefreshFail: function (placementId: any, errorInfo: any) {
|
|
66
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdAutoRefreshFail != null) {
|
|
67
|
-
this.developerCallback.onBannerAdAutoRefreshFail(placementId, errorInfo);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
|
|
71
|
-
onBannerAdCloseButtonTapped: function (placementId: any, callbackInfo: any) {
|
|
72
|
-
if (this.developerCallback != null && this.developerCallback.onBannerAdCloseButtonTapped != null) {
|
|
73
|
-
this.developerCallback.onBannerAdCloseButtonTapped(placementId, callbackInfo);
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
//added v5.8.10
|
|
78
|
-
onAdSourceBiddingAttempt: function (placementId: any, callbackInfo: any) {
|
|
79
|
-
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingAttempt != null) {
|
|
80
|
-
this.developerCallback.onAdSourceBiddingAttempt(placementId, callbackInfo);
|
|
81
|
-
}
|
|
82
|
-
}, onAdSourceBiddingFilled: function (placementId: any, callbackInfo: any) {
|
|
83
|
-
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingFilled != null) {
|
|
84
|
-
this.developerCallback.onAdSourceBiddingFilled(placementId, callbackInfo);
|
|
85
|
-
}
|
|
86
|
-
}, onAdSourceBiddingFail: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
87
|
-
if (this.developerCallback != null && this.developerCallback.onAdSourceBiddingFail != null) {
|
|
88
|
-
this.developerCallback.onAdSourceBiddingFail(placementId, errorInfo, callbackInfo);
|
|
89
|
-
}
|
|
90
|
-
}, onAdSourceAttemp: function (placementId: any, callbackInfo: any) {
|
|
91
|
-
if (this.developerCallback != null && this.developerCallback.onAdSourceAttemp != null) {
|
|
92
|
-
this.developerCallback.onAdSourceAttemp(placementId, callbackInfo);
|
|
93
|
-
}
|
|
94
|
-
}, onAdSourceLoadFilled: function (placementId: any, callbackInfo: any) {
|
|
95
|
-
if (this.developerCallback != null && this.developerCallback.onAdSourceLoadFilled != null) {
|
|
96
|
-
this.developerCallback.onAdSourceLoadFilled(placementId, callbackInfo);
|
|
97
|
-
}
|
|
98
|
-
}, onAdSourceLoadFail: function (placementId: any, errorInfo: any, callbackInfo: any) {
|
|
99
|
-
if (this.developerCallback != null && this.developerCallback.onAdSourceLoadFail != null) {
|
|
100
|
-
this.developerCallback.onAdSourceLoadFail(placementId, errorInfo, callbackInfo);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
loadAd: function (placementId: any, settings = {}) {
|
|
107
|
-
if (undefined != platformBridge) {
|
|
108
|
-
if (settings.hasOwnProperty(ATBannerSDK.kATBannerAdLoadingExtraBannerAdSizeStruct)) {
|
|
109
|
-
const loadAdSize = settings[ATBannerSDK.kATBannerAdLoadingExtraBannerAdSizeStruct];
|
|
110
|
-
settings["width"] = loadAdSize["width"];
|
|
111
|
-
settings["height"] = loadAdSize["height"];
|
|
112
|
-
}
|
|
113
|
-
platformBridge.loadBanner(placementId, JSON.stringify(settings));
|
|
114
|
-
} else {
|
|
115
|
-
console.log("You must run on Android or iOS.");
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
setAdListener: function (listener: any) {
|
|
120
|
-
const eventJSON = {};
|
|
121
|
-
eventJSON[LoadedCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdLoaded",
|
|
122
|
-
eventJSON[LoadFailCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdLoadFail",
|
|
123
|
-
eventJSON[CloseCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdCloseButtonTapped",
|
|
124
|
-
eventJSON[ClickCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdClick",
|
|
125
|
-
eventJSON[ShowCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdShow",
|
|
126
|
-
eventJSON[RefreshCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdAutoRefresh",
|
|
127
|
-
eventJSON[RefreshFailCallbackKey] = "ATBannerSDK.ATBannerListener.onBannerAdAutoRefreshFail",
|
|
128
|
-
|
|
129
|
-
//added v5.8.10
|
|
130
|
-
eventJSON[BiddingAttempt] = "ATBannerSDK.ATBannerListener.onAdSourceBiddingAttempt",
|
|
131
|
-
eventJSON[BiddingFilled] = "ATBannerSDK.ATBannerListener.onAdSourceBiddingFilled",
|
|
132
|
-
eventJSON[BiddingFail] = "ATBannerSDK.ATBannerListener.onAdSourceBiddingFail",
|
|
133
|
-
eventJSON[Attemp] = "ATBannerSDK.ATBannerListener.onAdSourceAttemp",
|
|
134
|
-
eventJSON[LoadFilled] = "ATBannerSDK.ATBannerListener.onAdSourceLoadFilled",
|
|
135
|
-
eventJSON[LoadFail] = "ATBannerSDK.ATBannerListener.onAdSourceLoadFail"
|
|
136
|
-
|
|
137
|
-
if (undefined != platformBridge) {
|
|
138
|
-
platformBridge.setAdListener(JSON.stringify(eventJSON));
|
|
139
|
-
} else {
|
|
140
|
-
console.log("You must run on Android or iOS.");
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
this.ATBannerListener.developerCallback = listener;
|
|
144
|
-
},
|
|
145
|
-
|
|
146
|
-
hasAdReady: function (placementId: any) {
|
|
147
|
-
if (undefined != platformBridge) {
|
|
148
|
-
try {
|
|
149
|
-
return platformBridge.hasAdReady(placementId);
|
|
150
|
-
} catch (e) {
|
|
151
|
-
console.error("anythink hasAdReady: " + e.toString());
|
|
152
|
-
}
|
|
153
|
-
} else {
|
|
154
|
-
console.log("You must run on Android or iOS.");
|
|
155
|
-
}
|
|
156
|
-
return false;
|
|
157
|
-
},
|
|
158
|
-
|
|
159
|
-
checkAdStatus: function (placementId: any) {
|
|
160
|
-
if (undefined != platformBridge) {
|
|
161
|
-
return platformBridge.checkAdStatus(placementId);
|
|
162
|
-
} else {
|
|
163
|
-
console.log("You must run on Android or iOS.");
|
|
164
|
-
}
|
|
165
|
-
return "";
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
showAdInPosition: function (placementId: any, position: any) {
|
|
169
|
-
if (undefined != platformBridge) {
|
|
170
|
-
platformBridge.showAdInPosition(placementId, position);
|
|
171
|
-
} else {
|
|
172
|
-
console.log("You must run on Android or iOS.");
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
|
|
176
|
-
showAdInPositionAndScenario: function (placementId: any, position: any, scenario: any) {
|
|
177
|
-
if (undefined != platformBridge) {
|
|
178
|
-
platformBridge.showAdInPositionAndScenario(placementId, position, scenario);
|
|
179
|
-
} else {
|
|
180
|
-
console.log("You must run on Android or iOS.");
|
|
181
|
-
}
|
|
182
|
-
},
|
|
183
|
-
|
|
184
|
-
showAdInRectangle: function (placementId: any, showAdRect: any) {
|
|
185
|
-
if (undefined != platformBridge) {
|
|
186
|
-
platformBridge.showAdInRectangle(placementId, JSON.stringify(showAdRect));
|
|
187
|
-
} else {
|
|
188
|
-
console.log("You must run on Android or iOS.");
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
|
|
192
|
-
showAdInRectangleAndScenario: function (placementId: any, showAdRect: any, scenario: any) {
|
|
193
|
-
if (undefined != platformBridge) {
|
|
194
|
-
platformBridge.showAdInRectangleAndScenario(placementId, JSON.stringify(showAdRect), scenario);
|
|
195
|
-
} else {
|
|
196
|
-
console.log("You must run on Android or iOS.");
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
|
|
200
|
-
removeAd: function (placementId: any) {
|
|
201
|
-
if (undefined != platformBridge) {
|
|
202
|
-
platformBridge.removeAd(placementId);
|
|
203
|
-
} else {
|
|
204
|
-
console.log("You must run on Android or iOS.");
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
|
|
208
|
-
reShowAd: function (placementId: any) {
|
|
209
|
-
if (undefined != platformBridge) {
|
|
210
|
-
platformBridge.reShowAd(placementId);
|
|
211
|
-
} else {
|
|
212
|
-
console.log("You must run on Android or iOS.");
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
|
|
216
|
-
hideAd: function (placementId: any) {
|
|
217
|
-
if (undefined != platformBridge) {
|
|
218
|
-
platformBridge.hideAd(placementId);
|
|
219
|
-
} else {
|
|
220
|
-
console.log("You must run on Android or iOS.");
|
|
221
|
-
}
|
|
222
|
-
},
|
|
223
|
-
|
|
224
|
-
createLoadAdSize: function (width: any, height: any) {
|
|
225
|
-
const loadAdSize = {};
|
|
226
|
-
loadAdSize["width"] = width;
|
|
227
|
-
loadAdSize["height"] = height;
|
|
228
|
-
return loadAdSize;
|
|
229
|
-
},
|
|
230
|
-
|
|
231
|
-
createShowAdRect: function (x: any, y: any, width: any, height: any) {
|
|
232
|
-
const adRect = {};
|
|
233
|
-
adRect["x"] = x;
|
|
234
|
-
adRect["y"] = y;
|
|
235
|
-
adRect["width"] = width;
|
|
236
|
-
adRect["height"] = height;
|
|
237
|
-
return adRect;
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
entryAdScenario: function (placementId: any, scenario: any) {
|
|
241
|
-
if (undefined != platformBridge) {
|
|
242
|
-
platformBridge.entryAdScenario(placementId, scenario);
|
|
243
|
-
} else {
|
|
244
|
-
console.log("You must run on Android or iOS.");
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
};
|
|
250
|
-
|
|
251
|
-
const LoadedCallbackKey = "BannerLoaded";
|
|
252
|
-
const LoadFailCallbackKey = "BannerLoadFail";
|
|
253
|
-
const CloseCallbackKey = "BannerCloseButtonTapped";
|
|
254
|
-
const ClickCallbackKey = "BannerClick";
|
|
255
|
-
const ShowCallbackKey = "BannerShow";
|
|
256
|
-
const RefreshCallbackKey = "BannerRefresh";
|
|
257
|
-
const RefreshFailCallbackKey = "BannerRefreshFail";
|
|
258
|
-
|
|
259
|
-
const BiddingAttempt = "BannerBiddingAttempt";
|
|
260
|
-
const BiddingFilled = "BannerBiddingFilled";
|
|
261
|
-
const BiddingFail = "BannerBiddingFail";
|
|
262
|
-
const Attemp = "BannerAttemp";
|
|
263
|
-
const LoadFilled = "BannerLoadFilled";
|
|
264
|
-
const LoadFail = "BannerLoadFail";
|
|
265
|
-
|
|
266
|
-
window["ATBannerSDK"] = ATBannerSDK;
|