ozai-webui/templates/join_game.html

118 lines
3.1 KiB
HTML
Raw Normal View History

2024-02-14 21:52:29 +01:00
<!-- HTML -->
<!DOCTYPE html>
<html>
<head>
2024-02-15 12:58:18 +01:00
<title>Ozai webui:Join Game</title>
<style>
2024-02-24 21:33:28 +01:00
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
2024-03-21 23:32:44 +01:00
background-color: black;
color: white;
color-scheme: dark;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
2024-02-24 21:33:28 +01:00
}
2024-03-21 23:32:44 +01:00
div{
margin-top: 20vh;
}
div,form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
flex-wrap: wrap; /* Allow the flex items to wrap onto the next line */
width: 90vw;
}
2024-02-24 21:33:28 +01:00
ul {
list-style-type: none;
padding: 0;
}
li {
2024-03-21 23:32:44 +01:00
margin-bottom: 1em;
2024-02-24 21:33:28 +01:00
}
select, input[type="submit"] {
2024-03-21 23:32:44 +01:00
padding: 1em;
margin-top: 1em;
width: 40%;
min-width: 30em;
max-width: 50em;
2024-03-22 00:10:02 +01:00
height: 7vh;
2024-02-24 21:33:28 +01:00
}
2024-03-21 23:32:44 +01:00
2024-02-24 21:33:28 +01:00
input[type="submit"] {
background-color: #3779fd;
border: none;
2024-03-21 23:32:44 +01:00
border-radius: 1em;
2024-02-24 21:33:28 +01:00
text-decoration: none;
2024-03-21 23:32:44 +01:00
margin: 6em 1em;
2024-02-24 21:33:28 +01:00
cursor: pointer;
}
2024-03-21 23:32:44 +01:00
2024-02-15 12:58:18 +01:00
</style>
2024-02-14 21:52:29 +01:00
</head>
<body>
2024-03-21 23:32:44 +01:00
<div>
2024-02-14 21:52:29 +01:00
{% if game_id %}
2024-02-24 21:33:28 +01:00
<p>Selected game to join is: <strong>{{ game_id }}</strong></p>
2024-02-14 21:52:29 +01:00
{% endif %}
{% if players %}
<p>Players in game:</p>
<ul>
{% for player in players %}
<li>{{ player }}</li>
{% endfor %}
</ul>
<!-- form to select one player to play as, or to select spectator too play as -->
<form method="POST" action="/join_game/{{ game_id }}">
<select name="player">
2024-02-24 21:33:28 +01:00
<option value="spectator" selected>Spectator</option>
2024-02-14 21:52:29 +01:00
{% for player in players %}
<option value="{{ player }}">{{ player }}</option>
{% endfor %}
</select>
2024-03-22 00:10:02 +01:00
<p>game type</p>
<select name="local_game" required>
<option value="True" selected>Local</option>
<option value="False">Online</option>
</select>
2024-02-14 21:52:29 +01:00
<input type="submit" value="Join Game">
</form>
2024-03-21 23:32:44 +01:00
2024-02-14 21:52:29 +01:00
{% else %}
<p>No players found in game, please recreate the game.</p>
{% endif %}
2024-03-21 23:32:44 +01:00
2024-02-14 21:52:29 +01:00
{% if player_name %}
2024-03-21 23:32:44 +01:00
<noscript>
<p>Selected player to join as: {{ player_name }}</p>
<p>manual redirect</p>
2024-03-22 00:10:02 +01:00
<a href="/game/{{ game_id }}/player/{{ player_name }}/local/{{ local_game }}">Go to game</a>
2024-03-21 23:32:44 +01:00
</noscript>
2024-02-14 21:52:29 +01:00
<script>
// Save player name in browser session for auto fill in game page
sessionStorage.setItem('player_name', '{{ player_name }}');
//redirect to game
2024-03-22 00:10:02 +01:00
window.location.href = '/game/{{ game_id }}/player/{{ player_name }}/local/{{ local_game }}';
2024-02-14 21:52:29 +01:00
</script>
{% endif %}
2024-03-21 23:32:44 +01:00
</div>
2024-02-14 21:52:29 +01:00
</body>
</html>