public ActorData(uint id) { cfgId = id; cfgVo = ActorCFG.items[id.ToString()]; uniqueId = (uint)Random.Range(1, 1000000); currHp = cfgVo.MaxHp; string[] s = cfgVo.Skills.Split(','); for (int i = 0; i < s.Length; i++) { if (s[i] == "") { continue; } skills.Add(new SkillData(SkillLevelCFG.items[s[i].Replace("_", "")])); } }
override public void Read(string str) { List <object> jsons = Json.Deserialize(str) as List <object>; for (int i = 0; i < jsons.Count; i++) { Dictionary <string, object> data = jsons[i] as Dictionary <string, object>; ActorVo vo = new ActorVo(); vo.Id = uint.Parse((string)data["Id"]); vo.Type = uint.Parse((string)data["Type"]); vo.ResName = (string)data["ResName"]; vo.Skills = (string)data["Skills"]; vo.MaxHp = uint.Parse((string)data["MaxHp"]); vo.Attack = uint.Parse((string)data["Attack"]); vo.Defence = uint.Parse((string)data["Defence"]); vo.MoveSpeed = float.Parse((string)data["MoveSpeed"]); vo.AttackInterval = float.Parse((string)data["AttackInterval"]); vo.AttackDistance = float.Parse((string)data["AttackDistance"]); vo.FindRange = float.Parse((string)data["FindRange"]); vo.PatrolRange = float.Parse((string)data["PatrolRange"]); items.Add(vo.Id.ToString(), vo); } }