keytops-game-framework 1.0.0

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.
Files changed (151) hide show
  1. package/README.md +214 -0
  2. package/dist/app/base/RuntimeApplicationImpl.d.ts +22 -0
  3. package/dist/app/base/base.d.ts +113 -0
  4. package/dist/app/base/event/Event.d.ts +12 -0
  5. package/dist/app/base/event/EventDispatcher.d.ts +66 -0
  6. package/dist/app/base/pool/IRecoverable.d.ts +13 -0
  7. package/dist/app/base/pool/Pool.d.ts +45 -0
  8. package/dist/app/base/utils/Handler.d.ts +69 -0
  9. package/dist/app/base/utils/Injector.d.ts +19 -0
  10. package/dist/app/base/utils/Json.d.ts +14 -0
  11. package/dist/app/base/utils/MathUtils.d.ts +74 -0
  12. package/dist/app/base/utils/NativeUtils.d.ts +4 -0
  13. package/dist/app/base/utils/PromiseUtils.d.ts +20 -0
  14. package/dist/app/base/utils/StringUtils.d.ts +66 -0
  15. package/dist/app/module/abTesting/ABTesting.d.ts +41 -0
  16. package/dist/app/module/analytics/ALiAnalyticsSender.d.ts +59 -0
  17. package/dist/app/module/analytics/AnalyticsAble.d.ts +191 -0
  18. package/dist/app/module/analytics/AnalyticsAbleConst.d.ts +20 -0
  19. package/dist/app/module/analytics/BaseDimension.d.ts +19 -0
  20. package/dist/app/module/analytics/KeytopsAnalyticsSender.d.ts +67 -0
  21. package/dist/app/module/analytics/ad/ADAnalyticsAble.d.ts +19 -0
  22. package/dist/app/module/analytics/ad/ADBehaviorReporter.d.ts +90 -0
  23. package/dist/app/module/analytics/ad/AdDimension.d.ts +34 -0
  24. package/dist/app/module/analytics/index.d.ts +65 -0
  25. package/dist/app/module/analytics/launch/LaunchAnalyticsAble.d.ts +11 -0
  26. package/dist/app/module/analytics/level/GameDimension.d.ts +39 -0
  27. package/dist/app/module/analytics/level/LevelAnalyticsAble.d.ts +86 -0
  28. package/dist/app/module/analytics/level/LevelBehaviorReporter.d.ts +29 -0
  29. package/dist/app/module/analytics/level/LevelStatsDimension.d.ts +70 -0
  30. package/dist/app/module/analytics/level/PlayerAbilityDimension.d.ts +147 -0
  31. package/dist/app/module/analytics/session/SessionAnalyticsAble.d.ts +9 -0
  32. package/dist/app/module/analytics/session/SessionDimension.d.ts +48 -0
  33. package/dist/app/module/analytics/social/SocialAnalyticsAble.d.ts +14 -0
  34. package/dist/app/module/analytics/social/SocialDimension.d.ts +14 -0
  35. package/dist/app/module/bidding/Bidding.d.ts +37 -0
  36. package/dist/app/module/business/BusinessCenter.d.ts +33 -0
  37. package/dist/app/module/business/IBusiness.d.ts +6 -0
  38. package/dist/app/module/business/RewardVideoMaskBusiness.d.ts +18 -0
  39. package/dist/app/module/config/ConfigHelper.d.ts +142 -0
  40. package/dist/app/module/ecs/Component.d.ts +125 -0
  41. package/dist/app/module/ecs/ECS.d.ts +162 -0
  42. package/dist/app/module/ecs/ECSManager.d.ts +56 -0
  43. package/dist/app/module/ecs/Entity.d.ts +1 -0
  44. package/dist/app/module/ecs/Mask.d.ts +12 -0
  45. package/dist/app/module/ecs/System.d.ts +54 -0
  46. package/dist/app/module/fsm/Fsm.d.ts +44 -0
  47. package/dist/app/module/fsm/FsmBase.d.ts +28 -0
  48. package/dist/app/module/fsm/FsmManager.d.ts +67 -0
  49. package/dist/app/module/fsm/IFsm.d.ts +67 -0
  50. package/dist/app/module/fsm/IFsmState.d.ts +38 -0
  51. package/dist/app/module/logger/Logger.d.ts +58 -0
  52. package/dist/app/module/native/INativeHelper.d.ts +6 -0
  53. package/dist/app/module/native/NativeHelper.d.ts +10 -0
  54. package/dist/app/module/net/NetInterface.d.ts +22 -0
  55. package/dist/app/module/net/NetManager.d.ts +24 -0
  56. package/dist/app/module/net/byte/ByteView.d.ts +391 -0
  57. package/dist/app/module/net/http/HttpNode.d.ts +104 -0
  58. package/dist/app/module/net/http/HttpRequest.d.ts +104 -0
  59. package/dist/app/module/net/server/IServer.d.ts +20 -0
  60. package/dist/app/module/net/server/LevelOnlineConfig.d.ts +9 -0
  61. package/dist/app/module/net/server/Server.d.ts +105 -0
  62. package/dist/app/module/net/server/SystemOnlineConfig.d.ts +34 -0
  63. package/dist/app/module/net/socket/BaseProtocolHelper.d.ts +31 -0
  64. package/dist/app/module/net/socket/Socket.d.ts +145 -0
  65. package/dist/app/module/net/socket/SocketNode.d.ts +63 -0
  66. package/dist/app/module/publisher/IADAble.d.ts +46 -0
  67. package/dist/app/module/publisher/IAble.d.ts +6 -0
  68. package/dist/app/module/publisher/IDevice.d.ts +42 -0
  69. package/dist/app/module/publisher/IGameUpdateAble.d.ts +21 -0
  70. package/dist/app/module/publisher/ILoginAble.d.ts +38 -0
  71. package/dist/app/module/publisher/IPayAble.d.ts +11 -0
  72. package/dist/app/module/publisher/IPublisher.d.ts +154 -0
  73. package/dist/app/module/publisher/IPublisherManager.d.ts +69 -0
  74. package/dist/app/module/publisher/IRecordAble.d.ts +16 -0
  75. package/dist/app/module/publisher/IShareAble.d.ts +39 -0
  76. package/dist/app/module/publisher/PublisherManager.d.ts +106 -0
  77. package/dist/app/module/publisher/PublisherManagerImpl.d.ts +24 -0
  78. package/dist/app/module/publisher/ks/KSAd.d.ts +7 -0
  79. package/dist/app/module/publisher/ks/KSDevice.d.ts +8 -0
  80. package/dist/app/module/publisher/ks/KSLogin.d.ts +7 -0
  81. package/dist/app/module/publisher/ks/KSPublisher.d.ts +34 -0
  82. package/dist/app/module/publisher/ks/KSRecorder.d.ts +13 -0
  83. package/dist/app/module/publisher/ks/KSShare.d.ts +32 -0
  84. package/dist/app/module/publisher/my/MYAd.d.ts +13 -0
  85. package/dist/app/module/publisher/my/MYDevice.d.ts +7 -0
  86. package/dist/app/module/publisher/my/MYLogin.d.ts +6 -0
  87. package/dist/app/module/publisher/my/MYPublisher.d.ts +6 -0
  88. package/dist/app/module/publisher/native/NativeAd.d.ts +22 -0
  89. package/dist/app/module/publisher/native/NativeAnalyticsSender.d.ts +9 -0
  90. package/dist/app/module/publisher/native/NativeDevice.d.ts +6 -0
  91. package/dist/app/module/publisher/native/NativeLogin.d.ts +27 -0
  92. package/dist/app/module/publisher/native/NativePay.d.ts +6 -0
  93. package/dist/app/module/publisher/native/NativePublisher.d.ts +21 -0
  94. package/dist/app/module/publisher/native/NativeRecord.d.ts +10 -0
  95. package/dist/app/module/publisher/native/NativeShare.d.ts +23 -0
  96. package/dist/app/module/publisher/tk/TKAd.d.ts +14 -0
  97. package/dist/app/module/publisher/tk/TKAnalyticsSender.d.ts +7 -0
  98. package/dist/app/module/publisher/tk/TKDevice.d.ts +9 -0
  99. package/dist/app/module/publisher/tk/TKLogin.d.ts +5 -0
  100. package/dist/app/module/publisher/tk/TKPublisher.d.ts +34 -0
  101. package/dist/app/module/publisher/tt/TTAd.d.ts +14 -0
  102. package/dist/app/module/publisher/tt/TTAnalyticsSender.d.ts +7 -0
  103. package/dist/app/module/publisher/tt/TTDevice.d.ts +9 -0
  104. package/dist/app/module/publisher/tt/TTLogin.d.ts +6 -0
  105. package/dist/app/module/publisher/tt/TTPay.d.ts +4 -0
  106. package/dist/app/module/publisher/tt/TTPublisher.d.ts +34 -0
  107. package/dist/app/module/publisher/tt/TTRecorder.d.ts +11 -0
  108. package/dist/app/module/publisher/tt/TTShare.d.ts +50 -0
  109. package/dist/app/module/publisher/tt/TTUpdateGameAble.d.ts +7 -0
  110. package/dist/app/module/publisher/wx/WXAd.d.ts +14 -0
  111. package/dist/app/module/publisher/wx/WXAnalyticsSender.d.ts +7 -0
  112. package/dist/app/module/publisher/wx/WXDevice.d.ts +8 -0
  113. package/dist/app/module/publisher/wx/WXLogin.d.ts +9 -0
  114. package/dist/app/module/publisher/wx/WXPay.d.ts +4 -0
  115. package/dist/app/module/publisher/wx/WXPublisher.d.ts +33 -0
  116. package/dist/app/module/publisher/wx/WXShare.d.ts +56 -0
  117. package/dist/app/module/publisher/wx/WXUpdateGameAble.d.ts +7 -0
  118. package/dist/app/module/storage/Storage.d.ts +123 -0
  119. package/dist/app/module/storage/StorageImpl.d.ts +13 -0
  120. package/dist/app/module/structure/Dictionary.d.ts +48 -0
  121. package/dist/app/module/structure/Link.d.ts +149 -0
  122. package/dist/app/module/structure/List.d.ts +93 -0
  123. package/dist/app/module/task/Task.d.ts +33 -0
  124. package/dist/app/module/task/TaskQueue.d.ts +17 -0
  125. package/dist/app/module/task/TaskSequence.d.ts +19 -0
  126. package/dist/app/module/timer/ITimer.d.ts +4 -0
  127. package/dist/app/module/timer/Timer.d.ts +133 -0
  128. package/dist/app/module/timer/TimerImpl.d.ts +10 -0
  129. package/dist/app/module/utils/md5.d.ts +3 -0
  130. package/dist/app/module/view/IView.d.ts +94 -0
  131. package/dist/app/module/view/IViewLoader.d.ts +48 -0
  132. package/dist/app/module/view/ViewManager.d.ts +242 -0
  133. package/dist/audio/AudioManager.d.ts +146 -0
  134. package/dist/business/AudioBusiness.d.ts +11 -0
  135. package/dist/cocos.d.ts +1 -0
  136. package/dist/index.d.ts +146 -0
  137. package/dist/index.js +14981 -0
  138. package/dist/native/CocosNativeHelper.d.ts +12 -0
  139. package/dist/resource/ResourceManager.d.ts +187 -0
  140. package/dist/utils/Async.d.ts +28 -0
  141. package/dist/utils/CocosStorageUtils.d.ts +10 -0
  142. package/dist/utils/GeometryUtils.d.ts +31 -0
  143. package/dist/view/CCPViewLoader.d.ts +95 -0
  144. package/dist/view/CCSceneLoader.d.ts +25 -0
  145. package/dist/view/CocosViewManager.d.ts +12 -0
  146. package/dist/view/Scene.d.ts +35 -0
  147. package/dist/view/View.d.ts +151 -0
  148. package/dist/view/ViewControl.d.ts +106 -0
  149. package/dist/view/tips/TipsView.d.ts +12 -0
  150. package/dist/vitest.config.d.ts +2 -0
  151. package/package.json +33 -0
@@ -0,0 +1,22 @@
1
+ import { IADAble, ADConfig } from "../IADAble";
2
+ import { AdFrom } from "../../analytics/ad/ADBehaviorReporter";
3
+ export declare class NativeAd extends IADAble {
4
+ protected _className: string;
5
+ init(type: string, config: ADConfig): IADAble;
6
+ loadBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
7
+ protected _loadBanner(unitId: string, caller?: any, onSuccess?: Function, fail?: Function): void;
8
+ showBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
9
+ protected _showBanner(unitId: string, caller?: any, onSuccess?: Function, fail?: Function): void;
10
+ hideBanner(): Promise<void>;
11
+ /**
12
+ * 显示激励视频,失败后根据config尝试其他广告位。
13
+ * @param breakConfirm
14
+ * @param unitIdIndex
15
+ */
16
+ showRewardVideo(from: AdFrom, breakConfirm?: boolean, unitIdIndex?: number): Promise<boolean>;
17
+ protected _showRewardVideo(unitId: string, caller?: any, onSuccess?: Function, fail?: Function): void;
18
+ loadInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
19
+ protected _loadInterstitial(unitId: string, caller?: any, onSuccess?: Function, fail?: Function): void;
20
+ showInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
21
+ protected _showInterstitial(unitId: string, caller?: any, onSuccess?: Function, fail?: Function): void;
22
+ }
@@ -0,0 +1,9 @@
1
+ import { EmptyAnalyticsSender } from "../../analytics/index";
2
+ /**
3
+ * 原生平台事件上报器
4
+ */
5
+ export declare class NativeAnalyticsSender extends EmptyAnalyticsSender {
6
+ protected _className: string;
7
+ constructor(className?: string, exclude?: string[]);
8
+ send(eventName: string, data: object): Promise<void>;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { IDevice } from "../IDevice";
2
+ export declare class NativeDevice extends IDevice {
3
+ protected _className: string;
4
+ init(type: string): IDevice;
5
+ vibrate(long: boolean, style?: "heavy" | "medium" | "light"): void;
6
+ }
@@ -0,0 +1,27 @@
1
+ import { ILoginAble } from "../ILoginAble";
2
+ import { argType } from "../IPublisher";
3
+ export declare class NativeLogin extends ILoginAble {
4
+ protected _className: string;
5
+ init(type: string): ILoginAble;
6
+ isSupport(): boolean;
7
+ /**
8
+ * 登录平台
9
+ * @param caller 回调this
10
+ * @param onSuccess 成功回调
11
+ * @param onFail 失败回调
12
+ */
13
+ login(caller?: any, onSuccess?: Function, onFail?: Function): void;
14
+ /**
15
+ * 注销账号
16
+ */
17
+ logout(): void;
18
+ /**
19
+ * 登录成功的sessionID
20
+ */
21
+ get sessionID(): argType;
22
+ /**
23
+ * 登录成功的openID
24
+ */
25
+ get openID(): argType;
26
+ get userInfo(): any;
27
+ }
@@ -0,0 +1,6 @@
1
+ import { IPayAble } from "../IPayAble";
2
+ export declare class NativePay extends IPayAble {
3
+ protected _className: string;
4
+ init(type: string): IPayAble;
5
+ pay(money: number): void;
6
+ }
@@ -0,0 +1,21 @@
1
+ import { IPublisher, PublisherAppInfoStruct } from "../IPublisher";
2
+ export declare class NativePublisher extends IPublisher {
3
+ protected _className: string;
4
+ init(type: string, custom?: PublisherAppInfoStruct): IPublisher;
5
+ /**
6
+ * 初始化平台SDK
7
+ * @param caller 回调this
8
+ * @param onSuccess 成功回调
9
+ * @param onFail 失败回调
10
+ * @returns
11
+ */
12
+ initSDK(caller?: any, onSuccess?: Function, onFail?: Function): void;
13
+ /**
14
+ * 进入平台界面
15
+ */
16
+ showView(viewName: string, caller?: any, onClose?: Function): void;
17
+ /**
18
+ * 推出APP
19
+ */
20
+ exit(): void;
21
+ }
@@ -0,0 +1,10 @@
1
+ import { IRecordAble } from "../IRecordAble";
2
+ export declare class NativeRecorder extends IRecordAble {
3
+ protected _className: string;
4
+ init(type: string): IRecordAble;
5
+ startRecord(duration?: number, frameRate?: number): void;
6
+ stopRecord(): void;
7
+ pauseRecord(): void;
8
+ resumeRecord(): void;
9
+ get videoPath(): string;
10
+ }
@@ -0,0 +1,23 @@
1
+ import { AnalyticsData } from "../../analytics/index";
2
+ import { IShareAble, ShareParameters } from "../IShareAble";
3
+ export declare class NativeShare extends IShareAble {
4
+ protected _className: string;
5
+ init(type: string): IShareAble;
6
+ /**
7
+ * 分享图片或者文字
8
+ * @param analyticsName 玩法发起分享的动作来源,用于统计。
9
+ * @param data 分享参数,可以通过明确泛型确定不同平台的分享结构体,如:WXShareParameters
10
+ * @returns
11
+ */
12
+ shareTextOrImage<T extends ShareParameters>(analyticsName: string | {
13
+ name: string;
14
+ } & AnalyticsData, data: T): Promise<boolean>;
15
+ shareVideo(analyticsName: string | {
16
+ name: string;
17
+ } & AnalyticsData, data: string | {
18
+ [key: string]: any;
19
+ }): Promise<boolean>;
20
+ protected _share<T extends ShareParameters>(action: string, analyticsName: string | {
21
+ name: string;
22
+ } & AnalyticsData, data: T): Promise<boolean>;
23
+ }
@@ -0,0 +1,14 @@
1
+ import { IADAble, ADConfig } from "../IADAble";
2
+ import { AdFrom } from "../../analytics/ad/ADBehaviorReporter";
3
+ export declare class TKAd extends IADAble {
4
+ protected _tk: any;
5
+ private _tempBanner;
6
+ private _tempInterstitial;
7
+ init(type: string, config: ADConfig): IADAble;
8
+ loadBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
9
+ showBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
10
+ hideBanner(): Promise<void>;
11
+ showRewardVideo(from: AdFrom, breakConfirm?: boolean, unitIdIndex?: number): Promise<boolean>;
12
+ loadInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
13
+ showInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { EmptyAnalyticsSender } from "../../analytics/index";
2
+ /**
3
+ * TK事件上报器(window['tt'].reportAnalytics)
4
+ */
5
+ export declare class TKAnalyticsSender extends EmptyAnalyticsSender {
6
+ send(eventName: string, data: any): Promise<void>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { IDevice, DeviceInfo, HostInfo } from "../IDevice";
2
+ export declare class TKDevice extends IDevice {
3
+ protected _tk: any;
4
+ protected _systemInfo: any;
5
+ init(type: string): IDevice;
6
+ vibrate(long: boolean, style?: "heavy" | "medium" | "light"): void;
7
+ get deviceInfo(): DeviceInfo;
8
+ get hostInfo(): HostInfo;
9
+ }
@@ -0,0 +1,5 @@
1
+ import { ILoginAble } from "../ILoginAble";
2
+ import { TTLogin } from "../tt/TTLogin";
3
+ export declare class TKLogin extends TTLogin {
4
+ init(type: string): ILoginAble;
5
+ }
@@ -0,0 +1,34 @@
1
+ import { EnterOptionParser, IPublisher, PublisherAppInfoStruct } from "../IPublisher";
2
+ export declare class TKPublisher extends IPublisher {
3
+ protected _tk: any;
4
+ init(type: string, custom?: PublisherAppInfoStruct): IPublisher;
5
+ private _setAppInfo;
6
+ get appId(): string;
7
+ get appVersion(): string;
8
+ /**
9
+ * 当前版本是否为正式版
10
+ */
11
+ get isReleaseEnv(): boolean;
12
+ /**
13
+ * 当前版本是否为开发环境中
14
+ */
15
+ get isDevelopEnv(): boolean;
16
+ /**
17
+ * 当前版本是否为体验版
18
+ */
19
+ get isTrialEnv(): boolean;
20
+ /**
21
+ * 当前版本是否是处于灰色测试中
22
+ */
23
+ get isGrayEnv(): boolean;
24
+ protected _initEnterOptions(info?: any): EnterOptionParser;
25
+ showView(viewName: string, caller?: any, onClose?: Function): void;
26
+ subscribeMessage(subscribeMsgIds: string[]): Promise<boolean>;
27
+ onError(call: (...error: any[]) => void, caller?: any): void;
28
+ offError(call: (...error: any[]) => void, caller?: any): void;
29
+ onShow(call: (data?: any) => void, caller?: any): void;
30
+ offShow(call: () => void, caller?: any): void;
31
+ onHide(call: () => void, caller?: any): void;
32
+ offHide(call: () => void, caller?: any): void;
33
+ restart(): void;
34
+ }
@@ -0,0 +1,14 @@
1
+ import { IADAble, ADConfig } from "../IADAble";
2
+ import { AdFrom } from "../../analytics/ad/ADBehaviorReporter";
3
+ export declare class TTAd extends IADAble {
4
+ protected _tt: any;
5
+ private _tempBanner;
6
+ private _tempInterstitial;
7
+ init(type: string, config: ADConfig): IADAble;
8
+ loadBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
9
+ showBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
10
+ hideBanner(): Promise<void>;
11
+ showRewardVideo(from: AdFrom, breakConfirm?: boolean, unitIdIndex?: number): Promise<boolean>;
12
+ loadInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
13
+ showInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { EmptyAnalyticsSender } from "../../analytics/index";
2
+ /**
3
+ * 字节事件上报器(window['tt'].reportAnalytics)
4
+ */
5
+ export declare class TTAnalyticsSender extends EmptyAnalyticsSender {
6
+ send(eventName: string, data: any): Promise<void>;
7
+ }
@@ -0,0 +1,9 @@
1
+ import { IDevice, DeviceInfo, HostInfo } from "../IDevice";
2
+ export declare class TTDevice extends IDevice {
3
+ protected _tt: any;
4
+ protected _systemInfo: any;
5
+ init(type: string): IDevice;
6
+ vibrate(long: boolean, style?: "heavy" | "medium" | "light"): void;
7
+ get deviceInfo(): DeviceInfo;
8
+ get hostInfo(): HostInfo;
9
+ }
@@ -0,0 +1,6 @@
1
+ import { ILoginAble } from "../ILoginAble";
2
+ export declare class TTLogin extends ILoginAble {
3
+ protected _tt: any;
4
+ init(type: string): ILoginAble;
5
+ login(caller?: any, onSuccess?: () => void, onFail?: () => void): void;
6
+ }
@@ -0,0 +1,4 @@
1
+ import { IPayAble } from "../IPayAble";
2
+ export declare class TTPay extends IPayAble {
3
+ pay(money: number): void;
4
+ }
@@ -0,0 +1,34 @@
1
+ import { IPublisher, EnterOptionParser, PublisherAppInfoStruct } from "../IPublisher";
2
+ export declare class TTPublisher extends IPublisher {
3
+ protected _tt: any;
4
+ init(type: string, custom?: PublisherAppInfoStruct): IPublisher;
5
+ private _setAppInfo;
6
+ get appId(): string;
7
+ get appVersion(): string;
8
+ /**
9
+ * 当前版本是否为正式版
10
+ */
11
+ get isReleaseEnv(): boolean;
12
+ /**
13
+ * 当前版本是否为开发环境中
14
+ */
15
+ get isDevelopEnv(): boolean;
16
+ /**
17
+ * 当前版本是否为体验版
18
+ */
19
+ get isTrialEnv(): boolean;
20
+ /**
21
+ * 当前版本是否是处于灰色测试中
22
+ */
23
+ get isGrayEnv(): boolean;
24
+ protected _initEnterOptions(info?: any): EnterOptionParser;
25
+ showView(viewName: string, caller?: any, onClose?: Function): void;
26
+ subscribeMessage(subscribeMsgIds: string[]): Promise<boolean>;
27
+ onError(call: (...error: any[]) => void, caller?: any): void;
28
+ offError(call: (...error: any[]) => void, caller?: any): void;
29
+ onShow(call: (data?: any) => void, caller?: any): void;
30
+ offShow(call: () => void, caller?: any): void;
31
+ onHide(call: () => void, caller?: any): void;
32
+ offHide(call: () => void, caller?: any): void;
33
+ restart(): void;
34
+ }
@@ -0,0 +1,11 @@
1
+ import { IRecordAble } from "../IRecordAble";
2
+ export declare class TTRecorder extends IRecordAble {
3
+ protected _recorder: any;
4
+ protected _videoPath: string;
5
+ init(type: string): IRecordAble;
6
+ startRecord(duration?: number, frameRate?: number): void;
7
+ stopRecord(): void;
8
+ pauseRecord(): void;
9
+ resumeRecord(): void;
10
+ get videoPath(): string;
11
+ }
@@ -0,0 +1,50 @@
1
+ import { AnalyticsData } from "../../analytics/index";
2
+ import { argType } from "../IPublisher";
3
+ import { IShareAble } from "../IShareAble";
4
+ /**
5
+ * 头条分享参数,用于share.shareTextOrImage接口的泛型指定
6
+ *
7
+ * - 方式1:简介文字分享,直接传入字符串 ```"分享文本"```
8
+ * - 方式2:详细图文分享 ```{title: "标题", desc: "描述", imageUrl: "图片地址", query: "通过分享进入的启动参数"}```
9
+ * - 方式3:图文模板分享 ```{templateId:"通过审核的分享ID"}```
10
+ *
11
+ * tips:分享到好友增加参数:```channel:"invite"```
12
+ */
13
+ export type TTShareParameters = string | {
14
+ /**
15
+ * 拉起邀请面板分享游戏好友
16
+ */
17
+ channel?: "invite";
18
+ /**
19
+ * 转发标题,不传则默认使用当前小游戏的昵称。
20
+ */
21
+ title?: string;
22
+ /**
23
+ * 转发描述,不传则默认使用当前小游戏的昵称。
24
+ */
25
+ desc?: string;
26
+ /**
27
+ * 转发显示图片的链接,可以是网络图片路径或本地图片文件路径或相对代码包根目录的图片文件路径。显示图片长宽比是 5:4
28
+ */
29
+ imageUrl?: string;
30
+ /**
31
+ * 查询字符串,从这条转发消息进入后,可通过 publisher.publisher.enterOptions 获取启动参数中的 query。必须是 key1=val1&key2=val2 的格式。
32
+ */
33
+ query?: string;
34
+ /**
35
+ * 通过审核的分享ID
36
+ */
37
+ templateId?: string;
38
+ };
39
+ export declare class TTShare extends IShareAble {
40
+ protected _tt: any;
41
+ init(type: string): IShareAble;
42
+ shareTextOrImage(analyticsName: string | {
43
+ name: string;
44
+ } & AnalyticsData, data?: TTShareParameters): Promise<boolean>;
45
+ shareVideo(analyticsName: string | {
46
+ name: string;
47
+ } & AnalyticsData, data: {
48
+ [key: string]: argType;
49
+ }): Promise<boolean>;
50
+ }
@@ -0,0 +1,7 @@
1
+ import { IGameUpdateAble } from "../IGameUpdateAble";
2
+ /**
3
+ * 字节平台游戏更新。
4
+ */
5
+ export declare class TTGameUpdater extends IGameUpdateAble {
6
+ constructor();
7
+ }
@@ -0,0 +1,14 @@
1
+ import { IADAble, ADConfig } from "../IADAble";
2
+ import { AdFrom } from "../../analytics/ad/ADBehaviorReporter";
3
+ export declare class WXAd extends IADAble {
4
+ protected _wx: any;
5
+ protected _tempBanner: any;
6
+ protected _tempInterstitial: any;
7
+ init(type: string, config: ADConfig): IADAble;
8
+ loadBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
9
+ showBanner(from: AdFrom, unitIdIndex?: number): Promise<void>;
10
+ hideBanner(): Promise<void>;
11
+ loadInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
12
+ showInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
13
+ showRewardVideo(from: AdFrom, breakConfirm?: boolean, unitIdIndex?: number): Promise<boolean>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import { EmptyAnalyticsSender } from "../../analytics/index";
2
+ /**
3
+ * 微信事件上报器(window['wx'].reportEvent)
4
+ */
5
+ export declare class WXAnalyticsSender extends EmptyAnalyticsSender {
6
+ send(eventName: string, data: any): Promise<void>;
7
+ }
@@ -0,0 +1,8 @@
1
+ import { IDevice, DeviceInfo, HostInfo } from "../IDevice";
2
+ export declare class WXDevice extends IDevice {
3
+ protected _wx: any;
4
+ init(type: string): IDevice;
5
+ vibrate(long: boolean, style?: "heavy" | "medium" | "light"): void;
6
+ get deviceInfo(): DeviceInfo;
7
+ get hostInfo(): HostInfo;
8
+ }
@@ -0,0 +1,9 @@
1
+ import { ILoginAble } from "../ILoginAble";
2
+ /**
3
+ * 微信登录
4
+ */
5
+ export declare class WXLogin extends ILoginAble {
6
+ private _wx;
7
+ init(type: string): ILoginAble;
8
+ login(caller?: any, onSuccess?: () => void, onFail?: () => void): void;
9
+ }
@@ -0,0 +1,4 @@
1
+ import { IPayAble } from "../IPayAble";
2
+ export declare class WXPay extends IPayAble {
3
+ pay(money: number): void;
4
+ }
@@ -0,0 +1,33 @@
1
+ import { IPublisher, EnterOptionParser, PublisherAppInfoStruct } from "../IPublisher";
2
+ export declare class WXPublisher extends IPublisher {
3
+ protected _wx: any;
4
+ init(type: string, custom?: PublisherAppInfoStruct): IPublisher;
5
+ get appVersion(): string;
6
+ get appId(): string;
7
+ private _setAppInfo;
8
+ /**
9
+ * 当前版本是否为正式版
10
+ */
11
+ get isReleaseEnv(): boolean;
12
+ /**
13
+ * 当前版本是否为开发环境中
14
+ */
15
+ get isDevelopEnv(): boolean;
16
+ /**
17
+ * 当前版本是否为体验版
18
+ */
19
+ get isTrialEnv(): boolean;
20
+ /**
21
+ * 当前版本是否是处于灰色测试中
22
+ */
23
+ get isGrayEnv(): boolean;
24
+ protected _initEnterOptions(info: any): EnterOptionParser;
25
+ subscribeMessage(subscribeMsgIds: string[]): Promise<boolean>;
26
+ onError(call: (...error: any[]) => void, caller?: any): void;
27
+ offError(call: (...error: any[]) => void, caller?: any): void;
28
+ onShow(call: (data?: any) => void, caller?: any): void;
29
+ offShow(call: () => void, caller?: any): void;
30
+ onHide(call: () => void, caller?: any): void;
31
+ offHide(call: () => void, caller?: any): void;
32
+ restart(): void;
33
+ }
@@ -0,0 +1,56 @@
1
+ import { AnalyticsData } from "../../analytics/index";
2
+ import { argType } from "../IPublisher";
3
+ import { IShareAble } from "../IShareAble";
4
+ /**
5
+ * 微信分享参数,用于share.shareTextOrImage接口的泛型指定
6
+ *
7
+ * - 方式1:简介文字分享,直接传入字符串 ```"分享文本"```
8
+ * - 方式2:详细图文分享 ```{title: "标题", desc: "描述", imageUrl: "网络图片路径或本地图片文件路径", query: "通过分享进入的启动参数"}```
9
+ * - 方式3:图片id分享 ```{imageUrlId:"通过 MP 系统审核的图片编号", imageUrl:"通过 MP 系统审核的图片地址"}```
10
+ */
11
+ export type WXShareParameters = string | {
12
+ /**
13
+ * 转发标题,不传则默认使用当前小游戏的昵称。
14
+ */
15
+ title?: string;
16
+ /**
17
+ * 转发显示图片的链接,可以是网络图片路径或本地图片文件路径或相对代码包根目录的图片文件路径。显示图片长宽比是 5:4
18
+ */
19
+ imageUrl?: string;
20
+ /**
21
+ * 查询字符串,从这条转发消息进入后,可通过 publisher.publisher.enterOptions 获取启动参数中的 query。必须是 key1=val1&key2=val2 的格式。
22
+ */
23
+ query?: string;
24
+ /**
25
+ * 通过 MP 系统审核的图片编号
26
+ */
27
+ imageUrlId?: string;
28
+ /**
29
+ * 是否转发到当前群。该参数只对从群工具栏打开的场景下生效,默认转发到当前群,填入false时可转发到其他会话。
30
+ */
31
+ toCurrentGroup?: boolean;
32
+ /**
33
+ * 独立分包路径。
34
+ */
35
+ path?: string;
36
+ /**
37
+ * 分享行为的最短时长(s)
38
+ */
39
+ durationMin?: number;
40
+ /**
41
+ * 分享行为的最长时长(s)
42
+ */
43
+ durationMax?: number;
44
+ };
45
+ export declare class WXShare extends IShareAble {
46
+ protected _wx: any;
47
+ init(type: string): IShareAble;
48
+ shareTextOrImage(analyticsName: string | {
49
+ name: string;
50
+ } & AnalyticsData, data?: WXShareParameters): Promise<boolean>;
51
+ shareVideo(analyticsName: string | {
52
+ name: string;
53
+ } & AnalyticsData, data: string | {
54
+ [key: string]: argType;
55
+ }): Promise<boolean>;
56
+ }
@@ -0,0 +1,7 @@
1
+ import { IGameUpdateAble } from "../IGameUpdateAble";
2
+ /**
3
+ * wx平台游戏更新。
4
+ */
5
+ export declare class WXGameUpdater extends IGameUpdateAble {
6
+ constructor();
7
+ }
@@ -0,0 +1,123 @@
1
+ export interface IStorage {
2
+ setValue(key: string, value: string | number | boolean | null | undefined): void;
3
+ getValue(key: string): string;
4
+ removeValue(key: string): void;
5
+ clear(): void;
6
+ }
7
+ /**
8
+ * 内存本地存储,数据不会永久保存
9
+ */
10
+ export declare class MemeryStorage implements IStorage {
11
+ private _data;
12
+ setValue(key: string, value: string | number | boolean | null | undefined): void;
13
+ getValue(key: string): string;
14
+ removeValue(key: string): void;
15
+ clear(): void;
16
+ }
17
+ /**
18
+ * 本地持久化工具
19
+ * 1. 区分全局和用户数据
20
+ * 2. 数据缓存,减少io
21
+ */
22
+ export declare class Storage {
23
+ static KEY: string;
24
+ private static created;
25
+ private _cacheEnable;
26
+ private _cacheCD;
27
+ private _cacheStore;
28
+ constructor();
29
+ /**
30
+ * 设置缓存策略
31
+ * @param enable 是否高速缓存
32
+ * @param cd 缓存cd, 单位毫秒, 默认为30秒(30000)
33
+ * @returns
34
+ */
35
+ setCache(enable: boolean, cd?: number): void;
36
+ private _userId;
37
+ /**
38
+ * 当前平台用户ID
39
+ */
40
+ set userId(userId: string);
41
+ /**
42
+ * 当前平台用户ID
43
+ */
44
+ get userId(): string;
45
+ /**
46
+ * 获取当前用户的音效声音大小
47
+ */
48
+ get effectsVolume(): number;
49
+ /**
50
+ * 设置当前用户的音效声音大小
51
+ */
52
+ set effectsVolume(value: number);
53
+ /**
54
+ * 获取当前用户的背景音乐声音大小
55
+ */
56
+ get musicVolume(): number;
57
+ /**
58
+ * 设置当前用户的背景音乐声音大小
59
+ */
60
+ set musicVolume(value: number);
61
+ /**
62
+ * 登录天数
63
+ */
64
+ get loginDays(): number;
65
+ /**
66
+ * 最后登录时间
67
+ */
68
+ get lastLoginTime(): number;
69
+ /**
70
+ * 获取当前用户的值
71
+ * @param key
72
+ * @param defaultValue
73
+ * @returns
74
+ */
75
+ getUValue<T extends string | number | boolean | null | undefined | object>(key: string, defaultValue?: T): T;
76
+ /**
77
+ * 设置当前用户的值
78
+ * @param key
79
+ * @param value
80
+ */
81
+ setUValue(key: string, value: string | number | boolean | null | undefined | object): void;
82
+ /**
83
+ * 删除当前用户的值
84
+ * @param key
85
+ */
86
+ removeUValue(key: string): void;
87
+ /**
88
+ * 获取全局值
89
+ * @param key
90
+ * @param defaultValue
91
+ * @returns
92
+ */
93
+ getGValue<T extends string | number | boolean | null | undefined | object>(key: string, defaultValue?: T): T;
94
+ /**
95
+ * 设置全局值
96
+ * @param key
97
+ * @param value
98
+ */
99
+ setGValue(key: string, value: string | number | boolean | null | undefined | object): void;
100
+ /**
101
+ * 删除全局值
102
+ * @param key
103
+ */
104
+ removeGValue(key: string): void;
105
+ /**
106
+ * 清理所有缓存
107
+ */
108
+ clear(): void;
109
+ private _getUserKey;
110
+ private _setValue;
111
+ private _internalSetValue;
112
+ private _flushCache;
113
+ private _cleanCache;
114
+ private _getValue;
115
+ private _internalGetValue;
116
+ private _removeValue;
117
+ private _impl;
118
+ private get impl();
119
+ }
120
+ /**
121
+ * 本地记录
122
+ */
123
+ export declare const storage: Storage;
@@ -0,0 +1,13 @@
1
+ import { IStorage } from "./Storage";
2
+ /**
3
+ * 通用本地持久化实现。
4
+ * 优先使用 localStorage,不可用时退化为内存存储。
5
+ */
6
+ export declare class StorageImpl implements IStorage {
7
+ private static _memory;
8
+ private get store();
9
+ removeValue(key: string): void;
10
+ setValue(key: string, value: string | number | boolean): void;
11
+ getValue<T>(key: string): T;
12
+ clear(): void;
13
+ }