From f95a1e9260927ba56413ea6634590c7adc614709 Mon Sep 17 00:00:00 2001 From: James <150948866+jameslaight@users.noreply.github.com> Date: Sun, 21 Apr 2024 11:36:53 +0100 Subject: [PATCH] add segments to round class --- core/src/com/monjaro/gamejam/main/Game.java | 10 +++++----- .../gamejam/main/{RoundData.java => Round.java} | 12 ++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) rename core/src/com/monjaro/gamejam/main/{RoundData.java => Round.java} (58%) diff --git a/core/src/com/monjaro/gamejam/main/Game.java b/core/src/com/monjaro/gamejam/main/Game.java index e86a0de..286ff51 100644 --- a/core/src/com/monjaro/gamejam/main/Game.java +++ b/core/src/com/monjaro/gamejam/main/Game.java @@ -29,7 +29,7 @@ public class Game extends ApplicationAdapter { private double tickProgress = 0; - private RoundData roundData; + private Round round; private UI ui; @Override @@ -40,7 +40,7 @@ public class Game extends ApplicationAdapter { img = new Texture("badlogic.jpg"); ui = new UI(50, 280, 10); - roundData = new RoundData(10); + round = new Round(10); Face.setBlankFaceSprite(new Texture("blank_die_face.png")); Face.setPipSprite(new Texture("pip.png")); @@ -66,15 +66,15 @@ public class Game extends ApplicationAdapter { public void tick() { processInput(); - ui.setRemainingRerolls(roundData.getRerolls()); + ui.setRemainingRerolls(round.getRerolls()); } public void processInput() { Input input = Gdx.input; - if (input.isKeyJustPressed(Input.Keys.R) && roundData.getRerolls() > 0) { //reroll dice that aren't locked + if (input.isKeyJustPressed(Input.Keys.R) && round.getRerolls() > 0) { //reroll dice that aren't locked dice.stream().filter(d -> !d.isSelected()).forEach(Die::roll); - roundData.reduceRerolls(1); + round.reduceRerolls(1); } for (int i = 0; i < dice.size(); i++) { //lock dice, iterating over for each keycode diff --git a/core/src/com/monjaro/gamejam/main/RoundData.java b/core/src/com/monjaro/gamejam/main/Round.java similarity index 58% rename from core/src/com/monjaro/gamejam/main/RoundData.java rename to core/src/com/monjaro/gamejam/main/Round.java index 172176f..ca2bdf3 100644 --- a/core/src/com/monjaro/gamejam/main/RoundData.java +++ b/core/src/com/monjaro/gamejam/main/Round.java @@ -1,10 +1,17 @@ package com.monjaro.gamejam.main; -public class RoundData { +import com.monjaro.gamejam.segment.Segment; + +import java.util.List; + +public class Round { + + private final List segments; private int rerolls; - public RoundData(int rerolls){ + public Round(List segments, int rerolls){ this.rerolls = rerolls; + this.segments = segments; } public int getRerolls() { @@ -18,4 +25,5 @@ public class RoundData { public void reduceRerolls(int i) { rerolls -= i; } + }