示例#1
0
        public static UserRole CreateRole(int userId, int roleId, string name, int sex, int prof)
        {
            RoleBornConfig bornConfig = GetRoleBornCfg(sex, prof);

            if (bornConfig == null)
            {
                return(null);
            }

            UserRole role = new UserRole();

            role.RoleId      = roleId;
            role.UserId      = userId;
            role.Name        = name;
            role.Sex         = sex;
            role.Prof        = prof;
            role.Level       = bornConfig.bornLevel;
            role.Exp         = 0;
            role.Hp          = 100;
            role.FightPower  = 1;
            role.Gold        = bornConfig.gold;
            role.BindGold    = bornConfig.bindGold;
            role.Diamond     = bornConfig.diamond;
            role.BindDiamond = bornConfig.bindDiamond;
            role.Race        = bornConfig.race;

            role.EnterSceneId = bornConfig.mapID;
            role.EnterMapId   = bornConfig.mapID;

            role.EnterPosX = bornConfig.mapX / 1000.0f;
            role.EnterPosY = bornConfig.mapY / 1000.0f;
            role.EnterPosZ = bornConfig.mapZ / 1000.0f;

            role.LastSceneId = bornConfig.mapID;
            role.LastMapId   = bornConfig.mapID;

            role.LastPosX = bornConfig.mapX / 1000.0f;
            role.LastPosY = bornConfig.mapY / 1000.0f;
            role.LastPosZ = bornConfig.mapZ / 1000.0f;

            RoleExpConfig expConfig = GetRoleExpCfg(bornConfig.bornLevel);

            if (expConfig == null)
            {
                return(null);
            }

            role.Stamina = expConfig.stamina;

            return(role);
        }
示例#2
0
    public void Load()
    {
        CVSReader reader = new CVSReader();

        reader.LoadText("Data/Config/Role_exp.txt", 1);
        int rows = reader.GetRowCount();

        for (int r = 0; r < rows; ++r)
        {
            string[]      row = reader.GetRow(r);
            RoleExpConfig ac  = ConfigProcess(row) as RoleExpConfig;
            configs.Add(ac.lv, ac);
        }
    }
示例#3
0
    public object ConfigProcess(string[] row)
    {
        if (row.Length < 3)
        {
            return(null);
        }
        RowHelper     rh  = new RowHelper(row);
        RoleExpConfig rec = new RoleExpConfig();

        rec.lv = Utility.ToInt(rh.Read());               //等级

        rec.exp = Utility.ToInt(rh.Read());              //当前等级升级需要经验

        rec.stamina = Utility.ToInt(rh.Read());          //体力上限


        return(rec);
    }