From a6af765cc3f521cba2c1a531d469e68cc54f7b3e Mon Sep 17 00:00:00 2001 From: Amon De Shir Date: Thu, 4 Jan 2024 22:06:15 +0100 Subject: [PATCH] add prepareForNextTurn metod --- .../interactive/AuctionInteractiveView.java | 20 ++++++++++++++----- .../interactive/CasinoInteractiveView.java | 4 ++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/AuctionInteractiveView.java b/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/AuctionInteractiveView.java index a4f8135..09d34cc 100644 --- a/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/AuctionInteractiveView.java +++ b/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/AuctionInteractiveView.java @@ -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; diff --git a/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/CasinoInteractiveView.java b/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/CasinoInteractiveView.java index 3366786..6c8ab29 100644 --- a/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/CasinoInteractiveView.java +++ b/core/src/xyz/magicjourney/nebulaquest/ui/panel/views/interactive/CasinoInteractiveView.java @@ -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);