import { _decorator, Component, Node, director,sys } from 'cc';
import { LoadConfig } from './loadConfig';

import { setting }  from "./config/setting"
import { uiManager }  from "./uiManager"

const { ccclass, property } = _decorator;

@ccclass('Login')
export class Login extends Component {

    

    onLoad(){
        //LoadConfig.instance.dataRemove('user');
        
        setting.Data['game']= LoadConfig.dataRead('user');

    }

    start () {
        
    }

    StartGame(){
        
        if(setting.Data['game']==''){
            setting.Data['game']={};
            uiManager.instance.showDialog("prefab/ui/creatoruser")
        }else{
            director.loadScene('scene2');
            console.log('加载场景2');
        }
        //this.node.active=false;
        
    }

    Remove(){
        LoadConfig.dataRemove('user');
        console.log('用户数据移除');
        setting.Data['game']= LoadConfig.dataRead('user');
    }

    // update (deltaTime: number) {
    //     // [4]
    // }
}

