@shimotsuki/core 2.0.38 → 2.0.39

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.
Files changed (2) hide show
  1. package/dist/index.js +13 -11
  2. package/package.json +1 -1
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shimotsuki/core",
3
- "version": "2.0.38",
3
+ "version": "2.0.39",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",