Add Lobby #43

Merged
hamcha merged 18 commits from feature/lobby into master 2019-10-16 08:31:04 +00:00
Showing only changes of commit 8e519d0a34 - Show all commits

View file

@ -1,15 +1,12 @@
import { ChatMessage, LocalClient, PeerClient, PeerServer } from "@/network";
import { MutationTree } from "vuex"; import { MutationTree } from "vuex";
import {
NetworkState, import { ClientNetworkState, ConnectionStatus, NetworkState, ServerNetworkState } from "./types";
ServerNetworkState,
ClientNetworkState,
ConnectionStatus
} from "./types";
import { LocalClient, PeerServer, PeerClient, ChatMessage } from "@/network";
const mutations: MutationTree<NetworkState> = { const mutations: MutationTree<NetworkState> = {
becomeServer(state, payload: { local: LocalClient; server: PeerServer }) { becomeServer(state, payload: { local: LocalClient; server: PeerServer }) {
state.peerType = "server"; state.peerType = "server";
state.players = [payload.local.name];
(state as ServerNetworkState).local = payload.local; (state as ServerNetworkState).local = payload.local;
(state as ServerNetworkState).server = payload.server; (state as ServerNetworkState).server = payload.server;
}, },