Timers and other features for Heroes of the Storm
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

57 line
1.0 KiB

  1. <template>
  2. <div
  3. class="objective"
  4. @click="clearObjective"
  5. v-longclick="forceClearObjective">
  6. <div>
  7. {{ objective.name }}
  8. <span v-if="objective.position"> ({{ objective.position }})</span>
  9. </div>
  10. <div>
  11. <Timer
  12. ref="timer"
  13. :initialTime="objective.initialSpawnTime"
  14. />
  15. </div>
  16. </div>
  17. </template>
  18. <style lang="sass" scoped>
  19. .objective
  20. width: 100%
  21. text-align: center
  22. </style>
  23. <script>
  24. import Timer from '@/components/Battleground/Timer'
  25. export default {
  26. name: 'Objective',
  27. props: {
  28. objective: Object
  29. },
  30. data () {
  31. return {
  32. }
  33. },
  34. methods: {
  35. clearObjective: function () {
  36. if (this.$refs.timer.currentTime === 0) {
  37. this.resetTimer()
  38. }
  39. },
  40. forceClearObjective: function () {
  41. this.resetTimer()
  42. },
  43. resetTimer: function () {
  44. this.$refs.timer.setTime(this.objective.respawnTime)
  45. this.$refs.timer.startTimer()
  46. }
  47. },
  48. components: {
  49. Timer
  50. }
  51. }
  52. </script>