12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { _decorator,Node, tween, UIOpacity } from 'cc';
- import { BaseZhaocha } from '../../hall/script/BaseZhaocha';
- const { ccclass, property } = _decorator;
- @ccclass('unit76')
- export class unit76 extends BaseZhaocha {
- override answerName: Array<string> = [
- "搅拌车",
- "耳机",
- "摄像头",
- "喇叭",
- "军用铁锹",
- "警示牌",
- "电子表",
- "蝴蝶结",
- "怀表",
- "望远镜",
- "信号基站",
- "数字",
- ]
- override num_showTip: number = 11;
- 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[11].active = true
- })
- .start()
- }
- this.startPos = null
- }
- }
|