import { _decorator, Node, tween, UIOpacity } from 'cc'; import { BaseZhaocha } from '../../hall/script/BaseZhaocha'; const { ccclass, property } = _decorator; @ccclass('unit32') export class unit32 extends BaseZhaocha { override answerName: Array = [ "蛋糕", "高脚凳", "西洋菜单", "电灯", "热气球", "牛仔裤", "沐浴露", "浴缸", "洋娃娃", "台灯", "手机", "轮胎", ] override num_showTip: number = 9; override str_tishi = "滑动纱窗,露出后面的台灯"; @property(Node) node_cat: Node = null; startPos = null override start(): void { super.start() this.node_cat.on(Node.EventType.TOUCH_START, this.touchStart, this) this.node_cat.on(Node.EventType.TOUCH_MOVE, this.touchMove, this) this.node_cat.on(Node.EventType.TOUCH_END, this.touchEnd, this) this.node_cat.on(Node.EventType.TOUCH_CANCEL, this.touchEnd, this) } touchStart(e) { this.startPos = e.getUILocation() } touchMove() { } touchEnd(e) { let endpos = e.getUILocation() if (this.startPos.subtract(endpos).length() > 100) { tween(this.node_cat.getComponent(UIOpacity)) .to(0.5, { opacity: 0 }) .call(() => { this.node_cat.active = false this.arr_node_allitem[9].active = true }) .start() } this.startPos = null } }