Exemplo n.º 1
0
        public static IHtmlContent FormatSkills(this ISkillable entity,
                                                string prefix, string postfix, string separator,
                                                Func <SkillDto, string> formatter)
        {
            var skills = entity?.Skills
                         ?.OrderByDescending(o => o.Position)
                         .ThenByDescending(o => o.Level)
                         .ToArray();

            if (skills == null || skills.Length == 0)
            {
                return(null);
            }

            if (formatter == null)
            {
                formatter = FormatSkill;
            }
            var result = new StringBuilder();

            foreach (var skill in skills)
            {
                if (skill == null)
                {
                    continue;
                }
                if (result.Length > 0)
                {
                    result.AppendNonEmpty(separator);
                }
                result.AppendNonEmpty(formatter(skill));
            }
            return(new HtmlString($"{prefix}{result}{postfix}"));
        }
Exemplo n.º 2
0
 public static IHtmlContent FormatSkills(this ISkillable entity)
 => entity.FormatSkills("(", ")", ", ", FormatSkill);
Exemplo n.º 3
0
 public override void OnStart(AIAgent agent)
 {
     base.OnStart(agent);
     _self = agent.SceneObject as ISkillable;
 }