public void UpdateData(WeaponLVData lvData) { weaponLVData = lvData; weaponData.Init(weaponLVData.LV); updateDesc(); }
/// <summary> /// 将索引映射成实体类 /// </summary> public void MakeJsonToModel() { Books.Clear(); //防止没有秘籍,设置一本默认秘籍 if (ResourceBookDataIds.Count == 0) { ResourceBookDataIds.Add("10000"); } DrugResistance = 0; DisarmResistance = 0; VertigoResistance = 0; CanNotMoveResistance = 0; SlowResistance = 0; ChaosResistance = 0; BookData book; for (int i = 0; i < ResourceBookDataIds.Count; i++) { book = JsonManager.GetInstance().GetMapping <BookData>("Books", ResourceBookDataIds[i]); book.MakeJsonToModel(); DrugResistance += book.DrugResistance; DisarmResistance += book.DisarmResistance; VertigoResistance += book.VertigoResistance; CanNotMoveResistance += book.CanNotMoveResistance; SlowResistance += book.SlowResistance; ChaosResistance += book.ChaosResistance; Books.Add(book); } //将秘籍放在前面 // Books.Sort((a, b) => { return a.IsMindBook && !b.IsMindBook ? 1 : 0; }); if (ResourceWeaponDataId != "") { Weapon = JsonManager.GetInstance().GetMapping <WeaponData>("Weapons", ResourceWeaponDataId); Weapon.Init(CurrentWeaponLV); } else { Weapon = null; } //处理伤势对全属性的影响 switch (Injury) { case InjuryType.None: default: injuryRate = 1; break; case InjuryType.White: injuryRate = 0.9f; break; case InjuryType.Yellow: injuryRate = 0.8f; break; case InjuryType.Purple: injuryRate = 0.6f; break; case InjuryType.Red: injuryRate = 0.2f; break; case InjuryType.Moribund: injuryRate = 0.1f; break; } //饥饿判定 全能力下降20% if (IsHungry) { injuryRate = Mathf.Clamp(injuryRate - 0.2f, 0.1f, 1); } InitAttribute(); }