Unity and Cocos stay as parallel schemes; apps/minigame ships the Godot 4.7 WeChat pack for DevTools. Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
50 KiB
JavaScript
1 line
50 KiB
JavaScript
var e=Object.create,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,n=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty;let i=window.Symbol,a=0;i||(i=function(e){return`__${e}_${Math.floor(1e9*Math.random())}_${++a}__`},i.iterator=i("Symbol.iterator")),window.Symbol=i;const u="object"==typeof self?self:globalThis,c=e=>((e,t)=>{const r=(t,r)=>(e.set(r,t),t),s=n=>{if(e.has(n))return e.get(n);const[o,i]=t[n];switch(o){case 0:case-1:return r(i,n);case 1:{const e=r([],n);for(const t of i)e.push(s(t));return e}case 2:{const e=r({},n);for(const[t,r]of i)e[s(t)]=s(r);return e}case 3:return r(new Date(i),n);case 4:{const{source:e,flags:t}=i;return r(new RegExp(e,t),n)}case 5:{const e=r(new Map,n);for(const[t,r]of i)e.set(s(t),s(r));return e}case 6:{const e=r(new Set,n);for(const t of i)e.add(s(t));return e}case 7:{const{name:e,message:t}=i;return r(new u[e](t),n)}case 8:return r(BigInt(i),n);case"BigInt":return r(Object(BigInt(i)),n)}return r(new u[o](i),n)};return s})(new Map,e)(0),l="",{toString:d}={},{keys:g}=Object,h=e=>{const t=typeof e;if("object"!==t||!e)return[0,t];const r=d.call(e).slice(8,-1);switch(r){case"Array":return[1,l];case"Object":return[2,l];case"Date":return[3,l];case"RegExp":return[4,l];case"Map":return[5,l];case"Set":return[6,l]}return r.includes("Array")?[1,r]:r.includes("Error")?[7,r]:[2,r]},m=([e,t])=>0===e&&("function"===t||"symbol"===t),b=(e,{json:t,lossy:r}={})=>{const s=[];return((e,t,r,s)=>{const n=(e,t)=>{const n=s.push(e)-1;return r.set(t,n),n},o=s=>{if(r.has(s))return r.get(s);let[i,a]=h(s);switch(i){case 0:{let t=s;switch(a){case"bigint":i=8,t=s.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+a);t=null;break;case"undefined":return n([-1],s)}return n([i,t],s)}case 1:{if(a)return n([a,[...s]],s);const e=[],t=n([i,e],s);for(const t of s)e.push(o(t));return t}case 2:{if(a)switch(a){case"BigInt":return n([a,s.toString()],s);case"Boolean":case"Number":case"String":return n([a,s.valueOf()],s)}if(t&&"toJSON"in s)return o(s.toJSON());const r=[],u=n([i,r],s);for(const t of g(s))!e&&m(h(s[t]))||r.push([o(t),o(s[t])]);return u}case 3:return n([i,s.toISOString()],s);case 4:{const{source:e,flags:t}=s;return n([i,{source:e,flags:t}],s)}case 5:{const t=[],r=n([i,t],s);for(const[r,n]of s)(e||!m(h(r))&&!m(h(n)))&&t.push([o(r),o(n)]);return r}case 6:{const t=[],r=n([i,t],s);for(const r of s)!e&&m(h(r))||t.push(o(r));return r}}const{message:u}=s;return n([i,{name:a,message:u}],s)};return o})(!(t||r),!!t,new Map,s)(e),s};let p,f=Date.now();p=function(){return Date.now()-f},GameGlobal.nowPolyfill=window.nowPolyfill=p,window.alert=console.warn;var y,S,C=(y={"helper/fs-utils.js"(e,t){const r=wx.getFileSystemManager?wx.getFileSystemManager():null,s=/the maximum size of the file storage/,n={fs:r,localFetch:e=>new Promise(((t,s)=>{r.readFile({filePath:e,complete:e=>{t(e.data)}})})),isOutOfStorage:e=>s.test(e),getUserDataPath:()=>wx.env.USER_DATA_PATH,checkFsValid:()=>!!r||(console.warn("can not get the file system!"),!1),deleteFile(e,t){r.unlink({filePath:e,success(){t&&t(null)},fail(r){console.warn(`Delete file failed: path: ${e} message: ${r.errMsg}`),t&&t(new Error(r.errMsg))}})},downloadFile(e,t,r,s,o){const i={url:e,success(t){200===t.statusCode?o&&o(null,t.tempFilePath||t.filePath):(t.filePath&&n.deleteFile(t.filePath),console.warn(`Download file failed: path: ${e} message: ${t.statusCode}`),o&&o(new Error(t.statusCode),null))},fail(t){console.warn(`Download file failed: path: ${e} message: ${t.errMsg}`),o&&o(new Error(t.errMsg),null)}};t&&(i.filePath=t),r&&(i.header=r);const a=wx.downloadFile(i);s&&a.onProgressUpdate(s)},saveFile(e,t,r){wx.saveFile({tempFilePath:e,filePath:t,success(e){r&&r(null)},fail(t){console.warn(`Save file failed: path: ${e} message: ${t.errMsg}`),r&&r(new Error(t.errMsg))}})},copyFile(e,t,s){r.copyFile({srcPath:e,destPath:t,success(){s&&s(null)},fail(t){console.warn(`Copy file failed: path: ${e} message: ${t.errMsg}`),s&&s(new Error(t.errMsg))}})},writeFile(e,t,s,n){r.writeFile({filePath:e,encoding:s,data:t,success(){n&&n(null)},fail(t){console.warn(`Write file failed: path: ${e} message: ${t.errMsg}`),n&&n(new Error(t.errMsg))}})},writeFileSync(e,t,s){try{return r.writeFileSync(e,t,s),null}catch(t){return console.warn(`Write file failed: path: ${e} message: ${t.message}`),new Error(t.message)}},readFile(e,t,s){r.readFile({filePath:e,encoding:t,success(e){s&&s(null,e.data)},fail(t){console.warn(`Read file failed: path: ${e} message: ${t.errMsg}`),s&&s(new Error(t.errMsg),null)}})},readDir(e,t){r.readdir({dirPath:e,success(e){t&&t(null,e.files)},fail(r){console.warn(`Read directory failed: path: ${e} message: ${r.errMsg}`),t&&t(new Error(r.errMsg),null)}})},readText(e,t){n.readFile(e,"utf8",t)},readArrayBuffer(e,t){n.readFile(e,"",t)},readJson(e,t){n.readFile(e,"utf8",((r,s)=>{let n=null;if(!r)try{n=JSON.parse(s)}catch(t){console.warn(`Read json failed: path: ${e} message: ${t.message}`),r=new Error(t.message)}t&&t(r,n)}))},readJsonSync(e){try{const t=r.readFileSync(e,"utf8");return JSON.parse(t)}catch(t){return console.warn(`Read json failed: path: ${e} message: ${t.message}`),new Error(t.message)}},makeDirSync(e,t){try{return r.mkdirSync(e,t),null}catch(t){return console.warn(`Make directory failed: path: ${e} message: ${t.message}`),new Error(t.message)}},rmdirSync(e,t){try{r.rmdirSync(e,t)}catch(t){return console.warn(`rm directory failed: path: ${e} message: ${t.message}`),new Error(t.message)}},exists(e,t){r.access({path:e,success(){t&&t(!0)},fail(){t&&t(!1)}})},loadSubpackage(e,t,r){const s=wx.loadSubpackage({name:e,success(){r&&r()},fail(t){console.warn(`Load Subpackage failed: path: ${e} message: ${t.errMsg}`),r&&r(new Error(`Failed to load subpackage ${e}: ${t.errMsg}`))}});return t&&s.onProgressUpdate(t),s},unzip(e,t,s){r.unzip({zipFilePath:e,targetPath:t,success(){s&&s(null)},fail(t){console.warn(`unzip failed: path: ${e} message: ${t.errMsg}`),s&&s(new Error(`unzip failed: ${t.errMsg}`))}})}};GameGlobal.fsUtils=window.fsUtils=t.exports=n,console.log("fs util loaded")}},function(){return S||(0,y[s(y)[0]])((S={exports:{}}).exports,S),S.exports});var w={_send:null,init(){this._send=GameGlobal.Module.SendMessage},send(e,t=""){this._send||this.init(),this._send("GODOTSDKManagerHandler",e,t)}};let E={cloneMethod(e,t,r,s){t[r]&&(e[s=s||r]=t[r].bind(t))}};Object.assign({AccountInfo:{miniProgram:"MiniProgram",plugin:"Plugin"},MiniProgram:{appId:"string",envVersion:"string",version:"string"},Plugin:{appId:"string",version:"string"},AppAuthorizeSetting:{albumAuthorized:"string",bluetoothAuthorized:"string",cameraAuthorized:"string",locationAuthorized:"string",locationReducedAccuracy:"bool",microphoneAuthorized:"string",notificationAlertAuthorized:"string",notificationAuthorized:"string",notificationBadgeAuthorized:"string",notificationSoundAuthorized:"string",phoneCalendarAuthorized:"string"},AppBaseInfo:{SDKVersion:"string",enableDebug:"bool",host:"AppBaseInfoHost",language:"string",version:"string",theme:"string"},AppBaseInfoHost:{appId:"string"},GetBatteryInfoSyncResult:{isCharging:"bool",level:"number"},DeviceInfo:{abi:"string",benchmarkLevel:"number",brand:"string",cpuType:"string",deviceAbi:"string",memorySize:"string",model:"string",platform:"string",system:"string"},EnterOptionsGame:{apiCategory:"string",query:"object",referrerInfo:"EnterOptionsGameReferrerInfo",scene:"number",chatType:"number",shareTicket:"string"},EnterOptionsGameReferrerInfo:{appId:"string",extraData:"object",gameLiveInfo:"GameLiveInfo"},GameLiveInfo:{streamerOpenId:"string",feedId:"string"},LaunchOptionsGame:{query:"object",referrerInfo:"EnterOptionsGameReferrerInfo",scene:"number",chatType:"number",shareTicket:"string"},ClientRect:{bottom:"number",height:"number",left:"number",right:"number",top:"number",width:"number"},GetStorageInfoSyncOption:{currentSize:"number",keys:"string[]",limitSize:"number"},SystemInfo:{SDKVersion:"string",albumAuthorized:"bool",benchmarkLevel:"number",bluetoothEnabled:"bool",brand:"string",cameraAuthorized:"bool",deviceOrientation:"string",enableDebug:"bool",fontSizeSetting:"number",host:"SystemInfoHost",language:"string",locationAuthorized:"bool",locationEnabled:"bool",locationReducedAccuracy:"bool",microphoneAuthorized:"bool",model:"string",notificationAlertAuthorized:"bool",notificationAuthorized:"bool",notificationBadgeAuthorized:"bool",notificationSoundAuthorized:"bool",phoneCalendarAuthorized:"bool",pixelRatio:"number",platform:"string",safeArea:"SafeArea",screenHeight:"number",screenWidth:"number",statusBarHeight:"number",system:"string",version:"string",wifiEnabled:"bool",windowHeight:"number",windowWidth:"number",theme:"string"},SystemInfoHost:{appId:"string"},SafeArea:{bottom:"number",height:"number",left:"number",right:"number",top:"number",width:"number"},SystemSetting:{bluetoothEnabled:"bool",deviceOrientation:"string",locationEnabled:"bool",wifiEnabled:"bool"},WindowInfo:{pixelRatio:"number",safeArea:"SafeArea",screenHeight:"number",screenTop:"number",screenWidth:"number",statusBarHeight:"number",windowHeight:"number",windowWidth:"number"},GeneralCallbackResult:{errMsg:"string"},DownloadFileSuccessCallbackResult:{filePath:"string",profile:"RequestProfile",statusCode:"number",tempFilePath:"string",errMsg:"string"},RequestProfile:{SSLconnectionEnd:"number",SSLconnectionStart:"number",connectEnd:"number",connectStart:"number",domainLookUpEnd:"number",domainLookUpStart:"number",downstreamThroughputKbpsEstimate:"number",estimate_nettype:"number",fetchStart:"number",httpRttEstimate:"number",peerIP:"string",port:"number",protocol:"string",receivedBytedCount:"number",redirectEnd:"number",redirectStart:"number",requestEnd:"number",requestStart:"number",responseEnd:"number",responseStart:"number",rtt:"number",sendBytesCount:"number",socketReused:"bool",throughputKbps:"number",transportRttEstimate:"number"},DownloadTaskOnHeadersReceivedListenerResult:{header:"object"},DownloadTaskOnProgressUpdateListenerResult:{progress:"number",totalBytesExpectedToWrite:"number",totalBytesWritten:"number"},CreateOpenSettingButtonOption:{style:"OptionStyle",type:"string",image:"string",text:"string"},OptionStyle:{backgroundColor:"string",borderColor:"string",borderRadius:"number",borderWidth:"number",color:"string",fontSize:"number",height:"number",left:"number",lineHeight:"number",textAlign:"string",top:"number",width:"number"},ImageData:{height:"number",width:"number"},GetLogManagerOption:{level:"number"},Path2D:{},OnCheckForUpdateListenerResult:{hasUpdate:"bool"},VideoDecoderStartOption:{source:"string",abortAudio:"bool",abortVideo:"bool",mode:"number"},SetMessageToFriendQueryOption:{query:"string",shareMessageToFriendScene:"number"},AddCardRequestInfo:{cardExt:"string",cardId:"string"},AddCardSuccessCallbackResult:{cardList:"AddCardResponseInfo[]",errMsg:"string"},AddCardResponseInfo:{cardExt:"string",cardId:"string",code:"string",isSuccess:"bool"},AuthPrivateMessageSuccessCallbackResult:{encryptedData:"string",errMsg:"string",iv:"string",valid:"bool"},CheckIsAddedToMyMiniProgramSuccessCallbackResult:{added:"bool",errMsg:"string"},ChooseImageSuccessCallbackResult:{tempFilePaths:"string[]",tempFiles:"ImageFile[]",errMsg:"string"},ImageFile:{path:"string",size:"number"},ChooseMediaSuccessCallbackResult:{tempFiles:"MediaFile[]",type:"string",errMsg:"string"},MediaFile:{duration:"number",fileType:"string",height:"number",size:"number",tempFilePath:"string",thumbTempFilePath:"string",width:"number"},ChooseMessageFileSuccessCallbackResult:{tempFiles:"ChooseFile[]",errMsg:"string"},ChooseFile:{name:"string",path:"string",size:"number",time:"number",type:"string"},BluetoothError:{errMsg:"string",errCode:"number"},CompressImageSuccessCallbackResult:{tempFilePath:"string",errMsg:"string"},CreateBLEPeripheralServerSuccessCallbackResult:{server:"BLEPeripheralServer",errMsg:"string"},BLEPeripheralService:{characteristics:"Characteristic[]",uuid:"string"},Characteristic:{uuid:"string",descriptors:"Descriptor[]",permission:"CharacteristicPermission",properties:"CharacteristicProperties",value:"arrayBuffer",arrayBufferLength:"number"},Descriptor:{uuid:"string",permission:"DescriptorPermission",value:"arrayBuffer",arrayBufferLength:"number"},DescriptorPermission:{read:"bool",write:"bool"},CharacteristicPermission:{readEncryptionRequired:"bool",readable:"bool",writeEncryptionRequired:"bool",writeable:"bool"},CharacteristicProperties:{indicate:"bool",notify:"bool",read:"bool",write:"bool",writeNoResponse:"bool"},OnCharacteristicReadRequestListenerResult:{callbackId:"number",characteristicId:"string",serviceId:"string"},OnCharacteristicSubscribedListenerResult:{characteristicId:"string",serviceId:"string"},OnCharacteristicWriteRequestListenerResult:{callbackId:"number",characteristicId:"string",serviceId:"string",value:"arrayBuffer",arrayBufferLength:"number"},AdvertiseReqObj:{beacon:"BeaconInfoObj",connectable:"bool",deviceName:"string",manufacturerData:"ManufacturerData[]",serviceUuids:"string[]"},BeaconInfoObj:{major:"number",minor:"number",uuid:"string",measuredPower:"number"},ManufacturerData:{manufacturerId:"string",manufacturerSpecificData:"arrayBuffer",arrayBufferLength:"number"},FaceDetectSuccessCallbackResult:{angleArray:"FaceAngel",confArray:"FaceConf",detectRect:"object",faceInfo:"IAnyObject[]",pointArray:"IAnyObject[]",x:"number",y:"number",errMsg:"string"},FaceAngel:{pitch:"number",roll:"number",yaw:"number"},FaceConf:{global:"number",leftEye:"number",mouth:"number",nose:"number",rightEye:"number"},GetAvailableAudioSourcesSuccessCallbackResult:{errMsg:"string"},GetBLEDeviceCharacteristicsSuccessCallbackResult:{characteristics:"BLECharacteristic[]",errMsg:"string"},BLECharacteristic:{properties:"BLECharacteristicProperties",uuid:"string"},BLECharacteristicProperties:{indicate:"bool",notify:"bool",read:"bool",write:"bool",writeDefault:"bool",writeNoResponse:"bool"},GetBLEDeviceRSSISuccessCallbackResult:{RSSI:"number",errMsg:"string"},GetBLEDeviceServicesSuccessCallbackResult:{services:"BLEService[]",errMsg:"string"},BLEService:{isPrimary:"bool",uuid:"string"},GetBLEMTUSuccessCallbackResult:{mtu:"number",errMsg:"string"},GetBackgroundFetchDataSuccessCallbackResult:{fetchedData:"string",path:"string",query:"string",scene:"number",timeStamp:"long",errMsg:"string"},GetBackgroundFetchTokenSuccessCallbackResult:{errMsg:"string",token:"string"},GetBatteryInfoSuccessCallbackResult:{isCharging:"bool",level:"number",errMsg:"string"},BeaconError:{errMsg:"string",errCode:"number"},GetBeaconsSuccessCallbackResult:{beacons:"BeaconInfo[]",errMsg:"string"},BeaconInfo:{accuracy:"number",major:"number",minor:"number",proximity:"number",rssi:"number",uuid:"string"},GetBluetoothAdapterStateSuccessCallbackResult:{available:"bool",discovering:"bool",errMsg:"string"},GetBluetoothDevicesSuccessCallbackResult:{devices:"BlueToothDevice[]",errMsg:"string"},BlueToothDevice:{RSSI:"number",advertisData:"arrayBuffer",arrayBufferLength:"number",advertisServiceUUIDs:"string[]",connectable:"bool",deviceId:"string",localName:"string",name:"string",serviceData:"object"},GetChannelsLiveInfoSuccessCallbackResult:{description:"string",feedId:"string",headUrl:"string",nickname:"string",nonceId:"string",otherInfos:"AnyKeyword[]",replayStatus:"number",status:"number",errMsg:"string"},GetChannelsLiveNoticeInfoSuccessCallbackResult:{headUrl:"string",nickname:"string",noticeId:"string",otherInfos:"AnyKeyword[]",reservable:"bool",startTime:"string",status:"number",errMsg:"string"},GetClipboardDataSuccessCallbackOption:{data:"string",errMsg:"string"},GetConnectedBluetoothDevicesSuccessCallbackResult:{devices:"BluetoothDeviceInfo[]",errMsg:"string"},BluetoothDeviceInfo:{deviceId:"string",name:"string"},GetExtConfigSuccessCallbackResult:{extConfig:"object",errMsg:"string"},GetFuzzyLocationSuccessCallbackResult:{latitude:"number",longitude:"number",errMsg:"string"},DataType:{type:"number",subKey:"string"},GetGameClubDataSuccessCallbackResult:{cloudID:"string",encryptedData:"string",iv:"string",signature:"string",errMsg:"string"},GetGroupEnterInfoSuccessCallbackResult:{cloudID:"string",encryptedData:"string",errMsg:"string",iv:"string"},GetInferenceEnvInfoSuccessCallbackResult:{ver:"string",errMsg:"string"},GetLocalIPAddressSuccessCallbackResult:{errMsg:"string",localip:"string",netmask:"string"},GetNetworkTypeSuccessCallbackResult:{hasSystemProxy:"bool",networkType:"string",signalStrength:"number",errMsg:"string"},GetPrivacySettingSuccessCallbackResult:{needAuthorization:"bool",privacyContractName:"string",errMsg:"string"},GetScreenBrightnessSuccessCallbackOption:{value:"number",errMsg:"string"},GetScreenRecordingStateSuccessCallbackResult:{state:"string",errMsg:"string"},GetSettingSuccessCallbackResult:{authSetting:"AuthSetting",subscriptionsSetting:"SubscriptionsSetting",miniprogramAuthSetting:"AuthSetting",errMsg:"string"},AuthSetting:{},SubscriptionsSetting:{mainSwitch:"bool",itemSettings:"object"},GetStorageInfoSuccessCallbackOption:{currentSize:"number",keys:"string[]",limitSize:"number",errMsg:"string"},GetUserInfoSuccessCallbackResult:{cloudID:"string",encryptedData:"string",iv:"string",rawData:"string",signature:"string",userInfo:"UserInfo",errMsg:"string"},UserInfo:{avatarUrl:"string",city:"string",country:"string",gender:"number",language:"string",nickName:"string",province:"string"},GetUserInteractiveStorageFailCallbackResult:{errCode:"number",errMsg:"string"},GetUserInteractiveStorageSuccessCallbackResult:{cloudID:"string",encryptedData:"string",iv:"string",errMsg:"string"},GetWeRunDataSuccessCallbackResult:{cloudID:"string",encryptedData:"string",iv:"string",errMsg:"string"},JoinVoIPChatError:{errMsg:"string",errCode:"number"},MuteConfig:{muteEarphone:"bool",muteMicrophone:"bool"},JoinVoIPChatSuccessCallbackResult:{errCode:"number",errMsg:"string",openIdList:"string[]"},RequestFailCallbackErr:{errMsg:"string",errno:"number"},LoginSuccessCallbackResult:{code:"string",errMsg:"string"},OnAccelerometerChangeListenerResult:{x:"number",y:"number",z:"number"},OnAddToFavoritesListenerResult:{disableForward:"bool",imageUrl:"string",query:"string",title:"string"},OnBLEConnectionStateChangeListenerResult:{connected:"bool",deviceId:"string"},OnBLEMTUChangeListenerResult:{deviceId:"string",mtu:"number"},OnBLEPeripheralConnectionStateChangedListenerResult:{connected:"bool",deviceId:"string",serverId:"string"},OnBackgroundFetchDataListenerResult:{fetchType:"string",fetchedData:"string",path:"string",query:"string",scene:"number",timeStamp:"long"},OnBeaconServiceChangeListenerResult:{available:"bool",discovering:"bool"},OnBeaconUpdateListenerResult:{beacons:"BeaconInfo[]"},OnBluetoothAdapterStateChangeListenerResult:{available:"bool",discovering:"bool"},OnBluetoothDeviceFoundListenerResult:{devices:"BlueToothDevice[]"},OnCompassChangeListenerResult:{accuracy:"string",direction:"number"},OnCopyUrlListenerResult:{query:"string"},OnDeviceMotionChangeListenerResult:{alpha:"number",beta:"number",gamma:"number"},OnDeviceOrientationChangeListenerResult:{value:"string"},Error:{message:"string",stack:"string"},OnHandoffListenerResult:{query:"string"},OnKeyDownListenerResult:{code:"string",key:"string",timeStamp:"long"},OnKeyboardInputListenerResult:{value:"string"},OnKeyboardHeightChangeListenerResult:{height:"number"},OnMemoryWarningListenerResult:{level:"number"},OnMouseDownListenerResult:{button:"number",timeStamp:"long",x:"number",y:"number"},OnMouseMoveListenerResult:{movementX:"number",movementY:"number",timeStamp:"long",x:"number",y:"number"},OnNetworkStatusChangeListenerResult:{isConnected:"bool",networkType:"string"},OnNetworkWeakChangeListenerResult:{networkType:"string",weakNet:"bool"},OnScreenRecordingStateChangedListenerResult:{state:"string"},OnShareTimelineListenerResult:{imageUrl:"string",imagePreviewUrl:"string",imagePreviewUrlId:"string",imageUrlId:"string",path:"string",query:"string",title:"string"},OnShowListenerResult:{query:"object",referrerInfo:"ResultReferrerInfo",scene:"number",chatType:"number",shareTicket:"string"},ResultReferrerInfo:{appId:"string",extraData:"object"},OnUnhandledRejectionListenerResult:{promise:"string",reason:"string"},OnVoIPChatInterruptedListenerResult:{errCode:"number",errMsg:"string"},OnVoIPChatMembersChangedListenerResult:{errCode:"number",errMsg:"string",openIdList:"string[]"},OnVoIPChatSpeakersChangedListenerResult:{errCode:"number",errMsg:"string",openIdList:"string[]"},OnVoIPChatStateChangedListenerResult:{code:"number",data:"object",errCode:"number",errMsg:"string"},OnWheelListenerResult:{deltaX:"number",deltaY:"number",deltaZ:"number",timeStamp:"long",x:"number",y:"number"},OnWindowResizeListenerResult:{windowHeight:"number",windowWidth:"number"},OpenCardRequestInfo:{cardId:"string",code:"string"},ExtInfoOption:{url:"string"},OpenCustomerServiceConversationSuccessCallbackResult:{path:"string",query:"object",errMsg:"string"},OpenSettingSuccessCallbackResult:{authSetting:"AuthSetting",subscriptionsSetting:"SubscriptionsSetting",errMsg:"string"},OperateGameRecorderVideoOption:{atempo:"number",audioMix:"bool",bgm:"string",desc:"string",path:"string",query:"string",timeRange:"number[]",title:"string",volume:"number"},MediaSource:{url:"string",poster:"string",type:"string"},ReportSceneError:{errMsg:"string",errCode:"number"},ReportSceneFailCallbackErr:{data:"object",errMsg:"string"},ReportSceneSuccessCallbackResult:{data:"object",errMsg:"string"},ReportUserBehaviorBranchAnalyticsOption:{branchId:"string",eventType:"number",branchDim:"string"},MidasFriendPaymentError:{errMsg:"string",errCode:"number"},RequestMidasFriendPaymentSuccessCallbackResult:{cloudID:"string",encryptedData:"string",errMsg:"string",iv:"string"},MidasPaymentError:{errMsg:"string",errCode:"number"},RequestMidasPaymentFailCallbackErr:{errCode:"number",errMsg:"string"},RequestMidasPaymentSuccessCallbackResult:{errMsg:"string"},RequestSubscribeMessageFailCallbackResult:{errCode:"number",errMsg:"string"},RequestSubscribeMessageSuccessCallbackResult:{anyKeyWord:"string",errMsg:"string"},RequestSubscribeSystemMessageSuccessCallbackResult:{anyKeyWord:"string",errMsg:"string"},ReserveChannelsLiveOption:{noticeId:"string"},ScanCodeSuccessCallbackResult:{charSet:"string",path:"string",rawData:"string",result:"string",scanType:"string",errMsg:"string"},SetBLEMTUFailCallbackResult:{mtu:"number"},SetBLEMTUSuccessCallbackResult:{mtu:"number",errMsg:"string"},KVData:{key:"string",value:"string"},ShareAppMessageOption:{imageUrl:"string",imageUrlId:"string",path:"string",query:"string",title:"string",toCurrentGroup:"bool"},ShowActionSheetSuccessCallbackResult:{tapIndex:"number",errMsg:"string"},ShowModalSuccessCallbackResult:{cancel:"bool",confirm:"bool",content:"string",errMsg:"string"},UpdatableMessageFrontEndTemplateInfo:{parameterList:"UpdatableMessageFrontEndParameter[]"},UpdatableMessageFrontEndParameter:{name:"string",value:"string"},VibrateShortFailCallbackResult:{errMsg:"string"},CheckGameLiveEnabledSuccessCallbackOption:{errMsg:"string",isEnabled:"bool"},OnGameLiveStateChangeCallbackResult:{state:"string",feedId:"string"},OnGameLiveStateChangeCallbackResponse:{query:"string"},GameLiveState:{isLive:"bool"},GetUserCurrentGameliveInfoSuccessCallbackOption:{feedIdList:"string[]"},GetUserGameLiveDetailsSuccessCallbackOption:{encryptedData:"string",iv:"string",cloudID:"string",feedIdList:"string[]",errMsg:"string"},MidasPaymentGameItemError:{errMsg:"string",errCode:"number"},RequestSubscribeLiveActivitySuccessCallbackResult:{code:"string",errMsg:"string"},FrameDataOptions:{data:"arrayBuffer",arrayBufferLength:"number",height:"number",pkDts:"number",pkPts:"number",width:"number"}},{Stats:{lastAccessedTime:"number",lastModifiedTime:"number",mode:"number",size:"number"},TCPSocketOnMessageListenerResult:{localInfo:"LocalInfo",message:"arrayBuffer",remoteInfo:"RemoteInfo"},LocalInfo:{address:"string",family:"string",port:"number"},RemoteInfo:{address:"string",family:"string",port:"number"},UDPSocketConnectOption:{address:"string",port:"number"},UDPSocketOnMessageListenerResult:{localInfo:"LocalInfo",message:"arrayBuffer",remoteInfo:"RemoteInfo"},UDPSocketSendOption:{address:"string",message:"string|arrayBuffer",port:"number",length:"number",offset:"number",setBroadcast:"bool"},UDPSocketSendParam:{address:"string",port:"number",length:"number",offset:"number",setBroadcast:"bool"}});const M=()=>function(e=20,t=!0){const r=(t?"":"!#%()*+,-./:;=?@[]^_`{|}~")+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=r.length,n=[];for(let t=0;t<e;t++)n[t]=r.charAt(Math.random()*s);return n.join("")}(20,!0);var v=E;if(globalThis.__globalAdapter=window.__globalAdapter=window.__globalAdapter||{},globalThis.__globalAdapter){const e=window.__globalAdapter,t=wx.getSystemInfoSync(),r=t.windowWidth>t.windowHeight;e.isSubContext=void 0===wx.getOpenDataContext,e.isDevTool="devtools"===t.platform,v.cloneMethod(e,wx,"getSystemInfoSync"),v.cloneMethod(e,wx,"onTouchStart"),v.cloneMethod(e,wx,"onTouchMove"),v.cloneMethod(e,wx,"onTouchEnd"),v.cloneMethod(e,wx,"onTouchCancel"),v.cloneMethod(e,wx,"createInnerAudioContext"),v.cloneMethod(e,wx,"onAudioInterruptionEnd"),v.cloneMethod(e,wx,"onAudioInterruptionBegin"),v.cloneMethod(e,wx,"createVideo"),v.cloneMethod(e,wx,"setPreferredFramesPerSecond"),v.cloneMethod(e,wx,"showKeyboard"),v.cloneMethod(e,wx,"hideKeyboard"),v.cloneMethod(e,wx,"updateKeyboard"),v.cloneMethod(e,wx,"onKeyboardInput"),v.cloneMethod(e,wx,"onKeyboardConfirm"),v.cloneMethod(e,wx,"onKeyboardComplete"),v.cloneMethod(e,wx,"offKeyboardInput"),v.cloneMethod(e,wx,"offKeyboardConfirm"),v.cloneMethod(e,wx,"offKeyboardComplete"),v.cloneMethod(e,wx,"getOpenDataContext"),v.cloneMethod(e,wx,"onMessage"),v.cloneMethod(e,wx,"loadSubpackage"),v.cloneMethod(e,wx,"getSharedCanvas"),v.cloneMethod(e,wx,"loadFont"),v.cloneMethod(e,wx,"onShow"),v.cloneMethod(e,wx,"onHide"),"function"==typeof getApp&&(wx.onShow=wx.onAppShow,wx.onHide=wx.onAppHide),v.cloneMethod(e,wx,"onError"),v.cloneMethod(e,wx,"offError");let s=!1,n=1;wx.onDeviceOrientationChange&&wx.onDeviceOrientationChange((e=>{"landscape"===e.value?n=1:"landscapeReverse"===e.value&&(n=-1)})),Object.assign(e,{startAccelerometer(e){s?wx.startAccelerometer&&wx.startAccelerometer({fail(e){console.error("start accelerometer failed",e)}}):(s=!0,wx.onAccelerometerChange&&wx.onAccelerometerChange((t=>{const s={};let o=t.x,i=t.y;if(r){const e=o;o=-i,i=e}s.x=o*n,s.y=i*n,s.z=t.z,e&&e(s)})))},stopAccelerometer(){wx.stopAccelerometer&&wx.stopAccelerometer({fail(e){console.error("stop accelerometer failed",e)}})}})}((i,a,u)=>{u=null!=i?e(n(i)):{},((e,n,i,a)=>{if(n&&"object"==typeof n||"function"==typeof n)for(var u,c=s(n),l=0,d=c.length;l<d;l++)u=c[l],o.call(e,u)||u===i||t(e,u,{get:(e=>n[e]).bind(null,u),enumerable:!(a=r(n,u))||a.enumerable})})(!a&&i&&i.__esModule?u:t(u,"default",{value:i,enumerable:!0}),i)})(C(),1);const{version:k,SDKVersion:I,platform:x,system:R}=wx.getSystemInfoSync(),P=wx.getAccountInfoSync(),O=P?.miniProgram?.envVersion;function A(e,t){return!(!e||!t)&&e.split(".").map((e=>e.padStart(2,"0"))).join("")>=t.split(".").map((e=>e.padStart(2,"0"))).join("")}const T="windows"===x||"mac"===x,D="ios"===x,L="android"===x,G="devtools"===x,F=!T&&!G,B="develop"===O,_=GameGlobal.isIOSHighPerformanceMode,W=R?R.split(" "):[],U=W.length?W[W.length-1]:"",j=(A(k,"3.3"),A(I,"2.17.0"),A(I,"2.23.1")),z=A(U,"14.0"),$=(A(U,"15.0")||GameGlobal.isIOSHighPerformanceModePlus,A(k,"8.0.19"),!T&&(_?A(I,"2.29.1")&&A(k,"8.0.30"):"function"==typeof wx.createBufferURL)),q=!L||A(k,"8.0.23"),N=!D||A(k,"8.0.31");A(k,"8.0.38"),T&&A(I,"2.29.2"),F&&A(I,"2.21.1");GameGlobal.canUseH5Renderer=_&&j,GameGlobal.canUseiOSAutoGC=_&&A(I,"2.32.1");D&&A(I,"3.1.1")||L&&A(I,"3.0.0")||(T||G)&&A(I,"3.2.1");const K=A(I,"2.25.3")&&_;if(B&&D&&j&&z&&!_&&console.error("此AppID未开通高性能模式\n请前往mp后台-能力地图-开发提效包-高性能模式开通\n可大幅提升游戏运行性能"),D)window.devicePixelRatio=1;else if(T)try{window.devicePixelRatio<2&&(window.devicePixelRatio=2)}catch(e){console.warn(e)}const V={audioInstanceIdCounter:0,audioInstances:{},audioContext:null,audioWebEnabled:0,audioCache:[],lOrientation:{x:0,y:0,z:0,xUp:0,yUp:0,zUp:0},lPosition:{x:0,y:0,z:0},audio3DSupport:0,audioWebSupport:0,bufferSourceNodeLength:0,audioBufferLength:0,isMute:!1,FAKEMOD_SAMPLERATE:44100},H={},X={},J={},Y=new WeakMap,Z=new WeakMap,Q=`${wx.env.USER_DATA_PATH}/__GAME_FILE_CACHE/audios`,ee=()=>{V.audioContext?.resume()},te=()=>{const e=M(),t=N&&V.audioCache.length?V.audioCache.shift():wx.createInnerAudioContext();return t&&(H[e]=t),{id:e,audio:t}},re=(e,t)=>{if(e){if(!t||!N||V.audioCache.length>32)H[e].destroy();else{["Play","Pause","Stop","Canplay","Error","Ended","Waiting","Seeking","Seeked","TimeUpdate"].forEach((t=>{H[e][`off${t}`]()}));const t={startTime:0,obeyMuteSwitch:!0,volume:1,autoplay:!1,loop:!1,referrerPolicy:""};Object.keys(t).forEach((r=>{try{H[e][r]=t[r]}catch(e){}})),H[e].stop();const r=H[e];setTimeout((()=>{V.audioCache.push(r)}),1e3)}delete H[e]}},se=e=>{GameGlobal.manager.printErr(e)};const ne={getFullUrl(e){if(!/^https?:\/\//.test(e)&&!/^wxfile:\/\//.test(e)){e=`${GameGlobal.manager.assetPath.replace(/\/$/,"")}/${e.replace(/^\//,"").replace(/^Assets\//,"")}`}return e},downloadAudios(e){const t=e.split(",");return Promise.all(t.map((e=>{const t=ne.getFullUrl(e);return new Promise(((e,r)=>{if(J[t])J[t].push({resolve:e,reject:r});else if(J[t]=[{resolve:e,reject:r}],ne.checkLocalFile(t))ne.handleDownloadEnd(t,!0);else if(GameGlobal.GODOTSDK.isCacheableFile(t)){const e=new GameGlobal.GODOTSDK.XMLHttpRequest;e.open("GET",t,!0),e.responseType="arraybuffer",e.onsave=()=>{X[t]=GameGlobal.manager.getCachePath(t),ne.handleDownloadEnd(t,!0)},e.onsavefail=()=>{ne.handleDownloadEnd(t,!1)},e.onerror=()=>{ne.handleDownloadEnd(t,!1)},e.send()}else wx.downloadFile({url:t,success(e){200===e.statusCode&&e.tempFilePath?(X[t]=e.tempFilePath,ne.handleDownloadEnd(t,!0)):ne.handleDownloadEnd(t,!1)},fail(e){ne.handleDownloadEnd(t,!1),se(e)}})}))})))},handleDownloadEnd(e,t){if(J[e]){for(;J[e]&&J[e].length>0;){const r=J[e].shift();t?r?.resolve(""):r?.reject()}delete J[e]}},checkLocalFile(e){if(X[e])return!0;const t=GameGlobal.manager.getCachePath(e);return!!t&&(X[e]=t,!0)},setAudioSrc:(e,t)=>new Promise(((r,s)=>{const n=ne.getFullUrl(t);e.isLoading=n,ne.checkLocalFile(n)?(e.src=X[n],delete e.isLoading,ne.handleDownloadEnd(n,!0),r(X[n])):e.needDownload?ne.downloadAudios(n).then((()=>{e?(e.src=X[n],delete e.isLoading,r(X[n])):(console.warn("资源已被删除:",n),s({errCode:-1,errMsg:"资源已被删除"}))})).catch((()=>{console.warn("资源下载失败:",n),e&&(e.src=n,delete e.isLoading),s({errCode:-1,errMsg:"资源下载失败"})})):(e.src=n,delete e.isLoading,r(n))}))};function oe(e){return!!H[e]||(console.error("InnerAudioContext does not exist!",e),!1)}var ie={WXCreateInnerAudioContext(e,t,r,s,n,o,i){const{audio:a,id:u}=te();let c;return a.needDownload=i,e&&ne.setAudioSrc(a,e).catch((e=>{w.send("OnAudioCallback",JSON.stringify({callbackId:u,errMsg:"onError",result:JSON.stringify(e)}))})),t&&(a.loop=!0),s&&(a.autoplay=!0),void 0===r&&(r=0),r>0&&(a.startTime=+r.toFixed(2)),c=void 0===n?1:+n.toFixed(2),Z.set(a,c),V.isMute&&(c=0),1!==c&&(a.volume=c),q||(o=1),void 0!==o&&1!==o&&(a.playbackRate=+o.toFixed(2)),u},WXInnerAudioContextSetBool(e,t,r){oe(e)&&(H[e][t]=Boolean(+r))},WXInnerAudioContextSetString(e,t,r){oe(e)&&("src"===t?ne.setAudioSrc(H[e],r):"needDownload"===t?H[e].needDownload=!!r:H[e][t]=r)},WXInnerAudioContextSetFloat(e,t,r){if(!oe(e))return;let s=+r.toFixed(2);"volume"===t&&(Z.set(H[e],s),V.isMute&&(s=0)),H[e][t]=s},WXInnerAudioContextGetFloat:(e,t)=>oe(e)?H[e][t]:0,WXInnerAudioContextGetBool:(e,t)=>!!oe(e)&&H[e][t],WXInnerAudioContextPlay(e){if(!oe(e))return;const t=H[e].isLoading;t?J[t]?J[t].push({resolve:()=>{void 0!==H[e]&&H[e].play()},reject:()=>{}}):(H[e].src=t,H[e].play()):H[e].play()},WXInnerAudioContextPause(e){oe(e)&&H[e].pause()},WXInnerAudioContextStop(e){oe(e)&&H[e].stop()},WXInnerAudioContextDestroy(e){oe(e)&&re(e,!1)},WXInnerAudioContextSeek(e,t){oe(e)&&H[e].seek(+t.toFixed(3))},WXInnerAudioContextAddListener(e,t){oe(e)&&("onCanplay"===t?H[e][t]((()=>{const{duration:r,buffered:s,referrerPolicy:n,volume:o}=H[e];setTimeout((()=>{w.send("OnAudioCallback",JSON.stringify({callbackId:e,errMsg:t}))}),0)})):"onError"===t?H[e][t]((r=>{"onError"===t&&(console.error(r),r.errMsg&&r.errMsg.indexOf("audio is playing, don't play again")>-1)||w.send("OnAudioCallback",JSON.stringify({callbackId:e,errMsg:t,result:JSON.stringify(r)}))})):H[e][t]((()=>{w.send("OnAudioCallback",JSON.stringify({callbackId:e,errMsg:t}))})))},WXInnerAudioContextRemoveListener(e,t){oe(e)&&H[e][t]()},WXPreDownloadAudios(e,t){ne.downloadAudios(e).then((()=>{w.send("WXPreDownloadAudiosCallback",JSON.stringify({callbackId:t.toString(),errMsg:"0"}))})).catch((()=>{w.send("WXPreDownloadAudiosCallback",JSON.stringify({callbackId:t.toString(),errMsg:"1"}))}))}};const ae=441e3;function ue(e,t,r){return{buffer:e,error:t,release(){this.buffer=null,V.audioBufferLength-=r},getLength(){if(!this.buffer)return 0;const e=44100/this.buffer.sampleRate;return this.buffer.length*e},getData(e,t){if(!this.buffer)return console.log("Trying to get data of sound which is not loaded."),0;const r=Math.floor((t>>2)/this.buffer.numberOfChannels),s=Math.min(this.buffer.length,r);for(let e=0;e<this.buffer.numberOfChannels;e++){const t=this.buffer.getChannelData(e).subarray(0,s);"".set(t,e*s)}return s*this.buffer.numberOfChannels*4},getNumberOfChannels(){return this.buffer?this.buffer.numberOfChannels:(console.log("Trying to get metadata of sound which is not loaded."),0)},getFrequency(){return this.buffer?this.buffer.sampleRate:(console.log("Trying to get metadata of sound which is not loaded."),0)}}}class ce{threeD=!1;source;gain;callback=0;userData=0;loop=!1;loopStart=0;loopEnd=0;deleyTime=0;deleyOffset=0;constructor(e,t){V.audioContext&&(this.gain=V.audioContext.createGain(),this.gain&&this.gain.connect(V.audioContext.destination)),this.callback=e,this.userData=t}release(){this.disconnectSource(),this.gain&&this.gain.disconnect()}setLoop(e){this.loop=e,this.source&&this.source.loop!=e&&(this.source.loop=e)}setLoopPoints(e,t){this.loopStart=e,this.loopEnd=t,this.source&&(this.source.loopStart!==e&&(this.source.loopStart=e),this.source.loopEnd!==t&&(this.source.loopEnd=t))}playUrl(e,t,r,s,n){try{if(this.setup(t),!this.source||!this.source.mediaElement)return;void 0!==s&&(this.source.mediaElement.volume=s),V.isMute&&(this.source.mediaElement.volume=0),this.source.mediaElement.onPlay((()=>{if(void 0!==this.source&&(this.source.isPlaying=!0,!this.source.loop&&this.source.mediaElement)){const{duration:e}=this.source.mediaElement;if(e>0){this.source.stopTicker&&(clearTimeout(this.source.stopTicker),this.source.stopTicker=void 0);const t=Math.floor(1e3*e)+1e3;this.source.stopTicker=setTimeout((()=>{this.source&&this.source.mediaElement&&this.source.mediaElement.stop()}),t)}}})),this.source.mediaElement.onPause((()=>{void 0!==this.source&&(this.source.isPlaying=!1,this.source.stopTicker&&(clearTimeout(this.source.stopTicker),this.source.stopTicker=void 0))})),this.source.mediaElement.onStop((()=>{if(void 0!==this.source){if(this.source.playAfterStop)return this.source._reset(),void(void 0!==this.source.mediaElement&&this.source.mediaElement.play());this.source._reset(),this.disconnectSource()}})),this.source.mediaElement.onEnded((()=>{void 0!==this.source&&(this.source._reset(),this.disconnectSource()),this.callback})),this.source.mediaElement.onError((e=>{se(e);const{errMsg:t}=e;t&&t.indexOf("play audio fail")<0||void 0!==this.source&&this.source.mediaElement&&(this.source._reset(),this.source.mediaElement.stop())}));const o=()=>{if(void 0!==this.source&&this.source.mediaElement){const{duration:e}=this.source.mediaElement;setTimeout((()=>{n&&this.source&&this.source.mediaElement&&(n.length=Math.round(44100*Math.max(this.source.mediaElement.duration,0)))}),0)}};this.source.canPlayFnList||(this.source.canPlayFnList=[]),this.source.canPlayFnList.push(o),this.source.mediaElement.onCanplay(o),this.source.mediaElement.loop=this.loop,this.deleyTime=e,this.deleyOffset=r,this.source.start(e,r),this.source.playbackStartTime=e-r/this.source.playbackRateValue}catch(e){se(`playUrl error. Exception: ${e}`)}}playBuffer(e,t,r,s){try{if(this.setup(),!this.source)return;if(this.source.buffer=t,this.source.onended=()=>{this.disconnectSource(),this.callback},this.gain&&s){let e;V.isMute?(Y.set(s,this.gain.gain.value||1),e=0):e=Y.get(s),this.gain.gain.value!==e&&"number"==typeof e&&(this.gain.gain.value=e)}this.source.loop=this.loop,this.source.loopStart=this.loopStart,this.source.loopEnd=this.loopEnd,this.source.start(e,r),this.source.playbackStartTime=e-r/this.source.playbackRateValue}catch(e){se(`playBuffer error. Exception: ${e}`)}}disconnectSource(){this.source&&(this.source.mediaElement?(re(this.source.instanceId,!1),delete this.source.mediaElement,delete this.source):this.source.isPausedMockNode?this.source.buffer=null:(this.source.onended=null,this.source.disconnect&&this.source.disconnect(),GameGlobal.isIOSHighPerformanceMode&&(this.source.buffer=null),V.bufferSourceNodeLength-=1,delete this.source))}stop(e){if(V.audioContext&&this.source)if(this.source.buffer){try{this.source.stop(V.audioContext.currentTime+e)}catch(e){}0==e&&this.disconnectSource()}else this.source.mediaElement&&this.source.stop(e)}isPaused(){return!this.source||(!!this.source.isPausedMockNode||!!this.source.mediaElement&&((!this.source.isPlaying||this.source.pauseRequested)??!0))}pause(){const{source:e}=this;if(!e)return;if(e.mediaElement)return void e._pauseMediaElement?.();if(e.isPausedMockNode)return;const t={isPausedMockNode:!0,loop:this.loop,loopStart:this.loopStart,loopEnd:this.loopEnd,buffer:e.buffer,playbackRate:e.playbackRateValue,playbackPausedAtPosition:e.estimatePlaybackPosition(),setPitch(e){this.playbackRate=e},_reset(){}};this.stop(0),this.disconnectSource(),this.source=t}resume(){if(!V.audioContext)return;if(!this.source)return;if(this.source.mediaElement)return this.source.start(this.deleyTime,this.deleyOffset),delete this.deleyTime,void delete this.deleyOffset;const e=this.source;if(!e.isPausedMockNode)return;if(delete this.source,!e.buffer)return;this.playBuffer(V.audioContext.currentTime-Math.min(0,e.playbackPausedAtPosition),e.buffer,Math.max(0,e.playbackPausedAtPosition));const t=this.source;t&&(t.loop=e.loop,t.loopStart=e.loopStart,t.loopEnd=e.loopEnd,t.setPitch(e.playbackRate))}setVolume(e,t){V.audioContext&&(V.isMute&&(e=0),t&&1==e||this.source&&(this.source.buffer&&this.gain?this.gain.gain.value=e:this.source.mediaElement&&(this.source.mediaElement.volume=e)))}setup(e){if(V.audioContext){if(this.source&&!this.source.isPausedMockNode&&(this.source.url?void 0===e?(void 0!==this.source&&this.source._reset(),this.disconnectSource()):(this.source._reset(),this.disconnectSource()):void 0!==e&&this.stop(0)),e){const{audio:t,id:r}=te();t.src=e;const s=()=>{this.source&&(this.source.needCanPlay=!0,this.source.fixPlayTicker&&(clearTimeout(this.source.fixPlayTicker),delete this.source.fixPlayTicker),this.source.fixPlayTicker=setTimeout((()=>{this.source&&this.source.mediaElement&&this.source.needCanPlay&&!this.source.isPlaying&&this.source.mediaElement.play()}),100))},n=()=>{if(this.source&&this.source.mediaElement)if($&&this.source.readyToPlay)this.source.stopCache?(this.source.stopCache=!1,this.source.playAfterStop=!0):this.source.isPlaying||(L&&s(),this.source.mediaElement.play());else{const e=()=>{if(this.source){if(this.source.needCanPlay=!1,this.source.readyToPlay=!0,void 0!==this.source.mediaElement){const{duration:e}=this.source.mediaElement;this.source.canPlayFnList.forEach((e=>{this.source?.mediaElement?.offCanplay(e)})),this.source.canPlayFnList=[]}this.source.stopCache?(this.source.stopCache=!1,this.source.playAfterStop=!0):this.source.isPlaying||(L&&s(),void 0!==this.source.mediaElement&&this.source.mediaElement.play())}};this.source.canPlayFnList||(this.source.canPlayFnList=[]),this.source.canPlayFnList.push(e),this.source.mediaElement.onCanplay(e),s()}},o=()=>{this.source&&(this.source.readyToPlay=!1,this.source.isPlaying=!1,this.source.stopCache=!1,this.source.playAfterStop=!1,this.source.needCanPlay=!1,this.source.stopTicker&&(clearTimeout(this.source.stopTicker),this.source.stopTicker=void 0))},i=()=>{void 0!==this.source&&(this.source.playTimeout?this.source.pauseRequested=!0:this.source.isPlaying&&this.source.mediaElement&&this.source.mediaElement.pause())},a=e=>{if(void 0!==this.source&&this.source.mediaElement){if(this.source.playTimeout)return"function"==typeof this.source.mediaElement.seek?this.source.mediaElement.seek(e):this.source.mediaElement.currentTime=e,void(this.source.pauseRequested=!1);n(),"function"==typeof this.source.mediaElement.seek?this.source.mediaElement.seek(e):this.source.mediaElement.currentTime=e}},u=(e,t)=>{if(void 0===this.source)return;if(void 0===e&&void 0===t)return void n();void 0===e&&(e=0),void 0===t&&(t=0);const r=1e3*e;r>4?(this.source.playTimeout&&clearTimeout(this.source.playTimeout),this.source.playTimeout=setTimeout((()=>{void 0!==this.source&&(delete this.source.playTimeout,this.source._startPlayback?.(t||0))}),r)):this.source._startPlayback?.(t)},c=e=>{if(void 0===this.source)return;void 0===e&&(e=0);const t=1e3*e;t>4?setTimeout((()=>{this.source&&this.source.mediaElement&&(this.source.stopCache=!0,this.source.mediaElement.stop())}),t):this.source.mediaElement&&(this.source.stopCache=!0,this.source.mediaElement.stop())};this.source={instanceId:r,mediaElement:t,url:e,playbackStartTime:0,playbackRate:1,pauseRequested:!1,_reset:o,_pauseMediaElement:i,_startPlayback:a,start:u,stop:c};const{buffered:l,referrerPolicy:d,volume:g}=t,{source:h}=this;Object.defineProperty(this.source,"loopStart",{get:()=>0,set(e){}}),Object.defineProperty(h,"loopEnd",{get:()=>0,set(e){}}),Object.defineProperty(h,"loop",{get:()=>h?.mediaElement?.loop??!1,set(e){h&&h.mediaElement&&(h.mediaElement.loop=e)}}),Object.defineProperty(h,"playbackRateValue",{get:()=>h?.playbackRate??1,set(e){h&&h.mediaElement&&(q?(h.playbackRate=e,h.mediaElement.playbackRate=e):h.mediaElement.playbackRate=1)}}),Object.defineProperty(h,"currentTime",{get:()=>h?.mediaElement?.currentTime??0,set(e){h&&h.mediaElement&&("function"==typeof h.mediaElement.seek?h.mediaElement.seek(e):h.mediaElement.currentTime=e)}})}else{this.source=V.audioContext.createBufferSource(),V.bufferSourceNodeLength+=1;const{source:e}=this;Object.defineProperty(this.source,"playbackRateValue",{get:()=>e?.playbackRate?.value??0,set(t){e&&void 0!==e.playbackRate&&(e.playbackRate.value=t)}})}this.source&&(this.source.estimatePlaybackPosition=()=>{if(!this.source)return 0;let e;return e=V.audioContext?(V.audioContext.currentTime-this.source.playbackStartTime)*this.source.playbackRateValue:-this.source.playbackStartTime*this.source.playbackRateValue,void 0!==this.source.loopStart&&void 0!==this.source.loopEnd&&this.source.loop&&e>=this.source.loopStart&&(e=(e-this.source.loopStart)%(this.source.loopEnd-this.source.loopStart)+this.source.loopStart),e},this.source.setPitch=e=>{if(!this.source)return 0;const t=this.source.estimatePlaybackPosition();t>=0&&V.audioContext&&(this.source.playbackStartTime=V.audioContext.currentTime-t/e),this.source.playbackRateValue=e},this.setupPanning())}}setupPanning(){void 0!==this.source&&(this.source.isPausedMockNode||this.source.disconnect&&this.source.connect&&(this.source.disconnect(),this.gain&&this.source.connect(this.gain)))}isStopped(){return!this.source}}var le={WEBAudio:V,create_channel(e,t){if(!V.audioContext||0===V.audioWebEnabled)return 0;const r=new ce(e,t);return V.audioInstances[++V.audioInstanceIdCounter]=r,V.audioInstanceIdCounter},get_length(e){if(0===V.audioWebEnabled)return ae;const t=V.audioInstances[e];if(!t)return ae;return t.getLength()||ae},get_load_state(e){if(0===V.audioWebEnabled)return 2;const t=V.audioInstances[e];return!t||t.error?2:t.buffer||t.url&&t.length?0:1},init(){try{if(wx&&wx.createWebAudioContext&&(V.audioContext=wx.createWebAudioContext()),!V.audioContext)return void se("Minigame Web Audio API not suppoted");V.audioWebSupport=1,V.audioWebEnabled=1;let e=null;wx.onHide((()=>{e&&(clearTimeout(e),e=null),GameGlobal.isIOSHighPerformanceMode||V.audioContext?.suspend()})),wx.onShow((()=>{V.audioContext?.resume()})),K&&(e=setTimeout((()=>{ee()}),2e3))}catch(e){se("Web Audio API is not supported in this browser")}},is_stopped(e){if(0==V.audioWebEnabled)return!0;const t=V.audioInstances[e];return!t||t.isStopped()},load_buffer(e){let t=e.length;const r=ue(null,!1,t);return V.audioContext?.decodeAudioData(e,(e=>{r.buffer=e,V.audioBufferLength+=t}),(e=>{r.error=!0,console.log(`Decode error: ${e}`)})),V.audioInstances[++V.audioInstanceIdCounter]=r,V.audioInstanceIdCounter},load_PCM(e,t,r,s){if(!V.audioContext||0===V.audioWebSupport||0===V.audioWebEnabled)return 0;const n=function(e,t,r){if(V.audioContext){const s=V.audioContext.createBuffer(e,t,r);for(let t=0;t<e;t++)s.copyToChannel;return ue(s,!1,t)}return ue(null,!1,t)}(e,t,r);return V.audioInstances[++V.audioInstanceIdCounter]=n,V.audioInstanceIdCounter},play(e,t,r,s){if(!V.audioContext||0===V.audioWebEnabled)return;GODOTSDK.audio.stop(t,0);const n=V.audioInstances[e],o=V.audioInstances[t];if(n&&n.url)try{o.playUrl(s,n.url,r,Y.get(o),n)}catch(e){se(`playUrl error. Exception: ${e}`)}else if(n&&n.buffer)try{o.playBuffer(V.audioContext.currentTime+s,n.buffer,r,o)}catch(e){se(`playBuffer error. Exception: ${e}`)}else console.log("Trying to play sound which is not loaded.")},release_instance(e){if(0===V.audioWebEnabled)return;const t=V.audioInstances[e];t&&t.release(),delete V.audioInstances[e]},resume_if_needed(){0!==V.audioWebSupport&&0!==V.audioWebEnabled&&ee()},set_3d(e,t){if(0===V.audio3DSupport||0===V.audioWebEnabled)return;const r=V.audioInstances[e];r.threeD!=t&&(r.threeD=t,r.source||r.setup(),r.setupPanning())},set_listener_orientation(e,t,r,s,n,o){V.audioContext&&0!==V.audio3DSupport&&0!==V.audioWebSupport&&0!==V.audioWebEnabled&&(t=t>0?0:t,r=r>0?0:r,s=s<0?0:s,n=n<0?0:n,o=o<0?0:o,(e=e>0?0:e)==V.lOrientation.x&&t==V.lOrientation.y&&r==V.lOrientation.z&&s==V.lOrientation.xUp&&n==V.lOrientation.yUp&&o==V.lOrientation.zUp||(V.lOrientation.x=e,V.lOrientation.y=t,V.lOrientation.z=r,V.lOrientation.xUp=s,V.lOrientation.yUp=n,V.lOrientation.zUp=o,V.audioContext.listener.forwardX?(V.audioContext.listener.forwardX.setValueAtTime(-e,V.audioContext.currentTime),V.audioContext.listener.forwardY.setValueAtTime(-t,V.audioContext.currentTime),V.audioContext.listener.forwardZ.setValueAtTime(-r,V.audioContext.currentTime),V.audioContext.listener.upX.setValueAtTime(s,V.audioContext.currentTime),V.audioContext.listener.upY.setValueAtTime(n,V.audioContext.currentTime),V.audioContext.listener.upZ.setValueAtTime(o,V.audioContext.currentTime)):V.audioContext.listener.setOrientation(-e,-t,-r,s,n,o)))},set_listener_position(e,t,r){V.audioContext&&0!==V.audio3DSupport&&0!==V.audioWebSupport&&0!==V.audioWebEnabled&&(t=t<0?0:t,r=r<0?0:r,(e=e<0?0:e)==V.lPosition.x&&t==V.lPosition.y&&r==V.lPosition.z||(V.lPosition.x=e,V.lPosition.y=t,V.lPosition.z=r,V.audioContext.listener.positionX?(V.audioContext.listener.positionX.setValueAtTime(e,V.audioContext.currentTime),V.audioContext.listener.positionY.setValueAtTime(t,V.audioContext.currentTime),V.audioContext.listener.positionZ.setValueAtTime(r,V.audioContext.currentTime)):V.audioContext.listener.setPosition(e,t,r)))},set_loop(e,t){if(0===V.audioWebEnabled)return;const r=V.audioInstances[e];r.source||r.setup(),r.source&&r.setLoop(t>0)},set_loop_points(e,t,r){if(0===V.audioWebEnabled)return;const s=V.audioInstances[e];s.source||s.setup(),s.source&&s.setLoopPoints(t,r)},set_paused(e,t){if(0===V.audioWebEnabled)return;const r=V.audioInstances[e];!!t!==r.isPaused()&&(t?r.pause():r.resume())},set_pitch(e,t){if(0!==V.audioWebSupport&&0!==V.audioWebEnabled)try{V.audioInstances[e].source?.setPitch(t)}catch(e){se(`Invalid audio pitch ${t} specified to WebAudio backend!`)}},set_position(e,t,r,s){0!==V.audio3DSupport&&0!==V.audioWebSupport&&0!==V.audioWebEnabled&&console.error("不支持3d音效")},set_volume(e,t){if(0!==V.audioWebEnabled)try{const r=Number(t.toFixed(2)),s=V.audioInstances[e],n=Y.get(s);if(n===r)return;Y.set(s,r),s.setVolume(r,null==n)}catch(e){se(`Invalid audio volume ${t} specified to WebAudio backend!`)}},stop(e,t){if(0===V.audioWebEnabled)return;V.audioInstances[e].stop(t)},get_data(e,t,r){if(0===V.audioWebEnabled)return 0;const s=V.audioInstances[e];return s?s.getData(t,r)??0:0},get_metadata(e,t,r){if(0===V.audioWebEnabled)return e[r>>2]=0,e[1+(r>>2)]=0,!1;const s=V.audioInstances[t];return s?(e[r>>2]=s.getNumberOfChannels()??0,e[1+(r>>2)]=s.getFrequency()??0,!0):(e[r>>2]=0,e[1+(r>>2)]=0,!1)},get_audio_buffer_sample_rate(e){if(0===V.audioWebEnabled)return V.FAKEMOD_SAMPLERATE;const t=V.audioInstances[e];if(!t)return V.FAKEMOD_SAMPLERATE;const r=t.buffer?t.buffer:t.source?t.source?.buffer:null;return r?r.sampleRate:V.FAKEMOD_SAMPLERATE},get_audio_context_sample_rate:()=>0!==V.audioWebEnabled&&V.audioContext?V.audioContext.sampleRate:V.FAKEMOD_SAMPLERATE};!function(){const e=wx.getFileSystemManager();e.rmdir({dirPath:Q,recursive:!0,complete:()=>{e.mkdir({dirPath:Q})}})}();var de={audioStore:()=>V,WXGetAudioCount:()=>({innerAudio:Object.keys(H).length,webAudio:V.bufferSourceNodeLength,buffer:V.audioBufferLength}),WXSetAudioMute(e){if("boolean"==typeof e&&V.isMute!==e){V.isMute=e;for(const t of Object.keys(V.audioInstances)){const r=V.audioInstances[+t];r.source&&r.setVolume?.(e?0:Y.get(r)??1)}for(const t of Object.values(H))t.volume=e?0:Z.get(t)??1}}};({init(){let e={};wx.onHide((()=>{Object.keys(H).forEach((t=>{!1!=!H[t].paused&&(e[t]=!0)}))})),wx.onShow((()=>{Object.keys(H).forEach((t=>{!1!==H[t].paused&&e[t]&&H[t].play()})),e={}})),wx.onAudioInterruptionBegin((()=>{Object.keys(H).forEach((t=>{!1!=!H[t].paused&&(e[t]=!0)}))})),wx.onAudioInterruptionEnd((()=>{Object.keys(H).forEach((t=>{!1!==H[t].paused&&e[t]&&H[t].play()})),e={},ee()}))}}).init();var ge={...ie,...le,...de};function he(e,t){let r=GameGlobal.godotLoader;if(!Engine.isWebGLAvailable())return r.currentText="WebGL not available!",console.log("WebGL not available!");r.currentText=r.config.textConfig.compilingText;const s=new Engine({canvas:canvas});return GODOTSDK.engine=s,Promise.all([s.init(e),s.preloadFile(t)]).then((()=>(r.currentText=r.config.textConfig.initText,console.log("engine init"),r.cleanup(),s.start({args:["--main-pack",t],onProgress:function(e,t){console.log("Loaded "+e+" of "+t+" bytes")}})))).then((()=>{console.log("Engine has started!"),r.currentText=r.config.textConfig.completeText}))}GameGlobal.__logo__=e=>{1},ge.init(),GameGlobal.GODOTSDK={audio:ge,startGame:he},GODOTSDK.copy_to_fs=function(e,t){GODOTSDK.engine.rtenv.copyToFS(e,t)},GODOTSDK.load_pack=function(e,t,r,s){fsUtils.loadSubpackage(e,r,(()=>{let e=GODOTSDK.engine;e.preloadFile(t).then((()=>{e.preloader.preloadedFiles.forEach((function(t){e.rtenv.copyToFS(t.path,t.buffer)})),e.preloader.preloadedFiles.length=0,r&&r(100),s&&s()}))}))},GameGlobal.CCWebAssembly=GameGlobal.WebAssembly=GameGlobal.WXWebAssembly; |