Commit 43798a2b authored by limingzhe's avatar limingzhe

fix: debug

parent 9b2b5366
No preview for this file type
This diff is collapsed.
...@@ -51,6 +51,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -51,6 +51,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.initListener(); this.initListener();
this.initGame(); this.initGame();
this.initBottom(); this.initBottom();
this.initSound();
this.startGame(); this.startGame();
} }
protected onDestroy(): void { protected onDestroy(): void {
...@@ -70,10 +71,12 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -70,10 +71,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
public layer_item: cc.Node = null; public layer_item: cc.Node = null;
@property(cc.Node) @property(cc.Node)
public layer_item_little: cc.Node = null; public layer_item_little: cc.Node = null;
@property(cc.Node)
public soundNode: cc.Node = null;
_cantouch = null; _cantouch = null;
private list: Array<{ private list: Array<{
title, questionAudio, image, letterList, recordData, isChose//用于判定对错 right wrong title, questionAudio, image, letterList, recordData, isChose//用于判定对错 right wrong
}>; }>;
private recordFlag: number;//录音模式 private recordFlag: number;//录音模式
private score: number; private score: number;
...@@ -394,9 +397,36 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -394,9 +397,36 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.resetView(); this.resetView();
this.initGame(); this.initGame();
this.initBottom(); this.initBottom();
this.initSound();
this.startGame(); this.startGame();
} }
initSound() {
console.log("CurrentData: " , this.CurrentData);
if (!this.data.audio_url) {
this.soundNode.active = false;
return;
}
const iconNode = cc.find('icon', this.soundNode);
const animNode = cc.find("anim", this.soundNode);
animNode.active = false;
const anim = animNode.getComponent(cc.Animation);
iconNode.on('touchstart', () => {
this.playAudioByUrl(this.data.audio_url, () => {
iconNode.active = true;
animNode.active = false;
})
animNode.active = true;
iconNode.active = false;
anim.play('sound');
});
}
private rightCount: number; private rightCount: number;
private errorCount: number; private errorCount: number;
private totalCount: number; private totalCount: number;
......
export const defaultData = { export const defaultData =
"title": "", {"title":"","questions":[{"title":"This is a title.","options":[{"type":"img","image":"http://staging-teach.cdn.ireadabc.com/94a46aa24d41a280e438b764b2bb123c.png","text":"apple","audio":"http://staging-teach.cdn.ireadabc.com/f5484db3e00a63a12f5197410ca95f0f_l.mp3","audioName":"apple-迅捷文字转语音-1694506758432.mp3"},{"type":"txt","image":"","text":"banana","audio":"http://staging-teach.cdn.ireadabc.com/c0acdb70d3f5f1483e44bae2faa1b25a_l.mp3","audioName":"banan-迅捷文字转语音-1694506764356.mp3"}]}],"audio_url":"http://staging-teach.cdn.ireadabc.com/f5484db3e00a63a12f5197410ca95f0f.mp3"}
"questions": [ // {
{ // "title": "",
"title": "Which animal have wings?", // "questions": [
"options": [ // {
{ // "title": "Which animal have wings?",
"type": "img_txt", // "options": [
"image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png", // {
"text": "bird", // "type": "img_txt",
"audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3' // "image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png",
}, // "text": "bird",
{ // "audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3'
"type": "img_txt", // },
"image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png", // {
"text": "interface", // "type": "img_txt",
"audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3' // "image": "http://staging-teach.cdn.ireadabc.com/c62b5960641fd7cf29613cc45fb00cd6.png",
}, // "text": "interface",
{ // "audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3'
"type": "img_txt", // },
"image": "http://staging-teach.cdn.ireadabc.com/a71f2b71e45ff2525714494f6edd624b.jpg", // {
"text": "wind", // "type": "img_txt",
"audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3' // "image": "http://staging-teach.cdn.ireadabc.com/a71f2b71e45ff2525714494f6edd624b.jpg",
}, // "text": "wind",
// { // "audio": 'http://staging-teach.cdn.ireadabc.com/981ebff00a4717b1327b9dcd32b9ad2f_l.mp3'
// "type": "txt", // },
// "image": "", // // {
// "text": "dog" // // "type": "txt",
// } // // "image": "",
] // // "text": "dog"
} // // }
] // ]
} // }
// ]
// }
{
"ver": "1.1.2",
"uuid": "52bb7007-ceec-4a56-b3d8-bb94bca91cd4",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "876ea961-54ff-4ebb-9ef1-12a7b3ef316e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 80,
"platformSettings": {},
"subMetas": {
"icon_audio_play_1": {
"ver": "1.0.4",
"uuid": "475320f4-2c2a-4da6-9cf6-8ba8ba20a881",
"rawTextureUuid": "876ea961-54ff-4ebb-9ef1-12a7b3ef316e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 80,
"rawWidth": 82,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c9146042-9230-47dd-a975-e5e62eba81ac",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 80,
"platformSettings": {},
"subMetas": {
"icon_audio_play_2": {
"ver": "1.0.4",
"uuid": "a2186f45-b37e-485a-8b15-280856b35cf0",
"rawTextureUuid": "c9146042-9230-47dd-a975-e5e62eba81ac",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 80,
"rawWidth": 82,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "afd552b4-b0aa-4241-a88d-417d9e482136",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 82,
"height": 80,
"platformSettings": {},
"subMetas": {
"icon_audio_play_3": {
"ver": "1.0.4",
"uuid": "dd9335de-476e-4b60-ac36-8f107cf43020",
"rawTextureUuid": "afd552b4-b0aa-4241-a88d-417d9e482136",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 82,
"height": 80,
"rawWidth": 82,
"rawHeight": 80,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "sound",
"_objFlags": 0,
"_native": "",
"_duration": 1.0166666666666666,
"sample": 60,
"speed": 1,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "475320f4-2c2a-4da6-9cf6-8ba8ba20a881"
}
},
{
"frame": 0.3333333333333333,
"value": {
"__uuid__": "a2186f45-b37e-485a-8b15-280856b35cf0"
}
},
{
"frame": 0.6666666666666666,
"value": {
"__uuid__": "dd9335de-476e-4b60-ac36-8f107cf43020"
}
},
{
"frame": 1,
"value": {
"__uuid__": "475320f4-2c2a-4da6-9cf6-8ba8ba20a881"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "06b33c9f-f254-4e3c-a9c6-021941a4fa94",
"subMetas": {}
}
\ No newline at end of file
...@@ -76,7 +76,21 @@ ...@@ -76,7 +76,21 @@
<div class="model-content"> <div class="model-content">
<div style="padding: 10px;background-color: #fff;"> <div style="padding: 10px;background-color: #fff;">
<div style="margin: 30px; display: flex; align-items: center;">
<h3>标题音频: </h3>
<div style="margin-left: 10px;">
<app-audio-recorder
[audioUrl]="item.audio_url"
(audioUploaded)="onItemAudioUploadSuccess($event, item)"
></app-audio-recorder>
</div>
</div>
<div class="border-dashed" style="margin: 20px;width: 1000px;display: none"> <div class="border-dashed" style="margin: 20px;width: 1000px;display: none">
<!-- <span style="font-size: 20px;">标题: </span> <!-- <span style="font-size: 20px;">标题: </span>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()"> --> <input type="text" nz-input [(ngModel)]="item.title" (blur)="save()"> -->
<!-- <span style="font-size: 20px;">npc音频: </span> <!-- <span style="font-size: 20px;">npc音频: </span>
......
...@@ -13,6 +13,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -13,6 +13,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
item = { item = {
title: "", title: "",
audio_url: '',
questions: [], questions: [],
}; };
isVisible = false; isVisible = false;
...@@ -78,6 +79,11 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -78,6 +79,11 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.save(); this.save();
} }
onItemAudioUploadSuccess(e, item) {
item.audio_url = e.url;
this.save();
}
deleteBgAudio() { deleteBgAudio() {
this.save(); this.save();
} }
......
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