feat: show player id, game id on click
This commit is contained in:
parent
6305c7beda
commit
4c34172e62
@ -20,6 +20,13 @@
|
||||
<td><input v-model="authcode" size="6" maxlength="6" /></td>
|
||||
<td><span class="admin-edit-player__button-generate-code" @click="generateCode">generate code</span></td>
|
||||
</tr>
|
||||
<tr v-if="!showId">
|
||||
<td colspan="3" @click="showId=true"> </td>
|
||||
</tr>
|
||||
<tr v-if="showId">
|
||||
<td>id: </td>
|
||||
<td colspan="2">{{ id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3"> </td>
|
||||
</tr>
|
||||
@ -40,6 +47,7 @@ export default {
|
||||
props: ['player'],
|
||||
data() {
|
||||
return {
|
||||
showId: false,
|
||||
name: '',
|
||||
score: 0,
|
||||
authcode: '',
|
||||
|
@ -20,6 +20,12 @@
|
||||
{{ gameinfo.numQuotesTotal - gameinfo.numQuotesLeft }} / {{ gameinfo.numQuotesTotal }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!showId">
|
||||
<td colspan="3" @click="showId=true"> </td>
|
||||
</tr>
|
||||
<tr v-if="showId">
|
||||
<td colspan="3">{{ gameinfo.id }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</AdminTile>
|
||||
</template>
|
||||
@ -27,6 +33,11 @@
|
||||
<script>
|
||||
export default {
|
||||
props: ['gameinfo', 'players'],
|
||||
data() {
|
||||
return {
|
||||
showId: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async editName() {
|
||||
const name = window.prompt('new game name: ')
|
||||
|
@ -17,6 +17,7 @@ func (gm *Game) initGameInfoJson() *GameInfoJson {
|
||||
defer gm.mu.Unlock()
|
||||
|
||||
gameInfo := GameInfoJson{
|
||||
Id: gm.id,
|
||||
Name: gm.name,
|
||||
Created: gm.created,
|
||||
State: gm.state,
|
||||
@ -27,14 +28,12 @@ func (gm *Game) initGameInfoJson() *GameInfoJson {
|
||||
|
||||
for _, player := range gm.players {
|
||||
gameInfo.Players = append(gameInfo.Players, PlayerInfoJson{
|
||||
Id: player.id,
|
||||
Name: player.name,
|
||||
Created: player.created,
|
||||
LastLoggedIn: player.lastLoggedIn,
|
||||
Score: player.score,
|
||||
IsPlaying: player.isPlaying,
|
||||
IsIdle: player.isIdle,
|
||||
Role: player.role,
|
||||
Id: player.id,
|
||||
Name: player.name,
|
||||
Score: player.score,
|
||||
IsPlaying: player.isPlaying,
|
||||
IsIdle: player.isIdle,
|
||||
Role: player.role,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -62,14 +62,12 @@ func (gm *Game) AddPlayer(usr *user.User) {
|
||||
}
|
||||
|
||||
gm.players[usrId] = playerInfo{
|
||||
id: usrId,
|
||||
name: usr.GetName(),
|
||||
created: usr.GetCreated(),
|
||||
lastLoggedIn: usr.GetLastLoggedIn(),
|
||||
isPlaying: false,
|
||||
isIdle: true,
|
||||
score: 0,
|
||||
role: usr.GetRole(),
|
||||
id: usrId,
|
||||
name: usr.GetName(),
|
||||
isPlaying: false,
|
||||
isIdle: true,
|
||||
score: 0,
|
||||
role: usr.GetRole(),
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,8 +83,6 @@ func (gm *Game) UpdatePlayer(usr *user.User) {
|
||||
}
|
||||
|
||||
player.name = usr.GetName()
|
||||
player.created = usr.GetCreated()
|
||||
player.lastLoggedIn = usr.GetLastLoggedIn()
|
||||
gm.players[usrId] = player
|
||||
}
|
||||
|
||||
|
@ -30,14 +30,12 @@ const (
|
||||
)
|
||||
|
||||
type playerInfo struct {
|
||||
id string
|
||||
name string
|
||||
created int64
|
||||
lastLoggedIn int64
|
||||
isPlaying bool
|
||||
isIdle bool
|
||||
score int
|
||||
role string
|
||||
id string
|
||||
name string
|
||||
isPlaying bool
|
||||
isIdle bool
|
||||
score int
|
||||
role string
|
||||
}
|
||||
|
||||
type Source struct {
|
||||
@ -99,6 +97,7 @@ type PlayerInfoJson struct {
|
||||
}
|
||||
|
||||
type GameInfoJson struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Created int64 `json:"created"`
|
||||
State string `json:"state"`
|
||||
|
Loading…
Reference in New Issue
Block a user