Commit 73be6b3e authored by unknown's avatar unknown

可以打包了

parent 4d05e251
import { _decorator, Component, Node, CCFloat, CCString, director, CCInteger, Label, find, Prefab, instantiate, math } from 'cc'; import { _decorator, Component, Node, CCFloat, CCString, director, CCInteger, Label, find, Prefab, instantiate, math } from 'cc';
import { AudioCtr } from '../../../../startFolder/script/AudioCtr'; import { AudioCtr } from '../../../../startFolder/script/AudioCtr';
import { failMus, rightMus, succMus, wrongMus } from '../../../../startFolder/script/common/AudioDef';
import { AudioMgr } from '../../../../startFolder/script/common/AudioMgr';
import { Utils } from '../../../../startFolder/script/common/Utils'; import { Utils } from '../../../../startFolder/script/common/Utils';
import { VIEW_DEF } from '../../../../startFolder/script/common/ViewDef'; import { VIEW_DEF } from '../../../../startFolder/script/common/ViewDef';
import { viewMgr, VIEW_INDEX } from '../../../../startFolder/script/common/ViewMgr'; import { viewMgr, VIEW_INDEX } from '../../../../startFolder/script/common/ViewMgr';
import { GameEndDataItf, htmlSendDataMgr } from '../../../../startFolder/script/HtmlSendDataMgr'; import { GameEndDataItf, GameEndDataItf_1, htmlSendDataMgr } from '../../../../startFolder/script/HtmlSendDataMgr';
import { AudioSrc } from '../../commonView/script/AudioSrc'; import { AudioSrc } from '../../commonView/script/AudioSrc';
import { BeginCountdownView } from '../../commonView/script/BeginCountdownView'; import { BeginCountdownView } from '../../commonView/script/BeginCountdownView';
import { ChallengeFailView } from '../../commonView/script/ChallengeFailView'; import { ChallengeFailView } from '../../commonView/script/ChallengeFailView';
...@@ -120,13 +122,13 @@ export class FaceRecognitionCtr extends Component { ...@@ -120,13 +122,13 @@ export class FaceRecognitionCtr extends Component {
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => { viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)?.init(1.2); node.getComponent(SwitchOkView)?.init(1.2);
}); });
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("RIGHT")!); AudioMgr.playOneShot(rightMus);
} }
else { else {
viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => { viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => {
node.getComponent(SwitchErrorView)?.init(1.2); node.getComponent(SwitchErrorView)?.init(1.2);
}); });
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("WRONG")!); AudioMgr.playOneShot(wrongMus);
} }
this.creAnswerTwoView(); this.creAnswerTwoView();
}); });
...@@ -139,13 +141,13 @@ export class FaceRecognitionCtr extends Component { ...@@ -139,13 +141,13 @@ export class FaceRecognitionCtr extends Component {
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => { viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)?.init(1.2); node.getComponent(SwitchOkView)?.init(1.2);
}); });
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("RIGHT")!); AudioMgr.playOneShot(rightMus);
} }
else { else {
viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => { viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => {
node.getComponent(SwitchErrorView)?.init(1.2); node.getComponent(SwitchErrorView)?.init(1.2);
}); });
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("WRONG")!); AudioMgr.playOneShot(wrongMus);
} }
this.startRound(true); this.startRound(true);
}); });
...@@ -246,7 +248,7 @@ export class FaceRecognitionCtr extends Component { ...@@ -246,7 +248,7 @@ export class FaceRecognitionCtr extends Component {
// node?.getComponent(ChallengeSuccView)?.init(); // node?.getComponent(ChallengeSuccView)?.init();
// }, VIEW_INDEX.TOP); // }, VIEW_INDEX.TOP);
viewMgr.openView(VIEW_DEF.ScoreSuccView, (node) => { viewMgr.openView(VIEW_DEF.ScoreSuccView, (node) => {
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("SCCESS")!); AudioMgr.playOneShot(succMus);
node?.getComponent(ScoreSuccView)?.setData(this.costTime, this.getEvaluation(this.curScore)); node?.getComponent(ScoreSuccView)?.setData(this.costTime, this.getEvaluation(this.curScore));
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
...@@ -256,10 +258,22 @@ export class FaceRecognitionCtr extends Component { ...@@ -256,10 +258,22 @@ export class FaceRecognitionCtr extends Component {
// node?.getComponent(ChallengeFailView); // node?.getComponent(ChallengeFailView);
// }, VIEW_INDEX.TOP); // }, VIEW_INDEX.TOP);
viewMgr.openView(VIEW_DEF.ScoreFailView, (node) => { viewMgr.openView(VIEW_DEF.ScoreFailView, (node) => {
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("FAIL")!); AudioMgr.playOneShot(failMus);
node?.getComponent(ScoreFailView)?.setData(this.costTime, this.getEvaluation(this.curScore)); node?.getComponent(ScoreFailView)?.setData(this.costTime, this.getEvaluation(this.curScore));
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf_1 = {
gameId: this.gameId,
gameScore: this.curScore,
gameEvaluation: this.getEvaluation(this.curScore),
durTime: Math.floor(this.costTime * 1000),
totalTime: Math.floor(this.costTime * 1000),
finishRate: <number><any>(this.curScore / this.succScore).toFixed(4),
type: "cocos_game"
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
//随机生成一个人物信息 //随机生成一个人物信息
......
...@@ -9,6 +9,17 @@ export interface GameEndDataItf { ...@@ -9,6 +9,17 @@ export interface GameEndDataItf {
finishLevelCount: number finishLevelCount: number
} }
export interface GameEndDataItf_1 {
gameId: number, //游戏id
gameScore: number, //游戏分数
gameEvaluation: string, //评价
durTime: number, //游戏时间
totalTime: number, //游戏总时长
finishRate: number, //游戏完成率
type: string //
}
class HtmlSendDataMgr { class HtmlSendDataMgr {
private constructor() { } private constructor() { }
private static _instance: HtmlSendDataMgr = null!; private static _instance: HtmlSendDataMgr = null!;
......
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