public static Color GetColor(this Profession profession)
 {
     if (profession.GetType() == typeof(Professions.Unknown))
     {
         return(Colors.White);
     }
     return(_professionColors[profession.Name ?? Profession.Unknown.Name]);
 }
 public static string GetIconPath(this Profession profession)
 {
     if (profession.GetType() == typeof(Professions.Unknown))
     {
         return($"/Icons/Unknown.png");
     }
     return(profession == null ? $"/Icons/NPC.png" : $"/Icons/{profession}.png");
 }
示例#3
0
    public static string GetDescription(Profession val)
    {
        FieldInfo fi = val.GetType().GetField(val.ToString());

        if (fi != null)
        {
            object[] profs = fi.GetCustomAttributes(typeof(DescriptionAttribute), true);
            if (profs != null && profs.Length > 0)
            {
                return(((DescriptionAttribute)profs[0]).Description);
            }
        }

        return(val.ToString());
    }
 public ProfessionData GetProfessionData(Profession profession)
 {
     return(professionDatas[profession.GetType()]);
 }