@shimotsuki/core 2.0.35 → 2.0.37
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 +7 -2
- package/dist/index.js +49 -5
- package/package.json +1 -1
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)
|
|
@@ -1021,10 +1024,12 @@ declare class Manager {
|
|
|
1021
1024
|
get store(): CoreStore;
|
|
1022
1025
|
get gui_bundle_name(): string;
|
|
1023
1026
|
get audio_local_store_key(): string;
|
|
1027
|
+
get default_audio_effect(): string;
|
|
1024
1028
|
/**GUI资源配置 */
|
|
1025
|
-
setConfig: ({ gui_bundleName, audio_local_store_key }?: {
|
|
1029
|
+
setConfig: ({ default_audio_effect, gui_bundleName, audio_local_store_key }?: {
|
|
1026
1030
|
gui_bundleName?: string;
|
|
1027
1031
|
audio_local_store_key?: string;
|
|
1032
|
+
default_audio_effect?: string;
|
|
1028
1033
|
}) => this;
|
|
1029
1034
|
/**启动 */
|
|
1030
1035
|
boot(): Promise<void>;
|
|
@@ -1033,4 +1038,4 @@ declare class Manager {
|
|
|
1033
1038
|
}
|
|
1034
1039
|
declare const cat: Manager;
|
|
1035
1040
|
|
|
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 };
|
|
1041
|
+
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,46 @@ 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
|
+
const _effect = effect ?? cat.default_audio_effect;
|
|
2768
|
+
if (_effect) {
|
|
2769
|
+
cat.audio.playEffect(_effect);
|
|
2770
|
+
}
|
|
2771
|
+
else {
|
|
2772
|
+
console.warn(`请添加音效路径参数`);
|
|
2773
|
+
}
|
|
2774
|
+
if (callBackFun) {
|
|
2775
|
+
callBackFun();
|
|
2776
|
+
}
|
|
2777
|
+
oldFun.apply(this, args);
|
|
2778
|
+
};
|
|
2779
|
+
return descriptor;
|
|
2780
|
+
};
|
|
2781
|
+
};
|
|
2782
|
+
const ButtonLock = (lockTime = 1, callBackFun) => {
|
|
2783
|
+
return function (_target, _propertyKey, descriptor) {
|
|
2784
|
+
let oldFun = descriptor.value;
|
|
2785
|
+
let isLock = false;
|
|
2786
|
+
descriptor.value = function (...args) {
|
|
2787
|
+
if (isLock) {
|
|
2788
|
+
if (callBackFun) {
|
|
2789
|
+
callBackFun();
|
|
2790
|
+
}
|
|
2791
|
+
return;
|
|
2792
|
+
}
|
|
2793
|
+
isLock = true;
|
|
2794
|
+
setTimeout(() => {
|
|
2795
|
+
isLock = false;
|
|
2796
|
+
}, lockTime * 1000);
|
|
2797
|
+
oldFun.apply(this, args);
|
|
2798
|
+
};
|
|
2799
|
+
return descriptor;
|
|
2800
|
+
};
|
|
2801
|
+
};
|
|
2802
|
+
|
|
2763
2803
|
/**
|
|
2764
2804
|
* @describe 管理类
|
|
2765
2805
|
* @author 游金宇(KM)
|
|
@@ -2821,13 +2861,17 @@ class Manager {
|
|
|
2821
2861
|
/**音效本地存储key */
|
|
2822
2862
|
#audio_local_store_key = '';
|
|
2823
2863
|
get audio_local_store_key() { return this.#audio_local_store_key; }
|
|
2864
|
+
/**默认音效路径 */
|
|
2865
|
+
#default_audio_effect = '';
|
|
2866
|
+
get default_audio_effect() { return this.#default_audio_effect; }
|
|
2824
2867
|
/**GUI资源配置 */
|
|
2825
|
-
setConfig = ({ gui_bundleName = 'resources', audio_local_store_key = 'game_audio' } = {}) => {
|
|
2868
|
+
setConfig = ({ default_audio_effect = '', gui_bundleName = 'resources', audio_local_store_key = 'game_audio' } = {}) => {
|
|
2826
2869
|
if (this.#initialized) {
|
|
2827
2870
|
throw new Error('[CAT] 已初始化,无法修改配置');
|
|
2828
2871
|
}
|
|
2829
2872
|
this.#gui_bundle_name = gui_bundleName;
|
|
2830
2873
|
this.#audio_local_store_key = audio_local_store_key;
|
|
2874
|
+
this.#default_audio_effect = default_audio_effect;
|
|
2831
2875
|
return this;
|
|
2832
2876
|
};
|
|
2833
2877
|
/**启动 */
|
|
@@ -2886,4 +2930,4 @@ game.onPostProjectInitDelegate.add(async () => {
|
|
|
2886
2930
|
}
|
|
2887
2931
|
});
|
|
2888
2932
|
|
|
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 };
|
|
2933
|
+
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 };
|