@chiyou/minigame-framework 1.0.0 → 1.0.2
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/AssetsPackage/GUI/Images/Block.png +0 -0
- package/assets/AssetsPackage/GUI/Images/Block.png.meta +134 -0
- package/assets/AssetsPackage/GUI/Images.meta +9 -0
- package/assets/AssetsPackage/GUI/UIPrefabs/ChessBoard_Card.prefab +509 -0
- package/assets/AssetsPackage/GUI/UIPrefabs/ChessBoard_Card.prefab.meta +13 -0
- package/assets/AssetsPackage/GUI/UIPrefabs.meta +9 -0
- package/assets/AssetsPackage/GUI.meta +11 -0
- package/assets/AssetsPackage/SpriteAtlas/Card_Pattern.plist +1106 -0
- package/assets/AssetsPackage/SpriteAtlas/Card_Pattern.plist.meta +3329 -0
- package/assets/AssetsPackage/SpriteAtlas/Card_Pattern.png +0 -0
- package/assets/AssetsPackage/SpriteAtlas/Card_Pattern.png.meta +134 -0
- package/assets/AssetsPackage/SpriteAtlas/SA_Card.plist +1196 -0
- package/assets/AssetsPackage/SpriteAtlas/SA_Card.plist.meta +3605 -0
- package/assets/AssetsPackage/SpriteAtlas/SA_Card.png +0 -0
- package/assets/AssetsPackage/SpriteAtlas/SA_Card.png.meta +134 -0
- package/assets/AssetsPackage/SpriteAtlas.meta +11 -0
- package/assets/AssetsPackage/SpriteFrame/Card_PatternType_Back.png +0 -0
- package/assets/AssetsPackage/SpriteFrame/Card_PatternType_Back.png.meta +134 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Back_BG.png +0 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Back_BG.png.meta +134 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Back_FG.png +0 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Back_FG.png.meta +134 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Front_BG.png +0 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Front_BG.png.meta +134 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Front_FG.png +0 -0
- package/assets/AssetsPackage/SpriteFrame/Card_TowardType_Front_FG.png.meta +134 -0
- package/assets/AssetsPackage/SpriteFrame.meta +11 -0
- package/assets/AssetsPackage.meta +9 -0
- package/assets/Scenes/Game.scene +831 -0
- package/assets/Scenes/Game.scene.meta +11 -0
- package/assets/Scenes.meta +9 -0
- package/assets/Scripts/Biz.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AbsAdAdapter.ts +312 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AbsAdAdapter.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterBilibili.ts +294 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterBilibili.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterDouYin.ts +650 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterDouYin.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterHonor.ts +782 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterHonor.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterHuaWei.ts +582 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterHuaWei.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterJingDong.ts +298 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterJingDong.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.ts +575 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterKuaiShou.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterOppo.ts +946 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterOppo.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterTapTap.ts +643 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterTapTap.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterVivo.ts +616 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterVivo.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterWeiXin.ts +847 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterWeiXin.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.ts +747 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterXiaoMi.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.ts +579 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter/AdAdapterZhiFuBao.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/AdAdapter.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.ts +102 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/AbsPlatformAdapter.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.ts +660 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterBilibili.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.ts +224 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterDesktopBrowser.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.ts +827 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterDouYin.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.ts +378 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterHonor.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.ts +363 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterHuaWei.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.ts +368 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterJingDong.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.ts +498 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterKuaiShou.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.ts +323 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterOppo.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.ts +617 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterTapTap.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.ts +377 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterVivo.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.ts +1136 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterWeiXin.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.ts +377 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterXiaoMi.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.ts +483 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter/PlatformAdapterZhiFuBao.ts.meta +9 -0
- package/assets/Scripts/Framework/Adapter/PlatformAdapter.meta +9 -0
- package/assets/Scripts/Framework/Adapter.meta +9 -0
- package/assets/Scripts/Framework/Definition/AdDefinition.ts +284 -0
- package/assets/Scripts/Framework/Definition/AdDefinition.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition/FrameworkBase.ts +15 -0
- package/assets/Scripts/Framework/Definition/FrameworkBase.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition/PrivacyDefinition.ts +95 -0
- package/assets/Scripts/Framework/Definition/PrivacyDefinition.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition/SocialDefinition.ts +21 -0
- package/assets/Scripts/Framework/Definition/SocialDefinition.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition/SystemDefinition.ts +58 -0
- package/assets/Scripts/Framework/Definition/SystemDefinition.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition/UIDefinition.ts +10 -0
- package/assets/Scripts/Framework/Definition/UIDefinition.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition/UserDefinition.ts +17 -0
- package/assets/Scripts/Framework/Definition/UserDefinition.ts.meta +9 -0
- package/assets/Scripts/Framework/Definition.meta +9 -0
- package/assets/Scripts/Framework/Manager/AdMgr.ts +812 -0
- package/assets/Scripts/Framework/Manager/AdMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/AudioMgr.ts +296 -0
- package/assets/Scripts/Framework/Manager/AudioMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/BaseMgr.ts +130 -0
- package/assets/Scripts/Framework/Manager/BaseMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/EventMgr.ts +102 -0
- package/assets/Scripts/Framework/Manager/EventMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/ExcelMgr.ts +188 -0
- package/assets/Scripts/Framework/Manager/ExcelMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/LifeCycleMgr.ts +142 -0
- package/assets/Scripts/Framework/Manager/LifeCycleMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/NodePoolMgr.ts +385 -0
- package/assets/Scripts/Framework/Manager/NodePoolMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/PrivacyMgr.ts +189 -0
- package/assets/Scripts/Framework/Manager/PrivacyMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/ResMgr.ts +420 -0
- package/assets/Scripts/Framework/Manager/ResMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/SocialMgr.ts +250 -0
- package/assets/Scripts/Framework/Manager/SocialMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/SystemMgr.ts +264 -0
- package/assets/Scripts/Framework/Manager/SystemMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/TimerMgr.ts +80 -0
- package/assets/Scripts/Framework/Manager/TimerMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/UIMgr.ts +267 -0
- package/assets/Scripts/Framework/Manager/UIMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager/UserMgr.ts +162 -0
- package/assets/Scripts/Framework/Manager/UserMgr.ts.meta +9 -0
- package/assets/Scripts/Framework/Manager.meta +9 -0
- package/assets/Scripts/Framework/Utils/BezierUtils.ts +273 -0
- package/assets/Scripts/Framework/Utils/BezierUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils/CSVUtils.ts +396 -0
- package/assets/Scripts/Framework/Utils/CSVUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils/LogUtils.ts +32 -0
- package/assets/Scripts/Framework/Utils/LogUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils/NumberUtils.ts +51 -0
- package/assets/Scripts/Framework/Utils/NumberUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils/TaskUtils.ts +27 -0
- package/assets/Scripts/Framework/Utils/TaskUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils/TimeUtils.ts +38 -0
- package/assets/Scripts/Framework/Utils/TimeUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils/WXBizDataCryptUtils.ts +54 -0
- package/assets/Scripts/Framework/Utils/WXBizDataCryptUtils.ts.meta +9 -0
- package/assets/Scripts/Framework/Utils.meta +9 -0
- package/assets/Scripts/Framework.meta +9 -0
- package/assets/Scripts/index.ts +39 -0
- package/assets/Scripts.meta +9 -0
- package/package.json +2 -4
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
import { Asset, assetManager, AssetManager, ImageAsset } from 'cc';
|
|
2
|
+
import { LogUtils } from '../Utils/LogUtils';
|
|
3
|
+
import { BaseMgr } from './BaseMgr';
|
|
4
|
+
|
|
5
|
+
export type ResBatch = string;
|
|
6
|
+
|
|
7
|
+
export interface ResBundleConfig {
|
|
8
|
+
assetType: typeof Asset;
|
|
9
|
+
resBatchUrlsMap: Map<ResBatch, string[]>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export class ResBundleInfo {
|
|
13
|
+
assetType: typeof Asset;
|
|
14
|
+
isBundleLoaded: boolean;
|
|
15
|
+
|
|
16
|
+
constructor(assetType: typeof Asset) {
|
|
17
|
+
this.assetType = assetType;
|
|
18
|
+
this.isBundleLoaded = false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class ResLoadInfo {
|
|
23
|
+
totalResCount: number;
|
|
24
|
+
loadedResCount: number;
|
|
25
|
+
|
|
26
|
+
constructor() {
|
|
27
|
+
this.totalResCount = 0;
|
|
28
|
+
this.loadedResCount = 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export class ResBatchInfo {
|
|
33
|
+
isBatchLoaded: boolean;
|
|
34
|
+
bundleLoadInfo: Map<string, ResLoadInfo> = null;
|
|
35
|
+
|
|
36
|
+
constructor() {
|
|
37
|
+
this.isBatchLoaded = false;
|
|
38
|
+
this.bundleLoadInfo = new Map<string, ResLoadInfo>();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class ResMgr extends BaseMgr {
|
|
43
|
+
|
|
44
|
+
public static Instance: ResMgr = null;
|
|
45
|
+
static TAG: string = "ResMgr";
|
|
46
|
+
|
|
47
|
+
private resBundleConfig: Map<string, ResBundleConfig> = new Map<string, ResBundleConfig>();
|
|
48
|
+
private resBatchSet: Set<ResBatch> = new Set<ResBatch>();
|
|
49
|
+
|
|
50
|
+
private resBundleInfoMap: Map<string, ResBundleInfo> = new Map<string, ResBundleInfo>();
|
|
51
|
+
private resBatchInfoMap: Map<ResBatch, ResBatchInfo> = new Map<ResBatch, ResBatchInfo>();
|
|
52
|
+
|
|
53
|
+
private abBundsMap: Map<string, AssetManager.Bundle> = new Map<string, AssetManager.Bundle>();
|
|
54
|
+
|
|
55
|
+
private loadInProgressFunc: (loadedResCount: number, totalResCount: number) => void;
|
|
56
|
+
private loadEndFunc: () => void;
|
|
57
|
+
|
|
58
|
+
private totalResCount: number = 0;
|
|
59
|
+
private nowLoadedResCount: number = 0;
|
|
60
|
+
|
|
61
|
+
onLoad(): void {
|
|
62
|
+
super.onLoad();
|
|
63
|
+
|
|
64
|
+
if (ResMgr.Instance === null) {
|
|
65
|
+
ResMgr.Instance = this;
|
|
66
|
+
} else {
|
|
67
|
+
this.destroy();
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
public init(resBundleConfig: Map<string, ResBundleConfig>): void {
|
|
73
|
+
this.resBundleConfig = resBundleConfig;
|
|
74
|
+
|
|
75
|
+
this._initResBundleInfo();
|
|
76
|
+
this._initResBatchInfo();
|
|
77
|
+
|
|
78
|
+
// this._printInfo();
|
|
79
|
+
|
|
80
|
+
LogUtils.Instance.log(ResMgr.TAG, "init() finished.");
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private _printInfo(): void {
|
|
84
|
+
LogUtils.Instance.log("", "resBundleInfoMap", this.resBundleInfoMap);
|
|
85
|
+
LogUtils.Instance.log("", "resBatchInfoMap", this.resBatchInfoMap);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
private _initResBundleInfo(): void {
|
|
89
|
+
this.resBundleInfoMap.clear();
|
|
90
|
+
this.resBundleConfig.forEach((resBundleConfig: ResBundleConfig, bundleName: string) => {
|
|
91
|
+
let assetType: typeof Asset = resBundleConfig.assetType;
|
|
92
|
+
let resBundleInfo: ResBundleInfo = new ResBundleInfo(assetType);
|
|
93
|
+
this.resBundleInfoMap.set(bundleName, resBundleInfo);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private _initResBatchInfo(): void {
|
|
98
|
+
this.resBatchSet.clear();
|
|
99
|
+
this.resBundleConfig.forEach((resBundleConfig: ResBundleConfig, bundleName: string) => {
|
|
100
|
+
let resBatchUrlsMap: Map<ResBatch, string[]> = resBundleConfig.resBatchUrlsMap;
|
|
101
|
+
resBatchUrlsMap.forEach((resUrls: string[], resBatch: ResBatch) => {
|
|
102
|
+
if (!this.resBatchSet.has(resBatch)) {
|
|
103
|
+
this.resBatchSet.add(resBatch);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
this.resBatchInfoMap.clear();
|
|
109
|
+
this.resBatchSet.forEach((resBatch: ResBatch) => {
|
|
110
|
+
let resBatchInfo = new ResBatchInfo();
|
|
111
|
+
|
|
112
|
+
let totalResCount: number = 0;
|
|
113
|
+
|
|
114
|
+
this.resBundleConfig.forEach((resBundleConfig: ResBundleConfig, bundleName: string) => {
|
|
115
|
+
let resBatchUrlsMap: Map<ResBatch, string[]> = resBundleConfig.resBatchUrlsMap;
|
|
116
|
+
if (resBatchUrlsMap.has(resBatch) && resBatchUrlsMap.get(resBatch) !== null) {
|
|
117
|
+
let resUrls: string[] = resBatchUrlsMap.get(resBatch);
|
|
118
|
+
|
|
119
|
+
totalResCount += resUrls.length;
|
|
120
|
+
|
|
121
|
+
let bundleLoadInfo: ResLoadInfo = new ResLoadInfo();
|
|
122
|
+
bundleLoadInfo.totalResCount = resUrls.length;
|
|
123
|
+
resBatchInfo.bundleLoadInfo.set(bundleName, bundleLoadInfo);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
this.resBatchInfoMap.set(resBatch, resBatchInfo);
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public preloadResBatch(resBatchList: ResBatch[],
|
|
132
|
+
loadInProgressFunc: (loadedResCount: number, totalResCount: number) => void,
|
|
133
|
+
loadEndFunc: () => void): void {
|
|
134
|
+
if (loadInProgressFunc === null || loadEndFunc === null) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
this.loadInProgressFunc = loadInProgressFunc;
|
|
139
|
+
this.loadEndFunc = loadEndFunc;
|
|
140
|
+
|
|
141
|
+
LogUtils.Instance.log(ResMgr.TAG, "preloadResBatch resBatchList = " + resBatchList);
|
|
142
|
+
|
|
143
|
+
let resBatchListToLoad: ResBatch[] = [];
|
|
144
|
+
for (let index: number = 0; index < resBatchList.length; index++) {
|
|
145
|
+
let resBatch: ResBatch = resBatchList[index];
|
|
146
|
+
|
|
147
|
+
let resBatchInfo: ResBatchInfo = this.resBatchInfoMap.get(resBatch);
|
|
148
|
+
if (resBatchInfo === null) {
|
|
149
|
+
LogUtils.Instance.log(ResMgr.TAG, "preloadResBatch [fail] resBatchInfo is null.");
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (!resBatchInfo.isBatchLoaded) {
|
|
154
|
+
resBatchListToLoad.push(resBatch);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (resBatchListToLoad.length === 0) {
|
|
159
|
+
LogUtils.Instance.log(ResMgr.TAG, "preloadResBatch [success] all resBatch already loaded.");
|
|
160
|
+
this.loadEndFunc();
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
let totalBundleCount: number = this.resBundleInfoMap.size;
|
|
165
|
+
let loadedBundleCount: number = 0;
|
|
166
|
+
|
|
167
|
+
let keys: IterableIterator<string> = this.resBundleInfoMap.keys();
|
|
168
|
+
let resultKey: IteratorResult<string> = keys.next();
|
|
169
|
+
while (resultKey.done === false) {
|
|
170
|
+
let resBundleInfo: ResBundleInfo = this.resBundleInfoMap.get(resultKey.value);
|
|
171
|
+
if (resBundleInfo === null) {
|
|
172
|
+
LogUtils.Instance.log(ResMgr.TAG, "preloadResBatch [fail] resBundleInfo is null.");
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
if (!resBundleInfo.isBundleLoaded) {
|
|
177
|
+
this._preloadAssetsBundle(resultKey.value, (isSuccess: boolean) => {
|
|
178
|
+
if (isSuccess) {
|
|
179
|
+
loadedBundleCount++;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (loadedBundleCount === totalBundleCount) {
|
|
183
|
+
this._preloadAssetInAssetBundle(resBatchListToLoad);
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
} else {
|
|
187
|
+
loadedBundleCount++;
|
|
188
|
+
|
|
189
|
+
if (loadedBundleCount === totalBundleCount) {
|
|
190
|
+
this._preloadAssetInAssetBundle(resBatchListToLoad);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
resultKey = keys.next();
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private _preloadAssetsBundle(bundleName: string, endFunc: (isSuccess: boolean) => void): void {
|
|
198
|
+
if (endFunc === null) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
let resBundleInfo: ResBundleInfo = this.resBundleInfoMap.get(bundleName);
|
|
203
|
+
if (resBundleInfo === null) {
|
|
204
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetsBundle() : bundleName = " + bundleName + " [fail] resBundleInfo is null.");
|
|
205
|
+
endFunc(false);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (resBundleInfo.isBundleLoaded) {
|
|
210
|
+
if (this.abBundsMap.has(bundleName)) {
|
|
211
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetsBundle() : bundleName = " + bundleName + " [success] bundle already loaded.");
|
|
212
|
+
endFunc(true);
|
|
213
|
+
return;
|
|
214
|
+
} else {
|
|
215
|
+
resBundleInfo.isBundleLoaded = false;
|
|
216
|
+
this.resBundleInfoMap.set(bundleName, resBundleInfo);
|
|
217
|
+
}
|
|
218
|
+
} else {
|
|
219
|
+
if (this.abBundsMap.has(bundleName)) {
|
|
220
|
+
this.abBundsMap.delete(bundleName);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
assetManager.loadBundle(bundleName, (err: Error, bundle: AssetManager.Bundle) => {
|
|
225
|
+
if (err !== null) {
|
|
226
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetsBundle() : bundleName = " + bundleName + " [fail] load bundle failed." + err);
|
|
227
|
+
endFunc(false);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetsBundle() : bundleName = " + bundleName + " [success] load bundle succeed.");
|
|
232
|
+
this.abBundsMap.set(bundleName, bundle);
|
|
233
|
+
|
|
234
|
+
resBundleInfo.isBundleLoaded = true;
|
|
235
|
+
this.resBundleInfoMap.set(bundleName, resBundleInfo);
|
|
236
|
+
endFunc(true);
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
private _preloadAssetInAssetBundle(resBatchListToLoad: ResBatch[]): void {
|
|
241
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetInAssetBundle() resBatchListToLoad = " + resBatchListToLoad);
|
|
242
|
+
|
|
243
|
+
this.totalResCount = 0;
|
|
244
|
+
for (let index: number = 0; index < resBatchListToLoad.length; index++) {
|
|
245
|
+
let resBatch: ResBatch = resBatchListToLoad[index];
|
|
246
|
+
|
|
247
|
+
let resBatchInfo: ResBatchInfo = this.resBatchInfoMap.get(resBatch);
|
|
248
|
+
if (resBatchInfo === null) {
|
|
249
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetInAssetBundle() [fail] resBatchInfo is null.");
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
if (resBatchInfo.isBatchLoaded) {
|
|
254
|
+
continue;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
resBatchInfo.bundleLoadInfo.forEach((bundleLoadInfo: ResLoadInfo, bundleName: string) => {
|
|
258
|
+
this.totalResCount += bundleLoadInfo.totalResCount;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAssetInAssetBundle() totalResCount = " + this.totalResCount);
|
|
262
|
+
|
|
263
|
+
this.nowLoadedResCount = 0;
|
|
264
|
+
for (let index: number = 0; index < resBatchListToLoad.length; index++) {
|
|
265
|
+
let resBatch: ResBatch = resBatchListToLoad[index];
|
|
266
|
+
|
|
267
|
+
this.resBundleConfig.forEach((resBundleConfig: ResBundleConfig, bundleName: string) => {
|
|
268
|
+
if (resBundleConfig.resBatchUrlsMap.has(resBatch) &&
|
|
269
|
+
resBundleConfig.resBatchUrlsMap.get(resBatch) !== null) {
|
|
270
|
+
|
|
271
|
+
let resBatchInfo: ResBatchInfo = this.resBatchInfoMap.get(resBatch);
|
|
272
|
+
|
|
273
|
+
let resUrlList: string[] = resBundleConfig.resBatchUrlsMap.get(resBatch);
|
|
274
|
+
for (let index: number = 0; index < resUrlList.length; index++) {
|
|
275
|
+
let resUrl: string = resUrlList[index];
|
|
276
|
+
|
|
277
|
+
if (!this.abBundsMap.has(bundleName) || this.abBundsMap.get(bundleName) === null) {
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
let adBundle: AssetManager.Bundle = this.abBundsMap.get(bundleName);
|
|
281
|
+
let bundleLoadInfo: ResLoadInfo = resBatchInfo.bundleLoadInfo.get(bundleName);
|
|
282
|
+
|
|
283
|
+
this._preloadAsset(adBundle, resUrl, resBundleConfig.assetType, (isSuccess: boolean, error?: Error) => {
|
|
284
|
+
if (isSuccess) {
|
|
285
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAsset() bundleName = " + bundleName + ", resUrl = " + resUrl + " [success]");
|
|
286
|
+
this.nowLoadedResCount++;
|
|
287
|
+
|
|
288
|
+
bundleLoadInfo.loadedResCount++;
|
|
289
|
+
resBatchInfo.bundleLoadInfo.set(bundleName, bundleLoadInfo);
|
|
290
|
+
} else {
|
|
291
|
+
LogUtils.Instance.log(ResMgr.TAG, "_preloadAsset() bundleName = " + bundleName + ", resUrl = " + resUrl + ", [fail] " + error);
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
if (this.loadInProgressFunc) {
|
|
295
|
+
this.loadInProgressFunc(this.nowLoadedResCount, this.totalResCount);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
if (this.nowLoadedResCount === this.totalResCount) {
|
|
299
|
+
for (let index: number = 0; index < resBatchListToLoad.length; index++) {
|
|
300
|
+
let _resBatch: ResBatch = resBatchListToLoad[index];
|
|
301
|
+
let _resBatchInfo: ResBatchInfo = this.resBatchInfoMap.get(_resBatch);
|
|
302
|
+
_resBatchInfo.isBatchLoaded = true;
|
|
303
|
+
}
|
|
304
|
+
this.resBatchInfoMap.set(resBatch, resBatchInfo);
|
|
305
|
+
|
|
306
|
+
// this._printInfo();
|
|
307
|
+
|
|
308
|
+
if (this.loadEndFunc) {
|
|
309
|
+
this.loadEndFunc();
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
private _preloadAsset(abBundle: AssetManager.Bundle, resUrl: string, assetType: typeof Asset, endFunc: (isSuccess: boolean, error?: Error) => void): void {
|
|
320
|
+
if (endFunc === null) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
abBundle.load(resUrl, assetType, (error: Error | null, asset: Asset) => {
|
|
325
|
+
if (error) {
|
|
326
|
+
endFunc(false, error);
|
|
327
|
+
} else {
|
|
328
|
+
endFunc(true);
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
public getAsset<T extends Asset>(bundleName: string, url: string, assetType?: typeof Asset): T | null {
|
|
334
|
+
let bundle: AssetManager.Bundle = assetManager.getBundle(bundleName);
|
|
335
|
+
if (bundle === null) {
|
|
336
|
+
LogUtils.Instance.log(ResMgr.TAG, "getAsset() error: " + bundleName + " AssetsBundle not loaded");
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
if (!assetType) {
|
|
341
|
+
return bundle.get(url);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
return bundle.get(url, assetType) as T;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
public getBundleResCount(bundleName: string, path: string, assetType: typeof Asset): number {
|
|
348
|
+
let abBundle: AssetManager.Bundle = this.abBundsMap.get(bundleName);
|
|
349
|
+
if (abBundle === null) {
|
|
350
|
+
return 0;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const infos = [];
|
|
354
|
+
|
|
355
|
+
abBundle.getDirWithPath(path, assetType, infos);
|
|
356
|
+
|
|
357
|
+
return infos.length;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
public loadRes(bundleName: string, url: string, assetType: typeof Asset, callback: Function): void {
|
|
361
|
+
if (!callback) {
|
|
362
|
+
return;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (this.abBundsMap.has(bundleName)) {
|
|
366
|
+
this._loadRes(bundleName, url, assetType, callback);
|
|
367
|
+
return;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
assetManager.loadBundle(bundleName, (err, bundle) => {
|
|
371
|
+
if (err !== null) {
|
|
372
|
+
LogUtils.Instance.log(ResMgr.TAG, "loadAssetsBundle() error:" + bundleName);
|
|
373
|
+
|
|
374
|
+
if (this.abBundsMap.has(bundleName)) {
|
|
375
|
+
this.abBundsMap.delete(bundleName);
|
|
376
|
+
}
|
|
377
|
+
callback(false);
|
|
378
|
+
return;
|
|
379
|
+
} else {
|
|
380
|
+
LogUtils.Instance.log(ResMgr.TAG, "loadAssetsBundle() success:" + bundleName);
|
|
381
|
+
|
|
382
|
+
this.abBundsMap.set(bundleName, bundle);
|
|
383
|
+
this._loadRes(bundleName, url, assetType, callback);
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
private _loadRes(bundleName: string, url: string, assetType: typeof Asset, callback: Function): void {
|
|
389
|
+
let abBundle: AssetManager.Bundle = this.abBundsMap.get(bundleName);
|
|
390
|
+
if (abBundle === null) {
|
|
391
|
+
callback(false);
|
|
392
|
+
return;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
abBundle.load(url, assetType, (error: Error | null, asset: Asset) => {
|
|
396
|
+
if (error) {
|
|
397
|
+
LogUtils.Instance.log(ResMgr.TAG, "loadRes() " + url + " error: " + error);
|
|
398
|
+
callback(false);
|
|
399
|
+
} else {
|
|
400
|
+
LogUtils.Instance.log(ResMgr.TAG, "loadRes() " + url + " sucess");
|
|
401
|
+
callback(true);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/*
|
|
407
|
+
imageUrl: "https://xxxx"
|
|
408
|
+
fileSuffix: ".png"
|
|
409
|
+
*/
|
|
410
|
+
public loadRemoteImage(imageUrl: string, fileSuffix: string, callback: Function): void {
|
|
411
|
+
assetManager.loadRemote<ImageAsset>(imageUrl, {ext: fileSuffix}, (err: Error, data: ImageAsset) => {
|
|
412
|
+
if (err) {
|
|
413
|
+
LogUtils.Instance.log(ResMgr.TAG, err);
|
|
414
|
+
callback(err, null);
|
|
415
|
+
} else {
|
|
416
|
+
callback(null, data);
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
}
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
import { ShareInfo, ShareTemplateInfo } from "../Definition/SocialDefinition";
|
|
2
|
+
import { PlatformID } from "../Definition/SystemDefinition";
|
|
3
|
+
import { LogUtils } from "../Utils/LogUtils";
|
|
4
|
+
import { BaseMgr } from "./BaseMgr";
|
|
5
|
+
|
|
6
|
+
export class SocialMgr extends BaseMgr {
|
|
7
|
+
public static Instance: SocialMgr = null;
|
|
8
|
+
static TAG: string = "SocialMgr";
|
|
9
|
+
|
|
10
|
+
private shareInfo: ShareInfo = null;
|
|
11
|
+
|
|
12
|
+
onLoad(): void {
|
|
13
|
+
super.onLoad();
|
|
14
|
+
|
|
15
|
+
if (SocialMgr.Instance === null) {
|
|
16
|
+
SocialMgr.Instance = this;
|
|
17
|
+
} else {
|
|
18
|
+
this.destroy();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
public init(shareInfo: ShareInfo): void {
|
|
24
|
+
this.shareInfo = shareInfo;
|
|
25
|
+
|
|
26
|
+
LogUtils.Instance.log(SocialMgr.TAG, "init() finished.");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public supportPassiveShare(): boolean {
|
|
30
|
+
switch (this.getCurrentPlatformID()) {
|
|
31
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
32
|
+
case PlatformID.ID_MiniGame_DouYin:
|
|
33
|
+
case PlatformID.ID_MiniGame_KuaiShou:
|
|
34
|
+
case PlatformID.ID_MiniGame_ZhiFuBao:
|
|
35
|
+
case PlatformID.ID_MiniGame_TapTap:
|
|
36
|
+
case PlatformID.ID_MiniGame_Bilibili:
|
|
37
|
+
case PlatformID.ID_MiniGame_JingDong:
|
|
38
|
+
return true;
|
|
39
|
+
default:
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public supportActiveShare(): boolean {
|
|
45
|
+
switch (this.getCurrentPlatformID()) {
|
|
46
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
47
|
+
case PlatformID.ID_MiniGame_DouYin:
|
|
48
|
+
case PlatformID.ID_MiniGame_KuaiShou:
|
|
49
|
+
case PlatformID.ID_MiniGame_TapTap:
|
|
50
|
+
case PlatformID.ID_MiniGame_Bilibili:
|
|
51
|
+
case PlatformID.ID_MiniGame_JingDong:
|
|
52
|
+
return true;
|
|
53
|
+
default:
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
public configPassiveShare(title?: string, desc?: string, imageUrl?: string, templateId?: string, query?: string): void {
|
|
59
|
+
if (!desc || desc.length === 0) {
|
|
60
|
+
desc = this.shareInfo.defaultInfo.desc;
|
|
61
|
+
}
|
|
62
|
+
if (!title || title.length === 0) {
|
|
63
|
+
title = this.shareInfo.defaultInfo.title;
|
|
64
|
+
}
|
|
65
|
+
if (this.getCurrentPlatformID() === PlatformID.ID_MiniGame_WeiXin) {
|
|
66
|
+
title = desc;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!templateId || templateId.length === 0) {
|
|
70
|
+
let currentPlatformID: PlatformID = this.getCurrentPlatformID();
|
|
71
|
+
if (this.shareInfo.templateInfoMap.has(currentPlatformID)) {
|
|
72
|
+
let templateInfo: ShareTemplateInfo = this.shareInfo.templateInfoMap.get(currentPlatformID);
|
|
73
|
+
if (templateInfo.templateId !== "") {
|
|
74
|
+
templateId = templateInfo.templateId;
|
|
75
|
+
|
|
76
|
+
if (this.getCurrentPlatformID() === PlatformID.ID_MiniGame_DouYin) {
|
|
77
|
+
title = "";
|
|
78
|
+
desc = "";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (templateInfo.imageUrl !== "") {
|
|
82
|
+
imageUrl = templateInfo.imageUrl;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (!imageUrl || imageUrl.length === 0) {
|
|
88
|
+
imageUrl = this.shareInfo.defaultInfo.imageUrl;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (this.getPlatformAdapter() === null) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
this.getPlatformAdapter().configPassiveShare(title, desc, imageUrl, templateId, query);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
public activeShareToFriend(callback?: Function, title?: string, desc?: string, imageUrl?: string, templateId?: string, query?: string): void {
|
|
98
|
+
if (!desc || desc.length === 0) {
|
|
99
|
+
desc = this.shareInfo.defaultInfo.desc;
|
|
100
|
+
}
|
|
101
|
+
if (!title || title.length === 0) {
|
|
102
|
+
title = this.shareInfo.defaultInfo.title;
|
|
103
|
+
}
|
|
104
|
+
if (this.getCurrentPlatformID() === PlatformID.ID_MiniGame_WeiXin) {
|
|
105
|
+
title = desc;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (!templateId || templateId.length === 0) {
|
|
109
|
+
let currentPlatformID: PlatformID = this.getCurrentPlatformID();
|
|
110
|
+
if (this.shareInfo.templateInfoMap.has(currentPlatformID)) {
|
|
111
|
+
let templateInfo: ShareTemplateInfo = this.shareInfo.templateInfoMap.get(currentPlatformID);
|
|
112
|
+
if (templateInfo.templateId !== "") {
|
|
113
|
+
templateId = templateInfo.templateId;
|
|
114
|
+
}
|
|
115
|
+
if (templateInfo.imageUrl !== "") {
|
|
116
|
+
imageUrl = templateInfo.imageUrl;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!imageUrl || imageUrl.length === 0) {
|
|
122
|
+
imageUrl = this.shareInfo.defaultInfo.imageUrl;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (this.getPlatformAdapter() === null) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
this.getPlatformAdapter().activeShareToFriend(callback, title, desc, imageUrl, templateId, query);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public supportRankList(): boolean {
|
|
132
|
+
switch (this.getCurrentPlatformID()) {
|
|
133
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
134
|
+
case PlatformID.ID_MiniGame_DouYin:
|
|
135
|
+
case PlatformID.ID_MiniGame_TapTap:
|
|
136
|
+
return true;
|
|
137
|
+
default:
|
|
138
|
+
return false;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
public setRankData(args: any[]): void {
|
|
143
|
+
if (!this.supportRankList()) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
if (this.getPlatformAdapter() === null) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.getPlatformAdapter().setRankData(args);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
public showRankList(args: any[]): void {
|
|
154
|
+
if (!this.supportRankList()) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
if (this.getPlatformAdapter() === null) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
this.getPlatformAdapter().showRankList(args);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
public openPortalGame(): void {
|
|
165
|
+
if (this.getPlatformAdapter() === null) {
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
this.getPlatformAdapter().openPortalGame();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
public supportGameClub(): boolean {
|
|
172
|
+
switch (this.getCurrentPlatformID()) {
|
|
173
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
174
|
+
case PlatformID.ID_MiniGame_DouYin:
|
|
175
|
+
return true;
|
|
176
|
+
default:
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
public openGameClub(): void {
|
|
182
|
+
if (!this.supportGameClub()) {
|
|
183
|
+
return;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
if (this.getPlatformAdapter() === null) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
this.getPlatformAdapter().openGameClub();
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
public supportRecommendToFriend(): boolean {
|
|
193
|
+
switch (this.getCurrentPlatformID()) {
|
|
194
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
195
|
+
case PlatformID.ID_MiniGame_DouYin:
|
|
196
|
+
case PlatformID.ID_MiniGame_KuaiShou:
|
|
197
|
+
case PlatformID.ID_MiniGame_TapTap:
|
|
198
|
+
case PlatformID.ID_MiniGame_Bilibili:
|
|
199
|
+
case PlatformID.ID_MiniGame_JingDong:
|
|
200
|
+
return true;
|
|
201
|
+
default:
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public openRecommendToFriend(): void {
|
|
207
|
+
if (!this.supportRecommendToFriend()) {
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
if (this.getPlatformAdapter() === null) {
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
switch (this.getCurrentPlatformID()) {
|
|
216
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
217
|
+
case PlatformID.ID_MiniGame_DouYin:
|
|
218
|
+
this.getPlatformAdapter().openRecommendToFriend();
|
|
219
|
+
break;
|
|
220
|
+
case PlatformID.ID_MiniGame_KuaiShou:
|
|
221
|
+
case PlatformID.ID_MiniGame_Bilibili:
|
|
222
|
+
case PlatformID.ID_MiniGame_TapTap:
|
|
223
|
+
case PlatformID.ID_MiniGame_JingDong:
|
|
224
|
+
this.activeShareToFriend();
|
|
225
|
+
break;
|
|
226
|
+
default:
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
public supportRecommendToGameClub(): boolean {
|
|
232
|
+
switch (this.getCurrentPlatformID()) {
|
|
233
|
+
case PlatformID.ID_MiniGame_WeiXin:
|
|
234
|
+
return true;
|
|
235
|
+
default:
|
|
236
|
+
return false;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
public openRecommendToGameClub(): void {
|
|
241
|
+
if (!this.supportRecommendToGameClub()) {
|
|
242
|
+
return;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (this.getPlatformAdapter() === null) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
this.getPlatformAdapter().openRecommendToGameClub();
|
|
249
|
+
}
|
|
250
|
+
}
|