@cc-component/cc-core 1.5.8 → 1.6.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.
@@ -32,7 +32,7 @@ export class LayerUI {
32
32
  bundleName: string = "";
33
33
 
34
34
  loading_call: { open: (finish: () => void) => void, close: () => void }
35
- progess: { open: (finish: () => void) => void, close: () => void, progess: (progress: number, time?: number) => void }
35
+ progess: { open: (param: ISceneParam, finish: () => void) => void, close: (param: ISceneParam) => void, progess: (param: ISceneParam, progress: number, time?: number) => void }
36
36
 
37
37
  scene: ISceneParam
38
38
  launch: BaseLaunchComponent;
@@ -47,14 +47,14 @@ export abstract class BaseLoading extends Component {
47
47
  const count = this.path_list.length;
48
48
  const ratio = 1 / count * this.progress_ratio;
49
49
  this.pro_total = 0;
50
- App.gui.progess.progess?.(0)//进度在OpenScene方法中先打开才可以 设置进度
50
+ App.gui.progess.progess?.(App.scenesParm.param, 0)//进度在OpenScene方法中先打开才可以 设置进度
51
51
  for (let index = 0; index < this.path_list.length; index++) {
52
52
  const key_path = this.path_list[index];
53
53
  let temp_pro = 0;
54
54
  await App.LoadDir(BundleConfig[key_path.bundleName], key_path.path, GetAssetType(key_path.type), (pro: number) => {
55
55
  temp_pro = pro * ratio
56
56
  const progess = (this.pro_total + pro * ratio)
57
- App.gui.progess.progess?.(progess)//进度在OpenScene方法中先打开才可以 设置进度
57
+ App.gui.progess.progess?.(App.scenesParm.param, progess)//进度在OpenScene方法中先打开才可以 设置进度
58
58
  })
59
59
  this.pro_total = (this.pro_total + temp_pro)
60
60
  }
@@ -79,12 +79,12 @@ export abstract class BaseLoading extends Component {
79
79
  addProgess(progess: number, total: number): void {
80
80
  const pro = this.getRemainingProgress(total)
81
81
  this.pro_total += (pro * progess)
82
- App.gui.progess.progess?.(this.pro_total)
82
+ App.gui.progess.progess?.(App.scenesParm.param, this.pro_total)
83
83
  }
84
84
 
85
85
  resetProgess() {
86
86
  this.pro_total = 0
87
- App.gui.progess.progess?.(this.pro_total, 0)
87
+ App.gui.progess.progess?.(App.scenesParm.param, this.pro_total, 0)
88
88
  }
89
89
 
90
90
  /**获取剩余进度 */
@@ -92,7 +92,7 @@ export abstract class BaseLoading extends Component {
92
92
  return ((total) - this.pro_total / 100) * 100
93
93
  }
94
94
  FinishLoad() {
95
- App.gui.progess.close?.()
95
+ App.gui.progess.close?.(App.scenesParm.param)
96
96
  if (DEBUG) {
97
97
  ResourceManager.instance.LogAssetsAll()
98
98
  }
@@ -109,10 +109,10 @@ export abstract class BaseLoading extends Component {
109
109
  if (progress >= 100) {
110
110
  progress = 100;
111
111
  clearInterval(timer);
112
- App.gui.progess.progess?.(progress);
112
+ App.gui.progess.progess?.(App.scenesParm.param, progress);
113
113
  resolve();
114
114
  } else {
115
- App.gui.progess.progess?.(progress);
115
+ App.gui.progess.progess?.(App.scenesParm.param, progress);
116
116
  }
117
117
  }, intervalMs);
118
118
  });
@@ -308,11 +308,11 @@ export class ResourceManager {
308
308
  return new Promise<T>((resolve, reject) => {
309
309
  bundle.load(path, type, (err, asset) => {
310
310
  if (err) {
311
- console.error(`${bundleName}-加载资源失败: ${path}`);
311
+ Logger.error(`${bundleName}-加载资源失败: ${path}`);
312
312
  resolve(null);
313
313
  return;
314
314
  }
315
- Logger.debug('--加载', path)
315
+ //Logger.debug('--加载', path)
316
316
  // 记录加载的资源
317
317
  ResourceManager.instance.trackAsset(path, asset, bundleName);
318
318
  ResourceManager.instance.LogAssets(bundleName)
@@ -147,7 +147,7 @@ export class App {
147
147
  //#region 监听模块消息
148
148
  static OnRequstNet(param: { open: (finish: (isOk: boolean) => void) => void }) { App.http.param = param; }
149
149
  static OnLoading(param: { open: (finish: () => void) => void, close: () => void }) { App.gui.loading_call = param; }
150
- static OnProgess(param: { open: (finish: () => void) => void, close: () => void, progess: (progress: number) => void }) { App.gui.progess = param; }
150
+ static OnProgess(param: { open: (param: ISceneParam, finish: () => void) => void, close: (param: ISceneParam) => void, progess: (param: ISceneParam, progress: number, time?: number) => void }) { App.gui.progess = param; }
151
151
 
152
152
  static async Requst<T>(config: IHttpConfig, params?: any, ext?: IExtData): Promise<{ code: number, data: T, msg: string }> {
153
153
  return new Promise<{ code: number, data: T, msg: string }>(async (originalResolve, originalReject) => {
@@ -363,7 +363,7 @@ export class App {
363
363
 
364
364
  static async OpenScene(param: ISceneParam) {
365
365
  App.OpenBlockEvents(LayerType.LayerBlockEventsUI, true)
366
- await new Promise<void>(resolve => { App.gui.progess?.open?.(() => { resolve() }) })
366
+ await new Promise<void>(resolve => { App.gui.progess?.open?.(param, () => { resolve() }) })
367
367
  //关闭所有窗口
368
368
  await App.CloseAll([LayerType.LayerUI, LayerType.LayerDialog, LayerType.LayerPopUp, LayerType.LayerGame])
369
369
  App.scenesParm.param = param
@@ -51,7 +51,7 @@ declare global {
51
51
  function InitGameConfig(param: IInitConfig): Promise<void>;
52
52
  /**=====================================⚠️⚠️⚠️ 必须实现的监听======================= */
53
53
  /**监听:打开场景加载进度窗口 -open 回调方法需要执行 finish() 方法 */
54
- function OnProgess(param: { open: (finish: () => void) => void, close: () => void, progess: (progress: number, time?: number) => void })
54
+ function OnProgess(param: { open: (param: ISceneParam, finish: () => void) => void, close: (param: ISceneParam) => void, progess: (param: ISceneParam, progress: number, time?: number) => void })
55
55
  /**监听:显示加载动画 -open 回调方法需要执行 finish() 方法 */
56
56
  function OnLoading(param: { open: (finish: () => void) => void, close: () => void })
57
57
  /**监听:是否打开网络接口重连窗口 -open 回调方法需要执行 finish() 方法 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cc-component/cc-core",
3
- "version": "1.5.8",
3
+ "version": "1.6.0",
4
4
  "engine": ">=3.8.6",
5
5
  "description": "系统组件添加常用扩展方法",
6
6
  "main": "index.ts",