@shimotsuki/core 2.0.36 → 2.0.38

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
@@ -785,6 +785,7 @@ declare class SocialGameClientManager extends BaseManager {
785
785
  private isInBackground;
786
786
  readonly onEventHideDelegate: AsyncDelegate<() => (Promise<void> | void)>;
787
787
  readonly onEventShowDelegate: AsyncDelegate<() => (Promise<void> | void)>;
788
+ readonly onEventReloadSceneDelegate: AsyncDelegate<() => (Promise<void> | void)>;
788
789
  get activeClients(): WrapperSocialGameClient[];
789
790
  constructor(cat: Manager);
790
791
  /**
@@ -1024,10 +1025,12 @@ declare class Manager {
1024
1025
  get store(): CoreStore;
1025
1026
  get gui_bundle_name(): string;
1026
1027
  get audio_local_store_key(): string;
1028
+ get default_audio_effect(): string;
1027
1029
  /**GUI资源配置 */
1028
- setConfig: ({ gui_bundleName, audio_local_store_key }?: {
1030
+ setConfig: ({ default_audio_effect, gui_bundleName, audio_local_store_key }?: {
1029
1031
  gui_bundleName?: string;
1030
1032
  audio_local_store_key?: string;
1033
+ default_audio_effect?: string;
1031
1034
  }) => this;
1032
1035
  /**启动 */
1033
1036
  boot(): Promise<void>;
package/dist/index.js CHANGED
@@ -2350,6 +2350,7 @@ class SocialGameClientManager extends BaseManager {
2350
2350
  isInBackground = false;
2351
2351
  onEventHideDelegate = new AsyncDelegate();
2352
2352
  onEventShowDelegate = new AsyncDelegate();
2353
+ onEventReloadSceneDelegate = new AsyncDelegate();
2353
2354
  get activeClients() {
2354
2355
  return Array.from(this.managedClients)
2355
2356
  .map(([_, client]) => client)
@@ -2477,9 +2478,10 @@ class SocialGameClientManager extends BaseManager {
2477
2478
  });
2478
2479
  }
2479
2480
  // 单个WS重连成功回调
2480
- handleSingleReconnect = () => {
2481
+ handleSingleReconnect = async () => {
2481
2482
  if (this.activeClients.every(client => client.socketConnectStatus === SocketConnectStatus.CONNECTED)) {
2482
2483
  log('单个WS重连成功回调===', this.managedClients);
2484
+ await this.onEventReloadSceneDelegate.dispatch();
2483
2485
  cat.gui.hideLoading().reloadScene();
2484
2486
  }
2485
2487
  };
@@ -2764,8 +2766,9 @@ const AudioEffect = (effect, callBackFun) => {
2764
2766
  return (_target, _propertyKey, descriptor) => {
2765
2767
  let oldFun = descriptor.value;
2766
2768
  descriptor.value = function (...args) {
2767
- if (effect) {
2768
- cat.audio.playEffect(effect);
2769
+ const _effect = effect ?? cat.default_audio_effect;
2770
+ if (_effect) {
2771
+ cat.audio.playEffect(_effect);
2769
2772
  }
2770
2773
  else {
2771
2774
  console.warn(`请添加音效路径参数`);
@@ -2860,13 +2863,17 @@ class Manager {
2860
2863
  /**音效本地存储key */
2861
2864
  #audio_local_store_key = '';
2862
2865
  get audio_local_store_key() { return this.#audio_local_store_key; }
2866
+ /**默认音效路径 */
2867
+ #default_audio_effect = '';
2868
+ get default_audio_effect() { return this.#default_audio_effect; }
2863
2869
  /**GUI资源配置 */
2864
- setConfig = ({ gui_bundleName = 'resources', audio_local_store_key = 'game_audio' } = {}) => {
2870
+ setConfig = ({ default_audio_effect = '', gui_bundleName = 'resources', audio_local_store_key = 'game_audio' } = {}) => {
2865
2871
  if (this.#initialized) {
2866
2872
  throw new Error('[CAT] 已初始化,无法修改配置');
2867
2873
  }
2868
2874
  this.#gui_bundle_name = gui_bundleName;
2869
2875
  this.#audio_local_store_key = audio_local_store_key;
2876
+ this.#default_audio_effect = default_audio_effect;
2870
2877
  return this;
2871
2878
  };
2872
2879
  /**启动 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shimotsuki/core",
3
- "version": "2.0.36",
3
+ "version": "2.0.38",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",