win.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import { _decorator, Component, Node, Sprite } from 'cc';
  2. import { tools } from '../../tools';
  3. import { gameManager } from '../gameManager';
  4. const { ccclass, property } = _decorator;
  5. @ccclass('win')
  6. export class win extends Component {
  7. @property(Node) btn_close:Node = null;
  8. @property(Node) btn_share:Node = null;
  9. @property(Node) btn_next:Node = null;
  10. @property(Node) icon:Node = null;
  11. private m_call_share = null;
  12. private m_call_next = null;
  13. public show(call_share,call_next){
  14. this.node.active = true;
  15. this.m_call_next = call_next;
  16. this.m_call_share = call_share;
  17. this.btn_share.off(Node.EventType.TOUCH_END)
  18. this.btn_next.off(Node.EventType.TOUCH_END)
  19. this.btn_close.off(Node.EventType.TOUCH_END)
  20. this.btn_share.on(Node.EventType.TOUCH_END,()=>{
  21. if(this.m_call_share!=null){
  22. this.m_call_share()
  23. }
  24. })
  25. this.btn_next.on(Node.EventType.TOUCH_END,()=>{
  26. if(this.m_call_next!=null){
  27. this.m_call_next()
  28. }
  29. })
  30. this.btn_close.on(Node.EventType.TOUCH_END,()=>{
  31. this.node.active = false;
  32. gameManager.Singleton.backGameList()
  33. })
  34. if(gameManager.Singleton.getLevelData()!=null){
  35. tools.loadUrl(gameManager.Singleton.getLevelData().complete_img,this.icon.getComponent(Sprite))
  36. }
  37. gameManager.Singleton.sys_success_complete_music()
  38. }
  39. }