Commit 7e47d40f authored by yu's avatar yu

1

parent 685c53aa
import ImgVoice from "../common/script/ImgVoice_hy14_pipei"; import ImgVoice from "../common/script/ImgVoice_hy14_pipei";
export let imageZize = { export let imageZize = {
width: 1000, width: 1100,
height: 600 height: 572
} }
...@@ -83,10 +83,12 @@ export default class Game { ...@@ -83,10 +83,12 @@ export default class Game {
public tipSwitch: any; public tipSwitch: any;
public endImgTitle: any; public endImgTitle: any;
public jumpIdx: any; public jumpIdx: any;
public hotZoneItemArr: any;
public init(data) { public init(data) {
this.data = data;
this.start = false; this.start = false;
this.lists = []; this.lists = [];
this.data = data.hotZoneItemArr; this.hotZoneItemArr = data.hotZoneItemArr;
this.aniEnter = data.imgAni; this.aniEnter = data.imgAni;
this.endImgAni = data.endImgAni; this.endImgAni = data.endImgAni;
this.title = data.title; this.title = data.title;
...@@ -99,7 +101,7 @@ export default class Game { ...@@ -99,7 +101,7 @@ export default class Game {
this.tipSwitch = data.tipSwitch; this.tipSwitch = data.tipSwitch;
this.endImgTitle = data.endImgTitle; this.endImgTitle = data.endImgTitle;
this.jumpIdx = data.jumpIdx || -1; this.jumpIdx = data.jumpIdx || -1;
this.changepoints(data); // this.changepoints();
} }
public start: boolean; public start: boolean;
public page: number; public page: number;
...@@ -107,8 +109,8 @@ export default class Game { ...@@ -107,8 +109,8 @@ export default class Game {
this.page = 1; this.page = 1;
this.start = true; this.start = true;
this.lists = []; this.lists = [];
for (let i = 0; i < this.data.length; i++) { for (let i = 0; i < this.hotZoneItemArr.length; i++) {
let data = this.data[i]; let data = this.hotZoneItemArr[i];
this.lists.push(new ItemJigsaw(data, i)); this.lists.push(new ItemJigsaw(data, i));
} }
this.lists.sort(function () { this.lists.sort(function () {
...@@ -127,7 +129,18 @@ export default class Game { ...@@ -127,7 +129,18 @@ export default class Game {
return true; return true;
} }
public pointsArr; public pointsArr;
private changepoints(data) { public changepoints(wh: any) {
let data = this.data;
if (wh.w > 1150) {
imageZize.width = 1150;
let sx = imageZize.width / wh.w;
imageZize.height = wh.h * sx;
} else {
imageZize.width = wh.w;
imageZize.height = wh.h;
}
let scX = imageZize.width / data.bgItem.rect.width; let scX = imageZize.width / data.bgItem.rect.width;
let scY = imageZize.height / data.bgItem.rect.height; let scY = imageZize.height / data.bgItem.rect.height;
let px = data.bgItem.rect.x; let px = data.bgItem.rect.x;
...@@ -192,7 +205,7 @@ export default class Game { ...@@ -192,7 +205,7 @@ export default class Game {
return this.page > this.lists.length; return this.page > this.lists.length;
} }
get opdata() { get opdata() {
return this.data; return this.hotZoneItemArr;
} }
} }
......
This diff is collapsed.
...@@ -86,8 +86,14 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -86,8 +86,14 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
this.cardBgs = []; this.cardBgs = [];
//自动创建卡片 //自动创建卡片
let itembg = cc.find("itembg", this.node); let itembg = this.layout_sort;
pg.view.setNetImg(itembg, Game.getIns().image, { w: imageZize.width, h: imageZize.height }); // let itembg = cc.find("itembg", this.node);
pg.view.setNetImg(itembg, Game.getIns().image, { w: imageZize.width, h: imageZize.height }, false).then((data: any) => {
Game.getIns().changepoints(data);
itembg.width = imageZize.width;
itembg.height = imageZize.height;
this.creaetPosPic();
});
this.createCrads(); this.createCrads();
} }
...@@ -135,21 +141,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -135,21 +141,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
createCrads() { createCrads() {
this.layout_sort.removeAllChildren(); this.layout_sort.removeAllChildren();
let pos = Game.getIns().pointsArr;
pos.forEach((li, idx) => {
let item = cc.instantiate(this.item);
this.layout_sort.addChild(item);
item.x = li.x;
item.y = li.y;
item.active = true;
// let desc = cc.find("desc", item);
// desc.getComponent(cc.Label).string = li.text;
this.cardBgs.push(item);
let data = { text: li.text };
item.data = data;
item.width = li.width;
item.height = li.height;
})
let op = Game.getIns().opdata; let op = Game.getIns().opdata;
op.forEach((dt, idx) => { op.forEach((dt, idx) => {
...@@ -177,6 +169,23 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent { ...@@ -177,6 +169,23 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
}) })
cc.find("ScrollView", this.node).getComponent(cc.ScrollView).enabled = op.length > 4; cc.find("ScrollView", this.node).getComponent(cc.ScrollView).enabled = op.length > 4;
} }
private creaetPosPic() {
let pos = Game.getIns().pointsArr;
pos.forEach((li, idx) => {
let item = cc.instantiate(this.item);
this.layout_sort.addChild(item);
item.x = li.x;
item.y = li.y;
item.active = true;
// let desc = cc.find("desc", item);
// desc.getComponent(cc.Label).string = li.text;
this.cardBgs.push(item);
let data = { text: li.text };
item.data = data;
item.width = li.width;
item.height = li.height;
})
}
private stSction(node) { private stSction(node) {
cc.tween(node).repeatForever(cc.tween().by(1, { y: 10 }).by(1, { y: -10 })).start(); cc.tween(node).repeatForever(cc.tween().by(1, { y: 10 }).by(1, { y: -10 })).start();
......
...@@ -262,8 +262,8 @@ let pg = { ...@@ -262,8 +262,8 @@ let pg = {
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 * scale; node.width = nw * scaleX;
node.height = nh * scale; node.height = nh * scaleY;
} }
node.active = true; node.active = true;
resolve({ w: nw, h: nh }); resolve({ w: nw, h: nh });
......
...@@ -3,20 +3,19 @@ export const defaultData = { ...@@ -3,20 +3,19 @@ export const defaultData = {
"questionScore": 0, "questionScore": 0,
"questions": [], "questions": [],
"bgItem": { "bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/933163fae966edff0633a0bb97e5c5bc.jpg", "url": "http://staging-teach.cdn.ireadabc.com/bf9f3958a388f3e10e79f50ab786f5ef.png",
"rect": { "rect": {
"x": 0, "x": 0,
"y": 85.66, "y": 42.52,
"width": 902, "width": 902,
"height": 469.69 "height": 424.95
} }
}, },
"hotZoneItemArr": [ "hotZoneItemArr": [
{ {
"id": "1687750651003", "id": "1689504307224",
"index": 0, "index": 0,
"text": "high collar", "text": "the blue and green face",
"audio_url": "http://staging-teach.cdn.ireadabc.com/81c8ea51c42136db0fd61e78c38de7c9_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.7046875, "fontScale": 0.7046875,
"imgScale": 1, "imgScale": 1,
...@@ -25,24 +24,23 @@ export const defaultData = { ...@@ -25,24 +24,23 @@ export const defaultData = {
"mapScale": 0.7046875, "mapScale": 0.7046875,
"dragDot": { "dragDot": {
"x": 451, "x": 451,
"y": 297 "y": 255.00000000000003
}, },
"gIdx": "0", "gIdx": "0",
"fontSize": 50, "fontSize": 50,
"fontName": "ahronbd-1", "fontName": "ahronbd-1",
"ontColor": "#8f3758", "ontColor": "#8f3758",
"rect": { "rect": {
"width": 169.77, "width": 390.95,
"height": 35.23, "height": 35.23,
"x": 36.11, "x": 56.53,
"y": 65.19 "y": 44.86
} }
}, },
{ {
"id": "1687750664688", "id": "1689504345672",
"index": 1, "index": 1,
"text": "low collar", "text": "the gold face",
"audio_url": "http://staging-teach.cdn.ireadabc.com/9de7c90341afc24bcd2a311f4d554bdc_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.7046875, "fontScale": 0.7046875,
"imgScale": 1, "imgScale": 1,
...@@ -51,24 +49,23 @@ export const defaultData = { ...@@ -51,24 +49,23 @@ export const defaultData = {
"mapScale": 0.7046875, "mapScale": 0.7046875,
"dragDot": { "dragDot": {
"x": 451, "x": 451,
"y": 297 "y": 255.00000000000003
}, },
"gIdx": "0", "gIdx": "0",
"fontSize": 50, "fontSize": 50,
"fontName": "ahronbd-1", "fontName": "ahronbd-1",
"ontColor": "#8f3758", "ontColor": "#8f3758",
"rect": { "rect": {
"width": 156.28, "width": 217.16,
"height": 35.23, "height": 35.23,
"x": 467.86, "x": 118.42,
"y": 100.19 "y": 193.86
} }
}, },
{ {
"id": "1687750699335", "id": "1689504365755",
"index": 2, "index": 2,
"text": "long sleeve", "text": "the black face",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7474d2ea3660833373b9d3dfb2ad9d07_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.7046875, "fontScale": 0.7046875,
"imgScale": 1, "imgScale": 1,
...@@ -77,24 +74,23 @@ export const defaultData = { ...@@ -77,24 +74,23 @@ export const defaultData = {
"mapScale": 0.7046875, "mapScale": 0.7046875,
"dragDot": { "dragDot": {
"x": 451, "x": 451,
"y": 297 "y": 255.00000000000003
}, },
"gIdx": "0", "gIdx": "0",
"fontSize": 50, "fontSize": 50,
"fontName": "ahronbd-1", "fontName": "ahronbd-1",
"ontColor": "#8f3758", "ontColor": "#8f3758",
"rect": { "rect": {
"width": 182.88, "width": 233.29,
"height": 35.23, "height": 35.23,
"x": 13.56, "x": 116.35,
"y": 193.19 "y": 341.86
} }
}, },
{ {
"id": "1687750716437", "id": "1689504375545",
"index": 3, "index": 3,
"text": "short sleeve", "text": "the red face",
"audio_url": "http://staging-teach.cdn.ireadabc.com/172fad3743476ac9c668eb8a82d5eca1_l.mp3",
"itemType": "text", "itemType": "text",
"fontScale": 0.7046875, "fontScale": 0.7046875,
"imgScale": 1, "imgScale": 1,
...@@ -103,26 +99,48 @@ export const defaultData = { ...@@ -103,26 +99,48 @@ export const defaultData = {
"mapScale": 0.7046875, "mapScale": 0.7046875,
"dragDot": { "dragDot": {
"x": 451, "x": 451,
"y": 297 "y": 255.00000000000003
}, },
"gIdx": "0", "gIdx": "0",
"fontSize": 50, "fontSize": 50,
"fontName": "ahronbd-1", "fontName": "ahronbd-1",
"ontColor": "#8f3758", "ontColor": "#8f3758",
"rect": { "rect": {
"width": 196.83, "width": 199.82,
"height": 35.23, "height": 35.23,
"x": 462.59, "x": 569.09,
"y": 186.19 "y": 81.86
} }
},
{
"id": "1689504389861",
"index": 4,
"text": "the white face",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 255.00000000000003
},
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 234.03,
"height": 35.23,
"x": 549.98,
"y": 301.86
} }
],
"questionText": "",
"npcTitle": "Mind Map",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/840c5d814e82b8dbc869d7523d592869_l.mp3",
"npcAudioName": "HY14位置匹配-将单词拖动到正确的位置.mp3"
} }
],
"npcTitle": "HY14",
"npcAudio": "",
// "npcAudio": "http://staging-teach.cdn.ireadabc.com/840c5d814e82b8dbc869d7523d592869_l.mp3",
"npcAudioName": "HY14位置匹配-将单词拖动到正确的位置.mp3",
"questionText": ""
}
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