1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- import { _decorator, Node, tween, UIOpacity } from 'cc';
- import { BaseZhaocha } from '../../hall/script/BaseZhaocha';
- const { ccclass, property } = _decorator;
- @ccclass('unit59')
- export class unit59 extends BaseZhaocha {
- override answerName: Array<string> = [
- "熊猫庆祝",
- "吊车",
- "安全生产",
- "棒球帽",
- "工具箱",
- "鲨鱼",
- "小轿车",
- "游艇",
- "老虎看书",
- "皮划艇",
- "专卖店",
- "鱼竿",
- ]
- override num_showTip: number = 5;
- 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[5].active = true
- })
- .start()
- }
- this.startPos = null
- }
- }
|