diff --git a/.DS_Store b/.DS_Store index f284ad2280cef04a78942d4331e3df67954c66b2..8538936e0c176786bea74e10e13823bbaf6dd77a 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/play/assets/tmpGame/animations/icon_sound_finish.anim b/play/assets/tmpGame/animations/icon_sound_finish.anim index 128678ad01b8f80f2e72a2ff9c0b3e0cdcb58f8b..ac5c5ddce4d2a442f9fc513b03c9e469ca0bdf41 100644 --- a/play/assets/tmpGame/animations/icon_sound_finish.anim +++ b/play/assets/tmpGame/animations/icon_sound_finish.anim @@ -1,16 +1,23 @@ { "__type__": "cc.AnimationClip", - "_name": "icon_sound", + "_name": "icon_sound_finish", "_objFlags": 0, "_native": "", - "_duration": 0, + "_duration": 0.016666666666666666, "sample": 60, "speed": 1, "wrapMode": 1, "curveData": { "comps": { "cc.Sprite": { - "spriteFrame": [] + "spriteFrame": [ + { + "frame": 0, + "value": { + "__uuid__": "781a51f6-3297-47ba-ad00-9a418e7f9e95" + } + } + ] } } }, diff --git a/play/assets/tmpGame/animations/wrong.anim b/play/assets/tmpGame/animations/wrong.anim deleted file mode 100644 index 7d763ae3e9a4d959ad5f843329c0ca4bbad96031..0000000000000000000000000000000000000000 --- a/play/assets/tmpGame/animations/wrong.anim +++ /dev/null @@ -1,121 +0,0 @@ -{ - "__type__": "cc.AnimationClip", - "_name": "wrong", - "_objFlags": 0, - "_native": "", - "_duration": 6, - "sample": 60, - "speed": 4, - "wrapMode": 1, - "curveData": { - "props": { - "position": [ - { - "frame": 0, - "value": [ - 0, - 0, - 0 - ] - }, - { - "frame": 0.5, - "value": [ - -10, - 0, - 0 - ] - }, - { - "frame": 1, - "value": [ - 0, - 0, - 0 - ] - }, - { - "frame": 1.5, - "value": [ - 10, - 0, - 0 - ] - }, - { - "frame": 2, - "value": [ - 0, - 0, - 0 - ] - }, - { - "frame": 2.5, - "value": [ - -10, - 0, - 0 - ] - }, - { - "frame": 3, - "value": [ - 0, - 0, - 0 - ] - }, - { - "frame": 3.5, - "value": [ - 10, - 0, - 0 - ] - }, - { - "frame": 4, - "value": [ - 0, - 0, - 0 - ] - }, - { - "frame": 4.5, - "value": [ - -10, - 0, - 0 - ] - }, - { - "frame": 5, - "value": [ - 0, - 0, - 0 - ] - }, - { - "frame": 5.5, - "value": [ - 10, - 0, - 0 - ] - }, - { - "frame": 6, - "value": [ - 0, - 0, - 0 - ] - } - ] - } - }, - "events": [] -} \ No newline at end of file diff --git a/play/assets/tmpGame/animations/wrong.anim.meta b/play/assets/tmpGame/animations/wrong.anim.meta deleted file mode 100644 index 0b0a20905e5e0d91d87c85449d772d4fe05499e4..0000000000000000000000000000000000000000 --- a/play/assets/tmpGame/animations/wrong.anim.meta +++ /dev/null @@ -1,5 +0,0 @@ -{ - "ver": "2.1.0", - "uuid": "b2ca5c8c-5d35-44c7-948b-810789a2bccd", - "subMetas": {} -} \ No newline at end of file diff --git a/play/assets/tmpGame/particle/particle.png b/play/assets/tmpGame/particle/particle.png new file mode 100755 index 0000000000000000000000000000000000000000..1b4bf014df6e7b8b415aa54710a3b36a827cea4a Binary files /dev/null and b/play/assets/tmpGame/particle/particle.png differ diff --git a/play/assets/tmpGame/particle/particle.png.meta b/play/assets/tmpGame/particle/particle.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..d2aaf815a2596f02da355b39b5cf0e3fa1b02b09 --- /dev/null +++ b/play/assets/tmpGame/particle/particle.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.5", + "uuid": "477a4289-7aea-4116-b80f-d3719a5a0191", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 64, + "height": 64, + "platformSettings": {}, + "subMetas": { + "particle": { + "ver": "1.0.4", + "uuid": "a20aecd1-ff1b-458d-a4e2-13cf79681ff6", + "rawTextureUuid": "477a4289-7aea-4116-b80f-d3719a5a0191", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": -1.5, + "offsetY": 1.5, + "trimX": 12, + "trimY": 10, + "width": 37, + "height": 41, + "rawWidth": 64, + "rawHeight": 64, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/play/assets/tmpGame/particle/sui.plist b/play/assets/tmpGame/particle/sui.plist new file mode 100755 index 0000000000000000000000000000000000000000..dc27d58f4fee24d074a302f121fc5d378cec868b --- /dev/null +++ b/play/assets/tmpGame/particle/sui.plist @@ -0,0 +1,108 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>angle</key> + <real>253.41999816894531</real> + <key>angleVariance</key> + <real>0.0</real> + <key>blendFuncDestination</key> + <integer>771</integer> + <key>blendFuncSource</key> + <integer>1</integer> + <key>duration</key> + <real>-1</real> + <key>emitterType</key> + <real>0.0</real> + <key>finishColorAlpha</key> + <real>1</real> + <key>finishColorBlue</key> + <real>1</real> + <key>finishColorGreen</key> + <real>1</real> + <key>finishColorRed</key> + <real>1</real> + <key>finishColorVarianceAlpha</key> + <real>0</real> + <key>finishColorVarianceBlue</key> + <real>1</real> + <key>finishColorVarianceGreen</key> + <real>1</real> + <key>finishColorVarianceRed</key> + <real>1</real> + <key>finishParticleSize</key> + <real>30</real> + <key>finishParticleSizeVariance</key> + <real>10</real> + <key>gravityx</key> + <real>0.0</real> + <key>gravityy</key> + <real>-100.54499816894531</real> + <key>maxParticles</key> + <real>400</real> + <key>maxRadius</key> + <real>100</real> + <key>maxRadiusVariance</key> + <real>0.0</real> + <key>minRadius</key> + <real>0.0</real> + <key>particleLifespan</key> + <real>5</real> + <key>particleLifespanVariance</key> + <real>0.0</real> + <key>radialAccelVariance</key> + <real>0.0</real> + <key>radialAcceleration</key> + <real>0.0</real> + <key>rotatePerSecond</key> + <real>0.0</real> + <key>rotatePerSecondVariance</key> + <real>0.0</real> + <key>rotationEnd</key> + <real>804.1529541015625</real> + <key>rotationEndVariance</key> + <real>-3600</real> + <key>rotationStart</key> + <real>450.37005615234375</real> + <key>rotationStartVariance</key> + <real>-1270.0657958984375</real> + <key>sourcePositionVariancex</key> + <real>1088</real> + <key>sourcePositionVariancey</key> + <real>0.0</real> + <key>sourcePositionx</key> + <real>384</real> + <key>sourcePositiony</key> + <real>785.88232421875</real> + <key>speed</key> + <real>100</real> + <key>speedVariance</key> + <real>300</real> + <key>startColorAlpha</key> + <real>1</real> + <key>startColorBlue</key> + <real>1</real> + <key>startColorGreen</key> + <real>1</real> + <key>startColorRed</key> + <real>1</real> + <key>startColorVarianceAlpha</key> + <real>0</real> + <key>startColorVarianceBlue</key> + <real>1</real> + <key>startColorVarianceGreen</key> + <real>1</real> + <key>startColorVarianceRed</key> + <real>1</real> + <key>startParticleSize</key> + <real>30</real> + <key>startParticleSizeVariance</key> + <real>10</real> + <key>tangentialAccelVariance</key> + <real>0.0</real> + <key>tangentialAcceleration</key> + <real>0.0</real> + <key>textureFileName</key> + <string>particle.png</string> +</dict> +</plist> diff --git a/play/assets/tmpGame/particle/sui.plist.meta b/play/assets/tmpGame/particle/sui.plist.meta new file mode 100644 index 0000000000000000000000000000000000000000..88f208bb63795909ac3143aeb6c972e151fb97a5 --- /dev/null +++ b/play/assets/tmpGame/particle/sui.plist.meta @@ -0,0 +1,5 @@ +{ + "ver": "2.0.1", + "uuid": "538af702-8a0f-4265-beb1-be7a0f687356", + "subMetas": {} +} \ No newline at end of file diff --git a/play/assets/tmpGame/particle/sui.png b/play/assets/tmpGame/particle/sui.png new file mode 100755 index 0000000000000000000000000000000000000000..f126819c12a48de9a2963ee5dc255e4ff1e6c909 Binary files /dev/null and b/play/assets/tmpGame/particle/sui.png differ diff --git a/play/assets/tmpGame/particle/sui.png.meta b/play/assets/tmpGame/particle/sui.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..889128c813aafc1a0e48c4da89e0417d873c9125 --- /dev/null +++ b/play/assets/tmpGame/particle/sui.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.5", + "uuid": "daae9bc9-d3a9-4d5a-8b08-d39bd5a958da", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": false, + "genMipmaps": false, + "packable": true, + "width": 120, + "height": 120, + "platformSettings": {}, + "subMetas": { + "sui": { + "ver": "1.0.4", + "uuid": "fb6b1982-4305-4b8a-a83e-04ac25732105", + "rawTextureUuid": "daae9bc9-d3a9-4d5a-8b08-d39bd5a958da", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0.5, + "offsetY": 0.5, + "trimX": 1, + "trimY": 3, + "width": 119, + "height": 113, + "rawWidth": 120, + "rawHeight": 120, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file diff --git a/play/assets/tmpGame/prefab/op_pic.prefab b/play/assets/tmpGame/prefab/op_pic.prefab index ad6fd0b941351fb83c975e200ac3ffb85f511cd7..b225a72a7f11e4d93ec385d1ce94da79ff86221e 100644 --- a/play/assets/tmpGame/prefab/op_pic.prefab +++ b/play/assets/tmpGame/prefab/op_pic.prefab @@ -19,25 +19,25 @@ "_children": [ { "__id__": 2 - } - ], - "_active": true, - "_components": [ + }, { "__id__": 5 }, { - "__id__": 6 - }, + "__id__": 8 + } + ], + "_active": true, + "_components": [ { - "__id__": 7 + "__id__": 11 }, { - "__id__": 8 + "__id__": 12 } ], "_prefab": { - "__id__": 9 + "__id__": 13 }, "_opacity": 255, "_color": { @@ -88,13 +88,13 @@ }, { "__type__": "cc.Node", - "_name": "sprite", + "_name": "pic_frame_selected", "_objFlags": 0, "_parent": { "__id__": 1 }, "_children": [], - "_active": true, + "_active": false, "_components": [ { "__id__": 3 @@ -104,6 +104,113 @@ "__id__": 4 }, "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 232, + "g": 67, + "b": 29, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 253, + "height": 219 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -1, + 0, + 0, + 0, + 0, + 1, + 1.06, + 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.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 1, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "dec1094e-44d7-400e-ae82-87256133f537" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "b74714cb-b4ed-49a6-9955-c21a7c47db01" + }, + "fileId": "2dGGITfL1FmLu4WXaq1ijO", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "pic_frame", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 6 + } + ], + "_prefab": { + "__id__": 7 + }, + "_opacity": 255, "_color": { "__type__": "cc.Color", "r": 255, @@ -113,8 +220,8 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 168, - "height": 168 + "width": 253, + "height": 227 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -155,7 +262,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 2 + "__id__": 5 }, "_enabled": true, "_materials": [ @@ -166,10 +273,10 @@ "_srcBlendFactor": 770, "_dstBlendFactor": 771, "_spriteFrame": { - "__uuid__": "8cdb44ac-a3f6-449f-b354-7cd48cf84061" + "__uuid__": "7fea9c73-91cb-4f14-b9e9-0ba62035d742" }, "_type": 0, - "_sizeMode": 0, + "_sizeMode": 1, "_fillType": 0, "_fillCenter": { "__type__": "cc.Vec2", @@ -190,15 +297,79 @@ "asset": { "__uuid__": "b74714cb-b4ed-49a6-9955-c21a7c47db01" }, - "fileId": "16DPpqsdpDG4Q1+EyiNkvS", + "fileId": "6dq18PWx1CippwCfwZboH5", "sync": false }, + { + "__type__": "cc.Node", + "_name": "sprite", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 9 + } + ], + "_prefab": { + "__id__": 10 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 168, + "height": 168 + }, + "_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.Sprite", "_name": "", "_objFlags": 0, "node": { - "__id__": 1 + "__id__": 8 }, "_enabled": true, "_materials": [ @@ -208,11 +379,9 @@ ], "_srcBlendFactor": 770, "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "7fea9c73-91cb-4f14-b9e9-0ba62035d742" - }, + "_spriteFrame": null, "_type": 0, - "_sizeMode": 1, + "_sizeMode": 0, "_fillType": 0, "_fillCenter": { "__type__": "cc.Vec2", @@ -225,6 +394,17 @@ "_atlas": null, "_id": "" }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "b74714cb-b4ed-49a6-9955-c21a7c47db01" + }, + "fileId": "16DPpqsdpDG4Q1+EyiNkvS", + "sync": false + }, { "__type__": "cc.BoxCollider", "_name": "", @@ -241,8 +421,8 @@ }, "_size": { "__type__": "cc.Size", - "width": 253, - "height": 227 + "width": 102, + "height": 102 }, "_id": "" }, @@ -255,10 +435,10 @@ }, "_enabled": true, "pic": { - "__id__": 3 + "__id__": 9 }, - "particle_star": { - "__uuid__": "de39730a-d6dc-4031-9744-9ca5c01fc1f0" + "pic_selected": { + "__id__": 2 }, "sounds": [ { @@ -273,23 +453,8 @@ "_isEnter": false, "_isContact": false, "_soundOp": null, - "_id": "" - }, - { - "__type__": "cc.Animation", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1 - }, - "_enabled": true, - "_defaultClip": null, - "_clips": [ - { - "__uuid__": "b2ca5c8c-5d35-44c7-948b-810789a2bccd" - } - ], - "playOnLoad": false, + "_picUrl": null, + "_spriteFrame": null, "_id": "" }, { diff --git a/play/assets/tmpGame/prefab/op_sound.prefab b/play/assets/tmpGame/prefab/op_sound.prefab index a9c85534a66d0dfe71f6a30b8a58a96e1d752b6a..6ea61703a6d515d79354742886813dd8e39d0b1e 100644 --- a/play/assets/tmpGame/prefab/op_sound.prefab +++ b/play/assets/tmpGame/prefab/op_sound.prefab @@ -19,22 +19,25 @@ "_children": [ { "__id__": 2 + }, + { + "__id__": 8 } ], "_active": true, "_components": [ { - "__id__": 12 + "__id__": 18 }, { - "__id__": 13 + "__id__": 19 }, { - "__id__": 14 + "__id__": 20 } ], "_prefab": { - "__id__": 15 + "__id__": 21 }, "_opacity": 255, "_color": { @@ -85,7 +88,7 @@ }, { "__type__": "cc.Node", - "_name": "btn_sound", + "_name": "pic_frame", "_objFlags": 0, "_parent": { "__id__": 1 @@ -95,20 +98,236 @@ "__id__": 3 } ], + "_active": false, + "_components": [ + { + "__id__": 6 + } + ], + "_prefab": { + "__id__": 7 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 253, + "height": 227 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_trs": { + "__type__": "TypedArray", + "ctor": "Float64Array", + "array": [ + 0, + -3.16, + 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.Node", + "_name": "sprite", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], "_active": true, "_components": [ { - "__id__": 7 + "__id__": 4 + } + ], + "_prefab": { + "__id__": 5 + }, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 168, + "height": 168 + }, + "_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.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 3 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": null, + "_type": 0, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "f816bebc-d7fa-41ca-aa93-efe1af15931d" + }, + "fileId": "d4CYgukWBK5JO7udUmvZT4", + "sync": false + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 2 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "7fea9c73-91cb-4f14-b9e9-0ba62035d742" + }, + "_type": 0, + "_sizeMode": 1, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__uuid__": "f816bebc-d7fa-41ca-aa93-efe1af15931d" + }, + "fileId": "4dd0omDwFOopCQREjKUE40", + "sync": false + }, + { + "__type__": "cc.Node", + "_name": "btn_sound", + "_objFlags": 0, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 9 + } + ], + "_active": true, + "_components": [ + { + "__id__": 13 }, { - "__id__": 8 + "__id__": 14 }, { - "__id__": 9 + "__id__": 15 } ], "_prefab": { - "__id__": 11 + "__id__": 17 }, "_opacity": 255, "_color": { @@ -162,20 +381,20 @@ "_name": "icon_sound", "_objFlags": 0, "_parent": { - "__id__": 2 + "__id__": 8 }, "_children": [], "_active": true, "_components": [ { - "__id__": 4 + "__id__": 10 }, { - "__id__": 5 + "__id__": 11 } ], "_prefab": { - "__id__": 6 + "__id__": 12 }, "_opacity": 255, "_color": { @@ -229,7 +448,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 3 + "__id__": 9 }, "_enabled": true, "_materials": [ @@ -261,7 +480,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 3 + "__id__": 9 }, "_enabled": true, "_defaultClip": null, @@ -292,7 +511,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 2 + "__id__": 8 }, "_enabled": true, "_materials": [ @@ -324,7 +543,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 2 + "__id__": 8 }, "_enabled": true, "alignMode": 1, @@ -351,7 +570,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 2 + "__id__": 8 }, "_enabled": true, "_normalMaterial": null, @@ -360,7 +579,7 @@ "zoomScale": 1.2, "clickEvents": [ { - "__id__": 10 + "__id__": 16 } ], "_N$interactable": true, @@ -480,13 +699,21 @@ }, "_enabled": true, "iconSound": { - "__id__": 3 + "__id__": 9 + }, + "rightFrame": { + "__id__": 2 }, - "particle": { + "rightPic": { + "__id__": 4 + }, + "particle_star": { "__uuid__": "de39730a-d6dc-4031-9744-9ca5c01fc1f0" }, "_opId": 0, "_soundUrl": "", + "_opPic": null, + "_isRight": false, "_id": "" }, { @@ -505,8 +732,8 @@ }, "_size": { "__type__": "cc.Size", - "width": 253, - "height": 218 + "width": 102, + "height": 102 }, "_id": "" }, diff --git a/play/assets/tmpGame/prefab/sui.prefab b/play/assets/tmpGame/prefab/sui.prefab new file mode 100644 index 0000000000000000000000000000000000000000..4d85758fbbf8eecfc8fb2c97514c03943452dfec --- /dev/null +++ b/play/assets/tmpGame/prefab/sui.prefab @@ -0,0 +1,190 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "", + "_objFlags": 0, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "asyncLoadAssets": false, + "readonly": false + }, + { + "__type__": "cc.Node", + "_name": "sui", + "_objFlags": 0, + "_parent": null, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 2 + } + ], + "_prefab": { + "__id__": 3 + }, + "_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": [ + 571, + 247, + 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.ParticleSystem", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 1 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 1, + "_dstBlendFactor": 771, + "_custom": true, + "_file": { + "__uuid__": "538af702-8a0f-4265-beb1-be7a0f687356" + }, + "_spriteFrame": { + "__uuid__": "fb6b1982-4305-4b8a-a83e-04ac25732105" + }, + "_texture": null, + "_stopped": false, + "playOnLoad": true, + "autoRemoveOnFinish": false, + "totalParticles": 300, + "duration": -1, + "emissionRate": 80, + "life": 5, + "lifeVar": 0, + "_startColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_startColorVar": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 0 + }, + "_endColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_endColorVar": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 0 + }, + "angle": 253.4199981689453, + "angleVar": 0, + "startSize": 30, + "startSizeVar": 10, + "endSize": 30, + "endSizeVar": 10, + "startSpin": 450.37005615234375, + "startSpinVar": -1270.0657958984375, + "endSpin": 804.1529541015625, + "endSpinVar": -3600, + "sourcePos": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "posVar": { + "__type__": "cc.Vec2", + "x": 1088, + "y": 0 + }, + "_positionType": 1, + "positionType": 1, + "emitterMode": 0, + "gravity": { + "__type__": "cc.Vec2", + "x": 0, + "y": -100.54499816894531 + }, + "speed": 100, + "speedVar": 300, + "tangentialAccel": 0, + "tangentialAccelVar": 0, + "radialAccel": 0, + "radialAccelVar": 0, + "rotationIsDir": false, + "startRadius": 0, + "startRadiusVar": 0, + "endRadius": 0, + "endRadiusVar": 0, + "rotatePerS": 0, + "rotatePerSVar": 0, + "_N$preview": true, + "_id": "" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "43HhlK8MBA455Uic/ufNlS", + "sync": false + } +] \ No newline at end of file diff --git a/play/assets/tmpGame/prefab/sui.prefab.meta b/play/assets/tmpGame/prefab/sui.prefab.meta new file mode 100644 index 0000000000000000000000000000000000000000..7e25599d86809daeb6cdd0610a4ac1f68554c71a --- /dev/null +++ b/play/assets/tmpGame/prefab/sui.prefab.meta @@ -0,0 +1,8 @@ +{ + "ver": "1.2.7", + "uuid": "d30b053b-c7eb-4811-951c-01c98b5825bf", + "optimizationPolicy": "AUTO", + "asyncLoadAssets": false, + "readonly": false, + "subMetas": {} +} \ No newline at end of file diff --git a/play/assets/tmpGame/scene/Scene.fire b/play/assets/tmpGame/scene/Scene.fire index b033abbb00416682ced584052bf531e62b9fc2eb..57bc2eac656a6abbaa2490bd1b2a9462a7b07f04 100644 --- a/play/assets/tmpGame/scene/Scene.fire +++ b/play/assets/tmpGame/scene/Scene.fire @@ -78,25 +78,28 @@ "__id__": 7 }, { - "__id__": 13 + "__id__": 15 }, { - "__id__": 23 + "__id__": 25 }, { - "__id__": 26 + "__id__": 28 + }, + { + "__id__": 31 } ], "_active": true, "_components": [ { - "__id__": 29 + "__id__": 35 }, { - "__id__": 30 + "__id__": 36 }, { - "__id__": 31 + "__id__": 37 } ], "_prefab": null, @@ -358,6 +361,9 @@ }, { "__id__": 12 + }, + { + "__id__": 13 } ], "_prefab": null, @@ -595,6 +601,88 @@ "_originalHeight": 0, "_id": "80I9I94UZOv7TpqKWf0ESe" }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 7 + }, + "_enabled": true, + "_normalMaterial": null, + "_grayMaterial": null, + "duration": 0.1, + "zoomScale": 1.2, + "clickEvents": [ + { + "__id__": 14 + } + ], + "_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": "1cdVnG8nxAFLXVGGU68gp2" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "", + "_componentId": "f4edeRi+NdAabqAkVYRwFjK", + "handler": "playTitle", + "customEventData": "" + }, { "__type__": "cc.Node", "_name": "res", @@ -604,13 +692,13 @@ }, "_children": [ { - "__id__": 14 + "__id__": 16 }, { - "__id__": 17 + "__id__": 19 }, { - "__id__": 20 + "__id__": 22 } ], "_active": false, @@ -668,11 +756,11 @@ "_name": "font", "_objFlags": 0, "_parent": { - "__id__": 13 + "__id__": 15 }, "_children": [ { - "__id__": 15 + "__id__": 17 } ], "_active": true, @@ -730,13 +818,13 @@ "_name": "BRLNSDB", "_objFlags": 0, "_parent": { - "__id__": 14 + "__id__": 16 }, "_children": [], "_active": true, "_components": [ { - "__id__": 16 + "__id__": 18 } ], "_prefab": null, @@ -792,7 +880,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 15 + "__id__": 17 }, "_enabled": true, "_materials": [], @@ -824,11 +912,11 @@ "_name": "img", "_objFlags": 0, "_parent": { - "__id__": 13 + "__id__": 15 }, "_children": [ { - "__id__": 18 + "__id__": 20 } ], "_active": true, @@ -886,13 +974,13 @@ "_name": "icon", "_objFlags": 0, "_parent": { - "__id__": 17 + "__id__": 19 }, "_children": [], "_active": true, "_components": [ { - "__id__": 19 + "__id__": 21 } ], "_prefab": null, @@ -948,7 +1036,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 18 + "__id__": 20 }, "_enabled": true, "_materials": [], @@ -974,11 +1062,11 @@ "_name": "audio", "_objFlags": 0, "_parent": { - "__id__": 13 + "__id__": 15 }, "_children": [ { - "__id__": 21 + "__id__": 23 } ], "_active": true, @@ -1036,13 +1124,13 @@ "_name": "btn", "_objFlags": 0, "_parent": { - "__id__": 20 + "__id__": 22 }, "_children": [], "_active": true, "_components": [ { - "__id__": 22 + "__id__": 24 } ], "_prefab": null, @@ -1098,7 +1186,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 21 + "__id__": 23 }, "_enabled": true, "_clip": { @@ -1122,10 +1210,10 @@ "_active": true, "_components": [ { - "__id__": 24 + "__id__": 26 }, { - "__id__": 25 + "__id__": 27 } ], "_prefab": null, @@ -1181,7 +1269,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "alignMode": 1, @@ -1208,7 +1296,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 23 + "__id__": 25 }, "_enabled": true, "_layoutSize": { @@ -1246,10 +1334,10 @@ "_active": true, "_components": [ { - "__id__": 27 + "__id__": 29 }, { - "__id__": 28 + "__id__": 30 } ], "_prefab": null, @@ -1263,7 +1351,7 @@ }, "_contentSize": { "__type__": "cc.Size", - "width": 552, + "width": -46, "height": 245 }, "_anchorPoint": { @@ -1305,7 +1393,7 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 28 }, "_enabled": true, "alignMode": 1, @@ -1332,12 +1420,12 @@ "_name": "", "_objFlags": 0, "node": { - "__id__": 26 + "__id__": 28 }, "_enabled": true, "_layoutSize": { "__type__": "cc.Size", - "width": 552, + "width": -46, "height": 245 }, "_resize": 1, @@ -1359,6 +1447,214 @@ "_N$affectedByScale": true, "_id": "d4POtEjZxONruTqzfh85Gk" }, + { + "__type__": "cc.Node", + "_name": "sui", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": false, + "_components": [ + { + "__id__": 32 + }, + { + "__id__": 33 + } + ], + "_prefab": { + "__id__": 34 + }, + "_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, + 440, + 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": "b3QM6ol8ZLCpoTS6HuWn0I" + }, + { + "__type__": "cc.ParticleSystem", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 31 + }, + "_enabled": true, + "_materials": [ + { + "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" + } + ], + "_srcBlendFactor": 1, + "_dstBlendFactor": 771, + "_custom": false, + "_file": { + "__uuid__": "538af702-8a0f-4265-beb1-be7a0f687356" + }, + "_spriteFrame": { + "__uuid__": "fb6b1982-4305-4b8a-a83e-04ac25732105" + }, + "_texture": null, + "_stopped": true, + "playOnLoad": true, + "autoRemoveOnFinish": false, + "totalParticles": 400, + "duration": -1, + "emissionRate": 80, + "life": 5, + "lifeVar": 0, + "_startColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_startColorVar": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 0 + }, + "_endColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_endColorVar": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 0 + }, + "angle": 253.4199981689453, + "angleVar": 0, + "startSize": 30, + "startSizeVar": 10, + "endSize": 30, + "endSizeVar": 10, + "startSpin": 450.37005615234375, + "startSpinVar": -1270.0657958984375, + "endSpin": 804.1529541015625, + "endSpinVar": -3600, + "sourcePos": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "posVar": { + "__type__": "cc.Vec2", + "x": 1088, + "y": 0 + }, + "_positionType": 1, + "positionType": 1, + "emitterMode": 0, + "gravity": { + "__type__": "cc.Vec2", + "x": 0, + "y": -100.54499816894531 + }, + "speed": 100, + "speedVar": 300, + "tangentialAccel": 0, + "tangentialAccelVar": 0, + "radialAccel": 0, + "radialAccelVar": 0, + "rotationIsDir": false, + "startRadius": 0, + "startRadiusVar": 0, + "endRadius": 0, + "endRadiusVar": 0, + "rotatePerS": 0, + "rotatePerSVar": 0, + "_N$preview": true, + "_id": "bf97yQUQNMU70uHouEJbSk" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 31 + }, + "_enabled": true, + "alignMode": 1, + "_target": null, + "_alignFlags": 1, + "_left": 0, + "_right": 0, + "_top": -80, + "_bottom": 0, + "_verticalCenter": 0, + "_horizontalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_id": "2bBDwo8WREL6gQRuSuE8uj" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 31 + }, + "asset": { + "__uuid__": "d30b053b-c7eb-4811-951c-01c98b5825bf" + }, + "fileId": "43HhlK8MBA455Uic/ufNlS", + "sync": false + }, { "__type__": "cc.Canvas", "_name": "", @@ -1415,10 +1711,10 @@ "__id__": 9 }, "sounds_container": { - "__id__": 23 + "__id__": 25 }, "pic_container": { - "__id__": 26 + "__id__": 28 }, "op_sound": { "__uuid__": "f816bebc-d7fa-41ca-aa93-efe1af15931d" @@ -1434,6 +1730,12 @@ "__uuid__": "f7ba93b1-0719-40f3-8482-0d5d94a2fb8f" } ], + "particle_paper": { + "__id__": 31 + }, + "_opSoundPos": [], + "_opPicPos": [], + "_rightCount": 0, "_id": "e687yyoRBIzZAOVRL8Sseh" } ] \ No newline at end of file diff --git a/play/assets/tmpGame/script/Scene.js b/play/assets/tmpGame/script/Scene.js index abfb667feb694c106e439bbe6589f4b637a4e64d..2b48cecdec6b908dcb847d6fbc3c0f751d68c46b 100644 --- a/play/assets/tmpGame/script/Scene.js +++ b/play/assets/tmpGame/script/Scene.js @@ -41,6 +41,23 @@ cc.Class({ default: [], type: [cc.AudioClip], }, + + particle_paper: { + default: null, + type: cc.Node, + }, + + _opSoundPos: [], // 选框ä½ç½® + _opPicPos: [], // 图片ä½ç½® + _rightCount: 0, // æ£ç¡®ä¸ªæ•° + }, + + onEnable() { + cc.game.on("RIGHT", this.answerRight, this); + }, + + onDisable() { + cc.game.off("RIGHT", this.answerRight, this); }, // 生命周期 onLoad @@ -112,7 +129,7 @@ cc.Class({ getDefaultData() { const dataJson = - '{"pic_url":"http://staging-teach.cdn.ireadabc.com/ed94332a503c31e0908bd4c6923a2665.png","pic_url_2":"http://staging-teach.cdn.ireadabc.com/5fb60317ade0195d35ad8034d5370a7f.png","text":"This is a test label.","audio_url":"http://staging-teach.cdn.ireadabc.com/f47f1d7b5c160fe1c59500d180346240.mp3"}'; + '{"title":"hello","audio_title":"http://staging-teach.cdn.ireadabc.com/f7fb9f71ab7d460ac2f78c85efba7610.mp3","options":[{"pic_url":"http://staging-teach.cdn.ireadabc.com/ae96e15404c873878ed4f4ce03f9f495.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/d16a95047e369fbc7f94428624859d03.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/5433aa00faced2d5e02f9cecce63ba09.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/0f0482ddb8c0d3329165ab0612683148.mp3"},{"pic_url":"http://staging-teach.cdn.ireadabc.com/9298013cc63aa40035dbd18f1f8380a8.jpeg","audio_url":"http://staging-teach.cdn.ireadabc.com/784cd4188bf126d6c3c9395d9a807619.mp3"}]}'; const data = JSON.parse(dataJson); return data; }, @@ -177,13 +194,20 @@ cc.Class({ this.initBg(); this.initPic(); + this.playSound(0); // åˆå§‹åŒ–title this.title.string = this.data.title; - this.title.node.on(cc.Node.EventType.TOUCH_START, () => { - this.playAudioByUrl(this.data.audio_title); - }); + var self = this; - for (var i = 0; i < this.data.options.length; i++) { + let scale = 1; + let count = this.data.options.length - 4; + if (count > 0) { + scale = 1 - count * 0.16; + } + this.pic_container.scale = scale; + this.sounds_container.scale = scale; + + for (let i = 0; i < this.data.options.length; i++) { const op_s = cc.instantiate(this.op_sound); op_s.getComponent("op_sound")._opId = i; op_s.getComponent("op_sound")._soundUrl = this.data.options[i].audio_url; @@ -191,17 +215,32 @@ cc.Class({ const op_p = cc.instantiate(this.op_pic); op_p.getComponent("op_pic")._opId = i; - op_p.getComponent("op_pic").setPic(this.data.options[i].pic_url); + op_p.getComponent("op_pic")._picUrl = this.data.options[i].pic_url; this.pic_container.addChild(op_p); - op_p.getComponent("op_pic")._ori_pos = cc.v2(op_p.x, op_p.y); } - var self = this; this.scheduleOnce(function () { self.pic_container.getComponent(cc.Layout).enabled = false; - }, 0.5); + self.sounds_container.getComponent(cc.Layout).enabled = false; + for (let o of this.sounds_container.children) { + this._opSoundPos.push(o.getPosition()); + } + for (let o of this.pic_container.children) { + this._opPicPos.push(o.getPosition()); + } - this.playSound(0); + this._opPicPos.sort(this.randomsort); + this._opSoundPos.sort(this.randomsort); + + for (let i = 0; i < this.sounds_container.children.length; i++) { + this.sounds_container.children[i].setPosition(this._opSoundPos[i]); + this.pic_container.children[i].setPosition(this._opPicPos[i]); + + this.pic_container.children[i].getComponent("op_pic")._ori_pos = this._opPicPos[i]; + + this.pic_container.children[i].getComponent("op_pic").setPic(); + } + }, 0.5); }, initBg() { @@ -281,12 +320,7 @@ cc.Class({ playAudioByUrl(audio_url, cb = null) { if (audio_url) { cc.assetManager.loadRemote(audio_url, (err, audioClip) => { - const audioId = cc.audioEngine.play(audioClip, false, 0.8); - if (cb) { - cc.audioEngine.setFinishCallback(audioId, () => { - cb(); - }); - } + cc.audioEngine.play(audioClip, false); }); } }, @@ -296,5 +330,29 @@ cc.Class({ cc.audioEngine.playEffect(this.sounds[index], false); }, + randomsort(a, b) { + return Math.random() > 0.5 ? 1 : -1; + }, + + playTitle() { + cc.assetManager.loadRemote(this.data.audio_title, (err, audioClip) => { + cc.audioEngine.playEffect(audioClip, false); + }); + }, + + answerRight() { + this._rightCount++; + if (this._rightCount == this.data.options.length) { + this.scheduleOnce(function () { + this.playSound(1); + this.particle_paper.active = true; + + this.scheduleOnce(function () { + this.particle_paper.active = false; + }, 5); + }, 1); + } + }, + // ------------------------------------------ }); diff --git a/play/assets/tmpGame/script/op_pic.js b/play/assets/tmpGame/script/op_pic.js index 4c7f85ad1add55fc4cd13080b935f85910f9a3a0..c25967b612c38bc05f0be0d7b74584f7191903af 100644 --- a/play/assets/tmpGame/script/op_pic.js +++ b/play/assets/tmpGame/script/op_pic.js @@ -12,10 +12,10 @@ cc.Class({ type: cc.Sprite, }, - // 星星特效 - particle_star: { + // 图片选ä¸åº•图 + pic_selected: { default: null, - type: cc.Prefab, + type: cc.Node, }, // 声音,0-æ£ç¡®ï¼Œ1-错误 @@ -29,74 +29,64 @@ cc.Class({ _isEnter: false, // 是å¦ç¢°åˆ°å¯¹çš„选框 _isContact: false, // 是å¦ç¢°åˆ°äº†é€‰é¡¹æ¡† _soundOp: null, // 碰到的选框 + _picUrl: null, // å›¾ç‰‡åœ°å€ + _spriteFrame: null, + }, + + onEnable() { + cc.game.on("SELECT", this.selected, this); + }, + + onDisable() { + cc.game.off("SELECT", this.selected, this); }, onLoad() { - this.nodePos = this.node.getPosition(); + this.scheduleOnce(function () { + this._ori_pos = this.node.getPosition(); + }, 0.5); + this.node.on("touchstart", this.onTouchStart, this); this.node.on("touchmove", this.onTouchMove, this); this.node.on("touchend", this.onTouchEnd, this); this.node.on("touchcancel", this.onTouchEnd, this); }, - setPic(url) { - cc.loader.load({ url }, (err, img) => { + setPic() { + cc.loader.load({ url: this._picUrl }, (err, img) => { const spriteFrame = new cc.SpriteFrame(img); this.pic.spriteFrame = spriteFrame; + this._spriteFrame = spriteFrame; }); }, + onTouchStart(event) { + this.pic_selected.active = true; + cc.game.emit("SELECT", this._opId); + }, + //触摸移动; - onTouchMove(event) { - var self = this; - var touches = event.getTouches(); - //触摸刚开始的ä½ç½® - var oldPos = self.node.convertToNodeSpaceAR(touches[0].getStartLocation()); - //è§¦æ‘¸æ—¶ä¸æ–å˜æ›´çš„ä½ç½® - var newPos = self.node.convertToNodeSpaceAR(touches[0].getLocation()); - - var subPos = oldPos.sub(newPos); // 2.X版本是 p1.sub(p2); - - self.node.x = self.nodePos.x - subPos.x; - self.node.y = self.nodePos.y - subPos.y; - - // 控制节点移ä¸å‡ºå±å¹•; - var minX = -cc.view.getVisibleSize().width / 2 + self.node.width / 2; //最å°Xåæ ‡ï¼› - var maxX = Math.abs(minX); - var minY = -cc.view.getVisibleSize().height / 2 + self.node.height / 2; //最å°Yåæ ‡ï¼› - var maxY = Math.abs(minY); - var nPos = self.node.getPosition(); //èŠ‚ç‚¹å®žæ—¶åæ ‡ï¼› - - if (nPos.x < minX) { - nPos.x = minX; - } - if (nPos.x > maxX) { - nPos.x = maxX; - } - if (nPos.y < minY) { - nPos.y = minY; + onTouchMove(touch, event) { + let delta = touch.getDelta(); + this.node.x += delta.x; + this.node.y += delta.y; + if (this.pic_selected.active) { + this.pic_selected.active = false; } - if (nPos.y > maxY) { - nPos.y = maxY; - } - self.node.setPosition(nPos); }, onTouchEnd() { - this.nodePos = this.node.getPosition(); //获å–触摸结æŸä¹‹åŽçš„nodeåæ ‡ï¼› - if (this._isContact) { - this.node.position = this._soundOp.position; + if (this._isContact && !this._soundOp.node.getComponent("op_sound")._isRight) { if (this._isEnter) { console.log("enter right"); this.playSound(0); - var par = cc.instantiate(this.particle_star); - this.node.addChild(par); + + this._soundOp.node.getComponent("op_sound").correct(this._spriteFrame); + this.node.destroy(); } else { console.log("enter false"); this.playSound(1); - this.node.getComponent(cc.Animation).play("wrong"); - this.scheduleOnce(function () { - this.node.setPosition(this._ori_pos); - }, 2); + this.node.active = false; + this._soundOp.node.getComponent("op_sound").wrong(this._spriteFrame); } } else { this.node.setPosition(this._ori_pos); @@ -126,11 +116,22 @@ cc.Class({ console.log("on collision exit"); this._isEnter = false; this._isContact = false; - this._soundOp = null; + // this._soundOp = null; }, // æ’æ”¾å£°éŸ³ playSound(index) { cc.audioEngine.playEffect(this.sounds[index], false); }, + + resetPos() { + this.node.setPosition(this._ori_pos); + }, + + selected(id) { + if (this._opId == id) { + return; + } + this.pic_selected.active = false; + }, }); diff --git a/play/assets/tmpGame/script/op_sound.js b/play/assets/tmpGame/script/op_sound.js index 336de8a1d0b8a265c3230793a11ecc5da249e3e6..4dcdd8a9560cc4571043d6748c33afed61dcdb29 100644 --- a/play/assets/tmpGame/script/op_sound.js +++ b/play/assets/tmpGame/script/op_sound.js @@ -12,8 +12,28 @@ cc.Class({ type: cc.Node, }, + // å£°éŸ³å›¾æ ‡ + rightFrame: { + default: null, + type: cc.Node, + }, + + // å£°éŸ³å›¾æ ‡ + rightPic: { + default: null, + type: cc.Sprite, + }, + + // 星星特效 + particle_star: { + default: null, + type: cc.Prefab, + }, + _opId: 0, // 选项id _soundUrl: "", // éŸ³é¢‘æ–‡ä»¶åœ°å€ + _opPic: null, + _isRight: false, }, /** @@ -23,9 +43,9 @@ cc.Class({ if (this._soundUrl != "") { cc.assetManager.loadRemote(this._soundUrl, (err, audioClip) => { const audioId = cc.audioEngine.play(audioClip, false, 0.8); - this.iconSound.getComponent(cc.Aimation).play("icon_sound_play"); + this.iconSound.getComponent(cc.Animation).play("icon_sound_play"); cc.audioEngine.setFinishCallback(audioId, () => { - this.iconSound.getComponent(cc.Aimation).play("icon_sound_finish"); + this.iconSound.getComponent(cc.Animation).play("icon_sound_finish"); }); }); } @@ -36,7 +56,9 @@ cc.Class({ * @param {Collider} other 产生碰撞的å¦ä¸€ä¸ªç¢°æ’žç»„ä»¶ * @param {Collider} self 产生碰撞的自身的碰撞组件 */ - onCollisionEnter: function (other, self) {}, + onCollisionEnter: function (other, self) { + this._opPic = other; + }, /** * 当碰撞结æŸåŽè°ƒç”¨ @@ -46,4 +68,42 @@ cc.Class({ onCollisionExit: function (other, self) { console.log("on collision exit"); }, + + correct(spriteFrame) { + this.rightFrame.active = true; + // cc.loader.load({ url }, (err, img) => { + // const spriteFrame = new cc.SpriteFrame(img); + // this.rightPic.spriteFrame = spriteFrame; + // }); + this.rightPic.spriteFrame = spriteFrame; + + var par = cc.instantiate(this.particle_star); + this.node.addChild(par); + + this._isRight = true; + + cc.game.emit("RIGHT"); + }, + + wrong(spriteFrame) { + this.rightFrame.active = true; + // cc.loader.load({ url }, (err, img) => { + // const spriteFrame = new cc.SpriteFrame(img); + // this.rightPic.spriteFrame = spriteFrame; + // }); + this.rightPic.spriteFrame = spriteFrame; + let time = 0.1; + let action = cc.repeat( + cc.sequence(cc.moveBy(time, -10, 0), cc.moveBy(time, 10, 0), cc.moveBy(time, 10, 0), cc.moveBy(time, -10, 0)), + 5 + ); + + this.node.runAction(action); + this.scheduleOnce(function () { + this.rightFrame.active = false; + this.rightPic.spriteFrame = null; + this._opPic.node.active = true; + this._opPic.node.getComponent("op_pic").resetPos(); + }, 2.2); + }, }); diff --git a/play/assets/tmpGame/textures/option/pic_frame_selected.png b/play/assets/tmpGame/textures/option/pic_frame_selected.png new file mode 100644 index 0000000000000000000000000000000000000000..a817d8b20737ea942e0ee27af568c37700e477d7 Binary files /dev/null and b/play/assets/tmpGame/textures/option/pic_frame_selected.png differ diff --git a/play/assets/tmpGame/textures/option/pic_frame_selected.png.meta b/play/assets/tmpGame/textures/option/pic_frame_selected.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..1cd44c99361c5201a658bc429f1602dc2bd75b12 --- /dev/null +++ b/play/assets/tmpGame/textures/option/pic_frame_selected.png.meta @@ -0,0 +1,36 @@ +{ + "ver": "2.3.5", + "uuid": "641b2540-061f-44f6-9248-8ffa04efb6ce", + "type": "sprite", + "wrapMode": "clamp", + "filterMode": "bilinear", + "premultiplyAlpha": true, + "genMipmaps": false, + "packable": true, + "width": 253, + "height": 227, + "platformSettings": {}, + "subMetas": { + "pic_frame_selected": { + "ver": "1.0.4", + "uuid": "dec1094e-44d7-400e-ae82-87256133f537", + "rawTextureUuid": "641b2540-061f-44f6-9248-8ffa04efb6ce", + "trimType": "auto", + "trimThreshold": 1, + "rotated": false, + "offsetX": 0, + "offsetY": 4, + "trimX": 0, + "trimY": 0, + "width": 253, + "height": 219, + "rawWidth": 253, + "rawHeight": 227, + "borderTop": 0, + "borderBottom": 0, + "borderLeft": 0, + "borderRight": 0, + "subMetas": {} + } + } +} \ No newline at end of file