Commit 2d52c6ee authored by yu's avatar yu

1

parent ebb8fa92
...@@ -36,6 +36,7 @@ export class ItemJigsaw { ...@@ -36,6 +36,7 @@ export class ItemJigsaw {
constructor(data, page) { constructor(data, page) {
// this.audio = data.audio; // this.audio = data.audio;
this.image = data.pic_url; this.image = data.pic_url;
this.audio = data.audio_url;
// this.voice = data.voice; // this.voice = data.voice;
// this.time = data.time; // this.time = data.time;
this.id = page; this.id = page;
......
This diff is collapsed.
...@@ -71,6 +71,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -71,6 +71,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
Game.getIns().init(this.data); Game.getIns().init(this.data);
Game.getIns().reset(); Game.getIns().reset();
this.cardBgs = []; this.cardBgs = [];
this.isOver = false;
} }
initView() { initView() {
...@@ -154,6 +155,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -154,6 +155,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
desc.active = true; desc.active = true;
let data: any = {}; let data: any = {};
data.text = dt.text; data.text = dt.text;
data.audio = dt.audio_url || "";
data.parent = ch; data.parent = ch;
data.x = desc.x; data.x = desc.x;
data.y = desc.y; data.y = desc.y;
...@@ -257,8 +259,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -257,8 +259,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
return; return;
} }
this.playLocalAudio("right");
target.parent = data.parent; target.parent = data.parent;
target.setPosition(data.x, data.y); target.setPosition(data.x, data.y);
target.active = false; target.active = false;
...@@ -269,12 +269,15 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -269,12 +269,15 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
desc.getComponent(cc.Label).string = data.text; desc.getComponent(cc.Label).string = data.text;
this.playLocalAudio("right").then(async () => {
await asyncDelay(0.3);
if (this.checkRoundEnd()) { pg.audio.playAudioByUrl(data.audio).then(async () => {
pg.event.emit("gameOver"); if (this.checkRoundEnd()) {
} await asyncDelay(0.5);
pg.event.emit("gameOver");
}
});
});
} }
private cleanLayoutSort() { private cleanLayoutSort() {
this.cardBgs.forEach((item) => { this.cardBgs.forEach((item) => {
...@@ -300,8 +303,10 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -300,8 +303,10 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
if (this.currentCards.length != this.cards.length) return false; if (this.currentCards.length != this.cards.length) return false;
return this.currentCards.every(card => !!card); return this.currentCards.every(card => !!card);
} }
private isOver = false;
gameOver() { gameOver() {
if (this.isOver) return;
this.isOver = true;
this.log("over ~~~~~~~~~~~~~~") this.log("over ~~~~~~~~~~~~~~")
pg.event.once('layer_right_show_excellent_end', () => { pg.event.once('layer_right_show_excellent_end', () => {
pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量 pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量
......
...@@ -261,9 +261,9 @@ let pg = { ...@@ -261,9 +261,9 @@ let pg = {
if (w && h && custom) { if (w && h && custom) {
let scaleX = w / nw; let scaleX = w / nw;
let scaleY = h / nh; let scaleY = h / nh;
// let scale = scaleX <= scaleY ? scaleX : scaleY; let scale = scaleX <= scaleY ? scaleX : scaleY;
node.width = nw * scaleX; node.width = nw * scale;
node.height = nh * scaleY; node.height = nh * scale;
} }
node.active = true; node.active = true;
resolve({ w: nw, h: nh }); resolve({ w: nw, h: nh });
......
...@@ -2,31 +2,31 @@ export const defaultData = { ...@@ -2,31 +2,31 @@ export const defaultData = {
"points": "", "points": "",
"questionScore": 0, "questionScore": 0,
"questions": [{ "questions": [{
"options": [{ "options": [{
"type": "img", "type": "img",
"image": "", "image": "",
"audio": "", "audio": "",
"text": "", "text": "",
"time": "", "time": "",
"right": false "right": false
}, { }, {
"type": "img", "type": "img",
"image": "", "image": "",
"audio": "", "audio": "",
"text": "", "text": "",
"time": "", "time": "",
"right": false "right": false
}, { }, {
"type": "img", "type": "img",
"image": "", "image": "",
"audio": "", "audio": "",
"text": "", "text": "",
"time": "", "time": "",
"right": false "right": false
}
],
"type": "img"
} }
],
"type": "img"
}
], ],
"bgItem": { "bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/933163fae966edff0633a0bb97e5c5bc.jpg", "url": "http://staging-teach.cdn.ireadabc.com/933163fae966edff0633a0bb97e5c5bc.jpg",
...@@ -38,106 +38,111 @@ export const defaultData = { ...@@ -38,106 +38,111 @@ export const defaultData = {
} }
}, },
"hotZoneItemArr": [{ "hotZoneItemArr": [{
"id": "1687246796178", "id": "1687246796178",
"index": 0, "index": 0,
"text": "low collar", "text": "low collar",
"itemType": "text", "audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"fontScale": 0.70625, "itemType": "text",
"imgScale": 1, "fontScale": 0.70625,
"imgSizeW": 0, "imgScale": 1,
"imgSizeH": 0, "imgSizeW": 0,
"mapScale": 0.70625, "imgSizeH": 0,
"dragDot": { "mapScale": 0.70625,
"x": 452, "dragDot": {
"y": 346 "x": 452,
}, "y": 346
"gIdx": "0", },
"fontSize": 50, "gIdx": "0",
"fontName": "ahronbd-1", "fontSize": 50,
"ontColor": "#8f3758", "fontName": "ahronbd-1",
"rect": { "ontColor": "#8f3758",
"width": 162.12, "rect": {
"height": 35.31, "width": 162.12,
"x": 466.94, "height": 35.31,
"y": 104.71 "x": 466.94,
} "y": 104.71
}, { }
"id": "1687246797020", }, {
"index": 1, "id": "1687246797020",
"text": " high collar", "index": 1,
"itemType": "text", "text": " high collar",
"fontScale": 0.70625, "audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"imgScale": 1, "itemType": "text",
"imgSizeW": 0, "fontScale": 0.70625,
"imgSizeH": 0, "imgScale": 1,
"mapScale": 0.70625, "imgSizeW": 0,
"dragDot": { "imgSizeH": 0,
"x": 452, "mapScale": 0.70625,
"y": 346 "dragDot": {
}, "x": 452,
"gIdx": "0", "y": 346
"fontSize": 50, },
"fontName": "ahronbd-1", "gIdx": "0",
"ontColor": "#8f3758", "fontSize": 50,
"rect": { "fontName": "ahronbd-1",
"width": 188.31, "ontColor": "#8f3758",
"height": 35.31, "rect": {
"x": 22.85, "width": 188.31,
"y": 67.71 "height": 35.31,
} "x": 22.85,
}, { "y": 67.71
"id": "1687246797521", }
"index": 2, }, {
"text": "long sleeve", "id": "1687246797521",
"itemType": "text", "index": 2,
"fontScale": 0.70625, "text": "long sleeve",
"imgScale": 1, "audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"imgSizeW": 0, "itemType": "text",
"imgSizeH": 0, "fontScale": 0.70625,
"mapScale": 0.70625, "imgScale": 1,
"dragDot": { "imgSizeW": 0,
"x": 452, "imgSizeH": 0,
"y": 346 "mapScale": 0.70625,
}, "dragDot": {
"gIdx": "0", "x": 452,
"fontSize": 50, "y": 346
"fontName": "ahronbd-1", },
"ontColor": "#8f3758", "gIdx": "0",
"rect": { "fontSize": 50,
"width": 190.79, "fontName": "ahronbd-1",
"height": 35.31, "ontColor": "#8f3758",
"x": 24.6, "rect": {
"y": 197.71 "width": 190.79,
} "height": 35.31,
}, { "x": 24.6,
"id": "1687246798099", "y": 197.71
"index": 3, }
"text": "short sleeve", }, {
"itemType": "text", "id": "1687246798099",
"fontScale": 0.70625, "index": 3,
"imgScale": 1, "text": "short sleeve",
"imgSizeW": 0, "audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"imgSizeH": 0, "itemType": "text",
"mapScale": 0.70625, "fontScale": 0.70625,
"dragDot": { "imgScale": 1,
"x": 452, "imgSizeW": 0,
"y": 346 "imgSizeH": 0,
}, "mapScale": 0.70625,
"gIdx": "0", "dragDot": {
"fontSize": 50, "x": 452,
"fontName": "ahronbd-1", "y": 346
"ontColor": "#8f3758", },
"rect": { "gIdx": "0",
"width": 202.88, "fontSize": 50,
"height": 35.31, "fontName": "ahronbd-1",
"x": 446.56, "ontColor": "#8f3758",
"y": 190.71 "rect": {
} "width": 202.88,
"height": 35.31,
"x": 446.56,
"y": 190.71
} }
}
], ],
"questionText": "", "questionText": "",
"npcTitle": "may", "npcTitle": "may",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/36067f9e2415d59fa37c3795a3929087_l.mp3", "npcAudio": "",
// "npcAudio": "http://staging-teach.cdn.ireadabc.com/36067f9e2415d59fa37c3795a3929087_l.mp3",
"npcAudioName": "bear_3.mp3" "npcAudioName": "bear_3.mp3"
} }
......
...@@ -41,6 +41,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -41,6 +41,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
{ {
name: '文本', name: '文本',
text: true, text: true,
audio: true,
// action: { // action: {
// type: 'text', // type: 'text',
// option: [ // option: [
......
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