@cc-component/cc-ex-component 1.1.4 → 1.1.6

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.
@@ -6,6 +6,8 @@ declare global {
6
6
  /**小游戏:按钮触摸 需要在按钮onTouchEnd中调用的方法 使用这个属性*/
7
7
  const buttonTouch: ButtonTouch;
8
8
  //#region 通用==============
9
+ /**模块初始化 */
10
+ export function Init(): Promise<void>
9
11
  /**登录 */
10
12
  export function Login(data?: string): Promise<SDKLoginData>
11
13
  /**退出登录 */
@@ -5,6 +5,7 @@ import { native } from 'cc';
5
5
  import { sys } from 'cc';
6
6
  import { ATRewardedVideoAutoAdSDK } from './AnyThinkAds/ATRewardedAutoVideo';
7
7
  import { ATSDK } from './AnyThinkAds/ATSDK';
8
+ import { assetManager } from 'cc';
8
9
  const { ccclass, property } = _decorator;
9
10
 
10
11
  @ccclass('AndroidSDK')
@@ -39,8 +40,7 @@ export class AndroidSDK extends SDKBase {
39
40
  adsParam: AdsData;
40
41
  adsCall: AdsCall;
41
42
 
42
- init(): Promise<void> {
43
- if (sys.platform !== sys.Platform.ANDROID) { return }
43
+ init(): Promise<boolean> {
44
44
  native.bridge.onNative = (func: string, param?: string | null): void => {
45
45
  switch (func) {
46
46
  case SDKEnum.Init:
@@ -76,6 +76,17 @@ export class AndroidSDK extends SDKBase {
76
76
  }
77
77
  }
78
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(true)
84
+
85
+ } else {
86
+ resolve(true)
87
+ }
88
+ })
89
+ })
79
90
  }
80
91
  public async login(data?: string): Promise<SDKLoginData> {
81
92
  return new Promise<SDKLoginData>(async (resolve, reject) => {
@@ -1,29 +1,30 @@
1
1
  import { _decorator, Component, Node } from 'cc';
2
2
  import { SDKBase } from './SDKBase';
3
- import { SDKLoginData, SDKStatus } from './SDKEnum';
3
+ import { AdsCall, AdsData, PositonData, SDKLoginData, SDKStatus } from './SDKEnum';
4
4
  const { ccclass, property } = _decorator;
5
5
 
6
6
  @ccclass('EditorSDK')
7
7
  export class EditorSDK extends SDKBase {
8
- init(): Promise<void> {
9
- return null
8
+ init(): Promise<boolean> {
9
+ return Promise.resolve(true);
10
10
  }
11
11
  public login(data?: string): Promise<SDKLoginData> {
12
- return null
12
+ return Promise.resolve({ success: true, code: '200' });
13
13
  }
14
14
  public logout(): Promise<SDKStatus> {
15
- return null
15
+ return Promise.resolve(SDKStatus.success);
16
16
  }
17
- public buyAction(param: any): Promise<SDKStatus> {
18
- return null
17
+ public initRewardedVideo(param: AdsData) {
18
+
19
19
  }
20
- public initAds() {
21
- return null
20
+ public showRewardedVideo(param: AdsCall) {
21
+ param.success?.();
22
22
  }
23
- public showAds(): Promise<SDKStatus> {
24
- return null
23
+ public toPosition(node: Node): PositonData {
24
+ return { x: 0, y: 0, width: 0, height: 0 };
25
25
  }
26
26
 
27
+
27
28
  }
28
29
 
29
30
 
@@ -26,8 +26,7 @@ export class PlatfprmModule {
26
26
  wx_button_subscribe: false
27
27
  };
28
28
 
29
-
30
- Init(): Promise<void> {
29
+ Init(): Promise<boolean> {
31
30
  switch (sys.platform) {
32
31
  case sys.Platform.BYTEDANCE_MINI_GAME:
33
32
  this.sdk = new TTSDK();
@@ -13,7 +13,7 @@ export abstract class SDKBase {
13
13
 
14
14
  protected _userInfo?: any;
15
15
  public get userInfo() { return this._userInfo; }
16
- abstract init(): Promise<void>;
16
+ abstract init(): Promise<boolean>;
17
17
  /**登录 */
18
18
  public abstract login(data?: string): Promise<SDKLoginData>;
19
19
  /**登出 */
@@ -9,7 +9,7 @@ export class TTSDK extends SDKBase {
9
9
  videoAdsLoadResolve: any = null
10
10
  adsCall: AdsCall;
11
11
  sidebarCall: Function;
12
- init(): Promise<void> {
12
+ init(): Promise<boolean> {
13
13
  const windowInfo = tt.getSystemInfoSync();
14
14
  var options = tt.getLaunchOptionsSync();
15
15
  const scene: string = options.scene;
@@ -8,7 +8,7 @@ const { ccclass, property } = _decorator;
8
8
  export class WXSDK extends SDKBase {
9
9
  adsCall: AdsCall;
10
10
 
11
- init(): Promise<void> {
11
+ init(): Promise<boolean> {
12
12
  wx.onShow((res: any) => {
13
13
 
14
14
  });
package/index.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  // 负责导出assets下的模块,如: export { default } from './assets/xxx.ts'
2
- export { } from './assets/ex/BaseEx';
2
+ export { } from './assets/ex/ExCommon';
3
3
  export { } from './assets/video/Interface';
4
- export { ReferenceCollector } from './assets/core/ReferenceCollector';
5
-
6
4
  export { } from './assets/platform/Interface';
5
+ export { ReferenceCollector } from './assets/core/ReferenceCollector';
7
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-ex-component",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",
File without changes
File without changes