12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import { _decorator, Component, director, Node, profiler } 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;
- }
- async start() {
- if (!Hall.instance) {
- Hall.instance = this;
- }
- this.init();
- gui.show(UI_Hall);
- director.addPersistRootNode(this.node);
- // if(chsdk.checkFromSidebar())
- // {
- // Hall.getInstance().player.add_item(2,2);
- // }
- }
- async init() {
- this.loadTable();
- this.player = PlayerData.getInstance(ch.sdk.get_gid(), ch.sdk.get_uid().toString());
- this.player.init_user_info();
- await this.player.load();
- this.player.set_login_num(1);
- console.log("登录次数:" + this.player.get_login_num());
- }
- private loadTable(): void {
- ch.log.log_start("加载配置初始化");
- TableLoadUtil.preloadAll(ModuleDef.EXTRA, "table_json", async () => {
- }, TableUtil.set);
- }
- }
|