App.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <div id="app">
  3. <div class="container-fluid">
  4. <div class="row">
  5. <div
  6. class="col-4"
  7. style="background-color:lightgreen;"
  8. v-if="!hideTest"
  9. >
  10. <span class="test-germania">For tests :</span>
  11. <br />
  12. <button
  13. class="btn btn-primary custom-button"
  14. @click="display = 'app-menu'"
  15. >
  16. Enter Menu
  17. </button>
  18. <br />
  19. <br />
  20. <button
  21. class="btn btn-primary custom-button custom-button2"
  22. @click="display = 'app-game'"
  23. >
  24. Enter Game
  25. </button>
  26. <br />
  27. <br />
  28. <input
  29. type="text"
  30. placeholder="Username"
  31. autocomplete="off"
  32. class="form-control custom-input"
  33. />
  34. <br />
  35. <input
  36. type="text"
  37. placeholder="Username"
  38. autocomplete="off"
  39. class="form-control custom-input2"
  40. />
  41. <br />
  42. <input
  43. type="text"
  44. placeholder="Username"
  45. autocomplete="off"
  46. class="form-control custom-input3"
  47. />
  48. <p class="custom-text">
  49. Test 1 font for some long text, like a description of something or
  50. some indication
  51. </p>
  52. <p class="custom-text2">
  53. Test 2 font for some long text, like a description of something or
  54. some indication
  55. </p>
  56. </div>
  57. <div class="col">
  58. <!-- <div class="bg"> -->
  59. <button style="font-size:8px" @click="hideTest = !hideTest">
  60. Hide test
  61. </button>
  62. <keep-alive>
  63. <transition
  64. enter-active-class="animated bounceInUp"
  65. leave-active-class="animated bounceOutDown"
  66. mode="out-in"
  67. appear
  68. >
  69. <component
  70. :is="display"
  71. @join-game-id="launchOnlineGame($event)"
  72. :username="username"
  73. :game-id="onlineGameId"
  74. ></component>
  75. </transition>
  76. </keep-alive>
  77. <!-- </div> -->
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import AppMenu from './menu/AppMenu';
  85. import AppGame from './game/AppGame';
  86. import { globalEventsBus } from './main';
  87. export default {
  88. name: 'App',
  89. data() {
  90. return {
  91. display: 'app-menu',
  92. username: '',
  93. onlineGameId: -1,
  94. hideTest: false
  95. };
  96. },
  97. components: {
  98. AppMenu,
  99. AppGame
  100. },
  101. methods: {
  102. launchOnlineGame(game) {
  103. console.log('received game to launch : ', game);
  104. this.username = game.username;
  105. this.onlineGameId = game.id;
  106. this.display = 'app-game';
  107. }
  108. },
  109. created() {
  110. globalEventsBus.$on('game-stopped', () => {
  111. this.username = '';
  112. this.onlineGameId = -1;
  113. this.display = 'app-menu';
  114. });
  115. }
  116. };
  117. </script>
  118. <style scoped>
  119. @font-face {
  120. font-family: 'GermaniaOne';
  121. src: url('./assets/fonts/GermaniaOne-Regular.ttf') format('truetype');
  122. }
  123. @font-face {
  124. font-family: 'AutourOne';
  125. src: url('./assets/fonts/AutourOne-Regular.ttf') format('truetype');
  126. }
  127. @font-face {
  128. font-family: 'BeyondWonderland';
  129. src: url('./assets/fonts/BeyondWonderland.ttf') format('truetype');
  130. }
  131. @font-face {
  132. font-family: 'MedievalSharp';
  133. src: url('./assets/fonts/MedievalSharp.ttf') format('truetype');
  134. }
  135. @font-face {
  136. font-family: 'OncialePh';
  137. src: url('./assets/fonts/OncialePhF01.ttf') format('truetype');
  138. }
  139. @font-face {
  140. font-family: 'CupAndTalon';
  141. src: url('./assets/fonts/CupAndTalon.ttf') format('truetype');
  142. }
  143. .test-germania {
  144. font-family: GermaniaOne, cursive;
  145. font-size: 80px;
  146. }
  147. .custom-button {
  148. font-family: GermaniaOne, cursive;
  149. font-size: 60px;
  150. background-color: transparent;
  151. color: red;
  152. border: none;
  153. }
  154. .custom-button2 {
  155. font-family: CupAndTalon, cursive;
  156. font-size: 60px;
  157. font-weight: bold;
  158. }
  159. .custom-input {
  160. font-family: BeyondWonderland, cursive;
  161. font-size: 45px;
  162. text-transform: capitalize;
  163. }
  164. .custom-input2 {
  165. font-family: MedievalSharp, cursive;
  166. font-size: 40px;
  167. text-transform: capitalize;
  168. }
  169. .custom-input3 {
  170. font-family: OncialePh, cursive;
  171. font-size: 40px;
  172. text-transform: capitalize;
  173. }
  174. .custom-text {
  175. font-family: GermaniaOne, cursive;
  176. font-size: 30px;
  177. }
  178. .custom-text2 {
  179. font-family: AutourOne, cursive;
  180. font-size: 30px;
  181. }
  182. .bg {
  183. height: 100%;
  184. width: auto;
  185. position: relative;
  186. }
  187. .bg::after {
  188. content: '';
  189. background: url('./assets/twelveHeroes_cover.png');
  190. background-repeat: no-repeat;
  191. background-position: center center;
  192. background-size: contain;
  193. opacity: 0.7;
  194. top: 0;
  195. left: 0;
  196. bottom: 0;
  197. right: 0;
  198. position: absolute;
  199. z-index: -1;
  200. }
  201. </style>