mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-17 03:15:35 -04:00
eros: show message if no account selected
This commit is contained in:
parent
5bd0c9b7c2
commit
1588f135e6
@ -20,7 +20,9 @@ import de.bixilon.minosoft.data.accounts.Account
|
||||
import de.bixilon.minosoft.gui.eros.controller.JavaFXWindowController
|
||||
import de.bixilon.minosoft.gui.eros.main.play.PlayMainController
|
||||
import de.bixilon.minosoft.gui.eros.modding.invoker.JavaFXEventInvoker
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXAccountUtil.avatar
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil
|
||||
import de.bixilon.minosoft.gui.eros.util.JavaFXUtil.ctext
|
||||
import de.bixilon.minosoft.modding.event.events.account.AccountSelectEvent
|
||||
import de.bixilon.minosoft.modding.event.master.GlobalEventMaster
|
||||
import de.bixilon.minosoft.util.GitInfo
|
||||
@ -87,8 +89,8 @@ class MainErosController : JavaFXWindowController() {
|
||||
|
||||
|
||||
GlobalEventMaster.registerEvent(JavaFXEventInvoker.of<AccountSelectEvent> {
|
||||
accountImageFX.image = JavaFXUtil.MINOSOFT_LOGO // ToDo
|
||||
accountNameFX.text = it.account?.username
|
||||
accountImageFX.image = it.account?.avatar
|
||||
accountNameFX.ctext = it.account?.username ?: NO_ACCOUNT_SELECTED
|
||||
})
|
||||
}
|
||||
|
||||
@ -117,4 +119,8 @@ class MainErosController : JavaFXWindowController() {
|
||||
onSuccess(account)
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val NO_ACCOUNT_SELECTED = "minosoft:main.account.no_account_selected".asResourceLocation()
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import org.kordamp.ikonli.fontawesome5.FontAwesomeSolid
|
||||
|
||||
enum class ServerTypes(
|
||||
val icon: Ikon,
|
||||
private val countGetter: () -> Int,
|
||||
private val countSupplier: () -> Int,
|
||||
) : Translatable {
|
||||
CUSTOM(FontAwesomeSolid.SERVER, { Minosoft.config.config.server.entries.size }),
|
||||
LAN(FontAwesomeSolid.NETWORK_WIRED, { LANServerListener.SERVERS.size }),
|
||||
@ -34,7 +34,7 @@ enum class ServerTypes(
|
||||
override val translationKey: ResourceLocation = "minosoft:server_type.${name.lowercase()}".asResourceLocation()
|
||||
|
||||
val count: Int
|
||||
get() = countGetter()
|
||||
get() = countSupplier()
|
||||
|
||||
companion object : ValuesEnum<ServerTypes> {
|
||||
override val VALUES: Array<ServerTypes> = values()
|
||||
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Minosoft
|
||||
* Copyright (C) 2021 Moritz Zwerger
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
|
||||
*/
|
||||
|
||||
package de.bixilon.minosoft.gui.eros.util
|
||||
|
||||
import de.bixilon.minosoft.data.accounts.Account
|
||||
import javafx.scene.image.Image
|
||||
|
||||
object JavaFXAccountUtil {
|
||||
|
||||
val Account.avatar: Image?
|
||||
get() = null // ToDo
|
||||
}
|
@ -27,6 +27,7 @@ import javafx.scene.control.Labeled
|
||||
import javafx.scene.control.TextField
|
||||
import javafx.scene.image.Image
|
||||
import javafx.scene.layout.Pane
|
||||
import javafx.scene.text.Text
|
||||
import javafx.scene.text.TextFlow
|
||||
import javafx.stage.Modality
|
||||
import javafx.stage.Stage
|
||||
@ -85,4 +86,10 @@ object JavaFXUtil {
|
||||
set(value) {
|
||||
this.text = Minosoft.LANGUAGE_MANAGER.translate(value).message
|
||||
}
|
||||
|
||||
var Text.ctext: Any?
|
||||
get() = this.text
|
||||
set(value) {
|
||||
this.text = Minosoft.LANGUAGE_MANAGER.translate(value).message
|
||||
}
|
||||
}
|
||||
|
@ -54,3 +54,6 @@ minosoft:update_server.edit.update_button=Save server
|
||||
minosoft:server_list.refresh.header=Refresh
|
||||
minosoft:server_list.refresh.text1=Get the latest
|
||||
minosoft:server_list.refresh.text2=information
|
||||
|
||||
|
||||
minosoft:main.account.no_account_selected=No account selected
|
||||
|
Loading…
x
Reference in New Issue
Block a user