Commit 1592a91a authored by 章红平's avatar 章红平

提交

parent 54d79795
...@@ -25,19 +25,22 @@ ...@@ -25,19 +25,22 @@
}, },
{ {
"__id__": 11 "__id__": 11
},
{
"__id__": 14
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 14 "__id__": 17
}, },
{ {
"__id__": 15 "__id__": 18
} }
], ],
"_prefab": { "_prefab": {
"__id__": 16 "__id__": 19
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -89,7 +92,7 @@ ...@@ -89,7 +92,7 @@
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_card", "_name": "bg_card",
"_objFlags": 0, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
...@@ -310,7 +313,7 @@ ...@@ -310,7 +313,7 @@
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "icon", "_name": "icon",
"_objFlags": 0, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
...@@ -519,6 +522,121 @@ ...@@ -519,6 +522,121 @@
"fileId": "c1uv2eSUhO7ZDzrM1TwY8H", "fileId": "c1uv2eSUhO7ZDzrM1TwY8H",
"sync": false "sync": false
}, },
{
"__type__": "cc.Node",
"_name": "right_ske",
"_objFlags": 0,
"_parent": {
"__id__": 1
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 15
}
],
"_prefab": {
"__id__": 16
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 136,
"height": 132
},
"_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__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 14
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "Armature",
"_animationName": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "97d73a25-19eb-40cd-815d-4c9ee3b688c6#346e8069-b050-46a2-9285-6aa34afce69a",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "97d73a25-19eb-40cd-815d-4c9ee3b688c6"
},
"_N$dragonAtlasAsset": {
"__uuid__": "346e8069-b050-46a2-9285-6aa34afce69a"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "282fcbdc-d3bf-489b-84b9-56358c5441cb"
},
"fileId": "c5HbFiY0lGdbpsPIcRa1Si",
"sync": false
},
{ {
"__type__": "930ecDU5FRJxY/bSPjAYqS3", "__type__": "930ecDU5FRJxY/bSPjAYqS3",
"_name": "", "_name": "",
...@@ -536,6 +654,9 @@ ...@@ -536,6 +654,9 @@
"wordLabel": { "wordLabel": {
"__id__": 4 "__id__": 4
}, },
"dragon": {
"__id__": 15
},
"_id": "" "_id": ""
}, },
{ {
......
...@@ -16,6 +16,8 @@ export default class card extends cc.Component { ...@@ -16,6 +16,8 @@ export default class card extends cc.Component {
backN: cc.Node = null; backN: cc.Node = null;
@property(cc.Label) @property(cc.Label)
wordLabel: cc.Label = null; wordLabel: cc.Label = null;
@property(dragonBones.ArmatureDisplay)
dragon: dragonBones.ArmatureDisplay = null;
mainControl:SceneComponent=null; mainControl:SceneComponent=null;
data=null data=null
...@@ -24,21 +26,16 @@ export default class card extends cc.Component { ...@@ -24,21 +26,16 @@ export default class card extends cc.Component {
// onLoad () {} // onLoad () {}
start () { start () {
this.node.on("click",()=>{
this.doFlip()
})
} }
initData(data,mainControl){ initData(data,mainControl){
this.data=data; this.data=data;
this.mainControl=mainControl this.mainControl=mainControl
this.node.off("click") this.node.off("click")
this.node.on("click",()=>{ this.node.on("click",(e)=>{
this.doFlip() console.log("e=====",e)
this.mainControl.clickCard(e.node,this.data);
}) })
this.updateBtnAble(false);
if(this.data.type=="img"){ if(this.data.type=="img"){
this.iconN.active=true; this.iconN.active=true;
this.iconN.scaleX=1 this.iconN.scaleX=1
...@@ -59,6 +56,31 @@ export default class card extends cc.Component { ...@@ -59,6 +56,31 @@ export default class card extends cc.Component {
updateBtnAble(interactable){ updateBtnAble(interactable){
this.node.getComponent(cc.Button).interactable=interactable; this.node.getComponent(cc.Button).interactable=interactable;
} }
playDragon(cb){
return new Promise((resolve,reject)=>{
this.dragon.node.active=true;
this.dragon.playAnimation("newAnimation", 1)
this.dragon.on(dragonBones.EventObject.COMPLETE,()=>{
if(cb){
cb();
}
resolve(null)
})
})
}
doHide(cb){
return new Promise((resolve,reject)=>{
this.node.stopAllActions()
cc.tween(this.node)
.to(0.3,{scale:0})
.call(()=>{
if(cb)cb()
resolve(null)
this.node.destroy();
})
.start();
})
}
doFlip(cb=null){ doFlip(cb=null){
this.node.stopAllActions(); this.node.stopAllActions();
if(this.node.scaleX>0){ if(this.node.scaleX>0){
...@@ -70,6 +92,9 @@ export default class card extends cc.Component { ...@@ -70,6 +92,9 @@ export default class card extends cc.Component {
this.backN.active=false this.backN.active=false
}) })
.to(0.25,{scaleX:-1}) .to(0.25,{scaleX:-1})
.call(()=>{
if(cb)cb()
})
.start(); .start();
}else{ }else{
cc.tween(this.node) cc.tween(this.node)
...@@ -80,11 +105,50 @@ export default class card extends cc.Component { ...@@ -80,11 +105,50 @@ export default class card extends cc.Component {
this.backN.active=true this.backN.active=true
}) })
.to(0.25,{scaleX:1}) .to(0.25,{scaleX:1})
.call(()=>{
if(cb)cb()
})
.start(); .start();
} }
} }
asyncDoFlip(cb){
return new Promise((resolve, reject)=>{
//做一些异步操作
this.node.stopAllActions();
if(this.node.scaleX>0){
cc.tween(this.node)
.to(0.25,{scaleX:0})
.call(()=>{
this.iconN.scaleX=-this.iconN.scaleX
this.wordLabel.node.scaleX=-1
this.backN.active=false
})
.to(0.25,{scaleX:-1})
.call(()=>{
if(cb)cb()
resolve(null);
})
.start();
}else{
cc.tween(this.node)
.to(0.25,{scaleX:0})
.call(()=>{
this.iconN.scaleX=-this.iconN.scaleX
this.wordLabel.node.scaleX=1
this.backN.active=true
})
.to(0.25,{scaleX:1})
.call(()=>{
if(cb)cb()
resolve(null);
})
.start();
}
});
}
// update (dt) {} // update (dt) {}
......
...@@ -78,22 +78,22 @@ ...@@ -78,22 +78,22 @@
"__id__": 9 "__id__": 9
}, },
{ {
"__id__": 99 "__id__": 101
}, },
{ {
"__id__": 109 "__id__": 123
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 111 "__id__": 125
}, },
{ {
"__id__": 112 "__id__": 126
}, },
{ {
"__id__": 113 "__id__": 127
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -311,7 +311,7 @@ ...@@ -311,7 +311,7 @@
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_1", "_name": "bg_1",
"_objFlags": 0, "_objFlags": 512,
"_parent": { "_parent": {
"__id__": 5 "__id__": 5
}, },
...@@ -459,12 +459,15 @@ ...@@ -459,12 +459,15 @@
}, },
{ {
"__id__": 86 "__id__": 86
},
{
"__id__": 88
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 98 "__id__": 100
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3518,6 +3521,98 @@ ...@@ -3518,6 +3521,98 @@
"fileId": "", "fileId": "",
"sync": false "sync": false
}, },
{
"__type__": "cc.Node",
"_name": "countDown",
"_objFlags": 0,
"_parent": {
"__id__": 9
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 87
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 89,
"height": 159
},
"_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": "a7JZI5ZsJDy6GJsPo0tTzT"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": null,
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "652JoN3OJM4K2rroMx8He6"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_tip", "_name": "bg_tip",
...@@ -3527,19 +3622,19 @@ ...@@ -3527,19 +3622,19 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 87 "__id__": 89
}, },
{ {
"__id__": 89 "__id__": 91
}, },
{ {
"__id__": 93 "__id__": 95
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 97 "__id__": 99
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3595,13 +3690,13 @@ ...@@ -3595,13 +3690,13 @@
"_name": "bg", "_name": "bg",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 86 "__id__": 88
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 88 "__id__": 90
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3657,7 +3752,7 @@ ...@@ -3657,7 +3752,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 87 "__id__": 89
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3689,17 +3784,17 @@ ...@@ -3689,17 +3784,17 @@
"_name": "bg_tip", "_name": "bg_tip",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 86 "__id__": 88
}, },
"_children": [ "_children": [
{ {
"__id__": 90 "__id__": 92
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 92 "__id__": 94
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3755,13 +3850,13 @@ ...@@ -3755,13 +3850,13 @@
"_name": "New Label", "_name": "New Label",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 89 "__id__": 91
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 91 "__id__": 93
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3817,7 +3912,7 @@ ...@@ -3817,7 +3912,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 90 "__id__": 92
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3852,7 +3947,7 @@ ...@@ -3852,7 +3947,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 89 "__id__": 91
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3884,16 +3979,16 @@ ...@@ -3884,16 +3979,16 @@
"_name": "btn_start", "_name": "btn_start",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 86 "__id__": 88
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 94 "__id__": 96
}, },
{ {
"__id__": 95 "__id__": 97
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3949,7 +4044,7 @@ ...@@ -3949,7 +4044,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 93 "__id__": 95
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3981,7 +4076,7 @@ ...@@ -3981,7 +4076,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 93 "__id__": 95
}, },
"_enabled": true, "_enabled": true,
"_normalMaterial": null, "_normalMaterial": null,
...@@ -3990,7 +4085,7 @@ ...@@ -3990,7 +4085,7 @@
"zoomScale": 1.2, "zoomScale": 1.2,
"clickEvents": [ "clickEvents": [
{ {
"__id__": 96 "__id__": 98
} }
], ],
"_N$interactable": true, "_N$interactable": true,
...@@ -4063,7 +4158,7 @@ ...@@ -4063,7 +4158,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 86 "__id__": 88
}, },
"_enabled": true, "_enabled": true,
"alignMode": 2, "alignMode": 2,
...@@ -4114,13 +4209,13 @@ ...@@ -4114,13 +4209,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 100 "__id__": 102
}, },
{ {
"__id__": 103 "__id__": 105
}, },
{ {
"__id__": 106 "__id__": 112
} }
], ],
"_active": false, "_active": false,
...@@ -4178,11 +4273,11 @@ ...@@ -4178,11 +4273,11 @@
"_name": "font", "_name": "font",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 99 "__id__": 101
}, },
"_children": [ "_children": [
{ {
"__id__": 101 "__id__": 103
} }
], ],
"_active": true, "_active": true,
...@@ -4240,13 +4335,13 @@ ...@@ -4240,13 +4335,13 @@
"_name": "BRLNSDB", "_name": "BRLNSDB",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 100 "__id__": 102
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 102 "__id__": 104
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4302,7 +4397,7 @@ ...@@ -4302,7 +4397,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 101 "__id__": 103
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -4333,11 +4428,17 @@ ...@@ -4333,11 +4428,17 @@
"_name": "img", "_name": "img",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 99 "__id__": 101
}, },
"_children": [ "_children": [
{ {
"__id__": 104 "__id__": 106
},
{
"__id__": 108
},
{
"__id__": 110
} }
], ],
"_active": true, "_active": true,
...@@ -4392,16 +4493,16 @@ ...@@ -4392,16 +4493,16 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "icon", "_name": "1",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 103 "__id__": 105
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 105 "__id__": 107
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4415,8 +4516,8 @@ ...@@ -4415,8 +4516,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 138, "width": 89,
"height": 141 "height": 159
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -4450,21 +4551,21 @@ ...@@ -4450,21 +4551,21 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "1blU2OArJIfoC9XfupGxJG" "_id": "5em6Lr5ehGsrPw2bxLOB3K"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 104 "__id__": 106
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "6fbc30a8-3c49-44ae-8ba4-7f56f385b78a" "__uuid__": "9f2bff18-673d-4254-bfcf-8e67c6d62390"
}, },
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
...@@ -4478,22 +4579,22 @@ ...@@ -4478,22 +4579,22 @@
"_fillRange": 0, "_fillRange": 0,
"_isTrimmedMode": true, "_isTrimmedMode": true,
"_atlas": null, "_atlas": null,
"_id": "03GEWUEZJGyKormWgIWCtM" "_id": "dcu6pSoU5GsqTibS+B2w8q"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "audio", "_name": "2",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 99 "__id__": 105
}, },
"_children": [ "_children": [],
"_active": true,
"_components": [
{ {
"__id__": 107 "__id__": 109
} }
], ],
"_active": true,
"_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -4505,8 +4606,8 @@ ...@@ -4505,8 +4606,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 93,
"height": 0 "height": 160
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -4540,20 +4641,48 @@ ...@@ -4540,20 +4641,48 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "d9f+b0lmZGSJJae6zrADhp" "_id": "0acf2ytBZP/bmyQhijJXZj"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 108
},
"_enabled": true,
"_materials": [],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "1baedfc5-f574-4b96-8f28-4a9bde529f34"
},
"_type": 0,
"_sizeMode": 1,
"_fillType": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "292MMy38NJrrHZHTrTBJHR"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn", "_name": "3",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 106 "__id__": 105
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 108 "__id__": 111
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4567,8 +4696,8 @@ ...@@ -4567,8 +4696,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 91,
"height": 0 "height": 162
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -4602,41 +4731,62 @@ ...@@ -4602,41 +4731,62 @@
"_is3DNode": false, "_is3DNode": false,
"_groupIndex": 0, "_groupIndex": 0,
"groupIndex": 0, "groupIndex": 0,
"_id": "e87DSaFCVJfb2PAUkf4/o7" "_id": "78NkXS7Z9J4LuVrngFMA8w"
}, },
{ {
"__type__": "cc.AudioSource", "__type__": "cc.Sprite",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 107 "__id__": 110
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_materials": [],
"__uuid__": "e825a6b2-2702-4af8-9d78-c4a25b2a0587" "_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_spriteFrame": {
"__uuid__": "bfe5075f-6f40-406c-bcfb-3d53ce1c4301"
}, },
"_volume": 1, "_type": 0,
"_mute": false, "_sizeMode": 1,
"_loop": false, "_fillType": 0,
"_firstlyEnabled": true, "_fillCenter": {
"playOnLoad": false, "__type__": "cc.Vec2",
"preload": false, "x": 0,
"_id": "dey05oKrBIspvsDa6pOIQz" "y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_atlas": null,
"_id": "437jZM4xlDm5v/b9DVRn8X"
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "1-游戏介绍,点击start开始", "_name": "audio",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 2 "__id__": 101
}, },
"_children": [], "_children": [
"_active": false,
"_components": [
{ {
"__id__": 110 "__id__": 113
},
{
"__id__": 115
},
{
"__id__": 117
},
{
"__id__": 119
},
{
"__id__": 121
} }
], ],
"_active": true,
"_components": [],
"_prefab": null, "_prefab": null,
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -4648,8 +4798,8 @@ ...@@ -4648,8 +4798,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1334, "width": 0,
"height": 750 "height": 0
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -4661,7 +4811,474 @@ ...@@ -4661,7 +4811,474 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-417.886, 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": "d9f+b0lmZGSJJae6zrADhp"
},
{
"__type__": "cc.Node",
"_name": "btn",
"_objFlags": 0,
"_parent": {
"__id__": 112
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 114
}
],
"_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,
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": "e87DSaFCVJfb2PAUkf4/o7"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 113
},
"_enabled": true,
"_clip": {
"__uuid__": "e825a6b2-2702-4af8-9d78-c4a25b2a0587"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "dey05oKrBIspvsDa6pOIQz"
},
{
"__type__": "cc.Node",
"_name": "time2",
"_objFlags": 0,
"_parent": {
"__id__": 112
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 116
}
],
"_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,
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": "b58atHqApOj5ahA3lsEfYh"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 115
},
"_enabled": true,
"_clip": {
"__uuid__": "a3dcfb84-6ad5-474b-8811-02d29d883e0c"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "ccPGJdM81FAIW44acoBU3P"
},
{
"__type__": "cc.Node",
"_name": "time1",
"_objFlags": 0,
"_parent": {
"__id__": 112
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 118
}
],
"_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,
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": "65dkblFw9O0K2u7JvnpwRY"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 117
},
"_enabled": true,
"_clip": {
"__uuid__": "9b756e7b-3912-4c0d-bc1e-312383139f87"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "1dJKxT6RtNTrWUpO7dQ16v"
},
{
"__type__": "cc.Node",
"_name": "false",
"_objFlags": 0,
"_parent": {
"__id__": 112
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 120
}
],
"_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,
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": "2a48qP1e9BabQXLpYhBpfq"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 119
},
"_enabled": true,
"_clip": {
"__uuid__": "f99ce72a-808a-411f-a6c9-f8fa07b6053c"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "174FDgZCFMcKPm213dQdBq"
},
{
"__type__": "cc.Node",
"_name": "true",
"_objFlags": 0,
"_parent": {
"__id__": 112
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 122
}
],
"_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,
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": "43p/xrzhxHmrEL5kprJ/qm"
},
{
"__type__": "cc.AudioSource",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 121
},
"_enabled": true,
"_clip": {
"__uuid__": "dd53a306-c802-4654-b0f9-d562c7b52bbb"
},
"_volume": 1,
"_mute": false,
"_loop": false,
"_firstlyEnabled": true,
"playOnLoad": false,
"preload": false,
"_id": "0cQEzE2YlKs6cwm1oEk6p+"
},
{
"__type__": "cc.Node",
"_name": "1-游戏介绍,点击start开始",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 124
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 1334,
"height": 750
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_trs": {
"__type__": "TypedArray",
"ctor": "Float64Array",
"array": [
0,
-417.886,
0, 0,
0, 0,
0, 0,
...@@ -4690,7 +5307,7 @@ ...@@ -4690,7 +5307,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 109 "__id__": 123
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4779,9 +5396,12 @@ ...@@ -4779,9 +5396,12 @@
"__id__": 28 "__id__": 28
}, },
"tipLabel": { "tipLabel": {
"__id__": 91 "__id__": 93
}, },
"tipN": { "tipN": {
"__id__": 88
},
"countDown": {
"__id__": 86 "__id__": 86
}, },
"_id": "eaTVUpqahPfZeO9+sUI7RP" "_id": "eaTVUpqahPfZeO9+sUI7RP"
......
...@@ -23,6 +23,10 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -23,6 +23,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
gameInterval=null; gameInterval=null;
watchTime=null; watchTime=null;
gameTime=null; gameTime=null;
clickNode1:cc.Node=null;
clickNodeData1=null
canTouch=false
completeNum=0;
...@@ -50,7 +54,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -50,7 +54,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
super.start(); super.start();
this.initBg(); this.initBg();
this.initData(); this.initData();
this.initTime(); // cc.find("Canvas/uiP/timeN").active=false;
} }
_cantouch = null; _cantouch = null;
...@@ -136,6 +140,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -136,6 +140,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
return data return data
} }
initTime(){ initTime(){
// cc.find("Canvas/uiP/timeN").active=true;
let timeN=cc.find("Canvas/uiP/timeN/bg_time"); let timeN=cc.find("Canvas/uiP/timeN/bg_time");
let timeN1=cc.find("Canvas/uiP/timeN/bg_time2"); let timeN1=cc.find("Canvas/uiP/timeN/bg_time2");
this.watchTime=this.data.questions[0].watchTime; this.watchTime=this.data.questions[0].watchTime;
...@@ -158,16 +163,29 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -158,16 +163,29 @@ export default class SceneComponent extends MyCocosSceneComponent {
if(numTime<=5){ if(numTime<=5){
timeN.active=false; timeN.active=false;
timeN1.active=true; timeN1.active=true;
if(numTime<=1){ // if(this.gameState=="game"){
if(numTime==1)this.playLocalAudio("time1") if(numTime<=1){
}else{ if(numTime==1)this.playLocalAudio("time1")
this.playLocalAudio("time2") }else{
} this.playLocalAudio("time2")
if(this.gameState=="watching"){
if(numTime==1||numTime==2||numTime==3){
} }
} // }else{
if(this.gameState=="watching"){
if(numTime==1||numTime==2||numTime==3){
this.countDown.active=true;
this.countDown.stopAllActions();
this.countDown.scale=1;
this.getSprforNode(numTime, this.countDown);
cc.tween( this.countDown)
.to(0.8,{scale:0.7})
.call(()=>{
this.countDown.active=false;
})
.start()
}
}
// }
} }
...@@ -177,27 +195,92 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -177,27 +195,92 @@ export default class SceneComponent extends MyCocosSceneComponent {
this.playLocalAudio("btn"); this.playLocalAudio("btn");
let children=this.cardParentN.children; let children=this.cardParentN.children;
for(let i=0;i<children.length;i++){ for(let i=0;i<children.length;i++){
children[i].getComponent("card").doFlip(()=>{ children[i].getComponent("card").asyncDoFlip(()=>{
if(i==children.length-1)this.startWatch();
}) })
} }
} }
startWatch(){ startWatch(){
this.canTouch=false
this.gameState=="watching" this.gameState=="watching"
this.initTime();
this.clearntervals(); this.clearntervals();
this.initTime();
this.watchInterval=setInterval(()=>{ this.watchInterval=setInterval(()=>{
this.watchTime--; this.watchTime--;
console.log("watchtime=====",this.watchTime)
if( this.watchTime<=0){ if( this.watchTime<=0){
this.clearntervals(); this.clearntervals();
let children=this.cardParentN.children;
for(let i=0;i<children.length;i++){
children[i].getComponent("card").asyncDoFlip(()=>{
if(i==children.length-1)this.startGame();
})
}
} }
this.updateTime(); this.updateTime();
},1000) },1000)
}; };
startGame(){
this.canTouch=true;
this.gameState="game"
this.clearntervals();
this.initTime();
this.gameInterval=setInterval(()=>{
this.gameTime--;
console.log("watchtime=====",this.gameTime)
if( this.gameTime<=0){
this.clearntervals();
}
this.updateTime();
},1000)
}
clickCard(node,data){
if(this.canTouch){
if(!this.clickNode1){
this.clickNode1=node;
this.clickNodeData1=data;
this.clickNode1.getComponent("card").asyncDoFlip()
this.playAudioByUrl( this.clickNodeData1.audio);
}else{
if(this.clickNode1==node){
return;
// this.playAudioByUrl( this.clickNodeData1.audio);
}else{
this.canTouch=false
Promise
.all([node.getComponent("card").asyncDoFlip(), this.playAudioByUrl( data.audio)])
.then(()=>{
Promise.all([node.getComponent("card").playDragon(), this.clickNode1.getComponent("card").playDragon(),this.playLocalAudio("true")])
.then(()=>{
Promise.all([node.getComponent("card").doHide(), this.clickNode1.getComponent("card").doHide()])
.then(()=>{
this.canTouch=true;
this.clickNode1=null
this.clickNodeData1=null;
this.completeNum++
if(this.completeNum== this.data.questions[this.questionIndex].options.length/2){
console.log("allTrue===")
this.clearntervals();
}
console.log("allActionFish=====")
})
})
}
)
}
}
}
}
clearntervals(){ clearntervals(){
// cc.find("Canvas/uiP/timeN").active=false;
if(this.watchInterval){ if(this.watchInterval){
clearInterval(this.watchInterval); clearInterval(this.watchInterval);
} }
...@@ -206,7 +289,6 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -206,7 +289,6 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
} }
initView() { initView() {
this.initBg(); this.initBg();
this.initBtn(); this.initBtn();
......
...@@ -105,17 +105,17 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -105,17 +105,17 @@ export class MyCocosSceneComponent extends cc.Component {
}); });
} }
log (str) { log(str) {
const node = cc.find('middleLayer'); const node = cc.find('middleLayer');
if(node){ if (node) {
node.getComponent('middleLayer').log(str); node.getComponent('middleLayer').log(str);
}else{ } else {
cc.log(str); cc.log(str);
} }
} }
onLoadEnd() { onLoadEnd() {
} }
...@@ -132,7 +132,7 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -132,7 +132,7 @@ export class MyCocosSceneComponent extends cc.Component {
// ------------------------------------------------ // ------------------------------------------------
getSprNode(resName) { getSprNode(resName) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame; const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
...@@ -140,6 +140,10 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -140,6 +140,10 @@ export class MyCocosSceneComponent extends cc.Component {
node.addComponent(cc.Sprite).spriteFrame = sf; node.addComponent(cc.Sprite).spriteFrame = sf;
return node; return node;
} }
getSprforNode(resName, node) {
const sf = cc.find('Canvas/res/img/' + resName).getComponent(cc.Sprite).spriteFrame;
node.getComponent(cc.Sprite).spriteFrame = sf;
}
getSpriteFrimeByUrl(url, cb) { getSpriteFrimeByUrl(url, cb) {
...@@ -161,7 +165,7 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -161,7 +165,7 @@ export class MyCocosSceneComponent extends cc.Component {
} }
}) })
} }
getSprForNodeByUrl(url,node,cb=null) { getSprForNodeByUrl(url, node, cb = null) {
const spr = node.getComponent(cc.Sprite); const spr = node.getComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => { this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf; spr.spriteFrame = sf;
...@@ -173,15 +177,19 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -173,15 +177,19 @@ export class MyCocosSceneComponent extends cc.Component {
playAudioByUrl(audio_url, cb = null) { playAudioByUrl(audio_url, cb = null) {
if (audio_url) { if (audio_url) {
cc.assetManager.loadRemote(audio_url, (err, audioClip) => { return new Promise((resole, reject) => {
const audioId = cc.audioEngine.play(audioClip, false, 0.8); cc.assetManager.loadRemote(audio_url, (err, audioClip) => {
if (cb) { cc.audioEngine.stopAll();
const audioId = cc.audioEngine.play(audioClip, false, 0.8);
cc.audioEngine.setFinishCallback(audioId, () => { cc.audioEngine.setFinishCallback(audioId, () => {
cb(); if(cb)cb();
}); resole(null);
} })
}); })
}else{ })
} else {
cb && cb(); cb && cb();
} }
} }
......
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