Feast 2.0!
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.
 
 
 
 
 

190 lines
4.2 KiB

  1. <template>
  2. <div class="explore-layout">
  3. <div class="explore-log">
  4. </div>
  5. <div class="explore-worldinfo">
  6. <p class="worldinfo-date">{{ world.time.format("MMMM Do Y") }}</p>
  7. <p class="worldinfo-date">{{ world.time.format("hh:mm:ss a") }}</p>
  8. </div>
  9. <Statblock :subject="world.player" :initiative="0" />
  10. <div class="explore-info">
  11. <h2 class="location-name">{{ location.name.capital }}</h2>
  12. <p class="location-desc">{{ location.desc }}</p>
  13. </div>
  14. <div class="explore-nav">
  15. <NavButton @click.native="writeLog(location.connections[direction].travel(world, world.player))" v-for="direction in Object.keys(location.connections)" :key="direction" :style="navBtnCss(direction)" :location="location" :direction="direction" />
  16. </div>
  17. <div class="explore-choices">
  18. <ChoiceButton @click.native="writeLog(choice.execute(world, world.player))" v-for="(choice, index) in location.choices.filter(choice => choice.visible(world))" :key="'choice' + index" :choice="choice" :world="world" />
  19. </div>
  20. </div>
  21. </template>
  22. <script lang="ts">
  23. import { Component, Prop, Vue } from 'vue-property-decorator'
  24. import { Direction, World, Place } from '@/game/world'
  25. import NavButton from './NavButton.vue'
  26. import ChoiceButton from './ChoiceButton.vue'
  27. import Statblock from './Statblock.vue'
  28. import { LogEntry } from '@/game/interface'
  29. @Component({
  30. components: {
  31. NavButton, ChoiceButton, Statblock
  32. },
  33. data () {
  34. return {
  35. directions: Direction
  36. }
  37. }
  38. })
  39. export default class Explore extends Vue {
  40. get location () {
  41. return this.world.player.location
  42. }
  43. set location (loc: Place) {
  44. this.world.player.location = loc
  45. }
  46. @Prop({ type: World })
  47. world!: World
  48. navBtnCss (dir: Direction) {
  49. return {
  50. '--nav-direction': dir
  51. }
  52. }
  53. writeLog (entry: LogEntry) {
  54. const log = this.$el.querySelector(".explore-log")
  55. if (log !== null) {
  56. const before = log.querySelector("div.explore-log-entry")
  57. const holder = document.createElement("div")
  58. holder.classList.add("explore-log-entry")
  59. entry.render().forEach(element => {
  60. holder.appendChild(element)
  61. })
  62. holder.classList.add("explore-entry")
  63. const hline = document.createElement("div")
  64. hline.classList.add("explore-log-separator")
  65. log.insertBefore(hline, before)
  66. log.insertBefore(holder, hline)
  67. log.scrollTo({ top: 0, left: 0 })
  68. }
  69. }
  70. }
  71. </script>
  72. <style scoped>
  73. .explore-layout {
  74. flex: 10;
  75. position: relative;
  76. display: grid;
  77. grid-template-areas: "log worldinfo"
  78. "log statblock"
  79. "log info "
  80. "log choices "
  81. "nav choices ";
  82. grid-template-rows: 0.5fr fit-content(250pt) 2fr 1fr 1fr;
  83. grid-template-columns: 2fr 1fr;
  84. width: 100%;
  85. height: 100%;
  86. overflow: hidden;
  87. }
  88. .explore-log {
  89. grid-area: log;
  90. background: #222;
  91. overflow-y: scroll;
  92. }
  93. .explore-worldinfo {
  94. grid-area: worldinfo;
  95. background: #111;
  96. }
  97. .worldinfo-date,
  98. .worldinfo-time {
  99. font-size: 125%;
  100. }
  101. .explore-info {
  102. grid-area: info;
  103. background: #333;
  104. display: flex;
  105. flex-direction: column;
  106. flex-wrap: none;
  107. justify-content: start;
  108. align-items: center;
  109. }
  110. .location-name {
  111. font-size: 200%;
  112. margin: 8pt;
  113. }
  114. .location-desc {
  115. font-size: 150%;
  116. color: #ccc;
  117. }
  118. .explore-nav {
  119. position: relative;
  120. grid-area: nav;
  121. background: #444;
  122. display: grid;
  123. justify-content: center;
  124. align-content: center;
  125. grid-template-areas: "Northwest North Northeast"
  126. "West Center East "
  127. "Southwest South Southeast";
  128. grid-template-rows: 1fr 1fr 1fr;
  129. grid-template-columns: 1fr 1fr 1fr;
  130. width: 100%;
  131. max-width: 1000px;
  132. height: 100%;
  133. justify-self: end;
  134. }
  135. .explore-choices {
  136. grid-area: choices;
  137. background: #555;
  138. display: flex;
  139. flex-direction: column;
  140. overflow-y: scroll;
  141. }
  142. </style>
  143. <style>
  144. .explore-log-entry {
  145. animation: explore-entry-fade 1s;
  146. }
  147. @keyframes explore-entry-fade {
  148. from {
  149. opacity: 0;
  150. }
  151. to {
  152. opacity: 1
  153. }
  154. }
  155. .explore-log-separator {
  156. width: 100%;
  157. height: 4px;
  158. margin: 16pt 0pt 16pt;
  159. background: linear-gradient(90deg, transparent, #444 10%, #444 90%, transparent 100%);
  160. }
  161. </style>