import { _decorator, Component, Label, Node } from 'cc'; import { gameManager } from '../gameManager'; const { ccclass, property } = _decorator; @ccclass('Lack') export class Lack extends Component { @property(Node) btn_yes; @property(Node) btn_get_coin; private m_call_yes = null; private m_call_get_coin = null; public initView(call_yes,call_get_coin){ this.m_call_yes = call_yes; this.m_call_get_coin = call_get_coin; this.btn_yes.on(Node.EventType.TOUCH_START,()=>{ if(this.m_call_yes!=null){ this.m_call_yes() } gameManager.playBtnSound() this.close() },this); this.btn_get_coin.on(Node.EventType.TOUCH_START,()=>{ if(this.m_call_get_coin!=null){ this.m_call_get_coin(this) } gameManager.playBtnSound() },this); } close(){ this.node.removeFromParent() } }