@shimotsuki/core 2.0.56 → 2.0.57
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 +15 -7
- package/dist/shimotsuki_core.js +1 -1
- package/package.json +48 -47
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component, Node, Prefab, Vec3, Quat, math, Layers, AudioClip, AudioSource, Label, Button, Scene, Asset,
|
|
1
|
+
import { Component, Node, Prefab, Vec3, Quat, math, Layers, AudioClip, AudioSource, Label, Button, Scene, Asset, Constructor, AssetManager, AsyncDelegate, SpriteFrame, Sprite } from 'cc';
|
|
2
2
|
import { IReactionPublic, IReactionOptions } from '@shimotsuki/mobx';
|
|
3
3
|
import EventEmitter, { EventEmitter as EventEmitter$1 } from 'eventemitter3';
|
|
4
4
|
import * as crypto_es_lib_cipher_core from 'crypto-es/lib/cipher-core';
|
|
@@ -751,13 +751,19 @@ declare const JsonFormatter: {
|
|
|
751
751
|
parse: (jsonStr: string) => crypto_es_lib_cipher_core.CipherParams;
|
|
752
752
|
};
|
|
753
753
|
|
|
754
|
-
declare const EncryptUtil_md5: typeof md5;
|
|
755
|
-
declare const EncryptUtil_initCrypto: typeof initCrypto;
|
|
756
|
-
declare const EncryptUtil_aesEncrypt: typeof aesEncrypt;
|
|
757
|
-
declare const EncryptUtil_aesDecrypt: typeof aesDecrypt;
|
|
758
754
|
declare const EncryptUtil_JsonFormatter: typeof JsonFormatter;
|
|
755
|
+
declare const EncryptUtil_aesDecrypt: typeof aesDecrypt;
|
|
756
|
+
declare const EncryptUtil_aesEncrypt: typeof aesEncrypt;
|
|
757
|
+
declare const EncryptUtil_initCrypto: typeof initCrypto;
|
|
758
|
+
declare const EncryptUtil_md5: typeof md5;
|
|
759
759
|
declare namespace EncryptUtil {
|
|
760
|
-
export {
|
|
760
|
+
export {
|
|
761
|
+
EncryptUtil_JsonFormatter as JsonFormatter,
|
|
762
|
+
EncryptUtil_aesDecrypt as aesDecrypt,
|
|
763
|
+
EncryptUtil_aesEncrypt as aesEncrypt,
|
|
764
|
+
EncryptUtil_initCrypto as initCrypto,
|
|
765
|
+
EncryptUtil_md5 as md5,
|
|
766
|
+
};
|
|
761
767
|
}
|
|
762
768
|
|
|
763
769
|
/**
|
|
@@ -807,6 +813,7 @@ declare class SocialGameClientManager extends BaseManager {
|
|
|
807
813
|
private handleGlobalStateChange;
|
|
808
814
|
private triggerReconnectAll;
|
|
809
815
|
private disconnectAll;
|
|
816
|
+
private handleSingleClose;
|
|
810
817
|
private handleSingleReconnect;
|
|
811
818
|
private handleSingleKick;
|
|
812
819
|
}
|
|
@@ -1061,4 +1068,5 @@ declare class Manager {
|
|
|
1061
1068
|
}
|
|
1062
1069
|
declare const cat: Manager;
|
|
1063
1070
|
|
|
1064
|
-
export { AudioEffect, AudioEventConstant, AudioManager, AudioSourceBaseComponent, AudioSourceUILayer, AudioTypeEnum, BaseComponent, BaseManager, BasePrefab, BaseStore, ButtonLock, CoreBlackMask, CoreNotice,
|
|
1071
|
+
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 };
|
|
1072
|
+
export type { CoreNoticeProps, CoreShowLoadingProps, CoreUIModalProps, HOOK, ICloseOptions, IDirection, IOpenOptions, IUIOption, SceneComponentType, SceneDataType, ScenePropsType, ToastProps, UIComponentType };
|
package/dist/shimotsuki_core.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{AudioSource as t,AudioClip as e,error as i,Node as s,director as o,log as n,sys as r,Component as a,Prefab as l,instantiate as c,isValid as h,Layers as p,view as d,Widget as u,v3 as _,tween as m,Enum as f,_decorator as g,game as y,Label as v,UIOpacity as E,Tween as C,BlockInputEvents as b,Button as w,Director as S,warn as A,assetManager as T,Asset as I,resources as O,AsyncDelegate as k,Game as N,SpriteFrame as D,Sprite as M}from"cc";import{PREVIEW as R,DEBUG as x,WECHAT as F}from"cc/env";import{makeObservable as P,observable as U,autorun as L,reaction as B}from"@shimotsuki/mobx";import H from"crypto-es";import{clone as G}from"@bufbuild/protobuf";import{SocketConnectStatus as $}from"pitayaclient";import{SocialGameClient as K}from"sgc";import{EventEmitter as j}from"eventemitter3";import"core-js/es/array/index.js";class V extends t{cat;initAudio(t){return this.cat=t,this}}class W extends V{effects=new Map;load(t){return new Promise(((i,s)=>{this.cat.res.load(t,e,((e,o)=>{if(e)return s(e);this.effects.set(t,o),this.playOneShot(o,this.volume),i(o)}))}))}release(){for(let t in this.effects)this.cat.res.release(t);this.effects.clear()}}class z extends V{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,s){this.cat.res.load(t,e,((e,o)=>{e&&i(e),this.playing&&(this._isPlay=!1,this.stop(),this.cat.res.release(this._url)),this.playOnAwake=!1,this.enabled=!0,this.clip=o,this._url=t,s&&s()}))}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 Q{cat;constructor(t){this.cat=t}}var J;!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"}(J||(J={}));class X extends Q{local_data={};music;effect;_volume_music=1;_volume_effect=1;_switch_music=!0;_switch_effect=!0;local_store_key="game_audio";extra={};constructor(t){super(t),this.local_store_key=this.cat.audio_local_store_key;var e=new s("UIAudioManager");o.addPersistRootNode(e);var i=new s("UIMusic");i.parent=e,this.music=i.addComponent(z).initAudio(t);var n=new s("UIEffect");n.parent=e,this.effect=n.addComponent(W).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(n("设置背景音乐开关值",t,this._switch_music),t==this._switch_music)return;this._switch_music=t,t?this.resumeMusic():this.pauseMusic();const e=t?J.MUSIC_ON:J.MUSIC_OFF;this.cat.event.emit(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?J.EFFECT_ON:J.EFFECT_OFF;this.cat.event.emit(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,this.local_data.extra=this.extra;let t=JSON.stringify(this.local_data);return this.cat.storage.set(this.local_store_key,t),this}load(){try{let t=this.cat.storage.get(this.local_store_key);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,this.extra=this.local_data.extra}catch(t){this.local_data={},this._volume_music=.6,this._volume_effect=1,this._switch_music=!0,this._switch_effect=!0,this.extra={}}this.music&&(this.music.volume=this._volume_music),this.effect&&(this.effect.volume=this._volume_effect)}}class q extends Q{_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(R||(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+="");R||null==this._key||null==this._iv||(e=this.cat.util.encryptUtil.aesEncrypt(`${e}`,this._key,this._iv)),r.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}`,R||(t=this.cat.util.encryptUtil.md5(t));let i=r.localStorage.getItem(t);return null==i||""===i||R||null==this._key||null==this._iv||(i=this.cat.util.encryptUtil.aesDecrypt(i,this._key,this._iv)),null===i?e:i}getNumber(t,e=0){var i=this.get(t);return Number(i)||e}getBoolean(t){var e=this.get(t);return Boolean(e)||!1}getJson(t,e){var i=this.get(t);return i&&JSON.parse(i)||e}remove(t){null!=t?(t=`${t}_${this._id}`,R||(t=this.cat.util.encryptUtil.md5(t)),r.localStorage.removeItem(t)):console.error("存储的key不能为空")}clear(){r.localStorage.clear()}}function Z(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function Y(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"function"==typeof SuppressedError&&SuppressedError;class tt extends a{props={};data={};autorunDisposers=[];reactionDisposers=[];eventEmitter=[];hook={destroyed:()=>{},started:()=>{}};initUI(){}__preload(){this.initUI(),this.onAutoObserver()}constructor(){super(),P(this,{props:U,data:U})}onAutoObserver(){}addAutorun(t){return(Array.isArray(t)?t:[t]).forEach((t=>{const e=L(t);this.autorunDisposers.push(e)})),this}addReaction(t,e,i){const s=B(t,e,i);return this.reactionDisposers.push(s),this}addAudoListener(t){return this.eventEmitter.includes(t)||t===pe.event||this.eventEmitter.push(t),t}_onPreDestroy(){if(this.autorunDisposers.forEach((t=>{t()})),this.reactionDisposers.forEach((t=>{t()})),this.autorunDisposers=[],this.reactionDisposers=[],!super._onPreDestroy)throw new Error("_onPreDestroy已弃用");super._onPreDestroy()}onDisable(){this.onHide(),this.deleteAllEventByEmitter(pe.event),this.eventEmitter.forEach((t=>{this.deleteAllEventByEmitter(t)})),this.eventEmitter=[],this.removeListener()}deleteAllEventByEmitter(t){const e=t._events;for(const i in e){let s=e[i];Array.isArray(s)||(s=[s]),s.forEach((e=>{e.context===this&&t.off(i,e.fn,this)}))}}onEnable(){this.onShow(),this.addListener(),this.onEventListener()}onEventListener(){}addListener(){}removeListener(){}addToParent(t,e,i){const s=t instanceof l?c(t):t instanceof a?t.node:t;if("number"==typeof e){const t=e,o=i;this.setOptions(o),s.insertChild(this.node,t)}else{const t=e;this.setOptions(t),s.addChild(this.node)}return 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(){h(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}setRotationFromEuler(t){return this.node.setRotationFromEuler(t),this}onShow(){}onHide(){}setNodeAndChildrenLayer(t){return et(this.node,t),this}}const et=(t,e)=>{t.layer="string"==typeof e?2**p.nameToLayer(e):e,t?.children.forEach((t=>{et(t,e)}))};class it extends tt{lastEnterDirection="center";screen;isClosing=!1;root;constructor(){super(),this._init()}_init(){this.root=this.node,this.screen=d.getVisibleSize()}async showTween({isMotion:t=!0,direction:e="center",duration:i=.1,isBounce:s=!0,bounceDuration:o=.05}){if(this.lastEnterDirection=e,t){const t=this.node.getComponent(u);let o,n;t&&(t.updateAlignment(),t.enabled=!1),_(1.1,1.1,1),"center"==e?(o=_(.01,.01,.01),n=_(1,1,1)):(o="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,i,o,n,s),t&&(t.enabled=!0)}}async hideTween({isMotion:t=!0,direction:e,duration:i=.1}){if(e=e||this.lastEnterDirection,!this.isClosing){if(this.isClosing=!0,m(this.node).removeSelf(),t){const t=this.node.getComponent(u);let s,o;t&&(t.enabled=!1),"center"==e?(s=this.node.scale,o=_(0,0,0)):(o="left"==e?_(-this.screen.width,0,0):"right"==e?_(this.screen.width,0,0):_(0,"top"==e?this.screen.height:-this.screen.height,0),s=this.node.getPosition()),await this.handle(e,i,s,o,!1)}this.removeAndDestroy()}}async handle(t,e,i,s,o){"center"==t?this.node.setScale(i):this.node.setPosition(i),await this.deftween(e,{["center"==t?"scale":"position"]:s},o)}deftween(t,e,i,s){return new Promise(((i,s)=>{m(this.node).to(t,e).call((()=>{i()})).start()}))}}const{ccclass:st,property:ot}=g;var nt;!function(t){t[t.EFFECT=0]="EFFECT",t[t.BGM=1]="BGM"}(nt||(nt={}));class rt extends tt{type=nt.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,pe.event.on(J.EFFECT_ON,this.onPlayEffectHandler,this).on(J.EFFECT_OFF,this.onStopEffectHandler,this).on(J.MUSIC_ON,this.onPlayMusicHandler,this).on(J.MUSIC_OFF,this.onStopMusicHandler,this)}__preload(){super.__preload();const{volumeEffect:t,volumeMusic:e}=pe.audio;this.audioSource.volume=this.type===nt.BGM?e:t}start(){}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=pe.audio;this.audioSource.playing||!(this.type===nt.BGM?e:t)||y._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}Z([ot({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:f(nt)}),Y("design:type",Number)],rt.prototype,"type",void 0),Z([ot({tooltip:"音源",type:e}),Y("design:type",e)],rt.prototype,"clip",void 0),Z([ot({tooltip:"循环"}),Y("design:type",Boolean)],rt.prototype,"loop",void 0),Z([ot({tooltip:"音量"}),Y("design:type",Number)],rt.prototype,"volume",void 0),Z([ot({tooltip:"是否启用自动播放"}),Y("design:type",Boolean)],rt.prototype,"playOnAwake",void 0);const{ccclass:at,property:lt}=g;class ct extends it{type=nt.EFFECT;clip=null;loop=!1;volume=1;playOnAwake=!1;audioSource=new t;onEnable(){super.onEnable(),pe.event.on(J.EFFECT_ON,this.onPlayEffectHandler,this).on(J.EFFECT_OFF,this.onStopEffectHandler,this).on(J.MUSIC_ON,this.onPlayMusicHandler,this).on(J.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}=pe.audio;this.audioSource.volume=this.type===nt.BGM?e:t}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=pe.audio;this.audioSource.playing||!(this.type===nt.BGM?e:t)||y._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}Z([lt({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:f(nt)}),Y("design:type",Number)],ct.prototype,"type",void 0),Z([lt({tooltip:"音源",type:e}),Y("design:type",e)],ct.prototype,"clip",void 0),Z([lt({tooltip:"循环"}),Y("design:type",Boolean)],ct.prototype,"loop",void 0),Z([lt({tooltip:"音量"}),Y("design:type",Number)],ct.prototype,"volume",void 0),Z([lt({tooltip:"是否启用自动播放"}),Y("design:type",Boolean)],ct.prototype,"playOnAwake",void 0);const{ccclass:ht,property:pt,menu:dt}=g;var ut;!function(t){t[t.FIXED=0]="FIXED",t[t.SLIDE=1]="SLIDE"}(ut||(ut={}));let _t=class extends tt{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:i,type:s,fixed_time:o}=this.props;s==ut.FIXED?(this.fixed_node.active=!0,this.fixed_label.string=`${i}`,this.scheduleOnce((()=>{this.node.destroy(),t()}),o)):(this.slide_node.active=!0,this.slide_label.string=`${i}`,this.playAnim(this.node).then((()=>{t()})))}))}playAnim(t){return new Promise(((e,i)=>{const s=this.node.getComponent(E),o=m(s).delay(1.2).to(.5,{opacity:0}).call((()=>{C.stopAllByTarget(t),this.node.destroy(),e()}));m(t).by(.5,{position:_(0,400,0)}).call((()=>{o.start()})).start()}))}onDestroy(){C.stopAllByTarget(this.node),this.unscheduleAllCallbacks()}};var mt;Z([pt({type:s,tooltip:"固定节点"}),Y("design:type",s)],_t.prototype,"fixed_node",void 0),Z([pt({type:s,tooltip:"滑动节点"}),Y("design:type",s)],_t.prototype,"slide_node",void 0),Z([pt({type:v,tooltip:"固定标签节点"}),Y("design:type",v)],_t.prototype,"fixed_label",void 0),Z([pt({type:v,tooltip:"滑动标签节点"}),Y("design:type",v)],_t.prototype,"slide_label",void 0),_t=Z([ht("CoreToast"),dt("CATCORE/CoreToast")],_t),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"}(mt||(mt={}));const{ccclass:ft,property:gt,menu:yt}=g;let vt=class extends it{scene_mask_node;ui_container;gui=null;onLoad(){this.setSceneMaskActive(!1)}get scene_mask(){return this.scene_mask_node.getComponent(Kt)}get brother(){return this.ui_container.children||[]}get tweenChildren(){return this.scene_mask.tween.children}onEventListener(){pe.event.on(mt.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 h(this)&&this.scene_mask&&this.scene_mask.tween.addChild(t),this}show(){this.setSceneMaskActive(!0)}hide(){this.setSceneMaskActive(!1)}setGui(t){return this.gui=t,this}uiMaskChanged(){this.blockMaskSiblingIndexChanged()}setSceneMaskActive(t){this.scene_mask.node.active=t}};Z([gt({type:s}),Y("design:type",s)],vt.prototype,"scene_mask_node",void 0),Z([gt({type:s}),Y("design:type",s)],vt.prototype,"ui_container",void 0),vt=Z([ft("CoreUIContainer"),yt("CATCORE/CoreUIContainer")],vt);class Et extends it{onEnable(){super.onEnable(),this.updateMask()}onDisable(){super.onDisable(),this.updateMask()}updateMask(){pe.event.emit(mt.ROOT_MASK_UPDATE)}}const{ccclass:Ct,property:bt,menu:wt}=g;let St=class extends Et{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(b).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)}};Z([bt({type:v,tooltip:"标题"}),Y("design:type",v)],St.prototype,"title",void 0),Z([bt({type:s,tooltip:"动画"}),Y("design:type",s)],St.prototype,"loadingTween",void 0),St=Z([Ct("CoreShowLoading"),wt("CATCORE/CoreShowLoading")],St);const{ccclass:At,property:Tt,menu:It}=g;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 kt=class extends Et{common_prompt_text;btn_confirm;btn_close;is_close=!1;props={content:null};initUI(){}onLoad(){this.btn_confirm.node.on(w.EventType.CLICK,this.onConfirmHandler,this),this.btn_close.node.on(w.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,n("更新提示文案:",t),e){let e=0;const i=()=>{e=(e+1)%4,this.common_prompt_text.string=t+["","·","··","···"][e]};this.schedule(i,.5)}}onConfirmHandler(){this.is_close=!0,pe.gui.hideReconnect()}};Z([Tt({type:v,tooltip:"通用提示文本"}),Y("design:type",v)],kt.prototype,"common_prompt_text",void 0),Z([Tt({type:w,tooltip:"确定按钮"}),Y("design:type",w)],kt.prototype,"btn_confirm",void 0),Z([Tt({type:w,tooltip:"关闭按钮"}),Y("design:type",w)],kt.prototype,"btn_close",void 0),kt=Z([At("CoreReconnection"),It("CATCORE/CoreReconnection")],kt);const{ccclass:Nt,property:Dt,menu:Mt}=g;let Rt=class extends Et{text;btn_confirm;btn_close;onLoad(){this.btn_confirm.node.on(w.EventType.CLICK,this.onConfrimHandler,this)}start(){this.props&&this.updateProps(this.props)}onConfrimHandler(){this.props?.confrim?.(),pe.gui.hideNotice()}updateProps(t){this.text.string=`${t.text}`}};Z([Dt({type:v,tooltip:"提示文本"}),Y("design:type",v)],Rt.prototype,"text",void 0),Z([Dt({type:w,tooltip:"确定按钮"}),Y("design:type",w)],Rt.prototype,"btn_confirm",void 0),Z([Dt({type:w,tooltip:"关闭按钮"}),Y("design:type",w)],Rt.prototype,"btn_close",void 0),Rt=Z([Nt("CoreNotice"),Mt("CATCORE/CoreNotice")],Rt);class xt extends tt{isReload}const{ccclass:Ft,property:Pt,menu:Ut}=g;var Lt;!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"}(Lt||(Lt={}));let Bt=class extends tt{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(mt.ROOT_MASK_UPDATE,this.onRootUpdate,this)}init(t){this.cat=t;const e=o.getScene();return n("init scene"),e&&this.changeScene(e),this}start(){this.onRootUpdate()}toastQueue=[];isScheduling=!1;minInterval=.2;showToast(t){this.toastQueue.push(t),this.isScheduling||this.processQueueWithInterval()}processQueueWithInterval(){if(0===this.toastQueue.length)return void(this.isScheduling=!1);this.isScheduling=!0;const t=this.toastQueue.shift(),e=()=>{c(this.toast_ui_prefab).getComponent(_t).addToParent(this.root_toast,{props:t}),this.scheduleOnce((()=>{this.processQueueWithInterval()}),this.minInterval)};0===this.root_toast.children.length?e():this.scheduleOnce(e,this.minInterval)}hideToast(){return this.root_toast&&this.root_toast.children.forEach((t=>{t.getComponent(_t)?.removeAndDestroy()})),this.toastQueue=[],this.unschedule(this.processQueueWithInterval),this.isScheduling=!1,this}showLoading({title:t="",mask:e=!0,black:i=!0}={}){if(n("showLoading",t),this.loading_ui_component)this.loading_ui_component.setOptions({props:{title:t,mask:e,black:i}});else{const s=c(this.loading_ui_prefab);this.loading_ui_component=s.getComponent(St).addToParent(this.root_ui,{props:{title:t,mask:e,black:i}})}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=c(this.reconnection_ui_prefab);this.reconnection_ui_component=e.getComponent(kt).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=c(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,i){n("加载场景",t,e,i);let s={},r=i??!1;return"boolean"==typeof e?r=e:s=e??{},n("当前场景",o.getScene()?.uuid,o.getScene()?.name),o.once(S.EVENT_BEFORE_SCENE_LAUNCH,(t=>{n("Director.EVENT_BEFORE_SCENE_LAUNCH",t),this.changeScene(t,s,r)})),o.loadScene(t),this}resetScene(t=""){return t=t||this.currentScene,this.loadScene(t)}cleanScene(){this.resetScene().hideLoading().hideNotice().hideReconnect().hideToast()}changeScene(t,e,i){this.currentScene=t.name,this.createUILayer(t);const s=t.getComponentInChildren(xt);s&&(s.isReload=i??!1),s?.setOptions(e)}createUILayer(t){this.ui_container_component?.removeAndDestroy(),this.ui_container_component=null;const e=c(this.ui_prefab);this.ui_container_component=e.getComponent(vt).setGui(this).addToParent(t,this.node.getSiblingIndex())}reloadScene(){this.loadScene(this.currentScene,!0)}async closeUI(t,e){const{component:i}=this.findUIBaseLayer(t,!1);i&&(i.setOptions({...e?.hook??{},...e?.props??{}}),await i.hideTween(e||{}),this.ui_container_component?.subMask())}async openUI(t,e){const{rootNode:i,component:s}=this.findUIBaseLayer(t,!0);i.getComponent(it),s?.setOptions(e),i&&this.ui_container_component?.addNodeToTween(i).addMask(),s&&await s.showTween(e||{}),this.ui_container_component?.ui_container&&s?.addToParent(this.ui_container_component.ui_container)}findUIBaseLayer(t,e){let o,n=null;if(t instanceof s){o=t;const e=t.components.filter((t=>t instanceof it));if(!e.length)return i(`${t.name}节点未找到继承自BaseLayer的组件`),{rootNode:o,component:n};1==e.length?n=e[0]:A(`${t.name}节点存在多个继承自BaseLayer的组件`)}else if(o=t.node,n=t,e){for(;o.parent;)o=o.parent;n.root=o}else o=t.root;return{rootNode:o,component:n}}onRootUpdate(){const t=this.root_ui.children.findLastIndex((t=>t.active&&t!=this.root_mask));if(this.root_mask.active=-1!=t,t>-1){const e=this.root_ui.children[t].getSiblingIndex()-1;this.root_mask.setSiblingIndex(e<0?0:e)}this.cat.event.emit(mt.ROOT_MASK_CHANGE)}};Z([Pt({type:l,tooltip:"断线重连UI预制体"}),Y("design:type",l)],Bt.prototype,"reconnection_ui_prefab",void 0),Z([Pt({type:l,tooltip:"提示UI预制体"}),Y("design:type",l)],Bt.prototype,"toast_ui_prefab",void 0),Z([Pt({type:l,tooltip:"加载UI预制体"}),Y("design:type",l)],Bt.prototype,"loading_ui_prefab",void 0),Z([Pt({type:l,tooltip:"公告UI预制体"}),Y("design:type",l)],Bt.prototype,"notice_ui_prefab",void 0),Z([Pt({type:l,tooltip:"UI层预制体"}),Y("design:type",l)],Bt.prototype,"ui_prefab",void 0),Z([Pt({type:s,tooltip:"root-UI层"}),Y("design:type",s)],Bt.prototype,"root_ui",void 0),Z([Pt({type:s,tooltip:"root-组件层"}),Y("design:type",s)],Bt.prototype,"root_toast",void 0),Z([Pt({type:s,tooltip:"root-mask"}),Y("design:type",s)],Bt.prototype,"root_mask",void 0),Bt=Z([Ft("Gui"),Ut("CATCORE/Gui")],Bt);const{ccclass:Ht,property:Gt,menu:$t}=g;let Kt=class extends tt{tween};var jt;Z([Gt({type:s,tooltip:"动画节点"}),Y("design:type",s)],Kt.prototype,"tween",void 0),Kt=Z([Ht("CoreBlackMask"),$t("CATCORE/CoreBlackMask")],Kt),function(t){t.Root="prefabs/root",t.Toast="prefabs/toast",t.BlackMask="prefabs/black-mask",t.Loading="prefabs/loading",t.Notice="prefabs/notice",t.Reconnection="prefabs/reconnection"}(jt||(jt={}));class Vt extends Q{gui;#t="core";getGuiPrefabByType=(t,e)=>new Promise(((i,s)=>{n(t,`${e}`),this.cat.res.load(t,e,((t,e)=>{t?s(t):i(e)}))}));async init(){this.cat.gui_bundle_name&&(this.#t=this.cat.gui_bundle_name);const t=await this.getGuiPrefabByType(this.#t,jt.Root),e=c(t);return this.gui=e.getComponent(Bt).init(this.cat),o.addPersistRootNode(e),this}}class Wt{get=(t,e,i="resources")=>T.getBundle(i).get(t,e);isAssetType=t=>"function"==typeof t&&t.prototype instanceof I;async load(...t){let e=null,i=null,s=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let o=t.shift();this.isAssetType(t[0])&&(i=t.shift()),2==t.length&&(s=t.shift());const n=t.shift();let r=O;if(e&&"resources"!=e){T.bundles.has(e)||await this.loadBundle(e);let t=T.bundles.get(e);t&&(r=t)}s&&n?r.load(o,i,s,n):n?r.load(o,i,n):r.load(o,i)}async loadDir(...t){let e=null,i=null,s=null,o=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let n=t.shift();this.isAssetType(t[0])&&(i=t.shift()),2==t.length&&(s=t.shift()),o=t.shift();let r=O;if(e&&"resources"!=e){T.bundles.has(e)||await this.loadBundle(e);let t=T.bundles.get(e);t&&(r=t)}s&&o?r.loadDir(n,i,s,o):o?r.loadDir(n,i,o):r.loadDir(n,i)}loadRemote(t,...e){var i,s=null;2==e.length&&(s=e.shift()),i=e.shift(),T.loadRemote(t,{ext:".png",...s},i)}loadBundle=(t,e)=>new Promise(((i,s)=>{const o=(t,e)=>{if(t)return s(t);i(e)};e?T.loadBundle(t,{version:e},o):T.loadBundle(t,o)}));releasePrefabtDepsRecursively=t=>{var e=T.assets.get(t);(T.releaseAsset(e),e instanceof l)&&T.dependUtil.getDepsRecursively(t).forEach((t=>{T.assets.get(t).decRef()}))};release=(t,e="resources")=>{var i=T.getBundle(e);if(i){var s=i.get(t);s&&this.releasePrefabtDepsRecursively(s._uuid)}};releaseDir=(t,e="resources")=>{var i=T.getBundle(e),s=i?.getDirWithPath(t);s?.map((t=>{this.releasePrefabtDepsRecursively(t.uuid)})),!t&&"resources"!=e&&i&&T.removeBundle(i)};dump=()=>{T.assets.forEach(((t,e)=>{n(T.assets.get(e))})),n(`当前资源总数:${T.assets.count}`)}}let zt=null;const Qt={stringify:t=>{const e={ct:t.ciphertext.toString(H.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),i=H.lib.CipherParams.create({ciphertext:H.enc.Base64.parse(e.ct)});return e.iv&&(i.iv=H.enc.Hex.parse(e.iv)),e.s&&(i.salt=H.enc.Hex.parse(e.s)),i}};var Jt=Object.freeze({__proto__:null,md5:t=>H.MD5(t).toString(),initCrypto:(t,e)=>{zt=H.enc.Hex.parse(e)},aesEncrypt:(t,e,i)=>H.AES.encrypt(t,e,{iv:zt,format:Qt}).toString(),aesDecrypt:(t,e,i)=>H.AES.decrypt(t,e,{iv:zt,format:Qt}).toString(H.enc.Utf8),JsonFormatter:Qt});class Xt extends Q{encryptUtil=Jt}class qt extends K{logBlackList=[];ignore=t=>this.logBlackList.includes(t);constructor(t,e,i,s){super(e,i,s,t)}destroy(){this.disconnect(!0),pe.socialGameClient.unregister(this)}async GameRequest(t,e,i,s){return new Promise(((o,r)=>{super.GameRequest(t,e,i,s).then((e=>{x&&n(`%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",G(i,e)),o(e)}),(t=>{pe.gui.showToast({title:t.msg}),r(t)}))}))}subscribe(t,e,i){return super.subscribe(t,e,(s=>{x&&!this.ignore(t)&&n(`%c ws服务端消息:[subscribe][${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",G(e,s)),pe.event.emit(t,G(e,s)),i?.(s)})),this}}class Zt extends Q{managedClients=new Map;isGlobalOnline=!0;isInBackground=!1;onEventHideDelegate=new k;onEventShowDelegate=new k;onEventReloadSceneDelegate=new k;get activeClients(){return Array.from(this.managedClients).map((([t,e])=>e)).filter((t=>t.socket))}constructor(t){super(t),this.initGlobalListeners()}createWebSocket(t,e,i,s){if(this.managedClients.has(t)){this.managedClients.get(t).destroy(),n(`清理旧的 ${t} 客户端`)}const o=new qt(t,i,s,Object.assign({reconnectMaxAttempts:1/0},{...e,isAutoConnect:!1,isArrayBuffer:F}));return this.register(o),o}register(t){t.on("reconnected",this.handleSingleReconnect),t.on("kick",this.handleSingleKick),this.managedClients.set(t.name,t)}unregister(t){t.off("reconnected",this.handleSingleReconnect),t.off("kick",this.handleSingleKick),this.managedClients.delete(t.name)}initGlobalListeners(){this.cat.event.on(mt.ONLINE,(()=>this.handleGlobalStateChange("online")),this).on(mt.OFFLINE,(()=>this.handleGlobalStateChange("offline")),this),y.on(N.EVENT_SHOW,(()=>this.handleGlobalStateChange("show"))),y.on(N.EVENT_HIDE,(()=>this.handleGlobalStateChange("hide")))}async handleGlobalStateChange(t){switch(t){case"online":this.isGlobalOnline=!0,this.triggerReconnectAll();break;case"offline":this.isGlobalOnline=!1,this.disconnectAll(!0);break;case"show":this.isInBackground=!1,await this.triggerReconnectAll(),await this.onEventShowDelegate.dispatch();break;case"hide":await this.onEventHideDelegate.dispatch(),this.isInBackground=!0,this.disconnectAll(!0)}}async triggerReconnectAll(){if(!this.isGlobalOnline||this.isInBackground)return;if(0===this.managedClients.size)return void n("没有任何WS需要重连");pe.gui.showLoading({title:"正在重连"}),await Promise.allSettled(this.activeClients.map((async t=>{try{await t.reconnectPromise()}catch(e){i(`${t.name}服重连失败`,e),pe.gui.showToast({title:`${t.name}服重连失败`})}})));const t=this.activeClients.filter((t=>t.socketConnectStatus!==$.CONNECTED));t.length>0&&(console.error("部分WS重连失败:",t.map((t=>t))),setTimeout((()=>{this.triggerReconnectAll()}),2e3))}disconnectAll(t){this.managedClients.forEach((e=>{n("断开连接",e.name,t,e.socket),e.disconnect(t)}))}handleSingleReconnect=async()=>{this.activeClients.every((t=>t.socketConnectStatus===$.CONNECTED))&&(n("单个WS重连成功回调===",this.managedClients),await Promise.allSettled(this.activeClients.map((async t=>{try{await t.connectRequest()}catch(e){i(`${t.name}服登录错误`,e),pe.gui.showToast({title:`登录${t.name}服错误`})}}))),await this.onEventReloadSceneDelegate.dispatch(),pe.gui.hideLoading().reloadScene())};handleSingleKick(){pe.gui.showReconnect(Ot.KICK)}}class Yt{rootStore;constructor(t){this.rootStore=t}}class te extends Q{}const{ccclass:ee,property:ie,menu:se}=g;let oe=class extends it{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(w.EventType.CLICK,this.onCancelHandler,this),this.btn_confirm.node.on(w.EventType.CLICK,this.onConfirmHandler,this),this.btn_close.node.on(w.EventType.CLICK,this.onCloseHandler,this),this.addAutorun([()=>{this.title.spriteFrame=this.props?.title||this.default_title},()=>{this.props.content&&(this.props.content instanceof D?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(M).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(M).spriteFrame=this.props.style?.cancel||this.cancel_spriteFrame)}])}close(){this.props.cancelCB?.(),pe.gui.closeUI(this)}onCancelHandler(){this.close()}onConfirmHandler(){this.props.confirmCB?.()}onDestroy(){this.isConfirm&&this.props.onDestroy?.()}onCloseHandler(){this.close()}};var ne;Z([ie({type:D,tooltip:"默认标题"}),Y("design:type",D)],oe.prototype,"default_title",void 0),Z([ie({type:M,tooltip:"标题节点"}),Y("design:type",M)],oe.prototype,"title",void 0),Z([ie({type:v,tooltip:"字符串内容按钮"}),Y("design:type",v)],oe.prototype,"prompt_content_str",void 0),Z([ie({type:M,tooltip:"图片精灵内容按钮"}),Y("design:type",M)],oe.prototype,"prompt_content_spriteFrame",void 0),Z([ie({type:w,tooltip:"确认按钮"}),Y("design:type",w)],oe.prototype,"btn_confirm",void 0),Z([ie({type:D,tooltip:"确认按钮精灵图"}),Y("design:type",D)],oe.prototype,"confirm_spriteFrame",void 0),Z([ie({type:w,tooltip:"取消按钮"}),Y("design:type",w)],oe.prototype,"btn_cancel",void 0),Z([ie({type:D,tooltip:"取消按钮精灵图"}),Y("design:type",D)],oe.prototype,"cancel_spriteFrame",void 0),Z([ie({type:w,tooltip:"关闭按钮"}),Y("design:type",w)],oe.prototype,"btn_close",void 0),oe=Z([ee("CoreUIModal"),se("CATCORE/CoreUIModal")],oe),function(t){t[t.Delay=0]="Delay",t[t.Interval=1]="Interval"}(ne||(ne={}));class re{tag;type;callback;remainingTime;executionTime=0;initialTime;constructor(t,e,i,s){this.tag=t,this.type=e,this.remainingTime=i,this.initialTime=i,this.callback=s}}class ae extends Q{timers=new Map;lastUpdateTime=Date.now();constructor(t){super(t),t.event.on(mt.EVENT_HIDE,this.onHandleAppBackground,this),t.event.on(mt.EVENT_SHOW,this.onHandleAppForeground,this),setInterval(this.update.bind(this),1e3)}onHandleAppBackground(){this.lastUpdateTime=Date.now()}onHandleAppForeground(){const t=Date.now(),e=t-this.lastUpdateTime;n("elapsedTime",e);for(const t of this.timers.values())t.remainingTime>0&&(t.remainingTime-=e,t.executionTime+=e);this.lastUpdateTime=t}registerInterval(t,e,s){if(this.has(t))return i(`${t}定时器已存在,请勿重复注册`);const o=new re(t,ne.Interval,e,s);this.timers.set(t,o)}registerDelay(t,e,s){if(this.has(t))return i(`${t}延时器已存在,请勿重复注册`);const o=new re(t,ne.Delay,e,s);this.timers.set(t,o)}unregister(t){this.has(t)&&this.timers.delete(t)}has(t){return this.timers.has(t)}update(){const t=[];for(const[e,i]of this.timers.entries())i.remainingTime-=1e3,i.remainingTime<=0&&(i.type===ne.Interval&&(i.executionTime+=i.initialTime),i.callback(i.executionTime),i.type===ne.Interval?i.remainingTime=i.initialTime:t.push(e));for(const e of t)this.timers.delete(e)}}const le=(t,e)=>(i,s,o)=>{let n=o.value;return o.value=function(...i){const s=t??pe.default_audio_effect;s?pe.audio.playEffect(s):console.warn("请添加音效路径参数"),e&&e(),n.apply(this,i)},o},ce=(t=1,e)=>function(i,s,o){let n=o.value,r=!1;return o.value=function(...i){r?e&&e():(r=!0,setTimeout((()=>{r=!1}),1e3*t),n.apply(this,i))},o};class he{static#e=null;#i=!1;static get instance(){return this.#e??(this.#e=new he)}onAppInitDelegate=new k;onPlugInInitDelegate=new k;#s=null;get audio(){return this.#s}#o=null;get event(){return this.#o}#n=null;get gui(){return this.#n}#r=null;get storage(){return this.#r}#a=null;get res(){return this.#a}#l=null;get util(){return this.#l}#c=null;get socialGameClient(){return this.#c}#h=null;get store(){return this.#h}#p="";get gui_bundle_name(){return this.#p}#d="";get audio_local_store_key(){return this.#d}#u="";get default_audio_effect(){return this.#u}setConfig=({default_audio_effect:t="",gui_bundleName:e="resources",audio_local_store_key:i="game_audio"}={})=>{if(this.#i)throw new Error("[CAT] 已初始化,无法修改配置");return this.#p=e,this.#d=i,this.#u=t,this};async boot(){if(this.#i)throw new Error("[CAT] 已初始化");try{this.#h=new te(this),this.#a=new Wt,this.#l=new Xt(this),this.#r=new q(this),this.#o=new j,this.#s=new X(this),this.#c=new Zt(this),this.#n=(await new Vt(this).init()).gui,this.#i=!0}catch(t){throw console.error("[CAT] 初始化失败:",t),t}}merge(t,e){if(!this.#i)throw new Error("[CAT] 未初始化");if("string"!=typeof t)throw new Error("merge方法第一个参数应该为string类型");return Reflect.get(this,t)||Reflect.set(this,t,e),Object.assign(Reflect.get(this,t),e),this}appendPlugInInitDelegate(t){return this.#i?Promise.resolve().then(t).catch((t=>{console.error("[CAT] appendPlugInInitDelegate 回调执行失败:",t)})):this.onPlugInInitDelegate.add(t),this}}const pe=he.instance;y.onPostProjectInitDelegate.add((async()=>{console.time("[Init App]");try{await pe.boot(),await pe.onAppInitDelegate.dispatch(),await pe.onPlugInInitDelegate.dispatch()}catch(t){throw i(`[Init App] 初始化失败: ${t instanceof Error?t.message:String(t)}`),t}finally{console.timeEnd("[Init App]")}}));export{le as AudioEffect,J as AudioEventConstant,X as AudioManager,rt as AudioSourceBaseComponent,ct as AudioSourceUILayer,nt as AudioTypeEnum,tt as BaseComponent,Q as BaseManager,jt as BasePrefab,Yt as BaseStore,ce as ButtonLock,Kt as CoreBlackMask,Rt as CoreNotice,kt as CoreReconnection,St as CoreShowLoading,te as CoreStore,_t as CoreToast,vt as CoreUIContainer,oe as CoreUIModal,Xt as CoreUtil,mt as GlobalEventConstant,Bt as Gui,Vt as GuiManager,Lt as LayerType,he as Manager,Ot as ReconnectPrompt,Et as RootUILayer,xt as SceneLayer,ae as TimerManager,ut as ToastType,it as UILayer,qt as WrapperSocialGameClient,pe as cat};
|
|
1
|
+
import{AudioSource as t,_decorator as e,AudioClip as i,error as s,Node as o,director as n,log as r,sys as a,Component as l,Prefab as c,instantiate as h,isValid as p,Layers as d,view as u,Widget as _,v3 as m,tween as f,Enum as g,game as y,UIOpacity as v,Tween as E,Label as C,BlockInputEvents as b,Button as w,Director as S,warn as A,assetManager as T,Asset as I,resources as O,AsyncDelegate as k,Game as N,SpriteFrame as D,Sprite as M}from"cc";import{PREVIEW as R,WECHAT as x,DEBUG as F}from"cc/env";import{makeObservable as P,observable as U,autorun as L,reaction as B}from"@shimotsuki/mobx";import H from"crypto-es";import{clone as G}from"@bufbuild/protobuf";import{SocketConnectStatus as $}from"pitayaclient";import{SocialGameClient as K}from"sgc";import{EventEmitter as j}from"eventemitter3";import"core-js/es/array/index.js";class V extends t{cat;initAudio(t){return this.cat=t,this}}const{ccclass:W,menu:z}=e;let Q=class extends V{effects=new Map;load(t){return new Promise(((e,s)=>{this.cat.res.load(t,i,((i,o)=>{if(i)return s(i);this.effects.set(t,o),this.playOneShot(o,this.volume),e(o)}))}))}release(){for(let t in this.effects)this.cat.res.release(t);this.effects.clear()}};const{ccclass:J,menu:X}=e;class q extends V{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,i,((i,o)=>{i&&s(i),this.playing&&(this._isPlay=!1,this.stop(),this.cat.res.release(this._url)),this.playOnAwake=!1,this.enabled=!0,this.clip=o,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 Y;!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"}(Y||(Y={}));class tt extends Z{local_data={};music;effect;_volume_music=1;_volume_effect=1;_switch_music=!0;_switch_effect=!0;local_store_key="game_audio";extra={};constructor(t){super(t),this.local_store_key=this.cat.audio_local_store_key;var e=new o("UIAudioManager");n.addPersistRootNode(e);var i=new o("UIMusic");i.parent=e,this.music=i.addComponent(q).initAudio(t);var s=new o("UIEffect");s.parent=e,this.effect=s.addComponent(Q).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?Y.MUSIC_ON:Y.MUSIC_OFF;this.cat.event.emit(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?Y.EFFECT_ON:Y.EFFECT_OFF;this.cat.event.emit(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,this.local_data.extra=this.extra;let t=JSON.stringify(this.local_data);return this.cat.storage.set(this.local_store_key,t),this}load(){try{let t=this.cat.storage.get(this.local_store_key);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,this.extra=this.local_data.extra}catch(t){this.local_data={},this._volume_music=.6,this._volume_effect=1,this._switch_music=!0,this._switch_effect=!0,this.extra={}}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(R||(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+="");R||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}`,R||(t=this.cat.util.encryptUtil.md5(t));let i=a.localStorage.getItem(t);return null==i||""===i||R||null==this._key||null==this._iv||(i=this.cat.util.encryptUtil.aesDecrypt(i,this._key,this._iv)),null===i?e:i}getNumber(t,e=0){var i=this.get(t);return Number(i)||e}getBoolean(t){var e=this.get(t);return Boolean(e)||!1}getJson(t,e){var i=this.get(t);return i&&JSON.parse(i)||e}remove(t){null!=t?(t=`${t}_${this._id}`,R||(t=this.cat.util.encryptUtil.md5(t)),a.localStorage.removeItem(t)):console.error("存储的key不能为空")}clear(){a.localStorage.clear()}}function it(t,e,i,s){var o,n=arguments.length,r=n<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)r=Reflect.decorate(t,e,i,s);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(r=(n<3?o(r):n>3?o(e,i,r):o(e,i))||r);return n>3&&r&&Object.defineProperty(e,i,r),r}function st(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)}"function"==typeof SuppressedError&&SuppressedError;class ot extends l{props={};data={};autorunDisposers=[];reactionDisposers=[];eventEmitter=[];hook={destroyed:()=>{},started:()=>{}};initUI(){}__preload(){this.initUI(),this.onAutoObserver()}constructor(){super(),P(this,{props:U,data:U})}onAutoObserver(){}addAutorun(t){return(Array.isArray(t)?t:[t]).forEach((t=>{const e=L(t);this.autorunDisposers.push(e)})),this}addReaction(t,e,i){const s=B(t,e,i);return this.reactionDisposers.push(s),this}addAudoListener(t){return this.eventEmitter.includes(t)||t===me.event||this.eventEmitter.push(t),t}_onPreDestroy(){if(this.autorunDisposers.forEach((t=>{t()})),this.reactionDisposers.forEach((t=>{t()})),this.autorunDisposers=[],this.reactionDisposers=[],!super._onPreDestroy)throw new Error("_onPreDestroy已弃用");super._onPreDestroy()}onDisable(){this.onHide(),this.deleteAllEventByEmitter(me.event),this.eventEmitter.forEach((t=>{this.deleteAllEventByEmitter(t)})),this.eventEmitter=[],this.removeListener()}deleteAllEventByEmitter(t){const e=t._events;for(const i in e){let s=e[i];Array.isArray(s)||(s=[s]),s.forEach((e=>{e.context===this&&t.off(i,e.fn,this)}))}}onEnable(){this.onShow(),this.addListener(),this.onEventListener()}onEventListener(){}addListener(){}removeListener(){}addToParent(t,e,i){const s=t instanceof c?h(t):t instanceof l?t.node:t;if("number"==typeof e){const t=e,o=i;this.setOptions(o),s.insertChild(this.node,t)}else{const t=e;this.setOptions(t),s.addChild(this.node)}return 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(){p(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}setRotationFromEuler(t){return this.node.setRotationFromEuler(t),this}onShow(){}onHide(){}setNodeAndChildrenLayer(t){return nt(this.node,t),this}}const nt=(t,e)=>{t.layer="string"==typeof e?2**d.nameToLayer(e):e,t?.children.forEach((t=>{nt(t,e)}))};class rt extends ot{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:i=.1,isBounce:s=!0,bounceDuration:o=.05}){if(this.lastEnterDirection=e,t){const t=this.node.getComponent(_);let o,n;t&&(t.updateAlignment(),t.enabled=!1),m(1.1,1.1,1),"center"==e?(o=m(.01,.01,.01),n=m(1,1,1)):(o="left"==e?m(-this.screen.width,0,0):"right"==e?m(this.screen.width,0,0):m(0,"top"==e?this.screen.height:-this.screen.height,0),n=m(0,0,0)),await this.handle(e,i,o,n,s),t&&(t.enabled=!0)}}async hideTween({isMotion:t=!0,direction:e,duration:i=.1}){if(e=e||this.lastEnterDirection,!this.isClosing){if(this.isClosing=!0,f(this.node).removeSelf(),t){const t=this.node.getComponent(_);let s,o;t&&(t.enabled=!1),"center"==e?(s=this.node.scale,o=m(0,0,0)):(o="left"==e?m(-this.screen.width,0,0):"right"==e?m(this.screen.width,0,0):m(0,"top"==e?this.screen.height:-this.screen.height,0),s=this.node.getPosition()),await this.handle(e,i,s,o,!1)}this.removeAndDestroy()}}async handle(t,e,i,s,o){"center"==t?this.node.setScale(i):this.node.setPosition(i),await this.deftween(e,{["center"==t?"scale":"position"]:s},o)}deftween(t,e,i,s){return new Promise(((i,s)=>{f(this.node).to(t,e).call((()=>{i()})).start()}))}}const{ccclass:at,property:lt}=e;var ct;!function(t){t[t.EFFECT=0]="EFFECT",t[t.BGM=1]="BGM"}(ct||(ct={}));class ht extends ot{type=ct.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,me.event.on(Y.EFFECT_ON,this.onPlayEffectHandler,this).on(Y.EFFECT_OFF,this.onStopEffectHandler,this).on(Y.MUSIC_ON,this.onPlayMusicHandler,this).on(Y.MUSIC_OFF,this.onStopMusicHandler,this)}__preload(){super.__preload();const{volumeEffect:t,volumeMusic:e}=me.audio;this.audioSource.volume=this.type===ct.BGM?e:t}start(){}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=me.audio;this.audioSource.playing||!(this.type===ct.BGM?e:t)||y._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}it([lt({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:g(ct)}),st("design:type",Number)],ht.prototype,"type",void 0),it([lt({tooltip:"音源",type:i}),st("design:type",i)],ht.prototype,"clip",void 0),it([lt({tooltip:"循环"}),st("design:type",Boolean)],ht.prototype,"loop",void 0),it([lt({tooltip:"音量"}),st("design:type",Number)],ht.prototype,"volume",void 0),it([lt({tooltip:"是否启用自动播放"}),st("design:type",Boolean)],ht.prototype,"playOnAwake",void 0);const{ccclass:pt,property:dt}=e;class ut extends rt{type=ct.EFFECT;clip=null;loop=!1;volume=1;playOnAwake=!1;audioSource=new t;onEnable(){super.onEnable(),me.event.on(Y.EFFECT_ON,this.onPlayEffectHandler,this).on(Y.EFFECT_OFF,this.onStopEffectHandler,this).on(Y.MUSIC_ON,this.onPlayMusicHandler,this).on(Y.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}=me.audio;this.audioSource.volume=this.type===ct.BGM?e:t}stopAudio(){this.audioSource.stop()}playAudio(){const{switchEffect:t,switchMusic:e}=me.audio;this.audioSource.playing||!(this.type===ct.BGM?e:t)||y._paused||this.audioSource.play()}onPlayEffectHandler(){}onStopEffectHandler(){this.stopAudio()}onPlayMusicHandler(){}onStopMusicHandler(){this.stopAudio()}_onPreDestroy(){this.onStopMusicHandler(),super._onPreDestroy()}}it([dt({tooltip:"类型:\n EFFECT 音效\n BGM 音乐",type:g(ct)}),st("design:type",Number)],ut.prototype,"type",void 0),it([dt({tooltip:"音源",type:i}),st("design:type",i)],ut.prototype,"clip",void 0),it([dt({tooltip:"循环"}),st("design:type",Boolean)],ut.prototype,"loop",void 0),it([dt({tooltip:"音量"}),st("design:type",Number)],ut.prototype,"volume",void 0),it([dt({tooltip:"是否启用自动播放"}),st("design:type",Boolean)],ut.prototype,"playOnAwake",void 0);const{ccclass:_t,property:mt,menu:ft}=e;var gt;!function(t){t[t.FIXED=0]="FIXED",t[t.SLIDE=1]="SLIDE"}(gt||(gt={}));let yt=class extends ot{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:i,type:s,fixed_time:o}=this.props;s==gt.FIXED?(this.fixed_node.active=!0,this.fixed_label.string=`${i}`,this.scheduleOnce((()=>{this.node.destroy(),t()}),o)):(this.slide_node.active=!0,this.slide_label.string=`${i}`,this.playAnim(this.node).then((()=>{t()})))}))}playAnim(t){return new Promise(((e,i)=>{const s=this.node.getComponent(v),o=f(s).delay(1.2).to(.5,{opacity:0}).call((()=>{E.stopAllByTarget(t),this.node.destroy(),e()}));f(t).by(.5,{position:m(0,400,0)}).call((()=>{o.start()})).start()}))}onDestroy(){E.stopAllByTarget(this.node),this.unscheduleAllCallbacks()}};var vt;it([mt({type:o,tooltip:"固定节点"}),st("design:type",o)],yt.prototype,"fixed_node",void 0),it([mt({type:o,tooltip:"滑动节点"}),st("design:type",o)],yt.prototype,"slide_node",void 0),it([mt({type:C,tooltip:"固定标签节点"}),st("design:type",C)],yt.prototype,"fixed_label",void 0),it([mt({type:C,tooltip:"滑动标签节点"}),st("design:type",C)],yt.prototype,"slide_label",void 0),yt=it([_t("CoreToast"),ft("CATCORE/CoreToast")],yt),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"}(vt||(vt={}));const{ccclass:Et,property:Ct,menu:bt}=e;let wt=class extends rt{scene_mask_node;ui_container;gui=null;onLoad(){this.setSceneMaskActive(!1)}get scene_mask(){return this.scene_mask_node.getComponent(zt)}get brother(){return this.ui_container.children||[]}get tweenChildren(){return this.scene_mask.tween.children}onEventListener(){me.event.on(vt.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 p(this)&&this.scene_mask&&this.scene_mask.tween.addChild(t),this}show(){this.setSceneMaskActive(!0)}hide(){this.setSceneMaskActive(!1)}setGui(t){return this.gui=t,this}uiMaskChanged(){this.blockMaskSiblingIndexChanged()}setSceneMaskActive(t){this.scene_mask.node.active=t}};it([Ct({type:o}),st("design:type",o)],wt.prototype,"scene_mask_node",void 0),it([Ct({type:o}),st("design:type",o)],wt.prototype,"ui_container",void 0),wt=it([Et("CoreUIContainer"),bt("CATCORE/CoreUIContainer")],wt);class St extends rt{onEnable(){super.onEnable(),this.updateMask()}onDisable(){super.onDisable(),this.updateMask()}updateMask(){me.event.emit(vt.ROOT_MASK_UPDATE)}}const{ccclass:At,property:Tt,menu:It}=e;let Ot=class extends St{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(b).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)}};it([Tt({type:C,tooltip:"标题"}),st("design:type",C)],Ot.prototype,"title",void 0),it([Tt({type:o,tooltip:"动画"}),st("design:type",o)],Ot.prototype,"loadingTween",void 0),Ot=it([At("CoreShowLoading"),It("CATCORE/CoreShowLoading")],Ot);const{ccclass:kt,property:Nt,menu:Dt}=e;var Mt;!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="连接游戏服错误"}(Mt||(Mt={}));let Rt=class extends St{common_prompt_text;btn_confirm;btn_close;is_close=!1;props={content:null};initUI(){}onLoad(){this.btn_confirm.node.on(w.EventType.CLICK,this.onConfirmHandler,this),this.btn_close.node.on(w.EventType.CLICK,this.onConfirmHandler,this),this.addAutorun([()=>{this.common_prompt_text.string=this.props.content??""}])}onDestroy(){this.unscheduleAllCallbacks()}updateProps(t){this.updatePromptText(t,t==Mt.RECONNECTING)}updatePromptText(t,e=!1){if(this.unscheduleAllCallbacks(),this.props.content=t,r("更新提示文案:",t),e){let e=0;const i=()=>{e=(e+1)%4,this.common_prompt_text.string=t+["","·","··","···"][e]};this.schedule(i,.5)}}onConfirmHandler(){this.is_close=!0,me.gui.hideReconnect()}};it([Nt({type:C,tooltip:"通用提示文本"}),st("design:type",C)],Rt.prototype,"common_prompt_text",void 0),it([Nt({type:w,tooltip:"确定按钮"}),st("design:type",w)],Rt.prototype,"btn_confirm",void 0),it([Nt({type:w,tooltip:"关闭按钮"}),st("design:type",w)],Rt.prototype,"btn_close",void 0),Rt=it([kt("CoreReconnection"),Dt("CATCORE/CoreReconnection")],Rt);const{ccclass:xt,property:Ft,menu:Pt}=e;let Ut=class extends St{text;btn_confirm;btn_close;onLoad(){this.btn_confirm.node.on(w.EventType.CLICK,this.onConfrimHandler,this)}start(){this.props&&this.updateProps(this.props)}onConfrimHandler(){this.props?.confrim?.(),me.gui.hideNotice()}updateProps(t){this.text.string=`${t.text}`}};it([Ft({type:C,tooltip:"提示文本"}),st("design:type",C)],Ut.prototype,"text",void 0),it([Ft({type:w,tooltip:"确定按钮"}),st("design:type",w)],Ut.prototype,"btn_confirm",void 0),it([Ft({type:w,tooltip:"关闭按钮"}),st("design:type",w)],Ut.prototype,"btn_close",void 0),Ut=it([xt("CoreNotice"),Pt("CATCORE/CoreNotice")],Ut);class Lt extends ot{isReload}const{ccclass:Bt,property:Ht,menu:Gt}=e;var $t;!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"}($t||($t={}));let Kt=class extends ot{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(vt.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()}toastQueue=[];isScheduling=!1;minInterval=.2;showToast(t){this.toastQueue.push(t),this.isScheduling||this.processQueueWithInterval()}processQueueWithInterval(){if(0===this.toastQueue.length)return void(this.isScheduling=!1);this.isScheduling=!0;const t=this.toastQueue.shift(),e=()=>{h(this.toast_ui_prefab).getComponent(yt).addToParent(this.root_toast,{props:t}),this.scheduleOnce((()=>{this.processQueueWithInterval()}),this.minInterval)};0===this.root_toast.children.length?e():this.scheduleOnce(e,this.minInterval)}hideToast(){return this.root_toast&&this.root_toast.children.forEach((t=>{t.getComponent(yt)?.removeAndDestroy()})),this.toastQueue=[],this.unschedule(this.processQueueWithInterval),this.isScheduling=!1,this}showLoading({title:t="",mask:e=!0,black:i=!0}={}){if(r("showLoading",t),this.loading_ui_component)this.loading_ui_component.setOptions({props:{title:t,mask:e,black:i}});else{const s=h(this.loading_ui_prefab);this.loading_ui_component=s.getComponent(Ot).addToParent(this.root_ui,{props:{title:t,mask:e,black:i}})}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(Rt).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(Ut).addToParent(this.root_ui,{props:t}),this}hideNotice(){return this.notice_ui_component?.removeAndDestroy(),this}loadScene(t,e,i){r("加载场景",t,e,i);let s={},o=i??!1;return"boolean"==typeof e?o=e:s=e??{},r("当前场景",n.getScene()?.uuid,n.getScene()?.name),n.once(S.EVENT_BEFORE_SCENE_LAUNCH,(t=>{r("Director.EVENT_BEFORE_SCENE_LAUNCH",t),this.changeScene(t,s,o)})),n.loadScene(t),this}resetScene(t=""){return t=t||this.currentScene,this.loadScene(t)}cleanScene(){this.resetScene().hideLoading().hideNotice().hideReconnect().hideToast()}changeScene(t,e,i){this.currentScene=t.name,this.createUILayer(t);const s=t.getComponentInChildren(Lt);s&&(s.isReload=i??!1),s?.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(wt).setGui(this).addToParent(t,this.node.getSiblingIndex())}reloadScene(){this.loadScene(this.currentScene,!0)}async closeUI(t,e){const{component:i}=this.findUIBaseLayer(t,!1);i&&(i.setOptions({...e?.hook??{},...e?.props??{}}),await i.hideTween(e||{}),this.ui_container_component?.subMask())}async openUI(t,e){const{rootNode:i,component:s}=this.findUIBaseLayer(t,!0);i.getComponent(rt),s?.setOptions(e),i&&this.ui_container_component?.addNodeToTween(i).addMask(),s&&await s.showTween(e||{}),this.ui_container_component?.ui_container&&s?.addToParent(this.ui_container_component.ui_container)}findUIBaseLayer(t,e){let i,n=null;if(t instanceof o){i=t;const e=t.components.filter((t=>t instanceof rt));if(!e.length)return s(`${t.name}节点未找到继承自BaseLayer的组件`),{rootNode:i,component:n};1==e.length?n=e[0]:A(`${t.name}节点存在多个继承自BaseLayer的组件`)}else if(i=t.node,n=t,e){for(;i.parent;)i=i.parent;n.root=i}else i=t.root;return{rootNode:i,component:n}}onRootUpdate(){const t=this.root_ui.children.findLastIndex((t=>t.active&&t!=this.root_mask));if(this.root_mask.active=-1!=t,t>-1){const e=this.root_ui.children[t].getSiblingIndex()-1;this.root_mask.setSiblingIndex(e<0?0:e)}this.cat.event.emit(vt.ROOT_MASK_CHANGE)}};it([Ht({type:c,tooltip:"断线重连UI预制体"}),st("design:type",c)],Kt.prototype,"reconnection_ui_prefab",void 0),it([Ht({type:c,tooltip:"提示UI预制体"}),st("design:type",c)],Kt.prototype,"toast_ui_prefab",void 0),it([Ht({type:c,tooltip:"加载UI预制体"}),st("design:type",c)],Kt.prototype,"loading_ui_prefab",void 0),it([Ht({type:c,tooltip:"公告UI预制体"}),st("design:type",c)],Kt.prototype,"notice_ui_prefab",void 0),it([Ht({type:c,tooltip:"UI层预制体"}),st("design:type",c)],Kt.prototype,"ui_prefab",void 0),it([Ht({type:o,tooltip:"root-UI层"}),st("design:type",o)],Kt.prototype,"root_ui",void 0),it([Ht({type:o,tooltip:"root-组件层"}),st("design:type",o)],Kt.prototype,"root_toast",void 0),it([Ht({type:o,tooltip:"root-mask"}),st("design:type",o)],Kt.prototype,"root_mask",void 0),Kt=it([Bt("Gui"),Gt("CATCORE/Gui")],Kt);const{ccclass:jt,property:Vt,menu:Wt}=e;let zt=class extends ot{tween};var Qt;it([Vt({type:o,tooltip:"动画节点"}),st("design:type",o)],zt.prototype,"tween",void 0),zt=it([jt("CoreBlackMask"),Wt("CATCORE/CoreBlackMask")],zt),function(t){t.Root="prefabs/root",t.Toast="prefabs/toast",t.BlackMask="prefabs/black-mask",t.Loading="prefabs/loading",t.Notice="prefabs/notice",t.Reconnection="prefabs/reconnection"}(Qt||(Qt={}));class Jt extends Z{gui;#t="core";getGuiPrefabByType=(t,e)=>new Promise(((i,s)=>{r(t,`${e}`),this.cat.res.load(t,e,((t,e)=>{t?s(t):i(e)}))}));async init(){this.cat.gui_bundle_name&&(this.#t=this.cat.gui_bundle_name);const t=await this.getGuiPrefabByType(this.#t,Qt.Root),e=h(t);return this.gui=e.getComponent(Kt).init(this.cat),n.addPersistRootNode(e),this}}class Xt{get=(t,e,i="resources")=>T.getBundle(i).get(t,e);isAssetType=t=>"function"==typeof t&&t.prototype instanceof I;async load(...t){let e=null,i=null,s=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let o=t.shift();this.isAssetType(t[0])&&(i=t.shift()),2==t.length&&(s=t.shift());const n=t.shift();let r=O;if(e&&"resources"!=e){T.bundles.has(e)||await this.loadBundle(e);let t=T.bundles.get(e);t&&(r=t)}s&&n?r.load(o,i,s,n):n?r.load(o,i,n):r.load(o,i)}async loadDir(...t){let e=null,i=null,s=null,o=null;"string"==typeof t[0]&&"string"==typeof t[1]&&(e=t.shift());let n=t.shift();this.isAssetType(t[0])&&(i=t.shift()),2==t.length&&(s=t.shift()),o=t.shift();let r=O;if(e&&"resources"!=e){T.bundles.has(e)||await this.loadBundle(e);let t=T.bundles.get(e);t&&(r=t)}s&&o?r.loadDir(n,i,s,o):o?r.loadDir(n,i,o):r.loadDir(n,i)}loadRemote(t,...e){var i,s=null;2==e.length&&(s=e.shift()),i=e.shift(),T.loadRemote(t,{ext:".png",...s},i)}loadBundle=(t,e)=>new Promise(((i,s)=>{const o=(t,e)=>{if(t)return s(t);i(e)};e?T.loadBundle(t,{version:e},o):T.loadBundle(t,o)}));releasePrefabtDepsRecursively=t=>{var e=T.assets.get(t);(T.releaseAsset(e),e instanceof c)&&T.dependUtil.getDepsRecursively(t).forEach((t=>{T.assets.get(t).decRef()}))};release=(t,e="resources")=>{var i=T.getBundle(e);if(i){var s=i.get(t);s&&this.releasePrefabtDepsRecursively(s._uuid)}};releaseDir=(t,e="resources")=>{var i=T.getBundle(e),s=i?.getDirWithPath(t);s?.map((t=>{this.releasePrefabtDepsRecursively(t.uuid)})),!t&&"resources"!=e&&i&&T.removeBundle(i)};dump=()=>{T.assets.forEach(((t,e)=>{r(T.assets.get(e))})),r(`当前资源总数:${T.assets.count}`)}}let qt=null;const Zt={stringify:t=>{const e={ct:t.ciphertext.toString(H.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),i=H.lib.CipherParams.create({ciphertext:H.enc.Base64.parse(e.ct)});return e.iv&&(i.iv=H.enc.Hex.parse(e.iv)),e.s&&(i.salt=H.enc.Hex.parse(e.s)),i}};var Yt=Object.freeze({__proto__:null,JsonFormatter:Zt,aesDecrypt:(t,e,i)=>H.AES.decrypt(t,e,{iv:qt,format:Zt}).toString(H.enc.Utf8),aesEncrypt:(t,e,i)=>H.AES.encrypt(t,e,{iv:qt,format:Zt}).toString(),initCrypto:(t,e)=>{qt=H.enc.Hex.parse(e)},md5:t=>H.MD5(t).toString()});class te extends Z{encryptUtil=Yt}class ee extends K{logBlackList=[];ignore=t=>this.logBlackList.includes(t);constructor(t,e,i,s){super(e,i,s,t)}destroy(){this.disconnect(!0),me.socialGameClient.unregister(this)}async GameRequest(t,e,i,s){return new Promise(((o,n)=>{super.GameRequest(t,e,i,s).then((e=>{F&&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",G(i,e)),o(e)}),(t=>{me.gui.showToast({title:t.msg}),n(t)}))}))}subscribe(t,e,i){return super.subscribe(t,e,(s=>{F&&!this.ignore(t)&&r(`%c ws服务端消息:[subscribe][${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",G(e,s)),me.event.emit(t,G(e,s)),i?.(s)})),this}}class ie extends Z{managedClients=new Map;isGlobalOnline=!0;isInBackground=!1;onEventHideDelegate=new k;onEventShowDelegate=new k;onEventReloadSceneDelegate=new k;get activeClients(){return Array.from(this.managedClients).map((([t,e])=>e)).filter((t=>t.socket))}constructor(t){super(t),this.initGlobalListeners()}createWebSocket(t,e,i,s){if(this.managedClients.has(t)){this.managedClients.get(t).destroy(),r(`清理旧的 ${t} 客户端`)}const o=new ee(t,i,s,Object.assign({reconnectMaxAttempts:1/0},{...e,isAutoConnect:!1,isArrayBuffer:x}));return this.register(o),o}register(t){t.on("reconnected",this.handleSingleReconnect),t.on("close",this.handleSingleClose),t.on("kick",this.handleSingleKick),this.managedClients.set(t.name,t)}unregister(t){t.off("reconnected",this.handleSingleReconnect),t.off("close",this.handleSingleClose),t.off("kick",this.handleSingleKick),this.managedClients.delete(t.name)}initGlobalListeners(){this.cat.event.on(vt.ONLINE,(()=>this.handleGlobalStateChange("online")),this).on(vt.OFFLINE,(()=>this.handleGlobalStateChange("offline")),this),y.on(N.EVENT_SHOW,(()=>this.handleGlobalStateChange("show"))),y.on(N.EVENT_HIDE,(()=>this.handleGlobalStateChange("hide")))}async handleGlobalStateChange(t){switch(t){case"online":this.isGlobalOnline=!0,this.triggerReconnectAll();break;case"offline":this.isGlobalOnline=!1,this.disconnectAll(!0);break;case"show":this.isInBackground=!1,await this.triggerReconnectAll(),await this.onEventShowDelegate.dispatch();break;case"hide":await this.onEventHideDelegate.dispatch(),this.isInBackground=!0,this.disconnectAll(!0)}}async triggerReconnectAll(){if(!this.isGlobalOnline||this.isInBackground)return;if(0===this.managedClients.size)return void r("没有任何WS需要重连");me.gui.showLoading({title:"正在重连"}),await Promise.allSettled(this.activeClients.map((async t=>{try{await t.reconnectPromise()}catch(e){s(`${t.name}服重连失败`,e),me.gui.showToast({title:`${t.name}服重连失败`})}})));const t=this.activeClients.filter((t=>t.socketConnectStatus!==$.CONNECTED));t.length>0&&(console.error("部分WS重连失败:",t.map((t=>t))),setTimeout((()=>{this.triggerReconnectAll()}),2e3))}disconnectAll(t){this.managedClients.forEach((e=>{r("断开连接",e.name,t,e.socket),e.disconnect(t)}))}handleSingleClose(){this.triggerReconnectAll()}handleSingleReconnect=async()=>{this.activeClients.every((t=>t.socketConnectStatus===$.CONNECTED))&&(r("单个WS重连成功回调===",this.managedClients),await Promise.allSettled(this.activeClients.map((async t=>{try{await t.connectRequest()}catch(e){s(`${t.name}服登录错误`,e),me.gui.showToast({title:`登录${t.name}服错误`})}}))),await this.onEventReloadSceneDelegate.dispatch(),me.gui.hideLoading().reloadScene())};handleSingleKick(){me.gui.showReconnect(Mt.KICK)}}class se{rootStore;constructor(t){this.rootStore=t}}class oe extends Z{}const{ccclass:ne,property:re,menu:ae}=e;let le=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(w.EventType.CLICK,this.onCancelHandler,this),this.btn_confirm.node.on(w.EventType.CLICK,this.onConfirmHandler,this),this.btn_close.node.on(w.EventType.CLICK,this.onCloseHandler,this),this.addAutorun([()=>{this.title.spriteFrame=this.props?.title||this.default_title},()=>{this.props.content&&(this.props.content instanceof D?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(M).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(M).spriteFrame=this.props.style?.cancel||this.cancel_spriteFrame)}])}close(){this.props.cancelCB?.(),me.gui.closeUI(this)}onCancelHandler(){this.close()}onConfirmHandler(){this.props.confirmCB?.()}onDestroy(){this.isConfirm&&this.props.onDestroy?.()}onCloseHandler(){this.close()}};var ce;it([re({type:D,tooltip:"默认标题"}),st("design:type",D)],le.prototype,"default_title",void 0),it([re({type:M,tooltip:"标题节点"}),st("design:type",M)],le.prototype,"title",void 0),it([re({type:C,tooltip:"字符串内容按钮"}),st("design:type",C)],le.prototype,"prompt_content_str",void 0),it([re({type:M,tooltip:"图片精灵内容按钮"}),st("design:type",M)],le.prototype,"prompt_content_spriteFrame",void 0),it([re({type:w,tooltip:"确认按钮"}),st("design:type",w)],le.prototype,"btn_confirm",void 0),it([re({type:D,tooltip:"确认按钮精灵图"}),st("design:type",D)],le.prototype,"confirm_spriteFrame",void 0),it([re({type:w,tooltip:"取消按钮"}),st("design:type",w)],le.prototype,"btn_cancel",void 0),it([re({type:D,tooltip:"取消按钮精灵图"}),st("design:type",D)],le.prototype,"cancel_spriteFrame",void 0),it([re({type:w,tooltip:"关闭按钮"}),st("design:type",w)],le.prototype,"btn_close",void 0),le=it([ne("CoreUIModal"),ae("CATCORE/CoreUIModal")],le),function(t){t[t.Delay=0]="Delay",t[t.Interval=1]="Interval"}(ce||(ce={}));class he{tag;type;callback;remainingTime;executionTime=0;initialTime;constructor(t,e,i,s){this.tag=t,this.type=e,this.remainingTime=i,this.initialTime=i,this.callback=s}}class pe extends Z{timers=new Map;lastUpdateTime=Date.now();constructor(t){super(t),t.event.on(vt.EVENT_HIDE,this.onHandleAppBackground,this),t.event.on(vt.EVENT_SHOW,this.onHandleAppForeground,this),setInterval(this.update.bind(this),1e3)}onHandleAppBackground(){this.lastUpdateTime=Date.now()}onHandleAppForeground(){const t=Date.now(),e=t-this.lastUpdateTime;r("elapsedTime",e);for(const t of this.timers.values())t.remainingTime>0&&(t.remainingTime-=e,t.executionTime+=e);this.lastUpdateTime=t}registerInterval(t,e,i){if(this.has(t))return s(`${t}定时器已存在,请勿重复注册`);const o=new he(t,ce.Interval,e,i);this.timers.set(t,o)}registerDelay(t,e,i){if(this.has(t))return s(`${t}延时器已存在,请勿重复注册`);const o=new he(t,ce.Delay,e,i);this.timers.set(t,o)}unregister(t){this.has(t)&&this.timers.delete(t)}has(t){return this.timers.has(t)}update(){const t=[];for(const[e,i]of this.timers.entries())i.remainingTime-=1e3,i.remainingTime<=0&&(i.type===ce.Interval&&(i.executionTime+=i.initialTime),i.callback(i.executionTime),i.type===ce.Interval?i.remainingTime=i.initialTime:t.push(e));for(const e of t)this.timers.delete(e)}}const de=(t,e)=>(i,s,o)=>{let n=o.value;return o.value=function(...i){const s=t??me.default_audio_effect;s?me.audio.playEffect(s):console.warn("请添加音效路径参数"),e&&e(),n.apply(this,i)},o},ue=(t=1,e)=>function(i,s,o){let n=o.value,r=!1;return o.value=function(...i){r?e&&e():(r=!0,setTimeout((()=>{r=!1}),1e3*t),n.apply(this,i))},o};class _e{static#e=null;#i=!1;static get instance(){return this.#e??(this.#e=new _e)}onAppInitDelegate=new k;onPlugInInitDelegate=new k;#s=null;get audio(){return this.#s}#o=null;get event(){return this.#o}#n=null;get gui(){return this.#n}#r=null;get storage(){return this.#r}#a=null;get res(){return this.#a}#l=null;get util(){return this.#l}#c=null;get socialGameClient(){return this.#c}#h=null;get store(){return this.#h}#p="";get gui_bundle_name(){return this.#p}#d="";get audio_local_store_key(){return this.#d}#u="";get default_audio_effect(){return this.#u}setConfig=({default_audio_effect:t="",gui_bundleName:e="resources",audio_local_store_key:i="game_audio"}={})=>{if(this.#i)throw new Error("[CAT] 已初始化,无法修改配置");return this.#p=e,this.#d=i,this.#u=t,this};async boot(){if(this.#i)throw new Error("[CAT] 已初始化");try{this.#h=new oe(this),this.#a=new Xt,this.#l=new te(this),this.#r=new et(this),this.#o=new j,this.#s=new tt(this),this.#c=new ie(this),this.#n=(await new Jt(this).init()).gui,this.#i=!0}catch(t){throw console.error("[CAT] 初始化失败:",t),t}}merge(t,e){if(!this.#i)throw new Error("[CAT] 未初始化");if("string"!=typeof t)throw new Error("merge方法第一个参数应该为string类型");return Reflect.get(this,t)||Reflect.set(this,t,e),Object.assign(Reflect.get(this,t),e),this}appendPlugInInitDelegate(t){return this.#i?Promise.resolve().then(t).catch((t=>{console.error("[CAT] appendPlugInInitDelegate 回调执行失败:",t)})):this.onPlugInInitDelegate.add(t),this}}const me=_e.instance;y.onPostProjectInitDelegate.add((async()=>{console.time("[Init App]");try{await me.boot(),await me.onAppInitDelegate.dispatch(),await me.onPlugInInitDelegate.dispatch()}catch(t){throw s(`[Init App] 初始化失败: ${t instanceof Error?t.message:String(t)}`),t}finally{console.timeEnd("[Init App]")}}));export{de as AudioEffect,Y as AudioEventConstant,tt as AudioManager,ht as AudioSourceBaseComponent,ut as AudioSourceUILayer,ct as AudioTypeEnum,ot as BaseComponent,Z as BaseManager,Qt as BasePrefab,se as BaseStore,ue as ButtonLock,zt as CoreBlackMask,Ut as CoreNotice,Rt as CoreReconnection,Ot as CoreShowLoading,oe as CoreStore,yt as CoreToast,wt as CoreUIContainer,le as CoreUIModal,te as CoreUtil,vt as GlobalEventConstant,Kt as Gui,Jt as GuiManager,$t as LayerType,_e as Manager,Mt as ReconnectPrompt,St as RootUILayer,Lt as SceneLayer,pe as TimerManager,gt as ToastType,rt as UILayer,ee as WrapperSocialGameClient,me as cat};
|
package/package.json
CHANGED
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@shimotsuki/core",
|
|
3
|
-
"version": "2.0.
|
|
4
|
-
"description": "",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"main": "dist/shimotsuki_core.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
|
-
"repository": "https://gitee.com/shimotsuki_yami/cat-core",
|
|
9
|
-
"author": "shimotsuki <youcunzhou2383@shengtian.com>",
|
|
10
|
-
"scripts": {
|
|
11
|
-
"build": "npx rollup -c rollup.config.js"
|
|
12
|
-
},
|
|
13
|
-
"devDependencies": {
|
|
14
|
-
"@babel/core": "^7.26.8",
|
|
15
|
-
"@babel/preset-env": "^7.26.8",
|
|
16
|
-
"@rollup/plugin-babel": "^6.0.4",
|
|
17
|
-
"@rollup/plugin-typescript": "^12.1.2",
|
|
18
|
-
"api": "git+ssh://git@gitlab.stnts.com:sparklab/gameapi.git",
|
|
19
|
-
"rollup-plugin-delete": "^2.1.0",
|
|
20
|
-
"rollup-plugin-typescript2": "^0.36.0",
|
|
21
|
-
"tslib": "^2.8.1",
|
|
22
|
-
"typescript": "^5.7.3"
|
|
23
|
-
},
|
|
24
|
-
"type": "module",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@bufbuild/protobuf": "^2.2.5",
|
|
27
|
-
"@rollup/plugin-commonjs": "^26.0.1",
|
|
28
|
-
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
29
|
-
"@shimotsuki/mobx": "^1.0.1",
|
|
30
|
-
"core-js": "^3.41.0",
|
|
31
|
-
"crypto-es": "^2.1.0",
|
|
32
|
-
"eventemitter3": "^5.0.1",
|
|
33
|
-
"
|
|
34
|
-
"rollup
|
|
35
|
-
"rollup-plugin-
|
|
36
|
-
"rollup-plugin-
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"./temp/
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@shimotsuki/core",
|
|
3
|
+
"version": "2.0.57",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/shimotsuki_core.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": "https://gitee.com/shimotsuki_yami/cat-core",
|
|
9
|
+
"author": "shimotsuki <youcunzhou2383@shengtian.com>",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "npx rollup -c rollup.config.js"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@babel/core": "^7.26.8",
|
|
15
|
+
"@babel/preset-env": "^7.26.8",
|
|
16
|
+
"@rollup/plugin-babel": "^6.0.4",
|
|
17
|
+
"@rollup/plugin-typescript": "^12.1.2",
|
|
18
|
+
"api": "git+ssh://git@gitlab.stnts.com:sparklab/gameapi.git",
|
|
19
|
+
"rollup-plugin-delete": "^2.1.0",
|
|
20
|
+
"rollup-plugin-typescript2": "^0.36.0",
|
|
21
|
+
"tslib": "^2.8.1",
|
|
22
|
+
"typescript": "^5.7.3"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@bufbuild/protobuf": "^2.2.5",
|
|
27
|
+
"@rollup/plugin-commonjs": "^26.0.1",
|
|
28
|
+
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
29
|
+
"@shimotsuki/mobx": "^1.0.1",
|
|
30
|
+
"core-js": "^3.41.0",
|
|
31
|
+
"crypto-es": "^2.1.0",
|
|
32
|
+
"eventemitter3": "^5.0.1",
|
|
33
|
+
"pitayaclient": "git+ssh://git@gitlab.stnts.com:sparklab/pitaya-client.git",
|
|
34
|
+
"rollup": "^4.18.1",
|
|
35
|
+
"rollup-plugin-copy": "^3.5.0",
|
|
36
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
37
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
38
|
+
"sgc": "git+ssh://git@gitlab.stnts.com:sparklab/social-gaming-client.git"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"package.json",
|
|
43
|
+
"./temp/tsconfig.cocos.json",
|
|
44
|
+
"./temp/declarations",
|
|
45
|
+
"tsconfig.json",
|
|
46
|
+
"LICENSE"
|
|
47
|
+
]
|
|
48
|
+
}
|