|
25 | 25 |
|
26 | 26 | public class MainMenu extends FXGLMenu { |
27 | 27 | private static final int SIZE = 250; |
28 | | - private final Animation<?> animation; |
29 | 28 | private final Rectangle buttonLevel1; |
30 | 29 | private final Rectangle buttonLevel2; |
31 | 30 | private final Rectangle buttonLevel3; |
@@ -143,12 +142,14 @@ public MainMenu(MenuType menuType, LevelManager levelManager) { |
143 | 142 | buttonLogin.setArcWidth(15); |
144 | 143 | buttonLogin.strokeProperty().bind(Bindings.when(buttonLogin.hoverProperty()).then(Color.web("425622",1.0)).otherwise(Color.web("6E834C",1.0))); |
145 | 144 | buttonLogin.fillProperty().bind(Bindings.when(buttonLogin.pressedProperty()).then(Color.web("425622",1.0)).otherwise(Color.web("6E834C",1.0))); |
146 | | - buttonLogin.setOnMouseClicked(e -> getDialogService().showInputBox("Please enter your name:", answer -> levelManager.setName(answer, c -> { |
147 | | - textLogin.setText("LOGGED IN"); |
148 | | - lockButtons(levelManager.levelProgress); |
149 | | - showHighscores(); |
150 | | - return null; |
151 | | - }))); |
| 145 | + buttonLogin.setOnMouseClicked(e -> getDialogService().showInputBox("Please enter your name:", answer -> { |
| 146 | + levelManager.setName(answer.toLowerCase(), c -> { |
| 147 | + textLogin.setText("LOGGED IN"); |
| 148 | + lockButtons(levelManager.levelProgress); |
| 149 | + showHighscores(); |
| 150 | + return null; |
| 151 | + }); |
| 152 | + })); |
152 | 153 |
|
153 | 154 | // Button Quit |
154 | 155 | var buttonQuit = new Rectangle(SIZE, 60); |
@@ -297,42 +298,6 @@ public MainMenu(MenuType menuType, LevelManager levelManager) { |
297 | 298 | lockButtons(levelManager.levelProgress); |
298 | 299 |
|
299 | 300 | getContentRoot().getChildren().addAll(imageView, vBoxMain); |
300 | | - getContentRoot().setScaleX(0); |
301 | | - getContentRoot().setScaleY(0); |
302 | 301 |
|
303 | | - |
304 | | - |
305 | | - |
306 | | - |
307 | | - |
308 | | - |
309 | | - animation = FXGL.animationBuilder() |
310 | | - |
311 | | - .duration(Duration.seconds(0.66)) |
312 | | - |
313 | | - .interpolator(Interpolators.EXPONENTIAL.EASE_OUT()) |
314 | | - |
315 | | - .scale(getContentRoot()) |
316 | | - |
317 | | - .from(new Point2D(0, 0)) |
318 | | - |
319 | | - .to(new Point2D(1, 1)) |
320 | | - |
321 | | - .build(); |
322 | | - |
323 | | - } |
324 | | - |
325 | | - @Override |
326 | | - public void onCreate() { |
327 | | - animation.setOnFinished(EmptyRunnable.INSTANCE); |
328 | | - animation.stop(); |
329 | | - animation.start(); |
330 | | - |
331 | | - } |
332 | | - |
333 | | - |
334 | | - @Override |
335 | | - protected void onUpdate(double tpf) { |
336 | | - animation.onUpdate(tpf); |
337 | 302 | } |
338 | 303 | } |
0 commit comments