UIbase.ts 455 B

123456789101112131415161718192021222324252627282930313233343536
  1. export default class UIbase extends cc.Component
  2. {
  3. public showUI(data?:any)
  4. {
  5. if(this.node.parent!=null)
  6. {
  7. this.node.parent=null;
  8. }
  9. let s = cc.director.getScene();
  10. s.addChild(this.node);
  11. this.onShow()
  12. }
  13. public hideUI()
  14. {
  15. this.onHide()
  16. this.node.removeFromParent(false);
  17. }
  18. protected onShow(){
  19. }
  20. protected onHide(){
  21. }
  22. }