diff options
author | nea <romangraef@gmail.com> | 2022-05-04 02:34:18 +0200 |
---|---|---|
committer | nea <romangraef@gmail.com> | 2022-05-04 02:34:18 +0200 |
commit | 42f9c22d1ac3d9fc68db3245c436ecfb5677e154 (patch) | |
tree | 435d0a62f3e99c1721e7f44ba16a618fd619431f /src | |
parent | a5f48eef1cae67b34866ee76718062a5df535e92 (diff) | |
download | RewardClaim-42f9c22d1ac3d9fc68db3245c436ecfb5677e154.tar.gz RewardClaim-42f9c22d1ac3d9fc68db3245c436ecfb5677e154.tar.bz2 RewardClaim-42f9c22d1ac3d9fc68db3245c436ecfb5677e154.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt index 1950acb..88ad1b7 100644 --- a/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt +++ b/src/main/kotlin/tech/thatgravyboat/rewardclaim/ui/RewardClaimGui.kt @@ -133,16 +133,16 @@ class RewardClaimGui(private val id: String) : WindowScreen() { private val rewards = Array(3) { i -> UIReward(57.5.percent(), 30.percent() + (18 * i).percent()) childOf background }.also { - for (reward in it) { + for ((i,reward) in it.withIndex()) { reward.onMouseClick { event -> if (event.mouseButton == 0 && state == State.SUCCESSFUL) { - for (j in 0..2) { - it[j].setSelected(it[j] == reward) - if (it[j] != event.currentTarget) continue - selected = j - selectedReward.updateInfo(data.rewards[selected], data.language) + val wasSelected = i == selected + selected = i + it.forEach { rew -> + rew.setSelected(rew == reward) } - if (event.clickCount >= 2) { + selectedReward.updateInfo(data.rewards[selected], data.language) + if (event.clickCount >= 2 && wasSelected) { if (Config.showDoubleClickConfirmation) confirmPopup() else claimReward() } |