浏览代码

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; color: #eee;
} }


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

.tag {
font-size: 24px;
}

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


+ 2
- 0
satiate.html 查看文件

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


+ 15
- 0
satiate.js 查看文件

@@ -114,6 +114,21 @@ function initStart() {
options[story.id] = story; 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"); const start = document.querySelector("#start-button");


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


+ 3
- 0
stories/demo.js 查看文件

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


+ 4
- 0
stories/fen-snack.js 查看文件

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


正在加载...
取消
保存