Commit 7558dbf9 authored by Tt's avatar Tt

小迪增加 待添加音效等

parent dc66bee6
This diff is collapsed.
import { asyncDelay, onHomeworkFinish } from "../script/util";
import { MyCocosSceneComponent } from "../script/MyCocosSceneComponent";
import pg from "./pg";
import dg_xiaodi from "./dg28_drag_xiaodi";
const { ccclass, property } = cc._decorator;
......@@ -27,6 +28,7 @@ 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)
this.initGame();
}
......@@ -179,6 +181,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
meetCurrentTouchNode: cc.Node;
onTouchMeetStart(event) {
this.waitTime = 8;
if (this.guide == 1) return;
let node = event.target;
if (!node.data) node = node.parent;
......@@ -188,6 +191,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.cPos = cc.v2(node);
}
onTouchMeetMove(event) {
this.waitTime = 8;
if (this.guide == 1) return;
// 移动
let node = event.target;
......@@ -202,6 +206,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.y += pos.y;
}
onTouchMeetEnd(event) {
this.waitTime = 8;
if (this.guide == 1) return;
let node = event.target;
if (!node.data) node = node.parent;
......@@ -313,6 +318,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
vegetableCurrentTouchNode: cc.Node;
onTouchVegetableStart(event) {
this.waitTime = 8;
if (this.guide == 0) return;
let node = event.target;
if (!node.data) node = node.parent;
......@@ -322,6 +328,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.cPos = cc.v2(node);
}
onTouchVegetableMove(event) {
this.waitTime = 8;
if (this.guide == 0) return;
// 移动
let node = event.target;
......@@ -336,6 +343,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
node.y += pos.y;
}
onTouchVegetableEnd(event) {
this.waitTime = 8;
if (this.guide == 0) return;
let node = event.target;
if (!node.data) node = node.parent;
......@@ -385,6 +393,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
static pieDefaultPos: cc.Vec2 = cc.v2(48.822, 58.632);
static pieStartPos: cc.Vec2 = cc.v2(48.822, 693.308);
showPie() {
this.waitTime = 8;
this.scheduleOnce(() => {
let node = pg.view.clone(this.item_pie);
this.layout_pie.addChild(node)
......@@ -399,6 +408,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
ani.active = true;
pg.view.playDBAnimation(ani, 'normal', 1)
node.parent = this.currentMain
}).delay(0.5).call(() => {
this.nextStage();
})
.start();
}, 0.2)
......@@ -415,8 +426,17 @@ export default class SceneComponent extends MyCocosSceneComponent {
img.active = false;
}
let img_text = pg.view.find(item, 'img_text');
if (data.pieType == 'img_text') {
img_text.active = true;
let str = this.getText(data.pieTextArr, `#AF5725`, `#00580A`);
img_text.getComponent(cc.RichText).string = str;
} else {
img_text.active = false;
}
let text = pg.view.find(item, 'text');
if (data.pieType.indexOf('text') > -1) {
if (data.pieType == 'text') {
text.active = true;
let str = this.getText(data.pieTextArr, `#AF5725`, `#00580A`);
text.getComponent(cc.RichText).string = str;
......@@ -495,6 +515,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
// ----------------------------------题目切换---------------------------------
// 下一题刷新选项
nextStage() {
if (!this.nextQuestion) {
this.gameOver();
return
}
this.waitTime = 8;
this.hideGuide();
// 两边丢弃
this.discardCurrent();
......@@ -512,7 +537,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.updateBtns();
}
lastStage() {
this.waitTime = 8;
this.hideGuide();
// 先把当前的还原
this.resetCurrent();
// 两边放入
this.createCurrent();
// 中间移出
......@@ -523,14 +551,35 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.current -= 1;
this.successArr = [];
this.currentMain = node;
this.visibleMeetList();
this.visibleVegetableList();
this.updateBtns();
}
discardCurrent() {
if (this.meetCurrentNode) {
this.meetCurrentNode.parent = this.currentMain
this.meetNodes.pop();
}
if (this.vegetableCurrentNode) {
this.vegetableCurrentNode.parent = this.currentMain
this.vegetableNodes.pop();
}
}
resetCurrent() {
let lastId = this.current;
let questionId = this.questions.length - 1 - lastId;
if (!this.meetCurrentNode) {
let meet = this.createMeet(this.preQuestion, questionId)
// let tPosMeet = cc.v2(meet);
// meet.y += 1000
// cc.tween(meet).to(1, { x: tPosMeet.x, y: tPosMeet.y - 30 }).to(0.1, { y: tPosMeet.y }).start()
}
if (!this.vegetableCurrentNode) {
let vegetable = this.createVegetable(this.preQuestion, questionId)
// let tPosVegetable = cc.v2(vegetable);
// vegetable.y += 1000
// cc.tween(vegetable).to(1, { x: tPosVegetable.x, y: tPosVegetable.y - 30 }).to(0.1, { y: tPosVegetable.y }).start()
}
}
createCurrent() {
......@@ -562,11 +611,13 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 用户点击下一页, 面包移出画面。 当不做题的时候点击。面包向下移出,蔬菜和肉饼乡下移动回来。
onTouchNext() {
if (this.guide < 2) return;
// 前往下一页
this.nextStage();
}
// 往前翻,向下移动上面下来一个新的内容。 天上掉落内容。
onTouchLast() {
if (this.guide < 2) return;
//
this.lastStage();
}
......@@ -606,9 +657,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
line_right.active = false;
}
showGuideLeft() {
this.showGuideReal('left')
let layout_tip = pg.view.find(this, 'layout_tip');
let line_left = pg.view.find(layout_tip, 'line_left');
if (line_left.active) return;
this.showGuideReal('left')
let finger = pg.view.find(line_left, 'finger');
cc.tween(finger).repeatForever(
cc.tween().call(() => {
......@@ -618,9 +670,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
).start();
}
showGuideRight() {
this.showGuideReal('right')
let layout_tip = pg.view.find(this, 'layout_tip');
let line_right = pg.view.find(layout_tip, 'line_right');
if (line_right.active) return;
this.showGuideReal('right')
let finger = pg.view.find(line_right, 'finger');
cc.tween(finger).repeatForever(
cc.tween().call(() => {
......@@ -638,14 +691,47 @@ export default class SceneComponent extends MyCocosSceneComponent {
}
private waitTime: number;
update(dt) {
if (!this.waitTime) this.waitTime = 8;
this.waitTime -= dt;
if (this.waitTime < 0) {
this.waitTime = 8
this.showGuide();
}
}
//小迪右跑左。 抛出画面
showXiaodi() {
if (!this.data.npcAudioEnd) return;
pg.view.find(this, 'layout_xiaodi/btn_go').active = false;
if (this.data.npcAudioText) {
this.scheduleOnce(() => {
pg.view.find(this, 'layout_xiaodi/btn_go').active = true;
}, 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.find(this, 'layout_xiaodi').active = true;
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playOver(this.data.npcAudioEnd)
}
hideXiaodi() {
if (!this.data.npcAudioEnd) return;
pg.view.find(this, 'layout_xiaodi').active = false;
pg.view.find(this, 'layout_xiaodi').getComponent(dg_xiaodi).playOverEnd()
}
private gameOver() {
// onHomeworkFinish(data)
this.showXiaodi();
}
onTouchExit() {
const middleLayer = cc.find('middleLayer')?.getComponent('middleLayer');
if (middleLayer) {
middleLayer.goNextPage(); // 跳转到下一页
// middleLayer.exitGame(null);
} else {
console.log("==触发返回事件==");
}
// 所有题做完,小迪入场结束 + 退出按钮
endXiaodi() {
}
playLocalAudio(audioName) {
......
......@@ -46,6 +46,7 @@ export default class dg_xiaodi extends cc.Component {
.to(0.5, { x: -1800 })
.call(() => {
this.scheduleOnce(() => {
this.playEnterEnd()
resolve('');
}, 0.5)
})
......
export const defaultData =
{
"npcTitle": "",
"npcAudio": "http://staging-teach.cdn.ireadabc.com/5214110bd03ae60f70e44c2e930f85ca_l.mp3",
"npcAudioEnd": "http://staging-teach.cdn.ireadabc.com/c14938125a52096dc0be9fbbf6638cb2_l.mp3",
"questions": [
{
"type": "img", "mainType": "empty", "mainText": "this is info",
......
{
"ver": "1.1.2",
"uuid": "0ef921d2-078b-40ac-981e-b797ef85fb30",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.2",
"uuid": "7d1abf8b-659d-459d-bd63-245041433beb",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "34050f77-f719-46e0-bcd3-380be6bcc75e",
"subMetas": {}
}
\ No newline at end of file
{"name":"Dge","imagePath":"Dge_tex.png","SubTexture":[{"name":"wave/图层_45","x":248,"height":174,"y":1105,"width":149},{"name":"good/图层40_0","x":834,"height":90,"y":1374,"width":71},{"name":"good/图层 36_0","x":518,"height":102,"y":1449,"width":79},{"name":"wave/图层_44","x":1,"height":84,"y":1619,"width":86},{"name":"cheer/图层42_2","x":390,"height":91,"y":1471,"width":87},{"name":"cheer/图层42","x":245,"height":84,"y":1607,"width":90},{"name":"run/图层_73","x":1394,"height":67,"y":210,"width":79},{"name":"run/图层 61_0","x":1349,"height":178,"y":810,"width":133},{"name":"run/图层_65","x":479,"height":71,"y":1452,"width":30},{"name":"run/图层44","x":1892,"height":99,"y":1049,"width":122},{"name":"run/图层_64","x":1148,"height":207,"y":1,"width":332},{"name":"run/图层38(2)","x":1952,"height":123,"y":670,"width":82},{"name":"run/图层_68","x":1148,"height":266,"y":210,"width":244},{"name":"run/身体","x":897,"height":285,"y":1,"width":249},{"name":"run/图层_66","x":156,"height":77,"y":1526,"width":71},{"name":"run/图层_72","x":156,"height":87,"y":1607,"width":87},{"name":"run/图层_61","x":1,"height":127,"y":1295,"width":241},{"name":"run/头","x":1,"height":413,"y":1,"width":454},{"name":"run/嘴巴","x":1785,"height":47,"y":612,"width":48},{"name":"run/半睁","x":1033,"height":76,"y":664,"width":64},{"name":"run/闭眼","x":441,"height":199,"y":428,"width":243},{"name":"run/眼睛","x":1713,"height":76,"y":748,"width":64},{"name":"run/图层_74","x":312,"height":15,"y":1547,"width":59},{"name":"run/眼镜","x":599,"height":130,"y":1001,"width":242},{"name":"run/耳套","x":1892,"height":119,"y":928,"width":118},{"name":"expect/左脚_0","x":390,"height":95,"y":1355,"width":126},{"name":"good/右脚","x":1420,"height":94,"y":1165,"width":126},{"name":"expect/图层 45_0","x":1394,"height":263,"y":280,"width":196},{"name":"good/右腿","x":636,"height":265,"y":734,"width":137},{"name":"expect/左脚","x":762,"height":95,"y":1262,"width":126},{"name":"good/左脚","x":1670,"height":94,"y":1086,"width":127},{"name":"good/左腿","x":255,"height":265,"y":838,"width":143},{"name":"expect/图层_45","x":1127,"height":263,"y":478,"width":196},{"name":"good/图层35_0","x":1219,"height":202,"y":810,"width":128},{"name":"expect/图层 37_2","x":1848,"height":176,"y":492,"width":167},{"name":"good/图层_46","x":1084,"height":142,"y":930,"width":133},{"name":"wave/图层43","x":838,"height":199,"y":798,"width":224},{"name":"cheer/图层 46_0","x":1325,"height":134,"y":674,"width":219},{"name":"invite/图层_30","x":1219,"height":121,"y":1014,"width":199},{"name":"good/图层 35_0","x":1546,"height":165,"y":748,"width":165},{"name":"cheer/图层_37","x":1592,"height":153,"y":314,"width":237},{"name":"good/右手2_0","x":400,"height":163,"y":1033,"width":197},{"name":"talk/图层_47","x":1,"height":193,"y":1424,"width":153},{"name":"good/图层34_0","x":1017,"height":104,"y":1218,"width":150},{"name":"cheer/图层42_0","x":1799,"height":87,"y":1086,"width":90},{"name":"wave/图层42","x":1548,"height":92,"y":1165,"width":100},{"name":"good/图层40","x":1062,"height":90,"y":1324,"width":71},{"name":"cheer/图层42_1","x":608,"height":92,"y":1421,"width":88},{"name":"good/图层_36","x":1033,"height":102,"y":560,"width":80},{"name":"talk/图层42","x":518,"height":92,"y":1355,"width":88},{"name":"cheer/图层_46","x":1564,"height":134,"y":612,"width":219},{"name":"invite/图层 30_0","x":1219,"height":121,"y":1137,"width":199},{"name":"good/图层_35","x":1785,"height":165,"y":670,"width":165},{"name":"cheer/图层 37_0","x":1,"height":164,"y":1001,"width":231},{"name":"good/右手2","x":400,"height":164,"y":867,"width":197},{"name":"talk/图层_46","x":400,"height":155,"y":1198,"width":206},{"name":"good/图层35","x":1909,"height":202,"y":1,"width":128},{"name":"expect/图层 37_1","x":1848,"height":176,"y":314,"width":167},{"name":"good/图层 46_0","x":1084,"height":142,"y":1074,"width":132},{"name":"wave/图层43_0","x":1,"height":161,"y":838,"width":252},{"name":"good/图层47_0","x":156,"height":100,"y":1424,"width":76},{"name":"good/身体","x":897,"height":270,"y":288,"width":228},{"name":"wave/图层_25","x":400,"height":20,"y":838,"width":29},{"name":"good/头","x":1,"height":420,"y":416,"width":438},{"name":"good/眉毛","x":1135,"height":25,"y":1341,"width":220},{"name":"talk/眉毛","x":1415,"height":25,"y":1330,"width":220},{"name":"invite/眉毛","x":1357,"height":23,"y":1357,"width":220},{"name":"expect/眉毛","x":312,"height":32,"y":1564,"width":221},{"name":"talk/闭嘴","x":1891,"height":17,"y":1150,"width":44},{"name":"cheer/闭嘴","x":1954,"height":22,"y":902,"width":57},{"name":"talk/张嘴","x":1420,"height":26,"y":1018,"width":44},{"name":"expect/张嘴","x":312,"height":40,"y":1505,"width":70},{"name":"good/张嘴","x":1420,"height":26,"y":990,"width":44},{"name":"wave/闭嘴","x":1420,"height":26,"y":1046,"width":43},{"name":"expect/闭嘴","x":1592,"height":26,"y":280,"width":66},{"name":"good/张嘴_0","x":636,"height":26,"y":690,"width":44},{"name":"wave/张嘴","x":1660,"height":32,"y":280,"width":43},{"name":"invite/闭嘴","x":1349,"height":17,"y":990,"width":44},{"name":"good/闭嘴","x":390,"height":17,"y":1452,"width":44},{"name":"invite/张嘴","x":1169,"height":26,"y":1218,"width":44},{"name":"cheer/张嘴","x":762,"height":40,"y":1133,"width":70},{"name":"invite/闭眼","x":1169,"height":37,"y":1302,"width":244},{"name":"good/睁眼_0","x":1638,"height":77,"y":928,"width":252},{"name":"wave/睁眼","x":1325,"height":127,"y":545,"width":237},{"name":"cheer/闭眼","x":1403,"height":37,"y":1261,"width":244},{"name":"wave/闭眼","x":1713,"height":89,"y":837,"width":239},{"name":"good/半睁","x":1638,"height":77,"y":1007,"width":252},{"name":"expect/睁眼","x":762,"height":77,"y":1183,"width":253},{"name":"good/睁眼","x":1420,"height":77,"y":1086,"width":248},{"name":"wave/睁眼_0","x":1,"height":126,"y":1167,"width":245},{"name":"good/闭眼","x":1799,"height":30,"y":1175,"width":247},{"name":"expect/图层 36_0","x":1325,"height":59,"y":478,"width":39},{"name":"expect/图层_36","x":636,"height":59,"y":629,"width":39},{"name":"point/左脚","x":608,"height":95,"y":1324,"width":126},{"name":"point/左腿","x":686,"height":304,"y":428,"width":150},{"name":"point/右脚","x":1909,"height":103,"y":205,"width":125},{"name":"point/右腿","x":1721,"height":311,"y":1,"width":186},{"name":"point/图层42","x":1954,"height":105,"y":795,"width":87},{"name":"point/已插入图像_1","x":1592,"height":141,"y":469,"width":254},{"name":"point/图层47","x":234,"height":100,"y":1505,"width":76},{"name":"point/身体","x":1482,"height":277,"y":1,"width":237},{"name":"point/图层34","x":1650,"height":92,"y":1268,"width":76},{"name":"point/头","x":457,"height":425,"y":1,"width":438},{"name":"point/半睁","x":843,"height":90,"y":1091,"width":239},{"name":"point/睁眼","x":843,"height":90,"y":999,"width":239},{"name":"point/闭眼","x":1169,"height":40,"y":1260,"width":232},{"name":"point/眉毛","x":1415,"height":28,"y":1300,"width":223},{"name":"point/已插入图像_0","x":988,"height":90,"y":1324,"width":72},{"name":"point/嘴巴2","x":1033,"height":41,"y":742,"width":24},{"name":"point/嘴巴1","x":1017,"height":30,"y":1183,"width":63},{"name":"point/已插入图像","x":244,"height":208,"y":1295,"width":144},{"name":"invite/图层_31","x":1484,"height":138,"y":915,"width":152},{"name":"invite/图层 31_0","x":608,"height":138,"y":1133,"width":152},{"name":"talk/图层40","x":1650,"height":84,"y":1182,"width":84},{"name":"talk/右手前","x":1064,"height":185,"y":743,"width":153},{"name":"good/图层_44","x":838,"height":236,"y":560,"width":193},{"name":"good/图层 44_0","x":441,"height":236,"y":629,"width":193},{"name":"expect/图层 39_2","x":890,"height":110,"y":1262,"width":96},{"name":"expect/图层 39_1","x":736,"height":110,"y":1359,"width":96}],"height":2048,"width":2048}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "fdc28b4f-46c5-4fe2-897b-50cad1d6c0f8",
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "2.3.5",
"uuid": "80a15deb-8c19-48a8-b5f6-5f8660dee093",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 2048,
"height": 2048,
"platformSettings": {},
"subMetas": {
"Dge_tex": {
"ver": "1.0.4",
"uuid": "4d234459-2f85-4df6-a64c-43fd16b2ff32",
"rawTextureUuid": "80a15deb-8c19-48a8-b5f6-5f8660dee093",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -0.5,
"offsetY": 172,
"trimX": 1,
"trimY": 1,
"width": 2045,
"height": 1702,
"rawWidth": 2048,
"rawHeight": 2048,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "558edd3e-59a8-471c-bea4-8d9a41723e45",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 265,
"height": 175,
"platformSettings": {},
"subMetas": {
"btn_go": {
"ver": "1.0.4",
"uuid": "dfaa53f7-2471-4f5c-9eb3-f8e618266970",
"rawTextureUuid": "558edd3e-59a8-471c-bea4-8d9a41723e45",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -4,
"offsetY": 1.5,
"trimX": 0,
"trimY": 3,
"width": 257,
"height": 166,
"rawWidth": 265,
"rawHeight": 175,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -17,11 +17,11 @@
9.最多配置5道题 不限制
13.当不做题的时候点击。面包向下移出,蔬菜和肉饼乡下移动回来。
14.往前翻,向下移动上面下来一个新的内容。 天上掉落内容。
15.停留时间8s以上,手指提示拖拽。
15.停留时间8s以上,手指提示拖拽。
16.超框体缩字。
12.三种情况 题干无、题干有、题干图片+文字
......
......@@ -84,6 +84,34 @@
<div style="padding: 10px;background-color: #fff;">
<div class="border-dashed" style="margin: 20px;width: 1300px;">
<span style="font-size: 20px;">小迪标题: </span>
<input type="text" nz-input [(ngModel)]="item.npcTitle" (blur)="save()">
<span style="font-size: 20px;">小迪开始音频: </span>
<div style="display:flex ;">
<div>
<app-audio-recorder [audioUrl]="item.npcAudio"
(audioUploaded)="onAudioUploadSuccess($event, 'npcAudio',item,'npcAudioName')">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>{{ item.npcAudioName}}</span>
</div>
</div>
<span style="font-size: 20px;">小迪结束音频: </span>
<div style="display:flex ;">
<div>
<app-audio-recorder [audioUrl]="item.npcAudioEnd"
(audioUploaded)="onAudioUploadSuccess($event, 'npcAudioEnd',item,'npcAudioEndName')">
</app-audio-recorder>
</div>
<div style="margin: 5px">
<span>{{ item.npcAudioEndName}}</span>
</div>
</div>
<div name="开始音频">
<span style="font-size: 20px;">开始音频: </span>
<div style="display:flex ;">
......
......@@ -15,6 +15,12 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
// 储存数据用
saveKey = "dg28_drag";
item = {
npcTitle: "",
npcAudio: "",
npcAudioName: "",
npcAudioEnd: "",
npcAudioEndName: "",
// 开始音频
auidoStart: "",
auidoStartName: "",
......
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