unit70.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { _decorator, tween, UIOpacity, Node } from 'cc';
  2. import { BaseZhaocha } from '../../hall/script/BaseZhaocha';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('unit70')
  5. export class unit70 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 = 1;
  21. override str_tishi = "拖动左上方的卷轴,可展开台球厅招牌";
  22. @property(Node)
  23. node_cat: Node = null;
  24. @property(Node)
  25. node_juanzhou: Node = null;
  26. startPos = null
  27. override start(): void {
  28. super.start()
  29. this.node_cat.on(Node.EventType.TOUCH_START, this.touchStart, this)
  30. this.node_cat.on(Node.EventType.TOUCH_MOVE, this.touchMove, this)
  31. this.node_cat.on(Node.EventType.TOUCH_END, this.touchEnd, this)
  32. this.node_cat.on(Node.EventType.TOUCH_CANCEL, this.touchEnd, this)
  33. }
  34. touchStart(e) {
  35. this.startPos = e.getUILocation()
  36. }
  37. touchMove() {
  38. }
  39. touchEnd(e) {
  40. let endpos = e.getUILocation()
  41. if (this.startPos.subtract(endpos).length() > 100) {
  42. tween(this.node_juanzhou.getComponent(UIOpacity))
  43. .to(0.5, { opacity: 255 })
  44. .call(() => {
  45. this.arr_node_allitem[1].active = true
  46. })
  47. .start()
  48. }
  49. this.startPos = null
  50. }
  51. // OnClickJuanzhou() {
  52. // tween(this.node_juanzhou.getComponent(UIOpacity))
  53. // .to(0.5, { opacity: 255 })
  54. // .call(() => {
  55. // this.arr_node_allitem[1].active = true
  56. // })
  57. // .start()
  58. // }
  59. }