tweak timer
This commit is contained in:
parent
30b3e826a0
commit
4958a2c7dc
@ -3,12 +3,12 @@
|
||||
<h1>{{text}}</h1>
|
||||
<div>
|
||||
<transition-group name="list" tag="div">
|
||||
<Card v-for="(c, i) in cards" v-bind:key="c.name ? (c.name+c.number) : i" :card="c" @click.native="select(c)" @pointerenter.native="showDesc(c)" @pointerleave.native="desc=''"/>
|
||||
<Card v-for="(c, i) in cards" v-bind:key="c.name ? (c.name+c.number) : i" :card="c" @click.native="internalSelect(c)" @pointerenter.native="showDesc(c)" @pointerleave.native="desc=''"/>
|
||||
</transition-group>
|
||||
</div>
|
||||
<h2 v-if="timer > 0 && remainingTime > 0">{{remainingTime}}</h2>
|
||||
<p v-if="hintText">{{hintText}}</p>
|
||||
<div style="margin-top:6pt;" class="button center-stuff" v-if="showCancelBtn" @click="cancel"><span>{{realCancelText}}</span></div>
|
||||
<h2 v-if="timer > 0 && remainingTime > 0 && !showCancelBtn">{{remainingTime}}</h2>
|
||||
<div style="margin-top:6pt;" class="button center-stuff" v-if="showCancelBtn" @click="internalCancel"><span>{{realCancelText}}</span> <span v-if="timer > 0 && remainingTime > 0"> ({{remainingTime}})</span></div>
|
||||
<p v-if="desc" style="bottom:10pt;right:0;left:0;position:absolute;margin:16pt;font-size:18pt">{{desc}}</p>
|
||||
</div>
|
||||
</template>
|
||||
@ -72,7 +72,15 @@ export default {
|
||||
this.select(this.cards[0]);
|
||||
window.clearInterval(this.intervalID);
|
||||
}
|
||||
}
|
||||
},
|
||||
internalCancel() {
|
||||
if (this.intervalID) window.clearInterval(this.intervalID);
|
||||
this.cancel();
|
||||
},
|
||||
internalSelect(card) {
|
||||
if (this.intervalID) window.clearInterval(this.intervalID);
|
||||
this.select(card);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.realCancelText = this.cancelText
|
||||
@ -85,11 +93,10 @@ export default {
|
||||
if (this.playAudio) {
|
||||
(new Audio(show_sfx)).play();
|
||||
}
|
||||
if (this.timer > 0) {
|
||||
this.remainingTime = this.timer;
|
||||
this.intervalID = window.setInterval(() => {
|
||||
this.countDown();
|
||||
}, 1000);
|
||||
if (this.timer != 0 && this.remainingTime == this.timer) {
|
||||
if (this.intervalID) window.clearInterval(this.intervalID);
|
||||
this.intervalID = window.setInterval(this.countDown, 1000);
|
||||
}
|
||||
},
|
||||
}
|
||||
|
@ -50,15 +50,15 @@
|
||||
</transition>
|
||||
<Chooser v-if="is_my_turn && pending_action == 4 && (lives > 0 || is_ghost) && !(emporioCards && emporioCards.cards && emporioCards.cards.length > 0)" :text="$t('wait')" :cards="[]"/>
|
||||
<Chooser v-if="card_against" :text="$t('card_against')" :hint-text="visiblePlayers.length === 0 ? $t('no_players_in_range'):''" :cards="visiblePlayers" :select="selectAgainst" :cancel="card_against.number !== 42 ? cancelCardAgainst : null"/>
|
||||
<Chooser v-if="pending_action == 3" :text="respondText" :cards="respondCards" :select="respond" :playAudio="true" :timer="60"/>
|
||||
<Chooser v-if="shouldChooseCard" :text="$t(choose_text)" :cards="available_cards" :select="choose" :playAudio="true" :timer="60"/>
|
||||
<Chooser v-if="pending_action == 3" :text="respondText" :cards="respondCards" :select="respond" :playAudio="true" :timer="30"/>
|
||||
<Chooser v-if="shouldChooseCard" :text="$t(choose_text)" :cards="available_cards" :select="choose" :playAudio="true" :timer="30"/>
|
||||
<Chooser v-if="lives <= 0 && max_lives > 0 && !is_ghost && !spectator" :text="$t('you_died')" :cancelText="$t('spectate')" :cancel="()=>{max_lives = 0; spectator = true}"/>
|
||||
<Chooser v-if="win_status !== undefined" :text="win_status?$t('you_win'):$t('you_lose')" />
|
||||
<Chooser v-if="show_role" :text="$t('you_are')" :cards="[my_role]" :hintText="($i18n.locale=='it'?my_role.goal:my_role.goal_eng)" :select="() => {show_role=false}" :cancel="() => {show_role=false}" :cancelText="$t('ok')" :timer="15"/>
|
||||
<Chooser v-if="show_role" :text="$t('you_are')" :cards="[my_role]" :hintText="($i18n.locale=='it'?my_role.goal:my_role.goal_eng)" :select="() => {show_role=false}" :cancel="() => {show_role=false}" :cancelText="$t('ok')"/>
|
||||
<Chooser v-if="notifycard" :key="notifycard.card" :text="`${notifycard.player} ${$t('did_pick_as')}:`" :cards="[notifycard.card]" :hintText="$t(notifycard.message)" class="turn-notify-4s"/>
|
||||
<Chooser v-if="cantplaycard" :key="cantplaycard" :text="`${$t('cantplaycard')}`" class="turn-notify-4s"/>
|
||||
<Chooser v-if="!show_role && is_my_turn && pending_action < 2" :text="$t('play_your_turn')" :key="is_my_turn" class="turn-notify" />
|
||||
<Chooser v-if="!show_role && availableCharacters.length > 0" :text="$t('choose_character')" :cards="availableCharacters" :select="setCharacter" :timer="60"/>
|
||||
<Chooser v-if="!show_role && availableCharacters.length > 0" :text="$t('choose_character')" :cards="availableCharacters" :select="setCharacter" :timer="45"/>
|
||||
<Chooser v-if="hasToPickResponse" :playAudio="true" :text="`${$t('pick_a_card')} ${attacker?($t('to_defend_from')+' '+attacker):''}`" :key="hasToPickResponse" class="turn-notify" />
|
||||
<Chooser v-if="!card_against && card_with" :text="`${$t('choose_scarp_card_to')} ${card_with.name.toUpperCase()}`" :cards="handComputed.filter(x => x !== card_with)" :select="selectWith" :cancel="()=>{card_with = null}"/>
|
||||
<Chooser v-if="showScrapScreen" :text="`${$t('discard')} ${hand.length}/${maxHandLength()}`" :cards="hand" :select="scrap" :cancel="cancelEndingTurn"/>
|
||||
|
Loading…
Reference in New Issue
Block a user