File tree 4 files changed +25
-7
lines changed
webapp-vue/src/components
4 files changed +25
-7
lines changed Original file line number Diff line number Diff line change 71
71
:label =" `${variable[0].toUpperCase()}${variable.slice(1, -1)} name`"
72
72
/>
73
73
</v-col >
74
+ <v-col v-if =" variable === 'settings'" >
75
+ <v-text-field
76
+ v-model.trim =" info[variable][i].faction"
77
+ :label =" `${variable[0].toUpperCase()}${variable.slice(1, -1)} faction`"
78
+ />
79
+ </v-col >
74
80
<v-col cols =" auto" v-if =" variable !== 'expansions'" >
75
81
<v-select
76
82
:items =" [
@@ -202,6 +208,13 @@ export default class GameEdit extends Vue {
202
208
this .info .rules = (this .$refs .rules as any ).invoke (" getMarkdown" );
203
209
this .info .description = (this .$refs .description as any ).invoke (" getMarkdown" );
204
210
211
+ // Remove empty faction strings
212
+ for (const setting of this .info .settings ?? []) {
213
+ if (! setting .faction ) {
214
+ delete setting .faction ;
215
+ }
216
+ }
217
+
205
218
this .$emit (" game:update" , this .info );
206
219
}
207
220
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export interface ViewerInfo {
24
24
replayable : boolean ;
25
25
}
26
26
27
- type GameInfoOptions = Array < {
27
+ type GameInfoOption = {
28
28
label : string ;
29
29
type : "checkbox" | "select" ;
30
30
name : string ;
@@ -36,7 +36,7 @@ type GameInfoOptions = Array<{
36
36
}
37
37
]
38
38
| null ;
39
- } > ;
39
+ } ;
40
40
export interface GameInfo {
41
41
_id : {
42
42
game : string ;
@@ -58,13 +58,13 @@ export interface GameInfo {
58
58
} ;
59
59
60
60
// [{label: "Do not fill planets with faction color", name: 'noFactionFill', type: 'checkbox'}]
61
- preferences : GameInfoOptions ;
61
+ preferences : GameInfoOption [ ] ;
62
62
63
63
// Player settings that affect the engine - like autocharge
64
- settings : GameInfoOptions ;
64
+ settings : Array < GameInfoOption & { faction ?: string } > ;
65
65
66
66
// [{label: "Last player <i>rotates</i> sectors before faction selection", name: "advancedRules", type: 'checkbox'}]
67
- options : GameInfoOptions ;
67
+ options : GameInfoOption [ ] ;
68
68
69
69
// [2, 3, 4]
70
70
players : number [ ] ;
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ const repr = {
92
92
entryPoint : String ,
93
93
} ,
94
94
preferences : optionSchema ,
95
- settings : optionSchema ,
95
+ settings : [ { ... optionSchema [ 0 ] , faction : String } ] ,
96
96
options : optionSchema ,
97
97
players : [ Number ] ,
98
98
expansions : [
Original file line number Diff line number Diff line change 62
62
63
63
<div class =" mt-75" v-if =" gameInfo && gameInfo.settings.length > 0 && game.status === 'active' && settings" >
64
64
<h3 >Settings</h3 >
65
- <div v-for =" pref in gameInfo.settings" :key =" pref.name" >
65
+ <div
66
+ v-for =" pref in gameInfo.settings.filter(
67
+ (setting) => !setting.faction || setting.faction === playerUser.faction
68
+ )"
69
+ :key =" pref.name"
70
+ >
66
71
<template v-if =" pref .type === ' checkbox' " >
67
72
<b-checkbox v-model =" settings[pref.name]" @change =" postSettings" >
68
73
{{ pref.label }}
You can’t perform that action at this time.
0 commit comments