Commit 8b237107 authored by unknown's avatar unknown

再次修复3

parent 9e514c94
...@@ -260,11 +260,11 @@ export class SchulteCtr extends Component { ...@@ -260,11 +260,11 @@ export class SchulteCtr extends Component {
let sendOutData: GameEndDataItf = { let sendOutData: GameEndDataItf = {
type: "cocos_game", type: "cocos_game",
gameId: this.gameId, gameId: this.gameId,
gameScore: Number((1 / (Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime)).toFixed(4)) * 10000 ? Number((1 / (Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime)).toFixed(4)) * 10000 : 0, gameScore: Number((1 / (Math.ceil((this.gameEndTime - this.beginTime) / 1000) / this.totalTime)).toFixed(4)) * 10000 ? Number((1 / (Math.ceil((this.gameEndTime - this.beginTime) / 1000) / this.totalTime)).toFixed(4)) * 10000 : 0,
gameEvaluation: this.getEvaluation(this.gameEndTime - this.beginTime), gameEvaluation: this.getEvaluation(this.gameEndTime - this.beginTime),
durTime: this.gameEndTime - this.beginTime, durTime: this.gameEndTime - this.beginTime,
totalTime: this.gameEndTime - this.beginTime, totalTime: this.gameEndTime - this.beginTime,
finishRate: Number((Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime).toFixed(4)) ? Number((Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime).toFixed(4)) : 0 finishRate: Number((Math.ceil((this.gameEndTime - this.beginTime) / 1000) / this.totalTime).toFixed(4)) ? Number((Math.ceil((this.gameEndTime - this.beginTime) / 1000) / this.totalTime).toFixed(4)) : 0
} }
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData)); htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */ //************************** */
......
...@@ -50,7 +50,7 @@ System.register("chunks:///_virtual/ClassifyGuideCtr_1.ts",["./_rollupPluginModL ...@@ -50,7 +50,7 @@ System.register("chunks:///_virtual/ClassifyGuideCtr_1.ts",["./_rollupPluginModL
System.register("chunks:///_virtual/ClassifyCtr.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./ViewMgr.ts","./ViewDef.ts","./AudioCtr.ts","./HtmlSendDataMgr.ts","./Utils.ts","./BeginCountdownView.ts","./ScoreFailView.ts","./ScoreSuccView.ts","./ScoreWaitView.ts","./SwitchErrorView.ts","./SwitchOkView.ts","./GameDescView.ts","./ClassifyUtils.ts","./ClassifyItem.ts","./ClassifyGuideCtr.ts"],(function(e){"use strict";var t,i,o,r,n,s,c,a,l,u,h,f,m,g,p,d,S,v,b,w,C,y,T,I,P,V,D,M,L,N,A,_,E;return{setters:[function(e){t=e.applyDecoratedDescriptor,i=e.inheritsLoose,o=e.initializerDefineProperty,r=e.assertThisInitialized,n=e.defineProperty},function(e){s=e.cclegacy,c=e._decorator,a=e.CCInteger,l=e.Label,u=e.Prefab,h=e.Node,f=e.CCFloat,m=e.AudioClip,g=e.instantiate,p=e.director,d=e.find,S=e.Component},function(e){v=e.viewMgr,b=e.VIEW_INDEX},function(e){w=e.VIEW_DEF},function(e){C=e.AudioCtr},function(e){y=e.htmlSendDataMgr},function(e){T=e.Utils},function(e){I=e.BeginCountdownView},function(e){P=e.ScoreFailView},function(e){V=e.ScoreSuccView},function(e){D=e.ScoreWaitView},function(e){M=e.SwitchErrorView},function(e){L=e.SwitchOkView},function(e){N=e.GameDescView},function(e){A=e.ClassifyUtils},function(e){_=e.ClassifyItem},function(e){E=e.ClassifyGuideCtr}],execute:function(){var k,O,z,U,R,G,F,B,x,H,W,j,q,J,K,X,Z,Q,Y,$,ee,te,ie,oe,re,ne,se,ce,ae,le,ue,he,fe,me,ge,pe,de;s._RF.push({},"5453dEdjo5Kgo1hIZdknzq7","ClassifyCtr",void 0);var Se,ve=c.ccclass,be=c.property;!function(e){e[e.RUN=10]="RUN",e[e.PAUSE=20]="PAUSE",e[e.END=30]="END"}(Se||(Se={}));e("ClassifyCtr",(k=ve("ClassifyCtr"),O=be(a),z=be(l),U=be(l),R=be(l),G=be(u),F=be([h]),B=be([h]),x=be(h),H=be({tooltip:"评价分数百分率,从差到好",type:[f]}),W=be(a),j=be(a),q=be(a),J=be(m),K=be(m),X=be(m),Z=be(m),Q=be(m),k((ee=t(($=function(e){function t(){for(var t,i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return t=e.call.apply(e,[this].concat(s))||this,o(r(t),"gameId",ee,r(t)),o(r(t),"timeLab",te,r(t)),o(r(t),"curScoreLab",ie,r(t)),o(r(t),"succScoreLab",oe,r(t)),o(r(t),"itemPre",re,r(t)),o(r(t),"leftPosNodes",ne,r(t)),o(r(t),"rightPosNodes",se,r(t)),o(r(t),"correctPosNode",ce,r(t)),o(r(t),"evaluationPercents",ae,r(t)),o(r(t),"totalTime",le,r(t)),o(r(t),"succScore",ue,r(t)),o(r(t),"oneScore",he,r(t)),o(r(t),"failMus",fe,r(t)),o(r(t),"succMus",me,r(t)),o(r(t),"okMus",ge,r(t)),o(r(t),"errorMus",pe,r(t)),o(r(t),"countdownMus",de,r(t)),n(r(t),"leftItems",[]),n(r(t),"rightItems",[]),n(r(t),"correctItem",null),n(r(t),"isLeftCorrect",!1),n(r(t),"correctType",""),n(r(t),"isClickLocked",!1),n(r(t),"beginTime",0),n(r(t),"gameState",Se.PAUSE),n(r(t),"curScore",0),n(r(t),"bestScore",0),n(r(t),"isPlayCountdownMus",!1),n(r(t),"isShowDescOnce",!1),t}i(t,e);var s=t.prototype;return s.showGameDescView=function(){v.openView(w.GameDescView,(function(e){var t;null===(t=e.getComponent(N))||void 0===t||t.setDesc("如果左边出现与中间一样的图形\n则点击左边箭头\n反之点击右边箭头")}))},s.onCloseGameDescView=function(){this.gameState!=Se.END&&(this.isShowDescOnce||(this.isShowDescOnce=!0,this.beginTime=(new Date).getTime(),this.gameState=Se.RUN))},s.start=function(){var e=this,t=T.getValueFromHref("gameTime");null!==t&&(this.totalTime=Number(t));var i=T.getValueFromHref("oneScore");null!==i&&(this.oneScore=Number(i));var o=T.getValueFromHref("succScore");null!==o&&(this.succScore=Number(o));for(var r=0;r<this.leftPosNodes.length;++r){var n=g(this.itemPre).getComponent(_);n.node.parent=this.leftPosNodes[r],this.leftItems.push(n)}for(var s=0;s<this.rightPosNodes.length;++s){var c=g(this.itemPre).getComponent(_);c.node.parent=this.rightPosNodes[s],this.rightItems.push(c)}var a=g(this.itemPre).getComponent(_);a.node.parent=this.correctPosNode,this.correctItem=a,this.resetGame(),p.on("continue_game",(function(){e.resetGame()})),p.on("finish_game",(function(){v.openView(w.ScoreWaitView,(function(t){var i;null===(i=t.getComponent(D))||void 0===i||i.setScoreAndLevel(e.bestScore,e.getEvaluation(e.bestScore))}))})),p.on("begin_countdown_end",(function(){var t,i;e.isShowDescOnce?(e.beginTime=(new Date).getTime(),e.gameState=Se.RUN):e.showGameDescView(),null===(t=d("Canvas"))||void 0===t||null===(i=t.getComponent(E))||void 0===i||i.init()})),p.on("close_desc_view",this.onCloseGameDescView,this)},s.resetGame=function(){this.isPlayCountdownMus=!1,this.succScoreLab.string="通关≥"+this.succScore+"分",this.curScore=0,this.curScoreLab.string="我的"+this.curScore+"分",this.timeLab.string=A.formatTime(1e3*this.totalTime),this.resetItems(),this.gameState=Se.PAUSE,v.openView(w.BeginCountdownView,(function(e){var t;null===(t=e.getComponent(I))||void 0===t||t.init()}))},s.resetItems=function(){this.isLeftCorrect=Math.random()<.5,this.correctType=A.getRandomOutShape()+"_"+A.getRandomInShapeAndColor()[0]+"_"+A.getRandomInShapeAndColor()[1];var e=this.isLeftCorrect?this.getDiffTypes(this.leftPosNodes.length-1):this.getDiffTypes(this.leftPosNodes.length),t=this.isLeftCorrect?this.getDiffTypes(this.rightPosNodes.length):this.getDiffTypes(this.rightPosNodes.length-1);this.isLeftCorrect&&e.push(this.correctType),!this.isLeftCorrect&&t.push(this.correctType),this.disorderlyArr(e),this.disorderlyArr(t);for(var i=0;i<e.length&&i<this.leftItems.length;++i){var o=e[i].split("_");this.leftItems[i].setTypes(o[0],o[1],o[2])}for(var r=0;r<t.length&&r<this.rightItems.length;++r){var n=t[r].split("_");this.rightItems[r].setTypes(n[0],n[1],n[2])}this.confuse();var s=this.correctType.split("_");this.correctItem.setTypes(s[0],s[1],s[2]);for(var c=0;c<e.length&&c<this.leftItems.length;++c)this.leftItems[c].updateUi();for(var a=0;a<t.length&&a<this.rightItems.length;++a)this.rightItems[a].updateUi();this.correctItem.updateUi()},s.disorderlyArr=function(e){for(var t=0;t<e.length;++t){var i=Math.floor(Math.random()*e.length);if(i!=t){var o=e[t];e[t]=e[i],e[i]=o}}return e},s.getDiffTypes=function(e){for(var t=[],i=0,o=0;i<e&&o<1e3;){o+=1;var r=A.getRandomOutShape()+"_"+A.getRandomInShapeAndColor()[0]+"_"+A.getRandomInShapeAndColor()[1];r!=this.correctType&&-1==t.indexOf(r)&&(t.push(r),i+=1)}return t},s.hideAllItem=function(e){for(var t=0;t<this.leftItems.length;++t)this.leftItems[t].node.active=!e;for(var i=0;i<this.rightItems.length;++i)this.rightItems[i].node.active=!e;this.correctItem.node.active=!e},s.onClickSwitchBtn=function(e,t){var i=this;this.isClickLocked||(this.isClickLocked=!0,this.hideAllItem(!0),t==(this.isLeftCorrect?"left":"right")?(v.openView(w.SwitchOkView,(function(e){var t,o,r,n;null===(t=d("Audio"))||void 0===t||null===(o=t.getComponent(C))||void 0===o||o.playOneShot(i.okMus),null===(r=e.getComponent(L))||void 0===r||r.setEndCb((function(){i.hideAllItem(!1),i.isClickLocked=!1})),null===(n=e.getComponent(L))||void 0===n||n.init()})),this.curScore+=this.oneScore):v.openView(w.SwitchErrorView,(function(e){var t,o,r,n;null===(t=d("Audio"))||void 0===t||null===(o=t.getComponent(C))||void 0===o||o.playOneShot(i.errorMus),null===(r=e.getComponent(M))||void 0===r||r.setEndCb((function(){i.hideAllItem(!1),i.isClickLocked=!1})),null===(n=e.getComponent(M))||void 0===n||n.init()})),this.curScoreLab.string="我的"+this.curScore+"分",this.resetItems())},s.update=function(e){var t=this;if(this.gameState==Se.RUN){var i,o,r=(new Date).getTime();if(!this.isPlayCountdownMus&&1e3*this.totalTime-(r-this.beginTime)<=3e3)this.isPlayCountdownMus=!0,null===(i=d("Audio"))||void 0===i||null===(o=i.getComponent(C))||void 0===o||o.playOneShot(this.countdownMus);if(r-this.beginTime>=1e3*this.totalTime){var n,s,c,a;if(this.curScore>this.bestScore&&(this.bestScore=this.curScore),this.gameState=Se.END,this.timeLab.string=A.formatTime(0),this.curScore>=this.succScore)v.openView(w.ScoreSuccView,(function(e){var i,o;null===(i=e.getComponent(V))||void 0===i||i.setScore(t.curScore),null===(o=e.getComponent(V))||void 0===o||o.setSuccScore(t.succScore)}),b.TOP),null===(n=d("Audio"))||void 0===n||null===(s=n.getComponent(C))||void 0===s||s.playOneShot(this.succMus);else v.openView(w.ScoreFailView,(function(e){var i,o;null===(i=e.getComponent(P))||void 0===i||i.setScore(t.curScore),null===(o=e.getComponent(P))||void 0===o||o.setSuccScore(t.succScore)}),b.TOP),null===(c=d("Audio"))||void 0===c||null===(a=c.getComponent(C))||void 0===a||a.playOneShot(this.failMus);var l={type:"cocos_game",gameId:this.gameId,gameScore:this.curScore,gameEvaluation:this.getEvaluation(this.curScore),durTime:r-this.beginTime,totalTime:r-this.beginTime,finishRate:(this.curScore/this.succScore).toFixed(4)};y.sendDataOut(JSON.stringify(l))}else this.timeLab.string=A.formatTime(1e3*this.totalTime-(r-this.beginTime))}},s.getEvaluation=function(e){for(var t=-1,i=0;i<this.evaluationPercents.length;++i)if(e/this.succScore<this.evaluationPercents[i]){t=i;break}switch(t){case 0:return"C";case 1:return"B";case 2:return"A";default:return"S"}},s.confuse=function(){var e=Math.random(),t=this.isLeftCorrect?this.rightItems:this.leftItems;if(e<.3){for(var i=[],o=0;o<t.length;++o)i.push(t[o].getType());for(var r=0;r<100;){r+=1;var n=A.getRandomInShapeAndColor(),s=this.correctType.split("_"),c=s[0]+"_"+s[1]+"_"+n[1];if(-1==i.indexOf(c)&&c!=this.correctType){t[Math.floor(Math.random()*t.length)].setTypes(s[0],s[1],n[1]);break}}}if((e=Math.random())<.3){for(var a=[],l=0;l<t.length;++l)a.push(t[l].getType());for(var u=10;u<100;){u+=1;var h=A.getRandomOutShape(),f=this.correctType.split("_"),m=h+"_"+f[1]+"_"+f[2];if(-1==a.indexOf(m)&&m!=this.correctType){t[Math.floor(Math.random()*t.length)].setTypes(h,f[1],f[2]);break}}}},s.pauseGame=function(){this.gameState=Se.PAUSE},s.continueGame=function(){this.beginTime=(new Date).getTime(),this.gameState=Se.RUN},s.getLeftIsCorrect=function(){return this.isLeftCorrect},s.getCorrectItem=function(){for(var e=this.isLeftCorrect?this.leftItems:this.rightItems,t=0;t<e.length;++t)if(e[t].getType()==this.correctType)return e[t]},t}(S)).prototype,"gameId",[O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),te=t($.prototype,"timeLab",[z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ie=t($.prototype,"curScoreLab",[U],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oe=t($.prototype,"succScoreLab",[R],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),re=t($.prototype,"itemPre",[G],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ne=t($.prototype,"leftPosNodes",[F],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),se=t($.prototype,"rightPosNodes",[B],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ce=t($.prototype,"correctPosNode",[x],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ae=t($.prototype,"evaluationPercents",[H],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),le=t($.prototype,"totalTime",[W],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),ue=t($.prototype,"succScore",[j],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),he=t($.prototype,"oneScore",[q],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fe=t($.prototype,"failMus",[J],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),me=t($.prototype,"succMus",[K],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ge=t($.prototype,"okMus",[X],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),pe=t($.prototype,"errorMus",[Z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),de=t($.prototype,"countdownMus",[Q],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Y=$))||Y));s._RF.pop()}}})); System.register("chunks:///_virtual/ClassifyCtr.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./ViewMgr.ts","./ViewDef.ts","./AudioCtr.ts","./HtmlSendDataMgr.ts","./Utils.ts","./BeginCountdownView.ts","./ScoreFailView.ts","./ScoreSuccView.ts","./ScoreWaitView.ts","./SwitchErrorView.ts","./SwitchOkView.ts","./GameDescView.ts","./ClassifyUtils.ts","./ClassifyItem.ts","./ClassifyGuideCtr.ts"],(function(e){"use strict";var t,i,o,r,n,s,c,a,l,u,h,f,m,g,p,d,S,v,b,w,C,y,T,I,P,V,D,M,L,N,A,_,E;return{setters:[function(e){t=e.applyDecoratedDescriptor,i=e.inheritsLoose,o=e.initializerDefineProperty,r=e.assertThisInitialized,n=e.defineProperty},function(e){s=e.cclegacy,c=e._decorator,a=e.CCInteger,l=e.Label,u=e.Prefab,h=e.Node,f=e.CCFloat,m=e.AudioClip,g=e.instantiate,p=e.director,d=e.find,S=e.Component},function(e){v=e.viewMgr,b=e.VIEW_INDEX},function(e){w=e.VIEW_DEF},function(e){C=e.AudioCtr},function(e){y=e.htmlSendDataMgr},function(e){T=e.Utils},function(e){I=e.BeginCountdownView},function(e){P=e.ScoreFailView},function(e){V=e.ScoreSuccView},function(e){D=e.ScoreWaitView},function(e){M=e.SwitchErrorView},function(e){L=e.SwitchOkView},function(e){N=e.GameDescView},function(e){A=e.ClassifyUtils},function(e){_=e.ClassifyItem},function(e){E=e.ClassifyGuideCtr}],execute:function(){var k,O,z,U,R,G,F,B,x,H,W,j,q,J,K,X,Z,Q,Y,$,ee,te,ie,oe,re,ne,se,ce,ae,le,ue,he,fe,me,ge,pe,de;s._RF.push({},"5453dEdjo5Kgo1hIZdknzq7","ClassifyCtr",void 0);var Se,ve=c.ccclass,be=c.property;!function(e){e[e.RUN=10]="RUN",e[e.PAUSE=20]="PAUSE",e[e.END=30]="END"}(Se||(Se={}));e("ClassifyCtr",(k=ve("ClassifyCtr"),O=be(a),z=be(l),U=be(l),R=be(l),G=be(u),F=be([h]),B=be([h]),x=be(h),H=be({tooltip:"评价分数百分率,从差到好",type:[f]}),W=be(a),j=be(a),q=be(a),J=be(m),K=be(m),X=be(m),Z=be(m),Q=be(m),k((ee=t(($=function(e){function t(){for(var t,i=arguments.length,s=new Array(i),c=0;c<i;c++)s[c]=arguments[c];return t=e.call.apply(e,[this].concat(s))||this,o(r(t),"gameId",ee,r(t)),o(r(t),"timeLab",te,r(t)),o(r(t),"curScoreLab",ie,r(t)),o(r(t),"succScoreLab",oe,r(t)),o(r(t),"itemPre",re,r(t)),o(r(t),"leftPosNodes",ne,r(t)),o(r(t),"rightPosNodes",se,r(t)),o(r(t),"correctPosNode",ce,r(t)),o(r(t),"evaluationPercents",ae,r(t)),o(r(t),"totalTime",le,r(t)),o(r(t),"succScore",ue,r(t)),o(r(t),"oneScore",he,r(t)),o(r(t),"failMus",fe,r(t)),o(r(t),"succMus",me,r(t)),o(r(t),"okMus",ge,r(t)),o(r(t),"errorMus",pe,r(t)),o(r(t),"countdownMus",de,r(t)),n(r(t),"leftItems",[]),n(r(t),"rightItems",[]),n(r(t),"correctItem",null),n(r(t),"isLeftCorrect",!1),n(r(t),"correctType",""),n(r(t),"isClickLocked",!1),n(r(t),"beginTime",0),n(r(t),"gameState",Se.PAUSE),n(r(t),"curScore",0),n(r(t),"bestScore",0),n(r(t),"isPlayCountdownMus",!1),n(r(t),"isShowDescOnce",!1),t}i(t,e);var s=t.prototype;return s.showGameDescView=function(){v.openView(w.GameDescView,(function(e){var t;null===(t=e.getComponent(N))||void 0===t||t.setDesc("如果左边出现与中间一样的图形\n则点击左边箭头\n反之点击右边箭头")}))},s.onCloseGameDescView=function(){this.gameState!=Se.END&&(this.isShowDescOnce||(this.isShowDescOnce=!0,this.beginTime=(new Date).getTime(),this.gameState=Se.RUN))},s.start=function(){var e=this,t=T.getValueFromHref("gameTime");null!==t&&(this.totalTime=Number(t));var i=T.getValueFromHref("oneScore");null!==i&&(this.oneScore=Number(i));var o=T.getValueFromHref("succScore");null!==o&&(this.succScore=Number(o));for(var r=0;r<this.leftPosNodes.length;++r){var n=g(this.itemPre).getComponent(_);n.node.parent=this.leftPosNodes[r],this.leftItems.push(n)}for(var s=0;s<this.rightPosNodes.length;++s){var c=g(this.itemPre).getComponent(_);c.node.parent=this.rightPosNodes[s],this.rightItems.push(c)}var a=g(this.itemPre).getComponent(_);a.node.parent=this.correctPosNode,this.correctItem=a,this.resetGame(),p.on("continue_game",(function(){e.resetGame()})),p.on("finish_game",(function(){v.openView(w.ScoreWaitView,(function(t){var i;null===(i=t.getComponent(D))||void 0===i||i.setScoreAndLevel(e.bestScore,e.getEvaluation(e.bestScore))}))})),p.on("begin_countdown_end",(function(){var t,i;e.isShowDescOnce?(e.beginTime=(new Date).getTime(),e.gameState=Se.RUN):e.showGameDescView(),null===(t=d("Canvas"))||void 0===t||null===(i=t.getComponent(E))||void 0===i||i.init()})),p.on("close_desc_view",this.onCloseGameDescView,this)},s.resetGame=function(){this.isPlayCountdownMus=!1,this.succScoreLab.string="通关≥"+this.succScore+"分",this.curScore=0,this.curScoreLab.string="我的"+this.curScore+"分",this.timeLab.string=A.formatTime(1e3*this.totalTime),this.resetItems(),this.gameState=Se.PAUSE,v.openView(w.BeginCountdownView,(function(e){var t;null===(t=e.getComponent(I))||void 0===t||t.init()}))},s.resetItems=function(){this.isLeftCorrect=Math.random()<.5,this.correctType=A.getRandomOutShape()+"_"+A.getRandomInShapeAndColor()[0]+"_"+A.getRandomInShapeAndColor()[1];var e=this.isLeftCorrect?this.getDiffTypes(this.leftPosNodes.length-1):this.getDiffTypes(this.leftPosNodes.length),t=this.isLeftCorrect?this.getDiffTypes(this.rightPosNodes.length):this.getDiffTypes(this.rightPosNodes.length-1);this.isLeftCorrect&&e.push(this.correctType),!this.isLeftCorrect&&t.push(this.correctType),this.disorderlyArr(e),this.disorderlyArr(t);for(var i=0;i<e.length&&i<this.leftItems.length;++i){var o=e[i].split("_");this.leftItems[i].setTypes(o[0],o[1],o[2])}for(var r=0;r<t.length&&r<this.rightItems.length;++r){var n=t[r].split("_");this.rightItems[r].setTypes(n[0],n[1],n[2])}this.confuse();var s=this.correctType.split("_");this.correctItem.setTypes(s[0],s[1],s[2]);for(var c=0;c<e.length&&c<this.leftItems.length;++c)this.leftItems[c].updateUi();for(var a=0;a<t.length&&a<this.rightItems.length;++a)this.rightItems[a].updateUi();this.correctItem.updateUi()},s.disorderlyArr=function(e){for(var t=0;t<e.length;++t){var i=Math.floor(Math.random()*e.length);if(i!=t){var o=e[t];e[t]=e[i],e[i]=o}}return e},s.getDiffTypes=function(e){for(var t=[],i=0,o=0;i<e&&o<1e3;){o+=1;var r=A.getRandomOutShape()+"_"+A.getRandomInShapeAndColor()[0]+"_"+A.getRandomInShapeAndColor()[1];r!=this.correctType&&-1==t.indexOf(r)&&(t.push(r),i+=1)}return t},s.hideAllItem=function(e){for(var t=0;t<this.leftItems.length;++t)this.leftItems[t].node.active=!e;for(var i=0;i<this.rightItems.length;++i)this.rightItems[i].node.active=!e;this.correctItem.node.active=!e},s.onClickSwitchBtn=function(e,t){var i=this;this.isClickLocked||(this.isClickLocked=!0,this.hideAllItem(!0),t==(this.isLeftCorrect?"left":"right")?(v.openView(w.SwitchOkView,(function(e){var t,o,r,n;null===(t=d("Audio"))||void 0===t||null===(o=t.getComponent(C))||void 0===o||o.playOneShot(i.okMus),null===(r=e.getComponent(L))||void 0===r||r.setEndCb((function(){i.hideAllItem(!1),i.isClickLocked=!1})),null===(n=e.getComponent(L))||void 0===n||n.init()})),this.curScore+=this.oneScore):v.openView(w.SwitchErrorView,(function(e){var t,o,r,n;null===(t=d("Audio"))||void 0===t||null===(o=t.getComponent(C))||void 0===o||o.playOneShot(i.errorMus),null===(r=e.getComponent(M))||void 0===r||r.setEndCb((function(){i.hideAllItem(!1),i.isClickLocked=!1})),null===(n=e.getComponent(M))||void 0===n||n.init()})),this.curScoreLab.string="我的"+this.curScore+"分",this.resetItems())},s.update=function(e){var t=this;if(this.gameState==Se.RUN){var i,o,r=(new Date).getTime();if(!this.isPlayCountdownMus&&1e3*this.totalTime-(r-this.beginTime)<=3e3)this.isPlayCountdownMus=!0,null===(i=d("Audio"))||void 0===i||null===(o=i.getComponent(C))||void 0===o||o.playOneShot(this.countdownMus);if(r-this.beginTime>=1e3*this.totalTime){var n,s,c,a;if(this.curScore>this.bestScore&&(this.bestScore=this.curScore),this.gameState=Se.END,this.timeLab.string=A.formatTime(0),this.curScore>=this.succScore)v.openView(w.ScoreSuccView,(function(e){var i,o;null===(i=e.getComponent(V))||void 0===i||i.setScore(t.curScore),null===(o=e.getComponent(V))||void 0===o||o.setSuccScore(t.succScore)}),b.TOP),null===(n=d("Audio"))||void 0===n||null===(s=n.getComponent(C))||void 0===s||s.playOneShot(this.succMus);else v.openView(w.ScoreFailView,(function(e){var i,o;null===(i=e.getComponent(P))||void 0===i||i.setScore(t.curScore),null===(o=e.getComponent(P))||void 0===o||o.setSuccScore(t.succScore)}),b.TOP),null===(c=d("Audio"))||void 0===c||null===(a=c.getComponent(C))||void 0===a||a.playOneShot(this.failMus);var l={type:"cocos_game",gameId:this.gameId,gameScore:this.curScore,gameEvaluation:this.getEvaluation(this.curScore),durTime:r-this.beginTime,totalTime:r-this.beginTime,finishRate:(this.curScore/this.succScore).toFixed(4)};y.sendDataOut(JSON.stringify(l))}else this.timeLab.string=A.formatTime(1e3*this.totalTime-(r-this.beginTime))}},s.getEvaluation=function(e){for(var t=-1,i=0;i<this.evaluationPercents.length;++i)if(e/this.succScore<this.evaluationPercents[i]){t=i;break}switch(t){case 0:return"C";case 1:return"B";case 2:return"A";default:return"S"}},s.confuse=function(){var e=Math.random(),t=this.isLeftCorrect?this.rightItems:this.leftItems;if(e<.3){for(var i=[],o=0;o<t.length;++o)i.push(t[o].getType());for(var r=0;r<100;){r+=1;var n=A.getRandomInShapeAndColor(),s=this.correctType.split("_"),c=s[0]+"_"+s[1]+"_"+n[1];if(-1==i.indexOf(c)&&c!=this.correctType){t[Math.floor(Math.random()*t.length)].setTypes(s[0],s[1],n[1]);break}}}if((e=Math.random())<.3){for(var a=[],l=0;l<t.length;++l)a.push(t[l].getType());for(var u=10;u<100;){u+=1;var h=A.getRandomOutShape(),f=this.correctType.split("_"),m=h+"_"+f[1]+"_"+f[2];if(-1==a.indexOf(m)&&m!=this.correctType){t[Math.floor(Math.random()*t.length)].setTypes(h,f[1],f[2]);break}}}},s.pauseGame=function(){this.gameState=Se.PAUSE},s.continueGame=function(){this.beginTime=(new Date).getTime(),this.gameState=Se.RUN},s.getLeftIsCorrect=function(){return this.isLeftCorrect},s.getCorrectItem=function(){for(var e=this.isLeftCorrect?this.leftItems:this.rightItems,t=0;t<e.length;++t)if(e[t].getType()==this.correctType)return e[t]},t}(S)).prototype,"gameId",[O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),te=t($.prototype,"timeLab",[z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ie=t($.prototype,"curScoreLab",[U],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oe=t($.prototype,"succScoreLab",[R],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),re=t($.prototype,"itemPre",[G],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ne=t($.prototype,"leftPosNodes",[F],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),se=t($.prototype,"rightPosNodes",[B],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ce=t($.prototype,"correctPosNode",[x],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ae=t($.prototype,"evaluationPercents",[H],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),le=t($.prototype,"totalTime",[W],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),ue=t($.prototype,"succScore",[j],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),he=t($.prototype,"oneScore",[q],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),fe=t($.prototype,"failMus",[J],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),me=t($.prototype,"succMus",[K],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ge=t($.prototype,"okMus",[X],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),pe=t($.prototype,"errorMus",[Z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),de=t($.prototype,"countdownMus",[Q],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),Y=$))||Y));s._RF.pop()}}}));
System.register("chunks:///_virtual/SchulteCtr.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./ViewMgr.ts","./ViewDef.ts","./AudioCtr.ts","./HtmlSendDataMgr.ts","./Utils.ts","./BeginCountdownView.ts","./TimeWaitView.ts","./SchulteBlockCtr.ts","./SchulteUtils.ts","./TimeSuccView.ts","./TimeFailView.ts","./SchulteGuideCtr.ts"],(function(e){"use strict";var t,i,n,o,l,a,r,s,u,m,c,h,g,d,b,f,T,p,C,v,k,w,y,S,E,M,x,I,P,N,F,V;return{setters:[function(e){t=e.applyDecoratedDescriptor,i=e.inheritsLoose,n=e.initializerDefineProperty,o=e.assertThisInitialized,l=e.defineProperty},function(e){a=e.cclegacy,r=e._decorator,s=e.CCInteger,u=e.Node,m=e.Color,c=e.Label,h=e.Font,g=e.Prefab,d=e.AudioClip,b=e.CCString,f=e.instantiate,T=e.director,p=e.find,C=e.Component},function(e){v=e.viewMgr,k=e.VIEW_INDEX},function(e){w=e.VIEW_DEF},function(e){y=e.AudioCtr},function(e){S=e.htmlSendDataMgr},function(e){E=e.Utils},function(e){M=e.BeginCountdownView},function(e){x=e.TimeWaitView},function(e){I=e.SchulteBlockCtr},function(e){P=e.SchulteUtils},function(e){N=e.TimeSuccView},function(e){F=e.TimeFailView},function(e){V=e.SchulteGuideCtr}],execute:function(){var D,A,L,z,U,_,O,R,B,W,G,H,Z,j,J,X,q,K,Q,Y,$,ee,te,ie,ne,oe,le,ae,re;a._RF.push({},"5b738fxZ8RO0ZcWCDa8jZxp","SchulteCtr",void 0);var se,ue=r.ccclass,me=r.property,ce=r.executeInEditMode;!function(e){e[e.RUN=10]="RUN",e[e.PAUSE=20]="PAUSE",e[e.END=30]="END"}(se||(se={}));e("SchulteCtr",(D=ue("SchulteCtr"),A=me(s),L=me([u]),z=me([m]),U=me(c),_=me(h),O=me(g),R=me(d),B=me(d),W=me(d),G=me(d),H=me({type:[b]}),Z=me({tooltip:"游戏时间限制,单位秒",type:s}),j=me({tooltip:"评价时间数组,从小到大;单位秒",type:[s]}),D(J=ce((q=t((X=function(e){function t(){for(var t,i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return t=e.call.apply(e,[this].concat(a))||this,n(o(t),"gameId",q,o(t)),n(o(t),"blockPosNodes",K,o(t)),n(o(t),"clickColors",Q,o(t)),l(o(t),"blockComs",[]),n(o(t),"timeLab",Y,o(t)),n(o(t),"blockFont",$,o(t)),n(o(t),"blockPre",ee,o(t)),n(o(t),"endMus",te,o(t)),n(o(t),"clickMus",ie,o(t)),n(o(t),"failMus",ne,o(t)),n(o(t),"countdownMus",oe,o(t)),n(o(t),"texts",le,o(t)),l(o(t),"elems",[]),n(o(t),"totalTime",ae,o(t)),n(o(t),"evaluateTime",re,o(t)),l(o(t),"gameState",se.PAUSE),l(o(t),"beginTime",0),l(o(t),"curIdx",-1),l(o(t),"isClickLocked",!1),l(o(t),"bestTime",0),l(o(t),"isPlayCountdownMus",!1),l(o(t),"gameEndTime",0),t}i(t,e);var a=t.prototype;return a.start=function(){var e=this,t=E.getValueFromHref("gameTime");null!==t&&(this.totalTime=t),this.bestTime=this.totalTime;for(var i=0;i<this.blockPosNodes.length;++i){var n=f(this.blockPre).getComponent(I);this.blockComs.push(n),n.node.parent=this.blockPosNodes[i],n.orderIdx=i,n.contLab.string="",this.blockFont?n.contLab.font=this.blockFont:n.contLab.useSystemFont=!0}this.reset(),T.on("click_block",(function(t){if(-1==e.curIdx?0==t.orderIdx:e.elems[e.curIdx+1]==t.text){var i,n;e.curIdx+=1,null===(i=p("Audio"))||void 0===i||null===(n=i.getComponent(y))||void 0===n||n.playOneShot(e.clickMus);var o=Math.floor(Math.random()*e.clickColors.length);t.setBgColor(e.clickColors[o]),t.isClicked=!0,t.playOkAnim()}else t.playForkAnim();if(e.curIdx>=e.elems.length-1){e.gameState=se.END;var l=(new Date).getTime();e.gameEndTime=l,Math.round((l-e.beginTime)/1e3)<e.bestTime&&(e.bestTime=Math.round((l-e.beginTime)/1e3)),v.openView(w.TimeSuccView,(function(t){var i,n,o,l;null==t||null===(i=t.getComponent(N))||void 0===i||i.setTime(1e3*e.bestTime),null==t||null===(n=t.getComponent(N))||void 0===n||n.setLevel(e.getEvaluation(1e3*e.bestTime)),null===(o=p("Audio"))||void 0===o||null===(l=o.getComponent(y))||void 0===l||l.playOneShot(e.endMus)}),k.TOP);var a={type:"cocos_game",gameId:e.gameId,gameScore:1e4*(1/(Math.round((e.gameEndTime-e.beginTime)/1e3)/e.totalTime)).toFixed(4),gameEvaluation:e.getEvaluation(e.gameEndTime-e.beginTime),durTime:e.gameEndTime-e.beginTime,totalTime:e.gameEndTime-e.beginTime,finishRate:1/(Math.round((e.gameEndTime-e.beginTime)/1e3)/e.totalTime).toFixed(4)};S.sendDataOut(JSON.stringify(a))}})),T.on("continue_game",(function(){e.reset()}),this),T.on("finish_game",(function(){v.openView(w.TimeWaitView,(function(t){var i,n;e.gameEndTime,e.beginTime;null===(i=t.getComponent(x))||void 0===i||i.setTime(1e3*e.bestTime),null===(n=t.getComponent(x))||void 0===n||n.setLevel(e.getEvaluation(1e3*e.bestTime))}))}),this),T.on("begin_countdown_end",(function(){var t,i;e.beginTime=(new Date).getTime(),e.gameState=se.RUN,null===(t=p("Canvas"))||void 0===t||null===(i=t.getComponent(V))||void 0===i||i.init()}))},a.reset=function(){this.isPlayCountdownMus=!1,this.isClickLocked=!1,this.timeLab.string=P.formatTime(1e3*this.totalTime),this.gameState=se.PAUSE,v.openView(w.BeginCountdownView,(function(e){var t;null===(t=e.getComponent(M))||void 0===t||t.init()}));var e=[];if(this.blockComs.forEach((function(e){e.text="",e.contLab.string=""})),this.texts.length>0){this.elems=this.texts[Math.floor(Math.random()*this.texts.length)].split(" "),this.blockComs.sort((function(e,t){return e.orderIdx-t.orderIdx}));for(var t=0;t<this.blockComs.length&&t<this.elems.length;++t)this.blockComs[t].contLab.string=this.elems[t],this.blockComs[t].text=this.elems[t]}for(;this.blockComs.length>0;){var i=Math.floor(Math.random()*this.blockComs.length),n=this.blockComs[i];this.blockComs.splice(i,1),e.push(n)}this.blockComs=e;for(var o=0;o<this.blockPosNodes.length&&o<this.blockComs.length;++o)this.blockComs[o].reset(),this.blockComs[o].node.parent=this.blockPosNodes[o],this.blockComs[o].node.setPosition(0,0,0);this.curIdx=-1},a.update=function(e){var t=this;if(this.gameState==se.RUN){var i,n,o=(new Date).getTime();if(!this.isPlayCountdownMus&&1e3*this.totalTime-(o-this.beginTime)<=3e3)this.isPlayCountdownMus=!0,null===(i=p("Audio"))||void 0===i||null===(n=i.getComponent(y))||void 0===n||n.playOneShot(this.countdownMus);if(1e3*this.totalTime-(o-this.beginTime)<=0){this.gameState=se.END,this.gameEndTime=o,v.openView(w.TimeFailView,(function(e){var i,n,o,l,a,r;null==e||null===(i=e.getComponent(F))||void 0===i||i.setTime(1e3*t.bestTime),null==e||null===(n=e.getComponent(F))||void 0===n||n.setLevel(t.getEvaluation(1e3*t.bestTime)),null===(o=p("Audio"))||void 0===o||null===(l=o.getComponent(y))||void 0===l||l.playOneShot(t.endMus),null===(a=p("Audio"))||void 0===a||null===(r=a.getComponent(y))||void 0===r||r.playOneShot(t.failMus)}),k.TOP);var l={type:"cocos_game",gameId:this.gameId,gameScore:1e4*Number((1/(Math.round((this.gameEndTime-this.beginTime)/1e3)/this.totalTime)).toFixed(4))?1e4*Number((1/(Math.round((this.gameEndTime-this.beginTime)/1e3)/this.totalTime)).toFixed(4)):0,gameEvaluation:this.getEvaluation(this.gameEndTime-this.beginTime),durTime:this.gameEndTime-this.beginTime,totalTime:this.gameEndTime-this.beginTime,finishRate:Number((Math.round((this.gameEndTime-this.beginTime)/1e3)/this.totalTime).toFixed(4))?Number((Math.round((this.gameEndTime-this.beginTime)/1e3)/this.totalTime).toFixed(4)):0};S.sendDataOut(JSON.stringify(l))}this.timeLab.string=P.formatTime(1e3*this.totalTime-(o-this.beginTime))}},a.getEvaluation=function(e){for(var t=-1,i=0;i<this.evaluateTime.length;++i)if(e/1e3<this.evaluateTime[i]){t=i;break}switch(t){case 0:return"S";case 1:return"A";case 2:return"B";default:return"C"}},a.pauseGame=function(){this.gameState=se.PAUSE},a.continueGame=function(){this.beginTime=(new Date).getTime(),this.gameState=se.RUN},a.getFirstItem=function(){for(var e=0;e<this.blockComs.length;++e)if(0==this.blockComs[e].orderIdx)return this.blockComs[e]},a.getTwoItem=function(){for(var e=0;e<this.blockComs.length;++e)if(0!=this.blockComs[e].orderIdx&&this.blockComs[e].text==this.elems[1])return this.blockComs[e]},t}(C)).prototype,"gameId",[A],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),K=t(X.prototype,"blockPosNodes",[L],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Q=t(X.prototype,"clickColors",[z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Y=t(X.prototype,"timeLab",[U],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),$=t(X.prototype,"blockFont",[_],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ee=t(X.prototype,"blockPre",[O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),te=t(X.prototype,"endMus",[R],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ie=t(X.prototype,"clickMus",[B],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ne=t(X.prototype,"failMus",[W],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oe=t(X.prototype,"countdownMus",[G],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),le=t(X.prototype,"texts",[H],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ae=t(X.prototype,"totalTime",[Z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),re=t(X.prototype,"evaluateTime",[j],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),J=X))||J)||J));a._RF.pop()}}})); System.register("chunks:///_virtual/SchulteCtr.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./ViewMgr.ts","./ViewDef.ts","./AudioCtr.ts","./HtmlSendDataMgr.ts","./Utils.ts","./BeginCountdownView.ts","./TimeWaitView.ts","./SchulteBlockCtr.ts","./SchulteUtils.ts","./TimeSuccView.ts","./TimeFailView.ts","./SchulteGuideCtr.ts"],(function(e){"use strict";var t,i,n,o,l,a,r,s,u,m,c,h,g,d,b,f,T,p,C,v,k,w,y,S,E,M,x,I,P,N,F,V;return{setters:[function(e){t=e.applyDecoratedDescriptor,i=e.inheritsLoose,n=e.initializerDefineProperty,o=e.assertThisInitialized,l=e.defineProperty},function(e){a=e.cclegacy,r=e._decorator,s=e.CCInteger,u=e.Node,m=e.Color,c=e.Label,h=e.Font,g=e.Prefab,d=e.AudioClip,b=e.CCString,f=e.instantiate,T=e.director,p=e.find,C=e.Component},function(e){v=e.viewMgr,k=e.VIEW_INDEX},function(e){w=e.VIEW_DEF},function(e){y=e.AudioCtr},function(e){S=e.htmlSendDataMgr},function(e){E=e.Utils},function(e){M=e.BeginCountdownView},function(e){x=e.TimeWaitView},function(e){I=e.SchulteBlockCtr},function(e){P=e.SchulteUtils},function(e){N=e.TimeSuccView},function(e){F=e.TimeFailView},function(e){V=e.SchulteGuideCtr}],execute:function(){var D,A,L,z,U,_,O,R,B,W,G,H,Z,j,J,X,q,K,Q,Y,$,ee,te,ie,ne,oe,le,ae,re;a._RF.push({},"5b738fxZ8RO0ZcWCDa8jZxp","SchulteCtr",void 0);var se,ue=r.ccclass,me=r.property,ce=r.executeInEditMode;!function(e){e[e.RUN=10]="RUN",e[e.PAUSE=20]="PAUSE",e[e.END=30]="END"}(se||(se={}));e("SchulteCtr",(D=ue("SchulteCtr"),A=me(s),L=me([u]),z=me([m]),U=me(c),_=me(h),O=me(g),R=me(d),B=me(d),W=me(d),G=me(d),H=me({type:[b]}),Z=me({tooltip:"游戏时间限制,单位秒",type:s}),j=me({tooltip:"评价时间数组,从小到大;单位秒",type:[s]}),D(J=ce((q=t((X=function(e){function t(){for(var t,i=arguments.length,a=new Array(i),r=0;r<i;r++)a[r]=arguments[r];return t=e.call.apply(e,[this].concat(a))||this,n(o(t),"gameId",q,o(t)),n(o(t),"blockPosNodes",K,o(t)),n(o(t),"clickColors",Q,o(t)),l(o(t),"blockComs",[]),n(o(t),"timeLab",Y,o(t)),n(o(t),"blockFont",$,o(t)),n(o(t),"blockPre",ee,o(t)),n(o(t),"endMus",te,o(t)),n(o(t),"clickMus",ie,o(t)),n(o(t),"failMus",ne,o(t)),n(o(t),"countdownMus",oe,o(t)),n(o(t),"texts",le,o(t)),l(o(t),"elems",[]),n(o(t),"totalTime",ae,o(t)),n(o(t),"evaluateTime",re,o(t)),l(o(t),"gameState",se.PAUSE),l(o(t),"beginTime",0),l(o(t),"curIdx",-1),l(o(t),"isClickLocked",!1),l(o(t),"bestTime",0),l(o(t),"isPlayCountdownMus",!1),l(o(t),"gameEndTime",0),t}i(t,e);var a=t.prototype;return a.start=function(){var e=this,t=E.getValueFromHref("gameTime");null!==t&&(this.totalTime=t),this.bestTime=this.totalTime;for(var i=0;i<this.blockPosNodes.length;++i){var n=f(this.blockPre).getComponent(I);this.blockComs.push(n),n.node.parent=this.blockPosNodes[i],n.orderIdx=i,n.contLab.string="",this.blockFont?n.contLab.font=this.blockFont:n.contLab.useSystemFont=!0}this.reset(),T.on("click_block",(function(t){if(-1==e.curIdx?0==t.orderIdx:e.elems[e.curIdx+1]==t.text){var i,n;e.curIdx+=1,null===(i=p("Audio"))||void 0===i||null===(n=i.getComponent(y))||void 0===n||n.playOneShot(e.clickMus);var o=Math.floor(Math.random()*e.clickColors.length);t.setBgColor(e.clickColors[o]),t.isClicked=!0,t.playOkAnim()}else t.playForkAnim();if(e.curIdx>=e.elems.length-1){e.gameState=se.END;var l=(new Date).getTime();e.gameEndTime=l,Math.round((l-e.beginTime)/1e3)<e.bestTime&&(e.bestTime=Math.round((l-e.beginTime)/1e3)),v.openView(w.TimeSuccView,(function(t){var i,n,o,l;null==t||null===(i=t.getComponent(N))||void 0===i||i.setTime(1e3*e.bestTime),null==t||null===(n=t.getComponent(N))||void 0===n||n.setLevel(e.getEvaluation(1e3*e.bestTime)),null===(o=p("Audio"))||void 0===o||null===(l=o.getComponent(y))||void 0===l||l.playOneShot(e.endMus)}),k.TOP);var a={type:"cocos_game",gameId:e.gameId,gameScore:1e4*(1/(Math.round((e.gameEndTime-e.beginTime)/1e3)/e.totalTime)).toFixed(4),gameEvaluation:e.getEvaluation(e.gameEndTime-e.beginTime),durTime:e.gameEndTime-e.beginTime,totalTime:e.gameEndTime-e.beginTime,finishRate:1/(Math.round((e.gameEndTime-e.beginTime)/1e3)/e.totalTime).toFixed(4)};S.sendDataOut(JSON.stringify(a))}})),T.on("continue_game",(function(){e.reset()}),this),T.on("finish_game",(function(){v.openView(w.TimeWaitView,(function(t){var i,n;e.gameEndTime,e.beginTime;null===(i=t.getComponent(x))||void 0===i||i.setTime(1e3*e.bestTime),null===(n=t.getComponent(x))||void 0===n||n.setLevel(e.getEvaluation(1e3*e.bestTime))}))}),this),T.on("begin_countdown_end",(function(){var t,i;e.beginTime=(new Date).getTime(),e.gameState=se.RUN,null===(t=p("Canvas"))||void 0===t||null===(i=t.getComponent(V))||void 0===i||i.init()}))},a.reset=function(){this.isPlayCountdownMus=!1,this.isClickLocked=!1,this.timeLab.string=P.formatTime(1e3*this.totalTime),this.gameState=se.PAUSE,v.openView(w.BeginCountdownView,(function(e){var t;null===(t=e.getComponent(M))||void 0===t||t.init()}));var e=[];if(this.blockComs.forEach((function(e){e.text="",e.contLab.string=""})),this.texts.length>0){this.elems=this.texts[Math.floor(Math.random()*this.texts.length)].split(" "),this.blockComs.sort((function(e,t){return e.orderIdx-t.orderIdx}));for(var t=0;t<this.blockComs.length&&t<this.elems.length;++t)this.blockComs[t].contLab.string=this.elems[t],this.blockComs[t].text=this.elems[t]}for(;this.blockComs.length>0;){var i=Math.floor(Math.random()*this.blockComs.length),n=this.blockComs[i];this.blockComs.splice(i,1),e.push(n)}this.blockComs=e;for(var o=0;o<this.blockPosNodes.length&&o<this.blockComs.length;++o)this.blockComs[o].reset(),this.blockComs[o].node.parent=this.blockPosNodes[o],this.blockComs[o].node.setPosition(0,0,0);this.curIdx=-1},a.update=function(e){var t=this;if(this.gameState==se.RUN){var i,n,o=(new Date).getTime();if(!this.isPlayCountdownMus&&1e3*this.totalTime-(o-this.beginTime)<=3e3)this.isPlayCountdownMus=!0,null===(i=p("Audio"))||void 0===i||null===(n=i.getComponent(y))||void 0===n||n.playOneShot(this.countdownMus);if(1e3*this.totalTime-(o-this.beginTime)<=0){this.gameState=se.END,this.gameEndTime=o,v.openView(w.TimeFailView,(function(e){var i,n,o,l,a,r;null==e||null===(i=e.getComponent(F))||void 0===i||i.setTime(1e3*t.bestTime),null==e||null===(n=e.getComponent(F))||void 0===n||n.setLevel(t.getEvaluation(1e3*t.bestTime)),null===(o=p("Audio"))||void 0===o||null===(l=o.getComponent(y))||void 0===l||l.playOneShot(t.endMus),null===(a=p("Audio"))||void 0===a||null===(r=a.getComponent(y))||void 0===r||r.playOneShot(t.failMus)}),k.TOP);var l={type:"cocos_game",gameId:this.gameId,gameScore:1e4*Number((1/(Math.ceil((this.gameEndTime-this.beginTime)/1e3)/this.totalTime)).toFixed(4))?1e4*Number((1/(Math.ceil((this.gameEndTime-this.beginTime)/1e3)/this.totalTime)).toFixed(4)):0,gameEvaluation:this.getEvaluation(this.gameEndTime-this.beginTime),durTime:this.gameEndTime-this.beginTime,totalTime:this.gameEndTime-this.beginTime,finishRate:Number((Math.ceil((this.gameEndTime-this.beginTime)/1e3)/this.totalTime).toFixed(4))?Number((Math.ceil((this.gameEndTime-this.beginTime)/1e3)/this.totalTime).toFixed(4)):0};S.sendDataOut(JSON.stringify(l))}this.timeLab.string=P.formatTime(1e3*this.totalTime-(o-this.beginTime))}},a.getEvaluation=function(e){for(var t=-1,i=0;i<this.evaluateTime.length;++i)if(e/1e3<this.evaluateTime[i]){t=i;break}switch(t){case 0:return"S";case 1:return"A";case 2:return"B";default:return"C"}},a.pauseGame=function(){this.gameState=se.PAUSE},a.continueGame=function(){this.beginTime=(new Date).getTime(),this.gameState=se.RUN},a.getFirstItem=function(){for(var e=0;e<this.blockComs.length;++e)if(0==this.blockComs[e].orderIdx)return this.blockComs[e]},a.getTwoItem=function(){for(var e=0;e<this.blockComs.length;++e)if(0!=this.blockComs[e].orderIdx&&this.blockComs[e].text==this.elems[1])return this.blockComs[e]},t}(C)).prototype,"gameId",[A],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 1e3}}),K=t(X.prototype,"blockPosNodes",[L],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Q=t(X.prototype,"clickColors",[z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),Y=t(X.prototype,"timeLab",[U],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),$=t(X.prototype,"blockFont",[_],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ee=t(X.prototype,"blockPre",[O],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),te=t(X.prototype,"endMus",[R],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ie=t(X.prototype,"clickMus",[B],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),ne=t(X.prototype,"failMus",[W],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),oe=t(X.prototype,"countdownMus",[G],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return null}}),le=t(X.prototype,"texts",[H],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),ae=t(X.prototype,"totalTime",[Z],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return 0}}),re=t(X.prototype,"evaluateTime",[j],{configurable:!0,enumerable:!0,writable:!0,initializer:function(){return[]}}),J=X))||J)||J));a._RF.pop()}}}));
System.register("chunks:///_virtual/UniqueUtils_1.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./Utils.ts"],(function(t){"use strict";var n,o,e,a;return{setters:[function(t){n=t.defineProperty},function(t){o=t.cclegacy,e=t._decorator},function(t){a=t.Utils}],execute:function(){o._RF.push({},"67c44BebhFLfpZEETw8DYtL","UniqueUtils_1",void 0);e.ccclass,e.property;var r=t("UniqueUtils_1",function(){function t(){}return t.getItemSprPath=function(n,o){return n<t.minShapeIdx||n>t.maxShapeIdx||o<t.minColorIdx||o>t.maxColorIdx?null:{bundleName:"sceneBundle",path:"games/unique-1/image/s_"+Math.floor(n)+"_c_"+Math.floor(o)}},t.getRandomShapeAndColorAndAct=function(){return{shapeIdx:t.minShapeIdx+Math.floor(Math.random()*(t.maxShapeIdx+1-t.minShapeIdx)),colorIdx:t.minColorIdx+Math.floor(Math.random()*(t.maxColorIdx+1-t.minColorIdx)),actIdx:t.minActIdx+Math.floor(Math.random()*(t.maxActIdx+1-t.minActIdx))}},t.formatTime=function(t){return a.formatTime(t)},t}());n(r,"minColorIdx",1),n(r,"maxColorIdx",4),n(r,"minShapeIdx",1),n(r,"maxShapeIdx",9),n(r,"minActIdx",1),n(r,"maxActIdx",3);t("sameShapeCfg",[[3,5],[8,9],[6,7],[7,5],[4,2],[2,4]]);o._RF.pop()}}})); System.register("chunks:///_virtual/UniqueUtils_1.ts",["./_rollupPluginModLoBabelHelpers.js","cc","./Utils.ts"],(function(t){"use strict";var n,o,e,a;return{setters:[function(t){n=t.defineProperty},function(t){o=t.cclegacy,e=t._decorator},function(t){a=t.Utils}],execute:function(){o._RF.push({},"67c44BebhFLfpZEETw8DYtL","UniqueUtils_1",void 0);e.ccclass,e.property;var r=t("UniqueUtils_1",function(){function t(){}return t.getItemSprPath=function(n,o){return n<t.minShapeIdx||n>t.maxShapeIdx||o<t.minColorIdx||o>t.maxColorIdx?null:{bundleName:"sceneBundle",path:"games/unique-1/image/s_"+Math.floor(n)+"_c_"+Math.floor(o)}},t.getRandomShapeAndColorAndAct=function(){return{shapeIdx:t.minShapeIdx+Math.floor(Math.random()*(t.maxShapeIdx+1-t.minShapeIdx)),colorIdx:t.minColorIdx+Math.floor(Math.random()*(t.maxColorIdx+1-t.minColorIdx)),actIdx:t.minActIdx+Math.floor(Math.random()*(t.maxActIdx+1-t.minActIdx))}},t.formatTime=function(t){return a.formatTime(t)},t}());n(r,"minColorIdx",1),n(r,"maxColorIdx",4),n(r,"minShapeIdx",1),n(r,"maxShapeIdx",9),n(r,"minActIdx",1),n(r,"maxActIdx",3);t("sameShapeCfg",[[3,5],[8,9],[6,7],[7,5],[4,2],[2,4]]);o._RF.pop()}}}));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment