import { _decorator, Node, tween, UIOpacity } from 'cc'; import { BaseZhaocha } from '../../hall/script/BaseZhaocha'; import { BundleName } from '../../script/Config/EnumCfg'; import { LayerMgr } from '../../script/Manager/LayerMgr'; const { ccclass, property } = _decorator; @ccclass('unit44') export class unit44 extends BaseZhaocha { override answerName: Array = [ "作业本", "平板电脑", "碳纤维", "不锈钢壶", "披萨", "猫粮罐头", "芭比娃娃", "动漫贴纸", "台灯", "挂历", "两个月亮", "蚊香", ] override num_showTip: number = 10; 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[10].active = true }) .start() } this.startPos = null } }