fail.ts 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { _decorator, Component, Label, Node, Vec3 } from 'cc';
  2. const { ccclass, property } = _decorator;
  3. @ccclass('fail')
  4. export class fail extends Component {
  5. @property(Node) btn_back:Node;
  6. @property(Node) btn_extend:Node;
  7. @property(Node) btn_restart:Node;
  8. @property(Node) lab_restart:Node;
  9. @property(Node) img_restart_video_icon:Node;
  10. @property(Node) lab_extend_time:Node;
  11. @property(Node) lab_title:Node;
  12. private m_extend_call:any = null;
  13. private m_restart_call:any = null;
  14. start() {
  15. let self = this;
  16. this.btn_back.on(Node.EventType.TOUCH_START,()=>{
  17. self.close();
  18. },this);
  19. this.btn_extend.on(Node.EventType.TOUCH_START,()=>{
  20. if(this.m_extend_call!=null){
  21. this.m_extend_call(this)
  22. }
  23. },this);
  24. this.btn_restart.on(Node.EventType.TOUCH_START,()=>{
  25. if(this.m_restart_call!=null){
  26. this.m_restart_call(this)
  27. }
  28. },this);
  29. }
  30. public close(){
  31. this.node.removeFromParent();
  32. }
  33. //双图找不同
  34. public showView(extend_time,extend_call,restart,is_show_restart_video){
  35. this.m_extend_call = extend_call;
  36. this.m_restart_call = restart;
  37. this.lab_extend_time.getComponent(Label).string = `延长${extend_time}秒`;
  38. if(is_show_restart_video===1){
  39. this.img_restart_video_icon.active = true;
  40. this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z);
  41. }else{
  42. this.img_restart_video_icon.active = false;
  43. this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z);
  44. }
  45. }
  46. public showDDZView(restart,is_show_restart_video){
  47. this.m_restart_call = restart;
  48. this.btn_extend.active = false;
  49. this.lab_title.getComponent(Label).string = "失败!"
  50. if(is_show_restart_video===1){
  51. this.img_restart_video_icon.active = true;
  52. this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z);
  53. }else{
  54. this.img_restart_video_icon.active = false;
  55. this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z);
  56. }
  57. }
  58. }