wait to close and other quality of life fixes

This commit is contained in:
Alberto Xamin 2021-06-16 18:14:44 +02:00 committed by Alberto
parent 7f0f8bb5c1
commit 86656c4942
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
3 changed files with 28 additions and 26 deletions

View File

@ -449,12 +449,14 @@ class Game:
if self.disconnect_bot and self.started: if self.disconnect_bot and self.started:
player.is_bot = True player.is_bot = True
if len([p for p in self.players if not p.is_bot]) == 0: if len([p for p in self.players if not p.is_bot]) == 0:
print(f'no players left in game {self.name}, shutting down') eventlet.sleep(5)
self.shutting_down = True if len([p for p in self.players if not p.is_bot]) == 0:
self.players = [] print(f'no players left in game {self.name}, shutting down')
self.spectators = [] self.shutting_down = True
self.deck = None self.players = []
return True self.spectators = []
self.deck = None
return True
eventlet.sleep(15) # he may reconnect eventlet.sleep(15) # he may reconnect
if player.is_bot: if player.is_bot:
if len(player.available_characters) > 0: if len(player.available_characters) > 0:

View File

@ -153,7 +153,7 @@ html {
#app { #app {
margin: 4pt; margin: 4pt;
margin-top: -16pt; margin-top: -16pt;
zoom: 0.8; zoom: 0.75;
} }
} }
h1,h2,h3,h4,p,span,b,label{ h1,h2,h3,h4,p,span,b,label{

View File

@ -17,6 +17,25 @@
<!-- <div class="players-table"> --> <!-- <div class="players-table"> -->
<!-- <div style="position: relative;width:260pt;height:400pt;"> --> <!-- <div style="position: relative;width:260pt;height:400pt;"> -->
<!-- :style="p.style"/> -->
<!-- </div> -->
<!-- </div> -->
<div v-if="!started">
<h3>{{$t("expansions")}}</h3>
<div v-for="ex in expansionsStatus" v-bind:key="ex.id">
<PrettyCheck @click.native="toggleExpansions(ex.id)" :disabled="!isRoomOwner" :checked="ex.enabled" class="p-switch p-fill" style="margin-top:5px; margin-bottom:3px;">{{ex.name}}</PrettyCheck>
<br>
</div>
<h3>{{$t('mods')}}</h3>
<PrettyCheck @click.native="toggleCompetitive" :disabled="!isRoomOwner" v-model="is_competitive" class="p-switch p-fill" style="margin-top:5px; margin-bottom:3px;">{{$t('mod_comp')}}</PrettyCheck>
<h3>{{$t('bots')}}</h3>
<input type="button" class="btn" :value="$t('add_bot')" :disabled="!isRoomOwner || players.length > 7" @click="(e)=>{this.$socket.emit('chat_message', '/addbot'); e.preventDefault()}"/>
<input type="button" class="btn" style="margin-left: 10pt;" :value="$t('remove_bot')" :disabled="!isRoomOwner || !isThereAnyBot" @click="(e)=>{this.$socket.emit('chat_message', '/removebot'); e.preventDefault()}"/>
<!-- <br> -->
<!-- <PrettyCheck @click.native="toggleReplaceWithBot" :disabled="!isRoomOwner" v-model="disconnect_bot" class="p-switch p-fill" style="margin-top:5px; margin-bottom:3px;">{{$t('disconnect_bot')}}</PrettyCheck> -->
<p v-if="players.length < 3" class="center-stuff" style="min-height: 19px;">{{$t('minimum_players')}}</p>
<p v-else style="min-height: 19px;"> </p>
</div>
<transition-group name="list" tag="div" class="players-table"> <transition-group name="list" tag="div" class="players-table">
<Card v-if="startGameCard" key="_start_game_" :donotlocalize="true" :card="startGameCard" @click.native="startGame"/> <Card v-if="startGameCard" key="_start_game_" :donotlocalize="true" :card="startGameCard" @click.native="startGame"/>
<div v-for="p in playersTable" v-bind:key="p.card.name" style="position:relative;"> <div v-for="p in playersTable" v-bind:key="p.card.name" style="position:relative;">
@ -42,25 +61,6 @@
</div> </div>
</div> </div>
</transition-group> </transition-group>
<!-- :style="p.style"/> -->
<!-- </div> -->
<!-- </div> -->
<div v-if="!started">
<p v-if="players.length < 3" class="center-stuff" style="min-height: 19px;">{{$t('minimum_players')}}</p>
<p v-else style="min-height: 19px;"> </p>
<h3>{{$t("expansions")}}</h3>
<div v-for="ex in expansionsStatus" v-bind:key="ex.id">
<PrettyCheck @click.native="toggleExpansions(ex.id)" :disabled="!isRoomOwner" :checked="ex.enabled" class="p-switch p-fill" style="margin-top:5px; margin-bottom:3px;">{{ex.name}}</PrettyCheck>
<br>
</div>
<h3>{{$t('mods')}}</h3>
<PrettyCheck @click.native="toggleCompetitive" :disabled="!isRoomOwner" v-model="is_competitive" class="p-switch p-fill" style="margin-top:5px; margin-bottom:3px;">{{$t('mod_comp')}}</PrettyCheck>
<h3>{{$t('bots')}}</h3>
<input type="button" class="btn" :value="$t('add_bot')" :disabled="!isRoomOwner || players.length > 7" @click="(e)=>{this.$socket.emit('chat_message', '/addbot'); e.preventDefault()}"/>
<input type="button" class="btn" style="margin-left: 10pt;" :value="$t('remove_bot')" :disabled="!isRoomOwner || !isThereAnyBot" @click="(e)=>{this.$socket.emit('chat_message', '/removebot'); e.preventDefault()}"/>
<!-- <br> -->
<!-- <PrettyCheck @click.native="toggleReplaceWithBot" :disabled="!isRoomOwner" v-model="disconnect_bot" class="p-switch p-fill" style="margin-top:5px; margin-bottom:3px;">{{$t('disconnect_bot')}}</PrettyCheck> -->
</div>
<div v-if="started"> <div v-if="started">
<deck :endTurnAction="()=>{wantsToEndTurn = true}"/> <deck :endTurnAction="()=>{wantsToEndTurn = true}"/>
<player :isEndingTurn="wantsToEndTurn" :cancelEndingTurn="()=>{wantsToEndTurn = false}" :chooseCardFromPlayer="choose" :cancelChooseCardFromPlayer="()=>{hasToChoose=false}"/> <player :isEndingTurn="wantsToEndTurn" :cancelEndingTurn="()=>{wantsToEndTurn = false}" :chooseCardFromPlayer="choose" :cancelChooseCardFromPlayer="()=>{hasToChoose=false}"/>