import { CfgManager } from "./CfgManager";
import AssetPath, { AppSetting } from "./AssetManager";
import UserModel, { UserAttr } from "../game_module/UserModel";
import { PlayerManager } from "./PlayerManager";
import { GlobalVariable } from "../game_module/GlobalVariable";


export class UserInfoManager {
    
    //初始化游戏参数
    public static GameInfo() {
        // PlayerManager.Instance.Coin = (Number(UserModel.Instance.CurModel.GetUserAttr(UserAttr.vmoney)));
        // PlayerManager.Instance.stage = (Number(UserModel.Instance.CurModel.GetUserAttr(UserAttr.stage)) + 1);
        // PlayerManager.Instance.Diamond = (Number(UserModel.Instance.CurModel.GetUserAttr(UserAttr.diamond)));
        // PlayerManager.Instance.SEarnPerSec();
        // PlayerManager.Instance.Unlock_kun = (Number(UserModel.Instance.CurModel.GetUserAttr(UserAttr.unlock_kun)));
        // PlayerManager.Instance.equip_kun = (Number(UserModel.Instance.CurModel.GetUserAttr(UserAttr.equip_kun)));
        PlayerManager.Instance.SetPlayer();
    }

    //获取配置信息
    public static SetCfg(cfg) {
        CfgManager.Instance._level = cfg[AssetPath.tableName.level];
        CfgManager.Instance._road = cfg[AssetPath.tableName.road];
        CfgManager.Instance._block = cfg[AssetPath.tableName.block];
        CfgManager.Instance._thing = cfg[AssetPath.tableName.thing];
        CfgManager.Instance._atk = cfg[AssetPath.tableName.atk];
        CfgManager.Instance._rate = cfg[AssetPath.tableName.rate];
       // CfgManager.Instance._rate = cfg[AssetPath.tableName.rate];
        CfgManager.Instance._theme = cfg[AssetPath.tableName.theme];
        CfgManager.Instance._globe=cfg[AssetPath.tableName.global];
        
        PlayerManager.SetGlobe();

    }

    //设置后台数据
    public static Appseting(data) {


        AppSetting.shareimage = data["shareimage"];
        AppSetting.sharetitle = data["sharetitle"];
        AppSetting.bannerCanMove = Number(data["bannerCanMove"]);
        AppSetting.moveTime = Number(data["moveTime"]);
        AppSetting.OpenSceneValue = Number(data["OpenSceneValue"]);
        AppSetting.freeUpdateVideotime = Number(data["freeUpdateVideotime"]);
        AppSetting.freecoinValue = Number(data["freecoinValue"]);
        AppSetting.freeGetcoinTime = Number(data["freeGetcoinTime"]);


        GlobalVariable.playerspeed = Number(data["playerspeed"]);
        GlobalVariable.friendspeed = Number(data["friendspeed"]);
        GlobalVariable.bulletspeed = Number(data["bulletspeed"]);
        GlobalVariable.sliderFactor = Number(data["sliderFactor"]);
        GlobalVariable.playerMoveMaxX = Number(data["playerMoveMaxX"]);
        GlobalVariable.playerRayLengthF = Number(data["playerRayLengthF"]);
        GlobalVariable.playerRayLengthLR = Number(data["playerRayLengthLR"]);
        GlobalVariable.bulletRayLength = Number(data["bulletRayLength"]);
        GlobalVariable.bulletMaxDis = Number(data["bulletMaxDis"]);
        GlobalVariable.barrierRoadLength = Number(data["barrierRoadLength"]);
        GlobalVariable.barrierRoadAverageNum = Number(data["barrierRoadAverageNum"]);
        GlobalVariable.hitmaxcount = Number(data["hitmaxcount"]);
        GlobalVariable.boommaxcount = Number(data["boommaxcount"]);
        GlobalVariable.blockLRmoveMaxDis = Number(data["blockLRmoveMaxDis"]);
        GlobalVariable.arriveStandWidth = Number(data["arriveStandWidth"]);
        GlobalVariable.enemySpeed = Number(data["enemySpeed"]);
    }



}