Commit 54d79795 authored by 章红平's avatar 章红平

提交

parent b0043bb5
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 162, "height": 162,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"text_1": { "1": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "9f2bff18-673d-4254-bfcf-8e67c6d62390", "uuid": "9f2bff18-673d-4254-bfcf-8e67c6d62390",
"rawTextureUuid": "32700d1f-9b5c-4576-8cd1-4061ed58ec0b", "rawTextureUuid": "32700d1f-9b5c-4576-8cd1-4061ed58ec0b",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 162, "height": 162,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"text_2": { "2": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "1baedfc5-f574-4b96-8f28-4a9bde529f34", "uuid": "1baedfc5-f574-4b96-8f28-4a9bde529f34",
"rawTextureUuid": "ff5fe14e-6b94-4529-84a3-e3b68a2a2f3a", "rawTextureUuid": "ff5fe14e-6b94-4529-84a3-e3b68a2a2f3a",
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
"height": 162, "height": 162,
"platformSettings": {}, "platformSettings": {},
"subMetas": { "subMetas": {
"text_3": { "3": {
"ver": "1.0.4", "ver": "1.0.4",
"uuid": "bfe5075f-6f40-406c-bcfb-3d53ce1c4301", "uuid": "bfe5075f-6f40-406c-bcfb-3d53ce1c4301",
"rawTextureUuid": "1061fa95-0194-4b25-a29b-e8ad794fde0f", "rawTextureUuid": "1061fa95-0194-4b25-a29b-e8ad794fde0f",
......
...@@ -21,16 +21,23 @@ ...@@ -21,16 +21,23 @@
"__id__": 2 "__id__": 2
}, },
{ {
"__id__": 5 "__id__": 8
}, },
{ {
"__id__": 8 "__id__": 11
} }
], ],
"_active": true, "_active": true,
"_components": [], "_components": [
{
"__id__": 14
},
{
"__id__": 15
}
],
"_prefab": { "_prefab": {
"__id__": 11 "__id__": 16
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -86,15 +93,19 @@ ...@@ -86,15 +93,19 @@
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
}, },
"_children": [], "_children": [
{
"__id__": 3
}
],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 3 "__id__": 6
} }
], ],
"_prefab": { "_prefab": {
"__id__": 4 "__id__": 7
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -143,6 +154,116 @@ ...@@ -143,6 +154,116 @@
"groupIndex": 0, "groupIndex": 0,
"_id": "" "_id": ""
}, },
{
"__type__": "cc.Node",
"_name": "New Label",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 4
}
],
"_prefab": {
"__id__": 5
},
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 95,
"g": 207,
"b": 208,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 200,
"height": 75.6
},
"_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.Label",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 3
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_srcBlendFactor": 770,
"_dstBlendFactor": 771,
"_string": "candi",
"_N$string": "candi",
"_fontSize": 60,
"_lineHeight": 60,
"_enableWrapText": true,
"_N$file": {
"__uuid__": "06add093-9d94-4388-b544-1b2ad59b5bc1"
},
"_isSystemFontUsed": false,
"_spacingX": 0,
"_batchAsBitmap": false,
"_styleFlags": 0,
"_underlineHeight": 0,
"_N$horizontalAlign": 1,
"_N$verticalAlign": 1,
"_N$fontFamily": "Arial",
"_N$overflow": 2,
"_N$cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__uuid__": "282fcbdc-d3bf-489b-84b9-56358c5441cb"
},
"fileId": "35WowoHDhEPajiTVLzQCcE",
"sync": false
},
{ {
"__type__": "cc.Sprite", "__type__": "cc.Sprite",
"_name": "", "_name": "",
...@@ -181,14 +302,14 @@ ...@@ -181,14 +302,14 @@
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "282fcbdc-d3bf-489b-84b9-56358c5441cb"
}, },
"fileId": "95FDfbQWNPlq3fq4wYlTU1", "fileId": "95FDfbQWNPlq3fq4wYlTU1",
"sync": false "sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_crad-back", "_name": "icon",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
...@@ -197,11 +318,11 @@ ...@@ -197,11 +318,11 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 6 "__id__": 9
} }
], ],
"_prefab": { "_prefab": {
"__id__": 7 "__id__": 10
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -213,8 +334,8 @@ ...@@ -213,8 +334,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 240, "width": 200,
"height": 275 "height": 240
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -255,7 +376,7 @@ ...@@ -255,7 +376,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 5 "__id__": 8
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -265,9 +386,7 @@ ...@@ -265,9 +386,7 @@
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": { "_spriteFrame": null,
"__uuid__": "efba3d4a-b76a-4eda-a65e-aa26f2357439"
},
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
"_fillType": 0, "_fillType": 0,
...@@ -288,14 +407,14 @@ ...@@ -288,14 +407,14 @@
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "282fcbdc-d3bf-489b-84b9-56358c5441cb"
}, },
"fileId": "c1uv2eSUhO7ZDzrM1TwY8H", "fileId": "71cqV8SNdEabf5k+v4MPPK",
"sync": false "sync": false
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "icon", "_name": "bg_crad-back",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 1 "__id__": 1
...@@ -304,11 +423,11 @@ ...@@ -304,11 +423,11 @@
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 9 "__id__": 12
} }
], ],
"_prefab": { "_prefab": {
"__id__": 10 "__id__": 13
}, },
"_opacity": 255, "_opacity": 255,
"_color": { "_color": {
...@@ -320,8 +439,8 @@ ...@@ -320,8 +439,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 100, "width": 240,
"height": 100 "height": 275
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -362,7 +481,7 @@ ...@@ -362,7 +481,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 8 "__id__": 11
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -372,7 +491,9 @@ ...@@ -372,7 +491,9 @@
], ],
"_srcBlendFactor": 770, "_srcBlendFactor": 770,
"_dstBlendFactor": 771, "_dstBlendFactor": 771,
"_spriteFrame": null, "_spriteFrame": {
"__uuid__": "efba3d4a-b76a-4eda-a65e-aa26f2357439"
},
"_type": 0, "_type": 0,
"_sizeMode": 1, "_sizeMode": 1,
"_fillType": 0, "_fillType": 0,
...@@ -393,18 +514,105 @@ ...@@ -393,18 +514,105 @@
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "282fcbdc-d3bf-489b-84b9-56358c5441cb"
}, },
"fileId": "71cqV8SNdEabf5k+v4MPPK", "fileId": "c1uv2eSUhO7ZDzrM1TwY8H",
"sync": false "sync": false
}, },
{
"__type__": "930ecDU5FRJxY/bSPjAYqS3",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"iconN": {
"__id__": 8
},
"backN": {
"__id__": 11
},
"wordLabel": {
"__id__": 4
},
"_id": ""
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 0,
"transition": 0,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": ""
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {
"__id__": 1 "__id__": 1
}, },
"asset": { "asset": {
"__id__": 0 "__uuid__": "282fcbdc-d3bf-489b-84b9-56358c5441cb"
}, },
"fileId": "", "fileId": "",
"sync": false "sync": false
......
// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.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
const {ccclass, property} = cc._decorator;
import SceneComponent from "../../scene/duiduipeng";
@ccclass
export default class card extends cc.Component {
@property(cc.Node)
iconN: cc.Node = null;
@property(cc.Node)
backN: cc.Node = null;
@property(cc.Label)
wordLabel: cc.Label = null;
mainControl:SceneComponent=null;
data=null
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
this.node.on("click",()=>{
this.doFlip()
})
}
initData(data,mainControl){
this.data=data;
this.mainControl=mainControl
this.node.off("click")
this.node.on("click",()=>{
this.doFlip()
})
this.updateBtnAble(false);
if(this.data.type=="img"){
this.iconN.active=true;
this.iconN.scaleX=1
this.mainControl.getSprForNodeByUrl(this.data.image,this.iconN,()=>{
if(this.iconN.width/this.iconN.height>200/240){
this.iconN.scale=200/this.iconN.width
}else{
this.iconN.scale=240/this.iconN.height
}
});
this.wordLabel.string=""
}else{
this.wordLabel.node.scaleX=1
this.wordLabel.string=this.data.text
}
}
updateBtnAble(interactable){
this.node.getComponent(cc.Button).interactable=interactable;
}
doFlip(cb=null){
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})
.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})
.start();
}
}
// update (dt) {}
}
{
"ver": "1.0.8",
"uuid": "930ec0d4-e454-49c5-8fdb-48f8c062a4b7",
"isPlugin": false,
"loadPluginInWeb": true,
"loadPluginInNative": true,
"loadPluginInEditor": false,
"subMetas": {}
}
\ No newline at end of file
...@@ -78,22 +78,22 @@ ...@@ -78,22 +78,22 @@
"__id__": 9 "__id__": 9
}, },
{ {
"__id__": 98 "__id__": 99
}, },
{ {
"__id__": 108 "__id__": 109
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 110
},
{ {
"__id__": 111 "__id__": 111
}, },
{ {
"__id__": 112 "__id__": 112
},
{
"__id__": 113
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -459,15 +459,12 @@ ...@@ -459,15 +459,12 @@
}, },
{ {
"__id__": 86 "__id__": 86
},
{
"__id__": 95
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 97 "__id__": 98
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3533,13 +3530,16 @@ ...@@ -3533,13 +3530,16 @@
"__id__": 87 "__id__": 87
}, },
{ {
"__id__": 90 "__id__": 89
},
{
"__id__": 93
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 94 "__id__": 97
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3602,9 +3602,6 @@ ...@@ -3602,9 +3602,6 @@
"_components": [ "_components": [
{ {
"__id__": 88 "__id__": 88
},
{
"__id__": 89
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3618,8 +3615,8 @@ ...@@ -3618,8 +3615,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 1334, "width": 3000,
"height": 750 "height": 3000
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
...@@ -3687,35 +3684,6 @@ ...@@ -3687,35 +3684,6 @@
"_atlas": null, "_atlas": null,
"_id": "e3Yed2G8tG4rTUdRGr4MSH" "_id": "e3Yed2G8tG4rTUdRGr4MSH"
}, },
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 87
},
"_enabled": true,
"alignMode": 2,
"_target": {
"__id__": 2
},
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 862,
"_originalHeight": 370,
"_id": "bcCSVhd2BIkYX6O9qFINI/"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "bg_tip", "_name": "bg_tip",
...@@ -3725,13 +3693,13 @@ ...@@ -3725,13 +3693,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 91 "__id__": 90
} }
], ],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 93 "__id__": 92
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3787,13 +3755,13 @@ ...@@ -3787,13 +3755,13 @@
"_name": "New Label", "_name": "New Label",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 90 "__id__": 89
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 92 "__id__": 91
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3849,7 +3817,7 @@ ...@@ -3849,7 +3817,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 91 "__id__": 90
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3884,7 +3852,7 @@ ...@@ -3884,7 +3852,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 90 "__id__": 89
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -3911,45 +3879,21 @@ ...@@ -3911,45 +3879,21 @@
"_atlas": null, "_atlas": null,
"_id": "4e7eA4mRJG46NUSjaqUBu8" "_id": "4e7eA4mRJG46NUSjaqUBu8"
}, },
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 862,
"_originalHeight": 370,
"_id": "f0zHqN8m9O1b7HYVbbjr+i"
},
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "btn_start", "_name": "btn_start",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 9 "__id__": 86
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 96 "__id__": 94
},
{
"__id__": 95
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -3976,7 +3920,7 @@ ...@@ -3976,7 +3920,7 @@
"ctor": "Float64Array", "ctor": "Float64Array",
"array": [ "array": [
0, 0,
-149.454, -187.688,
0, 0,
0, 0,
0, 0,
...@@ -3984,7 +3928,7 @@ ...@@ -3984,7 +3928,7 @@
1, 1,
1, 1,
1, 1,
1 0
] ]
}, },
"_eulerAngles": { "_eulerAngles": {
...@@ -4005,7 +3949,7 @@ ...@@ -4005,7 +3949,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 95 "__id__": 93
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4032,6 +3976,115 @@ ...@@ -4032,6 +3976,115 @@
"_atlas": null, "_atlas": null,
"_id": "365zF3jo5OCLkvdSjBXzhu" "_id": "365zF3jo5OCLkvdSjBXzhu"
}, },
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 93
},
"_enabled": true,
"_normalMaterial": null,
"_grayMaterial": null,
"duration": 0.1,
"zoomScale": 1.2,
"clickEvents": [
{
"__id__": 96
}
],
"_N$interactable": true,
"_N$enableAutoGrayEffect": false,
"_N$transition": 3,
"transition": 3,
"_N$normalColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"pressedColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_N$hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"hoverColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_N$disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_N$normalSprite": null,
"_N$pressedSprite": null,
"pressedSprite": null,
"_N$hoverSprite": null,
"hoverSprite": null,
"_N$disabledSprite": null,
"_N$target": null,
"_id": "aaUlu0oxtL8bqQX0S9kexa"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 2
},
"component": "",
"_componentId": "408a6f4ZfpM8Yzyg+IOGg/V",
"handler": "onStartClick",
"customEventData": ""
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 86
},
"_enabled": true,
"alignMode": 2,
"_target": null,
"_alignFlags": 45,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_verticalCenter": 0,
"_horizontalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 862,
"_originalHeight": 370,
"_id": "f0zHqN8m9O1b7HYVbbjr+i"
},
{ {
"__type__": "cc.Mask", "__type__": "cc.Mask",
"_name": "", "_name": "",
...@@ -4061,13 +4114,13 @@ ...@@ -4061,13 +4114,13 @@
}, },
"_children": [ "_children": [
{ {
"__id__": 99 "__id__": 100
}, },
{ {
"__id__": 102 "__id__": 103
}, },
{ {
"__id__": 105 "__id__": 106
} }
], ],
"_active": false, "_active": false,
...@@ -4125,11 +4178,11 @@ ...@@ -4125,11 +4178,11 @@
"_name": "font", "_name": "font",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 98 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 100 "__id__": 101
} }
], ],
"_active": true, "_active": true,
...@@ -4187,13 +4240,13 @@ ...@@ -4187,13 +4240,13 @@
"_name": "BRLNSDB", "_name": "BRLNSDB",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 99 "__id__": 100
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 101 "__id__": 102
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4249,7 +4302,7 @@ ...@@ -4249,7 +4302,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 100 "__id__": 101
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -4280,11 +4333,11 @@ ...@@ -4280,11 +4333,11 @@
"_name": "img", "_name": "img",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 98 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 103 "__id__": 104
} }
], ],
"_active": true, "_active": true,
...@@ -4342,13 +4395,13 @@ ...@@ -4342,13 +4395,13 @@
"_name": "icon", "_name": "icon",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 102 "__id__": 103
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 104 "__id__": 105
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4404,7 +4457,7 @@ ...@@ -4404,7 +4457,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 103 "__id__": 104
}, },
"_enabled": true, "_enabled": true,
"_materials": [], "_materials": [],
...@@ -4432,11 +4485,11 @@ ...@@ -4432,11 +4485,11 @@
"_name": "audio", "_name": "audio",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 98 "__id__": 99
}, },
"_children": [ "_children": [
{ {
"__id__": 106 "__id__": 107
} }
], ],
"_active": true, "_active": true,
...@@ -4494,13 +4547,13 @@ ...@@ -4494,13 +4547,13 @@
"_name": "btn", "_name": "btn",
"_objFlags": 0, "_objFlags": 0,
"_parent": { "_parent": {
"__id__": 105 "__id__": 106
}, },
"_children": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{ {
"__id__": 107 "__id__": 108
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4556,7 +4609,7 @@ ...@@ -4556,7 +4609,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 106 "__id__": 107
}, },
"_enabled": true, "_enabled": true,
"_clip": { "_clip": {
...@@ -4581,7 +4634,7 @@ ...@@ -4581,7 +4634,7 @@
"_active": false, "_active": false,
"_components": [ "_components": [
{ {
"__id__": 109 "__id__": 110
} }
], ],
"_prefab": null, "_prefab": null,
...@@ -4637,7 +4690,7 @@ ...@@ -4637,7 +4690,7 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 108 "__id__": 109
}, },
"_enabled": true, "_enabled": true,
"_materials": [ "_materials": [
...@@ -4726,9 +4779,11 @@ ...@@ -4726,9 +4779,11 @@
"__id__": 28 "__id__": 28
}, },
"tipLabel": { "tipLabel": {
"__id__": 92 "__id__": 91
},
"tipN": {
"__id__": 86
}, },
"tipN": null,
"_id": "eaTVUpqahPfZeO9+sUI7RP" "_id": "eaTVUpqahPfZeO9+sUI7RP"
} }
] ]
\ No newline at end of file
...@@ -15,8 +15,15 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -15,8 +15,15 @@ export default class SceneComponent extends MyCocosSceneComponent {
tipLabel: cc.Label = null tipLabel: cc.Label = null
@property(cc.Node) @property(cc.Node)
tipN: cc.Node = null tipN: cc.Node = null
@property(cc.Node)
countDown:cc.Node=null;
questionIndex = 0; questionIndex = 0;
gameState="watching" gameState="watching"
watchInterval=null;
gameInterval=null;
watchTime=null;
gameTime=null;
...@@ -62,7 +69,8 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -62,7 +69,8 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.find('Canvas/uiP').scale = this._mapScaleMin; cc.find('Canvas/uiP').scale = this._mapScaleMin;
} }
initCards() { initCards() {
let num = 4; let data=this.getRandomCardData();
let num = data.length;
this.cardParentN.removeAllChildren(); this.cardParentN.removeAllChildren();
let col = Math.ceil(num / 2); let col = Math.ceil(num / 2);
let width = 1250; let width = 1250;
...@@ -79,6 +87,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -79,6 +87,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else { } else {
card.y = +card.height / 2 + 10 card.y = +card.height / 2 + 10
} }
card.getComponent("card").initData(data[i],this)
} }
} else if (col == 2) { } else if (col == 2) {
...@@ -97,6 +106,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -97,6 +106,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else { } else {
card.y = +card.height / 2 + 10 card.y = +card.height / 2 + 10
} }
card.getComponent("card").initData(data[i],this)
} }
} else { } else {
...@@ -109,6 +119,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -109,6 +119,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} else { } else {
card.y = +card.height / 2 + 10 card.y = +card.height / 2 + 10
} }
card.getComponent("card").initData(data[i],this)
} }
} }
} }
...@@ -127,15 +138,73 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -127,15 +138,73 @@ export default class SceneComponent extends MyCocosSceneComponent {
initTime(){ initTime(){
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");
let numTime=this.data.questions[0].watchTime; this.watchTime=this.data.questions[0].watchTime;
if(this.gameState=="game")numTime=this.data.questions[0].gameTime; this.gameTime=this.data.questions[0].gameTime;
timeN.getComponentInChildren(cc.Label).string=this.data.numTime; let numTime= this.watchTime;
if(this.gameState=="game")numTime=this.gameTime;
timeN.getComponentInChildren(cc.Label).string=numTime;
timeN.active=true; timeN.active=true;
timeN1.active=false; timeN1.active=false;
} }
updateTime(){ updateTime(){
let timeN=cc.find("Canvas/uiP/timeN/bg_time");
let timeN1=cc.find("Canvas/uiP/timeN/bg_time2");
let numTime=this.watchTime;
if(this.gameState=="game")numTime=this.gameTime;
timeN.getComponentInChildren(cc.Label).string=numTime;
timeN1.getComponentInChildren(cc.Label).string=numTime;
timeN.active=true;
timeN1.active=false;
if(numTime<=5){
timeN.active=false;
timeN1.active=true;
if(numTime<=1){
if(numTime==1)this.playLocalAudio("time1")
}else{
this.playLocalAudio("time2")
}
if(this.gameState=="watching"){
if(numTime==1||numTime==2||numTime==3){
}
}
}
} }
onStartClick(){
this.tipN.active=false;
this.playLocalAudio("btn");
let children=this.cardParentN.children;
for(let i=0;i<children.length;i++){
children[i].getComponent("card").doFlip(()=>{
})
}
}
startWatch(){
this.gameState=="watching"
this.initTime();
this.clearntervals();
this.watchInterval=setInterval(()=>{
this.watchTime--;
if( this.watchTime<=0){
this.clearntervals();
}
this.updateTime();
},1000)
};
clearntervals(){
if(this.watchInterval){
clearInterval(this.watchInterval);
}
if(this.gameInterval){
clearInterval(this.gameInterval);
}
}
initView() { initView() {
......
...@@ -161,6 +161,15 @@ export class MyCocosSceneComponent extends cc.Component { ...@@ -161,6 +161,15 @@ export class MyCocosSceneComponent extends cc.Component {
} }
}) })
} }
getSprForNodeByUrl(url,node,cb=null) {
const spr = node.getComponent(cc.Sprite);
this.getSpriteFrimeByUrl(url, (sf) => {
spr.spriteFrame = sf;
if (cb) {
cb();
}
})
}
playAudioByUrl(audio_url, cb = null) { playAudioByUrl(audio_url, cb = null) {
if (audio_url) { if (audio_url) {
......
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