Add player name

This commit is contained in:
Hamcha 2019-09-23 15:10:26 +02:00
parent 01ff742207
commit 4306045991
Signed by: hamcha
GPG key ID: 44AD3571EB09A39E

View file

@ -2,7 +2,30 @@
<section class="lobby"> <section class="lobby">
<TopNav /> <TopNav />
<section class="body"> <section class="body">
<section class="host"> <section id="info">
<b-field label="Your name">
<b-input v-model="playerName"></b-input>
</b-field>
</section>
<section id="join">
<header>
<h1>Join someone's session</h1>
</header>
<b-field label="Session ID">
<b-input v-model="joinSessionID"></b-input>
</b-field>
<div class="center submit">
<b-button
type="is-primary"
@click="join"
class="wide"
:disabled="!canJoin"
>
Join
</b-button>
</div>
</section>
<section id="host">
<header> <header>
<h1>Host a new session</h1> <h1>Host a new session</h1>
</header> </header>
@ -49,24 +72,16 @@
</b-field> </b-field>
</div> </div>
<div class="center"> <div class="center">
<b-button type="is-primary" class="wide" :disabled="!canHost"> <b-button
type="is-primary"
@click="create"
class="wide"
:disabled="!canHost"
>
Create Create
</b-button> </b-button>
</div> </div>
</section> </section>
<section class="join">
<header>
<h1>Join someone's session</h1>
</header>
<b-field label="Session ID">
<b-input v-model="joinSessionID"></b-input>
</b-field>
<div class="center submit">
<b-button type="is-primary" class="wide" :disabled="!canJoin">
Join
</b-button>
</div>
</section>
</section> </section>
</section> </section>
</template> </template>
@ -85,16 +100,33 @@
.body { .body {
flex: 1; flex: 1;
display: flex; display: grid;
padding: 10px; padding: 10px;
padding-top: 0; padding-top: 0;
grid-template: 150px 1fr / 1fr 1fr;
#info {
grid-row: 1;
grid-column: 1 / end;
}
#join,
#host {
grid-row: 2;
}
#join {
grid-column: 2;
}
#host {
grid-column: 1;
}
section { section {
margin: 10px; margin: 10px;
border: 1px solid rgba($white, 20%); border: 1px solid rgba($white, 20%);
border-radius: 10px; border-radius: 10px;
padding: 20px; padding: 20px;
flex: 1;
header { header {
font-family: $fantasy; font-family: $fantasy;
h1 { h1 {
@ -125,13 +157,19 @@
@media (max-width: 500px) { @media (max-width: 500px) {
.body { .body {
grid-template: 120px 1fr 1fr /1fr;
#info,
#join,
#host {
grid-row: auto;
grid-column: auto;
}
section { section {
padding: 10px; padding: 10px;
header h1 { header h1 {
font-size: 14pt; font-size: 14pt;
} }
} }
flex-flow: column-reverse;
} }
} }
</style> </style>
@ -147,6 +185,7 @@ import { allSets, setNames } from "../mlpccg";
} }
}) })
export default class Lobby extends Vue { export default class Lobby extends Vue {
private playerName!: string;
private hostType!: string; private hostType!: string;
private hostDraftType!: string; private hostDraftType!: string;
private hostDraftSet!: string; private hostDraftSet!: string;
@ -157,6 +196,11 @@ export default class Lobby extends Vue {
private data() { private data() {
return { return {
playerName:
"Guest-" +
Math.random()
.toString()
.slice(2, 8),
hostType: "game", hostType: "game",
hostDraftType: "set", hostDraftType: "set",
hostDraftSet: "FF", hostDraftSet: "FF",
@ -167,6 +211,10 @@ export default class Lobby extends Vue {
}; };
} }
private async create() {}
private async join() {}
private get canHost(): boolean { private get canHost(): boolean {
switch (this.hostType) { switch (this.hostType) {
case "game": case "game":