Timers and other features for Heroes of the Storm
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

80 linhas
1.9 KiB

  1. <!--
  2. Copyright © 2021 Adrien Agez <adrien.agez@pm.me>
  3. This file is part of Nexus Timers.
  4. Nexus Timers is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU Affero General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or
  7. (at your option) any later version.
  8. Nexus Timers is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Affero General Public License for more details.
  12. You should have received a copy of the GNU Affero General Public License
  13. along with Nexus Timers. If not, see <https://www.gnu.org/licenses/>.
  14. -->
  15. <template>
  16. <div
  17. class="objective"
  18. @click="clearObjective"
  19. v-longclick="forceClearObjective">
  20. <div>
  21. {{ objective.name }}
  22. <span v-if="objective.position"> ({{ objective.position }})</span>
  23. </div>
  24. <div>
  25. <Timer
  26. ref="timer"
  27. class="objective-timer"
  28. :initialTime="objective.initialSpawnTime"
  29. />
  30. </div>
  31. </div>
  32. </template>
  33. <style lang="sass" scoped>
  34. .objective
  35. width: 100%
  36. text-align: center
  37. &-timer
  38. font-size: 2rem
  39. </style>
  40. <script>
  41. import Timer from '@/components/Timer'
  42. export default {
  43. name: 'Objective',
  44. props: {
  45. objective: Object
  46. },
  47. data () {
  48. return {
  49. }
  50. },
  51. methods: {
  52. clearObjective: function () {
  53. if (this.$refs.timer.currentTime === 0) {
  54. this.resetTimer()
  55. }
  56. },
  57. forceClearObjective: function () {
  58. this.resetTimer()
  59. },
  60. resetTimer: function () {
  61. this.$refs.timer.setTime(this.objective.respawnTime)
  62. this.$refs.timer.startTimer()
  63. }
  64. },
  65. components: {
  66. Timer
  67. }
  68. }
  69. </script>