update ctrls and add try catch for socket send

This commit is contained in:
ntr 2019-10-20 16:05:40 +11:00
parent c111cfe2b8
commit 2a14fbd3f5
4 changed files with 21 additions and 12 deletions

View File

@ -144,6 +144,12 @@ aside {
} }
} }
.play-ctrl {
.controls {
grid-template-rows: 1fr 1fr 1fr 3fr 1fr;
}
}
.abandon:not([disabled]) { .abandon:not([disabled]) {
&:hover { &:hover {
color: @red; color: @red;

View File

@ -130,8 +130,6 @@ function JoinButtons(args) {
<aside class='play-ctrl'> <aside class='play-ctrl'>
<div class="timer-container"></div> <div class="timer-container"></div>
<div class="controls"> <div class="controls">
{discordBtn}
<div class="flex">
<button <button
class='practice ready' class='practice ready'
onClick={() => sendInstancePractice()} onClick={() => sendInstancePractice()}
@ -139,7 +137,7 @@ function JoinButtons(args) {
Learn Learn
</button> </button>
{inviteBtn()} {inviteBtn()}
</div> {discordBtn}
<AccountBox /> <AccountBox />
<div class="instance-ctrl-btns"> <div class="instance-ctrl-btns">
<button disabled={true} >Chat</button> <button disabled={true} >Chat</button>

View File

@ -93,18 +93,18 @@ function Play(args) {
return ( return (
<section class="top"> <section class="top">
<div class="news"> <div class="news">
<h1>v{VERSION}</h1> <h2>v{VERSION}</h2>
<p class="play-p">Use the buttons on the right to join an instance.</p> <p class="play-p">Use the buttons on the right to join an instance.</p>
<p> <p>
Select <b>PVP</b> to play against other players.<br /> Select <b>PVP</b> to play against other players.<br />
Select <b>INVITE</b> then click <b>COPY LINK</b> to generate an instance invitation for a friend.<br /> Select <b>INVITE</b> then click <b>COPY LINK</b> to generate an instance invitation for a friend.<br />
Click <b>LEARN</b> to practice the game without time controls. Click <b>LEARN</b> to practice the game without time controls.
</p> </p>
<p>Join our Discord server to find opponents, message @ntr or @mashy for some credits to get started.</p>
<p> <p>
If you enjoy the game please support its development by <b>subscribing</b> or purchasing <b>credits</b>.<br /> If you enjoy the game please support its development by <b>subscribing</b> or purchasing <b>credits</b>.<br />
glhf glhf
</p> </p>
<p>--ntr & mashy</p>
</div> </div>
<div> <div>
<h1 class="credits">¤ {account.balance}</h1> <h1 class="credits">¤ {account.balance}</h1>

View File

@ -30,7 +30,12 @@ function createSocket(events) {
// ------------- // -------------
function send(msg) { function send(msg) {
if (msg[0] !== 'Ping') console.log('outgoing msg', msg); if (msg[0] !== 'Ping') console.log('outgoing msg', msg);
try {
ws.send(cbor.encode(msg)); ws.send(cbor.encode(msg));
} catch (e) {
console.warn(e);
return connect();
}
} }
let ping; let ping;