import { _decorator, Component, Label, Node, Sprite, SpriteFrame, Vec3 } from 'cc'; import { config } from '../config'; const { ccclass, property } = _decorator; @ccclass('fail') export class fail extends Component { @property(Node) bg:Node; @property(Node) img_text:Node; @property(Node) btn_extend:Node; @property(Node) btn_restart:Node; @property(Node) lab_restart:Node; @property(Node) img_restart_video_icon:Node; @property(Node) lab_extend_time:Node; @property(Node) btn_quit:Node; @property(SpriteFrame) sf_huidaocuowu:SpriteFrame; @property(SpriteFrame) sf_chuangguanshibai:SpriteFrame; private m_extend_call:any = null; private m_restart_call:any = null; private m_quit_call:any = null; start() { let self = this; this.btn_extend.on(Node.EventType.TOUCH_START,()=>{ if(this.m_extend_call!=null){ this.m_extend_call(this) } },this); this.btn_restart.on(Node.EventType.TOUCH_START,()=>{ if(this.m_restart_call!=null){ this.m_restart_call(this) } },this); this.btn_quit.on(Node.EventType.TOUCH_START,()=>{ if(this.m_quit_call!=null){ this.m_quit_call(this) } },this); } public close(){ this.node.removeFromParent(); } //双图找不同 public showView(extend_time,extend_call,restart,is_show_restart_video){ this.m_extend_call = extend_call; this.m_restart_call = restart; this.lab_extend_time.getComponent(Label).string = `延长${extend_time}秒`; if(is_show_restart_video===1){ this.img_restart_video_icon.active = true; this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z); }else{ this.img_restart_video_icon.active = false; this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z); } } public showJYLView(restart,is_show_restart_video,quit,categoryid){ this.m_restart_call = restart; this.m_quit_call = quit; this.btn_extend.active = false; this.btn_quit.active = true; if(categoryid===config.PLAY_TYPE.JI_YI_LI){ this.img_text.getComponent(Sprite).spriteFrame = this.sf_huidaocuowu; }else{ this.img_text.getComponent(Sprite).spriteFrame = this.sf_chuangguanshibai; this.bg.angle = -90; this.bg.position = new Vec3(this.bg.position.x+40,this.bg.position.y,this.bg.position.z) } if(is_show_restart_video===1){ this.img_restart_video_icon.active = true; this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z); }else{ this.img_restart_video_icon.active = false; this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z); } } // public showDDZView(restart,is_show_restart_video){ // this.m_restart_call = restart; // this.btn_extend.active = false; // this.lab_title.getComponent(Label).string = "失败!" // if(is_show_restart_video===1){ // this.img_restart_video_icon.active = true; // this.lab_restart.position = new Vec3(-64,0,this.lab_restart.position.z); // }else{ // this.img_restart_video_icon.active = false; // this.lab_restart.position = new Vec3(-94,0,this.lab_restart.position.z); // } // } }