fail.ts 3.5 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. @property(SpriteFrame) sf_chuangguanshibai:SpriteFrame;
  16. private m_extend_call:any = null;
  17. private m_restart_call:any = null;
  18. private m_quit_call:any = null;
  19. start() {
  20. let self = this;
  21. this.btn_extend.on(Node.EventType.TOUCH_START,()=>{
  22. if(this.m_extend_call!=null){
  23. this.m_extend_call(this)
  24. }
  25. },this);
  26. this.btn_restart.on(Node.EventType.TOUCH_START,()=>{
  27. if(this.m_restart_call!=null){
  28. this.m_restart_call(this)
  29. }
  30. },this);
  31. this.btn_quit.on(Node.EventType.TOUCH_START,()=>{
  32. if(this.m_quit_call!=null){
  33. this.m_quit_call(this)
  34. }
  35. },this);
  36. }
  37. public close(){
  38. this.node.removeFromParent();
  39. }
  40. //双图找不同
  41. public showView(extend_time,extend_call,restart,is_show_restart_video){
  42. this.m_extend_call = extend_call;
  43. this.m_restart_call = restart;
  44. this.lab_extend_time.getComponent(Label).string = `延长${extend_time}秒`;
  45. if(is_show_restart_video===1){
  46. this.img_restart_video_icon.active = true;
  47. this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z);
  48. }else{
  49. this.img_restart_video_icon.active = false;
  50. this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z);
  51. }
  52. }
  53. public showJYLView(restart,is_show_restart_video,quit,categoryid){
  54. this.m_restart_call = restart;
  55. this.m_quit_call = quit;
  56. this.btn_extend.active = false;
  57. this.btn_quit.active = true;
  58. if(categoryid===config.PLAY_TYPE.JI_YI_LI){
  59. this.img_text.getComponent(Sprite).spriteFrame = this.sf_huidaocuowu;
  60. }else{
  61. this.img_text.getComponent(Sprite).spriteFrame = this.sf_chuangguanshibai;
  62. this.bg.angle = -90;
  63. this.bg.position = new Vec3(this.bg.position.x+40,this.bg.position.y,this.bg.position.z)
  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. }