Commit 2d52c6ee authored by yu's avatar yu

1

parent ebb8fa92
......@@ -36,6 +36,7 @@ export class ItemJigsaw {
constructor(data, page) {
// this.audio = data.audio;
this.image = data.pic_url;
this.audio = data.audio_url;
// this.voice = data.voice;
// this.time = data.time;
this.id = page;
......
This diff is collapsed.
......@@ -71,6 +71,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
Game.getIns().init(this.data);
Game.getIns().reset();
this.cardBgs = [];
this.isOver = false;
}
initView() {
......@@ -154,6 +155,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
desc.active = true;
let data: any = {};
data.text = dt.text;
data.audio = dt.audio_url || "";
data.parent = ch;
data.x = desc.x;
data.y = desc.y;
......@@ -257,8 +259,6 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
return;
}
this.playLocalAudio("right");
target.parent = data.parent;
target.setPosition(data.x, data.y);
target.active = false;
......@@ -269,12 +269,15 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
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()) {
await asyncDelay(0.5);
pg.event.emit("gameOver");
}
});
});
}
private cleanLayoutSort() {
this.cardBgs.forEach((item) => {
......@@ -300,8 +303,10 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
if (this.currentCards.length != this.cards.length) return false;
return this.currentCards.every(card => !!card);
}
private isOver = false;
gameOver() {
if (this.isOver) return;
this.isOver = true;
this.log("over ~~~~~~~~~~~~~~")
pg.event.once('layer_right_show_excellent_end', () => {
pg.event.emit('layer_coin_show_coin', 3) //1 2 3硬币数量
......
......@@ -261,9 +261,9 @@ let pg = {
if (w && h && custom) {
let scaleX = w / nw;
let scaleY = h / nh;
// let scale = scaleX <= scaleY ? scaleX : scaleY;
node.width = nw * scaleX;
node.height = nh * scaleY;
let scale = scaleX <= scaleY ? scaleX : scaleY;
node.width = nw * scale;
node.height = nh * scale;
}
node.active = true;
resolve({ w: nw, h: nh });
......
......@@ -41,6 +41,7 @@ export const defaultData = {
"id": "1687246796178",
"index": 0,
"text": "low collar",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text",
"fontScale": 0.70625,
"imgScale": 1,
......@@ -65,6 +66,7 @@ export const defaultData = {
"id": "1687246797020",
"index": 1,
"text": " high collar",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text",
"fontScale": 0.70625,
"imgScale": 1,
......@@ -89,6 +91,7 @@ export const defaultData = {
"id": "1687246797521",
"index": 2,
"text": "long sleeve",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text",
"fontScale": 0.70625,
"imgScale": 1,
......@@ -113,6 +116,7 @@ export const defaultData = {
"id": "1687246798099",
"index": 3,
"text": "short sleeve",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8_l.mp3",
"itemType": "text",
"fontScale": 0.70625,
"imgScale": 1,
......@@ -137,7 +141,8 @@ export const defaultData = {
],
"questionText": "",
"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"
}
......
......@@ -41,6 +41,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
{
name: '文本',
text: true,
audio: true,
// action: {
// type: 'text',
// 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