Skip to content

Commit

Permalink
Merge pull request #2 from edbourque0/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
edbourque0 authored Feb 13, 2024
2 parents 3acc0cd + df9df96 commit fea6d94
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def reset_param():
tricheur = ''
init_points()
round_number = 0
print('Nouvelle partie crée')

def check_if_connected():
#Regarde si tout les clients sont déconnectés et reset une partie
Expand Down Expand Up @@ -120,6 +119,7 @@ def home():
@app.route('/reset', methods=['POST'])
def reset():
reset_param()
socketio.emit('Nouvelle partie crée')
return redirect(url_for('home'))

@app.route('/salle_attente')
Expand Down
27 changes: 27 additions & 0 deletions static/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,30 @@ button.bouton_retourne {
width: 100%;
justify-content: center;
}

.loader {
width: 48px;
height: 48px;
border-radius: 50%;
display: inline-block;
position: relative;
background: linear-gradient(0deg, rgba(255, 61, 0, 0.2) 33%, #ff3d00 100%);
box-sizing: border-box;
animation: rotation 1s linear infinite;
}
.loader::after {
content: '';
box-sizing: border-box;
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
width: 44px;
height: 44px;
border-radius: 50%;
background: #263238;
}
@keyframes rotation {
0% { transform: rotate(0deg) }
100% { transform: rotate(360deg)}
}
2 changes: 1 addition & 1 deletion templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="fr">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
<script type="text/javascript">
const socket = io.connect("https://game.ebourque.com");
const socket = io.connect("http://192.168.2.39:2827");
</script>
<head>
<meta charset="UTF-8">
Expand Down
2 changes: 1 addition & 1 deletion templates/partie.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="fr">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
<script type="text/javascript">
const socket = io.connect("https://game.ebourque.com");
const socket = io.connect("http://192.168.2.39:2827");
socket.on('Tricheur revélé', function() {
window.location.href = '/resultat';
});
Expand Down
4 changes: 2 additions & 2 deletions templates/resultat.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
<html lang="fr">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
<script type="text/javascript">
const socket = io.connect("https://game.ebourque.com");
const socket = io.connect("http://192.168.2.39:2827");
socket.on('Nouvelle round', function() {
location.reload();
});
socket.on('Nouvelle partie', function() {
socket.on('Nouvelle partie crée', function() {
window.location.href = '/';
});
</script>
Expand Down
14 changes: 13 additions & 1 deletion templates/salle_attente.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.0.1/socket.io.js" integrity="sha512-q/dWJ3kcmjBLU4Qc47E4A9kTB4m3wuTY7vkFJDTZKjTs8jhyGQnaUrxa0Ytd0ssMZhbNua9hE+E7Qv1j+DyZwA==" crossorigin="anonymous"></script>
<script type="text/javascript">
const socket = io.connect("https://game.ebourque.com");
const socket = io.connect("http://192.168.2.39:2827");
socket.on('Joueur en attente', function(joueurs) {
const listeJoueurs = document.querySelector('ul');
listeJoueurs.innerHTML = ''; // Vide la liste actuelle
Expand All @@ -21,6 +21,18 @@
socket.on('Partie commencée', function() {
location.reload();
});
socket.on('Nouvelle partie crée', function() {
window.location.href = '/';
});
document.onreadystatechange = function() {
if (document.readyState !== "complete") {
document.querySelector(
"loader").style.visibility = "visible";
} else {
document.querySelector(
"loader").style.display = "none";
}
};
</script>
</head>
<body>
Expand Down

0 comments on commit fea6d94

Please sign in to comment.