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