Lack.ts 969 B

12345678910111213141516171819202122232425262728293031323334
  1. import { _decorator, Component, Label, Node } from 'cc';
  2. import { gameManager } from '../gameManager';
  3. const { ccclass, property } = _decorator;
  4. @ccclass('Lack')
  5. export class Lack extends Component {
  6. @property(Node) btn_yes;
  7. @property(Node) btn_get_coin;
  8. private m_call_yes = null;
  9. private m_call_get_coin = null;
  10. public initView(call_yes,call_get_coin){
  11. this.m_call_yes = call_yes;
  12. this.m_call_get_coin = call_get_coin;
  13. this.btn_yes.on(Node.EventType.TOUCH_START,()=>{
  14. if(this.m_call_yes!=null){
  15. this.m_call_yes()
  16. }
  17. gameManager.playBtnSound()
  18. this.close()
  19. },this);
  20. this.btn_get_coin.on(Node.EventType.TOUCH_START,()=>{
  21. if(this.m_call_get_coin!=null){
  22. this.m_call_get_coin(this)
  23. }
  24. gameManager.playBtnSound()
  25. },this);
  26. }
  27. close(){
  28. this.node.removeFromParent()
  29. }
  30. }