mirror of
https://github.com/kmitresse/Cards-Rush.git
synced 2026-07-09 13:27:45 +00:00
feat: dev-web - begin modal and new-game front
This commit is contained in:
@@ -34,7 +34,7 @@ public class MainMenuServlet extends HttpServlet {
|
|||||||
// }
|
// }
|
||||||
request.setAttribute("current", "main-menu");
|
request.setAttribute("current", "main-menu");
|
||||||
manageNewGame(request, response, user);
|
manageNewGame(request, response, user);
|
||||||
//manageStatistiques(request, response, user);
|
manageStatistiques(request, response, user);
|
||||||
request.getRequestDispatcher("/WEB-INF/views/main-menu.jsp").forward(request, response);
|
request.getRequestDispatcher("/WEB-INF/views/main-menu.jsp").forward(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,9 +60,7 @@ public class MainMenuServlet extends HttpServlet {
|
|||||||
|
|
||||||
private void manageStatistiques(HttpServletRequest request, HttpServletResponse response, User sessionUser) throws IOException, ServletException {
|
private void manageStatistiques(HttpServletRequest request, HttpServletResponse response, User sessionUser) throws IOException, ServletException {
|
||||||
List<Game> games = new ArrayList<Game>();
|
List<Game> games = new ArrayList<Game>();
|
||||||
System.out.println(sessionUser.toString());
|
if (sessionUser != null && sessionUser.getPlayedGames() != null) {
|
||||||
System.out.println(sessionUser.getPlayedGames().size());
|
|
||||||
if (sessionUser.getPlayedGames() != null) {
|
|
||||||
for (Player player : sessionUser.getPlayedGames()) {
|
for (Player player : sessionUser.getPlayedGames()) {
|
||||||
Game game = player.getGame();
|
Game game = player.getGame();
|
||||||
game.sortPlayersByScore();
|
game.sortPlayersByScore();
|
||||||
|
|||||||
@@ -5,13 +5,20 @@
|
|||||||
|
|
||||||
<div id="newGameModal" class="modal-wrapper" style="display: none">
|
<div id="newGameModal" class="modal-wrapper" style="display: none">
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<a href="#close" title="Close" class="close">×</a>
|
<a href="#" title="Close" class="close">×</a>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2>Nouvelle Partie</h2>
|
<h2>Nouvelle Partie</h2>
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div id="settings">
|
<div id="settings">
|
||||||
<form>
|
<form>
|
||||||
|
<label>Difficulté</label>
|
||||||
|
<div class="difficulty-radio">
|
||||||
|
<input type="radio" name="difficulty" value="easy" id="easy" checked="checked" />
|
||||||
|
<label for="easy">Facile</label>
|
||||||
|
<input type="radio" name="difficulty" value="hard" id="hard" />
|
||||||
|
<label for="hard">Difficile</label>
|
||||||
|
</div>
|
||||||
<label for="timer">Timer</label>
|
<label for="timer">Timer</label>
|
||||||
<input type="number" id="timer" name="timer" min="<%= Game.TIMER_MIN %>" max="<%= Game.TIMER_MAX %>" value="<%= Game.TIMER_MIN %>">
|
<input type="number" id="timer" name="timer" min="<%= Game.TIMER_MIN %>" max="<%= Game.TIMER_MAX %>" value="<%= Game.TIMER_MIN %>">
|
||||||
<label for="nbColors">Nb couleurs</label>
|
<label for="nbColors">Nb couleurs</label>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<% ArrayList<Game> games = (ArrayList<Game>) request.getAttribute("games") != null ? (ArrayList<Game>) request.getAttribute("games") : new ArrayList<>() ; %>
|
<% ArrayList<Game> games = (ArrayList<Game>) request.getAttribute("games") != null ? (ArrayList<Game>) request.getAttribute("games") : new ArrayList<>() ; %>
|
||||||
<div id="statisticsModal" class="modal-wrapper" style="display: none">
|
<div id="statisticsModal" class="modal-wrapper" style="display: none">
|
||||||
<div class="modal">
|
<div class="modal">
|
||||||
<a href="#close" title="Close" class="close">×</a>
|
<a href="#" title="Close" class="close">×</a>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<h2>Statistiques</h2>
|
<h2>Statistiques</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,24 +25,24 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nombre de parties gagnées:</th>
|
<th>Nombre de parties gagnées:</th>
|
||||||
<td><%= user.getNbWin() %>, <%= user.getWinRate()%></td>
|
<td><%= user.getNbWin() %>, <%= user.getWinRate()%>%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nombre de clicks total:</th>
|
<th>Nombre de clics total:</th>
|
||||||
<td><%= user.getNbClicks() %></td>
|
<td><%= user.getNbClicks() %></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nombre de clicks corrects:</th>
|
<th>Nombre de clics corrects:</th>
|
||||||
<td><%= user.getNbRightClicks() %>, <%= user.getRightClickPercentRate()%></td>
|
<td><%= user.getNbRightClicks() %>, <%= user.getRightClickPercentRate()%>%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nombre de clicks rapides:</th>
|
<th>Nombre de clics rapides:</th>
|
||||||
<td><%= user.getNbRapidClicks() %>, <%= user.getRapidClickPercentRate()%></td>
|
<td><%= user.getNbRapidClicks() %>, <%= user.getRapidClickPercentRate()%>%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div id="game-selection">
|
<div id="game-selection">
|
||||||
//listes de game dont chacune est un onglet déroulante des joueurs
|
<%-- listes de game dont chacune est un onglet déroulante des joueurs--%>
|
||||||
<h2>Statistiques par jeu</h2>
|
<h2>Statistiques par jeu</h2>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -69,9 +69,9 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>Username</th>
|
<th>Username</th>
|
||||||
<th>Score</th>
|
<th>Score</th>
|
||||||
<th>Nombre de click</th>
|
<th>Nombre de clic</th>
|
||||||
<th>Nombre de click corrects</th>
|
<th>Nombre de clic corrects</th>
|
||||||
<th>Nombre de click rapides</th>
|
<th>Nombre de clic rapides</th>
|
||||||
</tr>
|
</tr>
|
||||||
<%
|
<%
|
||||||
for (Player player : game.getPlayers()) {
|
for (Player player : game.getPlayers()) {
|
||||||
@@ -80,8 +80,8 @@
|
|||||||
<td><%= player.getUser().getUsername() %></td>
|
<td><%= player.getUser().getUsername() %></td>
|
||||||
<td><%= player.getScore() %></td>
|
<td><%= player.getScore() %></td>
|
||||||
<td><%= player.getClickCount() %></td>
|
<td><%= player.getClickCount() %></td>
|
||||||
<td><%= player.getRightClickCount() %>, <%= player.getRatioRightClick() %></td>
|
<td><%= player.getRightClickCount() %>, <%= player.getRatioRightClick() %>%</td>
|
||||||
<td><%= player.getRapidClickCount() %>, <%= player.getRatioRapidClick() %></td>
|
<td><%= player.getRapidClickCount() %>, <%= player.getRatioRapidClick() %>%</td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
</table>
|
</table>
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
<title>Cards Rush</title>
|
<title>Cards Rush</title>
|
||||||
<link href="${pageContext.request.contextPath}/static/css/global.css" rel="stylesheet">
|
<link href="${pageContext.request.contextPath}/static/css/global.css" rel="stylesheet">
|
||||||
<link href="${pageContext.request.contextPath}/static/css/main-menu.css" rel="stylesheet">
|
<link href="${pageContext.request.contextPath}/static/css/main-menu.css" rel="stylesheet">
|
||||||
|
<link href="${pageContext.request.contextPath}/static/css/new-game.css" rel="stylesheet">
|
||||||
<link href="${pageContext.request.contextPath}/static/css/modal.css" rel="stylesheet">
|
<link href="${pageContext.request.contextPath}/static/css/modal.css" rel="stylesheet">
|
||||||
<script src="${pageContext.request.contextPath}/static/js/modal.js" defer></script>
|
<script src="${pageContext.request.contextPath}/static/js/modal.js" defer></script>
|
||||||
<script src="${pageContext.request.contextPath}/static/js/new-game.js" defer></script>
|
<script src="${pageContext.request.contextPath}/static/js/new-game.js" defer></script>
|
||||||
|
|||||||
@@ -1,62 +1,73 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600');
|
||||||
|
|
||||||
.modal-toggle {
|
.modal-toggle {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-wrapper {
|
.modal-wrapper {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 100px;
|
||||||
right: 0;
|
right: 90px;
|
||||||
bottom: 0;
|
bottom: 146px;
|
||||||
left: 0;
|
left: 90px;
|
||||||
border-radius: 20px;
|
background: rgba(255, 255, 255, 0.31);
|
||||||
border: 1px solid rgba(208, 73, 73, 0.83);
|
border-radius: 16px;
|
||||||
background: rgba(208, 73, 73, 0.38);
|
box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
|
||||||
backdrop-filter: blur(14.399999618530273px);
|
backdrop-filter: blur(12.2px);
|
||||||
|
-webkit-backdrop-filter: blur(12.2px);
|
||||||
|
border: 1px solid rgba(255, 255, 255, 0.63);
|
||||||
display: none;
|
display: none;
|
||||||
|
|
||||||
-webkit-transition: opacity 0.2s ease-in;
|
-webkit-transition: opacity 0.2s ease-in;
|
||||||
-moz-transition: opacity 0.2s ease-in;
|
-moz-transition: opacity 0.2s ease-in;
|
||||||
transition: opacity 0.2s ease-in;
|
transition: opacity 0.2s ease-in;
|
||||||
|
|
||||||
pointer-events: auto;
|
pointer-events: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
.modal-wrapper > div {
|
.modal-wrapper > div {
|
||||||
width: 460px;
|
width: 95%;
|
||||||
height: 40%;
|
height: 95%;
|
||||||
position: absolute;
|
position: relative;
|
||||||
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
|
|
||||||
margin: auto;
|
margin: 50px 15px;
|
||||||
|
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #fff;
|
|
||||||
|
|
||||||
display: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap : 20px;
|
||||||
|
border: 1px solid rgba(0, 0, 0, 0.83);
|
||||||
|
}
|
||||||
|
|
||||||
|
#settings {
|
||||||
|
border-right: 1px solid rgba(0, 0, 0, 0.83);
|
||||||
|
}
|
||||||
|
|
||||||
|
form {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
.close {
|
.close {
|
||||||
background: #606061;
|
background: var(--Button-Light-Default-Background);
|
||||||
color: #ffffff;
|
color: #FFFFFF;
|
||||||
line-height: 25px;
|
line-height: 30px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: -12px;
|
right: 20px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
top: -10px;
|
top: -10px;
|
||||||
width: 24px;
|
width: 30px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
-webkit-border-radius: 12px;
|
-webkit-border-radius: 33px;
|
||||||
-moz-border-radius: 12px;
|
-moz-border-radius: 33px;
|
||||||
border-radius: 12px;
|
border-radius: 33px;
|
||||||
}
|
font-size: xx-large;
|
||||||
|
|
||||||
.close:hover {
|
|
||||||
background: #00d9ff;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,62 @@
|
|||||||
|
.difficulty-radio {
|
||||||
|
margin: 0 0 1.5rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: 0;
|
||||||
|
display: flex;
|
||||||
|
flex-flow: row nowrap;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: stretch;
|
||||||
|
}
|
||||||
|
.difficulty-radio input {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
position: absolute;
|
||||||
|
left: -9999px;
|
||||||
|
}
|
||||||
|
.difficulty-radio input + label {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0.75rem 2rem;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
background-color: var(--Button-Light-Default-Background);
|
||||||
|
font-size: 1rem;
|
||||||
|
line-height: 140%;
|
||||||
|
font-weight: 600;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 0 0 rgba(255, 255, 255, 0);
|
||||||
|
transition: border-color 0.15s ease-out, color 0.25s ease-out, background-color 0.15s ease-out, box-shadow 0.15s ease-out;
|
||||||
|
/* ADD THESE PROPERTIES TO SWITCH FROM AUTO WIDTH TO FULL WIDTH */
|
||||||
|
/*flex: 0 0 50%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
*/
|
||||||
|
/* ----- */
|
||||||
|
}
|
||||||
|
.difficulty-radio input + label:first-of-type {
|
||||||
|
border-radius: 6px 0 0 6px;
|
||||||
|
border-right: none;
|
||||||
|
}
|
||||||
|
.difficulty-radio input + label:last-of-type {
|
||||||
|
border-radius: 0 6px 6px 0;
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.difficulty-radio input:checked + label {
|
||||||
|
background-color: #4b9dea;
|
||||||
|
color: #fff;
|
||||||
|
box-shadow: 0 0 10px rgba(102, 179, 251, .5);
|
||||||
|
border-color: #4b9dea;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 800px) {
|
||||||
|
.difficulty-radio input + label {
|
||||||
|
padding: 0.75rem 0.25rem;
|
||||||
|
flex: 0 0 50%;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user