mirror of
				https://github.com/bra1n/townsquare.git
				synced 2025-10-21 16:55:12 +00:00 
			
		
		
		
	Preset Timers
This commit is contained in:
		
							parent
							
								
									8d0622f3bb
								
							
						
					
					
						commit
						9df8456774
					
				
					 3 changed files with 114 additions and 6 deletions
				
			
		|  | @ -81,6 +81,16 @@ | ||||||
|           ⏵ |           ⏵ | ||||||
|         </div> |         </div> | ||||||
|       </div> |       </div> | ||||||
|  |       <div class="button-group" v-if="session.nomination"> | ||||||
|  |         <div @click="setAccusationTimer()" class="button">{{ locale.townsquare.timer.accusation.button }}</div> | ||||||
|  |         <div @click="setDefenseTimer()" class="button">{{ locale.townsquare.timer.defense.button }}</div> | ||||||
|  |         <div @click="setDebateTimer()" class="button">{{ locale.townsquare.timer.debate.button }}</div> | ||||||
|  |       </div> | ||||||
|  |       <div class="button-group" v-else> | ||||||
|  |         <div @click="setDaytimeTimer()" class="button">{{ locale.townsquare.timer.daytime.button }}</div> | ||||||
|  |         <div @click="setNominationTimer()" class="button">{{ locale.townsquare.timer.nominations.button }}</div> | ||||||
|  |         <div @click="setDuskTimer()" class="button">{{ locale.townsquare.timer.dusk.button }}</div> | ||||||
|  |       </div> | ||||||
|       <div class="button-group"> |       <div class="button-group"> | ||||||
|         <div @click="toggleNight()" class="button" :class="{disabled: grimoire.isNight}">☀</div> |         <div @click="toggleNight()" class="button" :class="{disabled: grimoire.isNight}">☀</div> | ||||||
|         <div @click="toggleNight()" class="button" :class="{disabled: !grimoire.isNight}">☽</div> |         <div @click="toggleNight()" class="button" :class="{disabled: !grimoire.isNight}">☽</div> | ||||||
|  | @ -317,16 +327,46 @@ export default { | ||||||
|       this.nominate = -1; |       this.nominate = -1; | ||||||
|     }, |     }, | ||||||
|     renameTimer() { |     renameTimer() { | ||||||
|       let newName = prompt("Timer Name", ""); |       let newName = prompt(this.locale.townsquare.timer.prompt.name, this.timerName); | ||||||
|       if (newName === "") { |       if (newName === "") { | ||||||
|         return; |         newName = this.locale.townsquare.timer.default.text; | ||||||
|       } |       } | ||||||
|       this.timerName = newName.trim(); |       this.timerName = newName.trim(); | ||||||
|     }, |     }, | ||||||
|  |     setDaytimeTimer() { | ||||||
|  |       this.timerDuration = 8; | ||||||
|  |       this.timerName = this.locale.townsquare.timer.daytime.text; | ||||||
|  |     }, | ||||||
|  |     setNominationTimer() { | ||||||
|  |       this.timerDuration = 2; | ||||||
|  |       this.timerName = this.timerName = this.locale.townsquare.timer.nominations.text; | ||||||
|  |     }, | ||||||
|  |     setDuskTimer() { | ||||||
|  |       this.timerDuration = 1; | ||||||
|  |       this.timerName = this.timerName = this.locale.townsquare.timer.dusk.text; | ||||||
|  |     }, | ||||||
|  |     setAccusationTimer() { | ||||||
|  |       this.timerDuration = 1; | ||||||
|  |       let timerText = this.locale.townsquare.timer.accusation.text; | ||||||
|  |       timerText = timerText.replace("$accusator", this.players[this.session.nomination[0]].name).replace("$accusee", this.players[this.session.nomination[1]].name); | ||||||
|  |       this.timerName = timerText; | ||||||
|  |     }, | ||||||
|  |     setDefenseTimer() { | ||||||
|  |       this.timerDuration = 1; | ||||||
|  |       let timerText = this.locale.townsquare.timer.defense.text; | ||||||
|  |       timerText = timerText.replace("$accusee", this.players[this.session.nomination[1]].name).replace("$accusator", this.players[this.session.nomination[0]].name); | ||||||
|  |       this.timerName = timerText; | ||||||
|  |     }, | ||||||
|  |     setDebateTimer() { | ||||||
|  |       this.timerDuration = 2; | ||||||
|  |       let timerText = this.locale.townsquare.timer.debate.text; | ||||||
|  |       timerText = timerText.replace("$accusee", this.players[this.session.nomination[1]].name); | ||||||
|  |       this.timerName = timerText; | ||||||
|  |     }, | ||||||
|     setTimer() { |     setTimer() { | ||||||
|       let newDuration = prompt("Timer Duration in minutes"); |       let newDuration = prompt(this.locale.townsquare.timer.prompt.duration); | ||||||
|       if (isNaN(newDuration)) { |       if (isNaN(newDuration)) { | ||||||
|         return alert("Incorrect number"); |         return alert(this.locale.townsquare.timer.prompt.durationError); | ||||||
|       } |       } | ||||||
|       if (newDuration > 0) { |       if (newDuration > 0) { | ||||||
|         this.timerDuration = newDuration; |         this.timerDuration = newDuration; | ||||||
|  |  | ||||||
|  | @ -93,7 +93,41 @@ | ||||||
|     "others": "Other characters", |     "others": "Other characters", | ||||||
|     "bluffs": "Demon bluffs", |     "bluffs": "Demon bluffs", | ||||||
|     "fabled": "Fabled", |     "fabled": "Fabled", | ||||||
|     "storytellerTools": "Storytelling" |     "storytellerTools": "Storytelling", | ||||||
|  |     "timer": { | ||||||
|  |       "default": { | ||||||
|  |         "text": "Timer" | ||||||
|  |       }, | ||||||
|  |       "prompt": { | ||||||
|  |         "name": "Timer name", | ||||||
|  |         "duration": "Timer duration in minutes", | ||||||
|  |         "durationError": "Timer duration must be a number" | ||||||
|  |       }, | ||||||
|  |       "daytime": { | ||||||
|  |         "button": "Daytime", | ||||||
|  |         "text": "Daytime" | ||||||
|  |       }, | ||||||
|  |       "nominations": { | ||||||
|  |         "button": "Nominations", | ||||||
|  |         "text": "Nominations open" | ||||||
|  |       }, | ||||||
|  |       "dusk": { | ||||||
|  |         "button": "Dusk", | ||||||
|  |         "text": "End of day" | ||||||
|  |       }, | ||||||
|  |       "accusation": { | ||||||
|  |         "button": "Accusation", | ||||||
|  |         "text": "$accusator accuses $accusee" | ||||||
|  |       }, | ||||||
|  |       "defense": { | ||||||
|  |         "button": "Defense", | ||||||
|  |         "text": "$accusee defends against $accusator" | ||||||
|  |       }, | ||||||
|  |       "debate": { | ||||||
|  |         "button": "Debate", | ||||||
|  |         "text": "Should $accusee be executed ?" | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   }, |   }, | ||||||
|   "towninfo":{ |   "towninfo":{ | ||||||
|     "addPlayers":"Please add more players!", |     "addPlayers":"Please add more players!", | ||||||
|  |  | ||||||
|  | @ -93,7 +93,41 @@ | ||||||
|     "others": "Autres Rôles", |     "others": "Autres Rôles", | ||||||
|     "bluffs": "Bluffs de Démon", |     "bluffs": "Bluffs de Démon", | ||||||
|     "fabled": "Fabuleux", |     "fabled": "Fabuleux", | ||||||
|     "storytellerTools": "Narration" |     "storytellerTools": "Narration", | ||||||
|  |     "timer": { | ||||||
|  |       "default": { | ||||||
|  |         "text": "Compte à rebours" | ||||||
|  |       }, | ||||||
|  |       "prompt": { | ||||||
|  |         "name": "Nom du compte à rebours", | ||||||
|  |         "duration": "Durée en minutes", | ||||||
|  |         "durationError": "Veuillez saisir un nombre en minutes" | ||||||
|  |       }, | ||||||
|  |       "daytime": { | ||||||
|  |         "button": "Journée", | ||||||
|  |         "text": "Journée" | ||||||
|  |       }, | ||||||
|  |       "nominations": { | ||||||
|  |         "button": "Nominations", | ||||||
|  |         "text": "Nominations ouvertes" | ||||||
|  |       }, | ||||||
|  |       "dusk": { | ||||||
|  |         "button": "Fin de Journée", | ||||||
|  |         "text": "Fin de Journée" | ||||||
|  |       }, | ||||||
|  |       "accusation": { | ||||||
|  |         "button": "Accusation", | ||||||
|  |         "text": "$accusator accuse $accusee" | ||||||
|  |       }, | ||||||
|  |       "defense": { | ||||||
|  |         "button": "Défense", | ||||||
|  |         "text": "$accusee se défend de $accusator" | ||||||
|  |       }, | ||||||
|  |       "debate": { | ||||||
|  |         "button": "Débat", | ||||||
|  |         "text": "$accusee doit mourrir ?" | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   }, |   }, | ||||||
|   "towninfo":{ |   "towninfo":{ | ||||||
|     "addPlayers": "Appuyez sur [A] pour ajouter plus de joueurs !", |     "addPlayers": "Appuyez sur [A] pour ajouter plus de joueurs !", | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue