| @@ -38,8 +38,12 @@ a:hover { | |||
| text-decoration: none; | |||
| } | |||
| #pick { | |||
| #pick.scene { | |||
| text-align: center; | |||
| display: flex; | |||
| flex-direction: column; | |||
| justify-content: center; | |||
| align-items: center; | |||
| } | |||
| #pick-blurb { | |||
| @@ -57,6 +61,7 @@ a:hover { | |||
| } | |||
| #start-button { | |||
| display: none; | |||
| user-select: none; | |||
| width: 200px; | |||
| height: 100px; | |||
| @@ -206,7 +211,6 @@ a:hover { | |||
| .sidebar { | |||
| background: rgba(255, 255, 255, 0.1); | |||
| padding: 25px; | |||
| flex: 1; | |||
| display: flex; | |||
| flex-direction: column; | |||
| @@ -230,14 +234,12 @@ a:hover { | |||
| } | |||
| #world-info { | |||
| margin: 10px 0px; | |||
| padding: 10px; | |||
| background: rgba(255,255,255,0.07); | |||
| flex: 5; | |||
| } | |||
| #player-info { | |||
| margin: 10px 0px; | |||
| padding: 10px; | |||
| background: rgba(255,255,255,0.07); | |||
| flex: 5; | |||
| @@ -274,6 +276,7 @@ a:hover { | |||
| .info-header { | |||
| font-size: 36px; | |||
| margin: 10px 0px; | |||
| text-align: center; | |||
| } | |||
| @@ -303,11 +306,27 @@ a:hover { | |||
| flex: 0 0 50px; | |||
| width: 250px; | |||
| background-color: #888; | |||
| border-color: #ddd; | |||
| color: #eee; | |||
| margin: 5px; | |||
| font-size: 16pt; | |||
| border: 5px; | |||
| border-style: outset; | |||
| } | |||
| .action-button:active { | |||
| background-color: #666; | |||
| border-color: #999; | |||
| } | |||
| .action-button.disabled { | |||
| border-style: inset; | |||
| border-color: #222; | |||
| } | |||
| .action-button.disabled:active { | |||
| border-color: #222; | |||
| } | |||
| #desc { | |||
| padding: 25px; | |||
| @@ -365,9 +384,26 @@ a:hover { | |||
| background-color: #888; | |||
| color: #eee; | |||
| border-radius: 5px; | |||
| border-style: outset; | |||
| border-color: #999; | |||
| font-size: 24px; | |||
| } | |||
| .move-button:active { | |||
| background-color: #666; | |||
| border-color: #333; | |||
| } | |||
| .move-button.disabled { | |||
| border-style: inset; | |||
| border-color: #222; | |||
| } | |||
| .move-button.disabled:active { | |||
| border-style: inset; | |||
| border-color: #222; | |||
| } | |||
| #move-up-left { | |||
| grid-column-start: 1; | |||
| } | |||
| @@ -408,33 +444,41 @@ a:hover { | |||
| grid-column-start: 3; | |||
| } | |||
| .move-button:focus { | |||
| outline: 0px; | |||
| } | |||
| .disabled { | |||
| background-color: #444; | |||
| border: none; | |||
| } | |||
| .missing { | |||
| .disabled:active { | |||
| background-color: #444; | |||
| color: #aaa !important; | |||
| } | |||
| .disabled:focus { | |||
| outline: none; | |||
| } | |||
| .missing, | |||
| .disabled.missing { | |||
| background-color: #333; | |||
| color: #aaa; | |||
| } | |||
| #area-name { | |||
| margin: 10px 0px; | |||
| padding: 10px; | |||
| background: rgba(255,255,255,0.07); | |||
| font-size: 36px; | |||
| } | |||
| #area-desc { | |||
| margin: 10px 0px; | |||
| padding: 10px; | |||
| background: rgba(255,255,255,0.07); | |||
| } | |||
| #area-info { | |||
| padding: 10px; | |||
| background: rgba(255,255,255,0.07); | |||
| flex: 5; | |||
| } | |||
| #log::-webkit-scrollbar { | |||
| width: 3px; | |||
| height: 2px; | |||
| @@ -470,8 +514,9 @@ a:hover { | |||
| } | |||
| #story-info { | |||
| display: flex; | |||
| flex-direction: column; | |||
| display: grid; | |||
| align-items: center; | |||
| grid-template-columns: repeat(1, minmax(240px, 1fr)); | |||
| } | |||
| .tooltip { | |||
| @@ -483,14 +528,16 @@ a:hover { | |||
| position: absolute; | |||
| display: none; | |||
| background: gray; | |||
| top: -20pt; | |||
| left: 50%; | |||
| top: 0%; | |||
| transform: translate(48pt, -100%); | |||
| padding: 5pt; | |||
| color: #eee; | |||
| border-radius: 5pt; | |||
| pointer-events: none; | |||
| transform: translate(-50%, 0); | |||
| } | |||
| .tooltip:hover::before { | |||
| display: inline-block; | |||
| } | |||
| } | |||
| @@ -19,29 +19,22 @@ | |||
| <body> | |||
| <div class="scene" id="pick"> | |||
| <div id="pick-blurb"> | |||
| <h1>Welcome to Satiate</h1> | |||
| <a href="https://discord.gg/dSwNN8T">Discord Server</a> | |||
| <br> | |||
| <a href="https://crux.sexy/changelog#satiate">Changelog</a> | |||
| <p class="version">Version: </p> | |||
| <p><b>This game contains 18+ content</b></p> | |||
| <p><b>Most of the games have sound!</b></p> | |||
| </div> | |||
| <h1>Satiate</h1> | |||
| <p id="pick-blurb">Satiate is a text-adventure engine. You can browse the available stories below.</p> | |||
| <div> | |||
| <select id="game-select"> | |||
| <option hidden value="didnt-pick-a-story-lol">Pick a story</option> | |||
| </select> | |||
| </div> | |||
| <button id="start-button">Start</button> | |||
| <div id="story-info"> | |||
| <h2>Title</h2> | |||
| <div id="title"></div> | |||
| <h2>Description</h2> | |||
| <div id="description"></div> | |||
| <h2>Tags</h2> | |||
| <div id="tags"></div> | |||
| <div> | |||
| <h3 id="description"></h3> | |||
| </div> | |||
| <div> | |||
| <div id="tags"></div> | |||
| </div> | |||
| </div> | |||
| <button id="start-button">Start</button> | |||
| </div> | |||
| <div class="hidden-scene" id="game"> | |||
| <div id="info-area"> | |||
| @@ -49,11 +42,11 @@ | |||
| <div id="game-menu"> | |||
| <button class="game-menu-button" id="game-menu-button">Menu</button> | |||
| </div> | |||
| <div class="info-header" id="world-info-header">Info</div> | |||
| <div id="world-info"> | |||
| <div class="info-header" id="world-info-header">World</div> | |||
| </div> | |||
| <div class="info-header" id="player-info-header">Stats</div> | |||
| <div id="player-info"> | |||
| <div class="info-header" id="player-info-header">Player</div> | |||
| </div> | |||
| </div> | |||
| <div id="log"> | |||
| @@ -61,8 +54,8 @@ | |||
| <div class="sidebar"> | |||
| <div id="area-name"></div> | |||
| <div id="area-desc"></div> | |||
| <div class="info-header" id="area-info-header">Room Info</div> | |||
| <div id="area-info"> | |||
| <div class="info-header" id="area-info-header">Area</div> | |||
| </div> | |||
| </div> | |||
| </div> | |||
| @@ -3,7 +3,7 @@ | |||
| let activeModal = null; | |||
| const newline = String.fromCharCode(160); | |||
| const version = "0.1.2"; | |||
| const version = "0.1.3"; | |||
| let state; | |||
| @@ -183,6 +183,9 @@ function initStart() { | |||
| div.classList.add("tooltip"); | |||
| holder.appendChild(div); | |||
| }) | |||
| document.querySelector("#description").innerText = story.info.desc; | |||
| document.querySelector("#start-button").style.display = "block"; | |||
| }); | |||
| const start = document.querySelector("#start-button"); | |||
| @@ -7,5 +7,10 @@ class CORSRequestHandler (SimpleHTTPRequestHandler): | |||
| self.send_header('Access-Control-Allow-Origin', '*') | |||
| SimpleHTTPRequestHandler.end_headers(self) | |||
| def send_my_headers(self): | |||
| self.send_header("Cache-Control", "no-cache") | |||
| self.send_header("Pragma", "no-cache") | |||
| self.send_header("Expires", "0") | |||
| if __name__ == '__main__': | |||
| test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 80) | |||
| @@ -90,7 +90,9 @@ stories.push({ | |||
| "exits": { | |||
| "up": { | |||
| "target": "Locked Room", | |||
| "desc": "It's locked!", | |||
| get desc() { | |||
| return state.player.items.keys.includes("Locked Room") ? "It's locked, but at least you have the key" : "It's locked!"; | |||
| }, | |||
| "conditions": [ | |||
| (room) => { | |||
| return state.player.items.keys.includes("Locked Room"); | |||
| @@ -41,7 +41,7 @@ function resetControls() { | |||
| button.classList.add("move-button") | |||
| button.id = "move-" + dir; | |||
| button.classList.add("missing"); | |||
| button.setAttribute("disabled", "true"); | |||
| disableButton(button); | |||
| button.textContent = dirs[dir]; | |||
| moveHolder.appendChild(button); | |||
| @@ -159,8 +159,7 @@ function updateRoom() { | |||
| Object.entries(dirs).forEach(([dir, name]) => { | |||
| const button = document.querySelector("#move-" + dir); | |||
| button.classList.add("disabled"); | |||
| button.setAttribute("disabled", "true"); | |||
| disableButton(button); | |||
| button.textContent = dirs[dir]; | |||
| }); | |||
| @@ -178,18 +177,25 @@ function updateRoom() { | |||
| } | |||
| button.classList.remove("missing"); | |||
| button.classList.add("disabled"); | |||
| disableButton(button); | |||
| button.textContent = dest.name; | |||
| // if any condition fails, don't enable/add a listener | |||
| button.addEventListener("mouseenter", () => { | |||
| showActionDescription(exit.desc); | |||
| }); | |||
| button.addEventListener("mouseleave", () => { | |||
| removeActionDescription(); | |||
| }); | |||
| // if any condition fails, don't turn it on and allow clicks | |||
| if (exit.conditions) { | |||
| if (!exit.conditions.every(cond => cond(room,state))) { | |||
| return; | |||
| } | |||
| } | |||
| button.classList.remove("disabled"); | |||
| button.removeAttribute("disabled"); | |||
| enableButton(button); | |||
| if (moveListeners[dir]) { | |||
| button.removeEventListener("click", moveListeners[dir]); | |||
| @@ -203,14 +209,6 @@ function updateRoom() { | |||
| button.addEventListener("click", moveFunc); | |||
| moveListeners[dir] = moveFunc; | |||
| button.addEventListener("mouseenter", () => { | |||
| showActionDescription(exit.desc); | |||
| }); | |||
| button.addEventListener("mouseleave", () => { | |||
| removeActionDescription(); | |||
| }); | |||
| }); | |||
| } | |||
| @@ -235,8 +233,10 @@ function updateRoom() { | |||
| button.textContent = action.name; | |||
| button.addEventListener("click", () => { | |||
| action.execute(room); | |||
| refresh(); | |||
| if (!button.classList.contains("disabled")) { | |||
| action.execute(room); | |||
| refresh(); | |||
| } | |||
| }); | |||
| button.addEventListener("mouseenter", () => { | |||
| @@ -258,11 +258,9 @@ function updateRoom() { | |||
| if (action.conditions) { | |||
| if (!action.conditions.every(cond => cond(room))) { | |||
| button.classList.add("disabled"); | |||
| button.setAttribute("disabled", true); | |||
| disableButton(button); | |||
| } else { | |||
| button.classList.remove("disabled"); | |||
| button.removeAttribute("disabled"); | |||
| enableButton(button); | |||
| } | |||
| } | |||
| @@ -281,3 +279,13 @@ function updateRoom() { | |||
| added.forEach(button => actionHolder.appendChild(button)); | |||
| } | |||
| } | |||
| function disableButton(button) { | |||
| button.setAttribute("tabindex", "-1"); | |||
| button.classList.add("disabled"); | |||
| } | |||
| function enableButton(button) { | |||
| button.removeAttribute("tabindex"); | |||
| button.classList.remove("disabled"); | |||
| } | |||