Files
fc/dev/project/library/imports/f8/f8efc855-0d0e-421c-b0f4-f7d8800e8e79.js
T

52 lines
1.2 KiB
JavaScript
Raw Normal View History

2026-05-24 10:21:26 +08:00
"use strict";
cc._RF.push(module, 'f8efchVDQ5CHLD099iADo55', 'bridge.toucher');
// Scripts/zbridge/cmps/bridge.toucher.js
"use strict";
/*******************************************************************************
*
* 全局置顶点击特效层
*
*
*
* 2021.12.10
******************************************************************************/
cc.Class({
"extends": cc.Component,
properties: {
spEffect: {
"default": null,
type: sp.Skeleton,
displayName: "动画"
}
},
// 载入
onLoad: function onLoad() {
// 点击监听
this.node.on("touchend", this.onTouched, this);
this.node._touchListener.setSwallowTouches(false);
// 特效初始化
nx.gui.setActive(this.spEffect, "", false);
},
// 销毁
onDestroy: function onDestroy() {
// 点击监听解除
this.node.off("touchend", this.onTouched, this);
},
// 点击
onTouched: function onTouched(_touch) {
// 定位
var pos = _touch.getLocation();
pos = this.node.convertToNodeSpaceAR(pos);
this.spEffect.node.position = pos;
nx.gui.setActive(this.spEffect, "", true);
if (this.spEffect) {
this.spEffect.setAnimation(0, "action", false);
}
}
});
cc._RF.pop();