예제 #1
0
 /// <summary>
 /// Конструктор для добавления в файл персонажа характеристики на основе характеристики
 /// </summary>
 /// <param name="prs"></param>
 /// <param name="cha"></param>
 public Characteristic(Pers prs, Characteristic cha) : this(prs)
 {
     SetChaFromCha(cha);
 }
        /// <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)
        {
            Characteristic cha = value as Characteristic;

            if (cha == null)
            {
                return(null);
            }

            double valueCharact = System.Convert.ToDouble(cha.ValueProperty);
            int    level        = 0;
            string color        = "White";

            string s = parameter.ToString();

            if (s == "Критично")
            {
                if (level == 0)
                {
                    color = "Red";
                }
            }

            if (s == "ОчПлохо")
            {
                if (level >= 1 && level < 3)
                {
                    color = "Orange";
                }
            }

            if (s == "НижеСреднего")
            {
                if (level >= 3 && level < 5)
                {
                    color = "LimeGreen";
                }
            }

            if (s == "Норм")
            {
                if (level >= 5 && level < 7)
                {
                    color = "Lime";
                }
            }

            if (s == "Хорошо")
            {
                if (level >= 7 && level < 10)
                {
                    color = "Gold";
                }
            }

            if (s == "Супер")
            {
                if (level >= 10)
                {
                    color = "Yellow";
                }
            }

            return(color);
        }
예제 #3
0
 public Characteristic(Characteristic cha)
 {
     SetChaFromCha(cha);
 }
예제 #4
0
        /// <summary>
        /// Получить значение характеристики, которое есть
        /// </summary>
        /// <param name="per">
        /// Персонаж
        /// </param>
        /// <param name="charact">
        /// The charact.
        /// </param>
        /// <returns>
        /// значение
        /// </returns>
        private double GetIsValue(Pers per, Characteristic charact)
        {
            var chaPers = per.Characteristics.First(n => n == charact);

            return(chaPers.ValueProperty);
        }