@shimotsuki/core 2.0.38 → 2.0.40

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/dist/index.d.ts CHANGED
@@ -1038,5 +1038,11 @@ declare class Manager {
1038
1038
  merge<K extends keyof Manager, T extends object>(target: K, source: T): this;
1039
1039
  }
1040
1040
  declare const cat: Manager;
1041
+ declare global {
1042
+ namespace globalThis {
1043
+ /**核心框架 */
1044
+ var cat: Manager;
1045
+ }
1046
+ }
1041
1047
 
1042
1048
  export { AudioEffect, AudioEventConstant, AudioManager, AudioSourceBaseComponent, AudioSourceUILayer, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, BaseStore, ButtonLock, CoreBlackMask, CoreNotice, type CoreNoticeProps, CoreReconnection, CoreShowLoading, type CoreShowLoadingProps, CoreStore, CoreToast, CoreUIContainer, CoreUIModal, type CoreUIModalProps, CoreUtil, GlobalEventConstant, Gui, GuiManager, type HOOK, type ICloseOptions, type IDirection, type IOpenOptions, type IUIOption, LayerType, Manager, ReconnectPrompt, RootUILayer, type SceneComponentType, type SceneDataType, SceneLayer, type ScenePropsType, TimerManager, type ToastProps, ToastType, type UIComponentType, UILayer, WrapperSocialGameClient, cat };
package/dist/index.js CHANGED
@@ -2421,10 +2421,10 @@ class SocialGameClientManager extends BaseManager {
2421
2421
  case 'show':
2422
2422
  this.isInBackground = false;
2423
2423
  await this.triggerReconnectAll();
2424
- await this.onEventHideDelegate.dispatch();
2424
+ await this.onEventShowDelegate.dispatch();
2425
2425
  break;
2426
2426
  case 'hide':
2427
- await this.onEventShowDelegate.dispatch();
2427
+ await this.onEventHideDelegate.dispatch();
2428
2428
  this.isInBackground = true;
2429
2429
  this.disconnectAll(true);
2430
2430
  break;
@@ -2450,15 +2450,6 @@ class SocialGameClientManager extends BaseManager {
2450
2450
  cat.gui.showToast({ title: `${client.name}服重连失败` });
2451
2451
  // 不抛出错误,让 Promise.allSettled 收集结果
2452
2452
  }
2453
- try {
2454
- // 2. 执行业务层连接请求
2455
- await client.connectRequest();
2456
- }
2457
- catch (err) {
2458
- error(`${client.name}服登录错误`, err);
2459
- cat.gui.showToast({ title: `登录${client.name}服错误` });
2460
- // 同样不抛出错误
2461
- }
2462
2453
  }));
2463
2454
  // 检查是否有客户端未成功连接
2464
2455
  const failedClients = this.activeClients.filter(client => client.socketConnectStatus !== SocketConnectStatus.CONNECTED);
@@ -2481,6 +2472,17 @@ class SocialGameClientManager extends BaseManager {
2481
2472
  handleSingleReconnect = async () => {
2482
2473
  if (this.activeClients.every(client => client.socketConnectStatus === SocketConnectStatus.CONNECTED)) {
2483
2474
  log('单个WS重连成功回调===', this.managedClients);
2475
+ await Promise.allSettled(this.activeClients.map(async (client) => {
2476
+ // 连接社交游戏服务
2477
+ try {
2478
+ // 2. 执行业务层连接请求
2479
+ await client.connectRequest();
2480
+ }
2481
+ catch (err) {
2482
+ error(`${client.name}服登录错误`, err);
2483
+ cat.gui.showToast({ title: `登录${client.name}服错误` });
2484
+ }
2485
+ }));
2484
2486
  await this.onEventReloadSceneDelegate.dispatch();
2485
2487
  cat.gui.hideLoading().reloadScene();
2486
2488
  }
@@ -2912,6 +2914,7 @@ class Manager {
2912
2914
  }
2913
2915
  }
2914
2916
  const cat = Manager.instance;
2917
+ globalThis.cat = cat;
2915
2918
  /**
2916
2919
  * 项目数据初始化之后的处理APP初始化事务
2917
2920
  * 执行顺序 onAppInitDelegate -> onPlugInInitDelegate
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shimotsuki/core",
3
- "version": "2.0.38",
3
+ "version": "2.0.40",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",