various niceties"

"
This commit is contained in:
ntr 2019-05-14 13:59:37 +10:00
parent 577ffd6421
commit cd4bd680fb
4 changed files with 11 additions and 10 deletions

View File

@ -30,7 +30,7 @@ class InstanceCreateForm extends Component {
this.sendInstanceNew = sendInstanceNew.bind(this); this.sendInstanceNew = sendInstanceNew.bind(this);
this.nameChange = this.nameChange.bind(this); this.nameInput = this.nameInput.bind(this);
this.playersChange = this.playersChange.bind(this); this.playersChange = this.playersChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
} }
@ -39,7 +39,7 @@ class InstanceCreateForm extends Component {
this.setState({ players: Number(event.target.value) }); this.setState({ players: Number(event.target.value) });
} }
nameChange(event) { nameInput(event) {
this.setState({ name: event.target.value }); this.setState({ name: event.target.value });
} }
@ -63,7 +63,7 @@ class InstanceCreateForm extends Component {
disabled={disabled} disabled={disabled}
value={this.state.name} value={this.state.name}
placeholder="name" placeholder="name"
onChange={this.nameChange} onInput={this.nameInput}
/> />
<label htmlFor="playerSelect">players</label> <label htmlFor="playerSelect">players</label>
<select id="playerSelect" <select id="playerSelect"

View File

@ -7,12 +7,13 @@ class SpawnButton extends Component {
this.state = { value: null, enabled: false }; this.state = { value: null, enabled: false };
this.handleChange = this.handleChange.bind(this); this.handleInput = this.handleInput.bind(this);
this.handleSubmit = this.handleSubmit.bind(this); this.handleSubmit = this.handleSubmit.bind(this);
this.enable = this.enable.bind(this); this.enable = this.enable.bind(this);
} }
handleChange(event) { handleInput(event) {
console.log(event.target.value);
this.setState({ value: event.target.value }); this.setState({ value: event.target.value });
} }
@ -41,7 +42,7 @@ class SpawnButton extends Component {
disabled={!this.state.enabled} disabled={!this.state.enabled}
value={this.state.value} value={this.state.value}
placeholder="name" placeholder="name"
onChange={this.handleChange} onInput={this.handleInput}
/> />
<button <button
className="login-btn" className="login-btn"

View File

@ -29,7 +29,7 @@ function createSocket(events) {
// Outgoing // Outgoing
// ------------- // -------------
function send(msg) { function send(msg) {
console.log('outgoing msg', msg); if (msg.method !== 'ping') console.log('outgoing msg', msg);
msg.token = account && account.token && account.token; msg.token = account && account.token && account.token;
ws.send(cbor.encode(msg)); ws.send(cbor.encode(msg));
} }
@ -287,7 +287,7 @@ function createSocket(events) {
const res = cbor.decode(blob); const res = cbor.decode(blob);
const { method, params } = res; const { method, params } = res;
console.log(res); if (method !== 'pong' ) console.log(res);
// check for error and split into response type and data // check for error and split into response type and data
if (res.err) return errHandler(res.err); if (res.err) return errHandler(res.err);

View File

@ -568,12 +568,12 @@ impl Game {
return self; return self;
} }
info!("upkeep beginning: {:} vs {:}", self.players[0].name, self.players[1].name);
if !self.phase_timed_out() { if !self.phase_timed_out() {
return self; return self;
} }
info!("upkeep game: {:} vs {:}", self.players[0].name, self.players[1].name);
for player in self.players.iter_mut() { for player in self.players.iter_mut() {
if !player.ready { if !player.ready {
player.set_ready(true); player.set_ready(true);