Begin implementing game joining
This commit is contained in:
parent
7db70bc4ec
commit
c5878a8334
1 changed files with 25 additions and 6 deletions
|
|
@ -1,10 +1,26 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import SciFiButton from "../components/SciFi-Button.svelte";
|
import SciFiButton from "../components/SciFi-Button.svelte";
|
||||||
|
|
||||||
|
const invalidUsername = /[^A-Z\-\_\ ]/i;
|
||||||
|
|
||||||
function testHandler() {
|
/** Prompts a user for a name until it's valid */
|
||||||
console.log(`Hello there!`);
|
function getUsername() {
|
||||||
|
do {
|
||||||
|
var name = prompt("What name do you want to appear in game?");
|
||||||
|
if (name.length == 0) {
|
||||||
|
return null;
|
||||||
|
};
|
||||||
|
} while (name.match(invalidUsername));
|
||||||
|
return name;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function hostGame() {
|
||||||
|
let username = getUsername();
|
||||||
|
};
|
||||||
|
|
||||||
|
function joinGame() {};
|
||||||
|
|
||||||
|
function singleplayerGame() {};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
|
|
@ -14,12 +30,12 @@ function testHandler() {
|
||||||
<h2>Multiplayer</h2>
|
<h2>Multiplayer</h2>
|
||||||
<div class="flex-row">
|
<div class="flex-row">
|
||||||
<SciFiButton
|
<SciFiButton
|
||||||
handler={testHandler}
|
on:click={joinGame}
|
||||||
>
|
>
|
||||||
Join Game
|
Join Game
|
||||||
</SciFiButton>
|
</SciFiButton>
|
||||||
<SciFiButton
|
<SciFiButton
|
||||||
handler={testHandler}
|
on:click={hostGame}
|
||||||
>
|
>
|
||||||
Host Game
|
Host Game
|
||||||
</SciFiButton>
|
</SciFiButton>
|
||||||
|
|
@ -28,9 +44,12 @@ function testHandler() {
|
||||||
<br>
|
<br>
|
||||||
<div class="sci-fi-box">
|
<div class="sci-fi-box">
|
||||||
<h2>Singleplayer</h2>
|
<h2>Singleplayer</h2>
|
||||||
<div class="flex-row">
|
<p>
|
||||||
|
Coming Soon
|
||||||
|
</p>
|
||||||
|
<div style="display: none;" class="flex-row">
|
||||||
<SciFiButton
|
<SciFiButton
|
||||||
handler={testHandler}
|
on:click={singleplayerGame}
|
||||||
>
|
>
|
||||||
Start Game
|
Start Game
|
||||||
</SciFiButton>
|
</SciFiButton>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue