Skip to content

Commit fbcc0f0

Browse files
committed
Fix display names of games in client
1 parent 01275bb commit fbcc0f0

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

games-vue-client/src/components/StartScreen.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<v-col cols="12" md="6" lg="4" v-for="(users, gameType) in lobby" :key="gameType">
1010
<v-card class="games">
1111
<v-toolbar color="cyan" dark>
12-
<v-toolbar-title>{{ gameType }}</v-toolbar-title>
12+
<v-toolbar-title>{{ displayNames[gameType] }}</v-toolbar-title>
1313
<v-spacer></v-spacer>
1414
<!-- <v-btn rounded :disabled="waiting" @click="matchMake(gameType)">Play anyone</v-btn> -->
1515
<v-btn rounded :disabled="waiting" @click="inviteLink(gameType)">Invite with link</v-btn>
@@ -153,6 +153,13 @@ export default {
153153
Socket.send(`{ "type": "ListRequest" }`);
154154
},
155155
computed: {
156+
displayNames() {
157+
let games = {};
158+
supportedGames.enabledGameKeys().forEach(gameType => {
159+
games[gameType] = supportedGames.games[gameType].displayName ? supportedGames.games[gameType].displayName : gameType;
160+
});
161+
return games
162+
},
156163
activeGames() {
157164
return this.$store.getters.activeGames;
158165
},

games-vue-client/src/components/games/common/GameHead.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
<template>
2-
<h1>{{ gameInfo.gameType }} : {{ playerVs }}</h1>
2+
<h1>{{ gameDisplayName }} : {{ playerVs }}</h1>
33
</template>
44
<script>
5+
import supportedGames from "@/supportedGames"
6+
57
export default {
68
name: "GameHead",
79
props: ["gameInfo"],
810
computed: {
11+
gameDisplayName() {
12+
let game = supportedGames.games[this.gameInfo.gameType]
13+
return game.displayName ? game.displayName : this.gameType.gameType
14+
},
915
playerVs: function() {
1016
if (typeof this.gameInfo.players !== "object") {
1117
return "local game";

games-vue-client/src/supportedGames.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,25 @@ const supportedGames = {
3838
routeProps: defaultRouteProps
3939
},
4040
"DSL-Connect4": {
41+
displayName: "Connect Four",
4142
dsl: true,
4243
component: DSLTTT,
4344
routeProps: defaultRouteProps
4445
},
4546
"DSL-Reversi": {
47+
displayName: "Reversi",
4648
dsl: true,
4749
component: DSLTTT,
4850
routeProps: defaultRouteProps
4951
},
5052
"DSL-TTT3D": {
53+
displayName: "3D Tic-Tac-Toe / Connect Four",
5154
dsl: true,
5255
component: TTT3D,
5356
routeProps: defaultRouteProps
5457
},
5558
"DSL-UTTT": {
59+
displayName: "Tic-Tac-Toe Ultimate",
5660
dsl: true,
5761
component: UTTT,
5862
routeProps: defaultRouteProps
@@ -65,6 +69,7 @@ const supportedGames = {
6569
routeProps: defaultRouteProps
6670
},
6771
"DSL-TTT": {
72+
displayName: "Tic-Tac-Toe",
6873
dsl: true,
6974
component: DSLTTT,
7075
routeProps: defaultRouteProps

0 commit comments

Comments
 (0)