mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 11:24:56 -04:00
eros: server type: server count
This commit is contained in:
parent
22c46342a0
commit
5bd0c9b7c2
@ -34,10 +34,10 @@ class SimpleErosConfirmationDialog(
|
|||||||
val onCancel: () -> Unit = {},
|
val onCancel: () -> Unit = {},
|
||||||
val onConfirm: () -> Unit,
|
val onConfirm: () -> Unit,
|
||||||
) : JavaFXWindowController() {
|
) : JavaFXWindowController() {
|
||||||
@FXML lateinit var headerFX: TextFlow
|
@FXML private lateinit var headerFX: TextFlow
|
||||||
@FXML lateinit var descriptionFX: TextFlow
|
@FXML private lateinit var descriptionFX: TextFlow
|
||||||
@FXML lateinit var cancelButtonFX: Button
|
@FXML private lateinit var cancelButtonFX: Button
|
||||||
@FXML lateinit var confirmButtonFX: Button
|
@FXML private lateinit var confirmButtonFX: Button
|
||||||
|
|
||||||
fun show() {
|
fun show() {
|
||||||
Platform.runLater {
|
Platform.runLater {
|
||||||
|
@ -41,29 +41,29 @@ class UpdateServerDialog(
|
|||||||
val onCancel: () -> Unit = {},
|
val onCancel: () -> Unit = {},
|
||||||
val onUpdate: (name: String, address: String, forcedVersion: Version?) -> Unit,
|
val onUpdate: (name: String, address: String, forcedVersion: Version?) -> Unit,
|
||||||
) : JavaFXWindowController() {
|
) : JavaFXWindowController() {
|
||||||
@FXML lateinit var descriptionFX: TextFlow
|
@FXML private lateinit var descriptionFX: TextFlow
|
||||||
|
|
||||||
@FXML lateinit var serverNameLabelFX: TextFlow
|
@FXML private lateinit var serverNameLabelFX: TextFlow
|
||||||
|
|
||||||
@FXML lateinit var serverNameFX: TextField
|
@FXML private lateinit var serverNameFX: TextField
|
||||||
|
|
||||||
@FXML lateinit var serverAddressLabelFX: TextFlow
|
@FXML private lateinit var serverAddressLabelFX: TextFlow
|
||||||
|
|
||||||
@FXML lateinit var serverAddressFX: TextField
|
@FXML private lateinit var serverAddressFX: TextField
|
||||||
|
|
||||||
|
|
||||||
@FXML lateinit var forcedVersionLabelFX: TextFlow
|
@FXML private lateinit var forcedVersionLabelFX: TextFlow
|
||||||
|
|
||||||
@FXML lateinit var forcedVersionFX: ComboBox<Version>
|
@FXML private lateinit var forcedVersionFX: ComboBox<Version>
|
||||||
|
|
||||||
@FXML lateinit var showReleasesFX: CheckBox
|
@FXML private lateinit var showReleasesFX: CheckBox
|
||||||
|
|
||||||
@FXML lateinit var showSnapshotsFX: CheckBox
|
@FXML private lateinit var showSnapshotsFX: CheckBox
|
||||||
|
|
||||||
|
|
||||||
@FXML lateinit var updateServerButtonFX: Button
|
@FXML private lateinit var updateServerButtonFX: Button
|
||||||
|
|
||||||
@FXML lateinit var cancelButtonFX: Button
|
@FXML private lateinit var cancelButtonFX: Button
|
||||||
|
|
||||||
|
|
||||||
fun show() {
|
fun show() {
|
||||||
|
@ -58,7 +58,7 @@ class PlayMainController : EmbeddedJavaFXController<Pane>() {
|
|||||||
if (this::currentController.isInitialized) {
|
if (this::currentController.isInitialized) {
|
||||||
currentController.terminate()
|
currentController.terminate()
|
||||||
}
|
}
|
||||||
currentController = when (new) {
|
currentController = when (new!!) {
|
||||||
ServerTypes.CUSTOM -> JavaFXUtil.loadEmbeddedController<ServerListController>(ServerListController.LAYOUT).apply {
|
ServerTypes.CUSTOM -> JavaFXUtil.loadEmbeddedController<ServerListController>(ServerListController.LAYOUT).apply {
|
||||||
servers = Minosoft.config.config.server.entries.values
|
servers = Minosoft.config.config.server.entries.values
|
||||||
refreshList()
|
refreshList()
|
||||||
|
@ -13,21 +13,28 @@
|
|||||||
|
|
||||||
package de.bixilon.minosoft.gui.eros.main.play
|
package de.bixilon.minosoft.gui.eros.main.play
|
||||||
|
|
||||||
|
import de.bixilon.minosoft.Minosoft
|
||||||
import de.bixilon.minosoft.data.registries.ResourceLocation
|
import de.bixilon.minosoft.data.registries.ResourceLocation
|
||||||
import de.bixilon.minosoft.data.registries.registries.registry.Translatable
|
import de.bixilon.minosoft.data.registries.registries.registry.Translatable
|
||||||
|
import de.bixilon.minosoft.protocol.protocol.LANServerListener
|
||||||
import de.bixilon.minosoft.util.KUtil
|
import de.bixilon.minosoft.util.KUtil
|
||||||
import de.bixilon.minosoft.util.KUtil.asResourceLocation
|
import de.bixilon.minosoft.util.KUtil.asResourceLocation
|
||||||
import de.bixilon.minosoft.util.enum.ValuesEnum
|
import de.bixilon.minosoft.util.enum.ValuesEnum
|
||||||
import org.kordamp.ikonli.Ikon
|
import org.kordamp.ikonli.Ikon
|
||||||
import org.kordamp.ikonli.fontawesome5.FontAwesomeSolid
|
import org.kordamp.ikonli.fontawesome5.FontAwesomeSolid
|
||||||
|
|
||||||
enum class ServerTypes(val icon: Ikon) : Translatable {
|
enum class ServerTypes(
|
||||||
CUSTOM(FontAwesomeSolid.SERVER),
|
val icon: Ikon,
|
||||||
LAN(FontAwesomeSolid.NETWORK_WIRED),
|
private val countGetter: () -> Int,
|
||||||
|
) : Translatable {
|
||||||
|
CUSTOM(FontAwesomeSolid.SERVER, { Minosoft.config.config.server.entries.size }),
|
||||||
|
LAN(FontAwesomeSolid.NETWORK_WIRED, { LANServerListener.SERVERS.size }),
|
||||||
;
|
;
|
||||||
|
|
||||||
override val translationKey: ResourceLocation = "minosoft:server_type.${name.lowercase()}".asResourceLocation()
|
override val translationKey: ResourceLocation = "minosoft:server_type.${name.lowercase()}".asResourceLocation()
|
||||||
|
|
||||||
|
val count: Int
|
||||||
|
get() = countGetter()
|
||||||
|
|
||||||
companion object : ValuesEnum<ServerTypes> {
|
companion object : ValuesEnum<ServerTypes> {
|
||||||
override val VALUES: Array<ServerTypes> = values()
|
override val VALUES: Array<ServerTypes> = values()
|
||||||
|
@ -24,11 +24,11 @@ import javafx.scene.text.TextFlow
|
|||||||
import org.kordamp.ikonli.javafx.FontIcon
|
import org.kordamp.ikonli.javafx.FontIcon
|
||||||
|
|
||||||
class ServerTypeCardController : AbstractCard<ServerTypes>() {
|
class ServerTypeCardController : AbstractCard<ServerTypes>() {
|
||||||
@FXML lateinit var iconFX: FontIcon
|
@FXML private lateinit var iconFX: FontIcon
|
||||||
|
|
||||||
@FXML lateinit var headerFX: TextFlow
|
@FXML private lateinit var headerFX: TextFlow
|
||||||
|
|
||||||
@FXML lateinit var textFX: TextFlow
|
@FXML private lateinit var textFX: TextFlow
|
||||||
|
|
||||||
override fun updateItem(item: ServerTypes?, empty: Boolean) {
|
override fun updateItem(item: ServerTypes?, empty: Boolean) {
|
||||||
super.updateItem(item, empty)
|
super.updateItem(item, empty)
|
||||||
@ -40,7 +40,7 @@ class ServerTypeCardController : AbstractCard<ServerTypes>() {
|
|||||||
iconFX.iconCode = item.icon
|
iconFX.iconCode = item.icon
|
||||||
headerFX.text = Minosoft.LANGUAGE_MANAGER.translate(item)
|
headerFX.text = Minosoft.LANGUAGE_MANAGER.translate(item)
|
||||||
|
|
||||||
textFX.text = "? servers"
|
textFX.text = "${item.count} servers" // ToDo: Update on the fly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user