123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { _decorator, Node, tween, UIOpacity } from 'cc';
- import { BaseZhaocha } from '../../hall/script/BaseZhaocha';
- const { ccclass, property } = _decorator;
- @ccclass('unit62')
- export class unit62 extends BaseZhaocha {
- override answerName: Array<string> = [
- "充电宝",
- "机枪",
- "探照灯",
- "扫描仪",
- "城管",
- "多媒体",
- "机械臂",
- "烧烤架",
- "雪花图案",
- "鸡精",
- "杀虫剂",
- "铜雕",
- ]
- override num_showTip: number = 1;
- 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[1].active = true
- })
- .start()
- }
- this.startPos = null
- }
- }
|