Commit f7a02102 authored by yu's avatar yu

1

parent dc700aed
...@@ -219,6 +219,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -219,6 +219,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
target.active = false; target.active = false;
} }
private onTouchCancel(e) { private onTouchCancel(e) {
if (!this.isClick || !this.touching) return;
let target: cc.Node = e.target; let target: cc.Node = e.target;
this.playWrongAudio(); this.playWrongAudio();
let data = target.data; let data = target.data;
...@@ -226,19 +227,22 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -226,19 +227,22 @@ export default class SceneComponent extends MyCocosSceneComponent {
target.setPosition(data.pos); target.setPosition(data.pos);
} }
private isClick; private isClick;
private touching;
private onTouchStart(e) { private onTouchStart(e) {
if (!this.isClick) return; if (!this.isClick || this.touching) return;
this.touching = true;
let target: cc.Node = e.target; let target: cc.Node = e.target;
target.parent = this.node; target.parent = this.node;
this.setTouchPos(e); this.setTouchPos(e);
} }
private onTouchMove(e) { private onTouchMove(e) {
if (!this.isClick) return; if (!this.isClick || !this.touching) return;
let target: cc.Node = e.target; let target: cc.Node = e.target;
this.setTouchPos(e); this.setTouchPos(e);
} }
private onTouchEnd(e) { private onTouchEnd(e) {
if (!this.isClick) return; if (!this.isClick || !this.touching) return;
this.touching = false;
let target: cc.Node = e.target; let target: cc.Node = e.target;
let data = target.data; let data = target.data;
let item: any = this.layout_box.children.find((ch) => { let item: any = this.layout_box.children.find((ch) => {
......
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