win.ts 1.6 KB

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