package com.tacktic.inbudget;

import com.badlogic.gdx.graphics.Color;

import java.math.BigDecimal;

public class ResultScreen extends BaseScreen {
    private final BigDecimal budget;
    private final BigDecimal totalPrice;
    private final BigDecimal percentage;

    public ResultScreen(InBudget game, BigDecimal budget, BigDecimal totalPrice) {
        super(game);
        this.budget = budget;
        this.totalPrice = totalPrice;
        this.percentage = totalPrice.divide(budget, 3, BigDecimal.ROUND_HALF_UP);
    }

    @Override
    public void renderBatch() {
        drawResultBackground();
        write("1", Color.WHITE, 3, VIEWPORT_WIDTH/2 + 100, VIEWPORT_HEIGHT - 170);
        write("$" + String.valueOf(budget), Color.DARK_GRAY, 2, VIEWPORT_WIDTH/2 + 100, VIEWPORT_HEIGHT - 250);
        write("$" + totalPrice.toString(), Color.WHITE, 2, VIEWPORT_WIDTH/2 + 100, VIEWPORT_HEIGHT - 320);
        write("" + percentage.movePointRight(2) + "%", Color.WHITE, 2, VIEWPORT_WIDTH/2 + 100, VIEWPORT_HEIGHT - 400);
    }

    @Override
    public void renderActions() {

    }

    @Override
    public void resize(int width, int height) {

    }

    @Override
    public void show() {

    }

    @Override
    public void hide() {

    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void dispose() {

    }
}

@@ -52,52 +52,154 @@
 gdx.
-graphics.Color;%0A%0Aimport java.math.BigDecimal
+Gdx;%0Aimport com.badlogic.gdx.graphics.Color;%0Aimport com.badlogic.gdx.utils.Array;%0A%0Aimport java.math.BigDecimal;%0Aimport java.util.function.Consumer
 ;%0A%0Ap
@@ -362,16 +362,50 @@
 centage;
+%0A    private boolean loadingRound;
 %0A%0A    pu
@@ -652,16 +652,51 @@
 LF_UP);%0A
+        this.loadingRound = false;%0A
     %7D%0A%0A 
@@ -1192,16 +1192,333 @@
  - 400);
+%0A%0A        if (Gdx.input.isTouched()) %7B%0A            loadingRound = true;%0A            changeRound(1).thenAccept(new Consumer%3CArray%3CItem%3E%3E() %7B%0A                @Override%0A                public void accept(final Array%3CItem%3E items) %7B%0A                    moveToGameScreen(items);%0A                %7D%0A            %7D);%0A%0A        %7D
 %0A    %7D%0A%0A

Allow to restart game on clicking the result screen.