You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
86 lines
1.9 KiB
86 lines
1.9 KiB
import { ryw_Event } from "../../../../FrameWork/Event/EventEnum";
|
|
import EventMgr from "../../../../FrameWork/Event/EventMgr";
|
|
import Common5 from "../../../../Platform/th/Common5";
|
|
|
|
|
|
const {ccclass, property} = cc._decorator;
|
|
|
|
@ccclass
|
|
export default class GuizeTouch extends cc.Component {
|
|
@property(
|
|
{
|
|
type: cc.Node,
|
|
displayName: "注册触摸节点",
|
|
}
|
|
)
|
|
emitTarget:cc.Node = null
|
|
|
|
@property(
|
|
{
|
|
type: cc.Node,
|
|
displayName: "隐藏的节点",
|
|
}
|
|
)
|
|
hideTarget:cc.Node = null
|
|
|
|
|
|
@property(cc.Boolean)
|
|
isHideTarget:Boolean= true
|
|
|
|
|
|
@property(cc.Integer)
|
|
touchIndex:number = 0
|
|
|
|
|
|
onLoad () {
|
|
if(!this.emitTarget){
|
|
this.emitTarget = this.node
|
|
}
|
|
|
|
|
|
this.openTouchEvent(this.emitTarget)
|
|
|
|
}
|
|
|
|
start () {
|
|
|
|
}
|
|
|
|
|
|
openTouchEvent(node){
|
|
node.on(cc.Node.EventType.TOUCH_START,this.touchStartNode,this)
|
|
node.on(cc.Node.EventType.TOUCH_MOVE,this.touchMoveNode,this)
|
|
node.on(cc.Node.EventType.TOUCH_CANCEL,this.touchEndNode,this)
|
|
node.on(cc.Node.EventType.TOUCH_END,this.touchEndNode,this)
|
|
}
|
|
|
|
closeTouchEvent(node:cc.Node){
|
|
node.off(cc.Node.EventType.TOUCH_START,this.touchStartNode,this)
|
|
node.off(cc.Node.EventType.TOUCH_MOVE,this.touchMoveNode,this)
|
|
node.off(cc.Node.EventType.TOUCH_CANCEL,this.touchEndNode,this)
|
|
node.off(cc.Node.EventType.TOUCH_END,this.touchEndNode,this)
|
|
}
|
|
|
|
touchStartNode(event){
|
|
|
|
Common5.playEffect("点击规则");
|
|
}
|
|
|
|
|
|
touchMoveNode(event){
|
|
|
|
}
|
|
|
|
touchEndNode(event){
|
|
EventMgr.emitEvent_custom(ryw_Event.GuiZeGameBtnClick, {touchIndex: this.touchIndex});
|
|
|
|
if(this.isHideTarget){
|
|
if( this.hideTarget){
|
|
this.hideTarget.active = false
|
|
}
|
|
|
|
}
|
|
|
|
//
|
|
}
|
|
}
|
|
|