Main Menu
Some checks failed
Build and Test (KnockOutWhist) TeamCity build failed

This commit is contained in:
2024-12-13 11:54:33 +01:00
parent 56cc2f1182
commit 648a1b2ce7

View File

@@ -11,14 +11,14 @@ import de.knockoutwhist.utils.gui.Animations
import javafx.scene.{Node, control}
import scalafx.animation.Timeline
import scalafx.geometry.Insets
import scalafx.geometry.Pos.{BottomCenter, Center, TopCenter, TopLeft}
import scalafx.geometry.Pos.{BottomCenter, Center, TopCenter, TopLeft, TopRight}
import scalafx.scene.control.{Button, Label, Slider, TextField}
import scalafx.scene.Parent
import scalafx.scene.control.{Button, Label}
import scalafx.scene.image.{Image, ImageView}
import scalafx.scene.layout.Priority.Always
import scalafx.scene.layout.{HBox, StackPane, VBox}
import scalafx.scene.text.Font
import scalafx.scene.layout.{BorderPane, HBox, StackPane, VBox}
import scalafx.scene.text.{Font, TextAlignment}
import scalafx.util.Duration
import java.awt.Taskbar.Feature
@@ -33,7 +33,7 @@ object MainMenu {
def createMainMenu: StackPane = {
changeChild(new VBox {
alignment = BottomCenter
alignment = Center
spacing = 10
margin = Insets(0, 0, 150, 0)
children = Seq(
@@ -69,7 +69,10 @@ object MainMenu {
def changeChild(child: Parent, duration: Duration = Duration(500)): Unit = {
val times = ListBuffer[Timeline]()
mainMenu.children.foreach(node => times += Animations.fadeOutLeft(node, duration))
mainMenu.children.foreach(node => {
times += Animations.fadeOutLeft(node, duration)
node.setDisable(true)
})
val fadeIn = Animations.fadeInRight(child, duration)
mainMenu.children += child
times.foreach(_.play())
@@ -79,24 +82,26 @@ object MainMenu {
}
}
def createPlayeramountmenu(): Unit = {
changeChild(new VBox {
alignment = TopCenter
spacing = 20
margin = Insets(100, 0, 0, 0)
changeChild(new BorderPane {
margin = Insets(50, 50, 50, 50)
val players: VBox = new VBox {
alignment = BottomCenter
vgrow = Always
alignment = TopCenter
spacing = 20
margin = Insets(0, 0, 50, 0)
}
children = Seq(
new VBox {
top = new HBox() {
alignment = TopCenter
children = Seq(
new HBox {
children = new ImageView {
image = new Image("/KnockOutLogo.png")
fitWidth = 200
fitHeight = 200
}
}
left = new HBox {
alignment = TopCenter
spacing = 500
children = Seq(
new Button {
children = new Button {
alignment = TopRight
styleClass += Styles.BUTTON_CIRCLE
styleClass += Styles.ACCENT
graphic = new ImageView {
@@ -109,8 +114,11 @@ object MainMenu {
ControlHandler.invoke(GameStateUpdateEvent(MAIN_MENU))
}
}
},
new Button {
}
}
right = new HBox {
alignment = TopCenter
children = new Button {
styleClass += Styles.SUCCESS
styleClass += Styles.BUTTON_CIRCLE
graphic = new ImageView {
@@ -131,12 +139,13 @@ object MainMenu {
}
}
}
)
}
)
},
center = new VBox{
alignment = TopCenter
children = Seq(
new Label {
alignment = TopCenter
textAlignment = TextAlignment.Center
text = "Select Playeramount below:"
font = Font.font(30)
},
@@ -166,10 +175,10 @@ object MainMenu {
}
}
})
},
players
)
}
for (i <- 1 to 2) {
players.children.add(new TextField {
promptText = s"Enter Player $i"