Example #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));
    }
Example #2
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));
    }
Example #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)));
    }
Example #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();
 }
Example #5
0
 public MovementManager(Station firstStation, Station lastStation, Route route, Movement firstMovement, Movement normalMovement, Movement goOutMovement, TrainPassengers passengers, TimeCounter timeCounter, CurrentPoints points, GuiManager gui, GuiRendererControl backToMenuButton, GuiRendererControl showRankingButton, bool isLocal, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network)
 {
     this.firstStation = firstStation;
     this.lastStation = lastStation;
     this.route = route;
     this.movement = firstMovement;
     this.normalMovement = normalMovement;
     this.goOutMovement = goOutMovement;
     this.passengers = passengers;
     this.timeCounter = timeCounter;
     this.points = points;
     this.gui = gui;
     this.backToMenuButton = backToMenuButton;
     this.showRankingButton = showRankingButton;
     this.isLocal = isLocal;
     this.playersPoints = playersPoints;
     this.network = network;
 }
Example #6
0
 public MovementManager(Station firstStation, Station lastStation, Route route, Movement firstMovement, Movement normalMovement, Movement goOutMovement, TrainPassengers passengers, TimeCounter timeCounter, CurrentPoints points, GuiManager gui, GuiRendererControl backToMenuButton, GuiRendererControl showRankingButton, bool isLocal, GuiPlayersPointsElement playersPoints, NetworkEntityPlaying network)
 {
     this.firstStation      = firstStation;
     this.lastStation       = lastStation;
     this.route             = route;
     this.movement          = firstMovement;
     this.normalMovement    = normalMovement;
     this.goOutMovement     = goOutMovement;
     this.passengers        = passengers;
     this.timeCounter       = timeCounter;
     this.points            = points;
     this.gui               = gui;
     this.backToMenuButton  = backToMenuButton;
     this.showRankingButton = showRankingButton;
     this.isLocal           = isLocal;
     this.playersPoints     = playersPoints;
     this.network           = network;
 }
    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 GuiTextRendererBuilder WithControl(GuiRendererControl control)
 {
     renderer.Control = control;
     return this;
 }
Example #9
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());
 }
Example #10
0
 public static GuiManagerElement GetSwitchCameraElement(string cameraName, GuiPosition position, GuiRendererControl control)
 {
     return(new GuiStaticElement(buildFullRenderer(cameraName, "yellow", 15, position, control)));
 }
 protected void Add(string text, GuiRendererControl control)
 {
     Add(text, defaultSize, control);
 }
 protected void Add(string text, int size, GuiRendererControl control)
 {
     Add(text, size, defaultBold, defaultColor, control);
 }
Example #13
0
 public static GuiManagerElement GetSwitchCameraElement(string cameraName, GuiPosition position, GuiRendererControl control)
 {
     return new GuiStaticElement(buildFullRenderer(cameraName, "yellow", 15, position, control));
 }
 private void addServer(string server, GuiRendererControl control)
 {
     Add(server, control: control);
 }
Example #15
0
 protected void Add(string text, int size, GuiRendererControl control)
 {
     Add(text, size, defaultBold, defaultColor, control);
 }
Example #16
0
 protected void Add(string text, GuiRendererControl control)
 {
     Add(text, defaultSize, control);
 }
Example #17
0
 public GuiContentRenderer()
 {
     Content = new GUIContent();
     Control = new GuiLabelRendererControl();
 }
Example #18
0
 public GuiTextRendererBuilder WithControl(GuiRendererControl control)
 {
     renderer.Control = control;
     return(this);
 }