-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
# sbt specific | ||
dist/* | ||
target/ | ||
target | ||
lib_managed/ | ||
src_managed/ | ||
project/boot/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package view | ||
|
||
import scalafx.Includes._ | ||
import scalafx.application.JFXApp3 | ||
import scalafx.scene.layout._ | ||
import scalafx.scene.control._ | ||
import scalafx.scene._ | ||
import scalafx.geometry._ | ||
import scalafx.geometry.Pos._ | ||
import scalafx.scene.paint.Color._ | ||
import viewmodel.ViewModel | ||
import domain.Game | ||
import domain.Game | ||
import domain.GlobalResults | ||
import domain.GlobalResults | ||
|
||
object StartView extends JFXApp3 { | ||
|
||
val viewModel = ViewModel() | ||
|
||
override def start(): Unit = { | ||
stage = new JFXApp3.PrimaryStage { | ||
title.value = "Montecarlo Simulation" | ||
scene = new Scene { | ||
content = new BorderPane { | ||
center = new HBox() { | ||
children = Seq(GameAmountChooser(), WinnerTeam()) | ||
alignment = CenterLeft | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def GameAmountChooser() = new HBox { | ||
val gamesAmmountField = new TextField() | ||
children = Seq( | ||
new Label("Cantidad de juegos"), | ||
gamesAmmountField, | ||
new Button("Iniciar") { | ||
onAction = _ => viewModel.startSimulation(gamesAmmountField.text) | ||
} | ||
) | ||
} | ||
|
||
def WinnerTeam() = new VBox { | ||
val title = new Label("Equipo Ganador") | ||
val winnerName = new Label("Ninguno") | ||
val winnerScore = new Label("0") | ||
viewModel.simulationGlobalResults.onChange { (_, _, results: GlobalResults) => | ||
results.winnerTeam match { | ||
case Some(value) => { | ||
winnerName.setText(value._1.toString()) | ||
winnerScore.setText(value._2.toString()) | ||
} | ||
case _ => print("No value") | ||
} | ||
} | ||
children = winnerName | ||
} | ||
} |