@shimotsuki/core 1.0.1 → 1.0.3
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 +38 -13
- package/dist/index.js +1 -1
- package/package.json +3 -1
- package/temp/declarations/cc.custom-macro.d.ts +3 -0
- package/temp/declarations/cc.d.ts +8 -0
- package/temp/declarations/cc.env.d.ts +180 -0
- package/temp/declarations/jsb.d.ts +1 -0
- package/tsconfig.json +24 -0
package/dist/index.d.ts
CHANGED
|
@@ -357,18 +357,6 @@ declare class CoreToast extends BaseComponent<ToastProps> {
|
|
|
357
357
|
onDestroy(): void;
|
|
358
358
|
}
|
|
359
359
|
|
|
360
|
-
/**
|
|
361
|
-
* @describe 根级别的UI层 所有的ROOT UI层需继承自该自组件
|
|
362
|
-
* @author 游金宇(KM)
|
|
363
|
-
* @date 2023-08-04 10:42:26
|
|
364
|
-
*/
|
|
365
|
-
|
|
366
|
-
declare class RootUILayer<T extends object> extends UILayer<T> {
|
|
367
|
-
protected onEnable(): void;
|
|
368
|
-
protected onDisable(): void;
|
|
369
|
-
private updateMask;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
360
|
type CoreShowLoadingProps = {
|
|
373
361
|
/**标题 */
|
|
374
362
|
title?: string;
|
|
@@ -922,6 +910,37 @@ declare class CoreUIModal extends UILayer<CoreUIModalProps> {
|
|
|
922
910
|
private onCloseHandler;
|
|
923
911
|
}
|
|
924
912
|
|
|
913
|
+
/**带有音频通道的UIlayer组件 */
|
|
914
|
+
declare class AudioSourceUILayer<T extends object, U extends object = {}> extends UILayer<T, U> {
|
|
915
|
+
type: AudioTypeEnum;
|
|
916
|
+
clip: never;
|
|
917
|
+
loop: boolean;
|
|
918
|
+
volume: number;
|
|
919
|
+
playOnAwake: boolean;
|
|
920
|
+
audioSource: AudioSource;
|
|
921
|
+
onEnable(): void;
|
|
922
|
+
__preload(): void;
|
|
923
|
+
protected stopAudio(): void;
|
|
924
|
+
protected playAudio(): void;
|
|
925
|
+
protected onPlayEffectHandler(): void;
|
|
926
|
+
protected onStopEffectHandler(): void;
|
|
927
|
+
protected onPlayMusicHandler(): void;
|
|
928
|
+
protected onStopMusicHandler(): void;
|
|
929
|
+
_onPreDestroy(): void;
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* @describe 根级别的UI层 所有的ROOT UI层需继承自该自组件
|
|
934
|
+
* @author 游金宇(KM)
|
|
935
|
+
* @date 2023-08-04 10:42:26
|
|
936
|
+
*/
|
|
937
|
+
|
|
938
|
+
declare class RootUILayer<T extends object> extends UILayer<T> {
|
|
939
|
+
protected onEnable(): void;
|
|
940
|
+
protected onDisable(): void;
|
|
941
|
+
private updateMask;
|
|
942
|
+
}
|
|
943
|
+
|
|
925
944
|
declare class CoreBlackMask extends BaseComponent {
|
|
926
945
|
tween: Node;
|
|
927
946
|
black_mask: Node;
|
|
@@ -960,6 +979,12 @@ declare class CoreUIContainer extends UILayer {
|
|
|
960
979
|
setSceneMaskActive(active: boolean): void;
|
|
961
980
|
}
|
|
962
981
|
|
|
982
|
+
/**
|
|
983
|
+
* @describe 层级界面管理
|
|
984
|
+
* @author 游金宇(KM)
|
|
985
|
+
* @date 2023-08-03 20:02:45
|
|
986
|
+
*/
|
|
987
|
+
|
|
963
988
|
type UIComponentType<T> = T extends UILayer<infer U> ? U : void;
|
|
964
989
|
type SceneComponentType<T> = T extends SceneLayer<infer U> ? U : void;
|
|
965
990
|
/**预制体路径 */
|
|
@@ -1012,4 +1037,4 @@ declare class Manager {
|
|
|
1012
1037
|
}
|
|
1013
1038
|
declare const cat: Manager;
|
|
1014
1039
|
|
|
1015
|
-
export { AudioEventConstant, AudioSourceBaseComponent, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, CoreBlackMask, CoreNotice, type CoreNoticeProps, CoreReconnection, CoreShowLoading, type CoreShowLoadingProps, CoreToast, CoreUIContainer, CoreUIModal, type CoreUIModalProps, CoreUtil, GlobalEventConstant, Gui, GuiManager, type HOOK, type ICloseOptions, type IDirection, type IOpenOptions, type IUIOption, LayerType, Manager, ReconnectPrompt, type SceneComponentType, type SceneDataType, type ScenePropsType, type ToastProps, ToastType, type UIComponentType, WrapperSocialGameClient, cat };
|
|
1040
|
+
export { AudioEventConstant, AudioSourceBaseComponent, AudioSourceUILayer, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, CoreBlackMask, CoreNotice, type CoreNoticeProps, CoreReconnection, CoreShowLoading, type CoreShowLoadingProps, 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, type ToastProps, ToastType, type UIComponentType, UILayer, WrapperSocialGameClient, cat };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AudioSource as t,_decorator as e,AudioClip as s,error as o,Node as i,director as n,log as r,sys as a,Component as c,Prefab as l,instantiate as h,isValid as d,Layers as p,view as u,Widget as f,v3 as _,tween as y,Enum as g,game as m,Label as v,UITransform as E,UIOpacity as b,Tween as C,BlockInputEvents as w,Button as k,Director as O,warn as S,assetManager as x,Asset as R,resources as N,SpriteFrame as A,Sprite as T,AsyncDelegate as I}from"cc";import{PREVIEW as M,DEBUG as D}from"cc/env";import{makeObservable as F,observable as U,autorun as P,reaction as H}from"@shimotsuki/mobx";import L from"crypto-es";import{clone as B,create as G}from"@bufbuild/protobuf";import{SocialGameClient as $,AudienceOptionsSchema as j}from"sgc";class q extends t{cat;initAudio(t){return this.cat=t,this}}const{ccclass:K,menu:V}=e;class J extends q{effects=new Map;load(t){return new Promise(((e,o)=>{this.cat.res.load(t,s,((s,i)=>{if(s)return o(s);this.effects.set(t,i),this.playOneShot(i,this.volume),e(i)}))}))}release(){for(let t in this.effects)this.cat.res.release(t);this.effects.clear()}}const{ccclass:W,menu:X}=e;class z extends q{onComplete=null;_progress=0;_url=null;_isPlay=!1;get progress(){return this.duration>0&&(this._progress=this.currentTime/this.duration),this._progress}set progress(t){this._progress=t,this.currentTime=t*this.duration}load(t,e){this.cat.res.load(t,s,((s,i)=>{s&&o(s),this.playing&&(this._isPlay=!1,this.stop(),this.cat.res.release(this._url)),this.playOnAwake=!1,this.enabled=!0,this.clip=i,this._url=t,e&&e()}))}update(t){this.currentTime>0&&(this._isPlay=!0),this._isPlay&&0==this.playing&&(this._isPlay=!1,this.enabled=!1,this.onComplete&&this.onComplete())}release(){this._url&&(this.cat.res.release(this._url),this._url=null)}}class Z{cat;constructor(t){this.cat=t}}var Q;!function(t){t.MUSIC_ON="AudioEventConstant/MUSIC_ON",t.MUSIC_OFF="AudioEventConstant/MUSIC_OFF",t.EFFECT_ON="AudioEventConstant/EFFECT_ON",t.EFFECT_OFF="AudioEventConstant/EFFECT_OFF",t.PAUSE_AUDIO="AudioEventConstant/PAUSE_AUDIO",t.RESUME_AUDIO="AudioEventConstant/RESUME_AUDIO"}(Q||(Q={}));const Y="game_audio";class tt extends Z{local_data={};music;effect;_volume_music=1;_volume_effect=1;_switch_music=!0;_switch_effect=!0;constructor(t){super(t);var e=new i("UIAudioManager");n.addPersistRootNode(e);var s=new i("UIMusic");s.parent=e,this.music=s.addComponent(z).initAudio(t);var o=new i("UIEffect");o.parent=e,this.effect=o.addComponent(J).initAudio(t),this.load()}setMusicComplete(t=null){this.music.onComplete=t}playMusic(t,e){this.music.loop=!0,t&&this.music.load(t,(()=>{this._switch_music&&this.music?.play(),e&&e()}))}stopMusic(){0!=this.music.state&&this.music?.stop()}pauseMusic(){1==this.music.state&&this.music?.pause()}resumeMusic(){[0,2].includes(this.music.state)&&this.music?.play()}get progressMusic(){return this.music.progress}set progressMusic(t){this.music.progress=t}get volumeMusic(){return this._volume_music}set volumeMusic(t){this._volume_music=t,this.music.volume=t}get switchMusic(){return this._switch_music}set switchMusic(t){if(r("设置背景音乐开关值",t,this._switch_music),t==this._switch_music)return;this._switch_music=t,t?this.resumeMusic():this.pauseMusic();const e=t?Q.MUSIC_ON:Q.MUSIC_OFF;this.cat.event.has(e)&&this.cat.event.dispatchEvent(e),this.save()}async playEffect(t){this._switch_effect&&t&&await this.effect.load(t).then((()=>{this.effect.play()}))}stopEffect(){this.effect?.stop()}get volumeEffect(){return this._volume_effect}set volumeEffect(t){this._volume_effect=t,this.effect.volume=t}get switchEffect(){return this._switch_effect}set switchEffect(t){if(t==this._switch_effect)return;this._switch_effect=t,t?this.effect?.play():this.effect?.stop();const e=t?Q.EFFECT_ON:Q.EFFECT_OFF;this.cat.event.has(e)&&this.cat.event.dispatchEvent(e),this.save()}resumeAll(){this.switchMusic&&this.music?.play(),this.switchEffect&&this.effect?.play()}pauseAll(){this.music?.pause(),this.effect?.pause()}stopAll(){this.music?.stop(),this.effect?.stop()}save(){this.local_data.volume_music=this._volume_music,this.local_data.volume_effect=this._volume_effect,this.local_data.switch_music=this._switch_music,this.local_data.switch_effect=this._switch_effect;let t=JSON.stringify(this.local_data);this.cat.storage.set(Y,t)}load(){try{let t=this.cat.storage.get(Y);this.local_data=JSON.parse(t),this._volume_music=this.local_data.volume_music,this._volume_effect=this.local_data.volume_effect,this._switch_music=this.local_data.switch_music,this._switch_effect=this.local_data.switch_effect}catch(t){this.local_data={},this._volume_music=.6,this._volume_effect=1,this._switch_music=!0,this._switch_effect=!0}this.music&&(this.music.volume=this._volume_music),this.effect&&(this.effect.volume=this._volume_effect)}}class et extends Z{_key=null;_iv=null;_id="";init(t,e){this.cat.util.encryptUtil.initCrypto(t,e),this._key=this.cat.util.encryptUtil.md5(t),this._iv=this.cat.util.encryptUtil.md5(e)}setUser(t){this._id=t}set(t,e){if(null!=(t=`${t}_${this._id}`)){if(M||(t=this.cat.util.encryptUtil.md5(t)),null==e)return console.warn("存储的值为空,则直接移除该存储"),void this.remove(t);if("function"!=typeof e){if("object"==typeof e)try{e=JSON.stringify(e)}catch(t){return void console.error(`解析失败,str = ${e}`)}else"number"==typeof e&&(e+="");M||null==this._key||null==this._iv||(e=this.cat.util.encryptUtil.aesEncrypt(`${e}`,this._key,this._iv)),a.localStorage.setItem(t,e)}else console.error("储存的值不能为方法")}else console.error("存储的key不能为空")}get(t,e){if(null==t)return console.error("存储的key不能为空"),null;t=`${t}_${this._id}`,M||(t=this.cat.util.encryptUtil.md5(t));let s=a.localStorage.getItem(t);return null==s||""===s||M||null==this._key||null==this._iv||(s=this.cat.util.encryptUtil.aesDecrypt(s,this._key,this._iv)),null===s?e:s}getNumber(t,e=0){var s=this.get(t);return Number(s)||e}getBoolean(t){var e=this.get(t);return Boolean(e)||!1}getJson(t,e){var s=this.get(t);return s&&JSON.parse(s)||e}remove(t){null!=t?(t=`${t}_${this._id}`,M||(t=this.cat.util.encryptUtil.md5(t)),a.localStorage.removeItem(t)):console.error("存储的key不能为空")}clear(){a.localStorage.clear()}}function st(t,e,s,o){var i,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(n<3?i(r):n>3?i(e,s,r):i(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}function ot(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"function"==typeof SuppressedError&&SuppressedError;class it extends c{props={};data={};autorunDisposers=[];reactionDisposers=[];hook={destroyed:()=>{},started:()=>{}};initUI(){}added(){}__preload(){this.initUI(),this.onAutoObserver()}constructor(){super(),F(this,{props:U,data:U})}onAutoObserver(){}addAutorun(t){return(Array.isArray(t)?t:[t]).forEach((t=>{const e=P(t);this.autorunDisposers.push(e)})),this}addReaction(t,e,s){const o=H(t,e,s);return this.reactionDisposers.push(o),this}_onPreDestroy(){this.autorunDisposers.forEach((t=>{t()})),this.reactionDisposers.forEach((t=>{t()})),this.autorunDisposers=[],this.reactionDisposers=[],super._onPreDestroy()}onDisable(){this.onHide(),te.event.deleteEventByComponent(this),this.removeListener()}onEnable(){this.onShow(),this.addListener(),this.onEventListener()}onEventListener(){}addListener(){}removeListener(){}addToParent(t,e){let s=t instanceof l?h(t):t instanceof c?t.node:t;return this.setOptions(e),s.addChild(this.node),this.added(),this}setOptions(t){if(t)for(let e in t)switch(e){case"hook":t.hook&&(this.hook=t.hook);break;case"props":null!==t.props&&"object"==typeof t.props&&(this.props=t.props);break;case"data":null!==t.data&&"object"==typeof t.data&&(this.data=t.data)}}setUpdateData(t){return t&&Object.assign(this.data,t),this}setUpdateProps(t){return this.props,t&&Object.assign(this.props,t),this}removeAndDestroy(){d(this?.node)&&(this.node.removeFromParent(),this.node.destroy())}setPosition(t){return this.node.setPosition(t),this}setScale(t){return this.node.setScale(t),this}setAngle(t){return this.node.angle=t,this}setRotation(t){return this.node.setRotation(t),this}onShow(){}onHide(){}setNodeAndChildrenLayer(t){return nt(this.node,t),this}}const nt=(t,e)=>{t.layer="string"==typeof e?2**p.nameToLayer(e):e,t?.children.forEach((t=>{nt(t,e)}))};class rt extends it{lastEnterDirection="center";screen;isClosing=!1;root;constructor(){super(),this._init()}_init(){this.root=this.node,this.screen=u.getVisibleSize()}async showTween({isMotion:t=!0,direction:e="center",duration:s=.1,isBounce:o=!0,bounceDuration:i=.05}){if(this.lastEnterDirection=e,t){const t=this.node.getComponent(f);let i,n;t&&(t.updateAlignment(),t.enabled=!1),_(1.1,1.1,1),"center"==e?(i=_(.01,.01,.01),n=_(1,1,1)):(i="left"==e?_(-this.screen.width,0,0):"right"==e?_(this.screen.width,0,0):_(0,"top"==e?this.screen.height:-this.screen.height,0),n=_(0,0,0)),await this.handle(e,s,i,n,o),t&&(t.enabled=!0)}}async hideTween({isMotion:t=!0,direction:e,duration:s=.1}){if(e=e||this.lastEnterDirection,!this.isClosing){if(this.isClosing=!0,y(this.node).removeSelf(),t){const t=this.node.getComponent(f);let o,i;t&&(t.enabled=!1),"center"==e?(o=this.node.scale,i=_(0,0,0)):(i="left"==e?_(-this.screen.width,0,0):"right"==e?_(this.screen.width,0,0):_(0,"top"==e?this.screen.height:-this.screen.height,0),o=this.node.getPosition()),await this.handle(e,s,o,i,!1)}this.removeAndDestroy()}}async handle(t,e,s,o,i){"center"==t?this.node.setScale(s):this.node.setPosition(s),await this.deftween(e,{["center"==t?"scale":"position"]:o},i)}deftween(t,e,s,o){return new Promise(((s,o)=>{y(this.node).to(t,e).call((()=>{s()})).start()}))}}const{ccclass:at,property:ct}=e;var lt;!function(t){t[t.EFFECT=0]="EFFECT",t[t.BGM=1]="BGM"}(lt||(lt={}));class ht extends it{type=lt.EFFECT;clip=null;loop=!1;volume=1;playOnAwake=!1;audioSource=new t;onEnable(){super.onEnable(),this.clip&&(this.audioSource.clip=this.clip),this.audioSource.loop=this.loop,this.audioSource.volume=this.volume,this.audioSource.playOnAwake=this.playOnAwake,te.event.on(Q.EFFECT_ON,this.onPlayEffectHandler,this).on(Q.EFFECT_OFF,this.onStopEffectHandler,this).on(Q.MUSIC_ON,this.onPlayMusicHandler,this).on(Q.MUSIC_OFF,this.onStopMusicHandler,this)}__preload(){super.__preload();const{volumeEffect:t,volumeMusic:e}=te.audio;this.audioSource.volume=this.type===lt.BGM?e:t}start(){}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=te.audio;this.audioSource.playing||!(this.type===lt.BGM?e:t)||m._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}st([ct({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:g(lt)}),ot("design:type",Object)],ht.prototype,"type",void 0),st([ct({tooltip:"音源",type:s}),ot("design:type",Object)],ht.prototype,"clip",void 0),st([ct({tooltip:"循环"}),ot("design:type",Object)],ht.prototype,"loop",void 0),st([ct({tooltip:"音量"}),ot("design:type",Object)],ht.prototype,"volume",void 0),st([ct({tooltip:"是否启用自动播放"}),ot("design:type",Object)],ht.prototype,"playOnAwake",void 0);const{ccclass:dt,property:pt}=e;var ut;!function(t){t[t.FIXED=0]="FIXED",t[t.SLIDE=1]="SLIDE"}(ut||(ut={}));let ft=class extends it{fixed_node;slide_node;fixed_label;slide_label;onLoad(){this.fixed_node.active=this.slide_node.active=!1}start(){this.show()}async show(){return new Promise((async(t,e)=>{const{title:s,type:o,fixed_time:i}=this.props;if(o==ut.FIXED){this.fixed_node.active=!0,this.fixed_label.string=`${s}`,this.fixed_label.updateRenderData(!0);const e=this.fixed_label.node.getComponent(E).height;e-this.fixed_node.getComponent(E).height>0&&(this.fixed_node.getComponent(E).height=e+100),this.scheduleOnce((()=>{this.node.destroy(),t()}),i)}else{this.slide_node.active=!0,this.slide_label.string=`${s}`,this.slide_label.updateRenderData(!0);const e=this.slide_label.node.getComponent(E).width;this.slide_node.getComponent(E).width-e<100&&(this.slide_node.getComponent(E).width=e+100),this.playAnim(this.node).then((()=>{t()}))}}))}playAnim(t){return new Promise(((e,s)=>{const o=this.node.getComponent(b),i=y(o).delay(1.2).to(.5,{opacity:0}).call((()=>{C.stopAllByTarget(t),this.node.destroy(),e()}));y(t).by(.5,{position:_(0,400,0)}).call((()=>{i.start()})).start()}))}onDestroy(){C.stopAllByTarget(this.node),this.unscheduleAllCallbacks()}};var _t;st([pt({type:i,tooltip:"固定节点"}),ot("design:type",i)],ft.prototype,"fixed_node",void 0),st([pt({type:i,tooltip:"滑动节点"}),ot("design:type",i)],ft.prototype,"slide_node",void 0),st([pt({type:v,tooltip:"固定标签节点"}),ot("design:type",v)],ft.prototype,"fixed_label",void 0),st([pt({type:v,tooltip:"滑动标签节点"}),ot("design:type",v)],ft.prototype,"slide_label",void 0),ft=st([dt("CoreToast")],ft),function(t){t.EVENT_SHOW="GlobalEventConstant/EVENT_SHOW",t.EVENT_HIDE="GlobalEventConstant/EVENT_HIDE",t.GAME_RESIZE="GlobalEventConstant/GAME_RESIZE",t.EVENT_CLOSE="GlobalEventConstant/EVENT_CLOSE",t.ONLINE="GlobalEventConstant/ONLINE",t.OFFLINE="GlobalEventConstant/OFFLINE",t.ROOT_MASK_UPDATE="GlobalEventConstant/ROOT_MASK_UPDATE",t.ROOT_MASK_CHANGE="GlobalEventConstant/ROOT_MASK_CHANGE"}(_t||(_t={}));const{ccclass:yt,property:gt}=e;let mt=class extends rt{scene_mask_node;ui_container;gui=null;onLoad(){this.setSceneMaskActive(!1)}get scene_mask(){return this.scene_mask_node.getComponent(Bt)}get brother(){return this.ui_container.children||[]}get tweenChildren(){return this.scene_mask.tween.children}onEventListener(){te.event.on(_t.ROOT_MASK_CHANGE,this.uiMaskChanged,this)}addMask(){const t=this.brother[this.brother.length-1];t&&this.scene_mask.node.setSiblingIndex(t.getSiblingIndex()),this.blockMaskSiblingIndexChanged()}subMask(){const t=this.brother[this.brother.length-2];t&&this.scene_mask.node.setSiblingIndex(t.getSiblingIndex()),this.blockMaskSiblingIndexChanged()}blockMaskSiblingIndexChanged(){this.tweenChildren.length>1||this.brother.length>1?this.show():this.hide()}addNodeToTween(t){return this.scene_mask?(this.scene_mask.tween.addChild(t),this):(console.error("scene_mask is null"),this)}show(){this.setSceneMaskActive(!0)}hide(){this.setSceneMaskActive(!1)}setGui(t){return this.gui=t,this}uiMaskChanged(){this.blockMaskSiblingIndexChanged()}setSceneMaskActive(t){this.scene_mask.black_mask.active=!this.gui.root_mask.active&&t}};st([gt({type:i}),ot("design:type",i)],mt.prototype,"scene_mask_node",void 0),st([gt({type:i}),ot("design:type",i)],mt.prototype,"ui_container",void 0),mt=st([yt("CoreUIContainer")],mt);class vt extends rt{onEnable(){super.onEnable(),this.updateMask()}onDisable(){super.onDisable(),this.updateMask()}updateMask(){te.event.dispatchEvent(_t.ROOT_MASK_UPDATE)}}const{ccclass:Et,property:bt}=e;let Ct=class extends vt{title;loadingTween;loading_rotate=0;onAutoObserver(){this.addAutorun([()=>{this.props?.title&&(this.title.string=`${this.props?.title}`),this.title.node.active=!!this.props?.title?.length},()=>{this.getComponent(w).enabled=!!this.props?.mask}])}update(t){this.loading_rotate+=220*t,this.loadingTween.setRotationFromEuler(0,0,-this.loading_rotate%360),this.loading_rotate>360&&(this.loading_rotate-=360)}};st([bt({type:v,tooltip:"标题"}),ot("design:type",v)],Ct.prototype,"title",void 0),st([bt({type:i,tooltip:"动画"}),ot("design:type",i)],Ct.prototype,"loadingTween",void 0),Ct=st([Et("CoreShowLoading")],Ct);const{ccclass:wt,property:kt}=e;var Ot;!function(t){t.RECONNECTED="重连成功",t.RECONNECTING="正在重连",t.MAX_RECONNECT="重连次数超出限制,请检查网络",t.RECONNECTED_ERROR="重连失败,请检查网络",t.CONNECT_PARAM_ERROR="游戏参数错误,请重新加载",t.KICK="账号已下线",t.OFFLINE="网络已断开",t.ONLINE="网络已连接",t.GAME_ERROR="连接游戏服错误"}(Ot||(Ot={}));let St=class extends vt{common_prompt_text;btn_confirm;is_close=!1;props={content:null};initUI(){this.btn_confirm.node.active=!1}onLoad(){this.btn_confirm.node.on(k.EventType.CLICK,this.onConfirmHandler,this),this.addAutorun([()=>{this.common_prompt_text.string=this.props.content??""}])}onDestroy(){this.unscheduleAllCallbacks()}updateProps(t){this.updatePromptText(t,t==Ot.RECONNECTING)}updatePromptText(t,e=!1){if(this.unscheduleAllCallbacks(),this.props.content=t,r("更新提示文案:",t),e){let e=0;const s=()=>{e=(e+1)%4,this.common_prompt_text.string=t+["","·","··","···"][e]};this.schedule(s,.5)}}onConfirmHandler(){this.is_close=!0,te.gui.hideReconnect()}};st([kt({type:v,tooltip:"通用提示文本"}),ot("design:type",v)],St.prototype,"common_prompt_text",void 0),st([kt({type:k,tooltip:"确定按钮"}),ot("design:type",k)],St.prototype,"btn_confirm",void 0),St=st([wt("CoreReconnection")],St);const{ccclass:xt,property:Rt}=e;let Nt=class extends vt{text;btn_confirm;onLoad(){this.btn_confirm.node.on(k.EventType.CLICK,this.onConfrimHandler,this)}start(){this.props&&this.updateProps(this.props)}onConfrimHandler(){this.props?.confrim?.(),te.gui.hideNotice()}updateProps(t){this.text.string=`${t.text}`}};st([Rt({type:v,tooltip:"提示文本"}),ot("design:type",v)],Nt.prototype,"text",void 0),st([Rt({type:k,tooltip:"确定按钮"}),ot("design:type",k)],Nt.prototype,"btn_confirm",void 0),Nt=st([xt("CoreNotice")],Nt);class At extends it{isReload}const{ccclass:Tt,property:It}=e;var Mt;!function(t){t[t.UI=0]="UI",t[t.LOADING=1]="LOADING",t[t.TOAST=2]="TOAST",t[t.RECONNECTTION=3]="RECONNECTTION",t[t.NOTICE=4]="NOTICE"}(Mt||(Mt={}));let Dt=class extends it{reconnection_ui_prefab;toast_ui_prefab;loading_ui_prefab;notice_ui_prefab;ui_prefab;root_ui;root_toast;root_mask;cat;ui_container_component;reconnection_ui_component;notice_ui_component;loading_ui_component;toast_ui_component;currentScene;onEventListener(){this.cat.event.on(_t.ROOT_MASK_UPDATE,this.onRootUpdate,this)}init(t){this.cat=t;const e=n.getScene();return r("init scene"),e&&this.changeScene(e),this}start(){this.onRootUpdate()}showToast({title:t="",type:e=ut.SLIDE,fixed_time:s=2}){const o=h(this.toast_ui_prefab);return r("showToast",t),this.toast_ui_component=o.getComponent(ft).addToParent(this.root_toast,{props:{title:t,type:e,fixed_time:s}}),this}hideToast(){return this.toast_ui_component?.removeAndDestroy(),this}showLoading({title:t="",mask:e=!0,black:s=!0}={}){if(r("showLoading",t),this.loading_ui_component)this.loading_ui_component.setOptions({props:{title:t,mask:e,black:s}});else{const o=h(this.loading_ui_prefab);this.loading_ui_component=o.getComponent(Ct).addToParent(this.root_ui,{props:{title:t,mask:e,black:s}})}return this}hideLoading(){return this.loading_ui_component?.removeAndDestroy(),this.loading_ui_component=null,this}showReconnect(t){if(this.reconnection_ui_component)this.reconnection_ui_component.setUpdateProps({content:t});else{const e=h(this.reconnection_ui_prefab);this.reconnection_ui_component=e.getComponent(St).addToParent(this.root_ui,{props:{content:t}})}return this}hideReconnect(){return this.reconnection_ui_component?.removeAndDestroy(),this.reconnection_ui_component=null,this}showNotice(t){const e=h(this.notice_ui_prefab);return this.notice_ui_component=e.getComponent(Nt).addToParent(this.root_ui,{props:t}),this}hideNotice(){return this.notice_ui_component?.removeAndDestroy(),this}loadScene(t,e,s){r("加载场景",t,e,s);let o={},i=s??!1;return"boolean"==typeof e?i=e:o=e??{},r("当前场景",n.getScene()?.uuid,n.getScene()?.name),n.once(O.EVENT_BEFORE_SCENE_LAUNCH,(t=>{r("Director.EVENT_BEFORE_SCENE_LAUNCH",t),this.changeScene(t,o,i)})),n.loadScene(t),this}resetScene(t=""){return t=t||this.currentScene,this.loadScene(t)}cleanScene(){this.resetScene().hideLoading().hideNotice().hideReconnect().hideToast()}changeScene(t,e,s){this.currentScene=t.name,this.createUILayer(t);const o=t.getComponentInChildren(At);o&&(o.isReload=s??!1),o?.setOptions(e)}createUILayer(t){this.ui_container_component?.removeAndDestroy(),this.ui_container_component=null;const e=h(this.ui_prefab);this.ui_container_component=e.getComponent(mt).setGui(this).addToParent(t)}reloadScene(){this.loadScene(this.currentScene,!0)}async closeUI(t,e){const{component:s}=this.findUIBaseLayer(t,!1);s&&(s.setOptions({...e?.hook??{},...e?.props??{}}),await s.hideTween(e||{}),this.ui_container_component?.subMask())}async openUI(t,e){const{rootNode:s,component:o}=this.findUIBaseLayer(t,!0);s.getComponent(rt),o?.setOptions(e),s&&this.ui_container_component?.addNodeToTween(s).addMask(),o&&await o.showTween(e||{}),this.ui_container_component?.ui_container&&o?.addToParent(this.ui_container_component.ui_container)}findUIBaseLayer(t,e){let s,n=null;if(t instanceof i){s=t;const e=t.components.filter((t=>t instanceof rt));if(!e.length)return o(`${t.name}节点未找到继承自BaseLayer的组件`),{rootNode:s,component:n};1==e.length?n=e[0]:S(`${t.name}节点存在多个继承自BaseLayer的组件`)}else if(s=t.node,n=t,e){for(;s.parent;)s=s.parent;n.root=s}else s=t.root;return{rootNode:s,component:n}}onRootUpdate(){const t=this.root_ui.children.length;if(this.root_mask.active=t>1,t>1){const e=this.root_ui.children[t-2];this.root_mask.setSiblingIndex(e.getSiblingIndex())}this.cat.event.dispatchEvent(_t.ROOT_MASK_CHANGE)}};st([It({type:l,tooltip:"断线重连UI预制体"}),ot("design:type",l)],Dt.prototype,"reconnection_ui_prefab",void 0),st([It({type:l,tooltip:"提示UI预制体"}),ot("design:type",l)],Dt.prototype,"toast_ui_prefab",void 0),st([It({type:l,tooltip:"加载UI预制体"}),ot("design:type",l)],Dt.prototype,"loading_ui_prefab",void 0),st([It({type:l,tooltip:"公告UI预制体"}),ot("design:type",l)],Dt.prototype,"notice_ui_prefab",void 0),st([It({type:l,tooltip:"UI层预制体"}),ot("design:type",l)],Dt.prototype,"ui_prefab",void 0),st([It({type:i,tooltip:"root-UI层"}),ot("design:type",i)],Dt.prototype,"root_ui",void 0),st([It({type:i,tooltip:"root-组件层"}),ot("design:type",i)],Dt.prototype,"root_toast",void 0),st([It({type:i,tooltip:"root-mask"}),ot("design:type",i)],Dt.prototype,"root_mask",void 0),Dt=st([Tt("Gui")],Dt);const{ccclass:Ft,property:Ut}=e;class Pt extends rt{type=lt.EFFECT;clip=null;loop=!1;volume=1;playOnAwake=!1;audioSource=new t;onEnable(){super.onEnable(),te.event.on(Q.EFFECT_ON,this.onPlayEffectHandler,this).on(Q.EFFECT_OFF,this.onStopEffectHandler,this).on(Q.MUSIC_ON,this.onPlayMusicHandler,this).on(Q.MUSIC_OFF,this.onStopMusicHandler,this)}__preload(){this.clip&&(this.audioSource.clip=this.clip),this.audioSource.loop=this.loop,this.audioSource.volume=this.volume,this.audioSource.playOnAwake=this.playOnAwake,super.__preload();const{volumeEffect:t,volumeMusic:e}=te.audio;this.audioSource.volume=this.type===lt.BGM?e:t}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=te.audio;this.audioSource.playing||!(this.type===lt.BGM?e:t)||m._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}st([Ut({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:g(lt)}),ot("design:type",Object)],Pt.prototype,"type",void 0),st([Ut({tooltip:"音源",type:s}),ot("design:type",Object)],Pt.prototype,"clip",void 0),st([Ut({tooltip:"循环"}),ot("design:type",Object)],Pt.prototype,"loop",void 0),st([Ut({tooltip:"音量"}),ot("design:type",Object)],Pt.prototype,"volume",void 0),st([Ut({tooltip:"是否启用自动播放"}),ot("design:type",Object)],Pt.prototype,"playOnAwake",void 0);const{ccclass:Ht,property:Lt}=e;let Bt=class extends it{tween;black_mask};var Gt;st([Lt({type:i,tooltip:"动画节点"}),ot("design:type",i)],Bt.prototype,"tween",void 0),st([Lt({type:i,tooltip:"遮罩节点"}),ot("design:type",i)],Bt.prototype,"black_mask",void 0),Bt=st([Ht("CoreBlackMask")],Bt),function(t){t.Root="core/root",t.Toast="core/toast",t.BlackMask="core/black-mask",t.Loading="core/loading",t.Notice="core/notice",t.Reconnection="core/reconnection"}(Gt||(Gt={}));class $t extends Z{_gui;get gui(){return this._gui}set gui(t){this._gui=t}getGuiPrefabByType=t=>new Promise(((e,s)=>{this.cat.res.load(t,((t,o)=>{t?s(t):e(o)}))}));async init(){const t=await this.getGuiPrefabByType(Gt.Root),e=h(t);return this.gui=e.getComponent(Dt).init(this.cat),n.addPersistRootNode(e),this}}class jt{get=(t,e,s="resources")=>x.getBundle(s).get(t,e);isAssetType=t=>"function"==typeof t&&t.prototype instanceof R;async load(...t){let e=null,s=null,o=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let i=t.shift();this.isAssetType(t[0])&&(s=t.shift()),2==t.length&&(o=t.shift());const n=t.shift();let r=N;if(e&&"resources"!=e){x.bundles.has(e)||await this.loadBundle(e);let t=x.bundles.get(e);t&&(r=t)}o&&n?r.load(i,s,o,n):n?r.load(i,s,n):r.load(i,s)}async loadDir(...t){let e=null,s=null,o=null,i=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let n=t.shift();this.isAssetType(t[0])&&(s=t.shift()),2==t.length&&(o=t.shift()),i=t.shift();let r=N;if(e&&"resources"!=e){x.bundles.has(e)||await this.loadBundle(e);let t=x.bundles.get(e);t&&(r=t)}o&&i?r.loadDir(n,s,o,i):i?r.loadDir(n,s,i):r.loadDir(n,s)}loadRemote(t,...e){var s,o=null;2==e.length&&(o=e.shift()),s=e.shift(),x.loadRemote(t,{ext:".png",...o},s)}loadBundle=(t,e)=>new Promise(((s,o)=>{const i=(t,e)=>{if(t)return o(t);s(e)};e?x.loadBundle(t,{version:e},i):x.loadBundle(t,i)}));releasePrefabtDepsRecursively=t=>{var e=x.assets.get(t);(x.releaseAsset(e),e instanceof l)&&x.dependUtil.getDepsRecursively(t).forEach((t=>{x.assets.get(t).decRef()}))};release=(t,e="resources")=>{var s=x.getBundle(e);if(s){var o=s.get(t);o&&this.releasePrefabtDepsRecursively(o._uuid)}};releaseDir=(t,e="resources")=>{var s=x.getBundle(e),o=s?.getDirWithPath(t);o?.map((t=>{this.releasePrefabtDepsRecursively(t.uuid)})),!t&&"resources"!=e&&s&&x.removeBundle(s)};dump=()=>{x.assets.forEach(((t,e)=>{r(x.assets.get(e))})),r(`当前资源总数:${x.assets.count}`)}}class qt{events=new Map;on(t,e,s){if(!t||!e)return S(`注册【${t}】事件的侦听器函数为空`),this;const o=this.events.get(t)??this.events.set(t,new Map).get(t);return o.has(s)?(S(`名为【${t}】的事件重复注册侦听器`),this):(o.set(s,e),this)}once(t,e,s){let o=(i,n)=>{this.off(t,o,s),o=null,e.call(s,i,n)};this.on(t,o,s)}off(t,e,s){if(!this.events.get(t)?.has(s))return this;const i=this.events.get(t);return i.get(s)!==e?(o(`${s}注册事件和取消事件不一致`),this):(i.delete(s),this)}dispatchEvent(t,e){if(!this.events.has(t))return this;const s=this.events.get(t);for(const[o,i]of s)i.call(o,e,t);return this}offAll(){this.events.clear()}has(t){return this.events.has(t)}deleteEventByComponent(t){for(const[e,s]of this.events){for(const[e]of s)e===t&&s.delete(e);0===s.size&&this.events.delete(e)}}}let Kt=null;const Vt={stringify:t=>{const e={ct:t.ciphertext.toString(L.enc.Base64)};return t.iv&&(e.iv=t.iv.toString()),t.salt&&(e.s=t.salt.toString()),JSON.stringify(e)},parse:t=>{const e=JSON.parse(t),s=L.lib.CipherParams.create({ciphertext:L.enc.Base64.parse(e.ct)});return e.iv&&(s.iv=L.enc.Hex.parse(e.iv)),e.s&&(s.salt=L.enc.Hex.parse(e.s)),s}};var Jt=Object.freeze({__proto__:null,JsonFormatter:Vt,aesDecrypt:(t,e,s)=>L.AES.decrypt(t,e,{iv:Kt,format:Vt}).toString(L.enc.Utf8),aesEncrypt:(t,e,s)=>L.AES.encrypt(t,e,{iv:Kt,format:Vt}).toString(),initCrypto:(t,e)=>{Kt=L.enc.Hex.parse(e)},md5:t=>L.MD5(t).toString()});class Wt extends Z{encryptUtil=Jt}class Xt extends ${isNeedReconnect=!1;isOnline=!0;isInBackground=!1;running=!1;index=0;logBlackList=[];constructor(t,e,s){super(t,e,s),this.running=!0,this.addEvent()}addEvent(){this.on("connected",(()=>this.handleEvent({type:"connected"}))).on("reconnected",(()=>this.handleEvent({type:"reconnected"}))).on("disconnect",(t=>this.handleEvent({type:"disconnect",ev:t}))).on("handshakeError",(t=>this.handleEvent({type:"handshakeError",ret:t}))).on("kick",(()=>this.handleEvent({type:"kick"}))).on("reconnecting",(()=>this.handleEvent({type:"reconnecting"}))).on("maxReconnect",(()=>this.handleEvent({type:"maxReconnect"}))).on("error",(t=>this.handleEvent({type:"error",ev:t}))),te.event.on(_t.EVENT_SHOW,this.onShowHandler,this).on(_t.EVENT_HIDE,this.onHideHandler,this).on(_t.ONLINE,this.onOnlineHandler,this).on(_t.OFFLINE,this.onOfflineHandler,this)}removeEvent(){this.removeAllListeners(),te.event.off(_t.EVENT_SHOW,this.onShowHandler,this).off(_t.EVENT_HIDE,this.onHideHandler,this).off(_t.ONLINE,this.onOnlineHandler,this).off(_t.OFFLINE,this.onOfflineHandler,this)}onShowHandler(){r("[SHOW]"),this.isInBackground=!1,this.isNeedReconnect&&this.isOnline&&this.handleEvent({type:"show"})}onHideHandler(t){r("[HIDE]"),t().finally((()=>{this.isInBackground=!0,this.handleEvent({type:"hide"})}))}onOnlineHandler(){this.isOnline=!0,r("正在检查网络状态:"+(this.isOnline?"在线":"断开")),this.handleEvent({type:"online"})}onOfflineHandler(){this.isOnline=!1,r("正在检查网络状态:"+(this.isOnline?"在线":"断开")),this.handleEvent({type:"offline"})}async handleEvent(t){if(this.running)switch(t.type){case"init":break;case"connected":r("ws连接成功状态 connected"),this.isNeedReconnect=!1;break;case"reconnected":r("ws重连成功状态 reconnected",this.isSocketConnected),this.isNeedReconnect=!1,r("%c 重连成功状态","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index);try{await this.connectRequest(),r("重连成功状态 connectRequest "),te.gui.showToast({title:Ot.RECONNECTED}),te.gui.hideReconnect().hideLoading(),te.gui.reloadScene()}catch(t){console.error(t),te.gui.showReconnect(Ot.GAME_ERROR)}break;case"disconnect":r("断开连接状态 disconnect",t.ev),r("%c 断开连接状态","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index),this.isNeedReconnect=!0,this.handleEvent({type:"reconnect"});break;case"handshakeError":r("参数错误状态 handshakeError",t.ret),te.gui.showReconnect(Ot.CONNECT_PARAM_ERROR),this.handleEvent({type:"destroy"});break;case"kick":r("%c 被踢出状态","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index),r("被踢出状态 kick"),te.gui.showReconnect(Ot.KICK),this.handleEvent({type:"destroy"});break;case"reconnecting":r("正在重连状态 reconnecting"),this.isOnline&&this.isInBackground;break;case"maxReconnect":r("超出最大重连状态 maxReconnect"),te.gui.showReconnect(Ot.MAX_RECONNECT);break;case"error":this.isOnline&&(r("ws报错状态 error",t.ev),"string"==typeof t.ev&&te.gui.showToast({title:t.ev}),te.gui.showReconnect(Ot.RECONNECTED_ERROR));break;case"online":te.gui.showReconnect(Ot.ONLINE),r("在线状态 online"),this.handleEvent({type:"reconnect"});break;case"offline":this.disconnect(!0),r("离线状态 offline"),this.isNeedReconnect=!0,te.gui.showReconnect(Ot.OFFLINE);break;case"show":r("前台状态 show"),this.handleEvent({type:"reconnect"});break;case"hide":r("后台状态 hide"),this.disconnect(!0),this.isNeedReconnect=!0;break;case"reconnect":r("重连状态 reconnect"),this.isNeedReconnect&&!this.isInBackground&&this.isOnline&&(te.gui.showLoading({title:"正在重连"}),this.reset(),this.index+=1,r("%c ws重连次数","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index),this.reconnectImmediately());break;case"destroy":r("销毁状态 destroy"),this.destroyStateMachine();break;default:r("Unknown event:",t.type)}}destroy(){this.handleEvent({type:"destroy"})}disconnect(t=!1){super.disconnect(t)}destroyStateMachine(){r("Destroying state machine"),this.running=!1,this.removeEvent(),this.disconnect(!0)}request(t,e,s){return D&&r(`%c ws客户端消息 %c [Request][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),new Promise(((i,n)=>{super.request(t,e,s).then((e=>{D&&r(`%c ws服务端消息 %c [Response][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7daa ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(s,e)),i(e)}),(t=>{o("request err",t),n(t)}))}))}async Request(t,e,s,{audOptions:o={forwardReq:!1,forwardResp:!1},show_log:i=!0}={}){if(!this.isSocketConnected)throw""+(this.isSocketConnected?"未加入战局/观战":"Socket未连接");return D&&i&&r(`%c ws客户端消息 %c [Request][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),this.GameRequest(t,e,s,G(j,o))}async GameRequest(t,e,s,o){return new Promise(((i,n)=>{super.GameRequest(t,e,s,o).then((e=>{D&&r(`%c ws服务端消息 %c [Response][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7daa ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(s,e)),i(e)}),(t=>{te.gui.showToast({title:t.msg}),n(t)}))}))}async gameRequest(t,e,s){return D&&r(`%c ws客户端消息 %c [Request][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),super.gameRequest(t,e,s)}GameNotify=async(t,e,s)=>{try{super.GameNotify(t,e,s)}catch(e){throw console.error(`Error in connectRequest for route ${t}: `,e),e}};Notify=async(t,e,{audOptions:s=G(j,{forwardReq:!1,forwardResp:!1}),show_log:o=!0}={})=>{this.isSocketConnected&&(D&&o&&r(`%c ws客户端消息 %c[Notify][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),this.GameNotify(t,e,s))};subscribe(t,e,s){return super.subscribe(t,e,(o=>{D&&!this.logBlackList.includes(t)&&r(`%c ws服务端消息:[${new Date}] %c ${t} %c`,"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#410083 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e,o)),te.event.dispatchEvent(t,B(e,o)),s?.(o)})),this}onData(t){super.onData(t)}}const{ccclass:zt,property:Zt}=e;let Qt=class extends rt{default_title=null;title;prompt_content_str;prompt_content_spriteFrame;btn_confirm;confirm_spriteFrame;btn_cancel;cancel_spriteFrame;btn_close;isConfirm=!1;props={title:this.default_title,content:null,confirmCB:()=>{},cancelCB:()=>{},style:null};onLoad(){this.btn_cancel.node.on(k.EventType.CLICK,this.onCancelHandler,this),this.btn_confirm.node.on(k.EventType.CLICK,this.onConfirmHandler,this),this.btn_close.node.on(k.EventType.CLICK,this.onCloseHandler,this),this.addAutorun([()=>{this.title.spriteFrame=this.props?.title||this.default_title},()=>{this.props.content instanceof A?this.prompt_content_spriteFrame.spriteFrame=this.props.content:"string"==typeof this.props.content?this.prompt_content_str.string=this.props.content:console.error("未知类型的【UIModal】内容")},()=>{null===this.props?.style?.confirm?this.btn_confirm.node.active=!1:(this.btn_confirm.node.active=!0,this.btn_confirm.getComponent(T).spriteFrame=this.props.style?.confirm||this.confirm_spriteFrame),null===this.props?.style?.cancel?this.btn_cancel.node.active=!1:(this.btn_cancel.node.active=!0,this.btn_cancel.getComponent(T).spriteFrame=this.props.style?.cancel||this.cancel_spriteFrame)}])}close(){this.props.cancelCB?.(),te.gui.closeUI(this)}onCancelHandler(){this.close()}onConfirmHandler(){this.props.confirmCB?.()}onDestroy(){this.isConfirm&&this.props.onDestroy?.()}onCloseHandler(){this.close()}};st([Zt({type:A,tooltip:"默认标题"}),ot("design:type",A)],Qt.prototype,"default_title",void 0),st([Zt({type:T,tooltip:"标题节点"}),ot("design:type",T)],Qt.prototype,"title",void 0),st([Zt({type:v,tooltip:"字符串内容按钮"}),ot("design:type",v)],Qt.prototype,"prompt_content_str",void 0),st([Zt({type:T,tooltip:"图片精灵内容按钮"}),ot("design:type",T)],Qt.prototype,"prompt_content_spriteFrame",void 0),st([Zt({type:k,tooltip:"确认按钮"}),ot("design:type",k)],Qt.prototype,"btn_confirm",void 0),st([Zt({type:A,tooltip:"确认按钮精灵图"}),ot("design:type",A)],Qt.prototype,"confirm_spriteFrame",void 0),st([Zt({type:k,tooltip:"取消按钮"}),ot("design:type",k)],Qt.prototype,"btn_cancel",void 0),st([Zt({type:A,tooltip:"取消按钮精灵图"}),ot("design:type",A)],Qt.prototype,"cancel_spriteFrame",void 0),st([Zt({type:k,tooltip:"关闭按钮"}),ot("design:type",k)],Qt.prototype,"btn_close",void 0),Qt=st([zt("CoreUIModal")],Qt);class Yt{static ins;static get instance(){return this.ins||(this.ins=new Yt),this.ins}onAppInitDelegate=new I;audio;event;gui;storage;res;util;async boot(){this.res=new jt,this.util=new Wt(this),this.storage=new et(this),this.event=new qt,this.audio=new tt(this),this.gui=(await new $t(this).init()).gui}}const te=Yt.instance;m.onPostProjectInitDelegate.add((async()=>{console.time("[Init App]"),await te.boot(),await te.onAppInitDelegate.dispatch(),console.timeEnd("[Init App]")}));export{Q as AudioEventConstant,ht as AudioSourceBaseComponent,lt as AudioTypeEnum,it as BaseComponent,Z as BaseManager,Gt as BasePrefab,Bt as CoreBlackMask,Nt as CoreNotice,St as CoreReconnection,Ct as CoreShowLoading,ft as CoreToast,mt as CoreUIContainer,Qt as CoreUIModal,Wt as CoreUtil,_t as GlobalEventConstant,Dt as Gui,$t as GuiManager,Mt as LayerType,Yt as Manager,Ot as ReconnectPrompt,ut as ToastType,Xt as WrapperSocialGameClient,te as cat};
|
|
1
|
+
import{AudioSource as t,_decorator as e,AudioClip as s,error as o,Node as i,director as n,log as r,sys as a,Component as c,Prefab as l,instantiate as h,isValid as d,Layers as p,view as u,Widget as f,v3 as _,tween as y,Enum as g,game as m,Label as v,UITransform as E,UIOpacity as b,Tween as C,BlockInputEvents as w,Button as k,Director as O,warn as S,assetManager as x,Asset as R,resources as N,SpriteFrame as A,Sprite as T,AsyncDelegate as I}from"cc";import{PREVIEW as M,DEBUG as D}from"cc/env";import{makeObservable as F,observable as U,autorun as P,reaction as H}from"@shimotsuki/mobx";import L from"crypto-es";import{clone as B,create as G}from"@bufbuild/protobuf";import{SocialGameClient as $,AudienceOptionsSchema as j}from"sgc";class q extends t{cat;initAudio(t){return this.cat=t,this}}const{ccclass:K,menu:V}=e;class J extends q{effects=new Map;load(t){return new Promise(((e,o)=>{this.cat.res.load(t,s,((s,i)=>{if(s)return o(s);this.effects.set(t,i),this.playOneShot(i,this.volume),e(i)}))}))}release(){for(let t in this.effects)this.cat.res.release(t);this.effects.clear()}}const{ccclass:W,menu:X}=e;class z extends q{onComplete=null;_progress=0;_url=null;_isPlay=!1;get progress(){return this.duration>0&&(this._progress=this.currentTime/this.duration),this._progress}set progress(t){this._progress=t,this.currentTime=t*this.duration}load(t,e){this.cat.res.load(t,s,((s,i)=>{s&&o(s),this.playing&&(this._isPlay=!1,this.stop(),this.cat.res.release(this._url)),this.playOnAwake=!1,this.enabled=!0,this.clip=i,this._url=t,e&&e()}))}update(t){this.currentTime>0&&(this._isPlay=!0),this._isPlay&&0==this.playing&&(this._isPlay=!1,this.enabled=!1,this.onComplete&&this.onComplete())}release(){this._url&&(this.cat.res.release(this._url),this._url=null)}}class Z{cat;constructor(t){this.cat=t}}var Q;!function(t){t.MUSIC_ON="AudioEventConstant/MUSIC_ON",t.MUSIC_OFF="AudioEventConstant/MUSIC_OFF",t.EFFECT_ON="AudioEventConstant/EFFECT_ON",t.EFFECT_OFF="AudioEventConstant/EFFECT_OFF",t.PAUSE_AUDIO="AudioEventConstant/PAUSE_AUDIO",t.RESUME_AUDIO="AudioEventConstant/RESUME_AUDIO"}(Q||(Q={}));const Y="game_audio";class tt extends Z{local_data={};music;effect;_volume_music=1;_volume_effect=1;_switch_music=!0;_switch_effect=!0;constructor(t){super(t);var e=new i("UIAudioManager");n.addPersistRootNode(e);var s=new i("UIMusic");s.parent=e,this.music=s.addComponent(z).initAudio(t);var o=new i("UIEffect");o.parent=e,this.effect=o.addComponent(J).initAudio(t),this.load()}setMusicComplete(t=null){this.music.onComplete=t}playMusic(t,e){this.music.loop=!0,t&&this.music.load(t,(()=>{this._switch_music&&this.music?.play(),e&&e()}))}stopMusic(){0!=this.music.state&&this.music?.stop()}pauseMusic(){1==this.music.state&&this.music?.pause()}resumeMusic(){[0,2].includes(this.music.state)&&this.music?.play()}get progressMusic(){return this.music.progress}set progressMusic(t){this.music.progress=t}get volumeMusic(){return this._volume_music}set volumeMusic(t){this._volume_music=t,this.music.volume=t}get switchMusic(){return this._switch_music}set switchMusic(t){if(r("设置背景音乐开关值",t,this._switch_music),t==this._switch_music)return;this._switch_music=t,t?this.resumeMusic():this.pauseMusic();const e=t?Q.MUSIC_ON:Q.MUSIC_OFF;this.cat.event.has(e)&&this.cat.event.dispatchEvent(e),this.save()}async playEffect(t){this._switch_effect&&t&&await this.effect.load(t).then((()=>{this.effect.play()}))}stopEffect(){this.effect?.stop()}get volumeEffect(){return this._volume_effect}set volumeEffect(t){this._volume_effect=t,this.effect.volume=t}get switchEffect(){return this._switch_effect}set switchEffect(t){if(t==this._switch_effect)return;this._switch_effect=t,t?this.effect?.play():this.effect?.stop();const e=t?Q.EFFECT_ON:Q.EFFECT_OFF;this.cat.event.has(e)&&this.cat.event.dispatchEvent(e),this.save()}resumeAll(){this.switchMusic&&this.music?.play(),this.switchEffect&&this.effect?.play()}pauseAll(){this.music?.pause(),this.effect?.pause()}stopAll(){this.music?.stop(),this.effect?.stop()}save(){this.local_data.volume_music=this._volume_music,this.local_data.volume_effect=this._volume_effect,this.local_data.switch_music=this._switch_music,this.local_data.switch_effect=this._switch_effect;let t=JSON.stringify(this.local_data);this.cat.storage.set(Y,t)}load(){try{let t=this.cat.storage.get(Y);this.local_data=JSON.parse(t),this._volume_music=this.local_data.volume_music,this._volume_effect=this.local_data.volume_effect,this._switch_music=this.local_data.switch_music,this._switch_effect=this.local_data.switch_effect}catch(t){this.local_data={},this._volume_music=.6,this._volume_effect=1,this._switch_music=!0,this._switch_effect=!0}this.music&&(this.music.volume=this._volume_music),this.effect&&(this.effect.volume=this._volume_effect)}}class et extends Z{_key=null;_iv=null;_id="";init(t,e){this.cat.util.encryptUtil.initCrypto(t,e),this._key=this.cat.util.encryptUtil.md5(t),this._iv=this.cat.util.encryptUtil.md5(e)}setUser(t){this._id=t}set(t,e){if(null!=(t=`${t}_${this._id}`)){if(M||(t=this.cat.util.encryptUtil.md5(t)),null==e)return console.warn("存储的值为空,则直接移除该存储"),void this.remove(t);if("function"!=typeof e){if("object"==typeof e)try{e=JSON.stringify(e)}catch(t){return void console.error(`解析失败,str = ${e}`)}else"number"==typeof e&&(e+="");M||null==this._key||null==this._iv||(e=this.cat.util.encryptUtil.aesEncrypt(`${e}`,this._key,this._iv)),a.localStorage.setItem(t,e)}else console.error("储存的值不能为方法")}else console.error("存储的key不能为空")}get(t,e){if(null==t)return console.error("存储的key不能为空"),null;t=`${t}_${this._id}`,M||(t=this.cat.util.encryptUtil.md5(t));let s=a.localStorage.getItem(t);return null==s||""===s||M||null==this._key||null==this._iv||(s=this.cat.util.encryptUtil.aesDecrypt(s,this._key,this._iv)),null===s?e:s}getNumber(t,e=0){var s=this.get(t);return Number(s)||e}getBoolean(t){var e=this.get(t);return Boolean(e)||!1}getJson(t,e){var s=this.get(t);return s&&JSON.parse(s)||e}remove(t){null!=t?(t=`${t}_${this._id}`,M||(t=this.cat.util.encryptUtil.md5(t)),a.localStorage.removeItem(t)):console.error("存储的key不能为空")}clear(){a.localStorage.clear()}}function st(t,e,s,o){var i,n=arguments.length,r=n<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,s):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,s,o);else for(var a=t.length-1;a>=0;a--)(i=t[a])&&(r=(n<3?i(r):n>3?i(e,s,r):i(e,s))||r);return n>3&&r&&Object.defineProperty(e,s,r),r}function ot(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"function"==typeof SuppressedError&&SuppressedError;class it extends c{props={};data={};autorunDisposers=[];reactionDisposers=[];hook={destroyed:()=>{},started:()=>{}};initUI(){}added(){}__preload(){this.initUI(),this.onAutoObserver()}constructor(){super(),F(this,{props:U,data:U})}onAutoObserver(){}addAutorun(t){return(Array.isArray(t)?t:[t]).forEach((t=>{const e=P(t);this.autorunDisposers.push(e)})),this}addReaction(t,e,s){const o=H(t,e,s);return this.reactionDisposers.push(o),this}_onPreDestroy(){this.autorunDisposers.forEach((t=>{t()})),this.reactionDisposers.forEach((t=>{t()})),this.autorunDisposers=[],this.reactionDisposers=[],super._onPreDestroy()}onDisable(){this.onHide(),te.event.deleteEventByComponent(this),this.removeListener()}onEnable(){this.onShow(),this.addListener(),this.onEventListener()}onEventListener(){}addListener(){}removeListener(){}addToParent(t,e){let s=t instanceof l?h(t):t instanceof c?t.node:t;return this.setOptions(e),s.addChild(this.node),this.added(),this}setOptions(t){if(t)for(let e in t)switch(e){case"hook":t.hook&&(this.hook=t.hook);break;case"props":null!==t.props&&"object"==typeof t.props&&(this.props=t.props);break;case"data":null!==t.data&&"object"==typeof t.data&&(this.data=t.data)}}setUpdateData(t){return t&&Object.assign(this.data,t),this}setUpdateProps(t){return this.props,t&&Object.assign(this.props,t),this}removeAndDestroy(){d(this?.node)&&(this.node.removeFromParent(),this.node.destroy())}setPosition(t){return this.node.setPosition(t),this}setScale(t){return this.node.setScale(t),this}setAngle(t){return this.node.angle=t,this}setRotation(t){return this.node.setRotation(t),this}onShow(){}onHide(){}setNodeAndChildrenLayer(t){return nt(this.node,t),this}}const nt=(t,e)=>{t.layer="string"==typeof e?2**p.nameToLayer(e):e,t?.children.forEach((t=>{nt(t,e)}))};class rt extends it{lastEnterDirection="center";screen;isClosing=!1;root;constructor(){super(),this._init()}_init(){this.root=this.node,this.screen=u.getVisibleSize()}async showTween({isMotion:t=!0,direction:e="center",duration:s=.1,isBounce:o=!0,bounceDuration:i=.05}){if(this.lastEnterDirection=e,t){const t=this.node.getComponent(f);let i,n;t&&(t.updateAlignment(),t.enabled=!1),_(1.1,1.1,1),"center"==e?(i=_(.01,.01,.01),n=_(1,1,1)):(i="left"==e?_(-this.screen.width,0,0):"right"==e?_(this.screen.width,0,0):_(0,"top"==e?this.screen.height:-this.screen.height,0),n=_(0,0,0)),await this.handle(e,s,i,n,o),t&&(t.enabled=!0)}}async hideTween({isMotion:t=!0,direction:e,duration:s=.1}){if(e=e||this.lastEnterDirection,!this.isClosing){if(this.isClosing=!0,y(this.node).removeSelf(),t){const t=this.node.getComponent(f);let o,i;t&&(t.enabled=!1),"center"==e?(o=this.node.scale,i=_(0,0,0)):(i="left"==e?_(-this.screen.width,0,0):"right"==e?_(this.screen.width,0,0):_(0,"top"==e?this.screen.height:-this.screen.height,0),o=this.node.getPosition()),await this.handle(e,s,o,i,!1)}this.removeAndDestroy()}}async handle(t,e,s,o,i){"center"==t?this.node.setScale(s):this.node.setPosition(s),await this.deftween(e,{["center"==t?"scale":"position"]:o},i)}deftween(t,e,s,o){return new Promise(((s,o)=>{y(this.node).to(t,e).call((()=>{s()})).start()}))}}const{ccclass:at,property:ct}=e;var lt;!function(t){t[t.EFFECT=0]="EFFECT",t[t.BGM=1]="BGM"}(lt||(lt={}));class ht extends it{type=lt.EFFECT;clip=null;loop=!1;volume=1;playOnAwake=!1;audioSource=new t;onEnable(){super.onEnable(),this.clip&&(this.audioSource.clip=this.clip),this.audioSource.loop=this.loop,this.audioSource.volume=this.volume,this.audioSource.playOnAwake=this.playOnAwake,te.event.on(Q.EFFECT_ON,this.onPlayEffectHandler,this).on(Q.EFFECT_OFF,this.onStopEffectHandler,this).on(Q.MUSIC_ON,this.onPlayMusicHandler,this).on(Q.MUSIC_OFF,this.onStopMusicHandler,this)}__preload(){super.__preload();const{volumeEffect:t,volumeMusic:e}=te.audio;this.audioSource.volume=this.type===lt.BGM?e:t}start(){}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=te.audio;this.audioSource.playing||!(this.type===lt.BGM?e:t)||m._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}st([ct({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:g(lt)}),ot("design:type",Object)],ht.prototype,"type",void 0),st([ct({tooltip:"音源",type:s}),ot("design:type",Object)],ht.prototype,"clip",void 0),st([ct({tooltip:"循环"}),ot("design:type",Object)],ht.prototype,"loop",void 0),st([ct({tooltip:"音量"}),ot("design:type",Object)],ht.prototype,"volume",void 0),st([ct({tooltip:"是否启用自动播放"}),ot("design:type",Object)],ht.prototype,"playOnAwake",void 0);const{ccclass:dt,property:pt}=e;var ut;!function(t){t[t.FIXED=0]="FIXED",t[t.SLIDE=1]="SLIDE"}(ut||(ut={}));let ft=class extends it{fixed_node;slide_node;fixed_label;slide_label;onLoad(){this.fixed_node.active=this.slide_node.active=!1}start(){this.show()}async show(){return new Promise((async(t,e)=>{const{title:s,type:o,fixed_time:i}=this.props;if(o==ut.FIXED){this.fixed_node.active=!0,this.fixed_label.string=`${s}`,this.fixed_label.updateRenderData(!0);const e=this.fixed_label.node.getComponent(E).height;e-this.fixed_node.getComponent(E).height>0&&(this.fixed_node.getComponent(E).height=e+100),this.scheduleOnce((()=>{this.node.destroy(),t()}),i)}else{this.slide_node.active=!0,this.slide_label.string=`${s}`,this.slide_label.updateRenderData(!0);const e=this.slide_label.node.getComponent(E).width;this.slide_node.getComponent(E).width-e<100&&(this.slide_node.getComponent(E).width=e+100),this.playAnim(this.node).then((()=>{t()}))}}))}playAnim(t){return new Promise(((e,s)=>{const o=this.node.getComponent(b),i=y(o).delay(1.2).to(.5,{opacity:0}).call((()=>{C.stopAllByTarget(t),this.node.destroy(),e()}));y(t).by(.5,{position:_(0,400,0)}).call((()=>{i.start()})).start()}))}onDestroy(){C.stopAllByTarget(this.node),this.unscheduleAllCallbacks()}};var _t;st([pt({type:i,tooltip:"固定节点"}),ot("design:type",i)],ft.prototype,"fixed_node",void 0),st([pt({type:i,tooltip:"滑动节点"}),ot("design:type",i)],ft.prototype,"slide_node",void 0),st([pt({type:v,tooltip:"固定标签节点"}),ot("design:type",v)],ft.prototype,"fixed_label",void 0),st([pt({type:v,tooltip:"滑动标签节点"}),ot("design:type",v)],ft.prototype,"slide_label",void 0),ft=st([dt("CoreToast")],ft),function(t){t.EVENT_SHOW="GlobalEventConstant/EVENT_SHOW",t.EVENT_HIDE="GlobalEventConstant/EVENT_HIDE",t.GAME_RESIZE="GlobalEventConstant/GAME_RESIZE",t.EVENT_CLOSE="GlobalEventConstant/EVENT_CLOSE",t.ONLINE="GlobalEventConstant/ONLINE",t.OFFLINE="GlobalEventConstant/OFFLINE",t.ROOT_MASK_UPDATE="GlobalEventConstant/ROOT_MASK_UPDATE",t.ROOT_MASK_CHANGE="GlobalEventConstant/ROOT_MASK_CHANGE"}(_t||(_t={}));const{ccclass:yt,property:gt}=e;let mt=class extends rt{scene_mask_node;ui_container;gui=null;onLoad(){this.setSceneMaskActive(!1)}get scene_mask(){return this.scene_mask_node.getComponent(Bt)}get brother(){return this.ui_container.children||[]}get tweenChildren(){return this.scene_mask.tween.children}onEventListener(){te.event.on(_t.ROOT_MASK_CHANGE,this.uiMaskChanged,this)}addMask(){const t=this.brother[this.brother.length-1];t&&this.scene_mask.node.setSiblingIndex(t.getSiblingIndex()),this.blockMaskSiblingIndexChanged()}subMask(){const t=this.brother[this.brother.length-2];t&&this.scene_mask.node.setSiblingIndex(t.getSiblingIndex()),this.blockMaskSiblingIndexChanged()}blockMaskSiblingIndexChanged(){this.tweenChildren.length>1||this.brother.length>1?this.show():this.hide()}addNodeToTween(t){return this.scene_mask?(this.scene_mask.tween.addChild(t),this):(console.error("scene_mask is null"),this)}show(){this.setSceneMaskActive(!0)}hide(){this.setSceneMaskActive(!1)}setGui(t){return this.gui=t,this}uiMaskChanged(){this.blockMaskSiblingIndexChanged()}setSceneMaskActive(t){this.scene_mask.black_mask.active=!this.gui.root_mask.active&&t}};st([gt({type:i}),ot("design:type",i)],mt.prototype,"scene_mask_node",void 0),st([gt({type:i}),ot("design:type",i)],mt.prototype,"ui_container",void 0),mt=st([yt("CoreUIContainer")],mt);const{ccclass:vt,property:Et}=e;let bt=class extends Pt{title;loadingTween;loading_rotate=0;onAutoObserver(){this.addAutorun([()=>{this.props?.title&&(this.title.string=`${this.props?.title}`),this.title.node.active=!!this.props?.title?.length},()=>{this.getComponent(w).enabled=!!this.props?.mask}])}update(t){this.loading_rotate+=220*t,this.loadingTween.setRotationFromEuler(0,0,-this.loading_rotate%360),this.loading_rotate>360&&(this.loading_rotate-=360)}};st([Et({type:v,tooltip:"标题"}),ot("design:type",v)],bt.prototype,"title",void 0),st([Et({type:i,tooltip:"动画"}),ot("design:type",i)],bt.prototype,"loadingTween",void 0),bt=st([vt("CoreShowLoading")],bt);const{ccclass:Ct,property:wt}=e;var kt;!function(t){t.RECONNECTED="重连成功",t.RECONNECTING="正在重连",t.MAX_RECONNECT="重连次数超出限制,请检查网络",t.RECONNECTED_ERROR="重连失败,请检查网络",t.CONNECT_PARAM_ERROR="游戏参数错误,请重新加载",t.KICK="账号已下线",t.OFFLINE="网络已断开",t.ONLINE="网络已连接",t.GAME_ERROR="连接游戏服错误"}(kt||(kt={}));let Ot=class extends Pt{common_prompt_text;btn_confirm;is_close=!1;props={content:null};initUI(){this.btn_confirm.node.active=!1}onLoad(){this.btn_confirm.node.on(k.EventType.CLICK,this.onConfirmHandler,this),this.addAutorun([()=>{this.common_prompt_text.string=this.props.content??""}])}onDestroy(){this.unscheduleAllCallbacks()}updateProps(t){this.updatePromptText(t,t==kt.RECONNECTING)}updatePromptText(t,e=!1){if(this.unscheduleAllCallbacks(),this.props.content=t,r("更新提示文案:",t),e){let e=0;const s=()=>{e=(e+1)%4,this.common_prompt_text.string=t+["","·","··","···"][e]};this.schedule(s,.5)}}onConfirmHandler(){this.is_close=!0,te.gui.hideReconnect()}};st([wt({type:v,tooltip:"通用提示文本"}),ot("design:type",v)],Ot.prototype,"common_prompt_text",void 0),st([wt({type:k,tooltip:"确定按钮"}),ot("design:type",k)],Ot.prototype,"btn_confirm",void 0),Ot=st([Ct("CoreReconnection")],Ot);const{ccclass:St,property:xt}=e;let Rt=class extends Pt{text;btn_confirm;onLoad(){this.btn_confirm.node.on(k.EventType.CLICK,this.onConfrimHandler,this)}start(){this.props&&this.updateProps(this.props)}onConfrimHandler(){this.props?.confrim?.(),te.gui.hideNotice()}updateProps(t){this.text.string=`${t.text}`}};st([xt({type:v,tooltip:"提示文本"}),ot("design:type",v)],Rt.prototype,"text",void 0),st([xt({type:k,tooltip:"确定按钮"}),ot("design:type",k)],Rt.prototype,"btn_confirm",void 0),Rt=st([St("CoreNotice")],Rt);class Nt extends it{isReload}const{ccclass:At,property:Tt}=e;var It;!function(t){t[t.UI=0]="UI",t[t.LOADING=1]="LOADING",t[t.TOAST=2]="TOAST",t[t.RECONNECTTION=3]="RECONNECTTION",t[t.NOTICE=4]="NOTICE"}(It||(It={}));let Mt=class extends it{reconnection_ui_prefab;toast_ui_prefab;loading_ui_prefab;notice_ui_prefab;ui_prefab;root_ui;root_toast;root_mask;cat;ui_container_component;reconnection_ui_component;notice_ui_component;loading_ui_component;toast_ui_component;currentScene;onEventListener(){this.cat.event.on(_t.ROOT_MASK_UPDATE,this.onRootUpdate,this)}init(t){this.cat=t;const e=n.getScene();return r("init scene"),e&&this.changeScene(e),this}start(){this.onRootUpdate()}showToast({title:t="",type:e=ut.SLIDE,fixed_time:s=2}){const o=h(this.toast_ui_prefab);return r("showToast",t),this.toast_ui_component=o.getComponent(ft).addToParent(this.root_toast,{props:{title:t,type:e,fixed_time:s}}),this}hideToast(){return this.toast_ui_component?.removeAndDestroy(),this}showLoading({title:t="",mask:e=!0,black:s=!0}={}){if(r("showLoading",t),this.loading_ui_component)this.loading_ui_component.setOptions({props:{title:t,mask:e,black:s}});else{const o=h(this.loading_ui_prefab);this.loading_ui_component=o.getComponent(bt).addToParent(this.root_ui,{props:{title:t,mask:e,black:s}})}return this}hideLoading(){return this.loading_ui_component?.removeAndDestroy(),this.loading_ui_component=null,this}showReconnect(t){if(this.reconnection_ui_component)this.reconnection_ui_component.setUpdateProps({content:t});else{const e=h(this.reconnection_ui_prefab);this.reconnection_ui_component=e.getComponent(Ot).addToParent(this.root_ui,{props:{content:t}})}return this}hideReconnect(){return this.reconnection_ui_component?.removeAndDestroy(),this.reconnection_ui_component=null,this}showNotice(t){const e=h(this.notice_ui_prefab);return this.notice_ui_component=e.getComponent(Rt).addToParent(this.root_ui,{props:t}),this}hideNotice(){return this.notice_ui_component?.removeAndDestroy(),this}loadScene(t,e,s){r("加载场景",t,e,s);let o={},i=s??!1;return"boolean"==typeof e?i=e:o=e??{},r("当前场景",n.getScene()?.uuid,n.getScene()?.name),n.once(O.EVENT_BEFORE_SCENE_LAUNCH,(t=>{r("Director.EVENT_BEFORE_SCENE_LAUNCH",t),this.changeScene(t,o,i)})),n.loadScene(t),this}resetScene(t=""){return t=t||this.currentScene,this.loadScene(t)}cleanScene(){this.resetScene().hideLoading().hideNotice().hideReconnect().hideToast()}changeScene(t,e,s){this.currentScene=t.name,this.createUILayer(t);const o=t.getComponentInChildren(Nt);o&&(o.isReload=s??!1),o?.setOptions(e)}createUILayer(t){this.ui_container_component?.removeAndDestroy(),this.ui_container_component=null;const e=h(this.ui_prefab);this.ui_container_component=e.getComponent(mt).setGui(this).addToParent(t)}reloadScene(){this.loadScene(this.currentScene,!0)}async closeUI(t,e){const{component:s}=this.findUIBaseLayer(t,!1);s&&(s.setOptions({...e?.hook??{},...e?.props??{}}),await s.hideTween(e||{}),this.ui_container_component?.subMask())}async openUI(t,e){const{rootNode:s,component:o}=this.findUIBaseLayer(t,!0);s.getComponent(rt),o?.setOptions(e),s&&this.ui_container_component?.addNodeToTween(s).addMask(),o&&await o.showTween(e||{}),this.ui_container_component?.ui_container&&o?.addToParent(this.ui_container_component.ui_container)}findUIBaseLayer(t,e){let s,n=null;if(t instanceof i){s=t;const e=t.components.filter((t=>t instanceof rt));if(!e.length)return o(`${t.name}节点未找到继承自BaseLayer的组件`),{rootNode:s,component:n};1==e.length?n=e[0]:S(`${t.name}节点存在多个继承自BaseLayer的组件`)}else if(s=t.node,n=t,e){for(;s.parent;)s=s.parent;n.root=s}else s=t.root;return{rootNode:s,component:n}}onRootUpdate(){const t=this.root_ui.children.length;if(this.root_mask.active=t>1,t>1){const e=this.root_ui.children[t-2];this.root_mask.setSiblingIndex(e.getSiblingIndex())}this.cat.event.dispatchEvent(_t.ROOT_MASK_CHANGE)}};st([Tt({type:l,tooltip:"断线重连UI预制体"}),ot("design:type",l)],Mt.prototype,"reconnection_ui_prefab",void 0),st([Tt({type:l,tooltip:"提示UI预制体"}),ot("design:type",l)],Mt.prototype,"toast_ui_prefab",void 0),st([Tt({type:l,tooltip:"加载UI预制体"}),ot("design:type",l)],Mt.prototype,"loading_ui_prefab",void 0),st([Tt({type:l,tooltip:"公告UI预制体"}),ot("design:type",l)],Mt.prototype,"notice_ui_prefab",void 0),st([Tt({type:l,tooltip:"UI层预制体"}),ot("design:type",l)],Mt.prototype,"ui_prefab",void 0),st([Tt({type:i,tooltip:"root-UI层"}),ot("design:type",i)],Mt.prototype,"root_ui",void 0),st([Tt({type:i,tooltip:"root-组件层"}),ot("design:type",i)],Mt.prototype,"root_toast",void 0),st([Tt({type:i,tooltip:"root-mask"}),ot("design:type",i)],Mt.prototype,"root_mask",void 0),Mt=st([At("Gui")],Mt);const{ccclass:Dt,property:Ft}=e;class Ut extends rt{type=lt.EFFECT;clip=null;loop=!1;volume=1;playOnAwake=!1;audioSource=new t;onEnable(){super.onEnable(),te.event.on(Q.EFFECT_ON,this.onPlayEffectHandler,this).on(Q.EFFECT_OFF,this.onStopEffectHandler,this).on(Q.MUSIC_ON,this.onPlayMusicHandler,this).on(Q.MUSIC_OFF,this.onStopMusicHandler,this)}__preload(){this.clip&&(this.audioSource.clip=this.clip),this.audioSource.loop=this.loop,this.audioSource.volume=this.volume,this.audioSource.playOnAwake=this.playOnAwake,super.__preload();const{volumeEffect:t,volumeMusic:e}=te.audio;this.audioSource.volume=this.type===lt.BGM?e:t}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=te.audio;this.audioSource.playing||!(this.type===lt.BGM?e:t)||m._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}st([Ft({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:g(lt)}),ot("design:type",Object)],Ut.prototype,"type",void 0),st([Ft({tooltip:"音源",type:s}),ot("design:type",Object)],Ut.prototype,"clip",void 0),st([Ft({tooltip:"循环"}),ot("design:type",Object)],Ut.prototype,"loop",void 0),st([Ft({tooltip:"音量"}),ot("design:type",Object)],Ut.prototype,"volume",void 0),st([Ft({tooltip:"是否启用自动播放"}),ot("design:type",Object)],Ut.prototype,"playOnAwake",void 0);class Pt extends rt{onEnable(){super.onEnable(),this.updateMask()}onDisable(){super.onDisable(),this.updateMask()}updateMask(){te.event.dispatchEvent(_t.ROOT_MASK_UPDATE)}}const{ccclass:Ht,property:Lt}=e;let Bt=class extends it{tween;black_mask};var Gt;st([Lt({type:i,tooltip:"动画节点"}),ot("design:type",i)],Bt.prototype,"tween",void 0),st([Lt({type:i,tooltip:"遮罩节点"}),ot("design:type",i)],Bt.prototype,"black_mask",void 0),Bt=st([Ht("CoreBlackMask")],Bt),function(t){t.Root="core/root",t.Toast="core/toast",t.BlackMask="core/black-mask",t.Loading="core/loading",t.Notice="core/notice",t.Reconnection="core/reconnection"}(Gt||(Gt={}));class $t extends Z{_gui;get gui(){return this._gui}set gui(t){this._gui=t}getGuiPrefabByType=t=>new Promise(((e,s)=>{this.cat.res.load(t,((t,o)=>{t?s(t):e(o)}))}));async init(){const t=await this.getGuiPrefabByType(Gt.Root),e=h(t);return this.gui=e.getComponent(Mt).init(this.cat),n.addPersistRootNode(e),this}}class jt{get=(t,e,s="resources")=>x.getBundle(s).get(t,e);isAssetType=t=>"function"==typeof t&&t.prototype instanceof R;async load(...t){let e=null,s=null,o=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let i=t.shift();this.isAssetType(t[0])&&(s=t.shift()),2==t.length&&(o=t.shift());const n=t.shift();let r=N;if(e&&"resources"!=e){x.bundles.has(e)||await this.loadBundle(e);let t=x.bundles.get(e);t&&(r=t)}o&&n?r.load(i,s,o,n):n?r.load(i,s,n):r.load(i,s)}async loadDir(...t){let e=null,s=null,o=null,i=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let n=t.shift();this.isAssetType(t[0])&&(s=t.shift()),2==t.length&&(o=t.shift()),i=t.shift();let r=N;if(e&&"resources"!=e){x.bundles.has(e)||await this.loadBundle(e);let t=x.bundles.get(e);t&&(r=t)}o&&i?r.loadDir(n,s,o,i):i?r.loadDir(n,s,i):r.loadDir(n,s)}loadRemote(t,...e){var s,o=null;2==e.length&&(o=e.shift()),s=e.shift(),x.loadRemote(t,{ext:".png",...o},s)}loadBundle=(t,e)=>new Promise(((s,o)=>{const i=(t,e)=>{if(t)return o(t);s(e)};e?x.loadBundle(t,{version:e},i):x.loadBundle(t,i)}));releasePrefabtDepsRecursively=t=>{var e=x.assets.get(t);(x.releaseAsset(e),e instanceof l)&&x.dependUtil.getDepsRecursively(t).forEach((t=>{x.assets.get(t).decRef()}))};release=(t,e="resources")=>{var s=x.getBundle(e);if(s){var o=s.get(t);o&&this.releasePrefabtDepsRecursively(o._uuid)}};releaseDir=(t,e="resources")=>{var s=x.getBundle(e),o=s?.getDirWithPath(t);o?.map((t=>{this.releasePrefabtDepsRecursively(t.uuid)})),!t&&"resources"!=e&&s&&x.removeBundle(s)};dump=()=>{x.assets.forEach(((t,e)=>{r(x.assets.get(e))})),r(`当前资源总数:${x.assets.count}`)}}class qt{events=new Map;on(t,e,s){if(!t||!e)return S(`注册【${t}】事件的侦听器函数为空`),this;const o=this.events.get(t)??this.events.set(t,new Map).get(t);return o.has(s)?(S(`名为【${t}】的事件重复注册侦听器`),this):(o.set(s,e),this)}once(t,e,s){let o=(i,n)=>{this.off(t,o,s),o=null,e.call(s,i,n)};this.on(t,o,s)}off(t,e,s){if(!this.events.get(t)?.has(s))return this;const i=this.events.get(t);return i.get(s)!==e?(o(`${s}注册事件和取消事件不一致`),this):(i.delete(s),this)}dispatchEvent(t,e){if(!this.events.has(t))return this;const s=this.events.get(t);for(const[o,i]of s)i.call(o,e,t);return this}offAll(){this.events.clear()}has(t){return this.events.has(t)}deleteEventByComponent(t){for(const[e,s]of this.events){for(const[e]of s)e===t&&s.delete(e);0===s.size&&this.events.delete(e)}}}let Kt=null;const Vt={stringify:t=>{const e={ct:t.ciphertext.toString(L.enc.Base64)};return t.iv&&(e.iv=t.iv.toString()),t.salt&&(e.s=t.salt.toString()),JSON.stringify(e)},parse:t=>{const e=JSON.parse(t),s=L.lib.CipherParams.create({ciphertext:L.enc.Base64.parse(e.ct)});return e.iv&&(s.iv=L.enc.Hex.parse(e.iv)),e.s&&(s.salt=L.enc.Hex.parse(e.s)),s}};var Jt=Object.freeze({__proto__:null,JsonFormatter:Vt,aesDecrypt:(t,e,s)=>L.AES.decrypt(t,e,{iv:Kt,format:Vt}).toString(L.enc.Utf8),aesEncrypt:(t,e,s)=>L.AES.encrypt(t,e,{iv:Kt,format:Vt}).toString(),initCrypto:(t,e)=>{Kt=L.enc.Hex.parse(e)},md5:t=>L.MD5(t).toString()});class Wt extends Z{encryptUtil=Jt}class Xt extends ${isNeedReconnect=!1;isOnline=!0;isInBackground=!1;running=!1;index=0;logBlackList=[];constructor(t,e,s){super(t,e,s),this.running=!0,this.addEvent()}addEvent(){this.on("connected",(()=>this.handleEvent({type:"connected"}))).on("reconnected",(()=>this.handleEvent({type:"reconnected"}))).on("disconnect",(t=>this.handleEvent({type:"disconnect",ev:t}))).on("handshakeError",(t=>this.handleEvent({type:"handshakeError",ret:t}))).on("kick",(()=>this.handleEvent({type:"kick"}))).on("reconnecting",(()=>this.handleEvent({type:"reconnecting"}))).on("maxReconnect",(()=>this.handleEvent({type:"maxReconnect"}))).on("error",(t=>this.handleEvent({type:"error",ev:t}))),te.event.on(_t.EVENT_SHOW,this.onShowHandler,this).on(_t.EVENT_HIDE,this.onHideHandler,this).on(_t.ONLINE,this.onOnlineHandler,this).on(_t.OFFLINE,this.onOfflineHandler,this)}removeEvent(){this.removeAllListeners(),te.event.off(_t.EVENT_SHOW,this.onShowHandler,this).off(_t.EVENT_HIDE,this.onHideHandler,this).off(_t.ONLINE,this.onOnlineHandler,this).off(_t.OFFLINE,this.onOfflineHandler,this)}onShowHandler(){r("[SHOW]"),this.isInBackground=!1,this.isNeedReconnect&&this.isOnline&&this.handleEvent({type:"show"})}onHideHandler(t){r("[HIDE]"),t().finally((()=>{this.isInBackground=!0,this.handleEvent({type:"hide"})}))}onOnlineHandler(){this.isOnline=!0,r("正在检查网络状态:"+(this.isOnline?"在线":"断开")),this.handleEvent({type:"online"})}onOfflineHandler(){this.isOnline=!1,r("正在检查网络状态:"+(this.isOnline?"在线":"断开")),this.handleEvent({type:"offline"})}async handleEvent(t){if(this.running)switch(t.type){case"init":break;case"connected":r("ws连接成功状态 connected"),this.isNeedReconnect=!1;break;case"reconnected":r("ws重连成功状态 reconnected",this.isSocketConnected),this.isNeedReconnect=!1,r("%c 重连成功状态","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index);try{await this.connectRequest(),r("重连成功状态 connectRequest "),te.gui.showToast({title:kt.RECONNECTED}),te.gui.hideReconnect().hideLoading(),te.gui.reloadScene()}catch(t){console.error(t),te.gui.showReconnect(kt.GAME_ERROR)}break;case"disconnect":r("断开连接状态 disconnect",t.ev),r("%c 断开连接状态","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index),this.isNeedReconnect=!0,this.handleEvent({type:"reconnect"});break;case"handshakeError":r("参数错误状态 handshakeError",t.ret),te.gui.showReconnect(kt.CONNECT_PARAM_ERROR),this.handleEvent({type:"destroy"});break;case"kick":r("%c 被踢出状态","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index),r("被踢出状态 kick"),te.gui.showReconnect(kt.KICK),this.handleEvent({type:"destroy"});break;case"reconnecting":r("正在重连状态 reconnecting"),this.isOnline&&this.isInBackground;break;case"maxReconnect":r("超出最大重连状态 maxReconnect"),te.gui.showReconnect(kt.MAX_RECONNECT);break;case"error":this.isOnline&&(r("ws报错状态 error",t.ev),"string"==typeof t.ev&&te.gui.showToast({title:t.ev}),te.gui.showReconnect(kt.RECONNECTED_ERROR));break;case"online":te.gui.showReconnect(kt.ONLINE),r("在线状态 online"),this.handleEvent({type:"reconnect"});break;case"offline":this.disconnect(!0),r("离线状态 offline"),this.isNeedReconnect=!0,te.gui.showReconnect(kt.OFFLINE);break;case"show":r("前台状态 show"),this.handleEvent({type:"reconnect"});break;case"hide":r("后台状态 hide"),this.disconnect(!0),this.isNeedReconnect=!0;break;case"reconnect":r("重连状态 reconnect"),this.isNeedReconnect&&!this.isInBackground&&this.isOnline&&(te.gui.showLoading({title:"正在重连"}),this.reset(),this.index+=1,r("%c ws重连次数","background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff",this.index),this.reconnectImmediately());break;case"destroy":r("销毁状态 destroy"),this.destroyStateMachine();break;default:r("Unknown event:",t.type)}}destroy(){this.handleEvent({type:"destroy"})}disconnect(t=!1){super.disconnect(t)}destroyStateMachine(){r("Destroying state machine"),this.running=!1,this.removeEvent(),this.disconnect(!0)}request(t,e,s){return D&&r(`%c ws客户端消息 %c [Request][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),new Promise(((i,n)=>{super.request(t,e,s).then((e=>{D&&r(`%c ws服务端消息 %c [Response][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7daa ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(s,e)),i(e)}),(t=>{o("request err",t),n(t)}))}))}async Request(t,e,s,{audOptions:o={forwardReq:!1,forwardResp:!1},show_log:i=!0}={}){if(!this.isSocketConnected)throw""+(this.isSocketConnected?"未加入战局/观战":"Socket未连接");return D&&i&&r(`%c ws客户端消息 %c [Request][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),this.GameRequest(t,e,s,G(j,o))}async GameRequest(t,e,s,o){return new Promise(((i,n)=>{super.GameRequest(t,e,s,o).then((e=>{D&&r(`%c ws服务端消息 %c [Response][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7daa ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(s,e)),i(e)}),(t=>{te.gui.showToast({title:t.msg}),n(t)}))}))}async gameRequest(t,e,s){return D&&r(`%c ws客户端消息 %c [Request][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),super.gameRequest(t,e,s)}GameNotify=async(t,e,s)=>{try{super.GameNotify(t,e,s)}catch(e){throw console.error(`Error in connectRequest for route ${t}: `,e),e}};Notify=async(t,e,{audOptions:s=G(j,{forwardReq:!1,forwardResp:!1}),show_log:o=!0}={})=>{this.isSocketConnected&&(D&&o&&r(`%c ws客户端消息 %c[Notify][${new Date}] %c ${t} %c`,"background:#ff00ff ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#3d7d3d ; padding: 1px; color: #fff","background:#ff00ff ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e.desc,e.message)),this.GameNotify(t,e,s))};subscribe(t,e,s){return super.subscribe(t,e,(o=>{D&&!this.logBlackList.includes(t)&&r(`%c ws服务端消息:[${new Date}] %c ${t} %c`,"background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color: #fff","background:#410083 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff","background:transparent",B(e,o)),te.event.dispatchEvent(t,B(e,o)),s?.(o)})),this}onData(t){super.onData(t)}}const{ccclass:zt,property:Zt}=e;let Qt=class extends rt{default_title=null;title;prompt_content_str;prompt_content_spriteFrame;btn_confirm;confirm_spriteFrame;btn_cancel;cancel_spriteFrame;btn_close;isConfirm=!1;props={title:this.default_title,content:null,confirmCB:()=>{},cancelCB:()=>{},style:null};onLoad(){this.btn_cancel.node.on(k.EventType.CLICK,this.onCancelHandler,this),this.btn_confirm.node.on(k.EventType.CLICK,this.onConfirmHandler,this),this.btn_close.node.on(k.EventType.CLICK,this.onCloseHandler,this),this.addAutorun([()=>{this.title.spriteFrame=this.props?.title||this.default_title},()=>{this.props.content instanceof A?this.prompt_content_spriteFrame.spriteFrame=this.props.content:"string"==typeof this.props.content?this.prompt_content_str.string=this.props.content:console.error("未知类型的【UIModal】内容")},()=>{null===this.props?.style?.confirm?this.btn_confirm.node.active=!1:(this.btn_confirm.node.active=!0,this.btn_confirm.getComponent(T).spriteFrame=this.props.style?.confirm||this.confirm_spriteFrame),null===this.props?.style?.cancel?this.btn_cancel.node.active=!1:(this.btn_cancel.node.active=!0,this.btn_cancel.getComponent(T).spriteFrame=this.props.style?.cancel||this.cancel_spriteFrame)}])}close(){this.props.cancelCB?.(),te.gui.closeUI(this)}onCancelHandler(){this.close()}onConfirmHandler(){this.props.confirmCB?.()}onDestroy(){this.isConfirm&&this.props.onDestroy?.()}onCloseHandler(){this.close()}};st([Zt({type:A,tooltip:"默认标题"}),ot("design:type",A)],Qt.prototype,"default_title",void 0),st([Zt({type:T,tooltip:"标题节点"}),ot("design:type",T)],Qt.prototype,"title",void 0),st([Zt({type:v,tooltip:"字符串内容按钮"}),ot("design:type",v)],Qt.prototype,"prompt_content_str",void 0),st([Zt({type:T,tooltip:"图片精灵内容按钮"}),ot("design:type",T)],Qt.prototype,"prompt_content_spriteFrame",void 0),st([Zt({type:k,tooltip:"确认按钮"}),ot("design:type",k)],Qt.prototype,"btn_confirm",void 0),st([Zt({type:A,tooltip:"确认按钮精灵图"}),ot("design:type",A)],Qt.prototype,"confirm_spriteFrame",void 0),st([Zt({type:k,tooltip:"取消按钮"}),ot("design:type",k)],Qt.prototype,"btn_cancel",void 0),st([Zt({type:A,tooltip:"取消按钮精灵图"}),ot("design:type",A)],Qt.prototype,"cancel_spriteFrame",void 0),st([Zt({type:k,tooltip:"关闭按钮"}),ot("design:type",k)],Qt.prototype,"btn_close",void 0),Qt=st([zt("CoreUIModal")],Qt);class Yt{static ins;static get instance(){return this.ins||(this.ins=new Yt),this.ins}onAppInitDelegate=new I;audio;event;gui;storage;res;util;async boot(){this.res=new jt,this.util=new Wt(this),this.storage=new et(this),this.event=new qt,this.audio=new tt(this),this.gui=(await new $t(this).init()).gui}}const te=Yt.instance;m.onPostProjectInitDelegate.add((async()=>{console.time("[Init App]"),await te.boot(),await te.onAppInitDelegate.dispatch(),console.timeEnd("[Init App]")}));export{Q as AudioEventConstant,ht as AudioSourceBaseComponent,Ut as AudioSourceUILayer,lt as AudioTypeEnum,it as BaseComponent,Z as BaseManager,Gt as BasePrefab,Bt as CoreBlackMask,Rt as CoreNotice,Ot as CoreReconnection,bt as CoreShowLoading,ft as CoreToast,mt as CoreUIContainer,Qt as CoreUIModal,Wt as CoreUtil,_t as GlobalEventConstant,Mt as Gui,$t as GuiManager,It as LayerType,Yt as Manager,kt as ReconnectPrompt,Pt as RootUILayer,Nt as SceneLayer,ut as ToastType,rt as UILayer,Xt as WrapperSocialGameClient,te as cat};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shimotsuki/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
"dist",
|
|
41
41
|
"package.json",
|
|
42
42
|
"./temp/tsconfig.cocos.json",
|
|
43
|
+
"./temp/declarations/",
|
|
44
|
+
"tsconfig.json",
|
|
43
45
|
"LICENSE"
|
|
44
46
|
]
|
|
45
47
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
|
|
2
|
+
/// <reference path="C:\ProgramData\cocos\editors\Creator\3.8.4\resources\resources\3d\engine\bin\.declarations\cc.d.ts"/>
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Global variable `cc` was dropped since 3.0. Use ES6 module syntax to import Cocos Creator APIs.
|
|
6
|
+
*/
|
|
7
|
+
declare const cc: never;
|
|
8
|
+
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
declare module 'cc/env'{
|
|
2
|
+
/**
|
|
3
|
+
* Running in Web platform
|
|
4
|
+
*/
|
|
5
|
+
export const HTML5: boolean;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Running in native platform (mobile app, desktop app, or simulator).
|
|
9
|
+
*/
|
|
10
|
+
export const NATIVE: boolean;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Running in ANDROID platform
|
|
14
|
+
*/
|
|
15
|
+
export const ANDROID: boolean;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Running in IOS platform
|
|
19
|
+
*/
|
|
20
|
+
export const IOS: boolean;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Running in MAC platform
|
|
24
|
+
*/
|
|
25
|
+
export const MAC: boolean;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Running in WINDOWS platform
|
|
29
|
+
*/
|
|
30
|
+
export const WINDOWS: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Running in LINUX platform
|
|
34
|
+
*/
|
|
35
|
+
export const LINUX: boolean;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Running in OHOS platform
|
|
39
|
+
*/
|
|
40
|
+
export const OHOS: boolean;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Running in OPEN_HARMONY platform
|
|
44
|
+
*/
|
|
45
|
+
export const OPEN_HARMONY: boolean;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Running in the Wechat's mini game.
|
|
49
|
+
*/
|
|
50
|
+
export const WECHAT: boolean;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Running in the Wechat's mini program.
|
|
54
|
+
*/
|
|
55
|
+
export const WECHAT_MINI_PROGRAM: boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Running in the baidu's mini game.
|
|
59
|
+
*/
|
|
60
|
+
export const BAIDU: boolean;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Running in the xiaomi's quick game.
|
|
64
|
+
*/
|
|
65
|
+
export const XIAOMI: boolean;
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Running in the alipay's mini game.
|
|
69
|
+
*/
|
|
70
|
+
export const ALIPAY: boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Running in the taobao creative app.
|
|
74
|
+
*/
|
|
75
|
+
export const TAOBAO: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Running in the taobao mini game.
|
|
79
|
+
*/
|
|
80
|
+
export const TAOBAO_MINIGAME: boolean;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Running in the ByteDance's mini game.
|
|
84
|
+
*/
|
|
85
|
+
export const BYTEDANCE: boolean;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Running in the oppo's quick game.
|
|
89
|
+
*/
|
|
90
|
+
export const OPPO: boolean;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Running in the vivo's quick game.
|
|
94
|
+
*/
|
|
95
|
+
export const VIVO: boolean;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Running in the huawei's quick game.
|
|
99
|
+
*/
|
|
100
|
+
export const HUAWEI: boolean;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Running in the cocosplay.
|
|
104
|
+
*/
|
|
105
|
+
export const COCOSPLAY: boolean;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Running in the qtt's quick game.
|
|
109
|
+
*/
|
|
110
|
+
export const QTT: boolean;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Running in the linksure's quick game.
|
|
114
|
+
*/
|
|
115
|
+
export const LINKSURE: boolean;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Running in the editor.
|
|
119
|
+
*/
|
|
120
|
+
export const EDITOR: boolean;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Run in editor but not in editor preview.
|
|
124
|
+
*/
|
|
125
|
+
export const EDITOR_NOT_IN_PREVIEW: boolean;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Preview in browser or simulator.
|
|
129
|
+
*/
|
|
130
|
+
export const PREVIEW: boolean;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Running in published project.
|
|
134
|
+
*/
|
|
135
|
+
export const BUILD: boolean;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Running in the engine's unit test.
|
|
139
|
+
*/
|
|
140
|
+
export const TEST: boolean;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Running debug mode.
|
|
144
|
+
*/
|
|
145
|
+
export const DEBUG: boolean;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Running in the editor or preview.
|
|
149
|
+
*/
|
|
150
|
+
export const DEV: boolean;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Running in mini game.
|
|
154
|
+
*/
|
|
155
|
+
export const MINIGAME: boolean;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Running in runtime based environment.
|
|
159
|
+
*/
|
|
160
|
+
export const RUNTIME_BASED: boolean;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Support JIT.
|
|
164
|
+
*/
|
|
165
|
+
export const SUPPORT_JIT: boolean;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Running in environment where using JSB as the JavaScript interface binding scheme.
|
|
169
|
+
*/
|
|
170
|
+
export const JSB: boolean;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The network access mode.
|
|
174
|
+
* - 0 Client
|
|
175
|
+
* - 1 ListenServer
|
|
176
|
+
* - 2 HostServer
|
|
177
|
+
*/
|
|
178
|
+
export const NET_MODE: number;
|
|
179
|
+
|
|
180
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="C:\ProgramData\cocos\editors\Creator\3.8.4\resources\resources\3d\engine\@types\jsb.d.ts"/>
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./temp/tsconfig.cocos.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "Node",
|
|
7
|
+
"lib": ["ESNext", "dom"],
|
|
8
|
+
"allowSyntheticDefaultImports": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"forceConsistentCasingInFileNames": true,
|
|
12
|
+
"useDefineForClassFields": true,
|
|
13
|
+
"strictNullChecks": true,
|
|
14
|
+
"strict": true,
|
|
15
|
+
"strictPropertyInitialization": false,
|
|
16
|
+
"noImplicitOverride": true,
|
|
17
|
+
"noEmit": false,
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"experimentalDecorators": true, // 启用装饰器
|
|
20
|
+
"emitDecoratorMetadata": true, // 如果需要元数据(可选)
|
|
21
|
+
"declarationDir": "./dist",
|
|
22
|
+
"outDir": "./dist"
|
|
23
|
+
}
|
|
24
|
+
}
|