public static List <string> GetSubAttrDescEx(EquipAttrData attrData, params uint[] values) { List <string> ret = new List <string>(); EquipSubAttrData data = DBManager.GetInstance().GetDB <DBEquipSubAttr>().GetSubAttrData(attrData.SubAttrId); if (data != null) { List <string> des_value = new List <string>(); for (int i = 0; i < data.DesType.Count; i++) { if (i < values.Length) { switch (data.DesType[i]) { case 0: // 整行 { string val = values[i].ToString(); des_value.Add(val); } break; case 1: // 浮点 { string val = (values[i] / ActorHelper.UnitConvert).ToString("0.00"); val = ActorUtils.Instance.TrimFloatStr(val); des_value.Add(val); } break; case 2: // 百分比 { string val_noSign = (values[i] / ActorHelper.DisplayPercentUnitConvert).ToString("0.00"); val_noSign = ActorUtils.Instance.TrimFloatStr(val_noSign); string val = val_noSign + "%"; des_value.Add(val); } break; } } } string data_des = data.Des; int startIdx = data_des.IndexOf("{", 0); string name = data_des.Substring(0, startIdx); string valueFormat = data_des.Substring(startIdx); string valueStr = ""; if (des_value.Count > 0) { valueStr = string.Format(valueFormat, des_value.ToArray()); } ret.Add(name); ret.Add(valueStr); } return(ret); }
/// <summary> /// 返回饰品星级 /// <returns></returns> public static uint GetDecorateStar(GoodsDecorate decorate) { uint ret = 0; if (decorate == null || decorate.LegendAttrs == null) { return(0); } if (decorate.ServerStar != 0xffffff) { return(decorate.ServerStar); } bool has_attrs = false; foreach (var kv in decorate.LegendAttrs) { var attrData = EquipHelper.GetEquipAttrData(kv.Id); if (attrData != null) { EquipSubAttrData data = null; if (DBManager.GetInstance().GetDB <DBEquipSubAttr>().EquipSubAttrDescs.TryGetValue(attrData.SubAttrId, out data)) { has_attrs = true; List <string> des_value = new List <string>(); for (int i = 0; i < data.DesType.Count; i++) { if (attrData.ColorType.Count > 4) { var valuerange = attrData.ColorType[3]; if (kv.Values[i] >= valuerange.Min) { ret++;//对应就是0~4品质 } } } } } } if (has_attrs == false) { if (decorate.DbData != null) { ret = decorate.DbData.DefaultStar; } } return(ret); }