Skip to content

Commit

Permalink
add prepareForNextTurn metod
Browse files Browse the repository at this point in the history
  • Loading branch information
AmonDeShir committed Jan 4, 2024
1 parent 253a83e commit a6af765
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,26 @@ protected void generateDescription() {
this.description.setText(text);
}

@Override
public void prepareForNextTurn() {
if (this.player != null) {
this.player.onChange().unsubscribe(this.update);
}

this.player = null;
this.property = null;
this.buyButton.setDisabled(true);
this.skipButton.setDisabled(true);
}

@Override
public void select(Player player, Entity field) {
this.display(field);

if (this.player != null) {
this.player.onChange().unsubscribe(this.update);
if (this.player == null) {
this.player = player;
this.player.onChange().subscribe(this.update);
}

this.player = player;
this.player.onChange().subscribe(this.update);

if (field instanceof Buyable property) {
this.property = property;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ public void select(Player player, Entity field) {
this.description.setText(this.splitText(23, "You docked to a suspicious-looking space station, only to discover it's a cosmic casino run by local gangsters. The catch is, you can only leave the station if you engage in a game with them. Sorry it's company policy. So what's your bet?"));
}

@Override
public void prepareForNextTurn() {
}

protected void resetCasino() {
this.betValue = 0;
this.bet.setText("Your bet: " + this.betValue);
Expand Down

0 comments on commit a6af765

Please sign in to comment.