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);
pg.audio.playAudioByUrl(data.audio).then(async () => {
if (this.checkRoundEnd()) { if (this.checkRoundEnd()) {
await asyncDelay(0.5);
pg.event.emit("gameOver"); 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 });
......
...@@ -41,6 +41,7 @@ export const defaultData = { ...@@ -41,6 +41,7 @@ export const defaultData = {
"id": "1687246796178", "id": "1687246796178",
"index": 0, "index": 0,
"text": "low collar", "text": "low collar",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.70625, "fontScale": 0.70625,
"imgScale": 1, "imgScale": 1,
...@@ -65,6 +66,7 @@ export const defaultData = { ...@@ -65,6 +66,7 @@ export const defaultData = {
"id": "1687246797020", "id": "1687246797020",
"index": 1, "index": 1,
"text": " high collar", "text": " high collar",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.70625, "fontScale": 0.70625,
"imgScale": 1, "imgScale": 1,
...@@ -89,6 +91,7 @@ export const defaultData = { ...@@ -89,6 +91,7 @@ export const defaultData = {
"id": "1687246797521", "id": "1687246797521",
"index": 2, "index": 2,
"text": "long sleeve", "text": "long sleeve",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.70625, "fontScale": 0.70625,
"imgScale": 1, "imgScale": 1,
...@@ -113,6 +116,7 @@ export const defaultData = { ...@@ -113,6 +116,7 @@ export const defaultData = {
"id": "1687246798099", "id": "1687246798099",
"index": 3, "index": 3,
"text": "short sleeve", "text": "short sleeve",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.70625, "fontScale": 0.70625,
"imgScale": 1, "imgScale": 1,
...@@ -137,7 +141,8 @@ export const defaultData = { ...@@ -137,7 +141,8 @@ export const defaultData = {
], ],
"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