fail.ts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import { _decorator, Component, Node } from 'cc';
  2. import { gameManager } from '../gameManager';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('fail')
  5. export class fail extends Component {
  6. @property(Node) btn_close:Node = null;
  7. @property(Node) btn_fail_reLife:Node = null;
  8. @property(Node) btn_fail_reStart:Node = null;
  9. private m_call_relife = null;
  10. private m_call_restart = null;
  11. protected start(): void {
  12. this.btn_fail_reLife.off(Node.EventType.TOUCH_END)
  13. this.btn_fail_reLife.on(Node.EventType.TOUCH_END,()=>{
  14. if(this.m_call_relife!=null){
  15. this.m_call_relife()
  16. }
  17. })
  18. this.btn_fail_reStart.off(Node.EventType.TOUCH_END)
  19. this.btn_fail_reStart.on(Node.EventType.TOUCH_END,()=>{
  20. if(this.m_call_restart!=null){
  21. this.m_call_restart()
  22. }
  23. })
  24. this.btn_close.off(Node.EventType.TOUCH_END)
  25. this.btn_close.on(Node.EventType.TOUCH_END,()=>{
  26. this.node.active = false;
  27. if(gameManager.Singleton.getLevelData()!=null){
  28. gameManager.Singleton.backGameList()
  29. }
  30. })
  31. }
  32. public show(is_relife:boolean,call_relife,call_restart){
  33. this.node.active = true;
  34. this.m_call_relife = call_relife;
  35. this.m_call_restart = call_restart;
  36. if(is_relife){
  37. this.btn_fail_reLife.active = true;
  38. }else{
  39. this.btn_fail_reLife.active = false;
  40. }
  41. gameManager.Singleton.sys_fail_prompt_music()
  42. }
  43. // public show(is_relife:boolean,call_relife,call_restart){
  44. // this.node.active = true;
  45. // this.m_call_relife = call_relife;
  46. // this.m_call_restart = call_restart;
  47. // if(is_relife){
  48. // this.btn_fail_reLife.active = true;
  49. // }else{
  50. // this.btn_fail_reLife.active = false;
  51. // }
  52. // this.btn_fail_reLife.off(Node.EventType.TOUCH_END)
  53. // this.btn_fail_reStart.off(Node.EventType.TOUCH_END)
  54. // this.btn_close.off(Node.EventType.TOUCH_END)
  55. // this.btn_fail_reLife.on(Node.EventType.TOUCH_END,()=>{
  56. // if(this.m_call_relife!=null){
  57. // this.m_call_relife()
  58. // }
  59. // })
  60. // this.btn_fail_reStart.on(Node.EventType.TOUCH_END,()=>{
  61. // if(this.m_call_restart!=null){
  62. // this.m_call_restart()
  63. // }
  64. // })
  65. // this.btn_close.on(Node.EventType.TOUCH_END,()=>{
  66. // this.node.active = false;
  67. // if(gameManager.Singleton.getLevelData()!=null){
  68. // gameManager.Singleton.backGameList()
  69. // }
  70. // })
  71. // gameManager.Singleton.sys_fail_prompt_music()
  72. // }
  73. }