import { _decorator, Node, tween, UIOpacity, utils } from 'cc'; import { BaseZhaocha } from '../../hall/script/BaseZhaocha'; import { AudioManager } from '../../script/Manager/AudioMgr'; const { ccclass, property } = _decorator; @ccclass('unit68') export class unit68 extends BaseZhaocha { override answerName: Array = [ "烟囱", "应援牌", "应援棒", "麦克风", "吉他", "电子琴", "音响", "洞洞鞋", "演出海报", "射灯", "牛打鼓", "卡通上衣", ] override num_showTip: number = 0; 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) { AudioManager.instance.playOtherBundleAudio("unit68", 'cat') tween(this.node_cat.getComponent(UIOpacity)) .to(0.5, { opacity: 0 }) .call(() => { this.node_cat.active = false this.arr_node_allitem[0].active = true }) .start() } this.startPos = null } }