mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-27 08:09:21 +07:00
Music now downloads on another thread to not harm the user experience
Removed unused "Username" string
This commit is contained in:
@ -41,7 +41,7 @@ android {
|
|||||||
release {
|
release {
|
||||||
// Don't add local save files and fonts to release, obviously
|
// Don't add local save files and fonts to release, obviously
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
ignoreAssetsPattern "!SaveFiles:!fonts:!maps"
|
ignoreAssetsPattern "!SaveFiles:!fonts:!maps:!music"
|
||||||
}
|
}
|
||||||
|
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
@ -51,7 +51,7 @@ android {
|
|||||||
debug {
|
debug {
|
||||||
// Don't add local save files and fonts to release, obviously
|
// Don't add local save files and fonts to release, obviously
|
||||||
aaptOptions {
|
aaptOptions {
|
||||||
ignoreAssetsPattern "!SaveFiles:!fonts:!maps"
|
ignoreAssetsPattern "!SaveFiles:!fonts:!maps:!music"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ class UnCivGame(val version: String) : Game() {
|
|||||||
if(musicFile.exists()){
|
if(musicFile.exists()){
|
||||||
music = Gdx.audio.newMusic(musicFile)
|
music = Gdx.audio.newMusic(musicFile)
|
||||||
music!!.isLooping=true
|
music!!.isLooping=true
|
||||||
music!!.volume = 0.4f
|
music!!.volume = 0.4f*settings.musicVolume
|
||||||
music!!.play()
|
music!!.play()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -278,7 +278,7 @@ class CivilizationInfo {
|
|||||||
leaderName += " (" + "AI".tr() + ")"
|
leaderName += " (" + "AI".tr() + ")"
|
||||||
else if (gameInfo.civilizations.count { it.playerType == PlayerType.Human } > 1)
|
else if (gameInfo.civilizations.count { it.playerType == PlayerType.Human } > 1)
|
||||||
leaderName += " (" + "Human".tr() + " - " + "Hotseat".tr() + ")"
|
leaderName += " (" + "Human".tr() + " - " + "Hotseat".tr() + ")"
|
||||||
else leaderName += " (" + "Human".tr() + " - " + UnCivGame.Current.settings.userName + ")"
|
else leaderName += " (" + "Human".tr() + " - " + "Multiplayer".tr() + ")"
|
||||||
return leaderName
|
return leaderName
|
||||||
}
|
}
|
||||||
//endregion
|
//endregion
|
||||||
|
@ -22,7 +22,6 @@ class GameSettings {
|
|||||||
var showPixelUnits: Boolean = false
|
var showPixelUnits: Boolean = false
|
||||||
var showPixelImprovements: Boolean = false
|
var showPixelImprovements: Boolean = false
|
||||||
|
|
||||||
var userName:String=""
|
|
||||||
var userId = ""
|
var userId = ""
|
||||||
|
|
||||||
fun save(){
|
fun save(){
|
||||||
|
@ -11,6 +11,7 @@ import com.unciv.models.gamebasics.GameBasics
|
|||||||
import com.unciv.models.gamebasics.tr
|
import com.unciv.models.gamebasics.tr
|
||||||
import com.unciv.ui.utils.*
|
import com.unciv.ui.utils.*
|
||||||
import com.unciv.ui.worldscreen.WorldScreen
|
import com.unciv.ui.worldscreen.WorldScreen
|
||||||
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
class Language(val language:String){
|
class Language(val language:String){
|
||||||
val percentComplete:Int
|
val percentComplete:Int
|
||||||
@ -117,7 +118,6 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
innerTable.add("Version".toLabel())
|
innerTable.add("Version".toLabel())
|
||||||
innerTable.add(UnCivGame.Current.version.toLabel()).row()
|
innerTable.add(UnCivGame.Current.version.toLabel()).row()
|
||||||
|
|
||||||
addUsernameAndId(innerTable)
|
|
||||||
|
|
||||||
val scrollPane = ScrollPane(innerTable, skin)
|
val scrollPane = ScrollPane(innerTable, skin)
|
||||||
scrollPane.setOverscroll(false, false)
|
scrollPane.setOverscroll(false, false)
|
||||||
@ -132,18 +132,6 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
UnCivGame.Current.worldScreen.shouldUpdate = true
|
UnCivGame.Current.worldScreen.shouldUpdate = true
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addUsernameAndId(innerTable: PopupTable) {
|
|
||||||
innerTable.add("Username".toLabel())
|
|
||||||
val userNameTextField = TextField(UnCivGame.Current.settings.userName, skin)
|
|
||||||
userNameTextField.addListener {
|
|
||||||
UnCivGame.Current.settings.userName = userNameTextField.text
|
|
||||||
UnCivGame.Current.settings.save()
|
|
||||||
true
|
|
||||||
}
|
|
||||||
innerTable.add(userNameTextField).row()
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun addSoundEffectsVolumeSlider(innerTable: PopupTable) {
|
private fun addSoundEffectsVolumeSlider(innerTable: PopupTable) {
|
||||||
innerTable.add("Sound effects volume".tr())
|
innerTable.add("Sound effects volume".tr())
|
||||||
@ -183,15 +171,20 @@ class WorldScreenOptionsTable(val worldScreen:WorldScreen) : PopupTable(worldScr
|
|||||||
innerTable.add(errorTable).colspan(2).row()
|
innerTable.add(errorTable).colspan(2).row()
|
||||||
|
|
||||||
downloadMusicButton.onClick {
|
downloadMusicButton.onClick {
|
||||||
try{
|
// So the whole game doesn't get stuck while downloading the file
|
||||||
val file = DropBox().downloadFile("/Music/thatched-villagers.mp3")
|
thread {
|
||||||
musicLocation.write(file,false)
|
try {
|
||||||
update()
|
downloadMusicButton.disable()
|
||||||
UnCivGame.Current.startMusic()
|
errorTable.clear()
|
||||||
}
|
errorTable.add("Downloading...".toLabel())
|
||||||
catch (ex:Exception){
|
val file = DropBox().downloadFile("/Music/thatched-villagers.mp3")
|
||||||
errorTable.clear()
|
musicLocation.write(file, false)
|
||||||
errorTable.add("Could not download music!".toLabel().setFontColor(Color.RED))
|
update()
|
||||||
|
UnCivGame.Current.startMusic()
|
||||||
|
} catch (ex: Exception) {
|
||||||
|
errorTable.clear()
|
||||||
|
errorTable.add("Could not download music!".toLabel().setFontColor(Color.RED))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user