Hall.ts 968 B

1234567891011121314151617181920212223242526272829303132333435
  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. import get_new_head_icon from '../core/util_class/HeadIcon';
  7. const { ccclass, property } = _decorator;
  8. @ccclass('Hall')
  9. export class Hall extends Component {
  10. private static instance: Hall;
  11. public player:PlayerData;
  12. public head_icon=get_new_head_icon();
  13. public static getInstance():Hall{
  14. return Hall.instance;
  15. }
  16. start() {
  17. if(!Hall.instance){
  18. Hall.instance=this;
  19. }
  20. gui.show(UI_Hall);
  21. director.addPersistRootNode(this.node);
  22. this.init();
  23. }
  24. async init(){
  25. this.player = PlayerData.getInstance(ch.sdk.get_gid(), ch.sdk.get_uid().toString());
  26. this.player.init_user_info();
  27. await this.player.load();
  28. }
  29. }