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 { 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 { VIEW_DEF } from '../../../../startFolder/script/common/ViewDef';
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 { BeginCountdownView } from '../../commonView/script/BeginCountdownView';
import { ChallengeFailView } from '../../commonView/script/ChallengeFailView';
......@@ -120,13 +122,13 @@ export class FaceRecognitionCtr extends Component {
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)?.init(1.2);
});
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("RIGHT")!);
AudioMgr.playOneShot(rightMus);
}
else {
viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => {
node.getComponent(SwitchErrorView)?.init(1.2);
});
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("WRONG")!);
AudioMgr.playOneShot(wrongMus);
}
this.creAnswerTwoView();
});
......@@ -139,13 +141,13 @@ export class FaceRecognitionCtr extends Component {
viewMgr.openView(VIEW_DEF.SwitchOkView, (node) => {
node.getComponent(SwitchOkView)?.init(1.2);
});
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("RIGHT")!);
AudioMgr.playOneShot(rightMus);
}
else {
viewMgr.openView(VIEW_DEF.SwitchErrorView, (node) => {
node.getComponent(SwitchErrorView)?.init(1.2);
});
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.audioSrc.getMus("WRONG")!);
AudioMgr.playOneShot(wrongMus);
}
this.startRound(true);
});
......@@ -246,7 +248,7 @@ export class FaceRecognitionCtr extends Component {
// node?.getComponent(ChallengeSuccView)?.init();
// }, VIEW_INDEX.TOP);
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));
}, VIEW_INDEX.TOP);
}
......@@ -256,10 +258,22 @@ export class FaceRecognitionCtr extends Component {
// node?.getComponent(ChallengeFailView);
// }, VIEW_INDEX.TOP);
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));
}, 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 {
finishLevelCount: number
}
export interface GameEndDataItf_1 {
gameId: number, //游戏id
gameScore: number, //游戏分数
gameEvaluation: string, //评价
durTime: number, //游戏时间
totalTime: number, //游戏总时长
finishRate: number, //游戏完成率
type: string //
}
class HtmlSendDataMgr {
private constructor() { }
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