Commit 7e47d40f authored by yu's avatar yu

1

parent 685c53aa
import ImgVoice from "../common/script/ImgVoice_hy14_pipei";
export let imageZize = {
width: 1000,
height: 600
width: 1100,
height: 572
}
......@@ -83,10 +83,12 @@ export default class Game {
public tipSwitch: any;
public endImgTitle: any;
public jumpIdx: any;
public hotZoneItemArr: any;
public init(data) {
this.data = data;
this.start = false;
this.lists = [];
this.data = data.hotZoneItemArr;
this.hotZoneItemArr = data.hotZoneItemArr;
this.aniEnter = data.imgAni;
this.endImgAni = data.endImgAni;
this.title = data.title;
......@@ -99,7 +101,7 @@ export default class Game {
this.tipSwitch = data.tipSwitch;
this.endImgTitle = data.endImgTitle;
this.jumpIdx = data.jumpIdx || -1;
this.changepoints(data);
// this.changepoints();
}
public start: boolean;
public page: number;
......@@ -107,8 +109,8 @@ export default class Game {
this.page = 1;
this.start = true;
this.lists = [];
for (let i = 0; i < this.data.length; i++) {
let data = this.data[i];
for (let i = 0; i < this.hotZoneItemArr.length; i++) {
let data = this.hotZoneItemArr[i];
this.lists.push(new ItemJigsaw(data, i));
}
this.lists.sort(function () {
......@@ -127,7 +129,18 @@ export default class Game {
return true;
}
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 scY = imageZize.height / data.bgItem.rect.height;
let px = data.bgItem.rect.x;
......@@ -192,7 +205,7 @@ export default class Game {
return this.page > this.lists.length;
}
get opdata() {
return this.data;
return this.hotZoneItemArr;
}
}
......
This diff is collapsed.
......@@ -86,8 +86,14 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
this.cardBgs = [];
//自动创建卡片
let itembg = cc.find("itembg", this.node);
pg.view.setNetImg(itembg, Game.getIns().image, { w: imageZize.width, h: imageZize.height });
let itembg = this.layout_sort;
// 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();
}
......@@ -135,21 +141,7 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
createCrads() {
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;
op.forEach((dt, idx) => {
......@@ -177,6 +169,23 @@ export default class PuzzleJigsaw extends MyCocosSceneComponent {
})
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) {
cc.tween(node).repeatForever(cc.tween().by(1, { y: 10 }).by(1, { y: -10 })).start();
......
......@@ -262,8 +262,8 @@ let pg = {
let scaleX = w / nw;
let scaleY = h / nh;
let scale = scaleX <= scaleY ? scaleX : scaleY;
node.width = nw * scale;
node.height = nh * scale;
node.width = nw * scaleX;
node.height = nh * scaleY;
}
node.active = true;
resolve({ w: nw, h: nh });
......
export const defaultData = {
"points": "",
"questionScore": 0,
"questions": [],
"bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/933163fae966edff0633a0bb97e5c5bc.jpg",
export const defaultData = {
"points": "",
"questionScore": 0,
"questions": [],
"bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/bf9f3958a388f3e10e79f50ab786f5ef.png",
"rect": {
"x": 0,
"y": 42.52,
"width": 902,
"height": 424.95
}
},
"hotZoneItemArr": [
{
"id": "1689504307224",
"index": 0,
"text": "the blue and green 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": 390.95,
"height": 35.23,
"x": 56.53,
"y": 44.86
}
},
{
"id": "1689504345672",
"index": 1,
"text": "the gold 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": {
"x": 0,
"y": 85.66,
"width": 902,
"height": 469.69
"width": 217.16,
"height": 35.23,
"x": 118.42,
"y": 193.86
}
},
"hotZoneItemArr": [
{
"id": "1687750651003",
"index": 0,
"text": "high collar",
"audio_url": "http://staging-teach.cdn.ireadabc.com/81c8ea51c42136db0fd61e78c38de7c9_l.mp3",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 297
},
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 169.77,
"height": 35.23,
"x": 36.11,
"y": 65.19
}
{
"id": "1689504365755",
"index": 2,
"text": "the black face",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 255.00000000000003
},
{
"id": "1687750664688",
"index": 1,
"text": "low collar",
"audio_url": "http://staging-teach.cdn.ireadabc.com/9de7c90341afc24bcd2a311f4d554bdc_l.mp3",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 297
},
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 156.28,
"height": 35.23,
"x": 467.86,
"y": 100.19
}
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 233.29,
"height": 35.23,
"x": 116.35,
"y": 341.86
}
},
{
"id": "1689504375545",
"index": 3,
"text": "the red face",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 255.00000000000003
},
{
"id": "1687750699335",
"index": 2,
"text": "long sleeve",
"audio_url": "http://staging-teach.cdn.ireadabc.com/7474d2ea3660833373b9d3dfb2ad9d07_l.mp3",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 297
},
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 182.88,
"height": 35.23,
"x": 13.56,
"y": 193.19
}
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 199.82,
"height": 35.23,
"x": 569.09,
"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
},
{
"id": "1687750716437",
"index": 3,
"text": "short sleeve",
"audio_url": "http://staging-teach.cdn.ireadabc.com/172fad3743476ac9c668eb8a82d5eca1_l.mp3",
"itemType": "text",
"fontScale": 0.7046875,
"imgScale": 1,
"imgSizeW": 0,
"imgSizeH": 0,
"mapScale": 0.7046875,
"dragDot": {
"x": 451,
"y": 297
},
"gIdx": "0",
"fontSize": 50,
"fontName": "ahronbd-1",
"ontColor": "#8f3758",
"rect": {
"width": 196.83,
"height": 35.23,
"x": 462.59,
"y": 186.19
}
"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