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,
|
||||
@ -29,8 +30,6 @@ func (gm *Game) initGameInfoJson() *GameInfoJson {
|
||||
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,
|
||||
|
@ -64,8 +64,6 @@ 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,
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
@ -32,8 +32,6 @@ const (
|
||||
type playerInfo struct {
|
||||
id string
|
||||
name string
|
||||
created int64
|
||||
lastLoggedIn int64
|
||||
isPlaying bool
|
||||
isIdle bool
|
||||
score int
|
||||
@ -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