Added "user id from clipboard" button in New Game screen
Fixed other user id problems
This commit is contained in:
parent
455de79d28
commit
91ac744692
6 changed files with 25 additions and 12 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -134,3 +134,4 @@ android/assets/fonts/
|
||||||
android/release/android.aab
|
android/release/android.aab
|
||||||
android/assets/maps/
|
android/assets/maps/
|
||||||
android/release/android.aab.sig
|
android/release/android.aab.sig
|
||||||
|
android/release/android-release.aab
|
||||||
|
|
|
@ -9,10 +9,10 @@ android:
|
||||||
- platform-tools
|
- platform-tools
|
||||||
|
|
||||||
# The BuildTools version used by your project
|
# The BuildTools version used by your project
|
||||||
- build-tools-28.0.3
|
- build-tools-29.0.3
|
||||||
|
|
||||||
# The SDK version used to compile your project
|
# The SDK version used to compile your project
|
||||||
- android-28
|
- android-29
|
||||||
|
|
||||||
|
|
||||||
jdk:
|
jdk:
|
||||||
|
|
|
@ -20,9 +20,9 @@ android {
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.unciv.app"
|
applicationId "com.unciv.app"
|
||||||
minSdkVersion 14
|
minSdkVersion 14
|
||||||
targetSdkVersion 28
|
targetSdkVersion 29
|
||||||
versionCode 293
|
versionCode 294
|
||||||
versionName "3.0.0"
|
versionName "3.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
// Had to add this crap for Travis to build, it wanted to sign the app
|
// Had to add this crap for Travis to build, it wanted to sign the app
|
||||||
|
|
|
@ -9,6 +9,7 @@ buildscript {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// 以下四行代码为阿里gradle 源
|
// 以下四行代码为阿里gradle 源
|
||||||
|
// Chinese mirrors for quicker loading for chinese devs
|
||||||
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
|
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
|
||||||
maven{ url 'https://maven.aliyun.com/repository/google'}
|
maven{ url 'https://maven.aliyun.com/repository/google'}
|
||||||
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
||||||
|
@ -42,6 +43,7 @@ allprojects {
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
// 以下四行代码为阿里gradle 源
|
// 以下四行代码为阿里gradle 源
|
||||||
|
// Chinese mirrors for quicker loading for chinese devs
|
||||||
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
|
maven{ url 'https://maven.aliyun.com/repository/jcenter'}
|
||||||
maven{ url 'https://maven.aliyun.com/repository/google'}
|
maven{ url 'https://maven.aliyun.com/repository/google'}
|
||||||
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
maven{ url 'https://maven.aliyun.com/repository/gradle-plugin'}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.unciv.ui.newgamescreen
|
package com.unciv.ui.newgamescreen
|
||||||
|
|
||||||
|
import com.badlogic.gdx.Gdx
|
||||||
import com.badlogic.gdx.graphics.Color
|
import com.badlogic.gdx.graphics.Color
|
||||||
import com.badlogic.gdx.scenes.scene2d.Touchable
|
import com.badlogic.gdx.scenes.scene2d.Touchable
|
||||||
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
import com.badlogic.gdx.scenes.scene2d.ui.ScrollPane
|
||||||
|
@ -60,11 +61,12 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||||
playerIdTable.add("Player ID:".toLabel())
|
playerIdTable.add("Player ID:".toLabel())
|
||||||
|
|
||||||
val playerIdTextfield = TextField(player.playerId, CameraStageBaseScreen.skin)
|
val playerIdTextfield = TextField(player.playerId, CameraStageBaseScreen.skin)
|
||||||
playerIdTable.add(playerIdTextfield)
|
playerIdTable.add(playerIdTextfield).colspan(2)
|
||||||
val errorLabel = "Not a valid user id!".toLabel().setFontColor(Color.RED)
|
val errorLabel = "Not a valid user id!".toLabel().setFontColor(Color.RED)
|
||||||
errorLabel.isVisible=false
|
errorLabel.isVisible=false
|
||||||
playerIdTable.add(errorLabel)
|
playerIdTable.add(errorLabel)
|
||||||
playerIdTextfield.addListener {
|
|
||||||
|
fun onPlayerIdTextUpdated(){
|
||||||
try {
|
try {
|
||||||
val uuid = UUID.fromString(playerIdTextfield.text)
|
val uuid = UUID.fromString(playerIdTextfield.text)
|
||||||
player.playerId = playerIdTextfield.text
|
player.playerId = playerIdTextfield.text
|
||||||
|
@ -72,19 +74,27 @@ class PlayerPickerTable(val newGameScreen: NewGameScreen, val newGameParameters:
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
errorLabel.isVisible=true
|
errorLabel.isVisible=true
|
||||||
}
|
}
|
||||||
true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
playerIdTextfield.addListener { onPlayerIdTextUpdated(); true }
|
||||||
|
|
||||||
playerIdTable.row()
|
playerIdTable.row()
|
||||||
|
|
||||||
val currentUserId = UnCivGame.Current.settings.userId
|
val currentUserId = UnCivGame.Current.settings.userId
|
||||||
val setCurrentUserButton = TextButton("Set current user", CameraStageBaseScreen.skin)
|
val setCurrentUserButton = TextButton("Set current user".tr(), CameraStageBaseScreen.skin)
|
||||||
setCurrentUserButton.onClick {
|
setCurrentUserButton.onClick {
|
||||||
playerIdTextfield.text = currentUserId
|
playerIdTextfield.text = currentUserId
|
||||||
errorLabel.isVisible = false
|
onPlayerIdTextUpdated()
|
||||||
}
|
}
|
||||||
playerIdTable.add(setCurrentUserButton)
|
playerIdTable.add(setCurrentUserButton)
|
||||||
|
|
||||||
|
val copyFromClipboardButton = TextButton("Player ID from clipboard",CameraStageBaseScreen.skin)
|
||||||
|
copyFromClipboardButton.onClick {
|
||||||
|
playerIdTextfield.text = Gdx.app.clipboard.contents
|
||||||
|
onPlayerIdTextUpdated()
|
||||||
|
}
|
||||||
|
playerIdTable.add(copyFromClipboardButton).pad(5f)
|
||||||
|
|
||||||
playerTable.add(playerIdTable).colspan(playerTable.columns)
|
playerTable.add(playerIdTable).colspan(playerTable.columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,9 +96,9 @@ class WorldScreenMenuTable(val worldScreen: WorldScreen) : PopupTable(worldScree
|
||||||
val badGameIdLabel = "".toLabel().setFontColor(Color.RED)
|
val badGameIdLabel = "".toLabel().setFontColor(Color.RED)
|
||||||
badGameIdLabel.isVisible = false
|
badGameIdLabel.isVisible = false
|
||||||
multiplayerPopup.addButton("Join Game") {
|
multiplayerPopup.addButton("Join Game") {
|
||||||
val gameId = Gdx.app.clipboard.contents.trim()
|
val gameId = Gdx.app.clipboard.contents
|
||||||
try {
|
try {
|
||||||
UUID.fromString(gameId)
|
UUID.fromString(gameId.trim())
|
||||||
} catch (ex: Exception) {
|
} catch (ex: Exception) {
|
||||||
badGameIdLabel.setText("Invalid game ID!")
|
badGameIdLabel.setText("Invalid game ID!")
|
||||||
badGameIdLabel.isVisible = true
|
badGameIdLabel.isVisible = true
|
||||||
|
|
Loading…
Reference in a new issue