Commit db5b9dd7 authored by 李维's avatar 李维

Bug fix

parent 1d40b197
......@@ -133,7 +133,7 @@
<div class="section-title" >
错误选项
<div style="text-align: center; float: right;">
<button nz-button nzType="primary" (click)="addChoice(item.incorrect)" >
<button nz-button nzType="primary" (click)="addChoice(item.incorrect)" [disabled]="item.correct.length>=4" >
<i nz-icon nzType="plus-circle" nzTheme="outline"></i>
添加
</button>
......
......@@ -526,7 +526,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if(index==1){
newId = "score-ball-right-"
}
for(let i=0; i<6; i++){
for(let i=0; i<this.g_formData.dataArray.length; i++){
let scoreBall = this.g_cartoon.createCartoonElementImageFunc(newId + i, "bg_star", (w ,h)=>{
return {
sx: 68 / w,
......@@ -649,11 +649,11 @@ export class PlayComponent implements OnInit, OnDestroy {
let x = 0
if( side=="right" ){
do{
x = this.g_canvasWidth / 2 + ( Math.ceil(Math.random()*400) + 80 ) * this.g_mapScale
x = this.g_canvasWidth / 2 + ( Math.ceil(Math.random()*400) + 150 ) * this.g_mapScale
}while(this.m_lastBubbleX[side] != -1 && x <= (this.m_lastBubbleX[side] + width) && x >= (this.m_lastBubbleX[side] - width))
}else{
do{
x = 150 * this.g_mapScale + Math.ceil(Math.random()*400) * this.g_mapScale
x = 150 * this.g_mapScale + Math.ceil(Math.random()*350) * this.g_mapScale
}while(this.m_lastBubbleX[side] != -1 && x <= (this.m_lastBubbleX[side] + width) && x >= (this.m_lastBubbleX[side] - width))
}
this.m_lastBubbleX[side] = x
......@@ -679,9 +679,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this.m_allAnswerBubble[side].push(container.id)
if(data.type == "Image"){
container.isImage = true;
let image = this.g_cartoon.createImage(data.image_url, (w, h)=>{
let sx = 138 * 0.7 / w
let sy = 138 * 0.7 / h
let sx = 120 / w
let sy = 120 / h
let s = Math.min(sx, sy)
return {
sx: s,
......@@ -694,23 +695,40 @@ export class PlayComponent implements OnInit, OnDestroy {
}
})
container.ref.addChild(image)
container.content = image
}else{
let text = this.g_cartoon.createLabel(data.text, "BerlinSansFBDemi-Bold", "#FFFFFF", 24);
container.isImage = false;
let text = this.g_cartoon.createLabel(data.text, "MMTextBook-Bold", "#00528c", 40);
container.ref.addChild(text)
container.content = text
}
container.ball_highlight = this.g_cartoon.createImage("ball_highlight", (w, h)=>{
return {
sx: 164 * 1.1 / w,
sy: 152 * 1.1 / h
sx: 164 / w,
sy: 152 / h
}
}, (w, h)=>{
return {
x: -2,
x: -5,
y: -5
}
})
container.ref.addChild(container.ball_highlight)
let redOutline = new ShapeRect();
redOutline.fillColor = "#ff5252"
redOutline.setSize(container.content.width * container.content.scaleX + 10, container.content.height * container.content.scaleY + 10);
redOutline.x = -container.content.width * container.content.scaleX / 2
redOutline.y = -container.content.height * container.content.scaleY / 2
if(container.isImage) {
redOutline.alpha = 1;
} else {
redOutline.alpha = 0;
}
container.ball_highlight.addChild(redOutline)
container.ball_highlight.alpha = 0
container.ref.addChild(container.ball_highlight, -1)
container.ball_highlight.visible = false;
container.ballYeah = this.g_cartoon.createImage("bg_graet", (w, h)=>{
......@@ -777,7 +795,10 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_cartoon.playAudio("cuowu")
container.ball_highlight.visible = true;
this.showShakeAnimation(container.id, ()=>{
container.ball_highlight.visible = false;
if(!container.isImage) {
container.content.fontColor = "#ff5252"
}
// container.ball_highlight.visible = false;
callback && callback()
})
}
......@@ -793,12 +814,12 @@ export class PlayComponent implements OnInit, OnDestroy {
if( side=="right" ){
let time = 0;
do{
x = this.g_canvasWidth / 2 + ( Math.ceil(Math.random()*400) + 80 ) * this.g_mapScale
x = this.g_canvasWidth / 2 + ( Math.ceil(Math.random()*400) + 150 ) * this.g_mapScale
}while(x <= (this.m_lastBubbleX[side] + width) && x >= (this.m_lastBubbleX[side] - width))
}else{
let time = 0;
do{
x = 150 * this.g_mapScale + Math.ceil(Math.random()*400) * this.g_mapScale
x = 150 * this.g_mapScale + Math.ceil(Math.random()*350) * this.g_mapScale
}while( x <= (this.m_lastBubbleX[side] + width) && x >= (this.m_lastBubbleX[side] - width))
}
this.m_lastBubbleX[side] = x
......@@ -825,8 +846,9 @@ export class PlayComponent implements OnInit, OnDestroy {
this.g_enableMapDown = true;
return
}
container.tween.stop()
if(container.index == this.m_currentQuestionIndex){
container.tween.stop()
this.m_scoreLine[side]--
if( this.m_scoreLine[side]==0 ){
this.m_score[side]++
......@@ -847,9 +869,10 @@ export class PlayComponent implements OnInit, OnDestroy {
})
}
}else{
container.tween.pause()
container.inCorrect(()=>{
this.g_enableMapDown = true;
container.tween.start()
container.tween.resume()
})
}
return true;
......
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