Beispiel #1
0
    public static SimpleInlineElement AppendContent(this IInlineContainer container, string text,
                                                    IStyleDefinition?localStyle = null)
    {
        var element = new SimpleInlineElement()
        {
            Text = text
        };

        localStyle?.MergeInto(element.LocalStyles);
        container.AppendContent(element);
        return(element);
    }
    private static InlineElement GetHitPointsText(GameObject obj)
    {
        var currentHp = obj.GetStat(Stat.hp_current);
        var maxHp     = obj.GetStat(Stat.hp_max);

        var result = new SimpleInlineElement($"{currentHp}/{maxHp}");

        if (currentHp < maxHp)
        {
            // Display the current hp in red
            result.AddStyle("char-ui-stat-value-hp-damaged");
        }

        return(result);
    }
    private static InlineElement GetAbilityScoreValue(GameObject obj, Stat stat)
    {
        var baseScore = obj.GetBaseStat(stat);
        var score     = obj.GetStat(stat);
        var result    = new SimpleInlineElement(score.ToString());

        // Select a color code indicating if there's a malus or bonus being applied
        if (score > baseScore)
        {
            result.AddStyle("char-ui-stat-value-bonus");
        }
        else if (score < baseScore)
        {
            result.AddStyle("char-ui-stat-value-malus");
        }

        return(result);
    }
 public Element(int start, int length, SimpleInlineElement source)
 {
     Start  = start;
     Length = length;
     Source = source;
 }