import { _decorator, Node, tween, UIOpacity } from 'cc'; import { BaseZhaocha } from '../../hall/script/BaseZhaocha'; const { ccclass, property } = _decorator; @ccclass('unit60') export class unit60 extends BaseZhaocha { override answerName: Array = [ "纹身", "时钟", "饮料", "铅笔", "平板", "爆米花", "飞机", "悠悠球", "围巾", "扑克", "饭盒", "皮鞋", ] override num_showTip: number = 2; 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[2].active = true }) .start() } this.startPos = null } }