Example #1
0
        private static string GetDescription(this NPCBelief value)
        {
            var fieldInfo  = value.GetType().GetField(value.ToString());
            var attributes = (DescriptionAttribute[])fieldInfo.GetCustomAttributes(typeof(DescriptionAttribute), false);

            return(attributes.Any() ? attributes.First().Description : value.ToString());
        }
Example #2
0
 /// <summary>
 /// Get the description attribute of an enum.
 /// </summary>
 internal static string Description(this NPCBelief belief)
 {
     return(BeliefDescriptionCache[belief]);
 }
Example #3
0
 /// <summary>
 /// Update the stored information to match what is passed here or add if it doesn't already exist
 /// </summary>
 internal void UpdateSingleBelief(NPCBelief name, object value = null, params object[] param)
 {
     UpdateSingleBelief(string.Format(name.Description(), param), value);
 }
Example #4
0
 /// <summary>
 /// Loaded stored information
 /// </summary>
 internal string LoadBelief(NPCBelief belief, params object[] param)
 {
     return(LoadBelief(string.Format(belief.Description(), param)));
 }