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.

Scene.svelte 1012B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <main>
  2. {#if showIntro}
  3. <h1>{level.name}</h1>
  4. <div class="story">
  5. <p></p>
  6. {@html level.pages[page]}
  7. <p></p>
  8. </div>
  9. <div class="controls">
  10. {page + 1}/{level.pages.length}
  11. <button on:click={previous} disabled={page == 0}>Back</button>
  12. {#if page < level.pages.length - 1}
  13. <button on:click={next}>Next</button>
  14. {:else}
  15. <button on:click={begin}>Begin</button>
  16. {/if}
  17. <button on:click={begin}>Skip</button>
  18. </div>
  19. {:else}
  20. <CircuitSim />
  21. {/if}
  22. </main>
  23. <style>
  24. h1 {
  25. margin-bottom: 0px;
  26. text-align: center;
  27. }
  28. .story {
  29. max-width: 800px;
  30. margin: auto;
  31. }
  32. .story p:first-child {
  33. margin: 0px;
  34. }
  35. .controls {
  36. text-align: center;
  37. }
  38. </style>
  39. <script>
  40. export let level;
  41. import CircuitSim from './CircuitSim.svelte';
  42. let page = 0;
  43. let showIntro = true;
  44. function previous() {
  45. if (page > 0) {
  46. page -= 1;
  47. }
  48. }
  49. function next() {
  50. if (page < level.pages.length - 1) {
  51. page += 1;
  52. }
  53. }
  54. function begin() {
  55. showIntro = false;
  56. }
  57. </script>