This commit is contained in:
tothvillar
2026-07-09 15:04:14 +08:00
commit e896e2ead4
1180 changed files with 115132 additions and 0 deletions
+34
View File
@@ -0,0 +1,34 @@
cc.Class({
extends: cc.Component,
properties: {
liziNodeChild: {
default: null,
type: cc.ParticleSystem,
displayName: "粒子效果"
}
},
start: function () {
cc.game.addPersistRootNode(this.node);
this.node.zIndex = cc.macro.MAX_ZINDEX;
this.node.on(cc.Node.EventType.TOUCH_START, this.onTouchStart, this);
this.node.on(cc.Node.EventType.TOUCH_END, this.onTouchEnd, this);
this.node.on(cc.Node.EventType.TOUCH_CANCEL, this.onTouchEnd, this);
this.node.on(cc.Node.EventType.TOUCH_MOVE, this.onTouchMove, this);
this.node._touchListener.swallowTouches = false;
},
onTouchStart: function (e) {
this.startPos = this.node.convertToNodeSpaceAR(e.getLocation());
this.liziNode = cc.instantiate(this.liziNodeChild.node);
this.liziNode.parent = this.node;
this.liziNode.zIndex = cc.macro.MAX_ZINDEX;
this.liziNode.getComponent(cc.ParticleSystem).resetSystem();
this.liziNode.position = this.startPos;
},
onTouchEnd: function () {
this.liziNode.getComponent(cc.ParticleSystem).stopSystem();
},
onTouchMove: function (e) {
this.startPos = this.node.convertToNodeSpaceAR(e.getLocation());
this.liziNode.position = this.startPos;
}
});