Commit 897f2241 authored by 李维's avatar 李维

添加虎阅对应的分数体系配置

parent 4e7aad42
...@@ -41,6 +41,7 @@ const RS_30_5L_FAF = "2"; ...@@ -41,6 +41,7 @@ const RS_30_5L_FAF = "2";
const RS_40_5L_FAF = "5"; const RS_40_5L_FAF = "5";
const RS_100_3L_FAF = "3"; const RS_100_3L_FAF = "3";
const RS_120_3L_FAF = "6"; const RS_120_3L_FAF = "6";
const RS_NONE_3L_HY = "7";
const layer_1 = 5 // 布局层1 [热区背景图] const layer_1 = 5 // 布局层1 [热区背景图]
const layer_2 = 10 // 布局层2 [装饰框 色块 结果展示] const layer_2 = 10 // 布局层2 [装饰框 色块 结果展示]
...@@ -455,12 +456,35 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -455,12 +456,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
// 根据评分体系显示对应的提示语 // 根据评分体系显示对应的提示语
showEndAnimationByRatingSystem(score, ratingSystem) { showEndAnimationByRatingSystem(resultData, ratingSystem) {
const aniName = this.getAniNameByRatingSystem(score, ratingSystem); const {
totalScore,
isAllRight,
isAllWrong
} = resultData;
let aniName = "Default"
const scoreNode = cc.find("score", this.scoreShowContainer);
if(ratingSystem == RS_NONE_3L_HY) {
if(isAllRight) {
aniName = "Default";
console.log("虎阅全对")
} else if (isAllWrong) {
aniName = "Default"
console.log("虎阅全错误")
} else {
aniName = "Default"
console.log("虎阅一般")
}
scoreNode.active = false;
} else {
scoreNode.active = true;
aniName = this.getAniNameByRatingSystem(totalScore, ratingSystem);
}
const animationNode = cc.find(`EndAnimation/${aniName}`, this.scoreShowContainer); const animationNode = cc.find(`EndAnimation/${aniName}`, this.scoreShowContainer);
const scoreLabel = cc.find("score/number", this.scoreShowContainer).getComponent(cc.RichText); const scoreLabel = cc.find("score/number", this.scoreShowContainer).getComponent(cc.RichText);
scoreLabel.string = `<outline color=#663333 width=5><color=#FFCC00>${score}</color></outline>`; scoreLabel.string = `<outline color=#663333 width=5><color=#FFCC00>${totalScore}</color></outline>`;
this.scoreShowContainer.opacity = 0; this.scoreShowContainer.opacity = 0;
this.scoreShowContainer.active = true; this.scoreShowContainer.active = true;
...@@ -3726,11 +3750,16 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -3726,11 +3750,16 @@ export default class SceneComponent extends MyCocosSceneComponent {
scoreCconfigArr: [], scoreCconfigArr: [],
basicScore: 0, basicScore: 0,
totalScore: 0, totalScore: 0,
isAllRight: false,
isAllWrong: false,
startTimestamp: this.startTimestamp, startTimestamp: this.startTimestamp,
submitTimestamp: new Date().getTime(), submitTimestamp: new Date().getTime(),
answeringTime: null, answeringTime: null,
} }
let rightCount = 0;
let wrongCount = 0;
// 计算答题时长 // 计算答题时长
resultData.answeringTime = resultData.submitTimestamp - resultData.startTimestamp; resultData.answeringTime = resultData.submitTimestamp - resultData.startTimestamp;
...@@ -3763,6 +3792,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -3763,6 +3792,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
if(result.allRight) { if(result.allRight) {
// 回答正确 // 回答正确
rightCount ++;
if(result.rect != null) { if(result.rect != null) {
// 显示在热区的中间 // 显示在热区的中间
errIcon.x = rightIcon.x = result.rect.width / 2; errIcon.x = rightIcon.x = result.rect.width / 2;
...@@ -3780,6 +3810,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -3780,6 +3810,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
} else { } else {
// 回答错误 // 回答错误
wrongCount ++;
if(result.rect != null) { if(result.rect != null) {
// 显示在热区的中间 // 显示在热区的中间
errIcon.x = rightIcon.x = result.rect.width / 2; errIcon.x = rightIcon.x = result.rect.width / 2;
...@@ -3800,6 +3831,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -3800,6 +3831,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
}) })
if(rightCount == 0) {
resultData.isAllRight = false;
resultData.isAllWrong = true;
} else if(wrongCount == 0) {
resultData.isAllRight = true;
resultData.isAllWrong = false;
}
let totalScore = 0; let totalScore = 0;
resultData.scoreCconfigArr.forEach((score, index) => { resultData.scoreCconfigArr.forEach((score, index) => {
// 累加各个分数区域 // 累加各个分数区域
...@@ -3823,7 +3862,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -3823,7 +3862,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
resultData.totalScore = totalScore; resultData.totalScore = totalScore;
this.resultData = resultData; this.resultData = resultData;
console.log("答案校验完毕", resultData) console.log("答案校验完毕", resultData)
this.showEndAnimationByRatingSystem(resultData.totalScore, this.data.ratingSystem)
this.showEndAnimationByRatingSystem({
totalScore: resultData.totalScore,
isAllRight: resultData.isAllRight,
isAllWrong: resultData.isAllWrong,
}, this.data.ratingSystem)
// 如果配置了分数显示区域 - 显示分数 // 如果配置了分数显示区域 - 显示分数
if(this.totalScorePanel) { if(this.totalScorePanel) {
......
...@@ -69,6 +69,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -69,6 +69,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
RS_40_5L_FAF = "5"; RS_40_5L_FAF = "5";
RS_100_3L_FAF = "3"; RS_100_3L_FAF = "3";
RS_120_3L_FAF = "6"; RS_120_3L_FAF = "6";
RS_NONE_3L_HY = "7";
// 评分体系 清单 // 评分体系 清单
ratingSystemList = [ ratingSystemList = [
...@@ -79,6 +80,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni ...@@ -79,6 +80,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy, AfterViewIni
{label: "40分 5段 - FAF", value: this.RS_40_5L_FAF}, {label: "40分 5段 - FAF", value: this.RS_40_5L_FAF},
{label: "100分 3段 - FAF", value: this.RS_100_3L_FAF}, {label: "100分 3段 - FAF", value: this.RS_100_3L_FAF},
{label: "120分 3段 - FAF", value: this.RS_120_3L_FAF}, {label: "120分 3段 - FAF", value: this.RS_120_3L_FAF},
{label: "无分数 3段 - 虎阅", value: this.RS_NONE_3L_HY},
] ]
// 保存锁 // 保存锁
......
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