ソースを参照

Added tags to each story

tags/v0.1.0
Fen Dweller 6年前
コミット
0e0a601ac4
5個のファイルの変更32行の追加0行の削除
  1. +8
    -0
      satiate.css
  2. +2
    -0
      satiate.html
  3. +15
    -0
      satiate.js
  4. +3
    -0
      stories/demo.js
  5. +4
    -0
      stories/fen-snack.js

+ 8
- 0
satiate.css ファイルの表示

@@ -61,6 +61,14 @@ a:hover {
color: #eee;
}

#tags-header {
font-size: 36px;
}

.tag {
font-size: 24px;
}

.modal {
position: fixed;
z-index: 1;


+ 2
- 0
satiate.html ファイルの表示

@@ -35,6 +35,8 @@
</select>
</div>
<button id="start-button">Start</button>
<div id="tags-header">Tags</div>
<div id="tags"></div>
</div>
<div class="hidden-scene" id="game">
<div id="info-area">


+ 15
- 0
satiate.js ファイルの表示

@@ -114,6 +114,21 @@ function initStart() {
options[story.id] = story;
})

select.addEventListener("change", event => {
const holder = document.querySelector("#tags");

holder.innerHTML = "";

const tags = stories.filter(s => s.id == [event.target.value])[0].tags;

tags.forEach(tag => {
const div = document.createElement("div");
div.textContent = tag;
div.classList.add("tag");
holder.appendChild(div);
})
});

const start = document.querySelector("#start-button");

start.addEventListener("click", (event) => {


+ 3
- 0
stories/demo.js ファイルの表示

@@ -1,6 +1,9 @@
stories.push({
"id": "demo",
"name": "Tech Demo",
"tags": [
"Memes"
],
"intro": {
"start": "Home",
"setup": state => {


+ 4
- 0
stories/fen-snack.js ファイルの表示

@@ -1,6 +1,10 @@
stories.push({
id: "fen-snack",
name: "Fen's Food",
tags: [
"Prey",
"Digestion"
],
sounds: [
"sfx/digested-test.ogg",
"loop/fen-stomach.ogg",


読み込み中…
キャンセル
保存