From 7d7a36acc9fb597c8d539bce240ead4fa40c570b Mon Sep 17 00:00:00 2001 From: OptimizedForDensity <105244635+OptimizedForDensity@users.noreply.github.com> Date: Fri, 15 Jul 2022 04:56:26 -0400 Subject: [PATCH] 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 --- core/src/com/unciv/ui/audio/MusicMood.kt | 3 +++ .../src/com/unciv/ui/mapeditor/MapEditorEditSubTabs.kt | 3 +++ core/src/com/unciv/ui/worldscreen/AlertPopup.kt | 3 +++ docs/Modders/Images-and-Audio.md | 10 +++++----- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/core/src/com/unciv/ui/audio/MusicMood.kt b/core/src/com/unciv/ui/audio/MusicMood.kt index 112d896f8b..f4433365ea 100644 --- a/core/src/com/unciv/ui/audio/MusicMood.kt +++ b/core/src/com/unciv/ui/audio/MusicMood.kt @@ -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 diff --git a/core/src/com/unciv/ui/mapeditor/MapEditorEditSubTabs.kt b/core/src/com/unciv/ui/mapeditor/MapEditorEditSubTabs.kt index 76d1469301..616a3a52ce 100644 --- a/core/src/com/unciv/ui/mapeditor/MapEditorEditSubTabs.kt +++ b/core/src/com/unciv/ui/mapeditor/MapEditorEditSubTabs.kt @@ -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 diff --git a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt index 9f77dd3f1a..8ad12be90a 100644 --- a/core/src/com/unciv/ui/worldscreen/AlertPopup.kt +++ b/core/src/com/unciv/ui/worldscreen/AlertPopup.kt @@ -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) diff --git a/docs/Modders/Images-and-Audio.md b/docs/Modders/Images-and-Audio.md index 3c787d53d1..34bdae03b1 100644 --- a/docs/Modders/Images-and-Audio.md +++ b/docs/Modders/Images-and-Audio.md @@ -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: