Commit f35af13d authored by linzhiguo's avatar linzhiguo

+ 增加动画

+ 增加音效(代用)
parent ddf1ee56
{
"ver": "2.0.1",
"uuid": "12c5ce05-d467-4159-b294-1a7e176fa47f",
"downloadMode": 0,
"duration": 0.5774,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "739e4493-58ce-461b-830c-c89693d0a9d9",
"downloadMode": 0,
"duration": 1.802449,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "eddafabf-f3d0-4c98-bdec-c7a284d166dd",
"downloadMode": 0,
"duration": 4,
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.0.1",
"uuid": "5a475a7e-8f7a-4074-aaa8-6b6c7a9a4458",
"downloadMode": 0,
"duration": 3.787755,
"subMetas": {}
}
\ No newline at end of file
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "3339780b-35ae-4d9b-af9a-daec95739611",
"subMetas": {}
}
\ No newline at end of file
{"width":512,"SubTexture":[{"width":210,"y":1,"height":198,"name":"WL01-flower(1)/矢量智能对象_17","x":1},{"width":79,"y":299,"height":74,"name":"WL01-flower(1)/矢量智能对象_16","x":248},{"width":47,"y":201,"height":44,"name":"WL01-flower(1)/矢量智能对象_15","x":157},{"width":157,"y":1,"height":147,"name":"WL01-flower(1)/矢量智能对象_14","x":213},{"width":58,"y":385,"height":54,"name":"WL01-flower(1)/矢量智能对象_13","x":144},{"width":120,"y":124,"height":113,"name":"WL01-flower(1)/矢量智能对象_12","x":372},{"width":157,"y":150,"height":147,"name":"WL01-flower(1)/矢量智能对象_11","x":213},{"width":89,"y":299,"height":84,"name":"WL01-flower(1)/矢量智能对象_10","x":157},{"width":154,"y":201,"height":145,"name":"WL01-flower(1)/矢量智能对象_9","x":1},{"width":128,"y":1,"height":121,"name":"WL01-flower(1)/矢量智能对象_8","x":372},{"width":60,"y":348,"height":56,"name":"WL01-flower(1)/矢量智能对象_7","x":82},{"width":47,"y":406,"height":44,"name":"WL01-flower(1)/矢量智能对象_6","x":82},{"width":79,"y":348,"height":74,"name":"WL01-flower(1)/矢量智能对象_5","x":1},{"width":47,"y":247,"height":44,"name":"WL01-flower(1)/矢量智能对象_4","x":157},{"width":45,"y":424,"height":42,"name":"WL01-flower(1)/矢量智能对象_3","x":1},{"width":45,"y":342,"height":42,"name":"WL01-flower(1)/矢量智能对象_2","x":389},{"width":58,"y":342,"height":54,"name":"WL01-flower(1)/矢量智能对象_1","x":329},{"width":107,"y":239,"height":101,"name":"WL01-flower(1)/矢量智能对象_0","x":372},{"width":58,"y":375,"height":54,"name":"WL01-flower(1)/矢量智能对象","x":248}],"height":512,"name":"WL01-flower(1)","imagePath":"WL01-flower(1)_tex.png"}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "8526f00f-532c-476b-ac33-b90759e738c6",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "43396c35-6652-4af3-90fc-8fd6057d5528",
"uuid": "6162e488-865a-43d7-8a70-23879e534969",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 273,
"height": 253,
"width": 512,
"height": 512,
"platformSettings": {},
"subMetas": {
"mouse_0": {
"WL01-flower(1)_tex": {
"ver": "1.0.4",
"uuid": "60b0326a-67e3-4795-aab8-8229b40a3ac2",
"rawTextureUuid": "43396c35-6652-4af3-90fc-8fd6057d5528",
"uuid": "f570f5f8-ebf1-40eb-9de5-513511d41325",
"rawTextureUuid": "6162e488-865a-43d7-8a70-23879e534969",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 273,
"height": 253,
"rawWidth": 273,
"rawHeight": 253,
"offsetX": -5.5,
"offsetY": 22.5,
"trimX": 1,
"trimY": 1,
"width": 499,
"height": 465,
"rawWidth": 512,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
{"frameRate":24,"name":"WL01-hummer(1)","version":"5.5","compatibleVersion":"5.5","armature":[{"type":"Armature","frameRate":24,"name":"Armature","aabb":{"x":-219,"y":-191,"width":437,"height":393},"bone":[{"name":"root"},{"length":195,"name":"图层_0","parent":"root","transform":{"x":169.85,"y":131.7,"skX":-134.3262,"skY":-134.3262}},{"name":"图层_10_拷贝_3","parent":"root","transform":{"x":-19.55,"y":-22.75}},{"name":"图层_10","parent":"root","transform":{"x":-115.45,"y":-60.15}},{"name":"图层_11_拷贝_2","parent":"root","transform":{"x":-147.15,"y":-175.55}},{"name":"图层_9_拷贝","parent":"root","transform":{"x":-10.6,"y":-104}},{"name":"图层_7","parent":"root","transform":{"x":-97.55,"y":54.45}},{"name":"图层_11","parent":"root","transform":{"x":-195.9,"y":26.85}},{"name":"图层_9","parent":"root","transform":{"x":-189.4,"y":191.8}},{"name":"图层_10_拷贝_2","parent":"root","transform":{"x":-30.1,"y":81.3}},{"name":"图层_7_拷贝_2","parent":"root","transform":{"x":-34.95,"y":159.3}},{"name":"图层_7_拷贝","parent":"root","transform":{"x":61.75,"y":126.8}},{"name":"图层_10_拷贝_4","parent":"root","transform":{"x":111.35,"y":11.4}},{"name":"图层_8","parent":"root","transform":{"x":160.1,"y":22.75}},{"name":"图层_8_拷贝","parent":"root","transform":{"x":209.65,"y":78.85}},{"name":"图层_11_拷贝","parent":"root","transform":{"x":162.55,"y":-23.55}},{"name":"图层_10_拷贝","parent":"root","transform":{"x":196.65,"y":-154.4}}],"slot":[{"name":"图层_7","parent":"图层_7"},{"name":"图层_7_拷贝","parent":"图层_7_拷贝"},{"name":"图层_7_拷贝_2","parent":"图层_7_拷贝_2"},{"name":"图层_8","parent":"图层_8"},{"name":"图层_8_拷贝","parent":"图层_8_拷贝"},{"name":"图层_9","parent":"图层_9"},{"name":"图层_9_拷贝","parent":"图层_9_拷贝"},{"name":"图层_10","parent":"图层_10"},{"name":"图层_10_拷贝_3","parent":"图层_10_拷贝_3"},{"name":"图层_10_拷贝_2","parent":"图层_10_拷贝_2"},{"name":"图层_10_拷贝","parent":"图层_10_拷贝"},{"name":"图层_10_拷贝_4","parent":"图层_10_拷贝_4"},{"name":"图层_11","parent":"图层_11"},{"name":"图层_11_拷贝_2","parent":"图层_11_拷贝_2"},{"name":"图层_11_拷贝","parent":"图层_11_拷贝"},{"name":"图层_0","parent":"图层_0"}],"skin":[{"slot":[{"name":"图层_7","display":[{"name":"WL01-hummer(1)/图层_7","transform":{"x":0.55,"y":1.05}}]},{"name":"图层_8_拷贝","display":[{"name":"WL01-hummer(1)/图层_8_拷贝","transform":{"x":-0.15,"y":-0.85}}]},{"name":"图层_10_拷贝_4","display":[{"name":"WL01-hummer(1)/图层_10_拷贝_4","transform":{"x":-3.35,"y":-0.4}}]},{"name":"图层_11_拷贝_2","display":[{"name":"WL01-hummer(1)/图层_11_拷贝_2","transform":{"x":0.15,"y":1.55}}]},{"name":"图层_10_拷贝","display":[{"name":"WL01-hummer(1)/图层_10_拷贝","transform":{"x":0.35,"y":-2.6}}]},{"name":"图层_8","display":[{"name":"WL01-hummer(1)/图层_8","transform":{"x":-0.1,"y":2.25}}]},{"name":"图层_11_拷贝","display":[{"name":"WL01-hummer(1)/图层_11_拷贝","transform":{"x":-2.55,"y":1.05}}]},{"name":"图层_10_拷贝_3","display":[{"name":"WL01-hummer(1)/图层_10_拷贝_3","transform":{"x":-2.45,"y":-4.75}}]},{"name":"图层_11","display":[{"name":"WL01-hummer(1)/图层_11","transform":{"x":-1.1,"y":-0.35}}]},{"name":"图层_7_拷贝","display":[{"name":"WL01-hummer(1)/图层_7_拷贝","transform":{"x":0.25,"y":2.2}}]},{"name":"图层_9_拷贝","display":[{"name":"WL01-hummer(1)/图层_9_拷贝","transform":{"x":2.1,"y":-0.5}}]},{"name":"图层_7_拷贝_2","display":[{"name":"WL01-hummer(1)/图层_7_拷贝_2","transform":{"x":-2.55,"y":3.7}}]},{"name":"图层_10","display":[{"name":"WL01-hummer(1)/图层_10","transform":{"x":-2.55,"y":-1.85}}]},{"name":"图层_10_拷贝_2","display":[{"name":"WL01-hummer(1)/图层_10_拷贝_2","transform":{"x":1.1,"y":0.7}}]},{"name":"图层_0","display":[{"name":"WL01-hummer(1)/图层_0","transform":{"x":124.69,"y":16.46,"skX":134.33,"skY":134.33}}]},{"name":"图层_9","display":[{"name":"WL01-hummer(1)/图层_9","transform":{"x":-0.1,"y":-2.3}}]}]}],"animation":[{"duration":8,"playTimes":0,"name":"normal","bone":[{"name":"图层_0","translateFrame":[{"duration":3,"tweenEasing":0},{"tweenEasing":0,"x":21.14,"y":-88.77},{"tweenEasing":0},{"duration":3,"tweenEasing":0},{"duration":0,"y":-30.65}],"rotateFrame":[{"duration":3,"tweenEasing":0},{"tweenEasing":0,"rotate":20.28},{"tweenEasing":0},{"duration":3,"tweenEasing":0},{"duration":0,"rotate":20.28}]},{"name":"图层_10_拷贝_3","translateFrame":[{"duration":5,"tweenEasing":0,"x":10.57,"y":71.44},{"tweenEasing":0,"x":10.57,"y":71.44},{"duration":2}]},{"name":"图层_10","translateFrame":[{"duration":5,"tweenEasing":0,"x":94.05,"y":99.34},{"tweenEasing":0,"x":94.05,"y":99.34},{"duration":2}]},{"name":"图层_11_拷贝_2","translateFrame":[{"duration":5,"tweenEasing":0,"x":143.46,"y":189.59},{"tweenEasing":0,"x":143.46,"y":189.59},{"duration":2}]},{"name":"图层_9_拷贝","translateFrame":[{"duration":5,"tweenEasing":0,"x":1.06,"y":144.83},{"tweenEasing":0,"x":1.06,"y":144.83},{"duration":2}]},{"name":"图层_7","translateFrame":[{"duration":5,"tweenEasing":0,"x":66.05,"y":16.43},{"tweenEasing":0,"x":66.05,"y":16.43},{"duration":2}]},{"name":"图层_11","translateFrame":[{"duration":5,"tweenEasing":0,"x":176.38,"y":30.01},{"tweenEasing":0,"x":176.38,"y":30.01},{"duration":2}]},{"name":"图层_9","translateFrame":[{"duration":5,"tweenEasing":0,"x":175,"y":-111.07},{"tweenEasing":0,"x":175,"y":-111.07},{"duration":2}]},{"name":"图层_10_拷贝_2","translateFrame":[{"duration":5,"tweenEasing":0,"x":11.89,"y":-2.64},{"tweenEasing":0,"x":11.89,"y":-2.64},{"duration":2}]},{"name":"图层_7_拷贝_2","translateFrame":[{"duration":5,"tweenEasing":0,"x":28.53,"y":-65.52},{"tweenEasing":0,"x":28.53,"y":-65.52},{"duration":2}]},{"name":"图层_7_拷贝","translateFrame":[{"duration":5,"tweenEasing":0,"x":-48.4,"y":-38.57},{"tweenEasing":0,"x":-48.4,"y":-38.57},{"duration":2}]},{"name":"图层_10_拷贝_4","translateFrame":[{"duration":5,"tweenEasing":0,"x":-81.37,"y":48.61},{"tweenEasing":0,"x":-81.37,"y":48.61},{"duration":2}]},{"name":"图层_8","translateFrame":[{"duration":5,"tweenEasing":0,"x":-133.16,"y":54.95},{"tweenEasing":0,"x":-133.16,"y":54.95},{"duration":2}]},{"name":"图层_8_拷贝","translateFrame":[{"duration":5,"tweenEasing":0,"x":-142.67,"y":3.17},{"tweenEasing":0,"x":-142.67,"y":3.17},{"duration":2}]},{"name":"图层_11_拷贝","translateFrame":[{"duration":5,"tweenEasing":0,"x":-126.82,"y":73.98},{"tweenEasing":0,"x":-126.82,"y":73.98},{"duration":2}]},{"name":"图层_10_拷贝","translateFrame":[{"duration":5,"tweenEasing":0,"x":-149.27,"y":190.22},{"tweenEasing":0,"x":-149.27,"y":190.22},{"duration":2}]}],"slot":[{"name":"图层_0","colorFrame":[{"duration":5},{"duration":3,"tweenEasing":0},{"duration":0,"value":{"aM":0}}]}]}],"defaultActions":[{"gotoAndPlay":"normal"}]}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "1188cc3e-915f-4085-bcf5-b6f2495a999e",
"subMetas": {}
}
\ No newline at end of file
{"width":256,"imagePath":"WL01-hummer(1)_tex.png","height":512,"name":"WL01-hummer(1)","SubTexture":[{"width":34,"y":320,"height":45,"name":"WL01-hummer(1)/图层_7","x":1},{"width":30,"y":91,"height":24,"name":"WL01-hummer(1)/图层_7_拷贝","x":224},{"width":29,"y":117,"height":22,"name":"WL01-hummer(1)/图层_7_拷贝_2","x":224},{"width":24,"y":141,"height":24,"name":"WL01-hummer(1)/图层_8","x":224},{"width":17,"y":273,"height":16,"name":"WL01-hummer(1)/图层_8_拷贝","x":83},{"width":29,"y":64,"height":25,"name":"WL01-hummer(1)/图层_9","x":224},{"width":29,"y":37,"height":25,"name":"WL01-hummer(1)/图层_9_拷贝","x":224},{"width":28,"y":273,"height":30,"name":"WL01-hummer(1)/图层_10","x":45},{"width":42,"y":273,"height":45,"name":"WL01-hummer(1)/图层_10_拷贝_3","x":1},{"width":34,"y":394,"height":24,"name":"WL01-hummer(1)/图层_10_拷贝_2","x":1},{"width":26,"y":320,"height":34,"name":"WL01-hummer(1)/图层_10_拷贝","x":37},{"width":26,"y":305,"height":14,"name":"WL01-hummer(1)/图层_10_拷贝_4","x":65},{"width":44,"y":356,"height":9,"name":"WL01-hummer(1)/图层_11","x":37},{"width":30,"y":1,"height":34,"name":"WL01-hummer(1)/图层_11_拷贝_2","x":224},{"width":38,"y":367,"height":25,"name":"WL01-hummer(1)/图层_11_拷贝","x":1},{"width":221,"y":1,"height":270,"name":"WL01-hummer(1)/图层_0","x":1}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "e12eae57-2e34-4db5-aba9-a01cbf86c732",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "ce45954f-7d5f-4293-bc02-ba4242caca5f",
"uuid": "cf9b16a1-e66c-4f6a-b3f2-c360e2fe8040",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 264,
"height": 248,
"width": 256,
"height": 512,
"platformSettings": {},
"subMetas": {
"flower": {
"WL01-hummer(1)_tex": {
"ver": "1.0.4",
"uuid": "a96f0eef-cba3-4867-90d3-83f97c050cd3",
"rawTextureUuid": "ce45954f-7d5f-4293-bc02-ba4242caca5f",
"uuid": "0c2cda85-d1c1-4389-b5fd-1d5b9bbecb32",
"rawTextureUuid": "cf9b16a1-e66c-4f6a-b3f2-c360e2fe8040",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 264,
"height": 248,
"rawWidth": 264,
"rawHeight": 248,
"offsetX": -0.5,
"offsetY": 46.5,
"trimX": 1,
"trimY": 1,
"width": 253,
"height": 417,
"rawWidth": 256,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
This diff is collapsed.
{
"ver": "1.0.1",
"uuid": "0d16bcab-9411-49dc-8fc4-f307450afeb7",
"subMetas": {}
}
\ No newline at end of file
{"width":512,"imagePath":"dishu_tex.png","height":512,"name":"dishu","SubTexture":[{"width":273,"y":1,"height":122,"name":"地鼠(画布尺寸根据动画自定义)(1)2/身体","x":1},{"width":198,"y":125,"height":136,"name":"地鼠(画布尺寸根据动画自定义)(1)2/脸","x":258},{"width":15,"y":105,"height":15,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_45","x":397},{"width":15,"y":105,"height":15,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_46","x":380},{"width":98,"y":248,"height":4,"name":"地鼠(画布尺寸根据动画自定义)(1)2/闭眼","x":135},{"width":102,"y":56,"height":47,"name":"地鼠(画布尺寸根据动画自定义)(1)2/默认腮帮子","x":380},{"width":34,"y":105,"height":25,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_44","x":458},{"width":102,"y":56,"height":64,"name":"地鼠(画布尺寸根据动画自定义)(1)2/打晕嘴前","x":276},{"width":37,"y":1,"height":37,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_88","x":413},{"width":11,"y":105,"height":10,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_89","x":441},{"width":37,"y":1,"height":37,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_88_拷贝","x":452},{"width":11,"y":105,"height":10,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_89_拷贝","x":428},{"width":255,"y":125,"height":121,"name":"地鼠(画布尺寸根据动画自定义)(1)2/帽子默认","x":1},{"width":132,"y":248,"height":44,"name":"地鼠(画布尺寸根据动画自定义)(1)2/椭圆_3","x":1},{"width":135,"y":1,"height":53,"name":"地鼠(画布尺寸根据动画自定义)(1)2/椭圆_4","x":276},{"width":24,"y":132,"height":33,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_92","x":458},{"width":17,"y":248,"height":23,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_92_拷贝","x":235},{"width":20,"y":1,"height":28,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_92_拷贝_2","x":491},{"width":16,"y":104,"height":21,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_92_拷贝_3","x":494},{"width":20,"y":75,"height":27,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_92_拷贝_4","x":484},{"width":24,"y":40,"height":33,"name":"地鼠(画布尺寸根据动画自定义)(1)2/图层_92_拷贝_5","x":484},{"width":12,"y":105,"height":10,"name":"地鼠(画布尺寸根据动画自定义)(1)2/这个点单独留一层,始终在帽子这","x":414}]}
\ No newline at end of file
{
"ver": "1.0.1",
"uuid": "82c1d7b7-eb06-4db2-a224-27416184544b",
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "51ed7491-08f0-45d6-a2a9-6fc2dc261617",
"uuid": "77c363e2-208c-4cb0-a921-bb61fc08dd58",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"premultiplyAlpha": true,
"genMipmaps": false,
"packable": true,
"width": 309,
"height": 360,
"width": 512,
"height": 512,
"platformSettings": {},
"subMetas": {
"mouse_1": {
"dishu_tex": {
"ver": "1.0.4",
"uuid": "78c0b15f-070d-4974-bbc3-532b15c5a845",
"rawTextureUuid": "51ed7491-08f0-45d6-a2a9-6fc2dc261617",
"uuid": "de25cd17-68fc-4c45-b8c0-607778027073",
"rawTextureUuid": "77c363e2-208c-4cb0-a921-bb61fc08dd58",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 309,
"height": 360,
"rawWidth": 309,
"rawHeight": 360,
"offsetY": 109.5,
"trimX": 1,
"trimY": 1,
"width": 510,
"height": 291,
"rawWidth": 512,
"rawHeight": 512,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
......
This diff is collapsed.
import { onHomeworkFinish, playAudioByUrl, RandomInt } from "../script/util";
import { onHomeworkFinish, playAudioByUrl, RandomInt, playDragonBoneAnimation, playAudio } from "../script/util";
import { defaultData } from "../script/defaultData";
cc.Class({
......@@ -83,6 +83,8 @@ cc.Class({
})
this.adjustMousePosition();
this._flower = cc.find('Canvas/flower');
this._flower.active = false;
},
......@@ -183,10 +185,10 @@ cc.Class({
initView() {
window.WL = this;
this._touched = false;
this._flower = cc.find('Canvas/flower');
this._flower.active = false;
this._hammer = cc.find('Canvas/hammer');
this.title.string = this.data.title;
......@@ -195,6 +197,7 @@ cc.Class({
}
this.updateFlagArea(()=>{
this.playAudioByName('time321');
this.playTimer(()=>{
this.nextMouse();
})
......@@ -204,27 +207,35 @@ cc.Class({
if (!this._touched)
return;
let canvas = cc.find('Canvas');
let pos = canvas.convertToNodeSpaceAR(cc.v2(event.touch._point.x, event.touch._point.y))
let item, len = this.mouses.length;
for(let i = 0; i < len; i++){
item = this.mouses[i];
if (item.active && cc.rect(item.getBoundingBoxToWorld()).contains(event.touch._point)){
let canvas = cc.find('Canvas');
let pos = canvas.convertToNodeSpaceAR(cc.v2(event.touch._point.x, event.touch._point.y))
this._hammer.x = pos.x;
this._hammer.y = pos.y;
//let mouse = item.getComponent(cc.js.getClassByName('Mouse'));
this.hitMouse(item, ()=>{
this.moveDown(item, ()=>{
this._hammer.y = -1000;
this.tryFinished();
});
this._touched = false;
this.playAudioByName('correct');
playDragonBoneAnimation(this._hammer.children[0], 'normal', 1, ()=>{
this._hammer.y = -1000;
this.hitMouse(item);
});
// mouse.moveUp(()=>{
// });
return;
}
}
let ground = cc.find('Canvas/ground');
if (cc.rect(ground.getBoundingBoxToWorld()).contains(event.touch._point)){
this._hammer.x = pos.x;
this._hammer.y = pos.y;
this.playAudioByName('incorrect');
playDragonBoneAnimation(this._hammer.children[0], 'normal', 1, ()=>{
this._hammer.y = -1000;
});
}
}, this);
},
......@@ -306,7 +317,7 @@ cc.Class({
.start();
},
hitMouse(node, cb){
hitMouse(node){
if (this._time_ani){
this._time_ani.stop();
this._time_ani = null;
......@@ -315,15 +326,12 @@ cc.Class({
mouse.hit();
this.updateFlag();
},
cc.tween(this.node)
.delay(0.1)
.call(()=>{
this.moveDown(node, ()=>{
cb && cb();
});
})
.start();
afterHit(item){
this.moveDown(item, ()=>{
this.tryFinished();
});
},
updateFlag(){
......@@ -347,8 +355,10 @@ cc.Class({
tryFinished(){
this._flag_index ++;
if (this._flag_index >= this.data.mouses.length){
console.log("over");
//console.log("over");
this.playAudioByName('victory');
this._flower.active = true;
playDragonBoneAnimation(this._flower, 'normal');
return;
}
......@@ -433,6 +443,17 @@ cc.Class({
}
},
playAudioByName(audioName) {
return new Promise((resolve, reject) => {
try {
const audioNode = cc.find('res/audio/'+audioName);
const audioClip = audioNode.getComponent(cc.AudioSource).clip;
playAudio(audioClip, resolve);
} catch (e) {
reject(e);
}
});
},
// ------------------------------------------
});
import {playAudioByUrl} from "../script/util";
import {playAudioByUrl, playDragonBoneAnimation} from "../script/util";
cc.Class({
extends: cc.Component,
name: "Mouse",
properties: {
normalPic:{
default:null,
type: cc.Sprite,
},
showTitle:{
default:null,
type: cc.Label
},
aniNode:{
default:null,
type:cc.Node
}
},
init(){
this.normalPic.enabled = true;
this.showTitle.enabled = true;
this.aniNode.active = false;
playDragonBoneAnimation(this.node, 'normal', -1);
},
setTitle(text){
this.showTitle.string = text;
this.showTitle.node.opacity = 255;
},
playAudio(){
......@@ -39,9 +28,14 @@ cc.Class({
},
hit(){
this.normalPic.enabled = false;
this.showTitle.enabled = false;
this.aniNode.active = true;
cc.tween(this.showTitle.node)
.delay(0.17)
.to(0.5-0.17, {opacity: 0})
.start();
playDragonBoneAnimation(this.node, 'wrong', 1, ()=>{
WL.afterHit(this.node);
});
}
......
export function playDragonBoneAnimation(node, animationName, time = 1, onFinish = null, onFrameEvent = null) {
const armatureDisplay = node.getComponent(dragonBones.ArmatureDisplay);
armatureDisplay.once(dragonBones.EventObject.COMPLETE, () => {
if (onFinish) {
onFinish();
}
});
armatureDisplay.on(dragonBones.EventObject.FRAME_EVENT, (event) => {
if (onFrameEvent) {
onFrameEvent(event);
}
});
armatureDisplay.playAnimation(animationName, time);
}
export function getPosByAngle(angle, len) {
const radian = angle * Math.PI / 180;
......
{
"ver": "2.3.5",
"uuid": "22e98c9f-4ea1-437f-9cc0-b79e69b619ce",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 221,
"height": 270,
"platformSettings": {},
"subMetas": {
"hammer": {
"ver": "1.0.4",
"uuid": "7f74a135-92ba-4c8f-afa3-e456c8443039",
"rawTextureUuid": "22e98c9f-4ea1-437f-9cc0-b79e69b619ce",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 221,
"height": 270,
"rawWidth": 221,
"rawHeight": 270,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ 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