From 14991c3261b5e04820822ab7d74b4ab1a84c253a Mon Sep 17 00:00:00 2001 From: SomeTroglodyte <63000004+SomeTroglodyte@users.noreply.github.com> Date: Fri, 17 Apr 2020 09:18:35 +0200 Subject: [PATCH] Keyboard-operated unit actions didn't play their sounds (#2438) --- core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt b/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt index 62c75bc8ef..a530b9769a 100644 --- a/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt +++ b/core/src/com/unciv/ui/worldscreen/unit/UnitActionsTable.kt @@ -14,6 +14,7 @@ import com.unciv.logic.map.MapUnit import com.unciv.models.UnitAction import com.unciv.ui.utils.* import com.unciv.ui.worldscreen.WorldScreen +import kotlin.concurrent.thread private data class UnitIconAndKey (val Icon: Actor, val key: Char = 0.toChar()) @@ -91,7 +92,10 @@ class UnitActionsTable(val worldScreen: WorldScreen) : Table(){ else { actionButton.onClick(unitAction.uncivSound,action) if (iconAndKey.key != 0.toChar()) - worldScreen.keyPressDispatcher[iconAndKey.key] = action + worldScreen.keyPressDispatcher[iconAndKey.key] = { + thread(name="Sound") { Sounds.play(unitAction.uncivSound) } + action() + } } return actionButton