Skip to content

Commit 0f87922

Browse files
committed
Finish Leaderboard
1 parent 29eaccb commit 0f87922

File tree

7 files changed

+62
-8
lines changed

7 files changed

+62
-8
lines changed

README.MD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Je mehr Konfetti man erzeugt desto bessere Upgrades können für den eigenen Loc
2020
#### Verwenden
2121

2222
Der Leaderboard REST Server ist unter https://sim-locher.herokuapp.com/ erreichbar.
23+
Es zeigt im Moment ein Leaderboard an. Richtig Nice.
2324

2425
Folgende HTTP Requests können verwendet werden(Alle Requests verwenden XML als Payload Format):
2526

server/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ mongoose.connection.once("open", () => {
6262

6363
// Weiterleitung auf GitHub für index Dokument
6464
.get("/github", (req, res) => {
65-
return res.redirect("https://github.com/PatrickSachs/sim-locher/");
65+
return res.redirect("https://github.com/PatrickSachs/sim-locher/releases/latest");
6666
})
6767

6868
// Score per POST speichern. (POST /ap/leaderboard { "name": "Spielername", "punkte": 3431 })

server/static/index.html

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,22 @@ <h1>👑Leaderboard:👑</h1>
5757
document.body.appendChild(para);
5858

5959
}
60+
61+
var urlAddition = window.location.search;
62+
if (urlAddition == "?nobutton") {
63+
var footer = document.getElementsByClassName("footer");
64+
footer[0].classList.add("notShow");
65+
}
66+
6067
})
6168

6269
}
6370
getLeaderboard();
6471
</script>
65-
66-
6772
</body>
6873

74+
<div class="footer">
75+
<a href="/github">Download des Spiels</a>
76+
</div>
77+
6978
</html>

server/static/resources/css/style.css

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ p {
88
text-align: center;
99
text-shadow: 2px 2px 4px black;
1010
font-size: 15px;
11-
1211
}
1312

1413
h1 {
@@ -40,4 +39,23 @@ img {
4039
#number3 {
4140
color: #9b2903;
4241
font-size: 17px;
42+
}
43+
44+
.footer {
45+
position: absolute;
46+
right: 0;
47+
bottom: 0;
48+
left: 0;
49+
padding: 1rem;
50+
background-color: darkgray;
51+
text-align: center;
52+
}
53+
54+
.notShow {
55+
display: none;
56+
}
57+
58+
a {
59+
color: black;
60+
text-decoration: none;
4361
}

server/static/test.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/main/java/de/wolc/gui/ItemShopMenu.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,11 @@ private Node guiButtons() {
139139
});
140140
Button leaderboardButton = new Button("🏅 Leaderboard 🏅");
141141
leaderboardButton.addEventHandler(ActionEvent.ACTION, (ActionEvent actionEvent) -> {
142-
this.leaderboard();
142+
Stage stageLeaderboard = new Stage();
143+
LeaderboardMenu sm = new LeaderboardMenu();
144+
stageLeaderboard.setScene(sm.LeaderboardScene(stageLeaderboard));
145+
stageLeaderboard.centerOnScreen();
146+
stageLeaderboard.show();
143147
});
144148
grid.add(backButton, 0, 0);
145149
grid.add(continueButton, 1, 0);
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package de.wolc.gui;
2+
3+
import javafx.stage.Stage;
4+
import javafx.scene.Scene;
5+
import javafx.scene.web.WebView;
6+
7+
public class LeaderboardMenu {
8+
private final String windowTitle = "LEADERBOARD von World of Lochercraft";
9+
10+
public Scene LeaderboardScene(Stage stage) {
11+
final WebView webview = new WebView();
12+
webview.getEngine().load("https://sim-locher.herokuapp.com/?nobutton");
13+
webview.setPrefSize(640, 390);
14+
15+
Scene sceneMainWindow = new Scene(webview);
16+
17+
// Updating the Title
18+
stage.setTitle(windowTitle);
19+
stage.setOnCloseRequest(e -> {
20+
webview.getEngine().load(null);
21+
});
22+
23+
return sceneMainWindow;
24+
}
25+
}

0 commit comments

Comments
 (0)