Exemple #1
0
    protected void Add(string text, int size, bool bold, string color, GuiRendererControl control)
    {
        RichTextFormatter textFormatter = RichTextFormatter.For(text);

        if (color.Length > 0)
        {
            textFormatter.SetColor(color);
        }
        if (bold)
        {
            textFormatter.SetBold();
        }
        textFormatter.SetSize(Pixels.GetDensityIndependentPixels(size));
        text = textFormatter.Format();

        GuiPosition            position            = lastGuiElement == null ? firstPosition : defaultPosition;
        GuiTextRendererBuilder textRendererBuilder = new GuiTextRendererBuilder().WithRichText(text).InPosition(position, lastGuiElement);

        if (control != null)
        {
            textRendererBuilder.WithControl(control);
        }

        lastGuiElement = textRendererBuilder.Get();
        manager.AddElement(new GuiStaticElement(lastGuiElement));
    }
    public override string GetText()
    {
        RichTextFormatter formatter = RichTextFormatter.For(data.PlayerName + ": " + data.Points + " puntos")
                                      .SetColor(TEXT_COLOR)
                                      .SetSize(TEXT_SIZE);

        addPointsStatusFormat(formatter);

        return(formatter.Format());
    }
Exemple #3
0
    public static GuiManagerElement GetEndElement(GamePoints maxPoints, GuiRendererControl backToMenuControl, GuiRendererControl showRankingControl)
    {
        GuiTextRenderer mapEndedRenderer = new GuiTextRendererBuilder()
                                           .WithRichText(RichTextFormatter.For("Mapa finalizado")
                                                         .SetBold()
                                                         .SetColor("lime")
                                                         .SetSize(Pixels.GetDensityIndependentPixels(40))
                                                         .Format())
                                           .InPosition(GuiPosition.UP_CENTER)
                                           .Get();

        GuiTextRenderer freeSpaceBetweenButtonsRenderer = new GuiTextRendererBuilder()
                                                          .WithRichText(RichTextFormatter.For("\xa0")
                                                                        .SetSize(Pixels.GetDensityIndependentPixels(25))
                                                                        .Format())
                                                          .InPosition(GuiPosition.DOWN_CENTER)
                                                          .Get();

        GuiTextRenderer showRankingRenderer = new GuiTextRendererBuilder()
                                              .WithRichText(RichTextFormatter.For("Ver clasificaci\xf3n")
                                                            .SetBold()
                                                            .SetColor("red")
                                                            .SetSize(Pixels.GetDensityIndependentPixels(25))
                                                            .Format())
                                              .InPosition(GuiPosition.BEFORE, freeSpaceBetweenButtonsRenderer)
                                              .WithControl(showRankingControl)
                                              .Get();

        GuiTextRenderer backToMenuRenderer = new GuiTextRendererBuilder()
                                             .WithRichText(RichTextFormatter.For("Volver al men\xfa")
                                                           .SetBold()
                                                           .SetColor("cyan")
                                                           .SetSize(Pixels.GetDensityIndependentPixels(25))
                                                           .Format())
                                             .InPosition(GuiPosition.NEXT, freeSpaceBetweenButtonsRenderer)
                                             .WithControl(backToMenuControl)
                                             .Get();

        GuiTextRenderer maxPointsRenderer = new GuiTextRendererBuilder()
                                            .WithRichText(RichTextFormatter.For("Tu r\x00e9cord: " + maxPoints.Points + " puntos")
                                                          .SetBold()
                                                          .SetColor("cyan")
                                                          .SetSize(Pixels.GetDensityIndependentPixels(20))
                                                          .Format())
                                            .InPosition(GuiPosition.CENTER_HALF_DOWN)
                                            .Get();

        return(new GuiElementGroup()
               .AddElement(new GuiStaticElement(mapEndedRenderer))
               .AddElement(new GuiStaticElement(freeSpaceBetweenButtonsRenderer))
               .AddElement(new GuiStaticElement(showRankingRenderer))
               .AddElement(new GuiStaticElement(backToMenuRenderer))
               .AddElement(new GuiStaticElement(maxPointsRenderer)));
    }
Exemple #4
0
 private static GuiTextRenderer buildFullRenderer(string text, string textColor, int textSize, GuiPosition position, GuiRendererControl control)
 {
     return(new GuiTextRendererBuilder()
            .WithRichText(RichTextFormatter.For(text)
                          .SetBold()
                          .SetColor(textColor)
                          .SetSize(Pixels.GetDensityIndependentPixels(textSize))
                          .Format())
            .InPosition(position)
            .WithControl(control)
            .Get());
 }