Skip to content

Commit

Permalink
Properly pass settings
Browse files Browse the repository at this point in the history
  • Loading branch information
lorgan3 committed Jun 12, 2024
1 parent 303df87 commit 90b39ed
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,29 @@ import { RouteRecordRaw, createRouter, createWebHashHistory } from "vue-router";
import Host from "./components/Host.vue";
import Join from "./components/Join.vue";
import Spellbook from "./components/Spellbook.vue";
import Team from "./components/Team.vue";
import MainMenu from "./components/MainMenu.vue";
import Builder from "./components/Builder.vue";
import Header from "./components/Header.vue";
import { Config, Map } from "./data/map";
import { AssetsContainer } from "./util/assets/assetsContainer";
import Game from "./components/Game.vue";
import Credits from "./components/Credits.vue";
import { Settings } from "./data/network/types";
import SettingsComponent from "./components/Settings.vue";

new AssetsContainer();
let config: Config;
let selectedMap: Map;
let selectedSettings: Settings;

const onPlay = async (key: string, map: Map | Config) => {
const onPlay = async (key: string, map: Map | Config, settings: Settings) => {
if (map instanceof Map) {
selectedMap = map;
} else {
config = map;
selectedMap = await Map.fromConfig(map);
}
selectedSettings = settings;
router.replace(`/game/${key}`);
};

Expand Down Expand Up @@ -68,6 +70,7 @@ const routes: RouteRecordRaw[] = [
component: Game,
props: () => ({
selectedMap: selectedMap!,
settings: selectedSettings!,
}),
beforeEnter: (to) => {
if (!selectedMap) {
Expand Down

0 comments on commit 90b39ed

Please sign in to comment.