Commit 9900f36b authored by asdf's avatar asdf

done

parent 96e775e5
...@@ -24,6 +24,11 @@ ...@@ -24,6 +24,11 @@
<span style="height: 30px; font-size: 18px;">第{{i + 1}}个单词:</span> <span style="height: 30px; font-size: 18px;">第{{i + 1}}个单词:</span>
<span style="height: 30px; font-size: 18px;">{{getQuestionText(question)}}</span> <span style="height: 30px; font-size: 18px;">{{getQuestionText(question)}}</span>
<br> <br>
<span style="height: 30px; font-size: 18px;">单词音频:</span>
<br>
<app-audio-recorder [audioUrl]="question.audio" (audioUploaded)="onAudioUploadSuccess($event, i)">
</app-audio-recorder>
<br>
<div *ngFor="let option of question.optionList; let j = index" class="section-content;text-align:center" <div *ngFor="let option of question.optionList; let j = index" class="section-content;text-align:center"
style="padding: 0.5vw; display: inline-block"> style="padding: 0.5vw; display: inline-block">
<div style="margin-top: 20px; float: left; border-width: 1px; border-style: dotted; <div style="margin-top: 20px; float: left; border-width: 1px; border-style: dotted;
......
...@@ -22,6 +22,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -22,6 +22,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
addQuestion() { addQuestion() {
this.item.questionList.push( this.item.questionList.push(
{ {
"audio": "",
"optionList": [{ "optionList": [{
"text": "", "text": "",
"optionAudio": "" "optionAudio": ""
...@@ -93,6 +94,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -93,6 +94,10 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
init() { init() {
}
onAudioUploadSuccess(e, questionIdx) {
this.item.questionList[questionIdx].audio = e.url;
this.save();
} }
onOptionUploadSuccess(e, questionIdx, optionIdx) { onOptionUploadSuccess(e, questionIdx, optionIdx) {
this.item.questionList[questionIdx].optionList[optionIdx].optionAudio = e.url; this.item.questionList[questionIdx].optionList[optionIdx].optionAudio = e.url;
......
{
"__type__": "cc.AnimationClip",
"_name": "cloud",
"_objFlags": 0,
"_native": "",
"_duration": 0.6666666666666666,
"sample": 15,
"speed": 0.1,
"wrapMode": 2,
"curveData": {
"paths": {
"path-4": {
"props": {
"x": [
{
"frame": 0,
"value": -414.644,
"curve": "quadInOut"
},
{
"frame": 0.3333333333333333,
"value": -368.856,
"curve": "quadInOut"
},
{
"frame": 0.6666666666666666,
"value": -414.644
}
]
}
},
"path-5": {
"props": {
"x": [
{
"frame": 0,
"value": -126.337,
"curve": "quadInOut"
},
{
"frame": 0.3333333333333333,
"value": -92.503,
"curve": "quadInOut"
},
{
"frame": 0.6666666666666666,
"value": -126.337
}
]
}
},
"path-6": {
"props": {
"x": [
{
"frame": 0,
"value": 434.079,
"curve": "quadInOut"
},
{
"frame": 0.3333333333333333,
"value": 384.965,
"curve": "quadInOut"
},
{
"frame": 0.6666666666666666,
"value": 434.079
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "collision",
"_objFlags": 0,
"_native": "",
"_duration": 0.16666666666666666,
"sample": 60,
"speed": 0.3,
"wrapMode": 1,
"curveData": {
"paths": {
"path-5": {
"props": {
"scale": [
{
"frame": 0,
"value": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
}
},
{
"frame": 0.16666666666666666,
"value": {
"__type__": "cc.Vec2",
"x": 3,
"y": 3
}
}
],
"active": [
{
"frame": 0,
"value": true
},
{
"frame": 0.16666666666666666,
"value": false
}
],
"opacity": [
{
"frame": 0,
"value": 255
},
{
"frame": 0.16666666666666666,
"value": 0
}
]
}
}
}
},
"events": []
}
\ No newline at end of file
{ {
"ver": "2.1.0", "ver": "2.1.0",
"uuid": "77afa1f4-7025-45c9-843c-b803d1c48c02", "uuid": "a5c6cff3-0959-4f10-b41b-91eb895a42d2",
"subMetas": {} "subMetas": {}
} }
\ No newline at end of file
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "ItemCollisionEffect",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
}
],
"_active": true,
"_components": [
{
"__id__": 8
}
],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 0
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
-4.246,
-235.669,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "path-5",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 3
}
],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 237.6,
"height": 136.8
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "path-5",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 142.56,
"height": 82.08
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "779eeaf1-4c97-4cc5-93cd-7cf4e1a714de"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "5cqZDh0lROSb58mTwseXse",
"sync": false
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "779eeaf1-4c97-4cc5-93cd-7cf4e1a714de"
},
"_type": 0,
"_sizeMode": 0,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "baDoNlZe5PF6pQmSnfs/gb",
"sync": false
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "a5c6cff3-0959-4f10-b41b-91eb895a42d2"
},
"_clips": [
{
"__uuid__": "a5c6cff3-0959-4f10-b41b-91eb895a42d2"
}
],
"playOnLoad": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "behsIKk45MmIVEBoYquqhp",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.7",
"uuid": "dc01f23a-4f76-4fc8-9793-1c29e3774b79",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -28,10 +28,13 @@ ...@@ -28,10 +28,13 @@
"_components": [ "_components": [
{ {
"__id__": 8 "__id__": 8
},
{
"__id__": 9
} }
], ],
"_prefab": { "_prefab": {
"__id__": 9 "__id__": 10
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -43,7 +46,7 @@ ...@@ -43,7 +46,7 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 207, "width": 184,
"height": 121 "height": 121
}, },
"_anchorPoint": { "_anchorPoint": {
...@@ -76,8 +79,8 @@ ...@@ -76,8 +79,8 @@
"_skewX": 0, "_skewX": 0,
"_skewY": 0, "_skewY": 0,
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 1,
"groupIndex": 0, "groupIndex": 1,
"_id": "" "_id": ""
}, },
{ {
...@@ -160,10 +163,10 @@ ...@@ -160,10 +163,10 @@
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "e8153e07-f79b-4d55-9cd9-776cf1bb37d1" "__uuid__": "c50864dd-052a-4ddd-adbf-4df64420510d"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 0, "_sizeMode": 1,
"_fillType": 0, "_fillType": 0,
"_fillCenter": { "_fillCenter": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -182,9 +185,9 @@ ...@@ -182,9 +185,9 @@
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "7eafaeb9-489a-42ea-a790-61e319f8bfd1"
}, },
"fileId": "5fPz7oAbREtIoEqx/KV94V", "fileId": "fceFvRYVJEKopxDiU0J8E+",
"sync": false "sync": false
}, },
{ {
...@@ -247,8 +250,8 @@ ...@@ -247,8 +250,8 @@
"_skewX": 0, "_skewX": 0,
"_skewY": 0, "_skewY": 0,
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 1,
"groupIndex": 0, "groupIndex": 1,
"_id": "" "_id": ""
}, },
{ {
...@@ -273,7 +276,7 @@ ...@@ -273,7 +276,7 @@
"_lineHeight": 80, "_lineHeight": 80,
"_enableWrapText": true, "_enableWrapText": true,
"_N$file": { "_N$file": {
"__uuid__": "45471cc5-3d53-4068-99c4-591121300416" "__uuid__": "bbb7f5b8-6788-4f09-bb15-e32ab0dbbdcc"
}, },
"_isSystemFontUsed": false, "_isSystemFontUsed": false,
"_spacingX": 0, "_spacingX": 0,
...@@ -293,7 +296,7 @@ ...@@ -293,7 +296,7 @@
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "7eafaeb9-489a-42ea-a790-61e319f8bfd1"
}, },
"fileId": "c30LWKe45FYYACM1Sd1Qe+", "fileId": "c30LWKe45FYYACM1Sd1Qe+",
"sync": false "sync": false
...@@ -306,6 +309,30 @@ ...@@ -306,6 +309,30 @@
"__id__": 1 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"labWord": {
"__id__": 6
},
"_id": ""
},
{
"__type__": "cc.BoxCollider",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"tag": 0,
"_offset": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_size": {
"__type__": "cc.Size",
"width": 183,
"height": 121
},
"_id": "" "_id": ""
}, },
{ {
...@@ -314,7 +341,7 @@ ...@@ -314,7 +341,7 @@
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "7eafaeb9-489a-42ea-a790-61e319f8bfd1"
}, },
"fileId": "62LLEOrWdB7qGJjaJUQ/OV", "fileId": "62LLEOrWdB7qGJjaJUQ/OV",
"sync": false "sync": false
......
[
{
"__type__": "cc.Prefab",
"_name": "",
"_objFlags": 0,
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"asyncLoadAssets": false,
"readonly": false
},
{
"__type__": "cc.Node",
"_name": "ItemWord",
"_objFlags": 0,
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 5
}
],
"_active": true,
"_components": [
{
"__id__": 8
}
],
"_prefab": {
"__id__": 9
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 517,
"height": 149
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "group-22",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
}
],
"_prefab": {
"__id__": 4
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 517,
"height": 149
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
0,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "6b628901-c2b8-45c7-ab5e-64142a4f4316"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a0a21fa6-e335-4b90-b31b-a182722a66e5"
},
"fileId": "22mvK725BLx7+D+fTaayXC",
"sync": false
},
{
"__type__": "cc.Node",
"_name": "Comic Sans MS Bold",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 6
}
],
"_prefab": {
"__id__": 7
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 0,
"height": 75.6
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
10.312,
-16.756,
0,
0,
0,
0,
1,
1,
1,
1
]
},
"_eulerAngles": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_skewX": 0,
"_skewY": 0,
"_is3DNode": false,
"_groupIndex": 0,
"groupIndex": 0,
"_id": ""
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 5
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": true,
"_string": "",
"_N$string": "",
"_fontSize": 60,
"_lineHeight": 60,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "bbb7f5b8-6788-4f09-bb15-e32ab0dbbdcc"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 0,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a0a21fa6-e335-4b90-b31b-a182722a66e5"
},
"fileId": "b4RG6yFkJGergtvpqnmsjl",
"sync": false
},
{
"__type__": "297e5YbIjtEAKE4B3/Cdi/c",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"labWord": {
"__id__": 6
},
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "a0a21fa6-e335-4b90-b31b-a182722a66e5"
},
"fileId": "f2hHIj+IdMcKy2lQEfCH0w",
"sync": false
}
]
\ No newline at end of file
{
"ver": "1.2.7",
"uuid": "a0a21fa6-e335-4b90-b31b-a182722a66e5",
"optimizationPolicy": "AUTO",
"asyncLoadAssets": false,
"readonly": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
export const DefaultData = { "questionAudio": "http://staging-teach.cdn.ireadabc.com/2c383c1fce3d89070430342b36469a9c.mp3", "questionText": "12345dsfgdfgsfag", "questionList": [{ "pageAudio": "", "rightOptionIdx": 0, "optionList": [{ "text": "a", "optionAudio": "http://staging-teach.cdn.ireadabc.com/0a78ca4f93c66c026d1e5319baffae6e.mp3" }, { "text": "pp", "optionAudio": "http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3" }, { "text": "le", "optionAudio": "http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8.mp3" }] }] } export const DefaultData = {"questionAudio":"http://staging-teach.cdn.ireadabc.com/2c383c1fce3d89070430342b36469a9c.mp3","questionText":"123123","questionList":[{"audio":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","optionList":[{"text":"a","optionAudio":"http://staging-teach.cdn.ireadabc.com/0a78ca4f93c66c026d1e5319baffae6e.mp3"},{"text":"p","optionAudio":"http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3"},{"text":"p","optionAudio":"http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8.mp3"}]},{"audio":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","optionList":[{"text":"a","optionAudio":"http://staging-teach.cdn.ireadabc.com/0a78ca4f93c66c026d1e5319baffae6e.mp3"},{"text":"p","optionAudio":"http://staging-teach.cdn.ireadabc.com/d4a2488ca37b24c40012132d95484459.mp3"},{"text":"c","optionAudio":"http://staging-teach.cdn.ireadabc.com/7934cdcec68eabe639020bad5420d7f8.mp3"}]}]}
\ No newline at end of file \ No newline at end of file
// Learn cc.Class: import EventMgr from "./EventMgr";
// - https://docs.cocos.com/creator/manual/en/scripting/class.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
cc.Class({ cc.Class({
extends: cc.Component, extends: cc.Component,
properties: { properties: {
// foo: { labWord: cc.Label,
// // ATTRIBUTES:
// default: null, // The default value will be used only when the component attaching
// // to a node for the first time
// type: cc.SpriteFrame, // optional, default is typeof default
// serializable: true, // optional, default is true
// },
// bar: {
// get () {
// return this._bar;
// },
// set (value) {
// this._bar = value;
// }
// },
}, },
// LIFE-CYCLE CALLBACKS: onLoad() {
this.node.on('touchmove', this.onTouchMove, this);
this.node.on('touchend', this.onTouchEnd, this);
this.node.on('touchcancel', this.onTouchEnd, this);
// onLoad () {}, EventMgr.on('onTouchmove', this.onMove, this);
EventMgr.on('onBlockInput', this.onBlockInput, this);
EventMgr.on('onCancelBlockInput', this.onCancelBlockInput, this);
},
onDestroy() {
this.node.off('touchmove', this.onTouchMove, this);
this.node.off('touchend', this.onTouchEnd, this);
this.node.off('touchcancel', this.onTouchEnd, this);
EventMgr.off('onTouchmove', this.onMove, this);
EventMgr.off('onBlockInput', this.onBlockInput, this);
EventMgr.off('onCancelBlockInput', this.onCancelBlockInput, this);
},
init(index, data, scene) {
this.scene = scene;
this.index = index;
this.data = data;
this.labWord.string = data.text;
this.blockInput = false;
this.scheduleOnce(() => {
this.canCollision = true;
})
},
onBlockInput() {
this.blockInput = true;
},
onCancelBlockInput() {
this.blockInput = false;
},
onMove(eventName, params) {
if (this.isActive) {
return;
}
if (params.x > 0) {
if (this.index != params.index + 1) {
return;
}
} else {
if (this.index != params.index - 1) {
return;
}
}
let item = this;
let itemList = [item];
while (item.leftItem) {
item = item.leftItem;
itemList.push(item);
}
item = this;
while (item.rightItem) {
item = item.rightItem;
itemList.push(item);
}
for (let i = 0; i < itemList.length; i++) {
itemList[i].node.x -= params.x;
}
},
onTouchMove(event) {
let delta = event.getDelta();
if (Math.abs(delta.x) > 5) {
this.hadMove = true;
}
if (this.blockInput) {
return;
}
this.isActive = true;
start () { let item = this;
let itemList = [item];
while (item.leftItem) {
item = item.leftItem;
itemList.unshift(item);
}
item = this;
while (item.rightItem) {
item = item.rightItem;
itemList.push(item);
}
for (let i = 0; i < itemList.length; i++) {
let pos = itemList[i].node.position.add(delta);
itemList[i].node.x = pos.x;
}
if (delta.x > 0) {
EventMgr.emit('onTouchmove', { x: delta.x, index: itemList[itemList.length - 1].index });
} else {
EventMgr.emit('onTouchmove', { x: delta.x, index: itemList[0].index });
}
},
onTouchEnd() {
if (!this.hadMove) {
this.playAudio();
}
this.hadMove = false;
this.isActive = false;
this.blockInput = false;
EventMgr.emit('onCancelBlockInput');
},
onCollisionEnter: function (other, self) {
if (!this.canCollision) {
return;
}
EventMgr.emit('onBlockInput');
let otherItem = other.node.getComponent('ItemPart');
let selfItem = self.node.getComponent('ItemPart');
if (otherItem.index > this.index) {
this.rightItem = otherItem;
otherItem.leftItem = this;
} else {
this.leftItem = otherItem;
otherItem.rightItem = this;
}
this.correctPosition(otherItem, selfItem);
this.showEffect(otherItem, selfItem);
this.checkDone();
},
// 修正坐标
correctPosition(otherItem, selfItem) {
if (otherItem.index < selfItem.index) {
return;
}
let item = otherItem;
let itemList = [];
let startX = otherItem.node.x;
if (otherItem.index > selfItem.index) {
while (item.leftItem) {
item = item.leftItem;
itemList.push(item);
}
for (let i = 0; i < itemList.length; i++) {
itemList[i].node.x = startX - 184 * (i + 1);
}
} else {
while (item.rightItem) {
item = item.rightItem;
itemList.push(item);
}
for (let i = 0; i < itemList.length; i++) {
itemList[i].node.x = startX + 184 * (i + 1);
}
}
},
showEffect(otherItem, selfItem) {
if (otherItem.index < selfItem.index) {
return;
}
this.scene.showCollisionEffect(cc.v2(otherItem.node.x - 92, otherItem.node.y));
},
checkDone() {
let item = this;
let itemList = [item];
while (item.leftItem) {
item = item.leftItem;
itemList.push(item);
}
item = this;
while (item.rightItem) {
item = item.rightItem;
itemList.push(item);
}
let x = 0;
for (let i = 0; i < itemList.length; i++) {
x += itemList[i].node.x;
}
let pos = cc.v2(x / itemList.length, this.node.y);
this.scene.checkDone(itemList.length, pos);
},
playAudio() {
GameData.audioCount++;
let url = this.data.optionAudio;
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
let id = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
})
});
}, },
// update (dt) {}, // update (dt) {},
......
cc.Class({
extends: cc.Component,
properties: {
labWord: cc.Label,
},
init(data) {
this.data = data;
let string = '';
for (let i = 0; i < data.optionList.length; i++) {
string += data.optionList[i].text;
}
this.labWord.string = string;
},
onLoad() {
this.node.on('touchstart', this.onTouchStart, this);
},
onDestroy() {
this.node.off('touchstart', this.onTouchStart, this);
},
onTouchStart() {
this.playAudio();
},
playAudio(){
GameData.audioCount++;
let url = this.data.audio;
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
let id = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
})
});
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "297e561b-223b-4400-a138-077fc2762fdc",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
cc.Class({
extends: cc.Component,
properties: {
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.node.on('touchstart',this.onTouchStart,this)
},
onTouchStart () {
this.playAudio();
},
playAudio(){
GameData.audioCount++;
let url = GameData.scene.data.questionList[GameData.questionIndex].audio;
cc.assetManager.loadRemote(url, null, (err, clip) => {
if (err) {
console.log(err)
return;
}
let id = cc.audioEngine.play(clip, false, 1);
cc.audioEngine.setFinishCallback(id, () => {
GameData.audioCount--;
})
});
},
// update (dt) {},
});
{
"ver": "1.0.8",
"uuid": "60f0ba18-2997-44b3-a27a-947f5c3e5616",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "8a24e809-df9e-49b1-8577-8cf46b2cf90c", "uuid": "5e3f5c6a-24ed-4095-8443-ffabd31067f9",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"1": { "1": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "25963b81-e467-47fe-84ab-ec6b9a37d0f6", "uuid": "32026f36-5332-4ca5-849b-324a02034107",
"rawTextureUuid": "8a24e809-df9e-49b1-8577-8cf46b2cf90c", "rawTextureUuid": "5e3f5c6a-24ed-4095-8443-ffabd31067f9",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
{
"__type__": "cc.SpriteAtlas"
}
\ No newline at end of file
{
"ver": "1.2.0",
"uuid": "90a684af-ca41-4a41-b14e-be122fb0098a",
"maxWidth": 1024,
"maxHeight": 1024,
"padding": 2,
"allowRotation": true,
"forceSquared": false,
"powerOfTwo": false,
"algorithm": "MaxRects",
"format": "png",
"quality": 80,
"contourBleed": true,
"paddingBleed": true,
"filterUnused": false,
"packable": false,
"premultiplyAlpha": false,
"filterMode": "bilinear",
"platformSettings": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "c5ca8ed7-7645-4278-b08c-cba36ed07416",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 455,
"height": 109,
"platformSettings": {},
"subMetas": {
"group-10": {
"ver": "1.0.4",
"uuid": "b96537b3-5a59-42ac-b68b-0162e225d0fa",
"rawTextureUuid": "c5ca8ed7-7645-4278-b08c-cba36ed07416",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 455,
"height": 109,
"rawWidth": 455,
"rawHeight": 109,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 259,
"borderRight": 168,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "401e5296-39a3-4424-b60e-14aad48013f2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 78,
"height": 45,
"platformSettings": {},
"subMetas": {
"group-2-copy-5": {
"ver": "1.0.4",
"uuid": "d6b07aa5-78c4-42e4-9e83-7ee547e3e71d",
"rawTextureUuid": "401e5296-39a3-4424-b60e-14aad48013f2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 78,
"height": 45,
"rawWidth": 78,
"rawHeight": 45,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e4849d4c-ca89-439e-bb0e-1eb6fa10f72b", "uuid": "0deb717e-07ca-4f3d-b0f0-72e2635b8c0e",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"group-2-copy": { "group-2-copy": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "e8153e07-f79b-4d55-9cd9-776cf1bb37d1", "uuid": "b8c19c61-5ffa-4146-9d2d-f1278b14609d",
"rawTextureUuid": "e4849d4c-ca89-439e-bb0e-1eb6fa10f72b", "rawTextureUuid": "0deb717e-07ca-4f3d-b0f0-72e2635b8c0e",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "cae44307-0e36-45ad-bcba-efa7407dfd62", "uuid": "5bfc0953-9c66-4dec-8ffb-65f13be11b62",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 517, "width": 207,
"height": 149, "height": 121,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"group-2": { "group-2": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "ad21aa5b-e9a8-40f0-b96b-beb15c46ec8f", "uuid": "c50864dd-052a-4ddd-adbf-4df64420510d",
"rawTextureUuid": "cae44307-0e36-45ad-bcba-efa7407dfd62", "rawTextureUuid": "5bfc0953-9c66-4dec-8ffb-65f13be11b62",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 517, "width": 207,
"height": 149, "height": 121,
"rawWidth": 517, "rawWidth": 207,
"rawHeight": 149, "rawHeight": 121,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "321bbab0-00a1-4e23-b060-951662a532ba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 517,
"height": 149,
"platformSettings": {},
"subMetas": {
"group-22": {
"ver": "1.0.4",
"uuid": "6b628901-c2b8-45c7-ab5e-64142a4f4316",
"rawTextureUuid": "321bbab0-00a1-4e23-b060-951662a532ba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 517,
"height": 149,
"rawWidth": 517,
"rawHeight": 149,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "e9e1df2a-b0d9-4bec-b7e6-0b1aa286653b", "uuid": "54f2e1f5-b1b6-4e6e-9593-8f3abb6f3748",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"group-3": { "group-3": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "28c78c42-a46b-4693-8aef-a043e8fedfb7", "uuid": "b2482312-db38-448b-9181-20cac9073b9a",
"rawTextureUuid": "e9e1df2a-b0d9-4bec-b7e6-0b1aa286653b", "rawTextureUuid": "54f2e1f5-b1b6-4e6e-9593-8f3abb6f3748",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 37, "width": 49,
"height": 34, "height": 44,
"rawWidth": 37, "rawWidth": 49,
"rawHeight": 34, "rawHeight": 44,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "6894ee7d-7754-4bb8-a9bb-af886d848c50", "uuid": "934273d5-c891-47c3-99a5-75eb4e5bc9ce",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
"premultiplyAlpha": false, "premultiplyAlpha": false,
"genMipmaps": false, "genMipmaps": false,
"packable": true, "packable": true,
"width": 231, "width": 53,
"height": 68, "height": 44,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"jacket": { "group-7-2": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "57d0fcf2-0891-4188-a6eb-08fbcbbd8ba9", "uuid": "6d54e77c-2b6b-45a3-b4ae-1aa53f84531b",
"rawTextureUuid": "6894ee7d-7754-4bb8-a9bb-af886d848c50", "rawTextureUuid": "934273d5-c891-47c3-99a5-75eb4e5bc9ce",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 231, "width": 53,
"height": 68, "height": 44,
"rawWidth": 231, "rawWidth": 53,
"rawHeight": 68, "rawHeight": 44,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "198bd21f-362f-422b-86f0-1900d925aceb", "uuid": "cc348dc0-7b5d-4724-86c9-d27ceafe77f9",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"group-7-copy": { "group-7-copy": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "abe08b24-be14-48f3-b76e-ba0d8cf3001e", "uuid": "118d5a67-2510-4adf-961a-24db4f84d96f",
"rawTextureUuid": "198bd21f-362f-422b-86f0-1900d925aceb", "rawTextureUuid": "cc348dc0-7b5d-4724-86c9-d27ceafe77f9",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 40, "width": 53,
"height": 34, "height": 44,
"rawWidth": 40, "rawWidth": 53,
"rawHeight": 34, "rawHeight": 44,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
{
"ver": "2.3.5",
"uuid": "d53b0aab-4aac-4fd4-ae95-adb38579a1aa",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 53,
"height": 44,
"platformSettings": {},
"subMetas": {
"group-7-copy2": {
"ver": "1.0.4",
"uuid": "0b505044-21ce-4a4a-85c6-5f2dfbd34609",
"rawTextureUuid": "d53b0aab-4aac-4fd4-ae95-adb38579a1aa",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 53,
"height": 44,
"rawWidth": 53,
"rawHeight": 44,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{ {
"ver": "2.3.5", "ver": "2.3.5",
"uuid": "0e1e58d5-506a-4aaa-a9c3-d4d1aeb9ecbb", "uuid": "085e9172-215b-4cf3-8240-eff2497ec889",
"type": "sprite", "type": "sprite",
"wrapMode": "clamp", "wrapMode": "clamp",
"filterMode": "bilinear", "filterMode": "bilinear",
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
"subMetas": { "subMetas": {
"group-7": { "group-7": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "b7086c0e-e86b-4136-95b1-0d7316e4011e", "uuid": "0ebd59e0-66cd-4757-9a31-36e2101ad031",
"rawTextureUuid": "0e1e58d5-506a-4aaa-a9c3-d4d1aeb9ecbb", "rawTextureUuid": "085e9172-215b-4cf3-8240-eff2497ec889",
"trimType": "auto", "trimType": "auto",
"trimThreshold": 1, "trimThreshold": 1,
"rotated": false, "rotated": false,
...@@ -22,10 +22,10 @@ ...@@ -22,10 +22,10 @@
"offsetY": 0, "offsetY": 0,
"trimX": 0, "trimX": 0,
"trimY": 0, "trimY": 0,
"width": 40, "width": 53,
"height": 34, "height": 44,
"rawWidth": 40, "rawWidth": 53,
"rawHeight": 34, "rawHeight": 44,
"borderTop": 0, "borderTop": 0,
"borderBottom": 0, "borderBottom": 0,
"borderLeft": 0, "borderLeft": 0,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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