@chiyou/minigame-framework 1.4.3 → 1.4.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chiyou/minigame-framework",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "基于 Cocos Creator 3.x 的小游戏开发框架,支持多平台发布",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -107,6 +107,11 @@ export abstract class AbsPlatformAdapter extends Component{
107
107
  return this.getWarmStartSceneInfo().category;
108
108
  }
109
109
 
110
+ /** 判断是否从指定分类启动(兼容原 isLaunchFromRecentUse/isLaunchFromDesktopShortcut/isLaunchFromAdvertisement) */
111
+ public isLaunchFrom(category: LaunchCategory): boolean {
112
+ return this.getLaunchCategory() === category;
113
+ }
114
+
110
115
  abstract isNavigateToRecentUseAvailable(callback: Function): void;
111
116
 
112
117
  abstract navigateToRecentUse(): void;
@@ -203,4 +203,13 @@ export class LifeCycleMgr extends BaseMgr {
203
203
 
204
204
  return this.getPlatformAdapter().getLaunchCategory();
205
205
  }
206
+
207
+ /** 判断是否从指定分类启动 */
208
+ public isLaunchFrom(category: string): boolean {
209
+ if (this.getPlatformAdapter() === null) {
210
+ return false;
211
+ }
212
+
213
+ return this.getPlatformAdapter().isLaunchFrom(category as any);
214
+ }
206
215
  }