private void GetGameItemAttr(string equips, ref Dictionary <AttrType, float> addDict, ref Dictionary <AttrType, float> mulDict) { SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(equips); if (dataById == null) { return; } if (addDict == null) { addDict = new Dictionary <AttrType, float>(); } if (mulDict == null) { mulDict = new Dictionary <AttrType, float>(); } string[] stringValue = StringUtils.GetStringValue(dataById.attribute, ','); for (int i = 0; i < stringValue.Length; i++) { string[] array = stringValue[i].Split(new char[] { '|' }); AttrType type = (AttrType)int.Parse(array[0]); if (!array[1].Contains("%")) { if (dataById.rune_type == 2) { HeroDataManager.AddToDict(ref addDict, type, float.Parse(array[1]) * (float)this.level); } else { HeroDataManager.AddToDict(ref addDict, type, float.Parse(array[1])); } } else { string text = array[1].Trim(); float num = float.Parse(text.Substring(0, text.Length - 1)) / 100f; if (dataById.rune_type == 2) { num *= (float)this.level; } HeroDataManager.AddToDict(ref mulDict, type, num); } } }
private void CollectEquipAttr(string equips, int magicStar, ref Dictionary <AttrType, float> addDict, ref Dictionary <AttrType, float> mulDict) { if (addDict == null || addDict.Keys.Count == 0) { addDict = new Dictionary <AttrType, float>(); } if (mulDict == null || mulDict.Keys.Count == 0) { mulDict = new Dictionary <AttrType, float>(); } string[] stringValue = StringUtils.GetStringValue(equips, ','); for (int i = 0; i < stringValue.Length; i++) { SysGameItemsVo dataById = BaseDataMgr.instance.GetDataById <SysGameItemsVo>(stringValue[i]); if (dataById == null) { Debug.LogError("HeroAttr.CollectEquipAttr , equips [" + equips + "] has null id: " + stringValue[i]); } else { string[] stringValue2 = StringUtils.GetStringValue(dataById.attribute, ','); for (int j = 0; j < stringValue2.Length; j++) { string[] array = stringValue2[j].Split(new char[] { '|' }); AttrType type = (AttrType)int.Parse(array[0]); if (!array[1].Contains("%")) { HeroDataManager.AddToDict(ref addDict, type, float.Parse(array[1])); } else { string text = array[1].Trim(); float value = float.Parse(text.Substring(0, text.Length - 1)) / 100f; HeroDataManager.AddToDict(ref mulDict, type, value); } } if (magicStar > 0) { string[] stringValue3 = StringUtils.GetStringValue(dataById.enchant_attribute, ','); for (int k = 0; k < stringValue3.Length; k++) { string[] array2 = stringValue3[k].Split(new char[] { '|' }); AttrType type2 = (AttrType)int.Parse(array2[0]); if (!array2[1].Contains("%")) { HeroDataManager.AddToDict(ref addDict, type2, float.Parse(array2[1]) * (float)magicStar); } else { string text2 = array2[1].Trim(); float num = float.Parse(text2.Substring(0, text2.Length - 1)) / 100f; HeroDataManager.AddToDict(ref mulDict, type2, num * (float)magicStar); } } } } } }