parent
e8d1fec9b6
commit
c20f9d1534
16 changed files with 463 additions and 531 deletions
After Width: | Height: | Size: 30 KiB |
After Width: | Height: | Size: 8.7 KiB |
@ -1,52 +0,0 @@ |
||||
const Join = function() { |
||||
document.addEventListener('L-conn-error', this.onConnectionError.bind(this)); |
||||
document.addEventListener('L-conn-open', this.onConnectionOpen.bind(this)); |
||||
|
||||
document.getElementById('join-setup-start').addEventListener('click', this.onClickStart.bind(this)); |
||||
document.getElementById('join-setup-go').addEventListener('click', this.onClickStart.bind(this)); |
||||
document.getElementById('join-setup-back').addEventListener('click', this.onClickBack.bind(this)); |
||||
|
||||
this.showSetup(); |
||||
}; |
||||
|
||||
Join.prototype.showSetup = function() { |
||||
document.getElementById('join-setup').style.display = 'block'; |
||||
document.getElementById('join-connect').style.display = 'none'; |
||||
document.getElementById('join-error').style.display = 'none'; |
||||
}; |
||||
|
||||
Join.prototype.showLoad = function() { |
||||
document.getElementById('join-setup').style.display = 'none'; |
||||
document.getElementById('join-connect').style.display = 'block'; |
||||
document.getElementById('join-error').style.display = 'none'; |
||||
}; |
||||
|
||||
Join.prototype.showError = function() { |
||||
document.getElementById('join-setup').style.display = 'none'; |
||||
document.getElementById('join-connect').style.display = 'none'; |
||||
document.getElementById('join-error').style.display = 'block'; |
||||
}; |
||||
|
||||
Join.prototype.onClickBack = function() { |
||||
this.showSetup(); |
||||
}; |
||||
|
||||
Join.prototype.onClickGo = function() { |
||||
this.showLoad(); |
||||
}; |
||||
|
||||
Join.prototype.onClickStart = function() { |
||||
this.showLoad(); |
||||
|
||||
const evt = new Event('L-join'); |
||||
document.dispatchEvent(evt); |
||||
}; |
||||
|
||||
Join.prototype.onConnectionError = function() { |
||||
this.showError(); |
||||
}; |
||||
|
||||
Join.prototype.onConnectionOpen = function() { |
||||
document.getElementById('join').style.display = 'none'; |
||||
this.showSetup(); |
||||
}; |
@ -1,100 +0,0 @@ |
||||
#controls-container { |
||||
background: #e7e7e7; |
||||
border: solid #e7e7e7; |
||||
border-width: 0 10px; |
||||
bottom: 0; |
||||
left: 20px; |
||||
position: absolute; |
||||
top: 0; |
||||
width: 300px; |
||||
z-index: 1; |
||||
} |
||||
|
||||
.controls-title { |
||||
background-color: #639978; |
||||
background-image: url('sprite-robots.png'); |
||||
/*color: #fff;*/ |
||||
font-size: 12px; |
||||
line-height: 48px; |
||||
margin-bottom: 24px; |
||||
text-align: center; |
||||
} |
||||
|
||||
.controls-subtitle { |
||||
background-color: #4D3243; |
||||
background-image: linear-gradient(90deg, #4D3243, #3C2132); |
||||
color: #fff; |
||||
padding: 12px; |
||||
margin: 24px 0 12px 0; |
||||
} |
||||
|
||||
.controls-alert-info { |
||||
background: #21dfae; |
||||
color: #222; |
||||
padding: 12px; |
||||
margin: 24px 0 12px 0; |
||||
} |
||||
|
||||
.controls-alert-urgent { |
||||
background: #DE4F21; |
||||
color: #fff; |
||||
padding: 12px; |
||||
margin: 24px 0 12px 0; |
||||
} |
||||
|
||||
.controls-row { |
||||
align-items: center; |
||||
display: flex; |
||||
flex-direction: row; |
||||
padding: 8px; |
||||
} |
||||
|
||||
.controls-row :nth-child(2) { |
||||
flex: 1; |
||||
margin: 0 8px; |
||||
width: 100%; |
||||
} |
||||
|
||||
.controls-player { |
||||
padding: 8px; |
||||
} |
||||
|
||||
#controls-footer { |
||||
bottom: 0; |
||||
left: 0; |
||||
padding: 24px; |
||||
position: absolute; |
||||
right: 0; |
||||
text-align: center; |
||||
} |
||||
|
||||
#controls-footer a { |
||||
color: #639699; |
||||
font-size: 24px; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
#controls-footer a:hover { |
||||
text-decoration: underline; |
||||
} |
||||
|
||||
.controls-button { |
||||
background: none; |
||||
border: 1px solid #888; |
||||
color: #444; |
||||
cursor: pointer; |
||||
font-size: 12px; |
||||
padding: 4px 8px; |
||||
} |
||||
|
||||
.controls-button:hover { |
||||
background: #21dfae; |
||||
border-color: #21dfae; |
||||
color: #222; |
||||
} |
||||
|
||||
#controls-start { |
||||
display: block; |
||||
margin: 0 auto; |
||||
padding: 4px 8px; |
||||
} |
@ -1,16 +0,0 @@ |
||||
* { |
||||
box-sizing: border-box; |
||||
font-family: Montserrat; |
||||
} |
||||
|
||||
body { |
||||
overflow: hidden; |
||||
} |
||||
|
||||
/* |
||||
PALETTE: |
||||
21DFAE Aquamarine |
||||
4D3243 Plum |
||||
DE4F21 Fire |
||||
639699 Cadet |
||||
*/ |
@ -1,115 +1,92 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="en"> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<title>Robots</title> |
||||
<link rel="stylesheet" href="index.css"> |
||||
<link rel="stylesheet" href="controls.css"> |
||||
<link rel="stylesheet" href="grid.css"> |
||||
<link rel="stylesheet" href="join.css"> |
||||
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet"> |
||||
<script type='text/javascript' src='client/connection.js'></script> |
||||
<script type='text/javascript' src='client/controls.js'></script> |
||||
<script type='text/javascript' src='client/cookie.js'></script> |
||||
<script type='text/javascript' src='client/grid.js'></script> |
||||
<script type='text/javascript' src='client/icons.js'></script> |
||||
<script type='text/javascript' src='client/stack.js'></script> |
||||
</head> |
||||
<body> |
||||
<!-- <div id="join"> |
||||
<div id='join-setup'> |
||||
<button type='button' class='join-button' id='join-setup-start'>Start a new game</button> |
||||
<div class='join-message'>- or -</div> |
||||
<input type="text" placeholder="Join a game" /> |
||||
<button type='text' class='join-button' id='join-setup-go'>Go</button> |
||||
</div> |
||||
<head> |
||||
<meta charset="UTF-8"> |
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||
<title>Robots</title> |
||||
<link rel="stylesheet" href="style/index.css"> |
||||
<link rel="stylesheet" href="style/controls.css"> |
||||
<link rel="stylesheet" href="style/grid.css"> |
||||
<link href="https://fonts.googleapis.com/css2?family=Days+One&display=swap" rel="stylesheet"> |
||||
<script type='text/javascript' src='client/connection.js'></script> |
||||
<script type='text/javascript' src='client/controls.js'></script> |
||||
<script type='text/javascript' src='client/cookie.js'></script> |
||||
<script type='text/javascript' src='client/grid.js'></script> |
||||
<script type='text/javascript' src='client/stack.js'></script> |
||||
</head> |
||||
<body> |
||||
<div id="controls-container"> |
||||
<div class='controls-block' id="controls-players"> |
||||
<div class="controls-title">Players</div> |
||||
<div class="controls-message"></div> |
||||
</div> |
||||
|
||||
<div id="join-connect"> |
||||
<div class='join-message'>Contacting Server</div> |
||||
</div> |
||||
<div class='controls-block' id="controls-moves"> |
||||
<div class="controls-title">Moves</div> |
||||
<div id='controls-moves-count'>24</div> |
||||
|
||||
<div id="join-error"> |
||||
<div class='join-message'>Can't reach the server.</div> |
||||
<button type='text' class='join-button' id='join-setup-back'>Back</button> |
||||
</div> |
||||
</div> |
||||
--> |
||||
<div id="controls-container"> |
||||
<div id="controls-manage"> |
||||
<div class='controls-subtitle'>Global</div> |
||||
<div class="controls-moves-buttons-layout"> |
||||
<div class='controls-button' id='controls-undo'>Undo</div> |
||||
<div class='controls-button' id='controls-reset'>Reset</div> |
||||
</div> |
||||
|
||||
<div class="controls-row"> |
||||
<div>Start Next Round</div> |
||||
<div> </div> |
||||
<div class='controls-button' id='controls-start'>Do It</div> |
||||
<div class='controls-button' id='controls-submit'>Solve the puzzle</div> |
||||
</div> |
||||
|
||||
<div class="controls-row"> |
||||
<div>Stop This Round</div> |
||||
<div> </div> |
||||
<div class='controls-button' id='controls-stop'>Yeah</div> |
||||
<div class='controls-block' id="controls-options"> |
||||
<div class="controls-title">Options</div> |
||||
<div class='controls-button' id='controls-robots'>Move Robots</div> |
||||
<div class='controls-button' id='controls-walls'>Move Walls</div> |
||||
</div> |
||||
|
||||
<div class="controls-row"> |
||||
<div>Move Robots</div> |
||||
<div> </div> |
||||
<div class='controls-button' id='controls-robots'>Reposition</div> |
||||
<div class='controls-block' id='controls-connection'> |
||||
<div class="controls-message" id="controls-connecting">Connecting...</div> |
||||
<div class="controls-message" id='controls-error'>Can't reach the server.</div> |
||||
</div> |
||||
|
||||
<div class="controls-row"> |
||||
<div>Move Walls</div> |
||||
<div> </div> |
||||
<div class='controls-button' id='controls-walls'>Regenerate</div> |
||||
</div> |
||||
</div> |
||||
<div class='controls-block' id="controls-countdown"> |
||||
<div class='controls-title'>Aardvark Matthews Dunkirk has a solution!</div> |
||||
|
||||
<div class="controls-countdown-values-layout"> |
||||
<div id="controls-solution-value">11</div> |
||||
<div id="controls-countdown-value">19</div> |
||||
</div> |
||||
|
||||
<div id="controls-players"> |
||||
<div class='controls-subtitle'>Players</div> |
||||
<div class='controls-button' id='controls-skip'>Skip</div> |
||||
</div> |
||||
|
||||
<div class="controls-player" id='controls-players-nobody'>Nobody is in the game yet.</div> |
||||
</div> |
||||
|
||||
<div class='controls-block' id="controls-solution"> |
||||
<div class='controls-title'>Round over</div> |
||||
<div class="controls-message" id='controls-solution-message'>Congrats Aardvark Matthews Dunkirk!</div> |
||||
|
||||
<div id="controls-local"> |
||||
<div class='controls-subtitle'>Local</div> |
||||
<div class="controls-row"> |
||||
<div>Moves:</div> |
||||
<div id="controls-moves"></div> |
||||
<div class='controls-button' id='controls-undo'>Undo</div> |
||||
<div class='controls-button' id='controls-reset'>Reset</div> |
||||
</div> |
||||
<div id='controls-solution-count'>24</div> |
||||
|
||||
<button id='controls-submit'>Submit</button> |
||||
<div class='controls-button' id='controls-solution-replay'>Replay</div> |
||||
|
||||
<div id="controls-panic"> |
||||
<div class='controls-alert-urgent'></div> |
||||
<div class='controls-button' id='controls-next'>Start next round</div> |
||||
</div> |
||||
|
||||
<div class="controls-row"> |
||||
<div>Countdown:</div> |
||||
<div id="controls-countdown">30 seconds!</div> |
||||
<div class='controls-button' id='controls-skip'>Skip</div> |
||||
</div> |
||||
<div id="controls-footer"> |
||||
<a href='http://buymeacoff.ee/5EGitAV' target='_blank'>♡</a> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="controls-footer"> |
||||
<a href='http://buymeacoff.ee/5EGitAV' target='_blank'>♡</a> |
||||
<div id="content-container"> |
||||
<div id="content-grid"></div> |
||||
</div> |
||||
</div> |
||||
|
||||
<div id="content-container"> |
||||
<div id="content-grid"></div> |
||||
</div> |
||||
<script> |
||||
window.addEventListener('load', () => { |
||||
// Order-independent. Communication via local events. |
||||
new Connection(); |
||||
new Controls(); |
||||
new Grid(); |
||||
new Stack(); |
||||
|
||||
<script> |
||||
window.addEventListener('load', () => { |
||||
// Order-independent. Communication via local events. |
||||
new Connection(); |
||||
new Controls(); |
||||
new Grid(); |
||||
new Stack(); |
||||
}) |
||||
</script> |
||||
</body> |
||||
// Entry point. |
||||
const evt = new Event('L-join'); |
||||
document.dispatchEvent(evt); |
||||
}) |
||||
</script> |
||||
</body> |
||||
</html> |
@ -1,102 +0,0 @@ |
||||
#join { |
||||
background-color: #28313b; |
||||
background-image: linear-gradient(315deg, #28313b 0%, #1A2026 74%); |
||||
bottom: 0; |
||||
color: #e7e7e7; |
||||
display: flex; |
||||
flex-direction: column; |
||||
justify-content: center; |
||||
left: 0; |
||||
position: absolute; |
||||
right: 0; |
||||
text-align: center; |
||||
top: 0; |
||||
z-index: 10; |
||||
} |
||||
|
||||
.join-button { |
||||
background: none; |
||||
border: 1px solid #888; |
||||
color: #ccc; |
||||
cursor: pointer; |
||||
font-size: 32px; |
||||
height: 72px; |
||||
line-height: 72px; |
||||
vertical-align: middle; |
||||
} |
||||
|
||||
.join-button:hover { |
||||
background: #21dfae; |
||||
border-color: #21dfae; |
||||
color: #222; |
||||
} |
||||
|
||||
.join-message { |
||||
font-size: 24px; |
||||
line-height: 72px; |
||||
} |
||||
|
||||
#join-setup-start, |
||||
#join-setup-back { |
||||
width: 500px; |
||||
} |
||||
|
||||
#join-setup-go { |
||||
width: 96px; |
||||
} |
||||
|
||||
#join-setup .join-message { |
||||
margin: 24px 0; |
||||
} |
||||
|
||||
#join-setup input { |
||||
border: 0; |
||||
font-size: 32px; |
||||
height: 72px; |
||||
line-height: 72px; |
||||
margin-right: 40px; |
||||
padding: 0 24px; |
||||
vertical-align: middle; |
||||
width: 360px; |
||||
} |
||||
|
||||
@keyframes LoadingBackground { |
||||
0%{background-position:0% 50%} |
||||
50%{background-position:100% 50%} |
||||
100%{background-position:0% 50%} |
||||
} |
||||
|
||||
#join-connect { |
||||
animation: LoadingBackground 8s infinite; |
||||
background-size: 230% 230%; |
||||
background-image: linear-gradient(90deg, #21DFAE 600px, #FFF 600px, #FFF 605px, #21DFAE 605px); |
||||
color: #222; |
||||
display: none; |
||||
font-size: 32px; |
||||
height: 72px; |
||||
margin: 0 auto; |
||||
text-align: center; |
||||
width: 500px; |
||||
} |
||||
|
||||
#join-error { |
||||
display: none; |
||||
font-size: 32px; |
||||
height: 264px; |
||||
line-height: 264px; |
||||
margin: 0 auto; |
||||
position: relative; |
||||
text-align: center; |
||||
width: 500px; |
||||
} |
||||
|
||||
#join-error .join-message { |
||||
background-color: #DE4F21; |
||||
color: #fff; |
||||
} |
||||
|
||||
#join-error button { |
||||
position: absolute; |
||||
bottom: 0; |
||||
left: 0; |
||||
} |
@ -0,0 +1,198 @@ |
||||
#controls-container { |
||||
bottom: 0; |
||||
left: 20px; |
||||
padding: 40px 0; |
||||
position: absolute; |
||||
top: 0; |
||||
width: 300px; |
||||
z-index: 1; |
||||
} |
||||
|
||||
.controls-block { |
||||
background: #23074d; |
||||
border: 6px solid #483c6c; |
||||
border-radius: 0 18px 0 18px; |
||||
color: #0cffe1; |
||||
font-size: 24px; |
||||
margin-bottom: 24px; |
||||
overflow: hidden; |
||||
padding-bottom: 24px; |
||||
position: relative; |
||||
} |
||||
|
||||
.controls-title { |
||||
background: #0cffe1; |
||||
color: #ff217c; |
||||
font-size: 14px; |
||||
margin-bottom: 16px; |
||||
padding: 8px 24px; |
||||
} |
||||
|
||||
.controls-message { |
||||
cursor: default; |
||||
font-size: 16px; |
||||
padding: 24px; |
||||
} |
||||
|
||||
.controls-button { |
||||
cursor: pointer; |
||||
padding: 8px 0; |
||||
text-align: center; |
||||
} |
||||
|
||||
.controls-button:hover { |
||||
background: yellow; |
||||
color: #23074d; |
||||
} |
||||
|
||||
/*===== PLAYERS BLOCK =====*/ |
||||
#controls-players { |
||||
} |
||||
|
||||
.controls-player { |
||||
cursor: default; |
||||
padding: 8px 24px; |
||||
} |
||||
|
||||
/*===== MOVES BLOCK =====*/ |
||||
#controls-moves { |
||||
background: #00dfd4; |
||||
border: 6px solid #483c6c; |
||||
border-radius: 0 18px 0 18px; |
||||
color: #ff217c; |
||||
position: relative; |
||||
} |
||||
|
||||
#controls-moves-count { |
||||
cursor: default; |
||||
font-size: 84px; |
||||
text-align: center; |
||||
} |
||||
|
||||
.controls-moves-buttons-layout { |
||||
display: flex; |
||||
flex-direction: row; |
||||
} |
||||
|
||||
#controls-reset, |
||||
#controls-undo { |
||||
flex: 1; |
||||
font-size: 12px; |
||||
padding: 12px; |
||||
} |
||||
|
||||
#controls-submit { |
||||
font-size: 24px; |
||||
padding: 8px 0; |
||||
} |
||||
|
||||
/*===== OPTIONS BLOCK =====*/ |
||||
#controls-options { |
||||
} |
||||
|
||||
#controls-options .controls-button { |
||||
font-size: 16px; |
||||
padding: 8px 24px; |
||||
} |
||||
|
||||
/*===== COUNTDOWN BLOCK =====*/ |
||||
#controls-countdown { |
||||
background: #F96600; |
||||
border-color: #ffec83; |
||||
color: #ffff00; |
||||
cursor: default; |
||||
} |
||||
|
||||
#controls-countdown .controls-title { |
||||
background: #CA1800; |
||||
color: #ffec83; |
||||
} |
||||
|
||||
.controls-countdown-values-layout { |
||||
display: flex; |
||||
flex-direction: row; |
||||
} |
||||
|
||||
#controls-countdown-value { |
||||
cursor: default; |
||||
flex: 1; |
||||
font-size: 64px; |
||||
text-align: center; |
||||
} |
||||
|
||||
#controls-countdown-value::after { |
||||
content: 'seconds'; |
||||
display: block; |
||||
font-size: 12px; |
||||
margin-top: -12px; |
||||
} |
||||
|
||||
#controls-solution-value { |
||||
cursor: default; |
||||
flex: 1; |
||||
font-size: 64px; |
||||
text-align: center; |
||||
} |
||||
|
||||
#controls-solution-value::after { |
||||
content: 'moves'; |
||||
display: block; |
||||
font-size: 12px; |
||||
margin-top: -12px; |
||||
} |
||||
|
||||
#controls-skip { |
||||
margin-top: 16px; |
||||
} |
||||
|
||||
/*===== SOLUTION BLOCK =====*/ |
||||
#controls-solution { |
||||
background: #483c6c; |
||||
border-width: 0; |
||||
color: #F96600; |
||||
text-align: center; |
||||
} |
||||
|
||||
#controls-solution-message { |
||||
color: #ffec83; |
||||
padding-bottom: 0; |
||||
} |
||||
|
||||
/* |
||||
0cffe1 CYAN 00dfd4 |
||||
ff217c PINK |
||||
483c6c PURPLE 23074d |
||||
fe5e78 SALMON |
||||
ffa283 PEACH |
||||
F96600 ORANGE |
||||
ffec83 YELLOW FFFF00 |
||||
*/ |
||||
|
||||
#controls-solution-count { |
||||
color: #ffec83; |
||||
cursor: default; |
||||
font-size: 84px; |
||||
} |
||||
|
||||
#controls-solution-replay { |
||||
} |
||||
|
||||
/*===== FOOTER BLOCK =====*/ |
||||
#controls-footer { |
||||
bottom: 0; |
||||
left: 0; |
||||
padding: 24px; |
||||
position: absolute; |
||||
right: 0; |
||||
text-align: center; |
||||
} |
||||
|
||||
#controls-footer a { |
||||
color: #639699; |
||||
font-size: 24px; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
#controls-footer a:hover { |
||||
text-decoration: underline; |
||||
} |
@ -1,6 +1,4 @@ |
||||
#content-container { |
||||
background-color: #28313b; |
||||
background-image: linear-gradient(315deg, #28313b 0%, #1A2026 74%); |
||||
bottom: 0; |
||||
left: 0; |
||||
position: absolute; |
@ -0,0 +1,26 @@ |
||||
* { |
||||
box-sizing: border-box; |
||||
font-family: Days One; |
||||
} |
||||
|
||||
body { |
||||
animation: MovingBackground 600s infinite; |
||||
background-image: url('../assets/stars.png'); |
||||
overflow: hidden; |
||||
} |
||||
|
||||
@keyframes MovingBackground { |
||||
0%{background-position:0% 50%} |
||||
50%{background-position:100% 50%} |
||||
100%{background-position:0% 50%} |
||||
} |
||||
|
||||
/* |
||||
0cffe1 CYAN 00dfd4 |
||||
ff217c PINK |
||||
483c6c PURPLE 23074d |
||||
fe5e78 SALMON |
||||
ffa283 PEACH |
||||
F96600 ORANGE |
||||
ffec83 YELLOW FFFF00 |
||||
*/ |
Loading…
Reference in new issue