import { _decorator, Node, sp, tween, UIOpacity } from 'cc'; import { BaseZhaocha } from '../../hall/script/BaseZhaocha'; const { ccclass, property } = _decorator; @ccclass('unit87') export class unit87 extends BaseZhaocha { override answerName: Array = [ "现代美女", "钥匙扣", "手表", "兵乓球拍", "兵乓球", "海报", "天线", "平底锅", "收割机", "土豆", "耳机", "风车", ] override num_showTip: number = 5; override str_tishi = "滑动房子墙上的麦穗,露出藏在后面的海报"; @property(Node) node_zhanai: Node = null; startPos = null override start(): void { super.start() this.node_zhanai.on(Node.EventType.TOUCH_START, this.touchStart, this) this.node_zhanai.on(Node.EventType.TOUCH_MOVE, this.touchMove, this) this.node_zhanai.on(Node.EventType.TOUCH_END, this.touchEnd, this) this.node_zhanai.on(Node.EventType.TOUCH_CANCEL, this.touchEnd, this) this.schedule(() => { this.pig.setAnimation(0, "animation", false) }, 5) } touchStart(e) { this.startPos = e.getUILocation() } touchMove() { } touchEnd(e) { let endpos = e.getUILocation() if (this.startPos.subtract(endpos).length() > 100) { tween(this.node_zhanai.getComponent(UIOpacity)) .to(0.5, { opacity: 0 }) .call(() => { this.node_zhanai.active = false this.arr_node_allitem[5].active = true }) .start() } this.startPos = null } @property(sp.Skeleton) pig: sp.Skeleton = null; }