123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- import { _decorator, Node, tween, UIOpacity } from 'cc';
- import { BaseZhaocha } from '../../hall/script/BaseZhaocha';
- const { ccclass, property } = _decorator;
- @ccclass('unit74')
- export class unit74 extends BaseZhaocha {
- override answerName: Array<string> = [
- "充电宝",
- "吊灯",
- "钢管",
- "高跟鞋",
- "光剑",
- "麦克风",
- "摄像头",
- "暖气片",
- "手机",
- "丝袜",
- "音响",
- "钻戒",
- ]
- override num_showTip: number = 8;
- 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[8].active = true
- })
- .start()
- }
- this.startPos = null
- }
- }
|