Hall.ts 818 B

1234567891011121314151617181920212223242526272829303132
  1. import { _decorator, Component, director, Node } from 'cc';
  2. import { UI_Hall } from '../module_game/ui/UI_Hall/UI_Hall';
  3. import { gui } from '../core/ui/ui';
  4. import PlayerData from '../module_game/game/PlayerData';
  5. import { ch } from '../ch/ch';
  6. const { ccclass, property } = _decorator;
  7. @ccclass('Hall')
  8. export class Hall extends Component {
  9. private static instance: Hall;
  10. player:PlayerData;
  11. public static getInstance():Hall{
  12. return Hall.instance;
  13. }
  14. start() {
  15. if(!Hall.instance){
  16. Hall.instance=this;
  17. }
  18. gui.show(UI_Hall);
  19. director.addPersistRootNode(this.node);
  20. this.init();
  21. }
  22. init(){
  23. this.player = PlayerData.getInstance(ch.sdk.get_gid(), ch.sdk.get_uid().toString());
  24. this.player.init_user_info();
  25. }
  26. }