Add calls to connect/createServer
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
91701b594f
commit
c19a1d2df2
1 changed files with 41 additions and 13 deletions
|
@ -4,7 +4,7 @@
|
||||||
<section class="body">
|
<section class="body">
|
||||||
<section id="info">
|
<section id="info">
|
||||||
<b-field label="Your name">
|
<b-field label="Your name">
|
||||||
<b-input v-model="playerName"></b-input>
|
<b-input :disabled="busy" v-model="playerName"></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
</section>
|
</section>
|
||||||
<section id="join">
|
<section id="join">
|
||||||
|
@ -12,22 +12,30 @@
|
||||||
<h1>Join someone's session</h1>
|
<h1>Join someone's session</h1>
|
||||||
</header>
|
</header>
|
||||||
<b-field label="Session ID" class="only-full">
|
<b-field label="Session ID" class="only-full">
|
||||||
<b-input v-model="joinSessionID"></b-input>
|
<b-input :disabled="busy" v-model="joinSessionID"></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
<div class="center submit only-full">
|
<div class="center submit only-full">
|
||||||
<b-button
|
<b-button
|
||||||
type="is-primary"
|
type="is-primary"
|
||||||
@click="join"
|
@click="join"
|
||||||
class="wide"
|
class="wide"
|
||||||
:disabled="!canJoin"
|
:disabled="busy || !canJoin"
|
||||||
>
|
>
|
||||||
Join
|
Join
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
<b-field class="only-mobile full">
|
<b-field class="only-mobile full">
|
||||||
<b-input placeholder="Session ID" v-model="joinSessionID"></b-input>
|
<b-input
|
||||||
|
:disabled="busy"
|
||||||
|
placeholder="Session ID"
|
||||||
|
v-model="joinSessionID"
|
||||||
|
></b-input>
|
||||||
<p class="control">
|
<p class="control">
|
||||||
<b-button type="is-primary" @click="join" :disabled="!canJoin">
|
<b-button
|
||||||
|
type="is-primary"
|
||||||
|
@click="join"
|
||||||
|
:disabled="busy || !canJoin"
|
||||||
|
>
|
||||||
Join
|
Join
|
||||||
</b-button>
|
</b-button>
|
||||||
</p>
|
</p>
|
||||||
|
@ -41,20 +49,28 @@
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<b-field label="Max players">
|
<b-field label="Max players">
|
||||||
<b-numberinput
|
<b-numberinput
|
||||||
|
:disabled="busy"
|
||||||
controls-position="compact"
|
controls-position="compact"
|
||||||
v-model="hostMaxPlayers"
|
v-model="hostMaxPlayers"
|
||||||
|
min="2"
|
||||||
|
max="8"
|
||||||
></b-numberinput>
|
></b-numberinput>
|
||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</div>
|
||||||
<div class="column">
|
<div class="column">
|
||||||
<b-field label="Password">
|
<b-field label="Password">
|
||||||
<b-input v-model="hostPassword"></b-input>
|
<b-input :disabled="busy" v-model="hostPassword"></b-input>
|
||||||
</b-field>
|
</b-field>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="center">
|
<div class="center">
|
||||||
<b-button type="is-primary" @click="create" class="wide">
|
<b-button
|
||||||
|
:disabled="busy"
|
||||||
|
type="is-primary"
|
||||||
|
@click="create"
|
||||||
|
class="wide"
|
||||||
|
>
|
||||||
Create
|
Create
|
||||||
</b-button>
|
</b-button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -164,7 +180,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from "vue-property-decorator";
|
import { Component, Vue } from "vue-property-decorator";
|
||||||
import TopNav from "@/components/Navigation/TopNav.vue";
|
import TopNav from "@/components/Navigation/TopNav.vue";
|
||||||
import { StartServerOptions } from "@/store/network/types";
|
import { StartServerOptions, ConnectOptions } from "@/store/network/types";
|
||||||
import { Action } from "vuex-class";
|
import { Action } from "vuex-class";
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
@ -177,12 +193,14 @@ export default class Lobby extends Vue {
|
||||||
private hostMaxPlayers!: number;
|
private hostMaxPlayers!: number;
|
||||||
private hostPassword!: string;
|
private hostPassword!: string;
|
||||||
private joinSessionID!: string;
|
private joinSessionID!: string;
|
||||||
private sets!: string[];
|
private busy!: boolean;
|
||||||
private setNames!: Record<string, string>;
|
|
||||||
|
|
||||||
@Action("startServer", { namespace: "network" })
|
@Action("startServer", { namespace: "network" })
|
||||||
private startServer!: (options: StartServerOptions) => void;
|
private startServer!: (options: StartServerOptions) => void;
|
||||||
|
|
||||||
|
@Action("connect", { namespace: "network" })
|
||||||
|
private connect!: (options: ConnectOptions) => void;
|
||||||
|
|
||||||
private data() {
|
private data() {
|
||||||
return {
|
return {
|
||||||
playerName:
|
playerName:
|
||||||
|
@ -190,6 +208,7 @@ export default class Lobby extends Vue {
|
||||||
Math.random()
|
Math.random()
|
||||||
.toString()
|
.toString()
|
||||||
.slice(2, 8),
|
.slice(2, 8),
|
||||||
|
busy: false,
|
||||||
hostMaxPlayers: 8,
|
hostMaxPlayers: 8,
|
||||||
hostPassword: "",
|
hostPassword: "",
|
||||||
joinSessionID: ""
|
joinSessionID: ""
|
||||||
|
@ -197,18 +216,27 @@ export default class Lobby extends Vue {
|
||||||
}
|
}
|
||||||
|
|
||||||
private async create() {
|
private async create() {
|
||||||
|
this.busy = true;
|
||||||
this.startServer({
|
this.startServer({
|
||||||
playerInfo: {
|
playerInfo: {
|
||||||
name: this.playerName
|
name: this.playerName
|
||||||
},
|
},
|
||||||
roomInfo: {
|
roomInfo: {
|
||||||
max_players: 8,
|
max_players: this.hostMaxPlayers,
|
||||||
password: ""
|
password: this.hostPassword
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async join() {}
|
private async join() {
|
||||||
|
this.busy = true;
|
||||||
|
this.connect({
|
||||||
|
serverID: this.joinSessionID,
|
||||||
|
playerInfo: {
|
||||||
|
name: this.playerName
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private get canJoin(): boolean {
|
private get canJoin(): boolean {
|
||||||
return this.joinSessionID != "";
|
return this.joinSessionID != "";
|
||||||
|
|
Loading…
Reference in a new issue