@chiyou/minigame-framework 1.4.8 → 1.4.10

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.8",
3
+ "version": "1.4.10",
4
4
  "description": "基于 Cocos Creator 3.x 的小游戏开发框架,支持多平台发布",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -263,10 +263,10 @@ export class AdMgr extends BaseMgr {
263
263
  const scene = AdMgr.nowRewardedVideoAdScene;
264
264
  switch (res) {
265
265
  case RewardedVideoAd_Callback_Status.Status_LoadSuccess:
266
- analytics?.trackAdLoadSuccess(scene);
266
+ analytics?.trackAdLoadSuccess();
267
267
  break;
268
268
  case RewardedVideoAd_Callback_Status.Status_LoadError:
269
- analytics?.trackAdLoadError(scene, errCode ?? 0, errMsg ?? '');
269
+ analytics?.trackAdLoadError(errCode ?? 0, errMsg ?? '');
270
270
  break;
271
271
  case RewardedVideoAd_Callback_Status.Status_Show_Watching:
272
272
  analytics?.trackAdShow(scene);
@@ -396,25 +396,22 @@ export class AnalyticsMgr extends BaseMgr {
396
396
 
397
397
  /**
398
398
  * 广告加载成功
399
- * @param adScene 广告场景(业务自定义,如 revive / daily_bonus)
399
+ * 注意:广告是预加载的,加载时尚未确定场景,因此不上报 ad_scene
400
400
  */
401
- public trackAdLoadSuccess(adScene: string): void {
401
+ public trackAdLoadSuccess(): void {
402
402
  if (!this._isEnabled) return;
403
- this.trackEvent(AnalyticsEventId.AdLoadSuccess, {
404
- [AnalyticsParamKey.AdScene]: adScene,
405
- });
403
+ this.trackEvent(AnalyticsEventId.AdLoadSuccess);
406
404
  }
407
405
 
408
406
  /**
409
407
  * 广告加载失败
410
- * @param adScene 广告场景
408
+ * 注意:广告是预加载的,加载时尚未确定场景,因此不上报 ad_scene
411
409
  * @param errCode 错误码
412
410
  * @param errMsg 错误信息
413
411
  */
414
- public trackAdLoadError(adScene: string, errCode: number, errMsg: string): void {
412
+ public trackAdLoadError(errCode: number, errMsg: string): void {
415
413
  if (!this._isEnabled) return;
416
414
  this.trackEvent(AnalyticsEventId.AdLoadError, {
417
- [AnalyticsParamKey.AdScene]: adScene,
418
415
  [AnalyticsParamKey.ErrCode]: errCode,
419
416
  [AnalyticsParamKey.ErrMsg]: errMsg,
420
417
  });
@@ -3,6 +3,7 @@ import { LogUtils } from "../Utils/LogUtils";
3
3
  import { ServiceLocator } from "../Utils/ServiceLocator";
4
4
  import { BaseMgr } from "./BaseMgr";
5
5
  import { EventMgr } from "./EventMgr";
6
+ import { LaunchCategory } from "../Definition/AnalyticsDefinition";
6
7
  import type { AnalyticsMgr } from "./AnalyticsMgr";
7
8
 
8
9
  /** 生命周期管理器 */
@@ -181,7 +182,7 @@ export class LifeCycleMgr extends BaseMgr {
181
182
  }
182
183
 
183
184
  /** 获取冷启动场景信息 */
184
- public getColdStartSceneInfo(): { scene: string; category: string } | null {
185
+ public getColdStartSceneInfo(): { scene: string; category: LaunchCategory } | null {
185
186
  if (this.getPlatformAdapter() === null) {
186
187
  return null;
187
188
  }
@@ -190,7 +191,7 @@ export class LifeCycleMgr extends BaseMgr {
190
191
  }
191
192
 
192
193
  /** 获取热启动场景信息 */
193
- public getWarmStartSceneInfo(): { scene: string; category: string } | null {
194
+ public getWarmStartSceneInfo(): { scene: string; category: LaunchCategory } | null {
194
195
  if (this.getPlatformAdapter() === null) {
195
196
  return null;
196
197
  }
@@ -199,7 +200,7 @@ export class LifeCycleMgr extends BaseMgr {
199
200
  }
200
201
 
201
202
  /** 获取当前启动场景分类(兼容原 isLaunchFromXxx 逻辑) */
202
- public getLaunchCategory(): string | null {
203
+ public getLaunchCategory(): LaunchCategory | null {
203
204
  if (this.getPlatformAdapter() === null) {
204
205
  return null;
205
206
  }
@@ -208,11 +209,11 @@ export class LifeCycleMgr extends BaseMgr {
208
209
  }
209
210
 
210
211
  /** 判断是否从指定分类启动 */
211
- public isLaunchFrom(category: string): boolean {
212
+ public isLaunchFrom(category: LaunchCategory): boolean {
212
213
  if (this.getPlatformAdapter() === null) {
213
214
  return false;
214
215
  }
215
216
 
216
- return this.getPlatformAdapter().isLaunchFrom(category as any);
217
+ return this.getPlatformAdapter().isLaunchFrom(category);
217
218
  }
218
219
  }