add spectate button
This commit is contained in:
parent
c05e2a69e2
commit
d9c3493661
@ -190,6 +190,7 @@ class Game:
|
||||
'disconnect_bot': self.disconnect_bot,
|
||||
'expansions': self.expansions,
|
||||
'available_expansions': self.available_expansions,
|
||||
'is_replay': self.is_replay,
|
||||
})
|
||||
self.sio.emit('debug', room=self.name, data=self.debug)
|
||||
if self.debug:
|
||||
|
@ -445,7 +445,7 @@ def chat_message(sid, msg, pl=None):
|
||||
ses.game.add_player(bot)
|
||||
bot.bot_spin()
|
||||
return
|
||||
if '/replay' in msg and not '/replayspeed' in msg:
|
||||
if '/replay' in msg and not '/replayspeed' in msg and not '/replaypov' in msg:
|
||||
_cmd = msg.split()
|
||||
if len(_cmd) >= 2:
|
||||
replay_id = _cmd[1]
|
||||
@ -463,6 +463,21 @@ def chat_message(sid, msg, pl=None):
|
||||
if len(_cmd) == 2:
|
||||
ses.game.replay_speed = float(_cmd[1])
|
||||
return
|
||||
if '/replaypov' in msg:
|
||||
_cmd = msg.split()
|
||||
if len(_cmd) > 1:
|
||||
name = ' '.join(_cmd[1:])
|
||||
for p in ses.game.players:
|
||||
if p.sid == ses.sid:
|
||||
from tests.dummy_socket import DummySocket
|
||||
p.sio = DummySocket()
|
||||
p.sid = ''
|
||||
pl = ses.game.get_player_named(name)
|
||||
pl.sio = sio
|
||||
pl.sid = ses.sid
|
||||
pl.set_role(pl.role)
|
||||
pl.notify_self()
|
||||
return
|
||||
if '/startwithseed' in msg and not ses.game.started:
|
||||
if len(msg.split()) > 1:
|
||||
ses.game.start_game(int(msg.split()[1]))
|
||||
|
@ -66,6 +66,7 @@
|
||||
:card="card" @click.native="selectedInfo = p.gold_rush_equipment"
|
||||
:style="`margin-top: ${i+p.equipment.length<1?10:-(Math.min((p.equipment.length+p.gold_rush_equipment.length+1)*12,80))}pt`"/>
|
||||
</div>
|
||||
<button v-if="is_replay" style="position:absolute" @click="replayPlayer(p.name)">{{$t('spectate_player')}}</button>
|
||||
<div v-if="p.is_bot" style="position:absolute;bottom:57%;width:20pt;" class="center-stuff">
|
||||
<span>🤖</span>
|
||||
</div>
|
||||
@ -144,6 +145,7 @@ export default {
|
||||
showTurnFlow: false,
|
||||
turnReversed: false,
|
||||
displayAdminStatus: false,
|
||||
is_replay: false,
|
||||
turn: -1,
|
||||
}),
|
||||
sockets: {
|
||||
@ -161,6 +163,7 @@ export default {
|
||||
this.disconnect_bot = data.disconnect_bot
|
||||
this.togglable_expansions = data.available_expansions
|
||||
this.expansions = data.expansions
|
||||
this.is_replay = data.is_replay
|
||||
this.players = data.players.map(x => {
|
||||
return {
|
||||
name: x.name,
|
||||
@ -285,6 +288,9 @@ export default {
|
||||
console.log(ex+' '+ this.expansions+ (this.expansions.indexOf(ex) !== -1))
|
||||
return this.expansions.indexOf(ex) !== -1
|
||||
},
|
||||
replayPlayer(player) {
|
||||
this.$socket.emit('chat_message', `/replaypov ${player}`)
|
||||
},
|
||||
leaveRoom() {
|
||||
window.location.replace(window.location.origin)
|
||||
document.title = 'PewPew!'
|
||||
|
Loading…
Reference in New Issue
Block a user