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