Fix two sound credits (#4020)

This commit is contained in:
SomeTroglodyte
2021-05-30 20:05:46 +02:00
committed by GitHub
parent a51978c960
commit ab4441ad1f
3 changed files with 19 additions and 2 deletions

View File

@ -14,6 +14,7 @@ private enum class UncivSoundConstants (val value: String) {
Whoosh("whoosh"),
Bombard("bombard"),
Slider("slider"),
Construction("construction"),
Silent(""),
Custom("")
}
@ -52,6 +53,7 @@ class UncivSound private constructor (
val Whoosh = UncivSound(UncivSoundConstants.Whoosh)
val Bombard = UncivSound(UncivSoundConstants.Bombard)
val Slider = UncivSound(UncivSoundConstants.Slider)
val Construction = UncivSound(UncivSoundConstants.Construction)
val Silent = UncivSound(UncivSoundConstants.Silent)
/** Creates an UncivSound instance for a custom sound.
* @param filename The base filename without extension.

View File

@ -284,7 +284,9 @@ class CityConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBase
if (!cannotAddConstructionToQueue(construction, cityScreen.city, cityScreen.city.cityConstructions)) {
val addToQueueButton = ImageGetter.getImage("OtherIcons/New").apply { color = Color.BLACK }.surroundWithCircle(40f)
addToQueueButton.onClick { addConstructionToQueue(construction, cityScreen.city.cityConstructions) }
addToQueueButton.onClick(getConstructionSound(construction)) {
addConstructionToQueue(construction, cityScreen.city.cityConstructions)
}
pickConstructionButton.add(addToQueueButton)
}
pickConstructionButton.row()
@ -338,7 +340,9 @@ class CityConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBase
|| cannotAddConstructionToQueue(construction, city, cityConstructions)) {
button.disable()
} else {
button.onClick { addConstructionToQueue(construction, cityConstructions) }
button.onClick(getConstructionSound(construction)) {
addConstructionToQueue(construction, cityConstructions)
}
}
}
@ -360,6 +364,15 @@ class CityConstructionsTable(val cityScreen: CityScreen) : Table(CameraStageBase
cityScreen.game.settings.addCompletedTutorialTask("Pick construction")
}
fun getConstructionSound(construction: IConstruction): UncivSound {
return when(construction) {
is Building -> UncivSound.Construction
is BaseUnit -> UncivSound.Promote
PerpetualConstruction.gold -> UncivSound.Coin
PerpetualConstruction.science -> UncivSound.Paper
else -> UncivSound.Click
}
}
fun purchaseConstruction(construction: IConstruction) {
val city = cityScreen.city