fail.ts 3.6 KB

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