| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- System.register("chunks:///_virtual/AndroidMgr.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(e){var r,o,n,i;return{setters:[function(e){r=e.inheritsLoose},function(e){o=e.cclegacy,n=e._decorator,i=e.Component}],execute:function(){var t,d;o._RF.push({},"f06a2ngQfROjYOEpzV58qip","AndroidMgr",void 0);var c=n.ccclass;n.property,e("AndroidMgr",c("AndroidMgr")(((d=function(e){function o(){return e.apply(this,arguments)||this}r(o,e);var n=o.prototype;return n.sendAndroid=function(e){if(!o.isDev){var r=window;void 0!==r.AndroidInterface?r.AndroidInterface.performAndroidMethod(e):console.log("安卓方法未定义")}},n.saveDataToAndroid=function(e,r){if(!o.isDev){var n={curLevel:e.stageLevel,curLevelScore:e.score,curLevelTime:e.curLevelTime,isPass:r},i=JSON.stringify(n),t=window;void 0!==t.AndroidInterface?t.AndroidInterface.performAndroidMethod("saveData:"+i):console.log("安卓方法未定义")}},o}(i)).isDev=!1,t=d))||t);o._RF.pop()}}}));
- System.register("chunks:///_virtual/ArrUtils.ts",["cc"],(function(r){var n,t,e;return{setters:[function(r){n=r.cclegacy,t=r._decorator,e=r.math}],execute:function(){var u;n._RF.push({},"74933iM/7NJ/rs+RegM2kLI","ArrUtils",void 0);var o=t.ccclass;t.property,r("ArrUtils",o("ArrUtils")(u=function(){function r(){}return r.shuffleArray=function(r){var n=[].concat(r);return n.sort((function(){return Math.random()-.5})),n},r.upOrder=function(r){r.sort((function(r,n){return r-n}))},r.downOrder=function(r){r.sort((function(r,n){return n-r}))},r.getRandomUniqueIndex=function(r,n){if(n.size>0){var t=new Array;r.forEach((function(r,e){n.has(e)||t.push(e)}));var u=e.randomRangeInt(0,t.length-1);return n.add(t[u]),t[u]}var o=e.randomRangeInt(0,r.length-1);return n.add(o),o},r.removeLastSet=function(r){var n=Array.from(r);if(0===n.length)return!1;var t=n[n.length-1];return r.delete(t),!0},r}())||u);n._RF.pop()}}}));
- System.register("chunks:///_virtual/AudioManage.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(o){var n,i,e,u,t,a,c,r;return{setters:[function(o){n=o.inheritsLoose,i=o.createClass},function(o){e=o.cclegacy,u=o._decorator,t=o.AudioSource,a=o.resources,c=o.AudioClip,r=o.Component}],execute:function(){var l,s;e._RF.push({},"ddb2bQZ+Y1HFKtzdgtAjjWR","AudioManage",void 0);var d=u.ccclass;u.property,o("AudioManage",d("AudioManage")(((s=function(o){function e(){return o.apply(this,arguments)||this}n(e,o);var u=e.prototype;return u.onLoad=function(){this.init()},u.init=function(){e._audioSource=this.node.getComponent(t)},u.playMusic=function(o){void 0===o&&(o=!0);var n=e._audioSource;n.loop=o,n.playing||n.play()},u.pauseMusic=function(){var o=e._audioSource;o.playing&&o.stop()},u.playSound=function(o,n){void 0===n&&(n=1);var i=e._audioSource;a.load(o,c,(function(o,e){i.playOneShot(e,n)}))},u.setBgVolume=function(o){e._audioSource.volume=o},u.playSoundCallback=function(o,n,i,u,r){void 0===i&&(i=!1);var l=e._audioSource;l.node.off(t.EventType.ENDED),l.node.on(t.EventType.ENDED,u,r),l.loop=i,a.load(o,c,(function(o,n){o?console.log(o):(l.clip=n,l.play())}))},u.playSoundCallback2=function(o,n,i,u,t){var a=e._audioSource;a.clip=o,a.play()},i(e,null,[{key:"instance",get:function(){return this._instance||(this._instance=new e),this._instance}}]),e}(r))._instance=void 0,s._audioSource=void 0,l=s))||l);e._RF.pop()}}}));
- System.register("chunks:///_virtual/AudioRecorder.ts",["./rollupPluginModLoBabelHelpers.js","cc","./AudioManage.ts"],(function(e){var o,r,n,t,a,i,c,s;return{setters:[function(e){o=e.inheritsLoose,r=e.asyncToGenerator,n=e.regeneratorRuntime},function(e){t=e.cclegacy,a=e._decorator,i=e.assetManager,c=e.Component},function(e){s=e.AudioManage}],execute:function(){var u;t._RF.push({},"31ca8q4AN9KGZ4Ybwb5RapB","AudioRecorder",void 0);var d=a.ccclass;a.property,e("AudioRecorder",d("AudioRecorder")(u=function(e){function t(){for(var o,r=arguments.length,n=new Array(r),t=0;t<r;t++)n[t]=arguments[t];return(o=e.call.apply(e,[this].concat(n))||this).mediaRecorder=null,o.audioChunks=[],o}o(t,e);var a=t.prototype;return a.startRecording=function(){var e=r(n().mark((function e(){var o,r=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices&&window.MediaRecorder){e.next=3;break}return console.error("浏览器不支持录音功能"),e.abrupt("return");case 3:return e.prev=3,e.next=6,navigator.mediaDevices.getUserMedia({audio:!0});case 6:o=e.sent,this.mediaRecorder=new MediaRecorder(o),this.audioChunks=[],this.mediaRecorder.ondataavailable=function(e){r.audioChunks.push(e.data)},this.mediaRecorder.onstop=function(){var e=new Blob(r.audioChunks,{type:"audio/wav"});r.onRecordingComplete(e),o.getTracks().forEach((function(e){return e.stop()}))},this.mediaRecorder.start(),console.log("录音开始..."),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(3),console.error("获取麦克风权限失败:",e.t0);case 18:case"end":return e.stop()}}),e,this,[[3,15]])})));return function(){return e.apply(this,arguments)}}(),a.stopRecording=function(){this.mediaRecorder&&"recording"===this.mediaRecorder.state&&(this.mediaRecorder.stop(),console.log("录音结束,正在处理..."))},a.onRecordingComplete=function(e){var o=URL.createObjectURL(e);console.log(o),this.loadAudioClipFromUrl(o)},a.loadAudioClipFromUrl=function(e){i.loadRemote(e,(function(e,o){e?console.error("加载录音文件失败",e):(console.log("成功加载成 AudioClip,现在可以播放它了"),s.instance.playSoundCallback2(o))}))},t}(c))||u);t._RF.pop()}}}));
- System.register("chunks:///_virtual/BgMusicMgr.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(o){var n,i,t,u,e,c,r,s;return{setters:[function(o){n=o.inheritsLoose,i=o.createClass},function(o){t=o.cclegacy,u=o._decorator,e=o.AudioSource,c=o.resources,r=o.AudioClip,s=o.Component}],execute:function(){var a,l;t._RF.push({},"0d6f4Jk3ldCU6Q4/V/4wusS","BgMusicMgr",void 0);var p=u.ccclass;u.property,o("BgMusicMgr",p("BgMusicMgr")(((l=function(o){function t(){return o.apply(this,arguments)||this}n(t,o);var u=t.prototype;return u.onLoad=function(){this.init()},u.init=function(){t._audioSource=this.node.getComponent(e)},u.playMusic=function(o){void 0===o&&(o=!0);var n=t._audioSource;n.loop=o,n.playing||n.play()},u.pauseMusic=function(){var o=t._audioSource;o.playing&&o.stop()},u.playSound=function(o,n){void 0===n&&(n=1);var i=t._audioSource;c.load(o,r,(function(o,t){i.playOneShot(t,n)}))},u.setBgVolume=function(o){t._audioSource.volume=o},i(t,null,[{key:"instance",get:function(){return this._instance||(this._instance=new t),this._instance}}]),t}(s))._instance=void 0,l._audioSource=void 0,a=l))||a);t._RF.pop()}}}));
- System.register("chunks:///_virtual/debug-view-runtime-control.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,o,i,n,s,l,r,a,g,h,p,c,C,d,m,u,L;return{setters:[function(t){e=t.applyDecoratedDescriptor,o=t.inheritsLoose,i=t.initializerDefineProperty,n=t.assertThisInitialized},function(t){s=t.cclegacy,l=t._decorator,r=t.Node,a=t.Color,g=t.Canvas,h=t.UITransform,p=t.instantiate,c=t.Label,C=t.RichText,d=t.Toggle,m=t.Button,u=t.director,L=t.Component}],execute:function(){var f,M,b,v,T,S,x,E,I;s._RF.push({},"b2bd1+njXxJxaFY3ymm06WU","debug-view-runtime-control",void 0);var A=l.ccclass,y=l.property;t("DebugViewRuntimeControl",(f=A("internal.DebugViewRuntimeControl"),M=y(r),b=y(r),v=y(r),f((x=e((S=function(t){function e(){for(var e,o=arguments.length,s=new Array(o),l=0;l<o;l++)s[l]=arguments[l];return e=t.call.apply(t,[this].concat(s))||this,i(e,"compositeModeToggle",x,n(e)),i(e,"singleModeToggle",E,n(e)),i(e,"EnableAllCompositeModeButton",I,n(e)),e._single=0,e.strSingle=["No Single Debug","Vertex Color","Vertex Normal","Vertex Tangent","World Position","Vertex Mirror","Face Side","UV0","UV1","UV Lightmap","Project Depth","Linear Depth","Fragment Normal","Fragment Tangent","Fragment Binormal","Base Color","Diffuse Color","Specular Color","Transparency","Metallic","Roughness","Specular Intensity","IOR","Direct Diffuse","Direct Specular","Direct All","Env Diffuse","Env Specular","Env All","Emissive","Light Map","Shadow","AO","Fresnel","Direct Transmit Diffuse","Direct Transmit Specular","Env Transmit Diffuse","Env Transmit Specular","Transmit All","Direct Internal Specular","Env Internal Specular","Internal All","Fog"],e.strComposite=["Direct Diffuse","Direct Specular","Env Diffuse","Env Specular","Emissive","Light Map","Shadow","AO","Normal Map","Fog","Tone Mapping","Gamma Correction","Fresnel","Transmit Diffuse","Transmit Specular","Internal Specular","TT"],e.strMisc=["CSM Layer Coloration","Lighting With Albedo"],e.compositeModeToggleList=[],e.singleModeToggleList=[],e.miscModeToggleList=[],e.textComponentList=[],e.labelComponentList=[],e.textContentList=[],e.hideButtonLabel=void 0,e._currentColorIndex=0,e.strColor=["<color=#ffffff>","<color=#000000>","<color=#ff0000>","<color=#00ff00>","<color=#0000ff>"],e.color=[a.WHITE,a.BLACK,a.RED,a.GREEN,a.BLUE],e}o(e,t);var s=e.prototype;return s.start=function(){if(this.node.parent.getComponent(g)){var t=this.node.parent.getComponent(h),e=.5*t.width,o=.5*t.height,i=.1*e-e,n=o-.1*o,s=this.node.getChildByName("MiscMode"),l=p(s);l.parent=this.node,l.name="Buttons";var r=p(s);r.parent=this.node,r.name="Titles";for(var u=0;u<2;u++){var L=p(this.EnableAllCompositeModeButton.getChildByName("Label"));L.setPosition(i+(u>0?450:150),n,0),L.setScale(.75,.75,.75),L.parent=r;var f=L.getComponent(c);f.string=u?"----------Composite Mode----------":"----------Single Mode----------",f.color=a.WHITE,f.overflow=0,this.labelComponentList[this.labelComponentList.length]=f}n-=20;for(var M=0,b=0;b<this.strSingle.length;b++,M++){b===this.strSingle.length>>1&&(i+=200,M=0);var v=b?p(this.singleModeToggle):this.singleModeToggle;v.setPosition(i,n-20*M,0),v.setScale(.5,.5,.5),v.parent=this.singleModeToggle.parent;var T=v.getComponentInChildren(C);T.string=this.strSingle[b],this.textComponentList[this.textComponentList.length]=T,this.textContentList[this.textContentList.length]=T.string,v.on(d.EventType.TOGGLE,this.toggleSingleMode,this),this.singleModeToggleList[b]=v}i+=200,this.EnableAllCompositeModeButton.setPosition(i+15,n,0),this.EnableAllCompositeModeButton.setScale(.5,.5,.5),this.EnableAllCompositeModeButton.on(m.EventType.CLICK,this.enableAllCompositeMode,this),this.EnableAllCompositeModeButton.parent=l;var S=this.EnableAllCompositeModeButton.getComponentInChildren(c);this.labelComponentList[this.labelComponentList.length]=S;var x=p(this.EnableAllCompositeModeButton);x.setPosition(i+90,n,0),x.setScale(.5,.5,.5),x.on(m.EventType.CLICK,this.changeTextColor,this),x.parent=l,(S=x.getComponentInChildren(c)).string="TextColor",this.labelComponentList[this.labelComponentList.length]=S;var E=p(this.EnableAllCompositeModeButton);E.setPosition(i+200,n,0),E.setScale(.5,.5,.5),E.on(m.EventType.CLICK,this.hideUI,this),E.parent=this.node.parent,(S=E.getComponentInChildren(c)).string="Hide UI",this.labelComponentList[this.labelComponentList.length]=S,this.hideButtonLabel=S,n-=40;for(var I=0;I<this.strMisc.length;I++){var A=p(this.compositeModeToggle);A.setPosition(i,n-20*I,0),A.setScale(.5,.5,.5),A.parent=s;var y=A.getComponentInChildren(C);y.string=this.strMisc[I],this.textComponentList[this.textComponentList.length]=y,this.textContentList[this.textContentList.length]=y.string,A.getComponent(d).isChecked=!!I,A.on(d.EventType.TOGGLE,I?this.toggleLightingWithAlbedo:this.toggleCSMColoration,this),this.miscModeToggleList[I]=A}n-=150;for(var D=0;D<this.strComposite.length;D++){var B=D?p(this.compositeModeToggle):this.compositeModeToggle;B.setPosition(i,n-20*D,0),B.setScale(.5,.5,.5),B.parent=this.compositeModeToggle.parent;var w=B.getComponentInChildren(C);w.string=this.strComposite[D],this.textComponentList[this.textComponentList.length]=w,this.textContentList[this.textContentList.length]=w.string,B.on(d.EventType.TOGGLE,this.toggleCompositeMode,this),this.compositeModeToggleList[D]=B}}else console.error("debug-view-runtime-control should be child of Canvas")},s.isTextMatched=function(t,e){var o=new String(t),i=o.search(">");return-1===i?t===e:(o=(o=o.substr(i+1)).substr(0,o.search("<")))===e},s.toggleSingleMode=function(t){for(var e=u.root.debugView,o=t.getComponentInChildren(C),i=0;i<this.strSingle.length;i++)this.isTextMatched(o.string,this.strSingle[i])&&(e.singleMode=i)},s.toggleCompositeMode=function(t){for(var e=u.root.debugView,o=t.getComponentInChildren(C),i=0;i<this.strComposite.length;i++)this.isTextMatched(o.string,this.strComposite[i])&&e.enableCompositeMode(i,t.isChecked)},s.toggleLightingWithAlbedo=function(t){u.root.debugView.lightingWithAlbedo=t.isChecked},s.toggleCSMColoration=function(t){u.root.debugView.csmLayerColoration=t.isChecked},s.enableAllCompositeMode=function(t){var e=u.root.debugView;e.enableAllCompositeMode(!0);for(var o=0;o<this.compositeModeToggleList.length;o++){this.compositeModeToggleList[o].getComponent(d).isChecked=!0}var i=this.miscModeToggleList[0].getComponent(d);i.isChecked=!1,e.csmLayerColoration=!1,(i=this.miscModeToggleList[1].getComponent(d)).isChecked=!0,e.lightingWithAlbedo=!0},s.hideUI=function(t){var e=this.node.getChildByName("Titles"),o=!e.active;this.singleModeToggleList[0].parent.active=o,this.miscModeToggleList[0].parent.active=o,this.compositeModeToggleList[0].parent.active=o,this.EnableAllCompositeModeButton.parent.active=o,e.active=o,this.hideButtonLabel.string=o?"Hide UI":"Show UI"},s.changeTextColor=function(t){this._currentColorIndex++,this._currentColorIndex>=this.strColor.length&&(this._currentColorIndex=0);for(var e=0;e<this.textComponentList.length;e++)this.textComponentList[e].string=this.strColor[this._currentColorIndex]+this.textContentList[e]+"</color>";for(var o=0;o<this.labelComponentList.length;o++)this.labelComponentList[o].color=this.color[this._currentColorIndex]},s.onLoad=function(){},s.update=function(t){},e}(L)).prototype,"compositeModeToggle",[M],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),E=e(S.prototype,"singleModeToggle",[b],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),I=e(S.prototype,"EnableAllCompositeModeButton",[v],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),T=S))||T));s._RF.pop()}}}));
- System.register("chunks:///_virtual/GameMgr.ts",["./rollupPluginModLoBabelHelpers.js","cc","./ArrUtils.ts","./AudioManage.ts","./AndroidMgr.ts","./BgMusicMgr.ts","./VoiceRecord.ts"],(function(t){var e,i,n,s,a,o,l,h,c,r,m,d,g,u,C;return{setters:[function(t){e=t.inheritsLoose},function(t){i=t.cclegacy,n=t._decorator,s=t.find,a=t.v3,o=t.tween,l=t.Button,h=t.Label,c=t.sp,r=t.Component},function(t){m=t.ArrUtils},function(t){d=t.AudioManage},function(t){g=t.AndroidMgr},function(t){u=t.BgMusicMgr},function(t){C=t.VoiceRecord}],execute:function(){var v;i._RF.push({},"b71c67ldRBLULj7xLgC9u2D","GameMgr",void 0);var f=n.ccclass;n.property,t("GameMgr",f("GameMgr")(v=function(t){function i(){for(var e,i=arguments.length,n=new Array(i),s=0;s<i;s++)n[s]=arguments[s];return(e=t.call.apply(t,[this].concat(n))||this).stageLevel=1,e.maxLevel=10,e.turnLevel=0,e.timeLimit=120,e.timeLimitMax=120,e.timeStep=0,e.timeInterval=1,e.labelPos=void 0,e.timeStart=!1,e.score=0,e.scoreMax=50,e.failCnt=0,e.titlePos=void 0,e.optionArr=[[],[{total:3,rightCnt:1,rightArr:[{name:"xiangJiao",title:"香蕉"},{name:"manGuo",title:"芒果"},{name:"yangTao",title:"杨桃"},{name:"boLuo",title:"菠萝"},{name:"liuLian",title:"榴莲"},{name:"redYouZi",title:"柚子"},{name:"xiangGua",title:"香瓜"},{name:"chenZi",title:"橙子"}]}]],e.vr=void 0,e.canClick=!0,e.isGameing=!0,e}e(i,t);var n=i.prototype;return n.onLoad=function(){var t=this,e=window;e.CallRestartGame=function(){t.restartGame()},e.CallNextLevel=function(){t.turnLevel=0,t.timeLimit=t.timeLimitMax,t.score=0,t.setTime(),t.setScore(),t.initGame()},e.CallContinueGame=function(){},e.CallPauseGame=function(){t.PauseGame()},e.CallQuitGame=function(){t.QuitGame()},setTimeout((function(){t.callAndroid("loading:over")}),500),e.CallStartGame=function(){t.initGame()},this.loadGame(),this.chargeUI(),this.node.getChildByName("failTip").active=!1,this.labelPos=this.node.getChildByName("failTip").getPosition(),this.titlePos=this.node.getChildByName("titleBg").getPosition(),this.setTime(),this.node.getChildByName("failTip").getChildByName("Button").on("click",(function(){t.node.getChildByName("failTip").active=!1,t.node.getChildByName("failTip").setPosition(t.labelPos),t.timeLimit=t.timeLimitMax,t.failReset(!1)}),this),this.node.getChildByName("endTip").getChildByName("Button").on("click",(function(){u.instance.playMusic(),t.node.getChildByName("endTip").setPosition(t.labelPos),t.node.getChildByName("titleBg").setPosition(t.titlePos),t.turnLevel=0,t.timeLimit=t.timeLimitMax,t.failCnt=0,t.setTime(),t.initGame()}),this),this.node.getChildByName("Button").on("click",(function(e){var i=t.node.getChildByName("voiceVR").getComponent(C);i.startRecording(),t.scheduleOnce((function(){i.stopRecording()}),3)}),this)},n.aaa=function(){console.log("aaaaaaaa")},n.onTouchStart=function(t){null==this.vr&&(this.vr=this.node.getChildByName("voiceVR").getComponent(C)),this.vr.startRecording()},n.onTouchMove=function(t){},n.onTouchEnd=function(t){this.vr.stopRecording()},n.onTouchCancel=function(t){this.vr.stopRecording()},n.chargeUI=function(){g.isDev||(this.node.getChildByName("scoreBg").active=!1,this.node.getChildByName("alertClock").active=!1)},n.start=function(){g.isDev&&this.initGame()},n.initGame=function(){g.isDev||s("androidMgr").getComponent(g).sendAndroid("setLevel:"+this.stageLevel),this.canClick=!0,this.isGameing=!0,this.node.getChildByName("noclick").active=!0,this.node.getChildByName("Layout").removeAllChildren(),this.scheduleOnce((function(){this.timeStart=!0,this.node.getChildByName("noclick").active=!1}),.5)},n.showTitle=function(){var t=this;0==this.turnLevel?(d.instance.pauseMusic(),this.node.getChildByName("titleBg").scale=a(0,0),this.node.getChildByName("titleBg").active=!0,o(this.node.getChildByName("titleBg")).to(.4,{scale:a(1,1)},{easing:"backOut"}).call((function(){t.node.getChildByName("titleBg").active=!1,t.begin()})).start()):this.begin()},n.cardAnimi=function(t){var e=this.node.getChildByName("Layout");o(e).to(.3,{position:a(e.getPosition().x,-100)}).start()},n.begin=function(){},n.update=function(t){var e=this;this.timeStart&&(this.timeStep+=t,this.timeStep>=this.timeInterval&&(this.timeStep=0,this.timeLimit--,this.setTime(),this.checkEnd(),o(this.node.getChildByName("alertClock")).to(.2,{angle:-10},{easing:"backOut"}).call((function(){o(e.node.getChildByName("alertClock")).to(.2,{angle:0},{easing:"backOut"}).start()})).start()))},n.clicked=function(t,e){this.isGameing&&this.canClick&&(this.canClick=!1,t.target.getComponent(l).interactable=!1,this.scheduleOnce((function(){this.canClick=!0}),.5))},n.succReset=function(){var t=this;this.isGameing=!1,d.instance.playSound("sound/success",1),this.node.getChildByName("noclick").active=!0,this.timeStart=!1,this.score+=this.scoreMax,this.setScore(),this.turnLevel++,this.turnLevel>=this.optionArr[this.stageLevel].length?(this.turnLevel=0,this.stageLevel++,this.stageLevel>=this.optionArr.length||this.stageLevel>this.maxLevel?(g.isDev?(this.stageLevel=1,this.node.getChildByName("endTip").getChildByName("label1").getComponent(h).string="您总共得分"+this.score+"分。恭喜您通关成功!",this.node.getChildByName("endTip").getChildByName("Button").getChildByName("Label").getComponent(h).string="再完一次",o(this.node.getChildByName("endTip")).to(.2,{position:a(this.node.getChildByName("endTip").getPosition().x,0)}).call((function(){t.setTime()})).start()):(u.instance.pauseMusic(),this.saveDate(3)),this.timeLimit=this.timeLimitMax,this.setTime()):g.isDev?(this.timeLimit=this.timeLimitMax,this.showSuccTip()):this.saveDate(0)):(d.instance.playSound("sound/great",1),this.showSuccTip())},n.showSuccTip=function(){this.node.getChildByName("succTip").active=!0,this.node.getChildByName("succTip").getChildByName("zhengque").getComponent(c.Skeleton).setAnimation(0,"animation",!1),this.scheduleOnce((function(){this.node.getChildByName("succTip").active=!1,this.setTime(),this.initGame()}),1)},n.setScore=function(){this.node.getChildByName("scoreBg").getChildByName("Label2").getComponent(h).string=this.score+"",s("androidMgr").getComponent(g).sendAndroid("setScore:"+this.score)},n.failReset=function(t){var e=this;void 0===t&&(t=!0),this.isGameing=!1,this.node.getChildByName("noclick").active=!0,this.timeStart=!1,this.failCnt++,this.failCnt>=3?(this.score=0,this.setScore(),u.instance.pauseMusic(),g.isDev?(this.node.getChildByName("endTip").getChildByName("label1").getComponent(h).string="通关失败了,没关系,再来一次吧!",this.node.getChildByName("endTip").getChildByName("Button").getChildByName("Label").getComponent(h).string="重新开始",o(this.node.getChildByName("endTip")).to(.2,{position:a(this.node.getChildByName("endTip").getPosition().x,0)}).call((function(){e.setTime(),e.saveDate(1)})).start()):this.saveDate(1),this.timeLimit=this.timeLimitMax,this.setTime()):t?d.instance.playSoundCallback("sound/fail",1,!1,(function(){d.instance.playSoundCallback("sound/jiayou",1,!1,(function(){e.initGame()}))})):this.initGame()},n.resetCardOrder=function(){for(var t=m.shuffleArray(this.optionArr[this.stageLevel][this.turnLevel]),e=0;e<this.optionArr[this.stageLevel][this.turnLevel].length;e++)if(this.optionArr[this.stageLevel][this.turnLevel][e].url!=t[e].url)return t;return this.resetCardOrder()},n.setTime=function(){this.node.getChildByName("alertClock").getChildByName("timeLimit").getComponent(h).string=this.timeLimit+"",this.node.getChildByName("scoreBg").getChildByName("Label4").getComponent(h).string=this.failCnt+"/3",this.node.getChildByName("scoreBg").getChildByName("Label5").getComponent(h).string="第"+this.stageLevel+"关 第"+(this.turnLevel+1)+"题",s("androidMgr").getComponent(g).sendAndroid("setTime:"+this.timeLimit)},n.checkEnd=function(){this.timeLimit<=0&&(this.score=0,this.node.getChildByName("noclick").active=!0,this.timeStart=!1,this.isGameing=!1,d.instance.pauseMusic(),g.isDev?(this.node.getChildByName("failTip").getChildByName("failLabel").getComponent(h).string="时间到了哦,请重新挑战。加油!",this.node.getChildByName("failTip").active=!0,o(this.node.getChildByName("failTip")).to(1,{position:a(0,0)},{easing:"backOut"}).start()):this.saveDate(4))},n.noclick=function(){},n.saveDate=function(t){if(g.isDev);else{var e=0;(e=1==t||4==t||2==t?this.stageLevel:this.stageLevel-1)<1&&(e=1),s("androidMgr").getComponent(g).saveDataToAndroid({stageLevel:e,score:this.score,curLevelTime:this.timeLimitMax-this.timeLimit},t)}},n.loadGame=function(){g.isDev||(this.stageLevel=parseInt(this.getParameterByName("startLv"))||1,this.maxLevel=parseInt(this.getParameterByName("maxLv"))||10,this.score=0,this.failCnt=0)},n.getParameterByName=function(t){var e=window.location.href;t=t.replace(/[\[\]]/g,"\\$&");var i=new RegExp("[?&]"+t+"(=([^&#]*)|&|#|$)").exec(e);return i?i[2]?decodeURIComponent(i[2].replace(/\+/g," ")):"":null},n.restartGame=function(){u.instance.playMusic(),this.node.getChildByName("endTip").setPosition(this.labelPos),this.node.getChildByName("titleBg").setPosition(this.titlePos),this.turnLevel=0,this.timeLimit=this.timeLimitMax,this.failCnt=0,this.score=0,this.setTime(),this.setScore(),this.initGame()},n.ContinueGame=function(){this.initGame()},n.PauseGame=function(){},n.QuitGame=function(){this.saveDate(2)},n.callAndroid=function(t){var e=window;void 0!==e.AndroidInterface?e.AndroidInterface.performAndroidMethod(t):console.log("安卓方法未定义")},i}(r))||v);i._RF.pop()}}}));
- System.register("chunks:///_virtual/HttpUtils.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,r,n,s,o,c;return{setters:[function(t){e=t.inheritsLoose,r=t.asyncToGenerator,n=t.regeneratorRuntime},function(t){s=t.cclegacy,o=t._decorator,c=t.Component}],execute:function(){var a,u;s._RF.push({},"9b3a97S76xMoaeOIusfqC7y","HttpUtils",void 0);var i=o.ccclass;o.property,t("HttpUtils",i("HttpUtils")(((u=function(t){function s(){return t.apply(this,arguments)||this}return e(s,t),s.sendHttpReq=function(){var t=r(n().mark((function t(e){var r,s;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch("http://192.168.1.22:8088/test/aaa");case 3:if((r=t.sent).ok){t.next=6;break}return t.abrupt("return");case 6:return t.next=8,r.text();case 8:return s=t.sent,t.abrupt("return",s);case 12:t.prev=12,t.t0=t.catch(0),console.log("失败= "+t.t0);case 15:case"end":return t.stop()}}),t,null,[[0,12]])})));return function(e){return t.apply(this,arguments)}}(),s.sendPost=function(){var t=r(n().mark((function t(e,r){var s;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return console.log("ip= "+this.ip),t.prev=1,t.next=4,fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});case 4:return(s=t.sent).ok||console.log("HTTP error! status: "+s.status),t.next=8,s.json();case 8:return t.abrupt("return",t.sent);case 11:t.prev=11,t.t0=t.catch(1),console.log("POST请求失败:",t.t0);case 14:case"end":return t.stop()}}),t,this,[[1,11]])})));return function(e,r){return t.apply(this,arguments)}}(),s}(c)).ip="http://localhost:8081/voice/voice/vs",a=u))||a);s._RF.pop()}}}));
- System.register("chunks:///_virtual/LoadUtils.ts",["cc"],(function(o){var t,e,c,n,r;return{setters:[function(o){t=o.cclegacy,e=o._decorator,c=o.resources,n=o.SpriteFrame,r=o.Prefab}],execute:function(){var a;t._RF.push({},"7f1edC9EatPCKMB8JtJ9dgl","LoadUtils",void 0);var i=e.ccclass;e.property,o("LoadUtils",i("LoadUtils")(a=function(){function o(){}return o.loadSpriteFrame=function(o,t,e){c.load(o,n,(function(o,e){o?console.log(o):t(e)}))},o.loadPrefab=function(o,t,e){c.load(o,r,(function(o,e){o?console.log(o):t(e)}))},o}())||a);t._RF.pop()}}}));
- System.register("chunks:///_virtual/main",["./debug-view-runtime-control.ts","./AndroidMgr.ts","./AudioManage.ts","./BgMusicMgr.ts","./GameMgr.ts","./MainMgr.ts","./NewComponent.ts","./StayData.ts","./VoiceMgr.ts","./ArrUtils.ts","./AudioRecorder.ts","./HttpUtils.ts","./LoadUtils.ts","./NodeUtils.ts","./NumUtils.ts","./StrUtils.ts","./VoiceRecord.ts","./ttt.ts"],(function(){return{setters:[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],execute:function(){}}}));
- System.register("chunks:///_virtual/MainMgr.ts",["./rollupPluginModLoBabelHelpers.js","cc","./StayData.ts"],(function(e){var t,n,o,a,l,r,i,c,s;return{setters:[function(e){t=e.inheritsLoose},function(e){n=e.cclegacy,o=e._decorator,a=e.find,l=e.director,r=e.tween,i=e.v3,c=e.Component},function(e){s=e.StayData}],execute:function(){var g;n._RF.push({},"6e0720zmtxAyI/+6Ak58Fm0","MainMgr",void 0);var I=o.ccclass;o.property,e("MainMgr",I("MainMgr")(g=function(e){function n(){return e.apply(this,arguments)||this}t(n,e);var o=n.prototype;return o.onLoad=function(){this.node.getChildByName("newGame").on("click",(function(){var e=a("STAY_DATA").getComponent(s);e.stageLevel=1,e.turnLevel=0,e.score=0,e.failCnt=0,l.loadScene("sc01")}),this),this.node.getChildByName("continue").on("click",this.loadGame,this)},o.start=function(){r(this.node.getChildByName("Label")).to(1.5,{position:i(this.node.getChildByName("Label").getPosition().x,100)},{easing:"backInOut"}).start()},o.update=function(e){},o.loadGame=function(){var e=a("STAY_DATA").getComponent(s);null!=localStorage.getItem("YRG_CAISHUIGUO_STAGE")?e.stageLevel=parseInt(localStorage.getItem("YRG_CAISHUIGUO_STAGE")):e.stageLevel=1,null!=localStorage.getItem("YRG_CAISHUIGUO_TURN")?e.turnLevel=parseInt(localStorage.getItem("YRG_CAISHUIGUO_TURN")):e.turnLevel=0,null!=localStorage.getItem("YRG_CAISHUIGUO_SCORE")?e.score=parseInt(localStorage.getItem("YRG_CAISHUIGUO_SCORE")):e.score=0,null!=localStorage.getItem("YRG_CAISHUIGUO_FAILCNT")?e.failCnt=parseInt(localStorage.getItem("YRG_CAISHUIGUO_FAILCNT")):e.failCnt=0,l.loadScene("sc01")},n}(c))||g);n._RF.pop()}}}));
- System.register("chunks:///_virtual/NewComponent.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(n){var t,o,e,r;return{setters:[function(n){t=n.inheritsLoose},function(n){o=n.cclegacy,e=n._decorator,r=n.Component}],execute:function(){var c;o._RF.push({},"61af9T4ndRM4q8zd4og/O3F","NewComponent",void 0);var u=e.ccclass;e.property,n("NewComponent",u("NewComponent")(c=function(n){function o(){return n.apply(this,arguments)||this}t(o,n);var e=o.prototype;return e.start=function(){},e.update=function(n){},o}(r))||c);o._RF.pop()}}}));
- System.register("chunks:///_virtual/NodeUtils.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,o,c,n,a,i;return{setters:[function(t){e=t.inheritsLoose},function(t){o=t.cclegacy,c=t._decorator,n=t.v3,a=t.tween,i=t.Component}],execute:function(){var l;o._RF.push({},"88d03KY+lRMc5uWTbge/SX4","NodeUtils",void 0);var s=c.ccclass;c.property,t("NodeUtils",s("NodeUtils")(l=function(t){function o(){return t.apply(this,arguments)||this}return e(o,t),o.maoPaoShow=function(t,e,o){void 0===e&&(e=null),void 0===o&&(o=.3),t.scale=n(0,0),a(t).to(o,{scale:n(1,1)},{easing:"backOut"}).call((function(){null!=e&&e()})).start()},o.pokeChange=function(t,e,o){void 0===o&&(o=.2),t.getChildByName("back").scale=n(0,1),t.getChildByName("back").active=!0,a(t.getChildByName("font")).to(o,{scale:n(0,1)}).call((function(){t.getChildByName("font").active=!1,a(t.getChildByName("back")).to(o,{scale:n(1,1)}).start()})).start()},o}(i))||l);o._RF.pop()}}}));
- System.register("chunks:///_virtual/NumUtils.ts",["cc"],(function(r){var t;return{setters:[function(r){t=r.cclegacy}],execute:function(){t._RF.push({},"6f243mZTlxFWaKT84nmjOo6","NumUtils",void 0);r("NumUtils",function(){function r(){}return r.prototype.calculateDistance=function(r,t){var n=t.x-r.x,e=t.y-r.y;return Math.sqrt(n*n+e*e)},r.splitNumberIntoRandomParts=function(r,t){if(t<=0||r<=0)throw new Error("Invalid input: parts must be greater than 0 and total must be greater than 0.");if(1===t)return[r];for(var n=r,e=[],a=0;a<t-1;a++){var o=n-(t-a-1),u=Math.floor(Math.random()*o)+1;e.push(u),n-=u}e.push(n);for(var i=e.length-1;i>0;i--){var f=Math.floor(Math.random()*(i+1)),s=[e[f],e[i]];e[i]=s[0],e[f]=s[1]}return e},r.getRandomUniqueNumbers=function(r,t,n){if(t-r+1<n)throw new Error("Range is too small to get the required number of unique numbers.");for(var e=[],a=new Set;e.length<n;){var o=Math.floor(Math.random()*(t-r+1))+r;a.has(o)||(e.push(o),a.add(o))}return e},r.getRandomNumbersInArr=function(r,t){for(var n=[];n.length<t;){var e=Math.floor(Math.random()*(r.length-1-0+1));n.push(r[e])}return n},r.getRandomUniqueExcludeNumbers=function(r,t,n,e){if(t-r+1<n)throw new Error("Range is too small to get the required number of unique numbers.");for(var a=[],o=new Set;a.length<n;){var u=Math.floor(Math.random()*(t-r+1))+r;o.has(u)||-1!=e.indexOf(u)||(a.push(u),o.add(u))}return a},r.getRandomNumbers=function(r,t,n){for(var e=[];e.length<n;){var a=Math.floor(Math.random()*(t-r+1))+r;e.push(a)}return e},r.splitNumberRandomly=function(r,t,n){if(t<=0||r<=0)throw new Error("Invalid input: n and total must be positive.");for(var e=Math.floor(r/t),a=r%t,o=new Array(t).fill(e),u=0;u<a;u++)o[Math.floor(Math.random()*t)]++;for(var i=1;i<t;i++)for(;Math.abs(o[i]-o[i-1])>n;)if(o[i]>o[i-1]+n)if(o[i]--,i>0&&Math.abs(o[i]-o[i-1])<=2)o[i-1]++;else{if(!(i<t-1&&Math.abs(o[i+1]-(o[i]-1))<=2))throw new Error("Unable to adjust numbers to meet the difference constraint.");o[i+1]++}else if(o[i-1]>o[i]+n)if(o[i-1]--,i>0&&Math.abs(o[i-1]-o[i-2])<=2)o[i-2]++;else{if(!(i<t&&Math.abs(o[i]-(o[i-1]-1))<=2))throw new Error("Unable to adjust numbers to meet the difference constraint.");o[i]++}var f=o.reduce((function(r,t){return r+t}),0);if(f!==r){var s=r-f;o[t-1]+=s}return o},r.allEqual=function(r){return r.reduce((function(r,t,n,e){return r&&(0===n||t===e[n-1])}),!0)},r.isNumeric=function(r){return/^-?\d+(\.\d+)?$/.test(r.trim())},r.arraysEqual=function(r,t){if(r.length!==t.length)return!1;for(var n=0;n<r.length;n++)if(r[n]!==t[n])return!1;return!0},r}());t._RF.pop()}}}));
- System.register("chunks:///_virtual/StayData.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var e,o,a,r,n;return{setters:[function(t){e=t.inheritsLoose},function(t){o=t.cclegacy,a=t._decorator,r=t.director,n=t.Component}],execute:function(){var c;o._RF.push({},"9bef08kZ0ZPiamDx0FtItML","StayData",void 0);var i=a.ccclass;a.property,t("StayData",i("StayData")(c=function(t){function o(){for(var e,o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return(e=t.call.apply(t,[this].concat(a))||this).stageLevel=1,e.turnLevel=0,e.score=0,e.failCnt=0,e.timeLimit=120,e}return e(o,t),o.prototype.onLoad=function(){r.addPersistRootNode(this.node)},o}(n))||c);o._RF.pop()}}}));
- System.register("chunks:///_virtual/StrUtils.ts",["cc"],(function(t){var r,e;return{setters:[function(t){r=t.cclegacy,e=t._decorator}],execute:function(){var c;r._RF.push({},"ed868dZi1hDz6Rbar3H6zop","StrUtils",void 0);var i=e.ccclass;e.property,t("StrUtils",i("StrUtils")(c=function(){function t(){}return t.prefixZero=function(t,r){return t.length<r?(t="0"+t,this.prefixZero(t,r)):t},t}())||c);r._RF.pop()}}}));
- System.register("chunks:///_virtual/ttt.ts",["./rollupPluginModLoBabelHelpers.js","cc"],(function(t){var o,e,i,r,u,a,n,c;return{setters:[function(t){o=t.applyDecoratedDescriptor,e=t.inheritsLoose,i=t.initializerDefineProperty,r=t.assertThisInitialized},function(t){u=t.cclegacy,a=t._decorator,n=t.AudioSource,c=t.Component}],execute:function(){var s,l,p,d,h;u._RF.push({},"e78ddu0+k1EG5Vg3LKubHNE","ttt",void 0);var f=a.ccclass,y=a.property;t("ttt",(s=f("ttt"),l=y(n),s((h=o((d=function(t){function o(){for(var o,e=arguments.length,u=new Array(e),a=0;a<e;a++)u[a]=arguments[a];return o=t.call.apply(t,[this].concat(u))||this,i(o,"audioSource",h,r(o)),o}return e(o,t),o.prototype.playRecordedAudio=function(t){this.audioSource||(this.audioSource=this.getComponent(n),this.audioSource||(this.audioSource=this.addComponent(n))),console.log("aaaaaaaa"),this.audioSource.clip=t,this.audioSource.play()},o}(c)).prototype,"audioSource",[l],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),p=d))||p));u._RF.pop()}}}));
- System.register("chunks:///_virtual/VoiceMgr.ts",["./rollupPluginModLoBabelHelpers.js","cc","./AudioManage.ts","./HttpUtils.ts"],(function(e){var t,n,i,o,r,a,c,u,s,d,l,p,g,h;return{setters:[function(e){t=e.applyDecoratedDescriptor,n=e.inheritsLoose,i=e.initializerDefineProperty,o=e.assertThisInitialized,r=e.asyncToGenerator,a=e.regeneratorRuntime},function(e){c=e.cclegacy,u=e._decorator,s=e.SpriteFrame,d=e.Button,l=e.assetManager,p=e.Component},function(e){g=e.AudioManage},function(e){h=e.HttpUtils}],execute:function(){var f,m,v,y,b,R,C;c._RF.push({},"c05425Rb4xFQKob6h/0gvnr","VoiceMgr",void 0);var B=u.ccclass,k=u.property;e("VoiceMgr",(f=B("VoiceMgr"),m=k(s),v=k(s),f((R=t((b=function(e){function t(){for(var t,n=arguments.length,r=new Array(n),a=0;a<n;a++)r[a]=arguments[a];return t=e.call.apply(e,[this].concat(r))||this,i(t,"noRecordingSprite",R,o(t)),i(t,"recordingSprite",C,o(t)),t.isRecording=!1,t.mediaRecorder=null,t.audioChunks=[],t}n(t,e);var c=t.prototype;return c.onLoad=function(){this.node.getChildByName("btnVoice").on("click",this.voiceClicked,this)},c.start=function(){},c.update=function(e){},c.voiceClicked=function(e){this.isRecording?(this.stopRecording(),this.node.getChildByName("btnVoice").getComponent(d).normalSprite=this.noRecordingSprite,this.node.getChildByName("bg").active=!1,this.node.getChildByName("anima").active=!1,this.isRecording=!1):(this.node.getChildByName("btnVoice").getComponent(d).interactable=!1,this.startRecording())},c.noclick=function(){},c.startRecording=function(){var e=this;if(!navigator.mediaDevices)return console.error("浏览器不支持录音"),void(this.node.getChildByName("btnVoice").getComponent(d).interactable=!0);navigator.mediaDevices.getUserMedia({audio:!0}).then((function(t){e.node.getChildByName("btnVoice").getComponent(d).normalSprite=e.recordingSprite,e.node.getChildByName("bg").active=!0,e.node.getChildByName("anima").active=!0,e.isRecording=!0,e.node.getChildByName("btnVoice").getComponent(d).interactable=!0,e.mediaRecorder=new MediaRecorder(t),e.audioChunks=[],e.mediaRecorder.ondataavailable=function(t){e.audioChunks.push(t.data)},e.mediaRecorder.onstop=function(){var n=new Blob(e.audioChunks,{type:"audio/pcm"});e.recognizeSpeech(n,""),t.getTracks().forEach((function(e){return e.stop()}))},e.mediaRecorder.start()})).catch((function(t){console.error("无法获取麦克风权限"),e.node.getChildByName("btnVoice").getComponent(d).interactable=!0}))},c.stopRecording=function(){this.mediaRecorder.stop()},c.playAudioBlob=function(e){var t=URL.createObjectURL(e);l.loadRemote(t,{ext:".wav"},(function(e,n){if(e)return console.error("加载音频失败",e),void URL.revokeObjectURL(t);g.instance.playSoundCallback2(n)}))},c.recognizeSpeech=function(){var e=r(a().mark((function e(t,n){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.prepareForBaidu(t).then((function(e){var t={content:Array.from(e)};console.log("=================="),h.sendPost(h.ip,t).then((function(e){console.log(e)}))}));case 1:case"end":return e.stop()}}),e,this)})));return function(t,n){return e.apply(this,arguments)}}(),c.prepareForBaidu=function(){var e=r(a().mark((function e(t,n){var i,o,r,c,u,s,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===n&&(n=16e3),i=new AudioContext({sampleRate:n}),e.next=4,t.arrayBuffer();case 4:return o=e.sent,e.next=7,i.decodeAudioData(o);case 7:for(r=e.sent,c=r.getChannelData(0),u=new Int16Array(c.length),s=0;s<c.length;s++)d=c[s],u[s]=Math.max(-32768,Math.min(32767,Math.round(32768*d)));return e.abrupt("return",u);case 12:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}(),t}(p)).prototype,"noRecordingSprite",[m],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),C=t(b.prototype,"recordingSprite",[v],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),y=b))||y));c._RF.pop()}}}));
- System.register("chunks:///_virtual/VoiceRecord.ts",["./rollupPluginModLoBabelHelpers.js","cc","./AudioManage.ts"],(function(e){var r,t,n,o,a,c,i,s;return{setters:[function(e){r=e.inheritsLoose,t=e.asyncToGenerator,n=e.regeneratorRuntime},function(e){o=e.cclegacy,a=e._decorator,c=e.assetManager,i=e.Component},function(e){s=e.AudioManage}],execute:function(){var u;o._RF.push({},"84adcX2GKBOzJ/Hg+03egO6","VoiceRecord",void 0);var d=a.ccclass;a.property,e("VoiceRecord",d("VoiceRecord")(u=function(e){function o(){for(var r,t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return(r=e.call.apply(e,[this].concat(n))||this).mediaRecorder=null,r.audioChunks=[],r.originalStream=void 0,r}r(o,e);var a=o.prototype;return a.startRecording=function(){var e=this;navigator.mediaDevices?navigator.mediaDevices.getUserMedia({audio:!0}).then((function(r){e.mediaRecorder=new MediaRecorder(r),e.audioChunks=[],e.mediaRecorder.ondataavailable=function(r){e.audioChunks.push(r.data)},e.mediaRecorder.onstop=function(){var t=new Blob(e.audioChunks,{type:"audio/pcm"});e.playAudioBlob(t),e.recognizeSpeech(t,""),r.getTracks().forEach((function(e){return e.stop()}))},e.mediaRecorder.start()})).catch((function(e){return console.error("无法获取麦克风权限",e)})):console.error("浏览器不支持录音")},a.stopRecording=function(){this.mediaRecorder.stop(),this.originalStream&&this.originalStream.getTracks().forEach((function(e){return e.stop()}))},a.playAudioBlob=function(e){var r=URL.createObjectURL(e);c.loadRemote(r,{ext:".wav"},(function(e,t){if(e)return console.error("加载音频失败",e),void URL.revokeObjectURL(r);s.instance.playSoundCallback2(t)}))},a.testMicrophone=function(){var e=t(n().mark((function e(){var r;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(console.log("开始测试麦克风..."),navigator.mediaDevices&&navigator.mediaDevices.getUserMedia){e.next=4;break}return console.error("错误: navigator.mediaDevices.getUserMedia 不存在。当前页面是 HTTPS 吗?"),e.abrupt("return");case 4:return e.prev=4,console.log("正在请求权限..."),e.next=8,navigator.mediaDevices.getUserMedia({audio:!0});case 8:r=e.sent,console.log("成功!获取到媒体流:",r),r.getTracks().forEach((function(e){return e.stop()})),console.log("已释放麦克风。"),e.next=33;break;case 14:e.prev=14,e.t0=e.catch(4),console.error("请求失败,错误信息如下:"),console.error("错误名称 (name):",e.t0.name),console.error("错误信息 (message):",e.t0.message),e.t1=e.t0.name,e.next="NotAllowedError"===e.t1?22:"NotFoundError"===e.t1?24:"NotReadableError"===e.t1?26:"OverconstrainedError"===e.t1?28:"SecurityError"===e.t1?30:32;break;case 22:return console.error("原因: 用户拒绝授权,或浏览器设置中禁止了麦克风。"),e.abrupt("break",33);case 24:return console.error("原因: 未找到可用的麦克风设备。"),e.abrupt("break",33);case 26:return console.error("原因: 麦克风被其他应用占用,或硬件出现问题。"),e.abrupt("break",33);case 28:return console.error("原因: 约束条件无法满足(但这里没加特殊约束,可能性小)。"),e.abrupt("break",33);case 30:return console.error("原因: 安全问题,大概率是因为页面不是 HTTPS。"),e.abrupt("break",33);case 32:console.error("原因: 未知错误。");case 33:case"end":return e.stop()}}),e,null,[[4,14]])})));return function(){return e.apply(this,arguments)}}(),a.recognizeSpeech=function(){var e=t(n().mark((function e(r,t){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:console.log("0000000000000= "),this.prepareForBaidu(r).then((function(e){console.log(e.toString()),console.log(r.size)}));case 2:case"end":return e.stop()}}),e,this)})));return function(r,t){return e.apply(this,arguments)}}(),a.sendHttp=function(){var e=t(n().mark((function e(r,t){var o,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch(r,{method:"POST",headers:{"Content-Type":"application/json; charset=utf-8",Authorization:"Bearer bce-v3/ALTAK-Igmc9iQIIETCHcRT6DAR0/5e238c4f1df92474f2b122e155e1b71f9dbe36b6","X-Custom-Header":"custom-value"},body:t});case 3:return o=e.sent,e.next=6,o.json();case 6:if(0!==(a=e.sent).err_no){e.next=12;break}return console.log("识别结果:",a.result),e.abrupt("return",a.result[0]);case 12:console.error("识别失败",a);case 13:e.next=18;break;case 15:e.prev=15,e.t0=e.catch(0),console.error("网络错误",e.t0);case 18:case"end":return e.stop()}}),e,null,[[0,15]])})));return function(r,t){return e.apply(this,arguments)}}(),a.blobToBase64=function(e){return new Promise((function(r,t){var n=new FileReader;n.onloadend=function(){var e=n.result.split(",")[1];r(e)},n.onerror=t,n.readAsDataURL(e)}))},a.blobToBytes=function(){var e=t(n().mark((function e(r){var t;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.arrayBuffer();case 2:return t=e.sent,e.abrupt("return",new Uint16Array(t));case 4:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),a.prepareForBaidu=function(){var e=t(n().mark((function e(r,t){var o,a,c,i,s,u,d;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===t&&(t=16e3),o=new AudioContext({sampleRate:t}),e.next=4,r.arrayBuffer();case 4:return a=e.sent,e.next=7,o.decodeAudioData(a);case 7:for(c=e.sent,i=c.getChannelData(0),s=new Int16Array(i.length),u=0;u<i.length;u++)d=i[u],s[u]=Math.max(-32768,Math.min(32767,Math.round(32768*d)));return e.abrupt("return",s);case 12:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),a.getResampledStream=function(){var e=t(n().mark((function e(r){var t,o,a;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r=16e3),e.next=3,navigator.mediaDevices.getUserMedia({audio:!0});case 3:return this.originalStream=e.sent,t=new AudioContext({sampleRate:r}),o=t.createMediaStreamSource(this.originalStream),a=t.createMediaStreamDestination(),o.connect(a),e.abrupt("return",a.stream);case 9:case"end":return e.stop()}}),e,this)})));return function(r){return e.apply(this,arguments)}}(),a.startRecording2=function(){var e=t(n().mark((function e(){var r,t=this;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getResampledStream(16e3);case 3:r=e.sent,this.mediaRecorder=new MediaRecorder(r),this.audioChunks=[],this.mediaRecorder.ondataavailable=function(e){t.audioChunks.push(e.data)},this.mediaRecorder.onstop=function(){var e=new Blob(t.audioChunks,{type:"audio/wav"});t.playAudioBlob(e),t.recognizeSpeech(e,"")},this.mediaRecorder.start(),e.next=14;break;case 11:e.prev=11,e.t0=e.catch(0),console.error("录音启动失败",e.t0);case 14:case"end":return e.stop()}}),e,this,[[0,11]])})));return function(){return e.apply(this,arguments)}}(),o}(i))||u);o._RF.pop()}}}));
- (function(r) {
- r('virtual:///prerequisite-imports/main', 'chunks:///_virtual/main');
- })(function(mid, cid) {
- System.register(mid, [cid], function (_export, _context) {
- return {
- setters: [function(_m) {
- var _exportObj = {};
- for (var _key in _m) {
- if (_key !== "default" && _key !== "__esModule") _exportObj[_key] = _m[_key];
- }
-
- _export(_exportObj);
- }],
- execute: function () { }
- };
- });
- });
|