Added error popup when failed to download map
This commit is contained in:
parent
f4d828d5e4
commit
753efe5f47
2 changed files with 7 additions and 1 deletions
|
@ -114,6 +114,12 @@ class MapDownloadTable(mapEditorScreen: MapEditorScreen):PopupTable(mapEditorScr
|
|||
val downloadMapButton = TextButton(downloadableMap.name, CameraStageBaseScreen.skin)
|
||||
downloadMapButton.onClick {
|
||||
val mapJsonGzipped = DropBox().downloadFile(downloadableMap.path_display)
|
||||
if(mapJsonGzipped==""){
|
||||
val couldNotDownloadMapPopup = PopupTable(screen)
|
||||
couldNotDownloadMapPopup.addGoodSizedLabel("Could not download map!").row()
|
||||
couldNotDownloadMapPopup.addCloseButton()
|
||||
return@onClick
|
||||
}
|
||||
val decodedMapJson = Gzip.unzip(mapJsonGzipped)
|
||||
val mapObject = MapSaver().mapFromJson(decodedMapJson)
|
||||
MapSaver().saveMap(downloadableMap.name, mapObject)
|
||||
|
|
|
@ -41,7 +41,7 @@ class DropBox(){
|
|||
println(ex.message)
|
||||
val reader = BufferedReader(InputStreamReader(errorStream))
|
||||
println(reader.readText())
|
||||
return "Error!"
|
||||
return ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue