ozai-webui/templates/join_game.html

118 lines
3.1 KiB
HTML

<!-- HTML -->
<!DOCTYPE html>
<html>
<head>
<title>Ozai webui:Join Game</title>
<style>
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: black;
color: white;
color-scheme: dark;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
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;
}
ul {
list-style-type: none;
padding: 0;
}
li {
margin-bottom: 1em;
}
select, input[type="submit"] {
padding: 1em;
margin-top: 1em;
width: 40%;
min-width: 30em;
max-width: 50em;
height: 7vh;
}
input[type="submit"] {
background-color: #3779fd;
border: none;
border-radius: 1em;
text-decoration: none;
margin: 6em 1em;
cursor: pointer;
}
</style>
</head>
<body>
<div>
{% if game_id %}
<p>Selected game to join is: <strong>{{ game_id }}</strong></p>
{% 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">
<option value="spectator" selected>Spectator</option>
{% for player in players %}
<option value="{{ player }}">{{ player }}</option>
{% endfor %}
</select>
<p>game type</p>
<select name="local_game" required>
<option value="True" selected>Local</option>
<option value="False">Online</option>
</select>
<input type="submit" value="Join Game">
</form>
{% else %}
<p>No players found in game, please recreate the game.</p>
{% endif %}
{% if player_name %}
<noscript>
<p>Selected player to join as: {{ player_name }}</p>
<p>manual redirect</p>
<a href="/game/{{ game_id }}/player/{{ player_name }}/local/{{ local_game }}">Go to game</a>
</noscript>
<script>
// Save player name in browser session for auto fill in game page
sessionStorage.setItem('player_name', '{{ player_name }}');
//redirect to game
window.location.href = '/game/{{ game_id }}/player/{{ player_name }}/local/{{ local_game }}';
</script>
{% endif %}
</div>
</body>
</html>