Commit 80983b9b authored by 李维's avatar 李维

Bug fix

parent a5ffeaea
...@@ -76,3 +76,9 @@ ...@@ -76,3 +76,9 @@
font-family: 'MMTextBook-Italic'; font-family: 'MMTextBook-Italic';
src: url("../../assets/font/MMTextBook-Italic.otf") ; src: url("../../assets/font/MMTextBook-Italic.otf") ;
} }
@font-face
{
font-family: 'futura-md-bt-bold';
src: url("../../assets/font/futura-md-bt-bold.ttf") ;
}
...@@ -117,6 +117,8 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -117,6 +117,8 @@ export class PlayComponent implements OnInit, OnDestroy {
opend = [false, false, false, false, false, false, false, false]; opend = [false, false, false, false, false, false, false, false];
wordLoad :{[key:string]:{loaded : boolean;letters:{[key:string]:{loaded:boolean, letter:Label}}}} = {}; wordLoad :{[key:string]:{loaded : boolean;letters:{[key:string]:{loaded:boolean, letter:Label}}}} = {};
underLine = [];
setWordLoad(id: string, letterId:string, loaded:boolean, letter: Label):void{ setWordLoad(id: string, letterId:string, loaded:boolean, letter: Label):void{
if(!this.wordLoad[id]){ if(!this.wordLoad[id]){
...@@ -751,23 +753,24 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -751,23 +753,24 @@ export class PlayComponent implements OnInit, OnDestroy {
body_bg; body_bg;
initPic() { initPic() {
this.body_bg = new ShapeRoundRect(); this.body_bg = new ShapeRoundRect();
this.body_bg.setSize(1280*this.mapScale, 555*this.mapScale, 30*this.mapScale) ; // this.body_bg.setSize(1280*this.mapScale, 555*this.mapScale, 30*this.mapScale) ;
this.body_bg.x = (this.canvasWidth - this.body_bg.width) / 2; // - 100 * this.mapScale; this.body_bg.setScaleXY(this.mapScale)
this.body_bg.y = this.canvasHeight - this.body_bg.height - (this.canvasHeight - this.body_bg.height)/3 ; this.body_bg.x = this.canvasWidth / 2 - 610 * this.mapScale // (this.canvasWidth - this.body_bg.width) / 2; // - 100 * this.mapScale;
this.body_bg.y = this.canvasHeight / 2 - 250 * this.mapScale // this.canvasHeight - this.body_bg.height - (this.canvasHeight - this.body_bg.height)/3 ;
this.renderArr.push(this.body_bg); this.renderArr.push(this.body_bg);
let colorBlock_left = new ShapeRoundRect() let colorBlock_left = new ShapeRoundRect()
colorBlock_left.x = 0; colorBlock_left.x = 0;
colorBlock_left.y = 0; colorBlock_left.y = 0;
colorBlock_left.fillColor = "#eef1f3" // `#${this.saveData.blockColor}`; colorBlock_left.fillColor = "#eef1f3" // `#${this.saveData.blockColor}`;
colorBlock_left.setSize(620*this.mapScale, 500*this.mapScale, 30) colorBlock_left.setSize(600, 500, 30)
this.body_bg.addChild(colorBlock_left) this.body_bg.addChild(colorBlock_left)
let colorBlock_right = new ShapeRoundRect() let colorBlock_right = new ShapeRoundRect()
colorBlock_right.x = 680*this.mapScale; colorBlock_right.x = 620;
colorBlock_right.y = 0; colorBlock_right.y = 0;
colorBlock_right.fillColor = "#eef1f3" // `#${this.saveData.blockColor}`; colorBlock_right.fillColor = "#eef1f3" // `#${this.saveData.blockColor}`;
colorBlock_right.setSize(620*this.mapScale, 500*this.mapScale, 30); colorBlock_right.setSize(600, 500, 30);
this.body_bg.addChild(colorBlock_right); this.body_bg.addChild(colorBlock_right);
// 初始化单词显示 // 初始化单词显示
...@@ -795,7 +798,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -795,7 +798,7 @@ export class PlayComponent implements OnInit, OnDestroy {
words_content.text = num; words_content.text = num;
words_content.textAlign = 'center'; words_content.textAlign = 'center';
words_content.fontSize = 36; words_content.fontSize = 36;
words_content.fontName = 'MMTextBookBold'; words_content.fontName = 'futura-md-bt-bold';
words_content.fontWeight = 600; words_content.fontWeight = 600;
words_content.fontColor = "#FFFFFF"; words_content.fontColor = "#FFFFFF";
words_content.refreshSize(); words_content.refreshSize();
...@@ -819,12 +822,12 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -819,12 +822,12 @@ export class PlayComponent implements OnInit, OnDestroy {
let letterFontSize = 48; let letterFontSize = 48;
// 单词背景 // 单词背景
let word_bg_group = new ShapeRoundRect() let word_bg_group = new ShapeRoundRect()
word_bg_group.width = 620; word_bg_group.width = 600;
word_bg_group.height = 57; word_bg_group.height = 57;
word_bg_group.x = x * this.mapScale; word_bg_group.x = x;
word_bg_group.y = y * this.mapScale; word_bg_group.y = y;
word_bg_group.fillColor = "#FFFF00" word_bg_group.fillColor = "#FFFF00"
word_bg_group.alpha = 0; word_bg_group.alpha = 1;
let startWidth = 80; let startWidth = 80;
//单词 //单词
...@@ -856,6 +859,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -856,6 +859,7 @@ export class PlayComponent implements OnInit, OnDestroy {
scale = 0.8 scale = 0.8
} }
let allUnderLines = []
for(let i = 0; i < len; ++ i) { for(let i = 0; i < len; ++ i) {
//字母 //字母
let letter = word_content.letters[i]; let letter = word_content.letters[i];
...@@ -893,6 +897,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -893,6 +897,7 @@ export class PlayComponent implements OnInit, OnDestroy {
lts_.setSize(ltBounds.width, 2); lts_.setSize(ltBounds.width, 2);
lts_.fillColor = "#949494" // this.getColor(letter.letter_color); lts_.fillColor = "#949494" // this.getColor(letter.letter_color);
word_bg.addChild(lts_); word_bg.addChild(lts_);
allUnderLines.push(lts_)
} }
height = letter_spr.height; height = letter_spr.height;
...@@ -904,11 +909,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -904,11 +909,13 @@ export class PlayComponent implements OnInit, OnDestroy {
word_bg.addChild(letter_spr); word_bg.addChild(letter_spr);
} }
this.underLine.push(allUnderLines);
word_bg.setSize(totalWidth, height * 2); word_bg.setSize(totalWidth, height * 2);
word_bg_group.addChild(word_bg); word_bg_group.addChild(word_bg);
this.word_arr_left.push(word_bg); this.word_arr_left.push(word_bg);
word_bg_group.setScaleXY(this.mapScale); // word_bg_group.setScaleXY(this.mapScale);
this.word_bg_groups.push(word_bg_group); this.word_bg_groups.push(word_bg_group);
this.body_bg.addChild(word_bg_group); this.body_bg.addChild(word_bg_group);
...@@ -920,7 +927,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -920,7 +927,7 @@ export class PlayComponent implements OnInit, OnDestroy {
let x = 0; let x = 0;
let y = 50 + 114 * i; let y = 50 + 114 * i;
if(i>3){ if(i>3){
x = 680; x = 620;
y = 50 + 114 * (i - 4); y = 50 + 114 * (i - 4);
} }
let index_1 = i // this.saveData.recordingIndex.indexOf(tIndex) let index_1 = i // this.saveData.recordingIndex.indexOf(tIndex)
...@@ -1059,6 +1066,13 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1059,6 +1066,13 @@ export class PlayComponent implements OnInit, OnDestroy {
let option = this.optionsAll[i]; let option = this.optionsAll[i];
if (this.checkClickTarget(option)) { if (this.checkClickTarget(option)) {
if(option["correct"]) { if(option["correct"]) {
if(this.opend[option["index"]]) {
// console.log(this.underLine[option["index"]])
} else {
this.opend[option["index"]] = true;
}
// this.playAudio("sm-choice-correct", false, ()=>{ // this.playAudio("sm-choice-correct", false, ()=>{
// if(this.saveData.indexAudio[option["index"]]) { // if(this.saveData.indexAudio[option["index"]]) {
// this.playAudio(this.saveData.indexAudio[option["index"]], true, ()=>{ // this.playAudio(this.saveData.indexAudio[option["index"]], true, ()=>{
...@@ -1068,8 +1082,7 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1068,8 +1082,7 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.canTouch = true; // this.canTouch = true;
// } // }
// }) // })
this.opend[option["index"]] = true;
let word = this.word_arr_left[option["index"]]; let word = this.word_arr_left[option["index"]];
let letters:Array<Label> = word.children.slice(1); let letters:Array<Label> = word.children.slice(1);
for (let j=0; j<letters.length;j++) { for (let j=0; j<letters.length;j++) {
...@@ -1157,6 +1170,11 @@ export class PlayComponent implements OnInit, OnDestroy { ...@@ -1157,6 +1170,11 @@ export class PlayComponent implements OnInit, OnDestroy {
// this.playAudio(this.saveData.wordArr[i].word_audio_url); // this.playAudio(this.saveData.wordArr[i].word_audio_url);
}) })
return ; return ;
} else {
console.log(this.underLine[i])
this.underLine[i].forEach(element => {
element.alpha = 0;
});
} }
this.stopAllAudio() this.stopAllAudio()
this.playAudio(this.saveData.wordArr[i].word_audio_url); this.playAudio(this.saveData.wordArr[i].word_audio_url);
......
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