import { _decorator, Node, tween, UIOpacity } from 'cc'; import { BaseZhaocha } from '../../hall/script/BaseZhaocha'; const { ccclass, property } = _decorator; @ccclass('unit101') export class unit101 extends BaseZhaocha { override answerName: Array = [ "公文包", "飞机", "烟囱", "船", "现代发型", "小广告", "驼马", "晴天娃娃", "酒精灯", "西餐刀", "奶茶招聘", "字母表", ] override num_showTip: number = 7; 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) } 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[this.num_showTip].active = true }) .start() } this.startPos = null } }