Commit 189d60a0 authored by xytk's avatar xytk

提交代码

parent 0338fa3c
......@@ -43,8 +43,6 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
"texJsonData": { "url": "" },
"texPngData": { "url": "" },
},
dragonBone_armatureName:"",
dragonBone_animationName:"",
dragonBone_audio_url:"",
pic_A_url:"",
pic_A_audio_url:"",
......
{
"ver": "1.1.2",
"uuid": "c79bd6df-0fc5-4b00-89d0-9c452ebde47f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"__type__": "cc.AnimationClip",
"_name": "doc",
"_objFlags": 0,
"_native": "",
"_duration": 0.06666666666666667,
"sample": 60,
"speed": 0.3,
"wrapMode": 2,
"curveData": {
"comps": {
"cc.Sprite": {
"spriteFrame": [
{
"frame": 0,
"value": {
"__uuid__": "df13ca56-0b84-446c-b23d-6a087788a3bb"
}
},
{
"frame": 0.016666666666666666,
"value": {
"__uuid__": "5798d041-ec18-4f1e-a4e4-b816dea7dd2b"
}
},
{
"frame": 0.03333333333333333,
"value": {
"__uuid__": "6ac58355-4763-43f4-87d1-2f27c8b0e199"
}
},
{
"frame": 0.05,
"value": {
"__uuid__": "2b16185e-b041-4777-9361-8d6f4ed80f42"
}
}
]
}
}
},
"events": []
}
\ No newline at end of file
{
"ver": "2.1.0",
"uuid": "e23bd72e-c7cc-4fa5-bcb4-4ca945251f6d",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "d52a14c8-c75b-4239-8062-1f91425a3886",
"downloadMode": 0,
"duration": 1.854694,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "261261f6-352b-4a08-9c39-b33dc3fe9b9a",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "e1bc056e-f2a2-4e58-a899-8c80096a60b5",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "76b0791a-dc4e-4bc3-b4e5-1883457eea81",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "d803f9f6-040e-4bfa-8405-6ef85d4bc5af",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "ba5cb94f-a8af-4b01-b548-414f4a31cea2",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "9de7e940-49b7-4208-a6fd-efbfd529cfa6",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "1.1.0",
"uuid": "d28d7b0a-dd52-4efb-8065-0a39dec57b26",
"subMetas": {}
}
\ No newline at end of file
......@@ -81,19 +81,25 @@
"__id__": 15
},
{
"__id__": 29
"__id__": 32
},
{
"__id__": 41
}
],
"_active": true,
"_components": [
{
"__id__": 39
"__id__": 51
},
{
"__id__": 40
"__id__": 52
},
{
"__id__": 41
"__id__": 54
},
{
"__id__": 53
}
],
"_prefab": null,
......@@ -183,7 +189,7 @@
"array": [
0,
0,
847.8388703049654,
840.3829328442588,
0,
0,
0,
......@@ -540,15 +546,13 @@
"__id__": 9
},
"_enabled": true,
"_clip": {
"__uuid__": "f0680ae0-c079-45ef-abd7-9e63d90b982b"
},
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "efDjeJSaVGhZjI05xgIeW0"
"_id": "0bkGTozUlFYrQ5trOKvZn3"
},
{
"__type__": "cc.Node",
......@@ -575,7 +579,7 @@
},
"_contentSize": {
"__type__": "cc.Size",
"width": 333.34,
"width": 320.88,
"height": 50.4
},
"_anchorPoint": {
......@@ -628,16 +632,18 @@
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": false,
"_string": "Listen And Droag",
"_N$string": "Listen And Droag",
"_string": "Listen and Droag",
"_N$string": "Listen and Droag",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": null,
"_isSystemFontUsed": true,
"_N$file": {
"__uuid__": "9de7e940-49b7-4208-a6fd-efbfd529cfa6"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 1,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 0,
"_N$verticalAlign": 1,
......@@ -677,16 +683,16 @@
"__id__": 18
},
{
"__id__": 22
"__id__": 23
},
{
"__id__": 25
"__id__": 27
}
],
"_active": true,
"_components": [
{
"__id__": 28
"__id__": 31
}
],
"_prefab": null,
......@@ -847,6 +853,9 @@
"_components": [
{
"__id__": 21
},
{
"__id__": 22
}
],
"_prefab": null,
......@@ -1021,6 +1030,22 @@
"_originalHeight": 0,
"_id": "25Y/j0TVlNLaW7n75RnpW0"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 18
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "b8YvExwQxMTb+VRqR9gteK"
},
{
"__type__": "cc.Node",
"_name": "picA",
......@@ -1032,10 +1057,13 @@
"_active": true,
"_components": [
{
"__id__": 23
"__id__": 24
},
{
"__id__": 24
"__id__": 25
},
{
"__id__": 26
}
],
"_prefab": null,
......@@ -1091,7 +1119,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
"__id__": 23
},
"_enabled": true,
"_materials": [
......@@ -1121,7 +1149,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 22
"__id__": 23
},
"_enabled": true,
"alignMode": 1,
......@@ -1143,6 +1171,22 @@
"_originalHeight": 0,
"_id": "7fwXzG+FFA6YnMIY1DBK4K"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 23
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "efivWRTqhDvL64IqErocig"
},
{
"__type__": "cc.Node",
"_name": "picC",
......@@ -1154,10 +1198,13 @@
"_active": true,
"_components": [
{
"__id__": 26
"__id__": 28
},
{
"__id__": 27
"__id__": 29
},
{
"__id__": 30
}
],
"_prefab": null,
......@@ -1213,7 +1260,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
"__id__": 27
},
"_enabled": true,
"_materials": [
......@@ -1243,7 +1290,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 25
"__id__": 27
},
"_enabled": true,
"alignMode": 1,
......@@ -1265,6 +1312,22 @@
"_originalHeight": 0,
"_id": "20HeObJVlDQZgPuhh6C3My"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 27
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "f0/5SQmQJP/7knSgIiWhQY"
},
{
"__type__": "41822h+7BlCubz7KWl6uoYP",
"_name": "",
......@@ -1273,26 +1336,374 @@
"__id__": 15
},
"_enabled": true,
"dragonBoneAudioSource": {
"__id__": 22
},
"picAAudioSource": {
"__id__": 26
},
"picCAudioSource": {
"__id__": 30
},
"_id": "a2RsgrevxLALki66+UKTAy"
},
{
"__type__": "cc.Node",
"_name": "res",
"_name": "bottom",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 30
"__id__": 33
},
{
"__id__": 33
"__id__": 37
}
],
"_active": true,
"_components": [
{
"__id__": 40
}
],
"_prefab": null,
"_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": [
0,
-237.194,
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": "9aK7vzEo1P8L06Zl7B+b4u"
},
{
"__type__": "cc.Node",
"_name": "label",
"_objFlags": 0,
"_parent": {
"__id__": 32
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 34
},
{
"__id__": 35
},
{
"__id__": 36
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 747.35,
"height": 62.4
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
669.187,
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": "6bCtdOECJLr68BCWe/BJUg"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_useOriginalSize": false,
"_string": "Blend A with B to make ab,bab,bab,bab.",
"_N$string": "Blend A with B to make ab,bab,bab,bab.",
"_fontSize": 40,
"_lineHeight": 40,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "ba5cb94f-a8af-4b01-b548-414f4a31cea2"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 0,
"_N$cacheMode": 0,
"_id": "61LGani0lNTYniLc8rzf6T"
},
{
"__type__": "cc.LabelOutline",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_color": {
"__type__": "cc.Color",
"r": 125,
"g": 147,
"b": 220,
"a": 255
},
"_width": 6,
"_id": "6dlmpCsDRBz7wz5btUHiNz"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 33
},
"_enabled": true,
"_clip": null,
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "edsuhsM/RI0rmsTZP2fVTO"
},
{
"__type__": "cc.Node",
"_name": "doc",
"_objFlags": 0,
"_parent": {
"__id__": 32
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
},
{
"__id__": 39
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 52,
"height": 52
},
"_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": "d6RMWRw9ZCLbn1n/qL1gUk"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "5798d041-ec18-4f1e-a4e4-b816dea7dd2b"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "acZ7tk9zxO/b2TzkHqDf3u"
},
{
"__type__": "cc.Animation",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
},
"_enabled": true,
"_defaultClip": {
"__uuid__": "e23bd72e-c7cc-4fa5-bcb4-4ca945251f6d"
},
"_clips": [
{
"__uuid__": "e23bd72e-c7cc-4fa5-bcb4-4ca945251f6d"
}
],
"playOnLoad": true,
"_id": "76TGPXH+JAd4Lp5L8Y2Mfg"
},
{
"__type__": "f06fdaiGzdMery4Nzf855ro",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 32
},
"_enabled": true,
"doc": {
"__id__": 37
},
"text": {
"__id__": 33
},
"_id": "624Q23nvtEgp2teq8h6WHj"
},
{
"__type__": "cc.Node",
"_name": "res",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [
{
"__id__": 42
},
{
"__id__": 45
},
{
"__id__": 48
}
],
"_active": false,
"_components": [],
"_prefab": null,
......@@ -1348,11 +1759,11 @@
"_name": "font",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 41
},
"_children": [
{
"__id__": 31
"__id__": 43
}
],
"_active": true,
......@@ -1410,13 +1821,13 @@
"_name": "BRLNSDB",
"_objFlags": 0,
"_parent": {
"__id__": 30
"__id__": 42
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 32
"__id__": 44
}
],
"_prefab": null,
......@@ -1472,7 +1883,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 31
"__id__": 43
},
"_enabled": true,
"_materials": [
......@@ -1508,11 +1919,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 41
},
"_children": [
{
"__id__": 34
"__id__": 46
}
],
"_active": true,
......@@ -1570,13 +1981,13 @@
"_name": "icon",
"_objFlags": 0,
"_parent": {
"__id__": 33
"__id__": 45
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 35
"__id__": 47
}
],
"_prefab": null,
......@@ -1632,7 +2043,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 34
"__id__": 46
},
"_enabled": true,
"_materials": [
......@@ -1664,11 +2075,11 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 29
"__id__": 41
},
"_children": [
{
"__id__": 37
"__id__": 49
}
],
"_active": true,
......@@ -1726,13 +2137,13 @@
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 36
"__id__": 48
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 38
"__id__": 50
}
],
"_prefab": null,
......@@ -1788,7 +2199,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 37
"__id__": 49
},
"_enabled": true,
"_clip": {
......@@ -1818,6 +2229,55 @@
"_fitHeight": false,
"_id": "59Cd0ovbdF4byw5sbjJDx7"
},
{
"__type__": "f4edeRi+NdAabqAkVYRwFjK",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"loadInAudioSource": {
"__id__": 53
},
"dragonBonesNode": {
"__id__": 18
},
"pic_a_sprite": {
"__id__": 24
},
"pic_c_sprite": {
"__id__": 28
},
"tittleJs": {
"__id__": 14
},
"middleJs": {
"__id__": 31
},
"bottomJs": {
"__id__": 40
},
"_id": "e687yyoRBIzZAOVRL8Sseh"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"_clip": {
"__uuid__": "d52a14c8-c75b-4239-8062-1f91425a3886"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"playOnLoad": false,
"preload": false,
"_id": "81Jn1CbeRFpbLeg3GSgMt2"
},
{
"__type__": "cc.Widget",
"_name": "",
......@@ -1844,24 +2304,5 @@
"_originalWidth": 0,
"_originalHeight": 0,
"_id": "29zXboiXFBKoIV4PQ2liTe"
},
{
"__type__": "f4edeRi+NdAabqAkVYRwFjK",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 2
},
"_enabled": true,
"dragonBonesNode": {
"__id__": 18
},
"pic_a_sprite": {
"__id__": 23
},
"pic_c_sprite": {
"__id__": 26
},
"_id": "e687yyoRBIzZAOVRL8Sseh"
}
]
\ No newline at end of file
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
@property(cc.Node)
doc: cc.Node = null;
@property(cc.Node)
text: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.doc.on(cc.Node.EventType.TOUCH_START,()=>{
this.doc.active = false;
this.text.active = true;
let tween = cc.tween().to(1,{y:0},{easing:"cubicInOut"})
cc.tween(this.text).then(tween).start();
})
this.text.on(cc.Node.EventType.TOUCH_START,()=>{
let as = this.text.getComponent<cc.AudioSource>(cc.AudioSource);
as.play();
})
}
setAudioClip(ac:cc.AudioClip){
this.text.getComponent<cc.AudioSource>(cc.AudioSource).clip = ac;
}
// start () {}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "f06fd6a2-1b37-4c7a-bcb8-3737fce79ae8",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
const {ccclass, property} = cc._decorator;
import {asyncPlayDragonBoneAnimation} from "./utils"
@ccclass
export default class NewClass extends cc.Component {
@property(cc.AudioSource)
dragonBoneAudioSource:cc.AudioSource = null;
@property(cc.AudioSource)
picAAudioSource:cc.AudioSource = null;
@property(cc.AudioSource)
picCAudioSource:cc.AudioSource = null;
// onLoad () {}
......@@ -12,10 +18,32 @@ export default class NewClass extends cc.Component {
this.scheduleOnce(()=>{
this.flyIn();
},0.5);
this.dragonBoneAudioSource.node.on(cc.Node.EventType.TOUCH_START,()=>{
this.dragonBoneAudioSource.play();
})
this.picAAudioSource.node.on(cc.Node.EventType.TOUCH_START,()=>{
this.picAAudioSource.play();
})
this.picCAudioSource.node.on(cc.Node.EventType.TOUCH_START,()=>{
this.picCAudioSource.play();
})
}
// update (dt) {}
setAudioClip(ac:cc.AudioClip,type:number){
if(type == 0){
this.dragonBoneAudioSource.clip = ac;
}else if(type == 1){
this.picAAudioSource.clip = ac;
}else if(type == 2){
this.picCAudioSource.clip = ac;
}
}
/**
* 飞入
*/
......
// Learn cc.Class:
// - 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
import Tittle from "./Tittle"
import Middle from "./Middle"
import Bottom from "./Bottom"
cc.Class({
......@@ -12,9 +8,13 @@ cc.Class({
extends: cc.Component,
properties: {
loadInAudioSource:cc.AudioSource,
dragonBonesNode:cc.Node,
pic_a_sprite:cc.Sprite,
pic_c_sprite:cc.Sprite
pic_c_sprite:cc.Sprite,
tittleJs:Tittle,
middleJs:Middle,
bottomJs:Bottom
},
......@@ -22,6 +22,7 @@ cc.Class({
onLoad() {
this.initSceneData();
this.initSize();
this.loadInAudioSource.play();
},
_imageResList: null,
......@@ -81,7 +82,7 @@ cc.Class({
playDragonAnimation(){
let ad = this.dragonBonesNode.getComponent(dragonBones.ArmatureDisplay);
if(ad){
ad.playAnimation(this.data.dragonBone_animationName, -1);
ad.playAnimation("normal", -1);
}
},
......@@ -91,7 +92,7 @@ cc.Class({
},
getDefaultData() {
const dataJson = '{"bt_text":"11111","bt_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","dragonBone":{"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/363ea3636888e4f70037d69794956daa.json","name":"sb_boy_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/ecc48e23d55b1af8eb40d997dc573791.json","name":"sb_boy_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","name":"sb_boy_tex.png"}},"dragonBone_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_A_url":"http://staging-teach.cdn.ireadabc.com/ed0e074ce7c52a469cc78c13a58eb09d.png","pic_C_url":"http://staging-teach.cdn.ireadabc.com/b2423375f6f8bfc4e24568c36b23947d.png","bottom_text":"底部的文本","bottom_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_A_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_C_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","dragonBone_animationName":"unit1_boy_jump","dragonBone_armatureName":"Armature"}'
const dataJson = '{"bt_text":"11111","bt_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","dragonBone":{"skeJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/14ca834d522122b031a2e18be5129251.json","name":"sb_boy_ske.json"},"texJsonData":{"url":"http://staging-teach.cdn.ireadabc.com/ecc48e23d55b1af8eb40d997dc573791.json","name":"sb_boy_tex.json"},"texPngData":{"url":"http://staging-teach.cdn.ireadabc.com/2d668f8049bc98c0e026921ef316a0fd.png","name":"sb_boy_tex.png"}},"dragonBone_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_A_url":"http://staging-teach.cdn.ireadabc.com/ed0e074ce7c52a469cc78c13a58eb09d.png","pic_C_url":"http://staging-teach.cdn.ireadabc.com/b2423375f6f8bfc4e24568c36b23947d.png","bottom_text":"底部的文本","bottom_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_A_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","pic_C_audio_url":"http://staging-teach.cdn.ireadabc.com/b0c23eb327ec13212d09516a1a8a49ec.mp3","dragonBone_animationName":"unit1_boy_jump","dragonBone_armatureName":"Armature"}'
const data = JSON.parse(dataJson);
return data;
},
......@@ -119,7 +120,9 @@ cc.Class({
},
addPreloadAnima() {
this._animaResList.push({url: this.data.dragonBone.skeJsonData.url});
this._animaResList.push({url: this.data.dragonBone.texJsonData.url});
this._animaResList.push({url: this.data.dragonBone.texPngData.url});
},
preload() {
......@@ -155,33 +158,31 @@ cc.Class({
audioBtn: null,
initAudio() {
const audioNode = cc.find('Canvas/res/audio');
const getAudioByResName = (resName) => {
return audioNode.getChildByName(resName).getComponent(cc.AudioSource);
}
this.audioBtn = getAudioByResName('btn');
this.getAudioByUrl(this.data.bt_audio_url,(ac)=>{
this.tittleJs.setAudioClip(ac);
});
this.getAudioByUrl(this.data.bottom_audio_url,(ac)=>{
this.bottomJs.setAudioClip(ac);
});
this.getAudioByUrl(this.data.dragonBone_audio_url,(ac)=>{
this.middleJs.setAudioClip(ac,0);
});
this.getAudioByUrl(this.data.pic_A_audio_url,(ac)=>{
this.middleJs.setAudioClip(ac,1);
});
this.getAudioByUrl(this.data.pic_C_audio_url,(ac)=>{
this.middleJs.setAudioClip(ac,2);
});
},
initView() {
this.initBg();
// this.initPic();
this.initPic();
//this.initBtn();
this.initIcon();
this.loadDragonBones();
this.getSpriteFrimeByUrl(this.data.pic_A_url,(spriteFrame)=>{
this.pic_a_sprite.spriteFrame = spriteFrame;
});
this.getSpriteFrimeByUrl(this.data.pic_C_url,(spriteFrame)=>{
this.pic_c_sprite.spriteFrame = spriteFrame;
});
},
loadDragonBones(){
var animNode = this.dragonBonesNode;
......@@ -203,8 +204,12 @@ cc.Class({
dragonDisplay.dragonAtlasAsset = atlas;
dragonDisplay.dragonAsset = asset;
let dbj = JSON.parse(dragonBonesJson);
let armatureNames = dbj.armature.map(data => data.name);
if(armatureNames.length>0){
dragonDisplay.armatureName = armatureNames[0];
dragonDisplay.armatureName = item.dragonBone_armatureName;
}
// dragonDisplay.playAnimation(item.dragonBone_animationName, 0);
});
});
......@@ -220,129 +225,23 @@ cc.Class({
pic1: null,
pic2: null,
initPic() {
const canvas = cc.find('Canvas');
const maxW = canvas.width * 0.7;
this.getSprNodeByUrl(this.data.pic_url, (sprNode) => {
const picNode1 = sprNode;
picNode1.scale = maxW / picNode1.width;
picNode1.baseX = picNode1.x;
canvas.addChild(picNode1);
this.pic1 = picNode1;
const labelNode = new cc.Node();
labelNode.color = cc.Color.YELLOW;
const label = labelNode.addComponent(cc.Label);
label.string = this.data.text;
label.fontSize = 60;
label.lineHeight = 60;
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent('cc.Label').font;
picNode1.addChild(labelNode);
this.getSpriteFrimeByUrl(this.data.pic_A_url,(spriteFrame)=>{
this.pic_a_sprite.spriteFrame = spriteFrame;
});
this.getSprNodeByUrl(this.data.pic_url_2, (sprNode) => {
const picNode2 = sprNode;
picNode2.scale = maxW / picNode2.width;
canvas.addChild(picNode2);
picNode2.x = canvas.width;
picNode2.baseX = picNode2.x;
this.pic2 = picNode2;
const labelNode = new cc.Node();
const label = labelNode.addComponent(cc.RichText);
const size = 60
label.font = cc.find('Canvas/res/font/BRLNSDB').getComponent(cc.Label).font;
label.string = `<outline color=#751e00 width=4><size=${size}><color=#ffffff>${this.data.text}</color></size></outline>`
label.lineHeight = size;
picNode2.addChild(labelNode);
this.getSpriteFrimeByUrl(this.data.pic_C_url,(spriteFrame)=>{
this.pic_c_sprite.spriteFrame = spriteFrame;
});
},
initIcon() {
const iconNode = this.getSprNode('icon');
iconNode.zIndex = 5;
iconNode.anchorX = 1;
iconNode.anchorY = 1;
iconNode.parent = cc.find('Canvas');
iconNode.x = iconNode.parent.width / 2 - 10;
iconNode.y = iconNode.parent.height / 2 - 10;
iconNode.on(cc.Node.EventType.TOUCH_START, () => {
this.playAudioByUrl(this.data.audio_url);
})
},
initIcon() {},
curPage: null,
initBtn() {
initBtn() { },
this.curPage = 0;
const bottomPart = cc.find('Canvas/bottomPart');
bottomPart.zIndex = 5; // 提高层级
bottomPart.x = bottomPart.parent.width / 2;
bottomPart.y = -bottomPart.parent.height / 2;
const leftBtnNode = bottomPart.getChildByName('btn_left');
//节点中添加了button组件 则可以添加click事件监听
leftBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 0) {
return;
}
this.curPage = 0
this.leftMove();
cc.audioEngine.play(this.audioBtn.clip, false, 0.8)
})
const rightBtnNode = bottomPart.getChildByName('btn_right');
//节点中添加了button组件 则可以添加click事件监听
rightBtnNode.on('click', () => {
if (!this._cantouch) {
return;
}
if (this.curPage == 1) {
return;
}
this.curPage = 1
this.rightMove();
cc.audioEngine.play(this.audioBtn.clip, false, 0.5)
})
},
leftMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
},
leftMove() {},
rightMove() {
this._cantouch = false;
const len = this.pic1.parent.width;
cc.tween(this.pic1)
.to(1, { x: this.pic1.baseX - len }, { easing: 'cubicInOut' })
.start();
cc.tween(this.pic2)
.to(1, { x: this.pic2.baseX - len }, { easing: 'cubicInOut' })
.call(() => {
this._cantouch = true;
})
.start();
},
// update (dt) {},
......@@ -375,6 +274,16 @@ cc.Class({
})
},
getAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
if (cb) {
cb(audioClip);
}
});
}
},
playAudioByUrl(audio_url, cb = null) {
if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
......
......@@ -10,8 +10,6 @@ export default class NewClass extends cc.Component {
@property(cc.AudioSource)
audioSource:cc.AudioSource = null;
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
......@@ -25,6 +23,10 @@ export default class NewClass extends cc.Component {
this.titleTextLabel.string = text?text:"";
}
setAudioClip(ac:cc.AudioClip){
this.audioSource.clip = ac;
}
playSe(){
this.audioSource.play();
}
......
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