// 更新战友模型相关信息 void UpdateHelperModel() { Helper helper = User.Singleton.HelperList.LookupHelper(StageMenu.Singleton.m_curHelperGuid); if (null != helper) { AddHelperModel(helper.m_cardId); HeroInfo heroInfo = GameTable.HeroInfoTableAsset.Lookup(helper.m_cardId); if (null != heroInfo) { m_helperCardName.text = heroInfo.StrName; m_helperCardLevel.text = Localization.Get("CardLevel") + helper.m_cardLevel; RaceInfo raceInfo = GameTable.RaceInfoTableAsset.LookUp(heroInfo.Type); m_helperCardRace.text = raceInfo.m_name; OccupationInfo occInfo = GameTable.OccupationInfoAsset.LookUp(heroInfo.Occupation); m_helperCardOcc.text = occInfo.m_name; AttrRatioInfo rarityInfo = GameTable.attrRatioTableAsset.LookUp(heroInfo.Occupation, heroInfo.Rarity); // 计算生命值 int hp = (int)((heroInfo.FHPMax + rarityInfo.m_hPMaxAdd * (helper.m_cardLevel - 1)) * rarityInfo.m_hpMutiply); m_helperHP.text = hp.ToString(); // 计算物理攻击力 int attack = BattleFormula.GetPhyAttack(helper.m_cardId, 1); m_helperPhyAttack.text = attack.ToString(); // 魔法攻击力 attack = BattleFormula.GetMagAttack(helper.m_cardId, 1); m_helperMagAttack.text = attack.ToString(); } } }
public void Load(byte[] bytes) { m_map = new Dictionary <int, AttrRatioInfo>(); BinaryHelper helper = new BinaryHelper(bytes); int sceneCount = helper.ReadInt(); for (int index = 0; index < sceneCount; ++index) { AttrRatioInfo info = new AttrRatioInfo(); info.Load(helper); m_map.Add(info.m_id, info); } }
public AttrRatioInfo LookUp(int occ, int rarity) { foreach (KeyValuePair <int, AttrRatioInfo> item in m_map) { if (item.Value.m_occupation == occ && item.Value.m_rarity == rarity) { AttrRatioInfo info = null; if (m_map.TryGetValue(item.Key, out info)) { return(info); } } } return(null); }