unit88.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { _decorator, Node, tween, UIOpacity } from 'cc';
  2. import { BaseZhaocha } from '../../hall/script/BaseZhaocha';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('unit88')
  5. export class unit88 extends BaseZhaocha {
  6. override answerName: Array<string> = [
  7. "巨型蜻蜓",
  8. "蚂蚁人",
  9. "电击棒",
  10. "丝袜",
  11. "高跟鞋",
  12. "铁丝",
  13. "电表箱",
  14. "外星人",
  15. "无脸男人",
  16. "飞机",
  17. "狮子",
  18. "悠悠球",
  19. ]
  20. override num_showTip: number = 10;
  21. override str_tishi = "滑动左边田地从下往上数第二排的草丛,露出藏在后面的狮子";
  22. @property(Node)
  23. node_zhanai: Node = null;
  24. startPos = null
  25. override start(): void {
  26. super.start()
  27. this.node_zhanai.on(Node.EventType.TOUCH_START, this.touchStart, this)
  28. this.node_zhanai.on(Node.EventType.TOUCH_MOVE, this.touchMove, this)
  29. this.node_zhanai.on(Node.EventType.TOUCH_END, this.touchEnd, this)
  30. this.node_zhanai.on(Node.EventType.TOUCH_CANCEL, this.touchEnd, this)
  31. }
  32. touchStart(e) {
  33. this.startPos = e.getUILocation()
  34. }
  35. touchMove() {
  36. }
  37. touchEnd(e) {
  38. let endpos = e.getUILocation()
  39. if (this.startPos.subtract(endpos).length() > 100) {
  40. tween(this.node_zhanai.getComponent(UIOpacity))
  41. .to(0.5, { opacity: 0 })
  42. .call(() => {
  43. this.node_zhanai.active = false
  44. this.arr_node_allitem[10].active = true
  45. })
  46. .start()
  47. }
  48. this.startPos = null
  49. }
  50. }