Commit 370cea16 authored by linzhiguo's avatar linzhiguo

+ come on 动画 | 逻辑

+ 框架代码
parent dafec3db
{
"ver": "2.0.1",
"uuid": "fa5062c9-e0d3-4988-8e91-53e6cea9662d",
"downloadMode": 0,
"duration": 3.761633,
"subMetas": {}
}
\ No newline at end of file
{"frameRate":24,"name":"comeon","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-360.46,"y":-155.14,"width":720,"height":199},"bone":[{"name":"root"},{"name":"WL-comeon","parent":"root","transform":{"x":-2.65,"y":-22.55}}],"slot":[{"name":"WL-comeon","parent":"WL-comeon"}],"skin":[{"slot":[{"name":"WL-comeon","display":[{"name":"WL-comeon","transform":{"x":2.19,"y":-33.09}}]}]}],"animation":[{"duration":34,"playTimes":0,"name":"newAnimation","bone":[{"name":"WL-comeon","translateFrame":[{"duration":12,"tweenEasing":0,"y":-477.5},{"duration":6,"tweenEasing":0,"y":24.18},{"duration":6,"tweenEasing":0,"y":-2.9},{"duration":10,"tweenEasing":0,"y":24.18},{"duration":0,"y":567.5}]}]}],"defaultActions":[{"gotoAndPlay":"newAnimation"}],"canvas":{"width":1280,"height":720}}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "23cf49aa-e3b4-4f37-bfc7-53efb370beec",
"subMetas": {}
}
\ No newline at end of file
{"width":1024,"imagePath":"comeon_tex.png","height":256,"name":"comeon","SubTexture":[{"width":720,"y":1,"height":199,"name":"WL-comeon","x":1}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "f4dcfc9d-c0a9-4b98-91b9-e1ac1883c802",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d4a66683-df79-4d97-a386-457122d080b9",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 1024,
"height": 256,
"platformSettings": {},
"subMetas": {
"comeon_tex": {
"ver": "1.0.4",
"uuid": "84402521-8a6e-4545-b793-bbfdab58a19b",
"rawTextureUuid": "d4a66683-df79-4d97-a386-457122d080b9",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": -151,
"offsetY": 27.5,
"trimX": 1,
"trimY": 1,
"width": 720,
"height": 199,
"rawWidth": 1024,
"rawHeight": 256,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
......@@ -17,7 +17,7 @@
"__id__": 2
},
{
"__id__": 242
"__id__": 245
}
],
"_active": false,
......@@ -124,18 +124,21 @@
},
{
"__id__": 236
},
{
"__id__": 239
}
],
"_active": true,
"_components": [
{
"__id__": 239
"__id__": 242
},
{
"__id__": 240
"__id__": 243
},
{
"__id__": 241
"__id__": 244
}
],
"_prefab": null,
......@@ -13015,6 +13018,138 @@
"_originalHeight": 0,
"_id": "46Z6t2RmxGBbBdNwi679dP"
},
{
"__type__": "cc.Node",
"_name": "comeon",
"_objFlags": 0,
"_parent": {
"__id__": 2
},
"_children": [],
"_active": false,
"_components": [
{
"__id__": 240
},
{
"__id__": 241
}
],
"_prefab": null,
"_opacity": 255,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 199
},
"_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": "7cT+5ZNvNGiqkWtr6Ej27a"
},
{
"__type__": "dragonBones.ArmatureDisplay",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 239
},
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
}
],
"_armatureName": "Armature",
"_animationName": "",
"_preCacheMode": 0,
"_cacheMode": 0,
"playTimes": -1,
"premultipliedAlpha": false,
"_armatureKey": "23cf49aa-e3b4-4f37-bfc7-53efb370beec#f4dcfc9d-c0a9-4b98-91b9-e1ac1883c802",
"_accTime": 0,
"_playCount": 0,
"_frameCache": null,
"_curFrame": null,
"_playing": false,
"_armatureCache": null,
"_N$dragonAsset": {
"__uuid__": "23cf49aa-e3b4-4f37-bfc7-53efb370beec"
},
"_N$dragonAtlasAsset": {
"__uuid__": "f4dcfc9d-c0a9-4b98-91b9-e1ac1883c802"
},
"_N$_defaultArmatureIndex": 0,
"_N$_animationIndex": 0,
"_N$_defaultCacheMode": 0,
"_N$timeScale": 1,
"_N$debugBones": false,
"_N$enableBatch": false,
"_id": "19F7+WnwVPAqks/aB4EMQk"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 239
},
"_enabled": true,
"alignMode": 1,
"_target": null,
"_alignFlags": 18,
"_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": 0,
"_originalHeight": 0,
"_id": "7dXRGWhgJH258ElrfYD+8y"
},
{
"__type__": "cc.Canvas",
"_name": "",
......@@ -13107,10 +13242,10 @@
},
"_children": [
{
"__id__": 243
"__id__": 246
},
{
"__id__": 248
"__id__": 251
}
],
"_active": true,
......@@ -13168,11 +13303,11 @@
"_name": "img",
"_objFlags": 0,
"_parent": {
"__id__": 242
"__id__": 245
},
"_children": [
{
"__id__": 244
"__id__": 247
}
],
"_active": true,
......@@ -13230,17 +13365,17 @@
"_name": "icon_0",
"_objFlags": 0,
"_parent": {
"__id__": 243
"__id__": 246
},
"_children": [
{
"__id__": 245
"__id__": 248
}
],
"_active": true,
"_components": [
{
"__id__": 247
"__id__": 250
}
],
"_prefab": null,
......@@ -13296,13 +13431,13 @@
"_name": "icon_1",
"_objFlags": 0,
"_parent": {
"__id__": 244
"__id__": 247
},
"_children": [],
"_active": true,
"_active": false,
"_components": [
{
"__id__": 246
"__id__": 249
}
],
"_prefab": null,
......@@ -13358,9 +13493,9 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 245
"__id__": 248
},
"_enabled": false,
"_enabled": true,
"_materials": [
{
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
......@@ -13390,7 +13525,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 244
"__id__": 247
},
"_enabled": true,
"_materials": [
......@@ -13422,26 +13557,26 @@
"_name": "audio",
"_objFlags": 0,
"_parent": {
"__id__": 242
"__id__": 245
},
"_children": [
{
"__id__": 249
"__id__": 252
},
{
"__id__": 251
"__id__": 254
},
{
"__id__": 253
"__id__": 256
},
{
"__id__": 255
"__id__": 258
},
{
"__id__": 257
"__id__": 260
},
{
"__id__": 259
"__id__": 262
}
],
"_active": true,
......@@ -13499,13 +13634,13 @@
"_name": "correct",
"_objFlags": 0,
"_parent": {
"__id__": 248
"__id__": 251
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 250
"__id__": 253
}
],
"_prefab": null,
......@@ -13561,7 +13696,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 249
"__id__": 252
},
"_enabled": true,
"_clip": {
......@@ -13580,13 +13715,13 @@
"_name": "incorrect",
"_objFlags": 0,
"_parent": {
"__id__": 248
"__id__": 251
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 252
"__id__": 255
}
],
"_prefab": null,
......@@ -13642,7 +13777,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 251
"__id__": 254
},
"_enabled": true,
"_clip": {
......@@ -13661,13 +13796,13 @@
"_name": "time321",
"_objFlags": 0,
"_parent": {
"__id__": 248
"__id__": 251
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 254
"__id__": 257
}
],
"_prefab": null,
......@@ -13723,7 +13858,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 253
"__id__": 256
},
"_enabled": true,
"_clip": {
......@@ -13742,13 +13877,13 @@
"_name": "victory",
"_objFlags": 0,
"_parent": {
"__id__": 248
"__id__": 251
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 256
"__id__": 259
}
],
"_prefab": null,
......@@ -13804,7 +13939,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 255
"__id__": 258
},
"_enabled": true,
"_clip": {
......@@ -13823,13 +13958,13 @@
"_name": "dizzy",
"_objFlags": 0,
"_parent": {
"__id__": 248
"__id__": 251
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 258
"__id__": 261
}
],
"_prefab": null,
......@@ -13885,7 +14020,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 257
"__id__": 260
},
"_enabled": true,
"_clip": {
......@@ -13904,13 +14039,13 @@
"_name": "laugh",
"_objFlags": 0,
"_parent": {
"__id__": 248
"__id__": 251
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 260
"__id__": 263
}
],
"_prefab": null,
......@@ -13966,7 +14101,7 @@
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 259
"__id__": 262
},
"_enabled": true,
"_clip": {
......
......@@ -85,6 +85,8 @@ cc.Class({
this.adjustMousePosition();
this._flower = cc.find('Canvas/flower');
this._flower.active = false;
this._comeon = cc.find('Canvas/comeon');
this._comeon.active = false;
},
......@@ -177,6 +179,24 @@ cc.Class({
this.title.string = this.data.title;
let audio_url = this.data.audio_url;
if (window && window.courseware) {
window.courseware.onEvent("course-in-screen", (data, next) => {
// 这里才能执行初始化就开始的东西
if (audio_url && audio_url!=""){
playAudioByUrl(audio_url, ()=>{
this.playGame();
});
}
else{
this.playGame();
}
next();
})
return;
}
else{
if (audio_url && audio_url!=""){
playAudioByUrl(audio_url, ()=>{
this.playGame();
......@@ -186,6 +206,8 @@ cc.Class({
this.playGame();
}
}
this.node.on(cc.Node.EventType.TOUCH_START, (event)=>{
if (!this._touched)
return;
......@@ -361,7 +383,7 @@ cc.Class({
flag.enabled = false;
let flag1 = flag.node.children[0];
flag1.getComponent(cc.Sprite).enabled = true;
flag1.active = true;
cc.tween(flag1)
.to(0.1, {scale: 1.2},{ easing: 'quadIn' })
.to(0.2, {scale: 0.8},{ easing: 'quadOut' })
......@@ -370,6 +392,9 @@ cc.Class({
},
tryFinished(){
if (this._finished == true)
return;
if (this._laugh){
this._laugh.stop();
this._laugh = null;
......@@ -377,10 +402,18 @@ cc.Class({
this._flag_index ++;
if (this._flag_index >= this.data.mouses.length){
//console.log("over");
this._finished = true;
if (this.allWrong() == true){
this.playAudioByName('lose');
this._comeon.active = true;
playDragonBoneAnimation(this._comeon, 'newAnimation');
}
else{
this.playAudioByName('victory');
this._flower.active = true;
playDragonBoneAnimation(this._flower, 'normal');
}
return;
}
......@@ -418,6 +451,16 @@ cc.Class({
this.timer1.string = str;
},
allWrong(){
let area = cc.find('Canvas/flag_area');
let len = area.childrenCount;
for(let i = 0; i < len; i++){
if (area.children[i].children[0].active == true)
return false;
}
return true;
},
// update (dt) {},
Between(a, b, c) {
return [a, b, c].sort()[1];
......
......@@ -25,6 +25,6 @@ export const defaultData =
}
],
"title": "weioewowe",
"time": "10",
"time": "3",
"audio_url": "http://staging-teach.cdn.ireadabc.com/738ef124b1882d10b31d59fb2fbd7eb7.mp3"
}
\ No newline at end of file
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