Commit 86a9a25e authored by unknown's avatar unknown

准备加入关卡成功信息发送

parent 537a65c6
...@@ -226,18 +226,6 @@ export class FaceRecognitionCtr extends Component { ...@@ -226,18 +226,6 @@ export class FaceRecognitionCtr extends Component {
node?.getComponent(ChallengeFailView); node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
//随机生成一个人物信息 //随机生成一个人物信息
......
...@@ -376,18 +376,6 @@ export class BombDisposalExpertCtr extends Component { ...@@ -376,18 +376,6 @@ export class BombDisposalExpertCtr extends Component {
node?.getComponent(ChallengeFailView); node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
isGameOver() { isGameOver() {
......
...@@ -149,18 +149,6 @@ export class BuyTicketCtr extends Component { ...@@ -149,18 +149,6 @@ export class BuyTicketCtr extends Component {
node?.getComponent(ChallengeFailView); node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
//列出火车表 //列出火车表
......
...@@ -313,18 +313,6 @@ export class ClassifyCtr_1 extends Component { ...@@ -313,18 +313,6 @@ export class ClassifyCtr_1 extends Component {
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.failMus); find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.failMus);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
type: "cocos_game",
gameId: this.gameId,
gameScore: this.curScore,
gameEvaluation: this.getEvaluation(this.curScore),
durTime: curTime - this.beginTime,
totalTime: curTime - this.beginTime,
finishRate: <number><any>(this.curScore / this.succScore).toFixed(4)
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
else { else {
this.timeLab.string = ClassifyUtils_1.formatTime(this.totalTime * 1000 - (curTime - this.beginTime)); this.timeLab.string = ClassifyUtils_1.formatTime(this.totalTime * 1000 - (curTime - this.beginTime));
......
...@@ -280,18 +280,6 @@ export class ClassifyCtr extends Component { ...@@ -280,18 +280,6 @@ export class ClassifyCtr extends Component {
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.failMus); find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.failMus);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
type: "cocos_game",
gameId: this.gameId,
gameScore: this.curScore,
gameEvaluation: this.getEvaluation(this.curScore),
durTime: curTime - this.beginTime,
totalTime: curTime - this.beginTime,
finishRate: <number><any>(this.curScore / this.succScore).toFixed(4)
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
else { else {
this.timeLab.string = ClassifyUtils.formatTime(this.totalTime * 1000 - (curTime - this.beginTime)); this.timeLab.string = ClassifyUtils.formatTime(this.totalTime * 1000 - (curTime - this.beginTime));
......
import { _decorator, Component, Node, Label, director } from 'cc'; import { _decorator, Component, Node, Label, director } from 'cc';
import { Utils } from '../../../../startFolder/script/common/Utils'; import { Utils } from '../../../../startFolder/script/common/Utils';
import { GameEndDataItf, htmlSendDataMgr } from '../../../../startFolder/script/HtmlSendDataMgr';
import { levelMgr } from '../../../../startFolder/script/LevelMgr'; import { levelMgr } from '../../../../startFolder/script/LevelMgr';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
...@@ -21,6 +22,19 @@ export class ChallengeSuccView extends Component { ...@@ -21,6 +22,19 @@ export class ChallengeSuccView extends Component {
this.countdownLab!.string = "(5)"; this.countdownLab!.string = "(5)";
this.costTime = 0; this.costTime = 0;
this.isClickOnce = false; this.isClickOnce = false;
//把数据发给包裹游戏的容器
if(levelMgr.unLockCount >= levelMgr.getLevelCount(levelMgr.gameIdHead)) return;
// let sendOutData: GameEndDataItf = {
// gameId: levelMgr.gameIdHead * 100 + (),
// 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));
//************************** */
} }
update(deltaTime: number) { update(deltaTime: number) {
...@@ -35,12 +49,12 @@ export class ChallengeSuccView extends Component { ...@@ -35,12 +49,12 @@ export class ChallengeSuccView extends Component {
} }
onBackBtnClick() { onBackBtnClick() {
if(levelMgr.unLockCount <= levelMgr.runLevel) levelMgr.unLockCount += 1; if (levelMgr.unLockCount <= levelMgr.runLevel) levelMgr.unLockCount += 1;
levelMgr.backLevelHome(); levelMgr.backLevelHome();
} }
onContinueBtnClick() { onContinueBtnClick() {
if(levelMgr.unLockCount <= levelMgr.runLevel) levelMgr.unLockCount += 1; if (levelMgr.unLockCount <= levelMgr.runLevel) levelMgr.unLockCount += 1;
levelMgr.runLevel += 1; levelMgr.runLevel += 1;
levelMgr.loadLevel(); levelMgr.loadLevel();
} }
......
...@@ -181,18 +181,6 @@ export class FoodForThePartyCtr extends Component { ...@@ -181,18 +181,6 @@ export class FoodForThePartyCtr extends Component {
node?.getComponent(ChallengeFailView); node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
//倒计时 //倒计时
......
...@@ -128,18 +128,6 @@ export class QuickQuizCtr extends Component { ...@@ -128,18 +128,6 @@ export class QuickQuizCtr extends Component {
view?.getComponent(ChallengeFailView); view?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
roundStart() { roundStart() {
......
...@@ -321,7 +321,7 @@ ...@@ -321,7 +321,7 @@
"_priority": 1073741824, "_priority": 1073741824,
"_fov": 45, "_fov": 45,
"_fovAxis": 0, "_fovAxis": 0,
"_orthoHeight": 414.4124472573839, "_orthoHeight": 418.6192468619247,
"_near": 1, "_near": 1,
"_far": 2000, "_far": 2000,
"_color": { "_color": {
......
...@@ -169,18 +169,6 @@ export class SchulteCtr extends Component { ...@@ -169,18 +169,6 @@ export class SchulteCtr extends Component {
node?.getComponent(ChallengeSuccView)?.init(); node?.getComponent(ChallengeSuccView)?.init();
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.endMus); find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.endMus);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
type: "cocos_game",
gameId: this.gameId,
gameScore: <number><any>(1 / (Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime)).toFixed(4) * 10000,
gameEvaluation: this.getEvaluation(this.gameEndTime - this.beginTime),
durTime: this.gameEndTime - this.beginTime,
totalTime: this.gameEndTime - this.beginTime,
finishRate: 1 / <number><any>(Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime).toFixed(4)
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
}); });
director.on("continue_game", () => { director.on("continue_game", () => {
...@@ -262,18 +250,6 @@ export class SchulteCtr extends Component { ...@@ -262,18 +250,6 @@ export class SchulteCtr extends Component {
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.endMus); find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.endMus);
find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.failMus); find("Audio")?.getComponent(AudioCtr)?.playOneShot(this.failMus);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
type: "cocos_game",
gameId: this.gameId,
gameScore: <number><any>(1 / (Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime)).toFixed(4) * 10000,
gameEvaluation: this.getEvaluation(this.gameEndTime - this.beginTime),
durTime: this.gameEndTime - this.beginTime,
totalTime: this.gameEndTime - this.beginTime,
finishRate: <number><any>(Math.round((this.gameEndTime - this.beginTime) / 1000) / this.totalTime).toFixed(4)
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
this.timeLab.string = SchulteUtils.formatTime(this.totalTime * 1000 - (endTime - this.beginTime)); this.timeLab.string = SchulteUtils.formatTime(this.totalTime * 1000 - (endTime - this.beginTime));
} }
......
...@@ -228,18 +228,6 @@ export class SiHaiShiYiCtr extends Component { ...@@ -228,18 +228,6 @@ export class SiHaiShiYiCtr extends Component {
node?.getComponent(ChallengeFailView); node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
//获取每一轮应该展示的图片,注意是所有老图片加三张新图片 //获取每一轮应该展示的图片,注意是所有老图片加三张新图片
......
...@@ -331,18 +331,6 @@ export class TransientCtr_1 extends Component { ...@@ -331,18 +331,6 @@ export class TransientCtr_1 extends Component {
node?.getComponent(ChallengeFailView); node?.getComponent(ChallengeFailView);
}, VIEW_INDEX.TOP); }, VIEW_INDEX.TOP);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
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));
//************************** */
} }
isGameOver() { isGameOver() {
......
...@@ -538,18 +538,6 @@ export class UniqueCtr_1 extends Component { ...@@ -538,18 +538,6 @@ export class UniqueCtr_1 extends Component {
this.gameState = GameState.END; this.gameState = GameState.END;
log(`游戏已经失败`); log(`游戏已经失败`);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
gameId: this.gameId,
gameScore: this.curScore,
gameEvaluation: this.getEvaluation(this.curScore),
durTime: endTime - this.beginTime,
totalTime: endTime - this.beginTime,
finishRate: <number><any>(this.curScore / this.succScore).toFixed(4),
type: "cocos_game"
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
this.timeLab.string = UniqueUtils_1.formatTime(this.totalTime * 1000 - (endTime - this.beginTime)); this.timeLab.string = UniqueUtils_1.formatTime(this.totalTime * 1000 - (endTime - this.beginTime));
} }
......
...@@ -542,18 +542,6 @@ export class UniqueCtr_2 extends Component { ...@@ -542,18 +542,6 @@ export class UniqueCtr_2 extends Component {
this.gameState = GameState.END; this.gameState = GameState.END;
log(`游戏已经失败`); log(`游戏已经失败`);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
gameId: this.gameId,
gameScore: this.curScore,
gameEvaluation: this.getEvaluation(this.curScore),
durTime: endTime - this.beginTime,
totalTime: endTime - this.beginTime,
finishRate: <number><any>(this.curScore / this.succScore).toFixed(4),
type: "cocos_game"
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
this.timeLab.string = UniqueUtils_2.formatTime(this.totalTime * 1000 - (endTime - this.beginTime)); this.timeLab.string = UniqueUtils_2.formatTime(this.totalTime * 1000 - (endTime - this.beginTime));
} }
......
...@@ -548,18 +548,6 @@ export class UniqueCtr extends Component { ...@@ -548,18 +548,6 @@ export class UniqueCtr extends Component {
this.gameState = GameState.END; this.gameState = GameState.END;
log(`游戏已经失败`); log(`游戏已经失败`);
} }
//把数据发给包裹游戏的容器
let sendOutData: GameEndDataItf = {
gameId: this.gameId,
gameScore: this.curScore,
gameEvaluation: this.getEvaluation(this.curScore),
durTime: endTime - this.beginTime,
totalTime: endTime - this.beginTime,
finishRate: <number><any>(this.curScore / this.succScore).toFixed(4),
type: "cocos_game"
}
htmlSendDataMgr.sendDataOut(JSON.stringify(sendOutData));
//************************** */
} }
this.timeLab.string = UniqueUtils.formatTime(this.totalTime * 1000 - (endTime - this.beginTime)); this.timeLab.string = UniqueUtils.formatTime(this.totalTime * 1000 - (endTime - this.beginTime));
} }
......
...@@ -37,6 +37,7 @@ class HtmlSendDataMgr { ...@@ -37,6 +37,7 @@ class HtmlSendDataMgr {
if (HTML5 || PREVIEW) { if (HTML5 || PREVIEW) {
console.log(`xuhang发送postMessage数据:`); console.log(`xuhang发送postMessage数据:`);
console.log(data); console.log(data);
//@ts-ignore
window.top.postMessage(data, this.targetOrigin); window.top.postMessage(data, this.targetOrigin);
//@ts-ignore //@ts-ignore
if (typeof wx != "undefined") { if (typeof wx != "undefined") {
......
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