Add Lobby #43
3 changed files with 39 additions and 9 deletions
|
@ -1,12 +1,11 @@
|
||||||
|
import DeckBuilder from "@/views/DeckBuilder.vue";
|
||||||
|
import DraftView from "@/views/Draft.vue";
|
||||||
|
import GameView from "@/views/Game.vue";
|
||||||
|
import Home from "@/views/Home.vue";
|
||||||
|
import Lobby from "@/views/Lobby.vue";
|
||||||
|
import SettingsView from "@/views/Settings.vue";
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import Router from "vue-router";
|
import Router from "vue-router";
|
||||||
import Home from "@/views/Home.vue";
|
|
||||||
import DeckBuilder from "@/views/DeckBuilder.vue";
|
|
||||||
import GameView from "@/views/Game.vue";
|
|
||||||
import DraftView from "@/views/Draft.vue";
|
|
||||||
import Lobby from "@/views/Lobby.vue";
|
|
||||||
import RoomView from "@/views/Room.vue";
|
|
||||||
import SettingsView from "@/views/Settings.vue";
|
|
||||||
|
|
||||||
Vue.use(Router);
|
Vue.use(Router);
|
||||||
|
|
||||||
|
@ -45,6 +44,14 @@ export default new Router({
|
||||||
topnav: "Lobby"
|
topnav: "Lobby"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "/join/:id",
|
||||||
|
name: "lobby-join",
|
||||||
|
component: Lobby,
|
||||||
|
meta: {
|
||||||
|
topnav: "Lobby"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: "/settings",
|
path: "/settings",
|
||||||
name: "settings",
|
name: "settings",
|
||||||
|
|
|
@ -80,7 +80,10 @@
|
||||||
</section>
|
</section>
|
||||||
<section class="room" v-else>
|
<section class="room" v-else>
|
||||||
<section class="info">
|
<section class="info">
|
||||||
Session ID: <span class="selectable">{{ sessionID }}</span>
|
Invite your friends:
|
||||||
|
<span class="selectable"
|
||||||
|
><a :href="inviteLink">{{ inviteLink }}</a></span
|
||||||
|
>
|
||||||
</section>
|
</section>
|
||||||
<section class="players">
|
<section class="players">
|
||||||
Players:
|
Players:
|
||||||
|
@ -251,6 +254,13 @@ export default class Lobby extends Vue {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private mounted() {
|
||||||
|
if ("id" in this.$route.params) {
|
||||||
|
this.joinSessionID = this.$route.params.id;
|
||||||
|
this.join();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async create() {
|
private async create() {
|
||||||
this.busy = true;
|
this.busy = true;
|
||||||
this.startServer({
|
this.startServer({
|
||||||
|
@ -277,5 +287,18 @@ export default class Lobby extends Vue {
|
||||||
private get canJoin(): boolean {
|
private get canJoin(): boolean {
|
||||||
return this.joinSessionID != "";
|
return this.joinSessionID != "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private get inviteLink(): string {
|
||||||
|
let subpath = "";
|
||||||
|
const joinIndex = location.pathname.indexOf("/join");
|
||||||
|
if (joinIndex > 0) {
|
||||||
|
subpath = location.pathname.substring(0, joinIndex);
|
||||||
|
}
|
||||||
|
const lobbyIndex = location.pathname.indexOf("/lobby");
|
||||||
|
if (lobbyIndex > 0) {
|
||||||
|
subpath = location.pathname.substring(0, lobbyIndex);
|
||||||
|
}
|
||||||
|
return `${location.origin}${subpath}/join/${this.sessionID}`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -6,7 +6,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
publicPath: process.env.SUBPATH ? process.env.SUBPATH : "",
|
publicPath: process.env.SUBPATH ? process.env.SUBPATH : "/",
|
||||||
|
|
||||||
pluginOptions: {
|
pluginOptions: {
|
||||||
gitDescribe: {
|
gitDescribe: {
|
||||||
|
|
Loading…
Reference in a new issue