/// <summary> /// The convert. /// </summary> /// <param name="value"> /// The value. /// </param> /// <param name="targetType"> /// The target type. /// </param> /// <param name="parameter"> /// The parameter. /// </param> /// <param name="culture"> /// The culture. /// </param> /// <returns> /// The <see cref="object"/>. /// </returns> public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value == DependencyProperty.UnsetValue) { return(string.Empty); } else { var charact = (Characteristic)value; if (charact == null) { return(string.Empty); } string text = string.Empty; var val = charact.ValueProperty; int level = charact.LevelProperty; var rang = charact.Rangs.OrderBy(n => n.LevelRang).FirstOrDefault(n => n.LevelRang >= level); text += " Название: " + charact.NameOfProperty; text += "\n Уровень: " + level.ToString(); text += "\n Значение: " + val.ToString() + "/" + Pers.ExpToLevel(level + 1, RpgItemsTypes.characteristic).ToString(); text += "\n Ранг: " + rang.NameOfRang; text += "\n Описание ранга: " + rang.DeskriptionRangProperty; text += "\n Описание характеристики: " + charact.DescriptionProperty; return(text); } }
private double getMaxForExp(double val, viewChangesModel vc) { var lev = StaticMetods.GetLevel(val, RpgItemsTypes.exp); var expToLevel = Pers.ExpToLevel(lev + 1, RpgItemsTypes.exp); //if (vc.to < vc.from && val == Pers.ExpToLevel(lev, RpgItemsTypes.exp)) //{ // var level = lev - 1; // if (level < 1) level = 1; // expToLevel = Pers.ExpToLevel(level, RpgItemsTypes.exp); //} return(System.Convert.ToInt32(expToLevel)); }
/// <summary> /// Получить значение изменений прогресса /// </summary> /// <returns></returns> public double GetValChenge() { double minVal = Pers.ExpToLevel(FirstLevelProperty, RpgItemsTypes.characteristic); return(MaxVal - minVal); }