Commit 7906653e authored by yu's avatar yu

1

parent f3a5ca6d
...@@ -212,6 +212,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -212,6 +212,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();
target.parent = this.layout_word; target.parent = this.layout_word;
...@@ -219,19 +220,22 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -219,19 +220,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