Delete the demo scrubber; complex and not very useful
This commit is contained in:
parent
ab377f6593
commit
cd7a328963
40
js/main.js
40
js/main.js
@ -723,7 +723,6 @@ const GAME_UI_HTML = `
|
|||||||
<button class="demo-step-4" type="button">Step 1 move</button>
|
<button class="demo-step-4" type="button">Step 1 move</button>
|
||||||
<button class="demo-step-20" type="button">Step 1 second</button>
|
<button class="demo-step-20" type="button">Step 1 second</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="demo-scrubber"></div>
|
|
||||||
<div class="input"></div>
|
<div class="input"></div>
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
@ -898,17 +897,6 @@ class Game {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Populate demo scrubber
|
|
||||||
let scrubber_el = this.container.querySelector('.demo-scrubber');
|
|
||||||
let scrubber_elements = {};
|
|
||||||
for (let [action, label] of Object.entries(ACTION_LABELS)) {
|
|
||||||
let el = mk('li');
|
|
||||||
scrubber_el.append(el);
|
|
||||||
scrubber_elements[action] = el;
|
|
||||||
}
|
|
||||||
this.demo_scrubber_marker = mk('div.demo-scrubber-marker');
|
|
||||||
scrubber_el.append(this.demo_scrubber_marker);
|
|
||||||
|
|
||||||
// Populate input debugger
|
// Populate input debugger
|
||||||
this.input_el = this.container.querySelector('.input');
|
this.input_el = this.container.querySelector('.input');
|
||||||
this.input_action_elements = {};
|
this.input_action_elements = {};
|
||||||
@ -921,30 +909,7 @@ class Game {
|
|||||||
// Done with UI, now we can load a level
|
// Done with UI, now we can load a level
|
||||||
this.load_level(0);
|
this.load_level(0);
|
||||||
|
|
||||||
// Fill in the scrubber
|
|
||||||
if (false && this.level.stored_level.demo) {
|
if (false && this.level.stored_level.demo) {
|
||||||
let input_starts = {};
|
|
||||||
for (let action of Object.keys(ACTION_LABELS)) {
|
|
||||||
input_starts[action] = null;
|
|
||||||
}
|
|
||||||
let t = 0;
|
|
||||||
for (let input of this.level.stored_level.demo) {
|
|
||||||
for (let [action, t0] of Object.entries(input_starts)) {
|
|
||||||
if (input.has(action)) {
|
|
||||||
if (t0 === null) {
|
|
||||||
input_starts[action] = t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (t0 !== null) {
|
|
||||||
let bar = mk('span.demo-scrubber-bar');
|
|
||||||
bar.style.setProperty('--start-time', t0);
|
|
||||||
bar.style.setProperty('--end-time', t);
|
|
||||||
scrubber_elements[action].append(bar);
|
|
||||||
input_starts[action] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
t += 1;
|
|
||||||
}
|
|
||||||
this.demo = this.level.stored_level.demo[Symbol.iterator]();
|
this.demo = this.level.stored_level.demo[Symbol.iterator]();
|
||||||
// FIXME should probably start playback on first input
|
// FIXME should probably start playback on first input
|
||||||
this.set_state('playing');
|
this.set_state('playing');
|
||||||
@ -1106,11 +1071,6 @@ class Game {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.demo) {
|
|
||||||
this.demo_scrubber_marker.style.setProperty('--time', this.tic);
|
|
||||||
this.demo_scrubber_marker.scrollIntoView({inline: 'center'});
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let action of Object.keys(ACTION_LABELS)) {
|
for (let action of Object.keys(ACTION_LABELS)) {
|
||||||
this.input_action_elements[action].classList.toggle('--pressed', this.previous_input.has(action));
|
this.input_action_elements[action].classList.toggle('--pressed', this.previous_input.has(action));
|
||||||
}
|
}
|
||||||
|
|||||||
31
style.css
31
style.css
@ -252,37 +252,6 @@ dl.score-chart .-sum {
|
|||||||
grid-area: demo;
|
grid-area: demo;
|
||||||
}
|
}
|
||||||
|
|
||||||
.demo-scrubber {
|
|
||||||
position: relative;
|
|
||||||
overflow-x: auto;
|
|
||||||
padding: 0;
|
|
||||||
margin: 1em 0;
|
|
||||||
list-style: none;
|
|
||||||
}
|
|
||||||
.demo-scrubber li {
|
|
||||||
position: relative;
|
|
||||||
height: 1em;
|
|
||||||
margin: 2px 0;
|
|
||||||
background: #303030;
|
|
||||||
}
|
|
||||||
.demo-scrubber li .demo-scrubber-bar {
|
|
||||||
position: absolute;
|
|
||||||
height: 1em;
|
|
||||||
left: calc(var(--start-time) * 3px);
|
|
||||||
width: calc((var(--end-time) - var(--start-time)) * 3px);
|
|
||||||
background: #606060;
|
|
||||||
}
|
|
||||||
.demo-scrubber .demo-scrubber-marker {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: calc(var(--time) * 3px);
|
|
||||||
width: 2px;
|
|
||||||
margin-left: -1px;
|
|
||||||
background: darkred;
|
|
||||||
--time: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Debug stuff */
|
/* Debug stuff */
|
||||||
.input {
|
.input {
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user