Add more music triggers (#7407)

* Add noted unimplemented music triggers

* Prototype try-civ-specific-then-try-general music function

* Undo previous commit and rename Built to Wonder

* Move music triggers to alert popup
This commit is contained in:
OptimizedForDensity 2022-07-15 04:56:26 -04:00 committed by GitHub
parent 28ff3da9cf
commit 7d7a36acc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 5 deletions

View File

@ -7,6 +7,9 @@ object MusicMood {
const val Defeat = "Defeat"
const val Menu = "Menu"
const val Ambient = "Ambient"
const val Golden = "Golden"
const val Wonder = "Wonder"
const val Researched = "Researched"
val themeOrPeace = listOf(Theme, Peace)
fun peaceOrWar(isAtWar: Boolean) = if (isAtWar) War else Peace

View File

@ -16,6 +16,8 @@ import com.unciv.models.ruleset.tile.TileImprovement
import com.unciv.models.ruleset.tile.TileResource
import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.models.translations.tr
import com.unciv.ui.audio.MusicMood
import com.unciv.ui.audio.MusicTrackChooserFlags
import com.unciv.ui.civilopedia.FormattedLine
import com.unciv.ui.civilopedia.MarkupRenderer
import com.unciv.ui.images.ImageGetter
@ -277,6 +279,7 @@ class MapEditorEditStartsTab(
getNations(),
iconDisplay = FormattedLine.IconDisplay.NoLink
) {
UncivGame.Current.musicController.chooseTrack(it, MusicMood.Theme, MusicTrackChooserFlags.setSpecific)
editTab.setBrush(BrushHandlerType.Direct, it, "Nation/$it") { tile ->
// toggle the starting location here, note this allows
// both multiple locations per nation and multiple nations per tile

View File

@ -216,6 +216,7 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
.toLabel().apply { wrap = true }).width(worldScreen.stage.width / 3).pad(10f)
add(centerTable).row()
add(getCloseButton(Constants.close))
UncivGame.Current.musicController.chooseTrack(wonder.name, MusicMood.Wonder, MusicTrackChooserFlags.setSpecific)
}
AlertType.TechResearched -> {
val gameBasics = worldScreen.gameInfo.ruleSet
@ -229,12 +230,14 @@ class AlertPopup(val worldScreen: WorldScreen, val popupAlert: PopupAlert): Popu
centerTable.add(descriptionScroll).width(worldScreen.stage.width / 3).maxHeight(worldScreen.stage.height / 2)
add(centerTable).row()
add(getCloseButton(Constants.close))
UncivGame.Current.musicController.chooseTrack(tech.name, MusicMood.Researched, MusicTrackChooserFlags.setSpecific)
}
AlertType.GoldenAge -> {
addGoodSizedLabel("GOLDEN AGE")
addSeparator()
addGoodSizedLabel("Your citizens have been happy with your rule for so long that the empire enters a Golden Age!").row()
add(getCloseButton(Constants.close))
UncivGame.Current.musicController.chooseTrack(worldScreen.viewingCiv.civName, MusicMood.Golden, MusicTrackChooserFlags.setSpecific)
}
AlertType.DeclarationOfFriendship -> {
val otherciv = worldScreen.gameInfo.getCivilization(popupAlert.value)

View File

@ -84,12 +84,12 @@ The current list of triggers is as follows:
| First contact[^4] | (civ name) | [^M] | Theme or Peace | [^X] | |
| War declaration[^5] | (civ name) | [^M] | War | [^X] | |
| Civ defeated | (civ name) | | Defeat | [^X] | |
| Golden Age | (civ name) | [^M] | Golden | [^X] | [^N] |
| Wonder built | (wonder name) | [^M] | Built | [^X] | [^N] |
| Tech researched | (tech name) | [^M] | Researched | [^X] | [^N] |
| Map editor: Select nation start location | (nation name) | [^M] | Theme | | [^S] [^N] |
| Golden Age | (civ name) | [^M] | Golden | [^X] | |
| Wonder built | (wonder name) | [^M] | Wonder | [^X] | |
| Tech researched | (tech name) | [^M] | Researched | [^X] | |
| Map editor: Select nation start location | (nation name) | [^M] | Theme | | [^S] |
| Options: Volume slider or Default track downloaded | | | | | [^D] |
| Options: Click currently playing label[^6] | | [^M] | Ambient | | [^S] |
| Options: Click currently playing label[^6] | | [^M] | Ambient | | [^S] |
Legend: