@shimotsuki/core 2.0.35 → 2.0.36

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
@@ -999,6 +999,9 @@ declare class TimerManager extends BaseManager {
999
999
  private update;
1000
1000
  }
1001
1001
 
1002
+ declare const AudioEffect: <T extends string>(effect?: T, callBackFun?: Function) => MethodDecorator;
1003
+ declare const ButtonLock: (lockTime?: number, callBackFun?: Function) => (_target: any, _propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor;
1004
+
1002
1005
  /**
1003
1006
  * @describe 管理类
1004
1007
  * @author 游金宇(KM)
@@ -1033,4 +1036,4 @@ declare class Manager {
1033
1036
  }
1034
1037
  declare const cat: Manager;
1035
1038
 
1036
- export { AudioEventConstant, AudioManager, AudioSourceBaseComponent, AudioSourceUILayer, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, BaseStore, 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 };
1039
+ 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
@@ -31,7 +31,7 @@ const { ccclass: ccclass$b, menu: menu$9 } = _decorator;
31
31
  * 注:用playOneShot播放的音乐效果,在播放期间暂时没办法即时关闭音乐
32
32
  */
33
33
  /** 游戏音效 */
34
- class AudioEffect extends CommonAudio {
34
+ let AudioEffect$1 = class AudioEffect extends CommonAudio {
35
35
  effects = new Map();
36
36
  /**
37
37
  * 加载音效并播放
@@ -57,7 +57,7 @@ class AudioEffect extends CommonAudio {
57
57
  }
58
58
  this.effects.clear();
59
59
  }
60
- }
60
+ };
61
61
 
62
62
  /**
63
63
  * @describe 音乐
@@ -185,7 +185,7 @@ class AudioManager extends BaseManager {
185
185
  this.music = music.addComponent(AudioMusic).initAudio(cat);
186
186
  var effect = new Node('UIEffect');
187
187
  effect.parent = node;
188
- this.effect = effect.addComponent(AudioEffect).initAudio(cat);
188
+ this.effect = effect.addComponent(AudioEffect$1).initAudio(cat);
189
189
  this.load();
190
190
  }
191
191
  /**
@@ -2760,6 +2760,45 @@ class TimerManager extends BaseManager {
2760
2760
  }
2761
2761
  }
2762
2762
 
2763
+ const AudioEffect = (effect, callBackFun) => {
2764
+ return (_target, _propertyKey, descriptor) => {
2765
+ let oldFun = descriptor.value;
2766
+ descriptor.value = function (...args) {
2767
+ if (effect) {
2768
+ cat.audio.playEffect(effect);
2769
+ }
2770
+ else {
2771
+ console.warn(`请添加音效路径参数`);
2772
+ }
2773
+ if (callBackFun) {
2774
+ callBackFun();
2775
+ }
2776
+ oldFun.apply(this, args);
2777
+ };
2778
+ return descriptor;
2779
+ };
2780
+ };
2781
+ const ButtonLock = (lockTime = 1, callBackFun) => {
2782
+ return function (_target, _propertyKey, descriptor) {
2783
+ let oldFun = descriptor.value;
2784
+ let isLock = false;
2785
+ descriptor.value = function (...args) {
2786
+ if (isLock) {
2787
+ if (callBackFun) {
2788
+ callBackFun();
2789
+ }
2790
+ return;
2791
+ }
2792
+ isLock = true;
2793
+ setTimeout(() => {
2794
+ isLock = false;
2795
+ }, lockTime * 1000);
2796
+ oldFun.apply(this, args);
2797
+ };
2798
+ return descriptor;
2799
+ };
2800
+ };
2801
+
2763
2802
  /**
2764
2803
  * @describe 管理类
2765
2804
  * @author 游金宇(KM)
@@ -2886,4 +2925,4 @@ game.onPostProjectInitDelegate.add(async () => {
2886
2925
  }
2887
2926
  });
2888
2927
 
2889
- export { AudioEventConstant, AudioManager, AudioSourceBaseComponent, AudioSourceUILayer, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, BaseStore, CoreBlackMask, CoreNotice, CoreReconnection, CoreShowLoading, CoreStore, CoreToast, CoreUIContainer, CoreUIModal, CoreUtil, GlobalEventConstant, Gui, GuiManager, LayerType, Manager, ReconnectPrompt, RootUILayer, SceneLayer, TimerManager, ToastType, UILayer, WrapperSocialGameClient, cat };
2928
+ export { AudioEffect, AudioEventConstant, AudioManager, AudioSourceBaseComponent, AudioSourceUILayer, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, BaseStore, ButtonLock, CoreBlackMask, CoreNotice, CoreReconnection, CoreShowLoading, CoreStore, CoreToast, CoreUIContainer, CoreUIModal, CoreUtil, GlobalEventConstant, Gui, GuiManager, LayerType, Manager, ReconnectPrompt, RootUILayer, SceneLayer, TimerManager, ToastType, UILayer, WrapperSocialGameClient, cat };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shimotsuki/core",
3
- "version": "2.0.35",
3
+ "version": "2.0.36",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",