From c42c613079b8590dadfad87073b4435010f44192 Mon Sep 17 00:00:00 2001 From: Sten Laane <21343173+StenAL@users.noreply.github.com> Date: Sat, 18 May 2024 23:04:32 +0300 Subject: [PATCH] Deobfuscate UI code about skipping tracks --- .../src/main/java/agolf/game/GameControlPanel.java | 12 ++++++------ client/src/main/java/agolf/game/GamePanel.java | 8 ++++---- .../main/java/agolf/game/GamePlayerInfoPanel.java | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/client/src/main/java/agolf/game/GameControlPanel.java b/client/src/main/java/agolf/game/GameControlPanel.java index c3ac1217..367a6e62 100644 --- a/client/src/main/java/agolf/game/GameControlPanel.java +++ b/client/src/main/java/agolf/game/GameControlPanel.java @@ -53,17 +53,17 @@ public void update(Graphics var1) { var1.fillRect(0, 0, this.anInt342, this.anInt343); } - public void actionPerformed(ActionEvent var1) { - Object var2 = var1.getSource(); - if (var2 == this.buttonSkip) { - if (this.gameContainer.gamePanel.method339(this.playerCount == 1)) { + public void actionPerformed(ActionEvent event) { + Object source = event.getSource(); + if (source == this.buttonSkip) { + if (this.gameContainer.gamePanel.skipButtonPressed(this.playerCount == 1)) { this.setVisible(false); this.remove(this.buttonSkip); this.setVisible(true); this.skipButtonVisible = false; } - } else if (var2 == this.buttonNewGame) { + } else if (source == this.buttonNewGame) { this.buttonNewGame.removeActionListener(this); this.setVisible(false); this.remove(this.buttonNewGame); @@ -71,7 +71,7 @@ public void actionPerformed(ActionEvent var1) { this.aGamePlayerInfoPanel__341.readyForNewGameLocal(); this.gameContainer.gamePanel.requestNewGame(); } else { - if (var2 == this.buttonBack) { + if (source == this.buttonBack) { this.buttonBack.removeActionListener(this); this.setVisible(false); this.remove(this.buttonBack); diff --git a/client/src/main/java/agolf/game/GamePanel.java b/client/src/main/java/agolf/game/GamePanel.java index ac2160ff..27fe4ea7 100644 --- a/client/src/main/java/agolf/game/GamePanel.java +++ b/client/src/main/java/agolf/game/GamePanel.java @@ -429,11 +429,11 @@ protected void sendEndStroke(int playerid, SynchronizedBool[] settings, int var3 this.gameContainer.connection.writeData("game\t" + data); } - protected boolean method339(boolean var1) { + protected boolean skipButtonPressed(boolean isSinglePlayer) { if (this.state == 1) { - if (!var1) { - this.gamePlayerInfoPanel.method366(); - if (this.gamePlayerInfoPanel.method376() && this.gameCanvas.method137()) { + if (!isSinglePlayer) { + this.gamePlayerInfoPanel.voteSkip(); + if (this.gamePlayerInfoPanel.shouldSkipTrack() && this.gameCanvas.method137()) { this.gameCanvas.restartGame(); } diff --git a/client/src/main/java/agolf/game/GamePlayerInfoPanel.java b/client/src/main/java/agolf/game/GamePlayerInfoPanel.java index 5beea558..c71c163c 100644 --- a/client/src/main/java/agolf/game/GamePlayerInfoPanel.java +++ b/client/src/main/java/agolf/game/GamePlayerInfoPanel.java @@ -434,7 +434,7 @@ protected void setGameOutcome(int[] outcome) { this.repaint(); } - protected void method366() { + protected void voteSkip() { this.voteSkip(this.playerId); } @@ -507,9 +507,9 @@ protected void method375(int[][] var1) { this.repaint(); } - protected boolean method376() { - for (int var1 = 0; var1 < this.playerCount; ++var1) { - if (this.anIntArray394[var1] == 0 && !this.playerVotedToSkip[var1]) { + protected boolean shouldSkipTrack() { + for (int player = 0; player < this.playerCount; ++player) { + if (this.anIntArray394[player] == 0 && !this.playerVotedToSkip[player]) { return false; } }