@chiyou/minigame-framework 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Scripts/index.ts +2 -5
- package/package.json +5 -10
- package/dist/Framework/Adapter/AdAdapter/AbsAdAdapter.d.ts +0 -78
- package/dist/Framework/Adapter/AdAdapter/AbsAdAdapter.js +0 -230
- package/dist/Framework/Adapter/AdAdapter/AdAdapterBilibili.d.ts +0 -31
- package/dist/Framework/Adapter/AdAdapter/AdAdapterBilibili.js +0 -224
- package/dist/Framework/Adapter/AdAdapter/AdAdapterDouYin.d.ts +0 -34
- package/dist/Framework/Adapter/AdAdapter/AdAdapterDouYin.js +0 -524
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHonor.d.ts +0 -34
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHonor.js +0 -631
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHuaWei.d.ts +0 -33
- package/dist/Framework/Adapter/AdAdapter/AdAdapterHuaWei.js +0 -460
- package/dist/Framework/Adapter/AdAdapter/AdAdapterJingDong.d.ts +0 -31
- package/dist/Framework/Adapter/AdAdapter/AdAdapterJingDong.js +0 -227
- package/dist/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.d.ts +0 -33
- package/dist/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.js +0 -458
- package/dist/Framework/Adapter/AdAdapter/AdAdapterOppo.d.ts +0 -35
- package/dist/Framework/Adapter/AdAdapter/AdAdapterOppo.js +0 -770
- package/dist/Framework/Adapter/AdAdapter/AdAdapterTapTap.d.ts +0 -33
- package/dist/Framework/Adapter/AdAdapter/AdAdapterTapTap.js +0 -519
- package/dist/Framework/Adapter/AdAdapter/AdAdapterVivo.d.ts +0 -33
- package/dist/Framework/Adapter/AdAdapter/AdAdapterVivo.js +0 -492
- package/dist/Framework/Adapter/AdAdapter/AdAdapterWeiXin.d.ts +0 -33
- package/dist/Framework/Adapter/AdAdapter/AdAdapterWeiXin.js +0 -695
- package/dist/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.d.ts +0 -34
- package/dist/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.js +0 -597
- package/dist/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.d.ts +0 -33
- package/dist/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.js +0 -458
- package/dist/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.d.ts +0 -51
- package/dist/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.js +0 -17
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.d.ts +0 -45
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.js +0 -555
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.js +0 -148
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.d.ts +0 -48
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.js +0 -715
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.js +0 -296
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.d.ts +0 -45
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.js +0 -284
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.js +0 -283
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.d.ts +0 -43
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.js +0 -406
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.d.ts +0 -43
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.js +0 -248
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.js +0 -517
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.js +0 -295
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.d.ts +0 -55
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.js +0 -964
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.js +0 -295
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.d.ts +0 -44
- package/dist/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.js +0 -393
- package/dist/Framework/Definition/AdDefinition.d.ts +0 -130
- package/dist/Framework/Definition/AdDefinition.js +0 -208
- package/dist/Framework/Definition/FrameworkBase.d.ts +0 -13
- package/dist/Framework/Definition/FrameworkBase.js +0 -23
- package/dist/Framework/Definition/PrivacyDefinition.d.ts +0 -51
- package/dist/Framework/Definition/PrivacyDefinition.js +0 -70
- package/dist/Framework/Definition/SocialDefinition.d.ts +0 -16
- package/dist/Framework/Definition/SocialDefinition.js +0 -2
- package/dist/Framework/Definition/SystemDefinition.d.ts +0 -43
- package/dist/Framework/Definition/SystemDefinition.js +0 -28
- package/dist/Framework/Definition/UIDefinition.d.ts +0 -6
- package/dist/Framework/Definition/UIDefinition.js +0 -7
- package/dist/Framework/Definition/UserDefinition.d.ts +0 -14
- package/dist/Framework/Definition/UserDefinition.js +0 -10
- package/dist/Framework/Manager/AdMgr.d.ts +0 -57
- package/dist/Framework/Manager/AdMgr.js +0 -684
- package/dist/Framework/Manager/AudioMgr.d.ts +0 -28
- package/dist/Framework/Manager/AudioMgr.js +0 -265
- package/dist/Framework/Manager/BaseMgr.d.ts +0 -18
- package/dist/Framework/Manager/BaseMgr.js +0 -114
- package/dist/Framework/Manager/EventMgr.d.ts +0 -18
- package/dist/Framework/Manager/EventMgr.js +0 -90
- package/dist/Framework/Manager/ExcelMgr.d.ts +0 -24
- package/dist/Framework/Manager/ExcelMgr.js +0 -156
- package/dist/Framework/Manager/LifeCycleMgr.d.ts +0 -20
- package/dist/Framework/Manager/LifeCycleMgr.js +0 -110
- package/dist/Framework/Manager/NodePoolMgr.d.ts +0 -53
- package/dist/Framework/Manager/NodePoolMgr.js +0 -279
- package/dist/Framework/Manager/PrivacyMgr.d.ts +0 -15
- package/dist/Framework/Manager/PrivacyMgr.js +0 -176
- package/dist/Framework/Manager/ResMgr.d.ts +0 -49
- package/dist/Framework/Manager/ResMgr.js +0 -337
- package/dist/Framework/Manager/SocialMgr.d.ts +0 -23
- package/dist/Framework/Manager/SocialMgr.js +0 -220
- package/dist/Framework/Manager/SystemMgr.d.ts +0 -24
- package/dist/Framework/Manager/SystemMgr.js +0 -222
- package/dist/Framework/Manager/TimerMgr.d.ts +0 -11
- package/dist/Framework/Manager/TimerMgr.js +0 -63
- package/dist/Framework/Manager/UIMgr.d.ts +0 -33
- package/dist/Framework/Manager/UIMgr.js +0 -223
- package/dist/Framework/Manager/UserMgr.d.ts +0 -15
- package/dist/Framework/Manager/UserMgr.js +0 -148
- package/dist/Framework/Utils/BezierUtils.d.ts +0 -49
- package/dist/Framework/Utils/BezierUtils.js +0 -247
- package/dist/Framework/Utils/CSVUtils.d.ts +0 -35
- package/dist/Framework/Utils/CSVUtils.js +0 -341
- package/dist/Framework/Utils/LogUtils.d.ts +0 -7
- package/dist/Framework/Utils/LogUtils.js +0 -32
- package/dist/Framework/Utils/NumberUtils.d.ts +0 -16
- package/dist/Framework/Utils/NumberUtils.js +0 -44
- package/dist/Framework/Utils/TaskUtils.d.ts +0 -10
- package/dist/Framework/Utils/TaskUtils.js +0 -24
- package/dist/Framework/Utils/TimeUtils.d.ts +0 -19
- package/dist/Framework/Utils/TimeUtils.js +0 -33
- package/dist/Framework/Utils/WXBizDataCryptUtils.d.ts +0 -12
- package/dist/Framework/Utils/WXBizDataCryptUtils.js +0 -37
- package/dist/index.d.ts +0 -30
- package/dist/index.js +0 -35
|
@@ -1,220 +0,0 @@
|
|
|
1
|
-
import { PlatformID } from "../Definition/SystemDefinition";
|
|
2
|
-
import { LogUtils } from "../Utils/LogUtils";
|
|
3
|
-
import { BaseMgr } from "./BaseMgr";
|
|
4
|
-
export class SocialMgr extends BaseMgr {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.shareInfo = null;
|
|
8
|
-
}
|
|
9
|
-
onLoad() {
|
|
10
|
-
super.onLoad();
|
|
11
|
-
if (SocialMgr.Instance === null) {
|
|
12
|
-
SocialMgr.Instance = this;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
this.destroy();
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
init(shareInfo) {
|
|
20
|
-
this.shareInfo = shareInfo;
|
|
21
|
-
LogUtils.Instance.log(SocialMgr.TAG, "init() finished.");
|
|
22
|
-
}
|
|
23
|
-
supportPassiveShare() {
|
|
24
|
-
switch (this.getCurrentPlatformID()) {
|
|
25
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
26
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
27
|
-
case PlatformID.ID_MiniGame_KuaiShou:
|
|
28
|
-
case PlatformID.ID_MiniGame_ZhiFuBao:
|
|
29
|
-
case PlatformID.ID_MiniGame_TapTap:
|
|
30
|
-
case PlatformID.ID_MiniGame_Bilibili:
|
|
31
|
-
case PlatformID.ID_MiniGame_JingDong:
|
|
32
|
-
return true;
|
|
33
|
-
default:
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
supportActiveShare() {
|
|
38
|
-
switch (this.getCurrentPlatformID()) {
|
|
39
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
40
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
41
|
-
case PlatformID.ID_MiniGame_KuaiShou:
|
|
42
|
-
case PlatformID.ID_MiniGame_TapTap:
|
|
43
|
-
case PlatformID.ID_MiniGame_Bilibili:
|
|
44
|
-
case PlatformID.ID_MiniGame_JingDong:
|
|
45
|
-
return true;
|
|
46
|
-
default:
|
|
47
|
-
return false;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
configPassiveShare(title, desc, imageUrl, templateId, query) {
|
|
51
|
-
if (!desc || desc.length === 0) {
|
|
52
|
-
desc = this.shareInfo.defaultInfo.desc;
|
|
53
|
-
}
|
|
54
|
-
if (!title || title.length === 0) {
|
|
55
|
-
title = this.shareInfo.defaultInfo.title;
|
|
56
|
-
}
|
|
57
|
-
if (this.getCurrentPlatformID() === PlatformID.ID_MiniGame_WeiXin) {
|
|
58
|
-
title = desc;
|
|
59
|
-
}
|
|
60
|
-
if (!templateId || templateId.length === 0) {
|
|
61
|
-
let currentPlatformID = this.getCurrentPlatformID();
|
|
62
|
-
if (this.shareInfo.templateInfoMap.has(currentPlatformID)) {
|
|
63
|
-
let templateInfo = this.shareInfo.templateInfoMap.get(currentPlatformID);
|
|
64
|
-
if (templateInfo.templateId !== "") {
|
|
65
|
-
templateId = templateInfo.templateId;
|
|
66
|
-
if (this.getCurrentPlatformID() === PlatformID.ID_MiniGame_DouYin) {
|
|
67
|
-
title = "";
|
|
68
|
-
desc = "";
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
if (templateInfo.imageUrl !== "") {
|
|
72
|
-
imageUrl = templateInfo.imageUrl;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (!imageUrl || imageUrl.length === 0) {
|
|
77
|
-
imageUrl = this.shareInfo.defaultInfo.imageUrl;
|
|
78
|
-
}
|
|
79
|
-
if (this.getPlatformAdapter() === null) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
this.getPlatformAdapter().configPassiveShare(title, desc, imageUrl, templateId, query);
|
|
83
|
-
}
|
|
84
|
-
activeShareToFriend(callback, title, desc, imageUrl, templateId, query) {
|
|
85
|
-
if (!desc || desc.length === 0) {
|
|
86
|
-
desc = this.shareInfo.defaultInfo.desc;
|
|
87
|
-
}
|
|
88
|
-
if (!title || title.length === 0) {
|
|
89
|
-
title = this.shareInfo.defaultInfo.title;
|
|
90
|
-
}
|
|
91
|
-
if (this.getCurrentPlatformID() === PlatformID.ID_MiniGame_WeiXin) {
|
|
92
|
-
title = desc;
|
|
93
|
-
}
|
|
94
|
-
if (!templateId || templateId.length === 0) {
|
|
95
|
-
let currentPlatformID = this.getCurrentPlatformID();
|
|
96
|
-
if (this.shareInfo.templateInfoMap.has(currentPlatformID)) {
|
|
97
|
-
let templateInfo = this.shareInfo.templateInfoMap.get(currentPlatformID);
|
|
98
|
-
if (templateInfo.templateId !== "") {
|
|
99
|
-
templateId = templateInfo.templateId;
|
|
100
|
-
}
|
|
101
|
-
if (templateInfo.imageUrl !== "") {
|
|
102
|
-
imageUrl = templateInfo.imageUrl;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (!imageUrl || imageUrl.length === 0) {
|
|
107
|
-
imageUrl = this.shareInfo.defaultInfo.imageUrl;
|
|
108
|
-
}
|
|
109
|
-
if (this.getPlatformAdapter() === null) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this.getPlatformAdapter().activeShareToFriend(callback, title, desc, imageUrl, templateId, query);
|
|
113
|
-
}
|
|
114
|
-
supportRankList() {
|
|
115
|
-
switch (this.getCurrentPlatformID()) {
|
|
116
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
117
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
118
|
-
case PlatformID.ID_MiniGame_TapTap:
|
|
119
|
-
return true;
|
|
120
|
-
default:
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
setRankData(args) {
|
|
125
|
-
if (!this.supportRankList()) {
|
|
126
|
-
return;
|
|
127
|
-
}
|
|
128
|
-
if (this.getPlatformAdapter() === null) {
|
|
129
|
-
return;
|
|
130
|
-
}
|
|
131
|
-
this.getPlatformAdapter().setRankData(args);
|
|
132
|
-
}
|
|
133
|
-
showRankList(args) {
|
|
134
|
-
if (!this.supportRankList()) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if (this.getPlatformAdapter() === null) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
this.getPlatformAdapter().showRankList(args);
|
|
141
|
-
}
|
|
142
|
-
openPortalGame() {
|
|
143
|
-
if (this.getPlatformAdapter() === null) {
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
this.getPlatformAdapter().openPortalGame();
|
|
147
|
-
}
|
|
148
|
-
supportGameClub() {
|
|
149
|
-
switch (this.getCurrentPlatformID()) {
|
|
150
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
151
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
152
|
-
return true;
|
|
153
|
-
default:
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
openGameClub() {
|
|
158
|
-
if (!this.supportGameClub()) {
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
if (this.getPlatformAdapter() === null) {
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
this.getPlatformAdapter().openGameClub();
|
|
165
|
-
}
|
|
166
|
-
supportRecommendToFriend() {
|
|
167
|
-
switch (this.getCurrentPlatformID()) {
|
|
168
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
169
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
170
|
-
case PlatformID.ID_MiniGame_KuaiShou:
|
|
171
|
-
case PlatformID.ID_MiniGame_TapTap:
|
|
172
|
-
case PlatformID.ID_MiniGame_Bilibili:
|
|
173
|
-
case PlatformID.ID_MiniGame_JingDong:
|
|
174
|
-
return true;
|
|
175
|
-
default:
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
openRecommendToFriend() {
|
|
180
|
-
if (!this.supportRecommendToFriend()) {
|
|
181
|
-
return;
|
|
182
|
-
}
|
|
183
|
-
if (this.getPlatformAdapter() === null) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
|
-
switch (this.getCurrentPlatformID()) {
|
|
187
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
188
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
189
|
-
this.getPlatformAdapter().openRecommendToFriend();
|
|
190
|
-
break;
|
|
191
|
-
case PlatformID.ID_MiniGame_KuaiShou:
|
|
192
|
-
case PlatformID.ID_MiniGame_Bilibili:
|
|
193
|
-
case PlatformID.ID_MiniGame_TapTap:
|
|
194
|
-
case PlatformID.ID_MiniGame_JingDong:
|
|
195
|
-
this.activeShareToFriend();
|
|
196
|
-
break;
|
|
197
|
-
default:
|
|
198
|
-
break;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
supportRecommendToGameClub() {
|
|
202
|
-
switch (this.getCurrentPlatformID()) {
|
|
203
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
204
|
-
return true;
|
|
205
|
-
default:
|
|
206
|
-
return false;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
openRecommendToGameClub() {
|
|
210
|
-
if (!this.supportRecommendToGameClub()) {
|
|
211
|
-
return;
|
|
212
|
-
}
|
|
213
|
-
if (this.getPlatformAdapter() === null) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
this.getPlatformAdapter().openRecommendToGameClub();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
SocialMgr.Instance = null;
|
|
220
|
-
SocialMgr.TAG = "SocialMgr";
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { AppItem, CopyrightInfo } from "../Definition/SystemDefinition";
|
|
2
|
-
import { BaseMgr } from "./BaseMgr";
|
|
3
|
-
export declare class SystemMgr extends BaseMgr {
|
|
4
|
-
static Instance: SystemMgr;
|
|
5
|
-
static TAG: string;
|
|
6
|
-
private appItem;
|
|
7
|
-
private copyrightInfo;
|
|
8
|
-
private localGame;
|
|
9
|
-
onLoad(): void;
|
|
10
|
-
init(appItem: AppItem, copyrightInfo: CopyrightInfo): void;
|
|
11
|
-
getAppItem(): AppItem;
|
|
12
|
-
isLocalGame(): boolean;
|
|
13
|
-
getScreenBrightness(callback: Function): void;
|
|
14
|
-
setScreenBrightness(value: number): void;
|
|
15
|
-
setKeepScreenOn(keepScreenOn: boolean): void;
|
|
16
|
-
exitGame(): void;
|
|
17
|
-
getSDKVersion(): string;
|
|
18
|
-
navigateToMiniProgram(appid: string, path?: string): void;
|
|
19
|
-
reportEvent(eventId: string, data: JSON): void;
|
|
20
|
-
supportRequest(): boolean;
|
|
21
|
-
requestGet(path: string, requestParams: Map<string, string> | null, success: Function, fail: Function): void;
|
|
22
|
-
requestPost(path: string, data: string, success: Function, fail: Function): void;
|
|
23
|
-
downloadFile(fileUrl: string, success: Function, fail: Function): void;
|
|
24
|
-
}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { PlatformAdapterBilibili } from "../Adapter/PlatformAdapter/PlatformAdapterBilibili";
|
|
2
|
-
import { PlatformAdapterDesktopBrowser } from "../Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser";
|
|
3
|
-
import { PlatformAdapterDouYin } from "../Adapter/PlatformAdapter/PlatformAdapterDouYin";
|
|
4
|
-
import { PlatformAdapterHonor } from "../Adapter/PlatformAdapter/PlatformAdapterHonor";
|
|
5
|
-
import { PlatformAdapterHuaWei } from "../Adapter/PlatformAdapter/PlatformAdapterHuaWei";
|
|
6
|
-
import { PlatformAdapterJingDong } from "../Adapter/PlatformAdapter/PlatformAdapterJingDong";
|
|
7
|
-
import { PlatformAdapterKuaiShou } from "../Adapter/PlatformAdapter/PlatformAdapterKuaiShou";
|
|
8
|
-
import { PlatformAdapterOppo } from "../Adapter/PlatformAdapter/PlatformAdapterOppo";
|
|
9
|
-
import { PlatformAdapterTapTap } from "../Adapter/PlatformAdapter/PlatformAdapterTapTap";
|
|
10
|
-
import { PlatformAdapterVivo } from "../Adapter/PlatformAdapter/PlatformAdapterVivo";
|
|
11
|
-
import { PlatformAdapterWeiXin } from "../Adapter/PlatformAdapter/PlatformAdapterWeiXin";
|
|
12
|
-
import { PlatformAdapterXiaoMi } from "../Adapter/PlatformAdapter/PlatformAdapterXiaoMi";
|
|
13
|
-
import { PlatformAdapterZhiFuBao } from "../Adapter/PlatformAdapter/PlatformAdapterZhiFuBao";
|
|
14
|
-
import { PlatformID } from "../Definition/SystemDefinition";
|
|
15
|
-
import { LogUtils } from "../Utils/LogUtils";
|
|
16
|
-
import { BaseMgr } from "./BaseMgr";
|
|
17
|
-
export class SystemMgr extends BaseMgr {
|
|
18
|
-
constructor() {
|
|
19
|
-
super(...arguments);
|
|
20
|
-
this.appItem = null;
|
|
21
|
-
this.copyrightInfo = null;
|
|
22
|
-
this.localGame = true;
|
|
23
|
-
}
|
|
24
|
-
onLoad() {
|
|
25
|
-
super.onLoad();
|
|
26
|
-
if (SystemMgr.Instance === null) {
|
|
27
|
-
SystemMgr.Instance = this;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
this.destroy();
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
init(appItem, copyrightInfo) {
|
|
35
|
-
this.appItem = appItem;
|
|
36
|
-
this.copyrightInfo = copyrightInfo;
|
|
37
|
-
let currPlatformID = BaseMgr.Instance.getCurrentPlatformID();
|
|
38
|
-
if (this.appItem !== null && this.appItem.appIDMap !== null &&
|
|
39
|
-
this.appItem.appIDMap.has(currPlatformID)) {
|
|
40
|
-
LogUtils.Instance.log(SystemMgr.TAG, "appID=" + this.appItem.appIDMap.get(currPlatformID));
|
|
41
|
-
}
|
|
42
|
-
if (this.copyrightInfo && this.copyrightInfo.icpMap &&
|
|
43
|
-
this.copyrightInfo.icpMap.has(currPlatformID)) {
|
|
44
|
-
let icpItem = this.copyrightInfo.icpMap.get(currPlatformID);
|
|
45
|
-
if (icpItem !== null) {
|
|
46
|
-
this.localGame = icpItem.isLocalGame;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
LogUtils.Instance.log(SystemMgr.TAG, "isLocalGame=" + this.localGame);
|
|
50
|
-
let platformAdapterImpl = null;
|
|
51
|
-
switch (currPlatformID) {
|
|
52
|
-
case PlatformID.ID_H5_DesktopBrowser:
|
|
53
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterDesktopBrowser);
|
|
54
|
-
break;
|
|
55
|
-
case PlatformID.ID_MiniGame_WeiXin:
|
|
56
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterWeiXin);
|
|
57
|
-
break;
|
|
58
|
-
case PlatformID.ID_MiniGame_DouYin:
|
|
59
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterDouYin);
|
|
60
|
-
break;
|
|
61
|
-
case PlatformID.ID_MiniGame_KuaiShou:
|
|
62
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterKuaiShou);
|
|
63
|
-
break;
|
|
64
|
-
case PlatformID.ID_MiniGame_ZhiFuBao:
|
|
65
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterZhiFuBao);
|
|
66
|
-
break;
|
|
67
|
-
case PlatformID.ID_MiniGame_Bilibili:
|
|
68
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterBilibili);
|
|
69
|
-
break;
|
|
70
|
-
case PlatformID.ID_MiniGame_TapTap:
|
|
71
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterTapTap);
|
|
72
|
-
break;
|
|
73
|
-
case PlatformID.ID_MiniGame_JingDong:
|
|
74
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterJingDong);
|
|
75
|
-
break;
|
|
76
|
-
case PlatformID.ID_QuickGame_XiaoMi:
|
|
77
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterXiaoMi);
|
|
78
|
-
break;
|
|
79
|
-
case PlatformID.ID_QuickGame_Oppo:
|
|
80
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterOppo);
|
|
81
|
-
break;
|
|
82
|
-
case PlatformID.ID_QuickGame_Honor:
|
|
83
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterHonor);
|
|
84
|
-
break;
|
|
85
|
-
case PlatformID.ID_QuickGame_Vivo:
|
|
86
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterVivo);
|
|
87
|
-
break;
|
|
88
|
-
case PlatformID.ID_QuickGame_HuaWei:
|
|
89
|
-
platformAdapterImpl = this.node.addComponent(PlatformAdapterHuaWei);
|
|
90
|
-
break;
|
|
91
|
-
default:
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
if (platformAdapterImpl !== null) {
|
|
95
|
-
BaseMgr.Instance.setPlatformAdapter(platformAdapterImpl);
|
|
96
|
-
}
|
|
97
|
-
if (this.getPlatformAdapter() !== null) {
|
|
98
|
-
this.getPlatformAdapter().onInit(this);
|
|
99
|
-
}
|
|
100
|
-
LogUtils.Instance.log(SystemMgr.TAG, "init() finished.");
|
|
101
|
-
}
|
|
102
|
-
getAppItem() {
|
|
103
|
-
return this.appItem;
|
|
104
|
-
}
|
|
105
|
-
isLocalGame() {
|
|
106
|
-
return this.localGame;
|
|
107
|
-
}
|
|
108
|
-
getScreenBrightness(callback) {
|
|
109
|
-
if (this.getPlatformAdapter() === null) {
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
this.getPlatformAdapter().getScreenBrightness(callback);
|
|
113
|
-
}
|
|
114
|
-
setScreenBrightness(value) {
|
|
115
|
-
if (value < 0) {
|
|
116
|
-
value = 0;
|
|
117
|
-
}
|
|
118
|
-
if (value > 1) {
|
|
119
|
-
value = 1;
|
|
120
|
-
}
|
|
121
|
-
if (this.getPlatformAdapter() === null) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
this.getPlatformAdapter().setScreenBrightness(value);
|
|
125
|
-
}
|
|
126
|
-
setKeepScreenOn(keepScreenOn) {
|
|
127
|
-
if (this.getPlatformAdapter() === null) {
|
|
128
|
-
return null;
|
|
129
|
-
}
|
|
130
|
-
this.getPlatformAdapter().setKeepScreenOn(keepScreenOn);
|
|
131
|
-
}
|
|
132
|
-
exitGame() {
|
|
133
|
-
if (this.getPlatformAdapter() === null) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
this.getPlatformAdapter().exitGame();
|
|
137
|
-
}
|
|
138
|
-
getSDKVersion() {
|
|
139
|
-
if (this.getPlatformAdapter() === null) {
|
|
140
|
-
return "";
|
|
141
|
-
}
|
|
142
|
-
return this.getPlatformAdapter().getSDKVersion();
|
|
143
|
-
}
|
|
144
|
-
navigateToMiniProgram(appid, path) {
|
|
145
|
-
if (this.getPlatformAdapter() === null) {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
this.getPlatformAdapter().navigateToMiniProgram(appid, path);
|
|
149
|
-
}
|
|
150
|
-
reportEvent(eventId, data) {
|
|
151
|
-
if (this.getPlatformAdapter() === null) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
this.getPlatformAdapter().reportEvent(eventId, data);
|
|
155
|
-
}
|
|
156
|
-
supportRequest() {
|
|
157
|
-
let platformSupport = false;
|
|
158
|
-
switch (this.getCurrentPlatformID()) {
|
|
159
|
-
case PlatformID.ID_QuickGame_Oppo:
|
|
160
|
-
case PlatformID.ID_QuickGame_Honor:
|
|
161
|
-
case PlatformID.ID_QuickGame_HuaWei:
|
|
162
|
-
platformSupport = false;
|
|
163
|
-
break;
|
|
164
|
-
default:
|
|
165
|
-
platformSupport = true;
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
return platformSupport && !this.isLocalGame();
|
|
169
|
-
}
|
|
170
|
-
requestGet(path, requestParams, success, fail) {
|
|
171
|
-
if (this.getPlatformAdapter() === null) {
|
|
172
|
-
return;
|
|
173
|
-
}
|
|
174
|
-
if (success === null || fail === null) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
if (!this.supportRequest()) {
|
|
178
|
-
fail();
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
181
|
-
let url = path;
|
|
182
|
-
if (requestParams && requestParams.size > 0) {
|
|
183
|
-
let paramIndex = 0;
|
|
184
|
-
for (let entry of requestParams.entries()) {
|
|
185
|
-
paramIndex++;
|
|
186
|
-
url += (paramIndex === 1) ? "?" : "&";
|
|
187
|
-
url += entry[0] + "=" + entry[1];
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
LogUtils.Instance.log(SystemMgr.TAG, "requestGet", url);
|
|
191
|
-
this.getPlatformAdapter().requestGet(url, success, fail);
|
|
192
|
-
}
|
|
193
|
-
requestPost(path, data, success, fail) {
|
|
194
|
-
if (this.getPlatformAdapter() === null) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
if (success === null || fail === null) {
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
if (!this.supportRequest()) {
|
|
201
|
-
fail();
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
LogUtils.Instance.log(SystemMgr.TAG, "requestPost", path, data);
|
|
205
|
-
this.getPlatformAdapter().requestPost(path, data, success, fail);
|
|
206
|
-
}
|
|
207
|
-
downloadFile(fileUrl, success, fail) {
|
|
208
|
-
if (this.getPlatformAdapter() === null) {
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
if (success === null || fail === null) {
|
|
212
|
-
return;
|
|
213
|
-
}
|
|
214
|
-
if (!this.supportRequest()) {
|
|
215
|
-
fail();
|
|
216
|
-
return;
|
|
217
|
-
}
|
|
218
|
-
this.getPlatformAdapter().downloadFile(fileUrl, success, fail);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
SystemMgr.Instance = null;
|
|
222
|
-
SystemMgr.TAG = "SystemMgr";
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { BaseMgr } from "./BaseMgr";
|
|
2
|
-
export declare class TimerMgr extends BaseMgr {
|
|
3
|
-
static Instance: TimerMgr;
|
|
4
|
-
static TAG: string;
|
|
5
|
-
private timers;
|
|
6
|
-
onLoad(): void;
|
|
7
|
-
init(): void;
|
|
8
|
-
addTimer(delay: number, interval: number, repeat: number, func: Function, target: Object): void;
|
|
9
|
-
removeTimer(func: Function, target: Object): void;
|
|
10
|
-
protected update(dt: number): void;
|
|
11
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { LogUtils } from "../Utils/LogUtils";
|
|
2
|
-
import { BaseMgr } from "./BaseMgr";
|
|
3
|
-
export class TimerMgr extends BaseMgr {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.timers = [];
|
|
7
|
-
}
|
|
8
|
-
onLoad() {
|
|
9
|
-
super.onLoad();
|
|
10
|
-
if (TimerMgr.Instance === null) {
|
|
11
|
-
TimerMgr.Instance = this;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
this.destroy();
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
init() {
|
|
19
|
-
this.timers = [];
|
|
20
|
-
LogUtils.Instance.log(TimerMgr.TAG, "init() finished.");
|
|
21
|
-
}
|
|
22
|
-
addTimer(delay, interval, repeat, func, target) {
|
|
23
|
-
if (repeat === 0) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
this.removeTimer(func, target);
|
|
27
|
-
this.timers.push({
|
|
28
|
-
tick: 0 - delay,
|
|
29
|
-
interval: interval,
|
|
30
|
-
repeat: repeat,
|
|
31
|
-
func: func,
|
|
32
|
-
target: target,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
removeTimer(func, target) {
|
|
36
|
-
for (let index = 0; index < this.timers.length; index++) {
|
|
37
|
-
const item = this.timers[index];
|
|
38
|
-
if (item.func === func && item.target === target) {
|
|
39
|
-
this.timers.splice(index, 1);
|
|
40
|
-
break;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
update(dt) {
|
|
45
|
-
for (let index = 0; index < this.timers.length; index++) {
|
|
46
|
-
const item = this.timers[index];
|
|
47
|
-
item.tick += dt * 1000;
|
|
48
|
-
if (item.tick >= item.interval) {
|
|
49
|
-
item.tick -= item.interval;
|
|
50
|
-
item.func.call(item.target);
|
|
51
|
-
if (item.repeat > 0) {
|
|
52
|
-
item.repeat--;
|
|
53
|
-
if (item.repeat === 0) {
|
|
54
|
-
this.timers.splice(index, 1);
|
|
55
|
-
index--;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
TimerMgr.Instance = null;
|
|
63
|
-
TimerMgr.TAG = "TimerMgr";
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Component, Node, Color } from 'cc';
|
|
2
|
-
import { ToastDuration } from '../Definition/UIDefinition';
|
|
3
|
-
import { BaseMgr } from './BaseMgr';
|
|
4
|
-
export declare class UICtrl extends Component {
|
|
5
|
-
protected views: Map<string, Node>;
|
|
6
|
-
onLoad(): void;
|
|
7
|
-
private load_all_object;
|
|
8
|
-
set_button_listener(view_name: string, clickListener: Function, target?: Component): void;
|
|
9
|
-
}
|
|
10
|
-
export declare class UIMgr extends BaseMgr {
|
|
11
|
-
static Instance: UIMgr;
|
|
12
|
-
static TAG: string;
|
|
13
|
-
private canvas;
|
|
14
|
-
private uiMap;
|
|
15
|
-
private windowWidth;
|
|
16
|
-
private windowHeight;
|
|
17
|
-
private node_toastRoot;
|
|
18
|
-
private tween_toast;
|
|
19
|
-
private node_dialogRoot;
|
|
20
|
-
print(): void;
|
|
21
|
-
onLoad(): void;
|
|
22
|
-
init(): void;
|
|
23
|
-
create_ui(ui_name: string, parent?: Node): Node;
|
|
24
|
-
destroy_ui(ui_name: string, node: Node): void;
|
|
25
|
-
destroy_ui_all(ui_name: string): void;
|
|
26
|
-
clear_ui_all(): void;
|
|
27
|
-
adaptScreen(node: Node): void;
|
|
28
|
-
setToastRootNode(node: Node): void;
|
|
29
|
-
showToast(content: string, toastDuration?: ToastDuration): void;
|
|
30
|
-
setDialogRootNode(node: Node): void;
|
|
31
|
-
openDialog(ui_name: string, maskColor?: Color): Node;
|
|
32
|
-
closeDialog(ui_name: string, node: Node): void;
|
|
33
|
-
}
|