import { _decorator, Component, director, Node } from 'cc'; import { ch } from '../../ch/ch'; import { gui } from '../../core/ui/ui'; import get_new_head_icon from '../../core/util_class/HeadIcon'; import PlayerData from '../game/PlayerData'; import { UI_Hall } from '../ui/UI_Hall/UI_Hall'; import TableLoadUtil from '../../core/util/TableLoadUtil'; import { TableUtil } from '../../module_extra/table_ts/TableUtil'; import { ModuleDef } from '../../Scripts/ModuleDef'; const { ccclass, property } = _decorator; @ccclass('Hall') export class Hall extends Component { private static instance: Hall; public player:PlayerData; public head_icon=get_new_head_icon(); public static getInstance():Hall{ return Hall.instance; } start() { if(!Hall.instance){ Hall.instance=this; } gui.show(UI_Hall); director.addPersistRootNode(this.node); this.init(); this.loadTable(); } async init(){ this.player = PlayerData.getInstance(ch.sdk.get_gid(), ch.sdk.get_uid().toString()); this.player.init_user_info(); await this.player.load(); } private loadTable(): void { // ch.log.log_start("加载配置初始化"); TableLoadUtil.preloadAll(ModuleDef.EXTRA, "table_json", async () => { // this.onPreloadingComplete(); console.log("加载配置初始化完成"); }, TableUtil.set); } }