Commit 61d20c99 authored by Tt's avatar Tt

流程走完

parent 15b7a9c9
......@@ -4401,7 +4401,7 @@
"__id__": 93
}
],
"_active": false,
"_active": true,
"_components": [
{
"__id__": 97
......
......@@ -28,10 +28,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initData();
this.initView();
this.initEvent();
// pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playEnter(this.data.npcAudio).then(() => {
// this.initGame();
// })
this.initGame();
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playEnter(this.data.npcAudio).then(() => {
this.initGame();
})
// this.initGame();
}
_cantouch = null;
......@@ -41,7 +41,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initData() {
// 所有全局变量 默认都是null
this._cantouch = true;
this.current = 0;
this.current = -1;
this.successArr = [];
this.questions = this.data.questions.map((question, id) => {
question.id = id;
......@@ -64,8 +64,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
// 初始化游戏
initGame() {
this.updateCanvas();
this.initLayoutBattery();
this.nextStage();
}
@property(cc.Node) layout_canvas: cc.Node = null;
......@@ -75,13 +74,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
@property(cc.Node) layout_battery_right: cc.Node = null;
@property(cc.Node) item_battery_text: cc.Node = null;
@property(cc.Node) item_battery_img: cc.Node = null;
updateCanvas() {
initCanvas() {
let img = pg.view.find(this.layout_canvas, 'img');
pg.view.setNetImg(img, this.currentQuestion.bgItem.url, { w: 1220, h: 790 }, false)
this.initTargets();
}
initTargets() {
this.layout_target.removeAllChildren();
let item_color = pg.view.find(this, 'item_color');
let arr = this.changepoints(this.currentQuestion);
arr.forEach((ar) => {
......@@ -245,15 +245,31 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.off(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
node.x = targetData.pos.x;
node.y = targetData.pos.y;
node.parent = this.layout_items
node.parent = this.layout_items;
// 处理完成就结束了
this.successArr.push(targetData);
// 处理完成
if (this.successArr.length == this.currentQuestion.hotZoneItemArr.length) {
this.nextStage();
}
}
onMeetFail(node) {
node.x = node.cPos.x;
node.y = node.cPos.y;
}
nextStage() {
// 处理下一个数
if (!this.nextQuestion) {
this.gameOver();
return;
}
this.current++
this.successArr = [];
this.layout_items.removeAllChildren();
this.initCanvas();
this.initLayoutBattery();
}
private waitTime: number;
update(dt) {
if (!this.waitTime) this.waitTime = 8;
......@@ -291,7 +307,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}, 0.5)
}
pg.view.touchOn(pg.view.find(this, 'layout_xiaodi/btn_go'), this.onTouchExit, this);
pg.view.setString(pg.view.find(this, 'layout_xiaodi/btn_go/txt'), this.data.npcAudioText)
pg.view.setString(pg.view.find(this, 'layout_xiaodi/btn_go/txt'), this.data.npcTitle)
pg.view.find(this, 'layout_xiaodi').active = true;
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playOver(this.data.npcAudioEnd)
}
......@@ -301,12 +317,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playOverEnd()
}
private gameOver() {
pg.audio.playAudioByUrl(this.data.auidoEnd).then(() => {
pg.audio.playAudioByUrl(this.data.auidoFinish).then(() => {
// onHomeworkFinish(data)
this.showXiaodi();
})
})
this.showXiaodi();
}
onTouchExit() {
const middleLayer = cc.find('middleLayer')?.getComponent('middleLayer');
......
export const defaultData =
{"npcTitle":"exit","npcAudio":"http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3","npcAudioName":"boom_dg28_drag.mp3","npcAudioEnd":"http://staging-teach.cdn.ireadabc.com/289fe0a6d9893519c3fb5993b86b6fe9_l.mp3","npcAudioEndName":"dragdown_dg28_drag.mp3","questions":[{"options":[{"audio":"","hotZoneItemArr":[],"bgItem":"","right":false},{"audio":"","hotZoneItemArr":[],"bgItem":"","right":false},{"audio":"","hotZoneItemArr":[],"bgItem":"","right":false}],"type":"img","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/f627ed930909e43e823cd79ed90aaea3.png","rect":{"x":90.8694029850746,"y":0,"width":910.2611940298508,"height":595}},"hotZoneItemArr":[{"index":0,"text":"part1","itemType":"text","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":261.13,"y":44.5,"width":200,"height":200}},{"index":1,"text":"part2","itemType":"text","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":512.13,"y":45.5,"width":200,"height":200}},{"index":2,"text":"part3","itemType":"text","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":355.13,"y":151.5,"width":200,"height":200}},{"index":3,"text":"part4","itemType":"text","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":743.13,"y":155.5,"width":200,"height":200}},{"index":4,"text":"part5","itemType":"text","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":263.13,"y":281.5,"width":200,"height":200}},{"index":5,"text":"part6","itemType":"text","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":564.13,"y":278.5,"width":200,"height":200}},{"index":6,"pic_url":"http://staging-teach.cdn.ireadabc.com/be8ec5cee7a3074440478b00a4a84f5e.png","itemType":"pic","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":0.44287909836065575,"mapScale":0.853125,"rect":{"x":23.13,"y":44.5,"width":200,"height":200}},{"index":7,"pic_url":"http://staging-teach.cdn.ireadabc.com/a5d393ae3c9759211c441f8d3fc69e04.png","itemType":"pic","fontSize":50,"fontName":"BRLNSR_1","fontColor":"#8f3758","fontScale":0.853125,"imgScale":1.1256510416666667,"mapScale":0.853125,"rect":{"x":16.13,"y":318.5,"width":200,"height":200}}],"hotZoneFontObj":{"size":50,"name":"BRLNSR_1","color":"#8f3758"}},{"options":[],"type":"img","bgItem":{"url":"http://staging-teach.cdn.ireadabc.com/8b565a3db344386ab9cde226cc1411f2.jpg","rect":{"x":72.15060240963851,"y":0,"width":947.698795180723,"height":595}},"hotZoneItemArr":[{"index":0,"text":"download","itemType":"text","fontSize":"40","fontName":"BRLNSR_1","fontColor":"#FF0000","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":122.84,"y":71.5,"width":200,"height":200}},{"index":1,"text":"app","itemType":"text","fontSize":"40","fontName":"BRLNSR_1","fontColor":"#FF0000","fontScale":0.853125,"imgScale":1,"mapScale":0.853125,"rect":{"x":176.84,"y":270.5,"width":200,"height":200}}],"hotZoneFontObj":{"size":"40","name":"BRLNSR_1","color":"#FF0000"}}],"bgItem":"","hotZoneItemArr":[]}
{
"npcTitle": "exit", "npcAudio": "http://staging-teach.cdn.ireadabc.com/5f4e4c72671607bb35d1ecd1d291f238_l.mp3",
"npcAudioName": "boom_dg28_drag.mp3",
"npcAudioEnd": "http://staging-teach.cdn.ireadabc.com/289fe0a6d9893519c3fb5993b86b6fe9_l.mp3",
"npcAudioEndName": "dragdown_dg28_drag.mp3",
"questions": [{
"options": [{ "audio": "", "hotZoneItemArr": [], "bgItem": "", "right": false },
{ "audio": "", "hotZoneItemArr": [], "bgItem": "", "right": false },
{ "audio": "", "hotZoneItemArr": [], "bgItem": "", "right": false }],
"type": "img",
"bgItem": {
"url": "http://staging-teach.cdn.ireadabc.com/f627ed930909e43e823cd79ed90aaea3.png", "rect": { "x": 90.8694029850746, "y": 0, "width": 910.2611940298508, "height": 595 }
}, "hotZoneItemArr": [
{
"index": 0, "text": "part1", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 261.13, "y": 44.5, "width": 200, "height": 200 }
}, {
"index": 1, "text": "part2", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 512.13, "y": 45.5, "width": 200, "height": 200 }
}, {
"index": 2, "text": "part3", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 355.13, "y": 151.5, "width": 200, "height": 200 }
}, {
"index": 3, "pic_url": "http://staging-teach.cdn.ireadabc.com/be8ec5cee7a3074440478b00a4a84f5e.png", "itemType": "pic", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 0.44287909836065575, "mapScale": 0.853125, "rect": { "x": 23.13, "y": 44.5, "width": 200, "height": 200 }
}], "hotZoneFontObj": { "size": 50, "name": "BRLNSR_1", "color": "#8f3758" }
}, {
"options": [], "type": "img", "bgItem": { "url": "http://staging-teach.cdn.ireadabc.com/8b565a3db344386ab9cde226cc1411f2.jpg", "rect": { "x": 72.15060240963851, "y": 0, "width": 947.698795180723, "height": 595 } }, "hotZoneItemArr": [{ "index": 0, "text": "download", "itemType": "text", "fontSize": "40", "fontName": "BRLNSR_1", "fontColor": "#FF0000", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 122.84, "y": 71.5, "width": 200, "height": 200 } }, { "index": 1, "text": "app", "itemType": "text", "fontSize": "40", "fontName": "BRLNSR_1", "fontColor": "#FF0000", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 176.84, "y": 270.5, "width": 200, "height": 200 } }], "hotZoneFontObj": { "size": "40", "name": "BRLNSR_1", "color": "#FF0000" }
}], "bgItem": "", "hotZoneItemArr": []
}
const b = {
"npcTitle": "exit",
......@@ -34,15 +59,11 @@ const b = {
}, {
"index": 1, "text": "part2", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": -19.11, "y": -59.5, "width": 200, "height": 200 }
}, {
"index": 2, "text": "part3", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 889.89, "y": -48.5, "width": 200, "height": 200 }
}, {
"index": 3, "text": "part4", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": -27.11, "y": 452.5, "width": 200, "height": 200 }
}, {
"index": 4, "text": "part5", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 883.89, "y": 460.5, "width": 200, "height": 200 }
"index": 2, "text": "part4", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": -27.11, "y": 452.5, "width": 200, "height": 200 }
}, {
"index": 5, "pic_url": "http://staging-teach.cdn.ireadabc.com/be8ec5cee7a3074440478b00a4a84f5e.png", "itemType": "pic", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 0.44287909836065575, "mapScale": 0.853125, "rect": { "x": 6.89, "y": 79.5, "width": 200, "height": 200 }
"index": 3, "text": "part5", "itemType": "text", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1, "mapScale": 0.853125, "rect": { "x": 883.89, "y": 460.5, "width": 200, "height": 200 }
}, {
"index": 6, "pic_url": "http://staging-teach.cdn.ireadabc.com/a5d393ae3c9759211c441f8d3fc69e04.png", "itemType": "pic", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 1.1256510416666667, "mapScale": 0.853125, "rect": { "x": 870.89, "y": 294.5, "width": 200, "height": 200 }
"index": 4, "pic_url": "http://staging-teach.cdn.ireadabc.com/be8ec5cee7a3074440478b00a4a84f5e.png", "itemType": "pic", "fontSize": 50, "fontName": "BRLNSR_1", "fontColor": "#8f3758", "fontScale": 0.853125, "imgScale": 0.44287909836065575, "mapScale": 0.853125, "rect": { "x": 6.89, "y": 79.5, "width": 200, "height": 200 }
}],
"hotZoneFontObj": {
"size": 50,
......
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