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.
- package/README.md +214 -0
- package/dist/app/base/RuntimeApplicationImpl.d.ts +22 -0
- package/dist/app/base/base.d.ts +113 -0
- package/dist/app/base/event/Event.d.ts +12 -0
- package/dist/app/base/event/EventDispatcher.d.ts +66 -0
- package/dist/app/base/pool/IRecoverable.d.ts +13 -0
- package/dist/app/base/pool/Pool.d.ts +45 -0
- package/dist/app/base/utils/Handler.d.ts +69 -0
- package/dist/app/base/utils/Injector.d.ts +19 -0
- package/dist/app/base/utils/Json.d.ts +14 -0
- package/dist/app/base/utils/MathUtils.d.ts +74 -0
- package/dist/app/base/utils/NativeUtils.d.ts +4 -0
- package/dist/app/base/utils/PromiseUtils.d.ts +20 -0
- package/dist/app/base/utils/StringUtils.d.ts +66 -0
- package/dist/app/module/abTesting/ABTesting.d.ts +41 -0
- package/dist/app/module/analytics/ALiAnalyticsSender.d.ts +59 -0
- package/dist/app/module/analytics/AnalyticsAble.d.ts +191 -0
- package/dist/app/module/analytics/AnalyticsAbleConst.d.ts +20 -0
- package/dist/app/module/analytics/BaseDimension.d.ts +19 -0
- package/dist/app/module/analytics/KeytopsAnalyticsSender.d.ts +67 -0
- package/dist/app/module/analytics/ad/ADAnalyticsAble.d.ts +19 -0
- package/dist/app/module/analytics/ad/ADBehaviorReporter.d.ts +90 -0
- package/dist/app/module/analytics/ad/AdDimension.d.ts +34 -0
- package/dist/app/module/analytics/index.d.ts +65 -0
- package/dist/app/module/analytics/launch/LaunchAnalyticsAble.d.ts +11 -0
- package/dist/app/module/analytics/level/GameDimension.d.ts +39 -0
- package/dist/app/module/analytics/level/LevelAnalyticsAble.d.ts +86 -0
- package/dist/app/module/analytics/level/LevelBehaviorReporter.d.ts +29 -0
- package/dist/app/module/analytics/level/LevelStatsDimension.d.ts +70 -0
- package/dist/app/module/analytics/level/PlayerAbilityDimension.d.ts +147 -0
- package/dist/app/module/analytics/session/SessionAnalyticsAble.d.ts +9 -0
- package/dist/app/module/analytics/session/SessionDimension.d.ts +48 -0
- package/dist/app/module/analytics/social/SocialAnalyticsAble.d.ts +14 -0
- package/dist/app/module/analytics/social/SocialDimension.d.ts +14 -0
- package/dist/app/module/bidding/Bidding.d.ts +37 -0
- package/dist/app/module/business/BusinessCenter.d.ts +33 -0
- package/dist/app/module/business/IBusiness.d.ts +6 -0
- package/dist/app/module/business/RewardVideoMaskBusiness.d.ts +18 -0
- package/dist/app/module/config/ConfigHelper.d.ts +142 -0
- package/dist/app/module/ecs/Component.d.ts +125 -0
- package/dist/app/module/ecs/ECS.d.ts +162 -0
- package/dist/app/module/ecs/ECSManager.d.ts +56 -0
- package/dist/app/module/ecs/Entity.d.ts +1 -0
- package/dist/app/module/ecs/Mask.d.ts +12 -0
- package/dist/app/module/ecs/System.d.ts +54 -0
- package/dist/app/module/fsm/Fsm.d.ts +44 -0
- package/dist/app/module/fsm/FsmBase.d.ts +28 -0
- package/dist/app/module/fsm/FsmManager.d.ts +67 -0
- package/dist/app/module/fsm/IFsm.d.ts +67 -0
- package/dist/app/module/fsm/IFsmState.d.ts +38 -0
- package/dist/app/module/logger/Logger.d.ts +58 -0
- package/dist/app/module/native/INativeHelper.d.ts +6 -0
- package/dist/app/module/native/NativeHelper.d.ts +10 -0
- package/dist/app/module/net/NetInterface.d.ts +22 -0
- package/dist/app/module/net/NetManager.d.ts +24 -0
- package/dist/app/module/net/byte/ByteView.d.ts +391 -0
- package/dist/app/module/net/http/HttpNode.d.ts +104 -0
- package/dist/app/module/net/http/HttpRequest.d.ts +104 -0
- package/dist/app/module/net/server/IServer.d.ts +20 -0
- package/dist/app/module/net/server/LevelOnlineConfig.d.ts +9 -0
- package/dist/app/module/net/server/Server.d.ts +105 -0
- package/dist/app/module/net/server/SystemOnlineConfig.d.ts +34 -0
- package/dist/app/module/net/socket/BaseProtocolHelper.d.ts +31 -0
- package/dist/app/module/net/socket/Socket.d.ts +145 -0
- package/dist/app/module/net/socket/SocketNode.d.ts +63 -0
- package/dist/app/module/publisher/IADAble.d.ts +46 -0
- package/dist/app/module/publisher/IAble.d.ts +6 -0
- package/dist/app/module/publisher/IDevice.d.ts +42 -0
- package/dist/app/module/publisher/IGameUpdateAble.d.ts +21 -0
- package/dist/app/module/publisher/ILoginAble.d.ts +38 -0
- package/dist/app/module/publisher/IPayAble.d.ts +11 -0
- package/dist/app/module/publisher/IPublisher.d.ts +154 -0
- package/dist/app/module/publisher/IPublisherManager.d.ts +69 -0
- package/dist/app/module/publisher/IRecordAble.d.ts +16 -0
- package/dist/app/module/publisher/IShareAble.d.ts +39 -0
- package/dist/app/module/publisher/PublisherManager.d.ts +106 -0
- package/dist/app/module/publisher/PublisherManagerImpl.d.ts +24 -0
- package/dist/app/module/publisher/ks/KSAd.d.ts +7 -0
- package/dist/app/module/publisher/ks/KSDevice.d.ts +8 -0
- package/dist/app/module/publisher/ks/KSLogin.d.ts +7 -0
- package/dist/app/module/publisher/ks/KSPublisher.d.ts +34 -0
- package/dist/app/module/publisher/ks/KSRecorder.d.ts +13 -0
- package/dist/app/module/publisher/ks/KSShare.d.ts +32 -0
- package/dist/app/module/publisher/my/MYAd.d.ts +13 -0
- package/dist/app/module/publisher/my/MYDevice.d.ts +7 -0
- package/dist/app/module/publisher/my/MYLogin.d.ts +6 -0
- package/dist/app/module/publisher/my/MYPublisher.d.ts +6 -0
- package/dist/app/module/publisher/native/NativeAd.d.ts +22 -0
- package/dist/app/module/publisher/native/NativeAnalyticsSender.d.ts +9 -0
- package/dist/app/module/publisher/native/NativeDevice.d.ts +6 -0
- package/dist/app/module/publisher/native/NativeLogin.d.ts +27 -0
- package/dist/app/module/publisher/native/NativePay.d.ts +6 -0
- package/dist/app/module/publisher/native/NativePublisher.d.ts +21 -0
- package/dist/app/module/publisher/native/NativeRecord.d.ts +10 -0
- package/dist/app/module/publisher/native/NativeShare.d.ts +23 -0
- package/dist/app/module/publisher/tk/TKAd.d.ts +14 -0
- package/dist/app/module/publisher/tk/TKAnalyticsSender.d.ts +7 -0
- package/dist/app/module/publisher/tk/TKDevice.d.ts +9 -0
- package/dist/app/module/publisher/tk/TKLogin.d.ts +5 -0
- package/dist/app/module/publisher/tk/TKPublisher.d.ts +34 -0
- package/dist/app/module/publisher/tt/TTAd.d.ts +14 -0
- package/dist/app/module/publisher/tt/TTAnalyticsSender.d.ts +7 -0
- package/dist/app/module/publisher/tt/TTDevice.d.ts +9 -0
- package/dist/app/module/publisher/tt/TTLogin.d.ts +6 -0
- package/dist/app/module/publisher/tt/TTPay.d.ts +4 -0
- package/dist/app/module/publisher/tt/TTPublisher.d.ts +34 -0
- package/dist/app/module/publisher/tt/TTRecorder.d.ts +11 -0
- package/dist/app/module/publisher/tt/TTShare.d.ts +50 -0
- package/dist/app/module/publisher/tt/TTUpdateGameAble.d.ts +7 -0
- package/dist/app/module/publisher/wx/WXAd.d.ts +14 -0
- package/dist/app/module/publisher/wx/WXAnalyticsSender.d.ts +7 -0
- package/dist/app/module/publisher/wx/WXDevice.d.ts +8 -0
- package/dist/app/module/publisher/wx/WXLogin.d.ts +9 -0
- package/dist/app/module/publisher/wx/WXPay.d.ts +4 -0
- package/dist/app/module/publisher/wx/WXPublisher.d.ts +33 -0
- package/dist/app/module/publisher/wx/WXShare.d.ts +56 -0
- package/dist/app/module/publisher/wx/WXUpdateGameAble.d.ts +7 -0
- package/dist/app/module/storage/Storage.d.ts +123 -0
- package/dist/app/module/storage/StorageImpl.d.ts +13 -0
- package/dist/app/module/structure/Dictionary.d.ts +48 -0
- package/dist/app/module/structure/Link.d.ts +149 -0
- package/dist/app/module/structure/List.d.ts +93 -0
- package/dist/app/module/task/Task.d.ts +33 -0
- package/dist/app/module/task/TaskQueue.d.ts +17 -0
- package/dist/app/module/task/TaskSequence.d.ts +19 -0
- package/dist/app/module/timer/ITimer.d.ts +4 -0
- package/dist/app/module/timer/Timer.d.ts +133 -0
- package/dist/app/module/timer/TimerImpl.d.ts +10 -0
- package/dist/app/module/utils/md5.d.ts +3 -0
- package/dist/app/module/view/IView.d.ts +94 -0
- package/dist/app/module/view/IViewLoader.d.ts +48 -0
- package/dist/app/module/view/ViewManager.d.ts +242 -0
- package/dist/audio/AudioManager.d.ts +146 -0
- package/dist/business/AudioBusiness.d.ts +11 -0
- package/dist/cocos.d.ts +1 -0
- package/dist/index.d.ts +146 -0
- package/dist/index.js +14981 -0
- package/dist/native/CocosNativeHelper.d.ts +12 -0
- package/dist/resource/ResourceManager.d.ts +187 -0
- package/dist/utils/Async.d.ts +28 -0
- package/dist/utils/CocosStorageUtils.d.ts +10 -0
- package/dist/utils/GeometryUtils.d.ts +31 -0
- package/dist/view/CCPViewLoader.d.ts +95 -0
- package/dist/view/CCSceneLoader.d.ts +25 -0
- package/dist/view/CocosViewManager.d.ts +12 -0
- package/dist/view/Scene.d.ts +35 -0
- package/dist/view/View.d.ts +151 -0
- package/dist/view/ViewControl.d.ts +106 -0
- package/dist/view/tips/TipsView.d.ts +12 -0
- package/dist/vitest.config.d.ts +2 -0
- package/package.json +33 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type DeviceInfo = {
|
|
2
|
+
/**操作系统版本 */
|
|
3
|
+
system: string;
|
|
4
|
+
/**操作系统类型 */
|
|
5
|
+
platform: string;
|
|
6
|
+
/**手机品牌 */
|
|
7
|
+
brand: string;
|
|
8
|
+
/**手机型号 */
|
|
9
|
+
model: string;
|
|
10
|
+
};
|
|
11
|
+
export type HostInfo = {
|
|
12
|
+
/**宿主app名称 */
|
|
13
|
+
name: string;
|
|
14
|
+
/**宿主app 版本 */
|
|
15
|
+
version: string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* 设备
|
|
19
|
+
*/
|
|
20
|
+
export declare class IDevice {
|
|
21
|
+
protected _type: string;
|
|
22
|
+
init(type: string): IDevice;
|
|
23
|
+
/**
|
|
24
|
+
* 震动开关,自动存储开关数据到本地storage。
|
|
25
|
+
*/
|
|
26
|
+
set vibrateAble(value: boolean);
|
|
27
|
+
get vibrateAble(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 手机震动
|
|
30
|
+
* @param long
|
|
31
|
+
* @param style long为false时支持的震动级别,部分机型和平台支持。
|
|
32
|
+
*/
|
|
33
|
+
vibrate(long: boolean, style?: "heavy" | "medium" | "light"): void;
|
|
34
|
+
/**
|
|
35
|
+
* 设备信息
|
|
36
|
+
*/
|
|
37
|
+
get deviceInfo(): DeviceInfo;
|
|
38
|
+
/**
|
|
39
|
+
* 宿主信息
|
|
40
|
+
*/
|
|
41
|
+
get hostInfo(): HostInfo;
|
|
42
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 平台游戏更新。
|
|
3
|
+
* 获取方式:publisher.updater
|
|
4
|
+
*/
|
|
5
|
+
export declare class IGameUpdateAble {
|
|
6
|
+
protected _plat: any;
|
|
7
|
+
private _siwtcha;
|
|
8
|
+
private _hasInit;
|
|
9
|
+
private _hasUpdate;
|
|
10
|
+
get can(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* 是否需要更新
|
|
13
|
+
*/
|
|
14
|
+
get needUpdate(): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* 初始化
|
|
17
|
+
* @param switcha 自定义开关
|
|
18
|
+
* @returns
|
|
19
|
+
*/
|
|
20
|
+
init(switcha: boolean): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { argType } from "./IPublisher";
|
|
2
|
+
/**
|
|
3
|
+
* 登录能力
|
|
4
|
+
*/
|
|
5
|
+
export declare class ILoginAble {
|
|
6
|
+
private _openId;
|
|
7
|
+
protected _type: string;
|
|
8
|
+
/**
|
|
9
|
+
* 初始化
|
|
10
|
+
* @param type 功能类型,如:wx;tt等
|
|
11
|
+
*/
|
|
12
|
+
init(type: string): ILoginAble;
|
|
13
|
+
/**
|
|
14
|
+
* 是否支持
|
|
15
|
+
*/
|
|
16
|
+
isSupport(): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* 登录,helper内登录成功后,必须调用this._setOpenId();否则后续逻辑会有BUG
|
|
19
|
+
*/
|
|
20
|
+
login(caller?: any, onSuccess?: () => void, onFail?: () => void): void;
|
|
21
|
+
protected _setOpenID(openID: string): void;
|
|
22
|
+
/**
|
|
23
|
+
* 注销
|
|
24
|
+
*/
|
|
25
|
+
logout(): void;
|
|
26
|
+
/**
|
|
27
|
+
* 登录成功的sessionID
|
|
28
|
+
*/
|
|
29
|
+
get sessionID(): argType;
|
|
30
|
+
/**
|
|
31
|
+
* 登录成功的openID
|
|
32
|
+
*/
|
|
33
|
+
get openID(): argType;
|
|
34
|
+
/**
|
|
35
|
+
* 获取用户信息
|
|
36
|
+
*/
|
|
37
|
+
get userInfo(): any;
|
|
38
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { EventDispatcher } from "../../base/event/EventDispatcher";
|
|
2
|
+
export type argType = string | boolean | number;
|
|
3
|
+
export type PublisherAppInfoStruct = {
|
|
4
|
+
/**
|
|
5
|
+
* 游戏平台id
|
|
6
|
+
*/
|
|
7
|
+
appId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* 游戏版本号
|
|
10
|
+
*/
|
|
11
|
+
version?: string;
|
|
12
|
+
/**
|
|
13
|
+
* 宿主版本类型
|
|
14
|
+
*/
|
|
15
|
+
envVersion?: string;
|
|
16
|
+
options?: PublisherOptions;
|
|
17
|
+
};
|
|
18
|
+
export type PublisherOptions = Record<string, any>;
|
|
19
|
+
export declare class EnterOptionParser {
|
|
20
|
+
protected _options: any;
|
|
21
|
+
constructor(options: any);
|
|
22
|
+
/**
|
|
23
|
+
* 是否匹配对应的来源渠道场景
|
|
24
|
+
* @param scenes
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
27
|
+
isFromScene(scenes: string[] | string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 来源的渠道场景
|
|
30
|
+
*/
|
|
31
|
+
get channelScene(): string;
|
|
32
|
+
/**
|
|
33
|
+
* 来源的渠道
|
|
34
|
+
*/
|
|
35
|
+
get channelSource(): string;
|
|
36
|
+
/**
|
|
37
|
+
* 获取启动配置项
|
|
38
|
+
* @param key 支持xx.xx递归索引,任何一级不存在返回null
|
|
39
|
+
* @returns
|
|
40
|
+
*/
|
|
41
|
+
getOption<T>(key: string): T | null;
|
|
42
|
+
getAllOption(): any;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* 平台基类
|
|
46
|
+
*/
|
|
47
|
+
export declare class IPublisher extends EventDispatcher {
|
|
48
|
+
static TYPE_HL: string;
|
|
49
|
+
static TYPE_DEV: string;
|
|
50
|
+
static TYPE_H5: string;
|
|
51
|
+
static TYPE_TT: string;
|
|
52
|
+
static TYPE_233: string;
|
|
53
|
+
protected _type: string;
|
|
54
|
+
protected _appInfo: PublisherAppInfoStruct;
|
|
55
|
+
protected _customAppInfo: PublisherAppInfoStruct;
|
|
56
|
+
protected _enterOptions: EnterOptionParser;
|
|
57
|
+
protected _installOptions: EnterOptionParser;
|
|
58
|
+
protected _eventShowMap: Map<string, any>;
|
|
59
|
+
protected _eventHideMap: Map<string, any>;
|
|
60
|
+
protected _eventErrorMap: Map<string, any>;
|
|
61
|
+
protected static INSTALL_SOURCE_KEY: string;
|
|
62
|
+
/**
|
|
63
|
+
* 初始化平台
|
|
64
|
+
* @param type 平台标视
|
|
65
|
+
* @param config 平台配置 PublisherConfig
|
|
66
|
+
* @returns
|
|
67
|
+
*/
|
|
68
|
+
init(type: string, custom?: PublisherAppInfoStruct): IPublisher;
|
|
69
|
+
protected _onAppShow(info: {
|
|
70
|
+
query: {};
|
|
71
|
+
scene: string | number;
|
|
72
|
+
}): void;
|
|
73
|
+
/**
|
|
74
|
+
* 获取发行商名称,Develop保留位开发环境
|
|
75
|
+
*/
|
|
76
|
+
get type(): string;
|
|
77
|
+
/**
|
|
78
|
+
* 获取发行商下的APPID
|
|
79
|
+
*/
|
|
80
|
+
get appId(): string;
|
|
81
|
+
/**
|
|
82
|
+
* 获取版本
|
|
83
|
+
*/
|
|
84
|
+
get appVersion(): string;
|
|
85
|
+
/**
|
|
86
|
+
* 当前版本是否为正式版
|
|
87
|
+
*/
|
|
88
|
+
get isReleaseEnv(): boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 当前版本是否为开发环境中
|
|
91
|
+
*/
|
|
92
|
+
get isDevelopEnv(): boolean;
|
|
93
|
+
/**
|
|
94
|
+
* 当前版本是否为体验版
|
|
95
|
+
*/
|
|
96
|
+
get isTrialEnv(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* 当前版本是否是处于灰色测试中
|
|
99
|
+
*/
|
|
100
|
+
get isGrayEnv(): boolean;
|
|
101
|
+
/**
|
|
102
|
+
* 平台初始化
|
|
103
|
+
* @param caller
|
|
104
|
+
* @param onSuccess
|
|
105
|
+
* @param onFail
|
|
106
|
+
*/
|
|
107
|
+
initSDK(caller?: any, onSuccess?: Function, onFail?: Function): void;
|
|
108
|
+
private _init;
|
|
109
|
+
private _listenError;
|
|
110
|
+
/**
|
|
111
|
+
* 获取启动信息
|
|
112
|
+
* @param plat
|
|
113
|
+
* @returns
|
|
114
|
+
*/
|
|
115
|
+
get enterOptions(): EnterOptionParser;
|
|
116
|
+
/**
|
|
117
|
+
* 安装来源
|
|
118
|
+
*/
|
|
119
|
+
get installOptions(): EnterOptionParser;
|
|
120
|
+
/**
|
|
121
|
+
* 获取启动参数
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
protected _initEnterOptions(info?: any): EnterOptionParser;
|
|
125
|
+
/**
|
|
126
|
+
* 获取安装来源
|
|
127
|
+
* @returns
|
|
128
|
+
*/
|
|
129
|
+
protected _initInstallOptions(): EnterOptionParser;
|
|
130
|
+
/**
|
|
131
|
+
* 订阅推送
|
|
132
|
+
* @param subscribeMsgIds 订阅消息模板ID列表
|
|
133
|
+
* @returns
|
|
134
|
+
*/
|
|
135
|
+
subscribeMessage(subscribeMsgIds: string[]): Promise<boolean>;
|
|
136
|
+
protected _subscribeMessage(subscribeMsgIds: string[], plat?: any): Promise<boolean>;
|
|
137
|
+
/**
|
|
138
|
+
* 进入平台界面
|
|
139
|
+
*/
|
|
140
|
+
showView(viewName: string, caller?: any, onClose?: Function): void;
|
|
141
|
+
protected _getMapKey(call: Function, caller?: any): string;
|
|
142
|
+
protected _getCall(map: Map<string, any>, call: () => void, caller?: any): any;
|
|
143
|
+
onError(call: (...error: any[]) => void, caller?: any): void;
|
|
144
|
+
offError(call: (...error: any[]) => void, caller?: any): void;
|
|
145
|
+
onShow(call: (data?: any) => void, caller?: any): void;
|
|
146
|
+
offShow(call: () => void, caller?: any): void;
|
|
147
|
+
onHide(call: () => void, caller?: any): void;
|
|
148
|
+
offHide(call: () => void, caller?: any): void;
|
|
149
|
+
restart(): void;
|
|
150
|
+
/**
|
|
151
|
+
* 退出
|
|
152
|
+
*/
|
|
153
|
+
exit(): void;
|
|
154
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { IAbleHelper } from "./IAble";
|
|
2
|
+
import { IADAble, ADConfig } from "./IADAble";
|
|
3
|
+
import { IDevice } from "./IDevice";
|
|
4
|
+
import { IGameUpdateAble } from "./IGameUpdateAble";
|
|
5
|
+
import { ILoginAble } from "./ILoginAble";
|
|
6
|
+
import { IPayAble } from "./IPayAble";
|
|
7
|
+
import { IPublisher, PublisherAppInfoStruct } from "./IPublisher";
|
|
8
|
+
import { IRecordAble } from "./IRecordAble";
|
|
9
|
+
import { IShareAble } from "./IShareAble";
|
|
10
|
+
export declare abstract class IPublisherManager {
|
|
11
|
+
private _publisher;
|
|
12
|
+
private _ad;
|
|
13
|
+
private _login;
|
|
14
|
+
private _pay;
|
|
15
|
+
private _record;
|
|
16
|
+
private _share;
|
|
17
|
+
private _updater;
|
|
18
|
+
private _device;
|
|
19
|
+
private _abilityMap;
|
|
20
|
+
abstract enable(): void;
|
|
21
|
+
/**
|
|
22
|
+
* 初始化平台
|
|
23
|
+
* @param publisherId 平台ID,0保留为DEVELOP
|
|
24
|
+
* @param publisher
|
|
25
|
+
*/
|
|
26
|
+
protected setPublisher(type: string, publisher: {
|
|
27
|
+
new (): IPublisher;
|
|
28
|
+
}, customAppInfo?: PublisherAppInfoStruct): void;
|
|
29
|
+
/**
|
|
30
|
+
* 获取平台类实例
|
|
31
|
+
* @return IPublisher
|
|
32
|
+
*/
|
|
33
|
+
get publisher(): IPublisher;
|
|
34
|
+
protected setDevice(type: string, device: {
|
|
35
|
+
new (): IDevice;
|
|
36
|
+
}): void;
|
|
37
|
+
get device(): IDevice;
|
|
38
|
+
get type(): string;
|
|
39
|
+
get appId(): string;
|
|
40
|
+
get appVersion(): string;
|
|
41
|
+
isTarget(type: string): boolean;
|
|
42
|
+
protected enableAdAble(type: string, ad: {
|
|
43
|
+
new (): IADAble;
|
|
44
|
+
}, config: ADConfig): void;
|
|
45
|
+
get ad(): IADAble;
|
|
46
|
+
protected enableLogin(type: string, login: {
|
|
47
|
+
new (): ILoginAble;
|
|
48
|
+
}): void;
|
|
49
|
+
get login(): ILoginAble;
|
|
50
|
+
protected enablePay(type: string, pay: {
|
|
51
|
+
new (): IPayAble;
|
|
52
|
+
}): void;
|
|
53
|
+
get pay(): IPayAble;
|
|
54
|
+
protected enableRecord(type: string, record: {
|
|
55
|
+
new (): IRecordAble;
|
|
56
|
+
}): void;
|
|
57
|
+
get record(): IRecordAble;
|
|
58
|
+
protected enableShare(type: string, share: {
|
|
59
|
+
new (): IShareAble;
|
|
60
|
+
}): void;
|
|
61
|
+
get share(): IShareAble;
|
|
62
|
+
protected enableGameUpdate(type: string, updater: {
|
|
63
|
+
new (): IGameUpdateAble;
|
|
64
|
+
}): void;
|
|
65
|
+
get updater(): IGameUpdateAble;
|
|
66
|
+
helper<T extends IAbleHelper>(abilityClass: {
|
|
67
|
+
new (): T;
|
|
68
|
+
}): IAbleHelper;
|
|
69
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 录屏能力
|
|
3
|
+
*/
|
|
4
|
+
export declare class IRecordAble {
|
|
5
|
+
protected _type: string;
|
|
6
|
+
/**
|
|
7
|
+
* 初始化
|
|
8
|
+
* @param type 功能类型,如:wx;tt等
|
|
9
|
+
*/
|
|
10
|
+
init(type: string): IRecordAble;
|
|
11
|
+
startRecord(duration?: number, frameRate?: number): void;
|
|
12
|
+
stopRecord(): void;
|
|
13
|
+
pauseRecord(): void;
|
|
14
|
+
resumeRecord(): void;
|
|
15
|
+
get videoPath(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AnalyticsData } from "../analytics/index";
|
|
2
|
+
import { KSShareParameters } from "./ks/KSShare";
|
|
3
|
+
import { TTShareParameters } from "./tt/TTShare";
|
|
4
|
+
import { WXShareParameters } from "./wx/WXShare";
|
|
5
|
+
export type ShareParameters = string | WXShareParameters | TTShareParameters | KSShareParameters;
|
|
6
|
+
/**
|
|
7
|
+
* 分享能力
|
|
8
|
+
*/
|
|
9
|
+
export declare class IShareAble {
|
|
10
|
+
protected _type: string;
|
|
11
|
+
/**
|
|
12
|
+
* 初始化
|
|
13
|
+
* @param type 功能类型,如:wx;tt等
|
|
14
|
+
*/
|
|
15
|
+
init(type: string): IShareAble;
|
|
16
|
+
/**
|
|
17
|
+
* 转换分享的query参数
|
|
18
|
+
* @param query 外部query
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
protected _getShareQuery(analyticsName: string | {
|
|
22
|
+
name: string;
|
|
23
|
+
} & AnalyticsData, query?: string): string;
|
|
24
|
+
protected _report(analyticsName: string | AnalyticsData, msg: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* 分享图片或者文字
|
|
27
|
+
* @param analyticsName 玩法发起分享的动作来源,用于统计。
|
|
28
|
+
* @param data 分享参数,可以通过明确泛型确定不同平台的分享结构体,如:WXShareParameters
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
shareTextOrImage<T extends ShareParameters>(analyticsName: string | {
|
|
32
|
+
name: string;
|
|
33
|
+
} & AnalyticsData, data?: T): Promise<boolean>;
|
|
34
|
+
shareVideo(analyticsName: string | {
|
|
35
|
+
name: string;
|
|
36
|
+
} & AnalyticsData, data: string | {
|
|
37
|
+
[key: string]: any;
|
|
38
|
+
}): Promise<boolean>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { IAbleHelper } from "./IAble";
|
|
2
|
+
import { IADAble } from "./IADAble";
|
|
3
|
+
import { IDevice } from "./IDevice";
|
|
4
|
+
import { IGameUpdateAble } from "./IGameUpdateAble";
|
|
5
|
+
import { ILoginAble } from "./ILoginAble";
|
|
6
|
+
import { IPayAble } from "./IPayAble";
|
|
7
|
+
import { IPublisher } from "./IPublisher";
|
|
8
|
+
import { IRecordAble } from "./IRecordAble";
|
|
9
|
+
import { IShareAble } from "./IShareAble";
|
|
10
|
+
export declare class PublisherManager {
|
|
11
|
+
/**
|
|
12
|
+
* 全局唯一注入KEY
|
|
13
|
+
*/
|
|
14
|
+
static KEY: string;
|
|
15
|
+
private static created;
|
|
16
|
+
constructor();
|
|
17
|
+
get publisher(): IPublisher;
|
|
18
|
+
/**
|
|
19
|
+
* 带泛型的publisher
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
publisherT<T extends IPublisher>(): T;
|
|
23
|
+
get type(): string;
|
|
24
|
+
get appId(): string;
|
|
25
|
+
get appVersion(): string;
|
|
26
|
+
/**
|
|
27
|
+
* 是否是目标平台
|
|
28
|
+
* @param type 目标平台
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
isTarget(type: string): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 广告能力banner、插屏、激励视频等
|
|
34
|
+
*/
|
|
35
|
+
get ad(): IADAble;
|
|
36
|
+
/**
|
|
37
|
+
* 带泛型的ad
|
|
38
|
+
* @returns
|
|
39
|
+
*/
|
|
40
|
+
adT<T extends IADAble>(): T;
|
|
41
|
+
/**
|
|
42
|
+
* 平台登录能力
|
|
43
|
+
*/
|
|
44
|
+
get login(): ILoginAble;
|
|
45
|
+
/**
|
|
46
|
+
* 带泛型的login
|
|
47
|
+
* @returns
|
|
48
|
+
*/
|
|
49
|
+
loginT<T extends ILoginAble>(): T;
|
|
50
|
+
/**
|
|
51
|
+
* 支付能力
|
|
52
|
+
*/
|
|
53
|
+
get pay(): IPayAble;
|
|
54
|
+
/**
|
|
55
|
+
* 带泛型的pay
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
payT<T extends IPayAble>(): T;
|
|
59
|
+
/**
|
|
60
|
+
* 录屏能力
|
|
61
|
+
*/
|
|
62
|
+
get record(): IRecordAble;
|
|
63
|
+
/**
|
|
64
|
+
* 带泛型的record
|
|
65
|
+
* @returns
|
|
66
|
+
*/
|
|
67
|
+
recordT<T extends IRecordAble>(): T;
|
|
68
|
+
/**
|
|
69
|
+
* 分享能力,微信分享、抖音分享等
|
|
70
|
+
*/
|
|
71
|
+
get share(): IShareAble;
|
|
72
|
+
/**
|
|
73
|
+
* 带泛型的share
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
shareT<T extends IShareAble>(): T;
|
|
77
|
+
/**
|
|
78
|
+
* 设备相关操作[震动、电量、网络状况等]
|
|
79
|
+
*/
|
|
80
|
+
get device(): IDevice;
|
|
81
|
+
/**
|
|
82
|
+
* 带泛型的device
|
|
83
|
+
* @returns
|
|
84
|
+
*/
|
|
85
|
+
deviceT<T extends IDevice>(): T;
|
|
86
|
+
/**
|
|
87
|
+
* 游戏更新器
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
get updater(): IGameUpdateAble;
|
|
91
|
+
/**
|
|
92
|
+
* 其他功能的协助协助器
|
|
93
|
+
* @param abilityClass
|
|
94
|
+
* @returns
|
|
95
|
+
*/
|
|
96
|
+
helper<T extends IAbleHelper>(abilityClass: {
|
|
97
|
+
new (): T;
|
|
98
|
+
}): T;
|
|
99
|
+
enable(): void;
|
|
100
|
+
private _impl;
|
|
101
|
+
private get impl();
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* 多平台管理,集成平台的登录,支付等功能。
|
|
105
|
+
*/
|
|
106
|
+
export declare const publisher: PublisherManager;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PublisherAppInfoStruct } from "./IPublisher";
|
|
2
|
+
import { IPublisherManager } from "./IPublisherManager";
|
|
3
|
+
/**
|
|
4
|
+
* 通用平台管理实现。
|
|
5
|
+
* 负责在通用运行时中检测平台并启用对应能力。
|
|
6
|
+
*/
|
|
7
|
+
export declare class PublisherManagerImpl extends IPublisherManager {
|
|
8
|
+
private _customAppInfo;
|
|
9
|
+
constructor(customAppInfo?: PublisherAppInfoStruct);
|
|
10
|
+
private _init;
|
|
11
|
+
enable(): void;
|
|
12
|
+
private _initWeb;
|
|
13
|
+
private _enableWeb;
|
|
14
|
+
private _initTT;
|
|
15
|
+
private _enableTT;
|
|
16
|
+
private _initWX;
|
|
17
|
+
private _enableWX;
|
|
18
|
+
private _initKS;
|
|
19
|
+
private _enableKS;
|
|
20
|
+
private _initMY;
|
|
21
|
+
private _enableMY;
|
|
22
|
+
private _initNative;
|
|
23
|
+
private _enableNative;
|
|
24
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { IADAble, ADConfig } from "../IADAble";
|
|
2
|
+
import { AdFrom } from "../../analytics/ad/ADBehaviorReporter";
|
|
3
|
+
import { WXAd } from "../wx/WXAd";
|
|
4
|
+
export declare class KSAd extends WXAd {
|
|
5
|
+
init(type: string, config: ADConfig): IADAble;
|
|
6
|
+
loadInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { IDevice, DeviceInfo, HostInfo } from "../IDevice";
|
|
2
|
+
export declare class KSDevice extends IDevice {
|
|
3
|
+
protected _ks: 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,34 @@
|
|
|
1
|
+
import { EnterOptionParser, IPublisher } from "../IPublisher";
|
|
2
|
+
export declare class KSPublisher extends IPublisher {
|
|
3
|
+
protected _ks: any;
|
|
4
|
+
init(type: string): 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
|
+
protected _initInstallOptions(): EnterOptionParser;
|
|
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,13 @@
|
|
|
1
|
+
import { IRecordAble } from "../IRecordAble";
|
|
2
|
+
export declare class KSRecorder extends IRecordAble {
|
|
3
|
+
protected _recorder: any;
|
|
4
|
+
protected _videoPath: string;
|
|
5
|
+
protected _videoID: string;
|
|
6
|
+
init(type: string): IRecordAble;
|
|
7
|
+
startRecord(duration?: number, frameRate?: number): void;
|
|
8
|
+
stopRecord(): void;
|
|
9
|
+
pauseRecord(): void;
|
|
10
|
+
resumeRecord(): void;
|
|
11
|
+
get videoPath(): string;
|
|
12
|
+
publicVideo(query: string, mouldId?: string): Promise<boolean>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AnalyticsData } from "../../analytics/index";
|
|
2
|
+
import { argType } from "../IPublisher";
|
|
3
|
+
import { IShareAble, ShareParameters } from "../IShareAble";
|
|
4
|
+
/**
|
|
5
|
+
* 快手分享参数,用于share.shareTextOrImage接口的泛型指定
|
|
6
|
+
*
|
|
7
|
+
* - 方式1:图文模板分享 ```{templateId:"通过审核的分享ID", query: "通过分享进入的启动参数"}```
|
|
8
|
+
*
|
|
9
|
+
* tips:分享到好友增加参数:```channel:"invite"```
|
|
10
|
+
*/
|
|
11
|
+
export type KSShareParameters = {
|
|
12
|
+
/**
|
|
13
|
+
* 查询字符串,从这条转发消息进入后,可通过 app.publisher.publisher.enterOptions 获取启动参数中的 query。必须是 key1=val1&key2=val2 的格式。
|
|
14
|
+
*/
|
|
15
|
+
query?: string;
|
|
16
|
+
/**
|
|
17
|
+
* 通过审核的分享ID
|
|
18
|
+
*/
|
|
19
|
+
templateId?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare class KSShare extends IShareAble {
|
|
22
|
+
protected _ks: any;
|
|
23
|
+
init(type: string): IShareAble;
|
|
24
|
+
shareTextOrImage<T extends ShareParameters>(analyticsName: string | ({
|
|
25
|
+
name: string;
|
|
26
|
+
} & AnalyticsData), data?: T): Promise<boolean>;
|
|
27
|
+
shareVideo(analyticsName: string | {
|
|
28
|
+
name: string;
|
|
29
|
+
} & AnalyticsData, data: {
|
|
30
|
+
[key: string]: argType;
|
|
31
|
+
}): Promise<boolean>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IADAble, ADConfig } from "../IADAble";
|
|
2
|
+
import { AdFrom } from "../../analytics/ad/ADBehaviorReporter";
|
|
3
|
+
/**
|
|
4
|
+
* 支付宝广告
|
|
5
|
+
*/
|
|
6
|
+
export declare class MYAd extends IADAble {
|
|
7
|
+
protected _my: any;
|
|
8
|
+
protected _tempInterstitial: any;
|
|
9
|
+
init(type: string, config: ADConfig): IADAble;
|
|
10
|
+
loadInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
|
|
11
|
+
showInterstitial(from: AdFrom, unitIdIndex?: number): Promise<void>;
|
|
12
|
+
showRewardVideo(from: AdFrom, breakConfirm?: boolean, unitIdIndex?: number): Promise<boolean>;
|
|
13
|
+
}
|