fail.ts 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. import { _decorator, Component, Label, Node, Sprite, SpriteFrame, Vec3 } from 'cc';
  2. import { config } from '../config';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('fail')
  5. export class fail extends Component {
  6. @property(Node) bg:Node;
  7. @property(Node) img_text:Node;
  8. @property(Node) btn_extend:Node;
  9. @property(Node) btn_restart:Node;
  10. @property(Node) lab_restart:Node;
  11. @property(Node) img_restart_video_icon:Node;
  12. @property(Node) lab_extend_time:Node;
  13. @property(Node) btn_quit:Node;
  14. @property(SpriteFrame) sf_huidaocuowu:SpriteFrame;
  15. private m_extend_call:any = null;
  16. private m_restart_call:any = null;
  17. private m_quit_call:any = null;
  18. start() {
  19. let self = this;
  20. this.btn_extend.on(Node.EventType.TOUCH_START,()=>{
  21. if(this.m_extend_call!=null){
  22. this.m_extend_call(this)
  23. }
  24. },this);
  25. this.btn_restart.on(Node.EventType.TOUCH_START,()=>{
  26. if(this.m_restart_call!=null){
  27. this.m_restart_call(this)
  28. }
  29. },this);
  30. this.btn_quit.on(Node.EventType.TOUCH_START,()=>{
  31. if(this.m_quit_call!=null){
  32. this.m_quit_call(this)
  33. }
  34. },this);
  35. }
  36. public close(){
  37. this.node.removeFromParent();
  38. }
  39. //双图找不同
  40. public showView(extend_time,extend_call,restart,is_show_restart_video){
  41. this.m_extend_call = extend_call;
  42. this.m_restart_call = restart;
  43. this.lab_extend_time.getComponent(Label).string = `延长${extend_time}秒`;
  44. if(is_show_restart_video===1){
  45. this.img_restart_video_icon.active = true;
  46. this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z);
  47. }else{
  48. this.img_restart_video_icon.active = false;
  49. this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z);
  50. }
  51. }
  52. public showJYLView(restart,is_show_restart_video,quit,categoryid){
  53. this.m_restart_call = restart;
  54. this.m_quit_call = quit;
  55. this.btn_extend.active = false;
  56. this.btn_quit.active = true;
  57. if(categoryid===config.PLAY_TYPE.JI_YI_LI){
  58. this.img_text.getComponent(Sprite).spriteFrame = this.sf_huidaocuowu;
  59. }else{
  60. this.bg.angle = -90;
  61. this.bg.position = new Vec3(this.bg.position.x+40,this.bg.position.y,this.bg.position.z)
  62. // 闯关失败
  63. this.img_text.getComponent(Sprite).spriteFrame = this.sf_huidaocuowu;
  64. }
  65. if(is_show_restart_video===1){
  66. this.img_restart_video_icon.active = true;
  67. this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z);
  68. }else{
  69. this.img_restart_video_icon.active = false;
  70. this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z);
  71. }
  72. }
  73. // public showDDZView(restart,is_show_restart_video){
  74. // this.m_restart_call = restart;
  75. // this.btn_extend.active = false;
  76. // this.lab_title.getComponent(Label).string = "失败!"
  77. // if(is_show_restart_video===1){
  78. // this.img_restart_video_icon.active = true;
  79. // this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z);
  80. // }else{
  81. // this.img_restart_video_icon.active = false;
  82. // this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z);
  83. // }
  84. // }
  85. }