diff --git a/docs/screenshot.png b/docs/screenshot.png
index c2a9b32..5710ff8 100644
Binary files a/docs/screenshot.png and b/docs/screenshot.png differ
diff --git a/examples/client.js b/examples/client.js
index c368872..1c4a55b 100644
--- a/examples/client.js
+++ b/examples/client.js
@@ -271,7 +271,13 @@ ws.on('message', (data) => {
state = States.THINKING;
}
} else if (state === States.AWAIT_CHALLENGE_RESPONSE) {
- if (data[0] === MessageTypes.CHALLENGE_ACCEPTED) {
+ if (data[0] === MessageTypes.NO_CHALLENGE) {
+ console.log('Challenge Time Out.');
+ const info = Structs.TypeWithTimeStruct.unpack(data);
+ displayTime(info);
+ displayCurrentGameState();
+ state = States.THINKING;
+ } else if (data[0] === MessageTypes.CHALLENGE_ACCEPTED) {
console.log('Challenge Accepted.');
const info = Structs.TypeWithTimeStruct.unpack(data);
displayTime(info);
diff --git a/main/server.js b/main/server.js
index 160943b..77db429 100644
--- a/main/server.js
+++ b/main/server.js
@@ -252,21 +252,21 @@ class Server {
case MessageTypes.START:
return {
player: 2,
- turn: '-',
- text: 'Game Start',
+ turn: '',
+ text: 'START',
result: '',
};
case MessageTypes.END: {
let resultText;
if (result.end) {
- resultText = _.isNull(result.winner) ? 'Draw' : `Player${result.winner + 1} won`;
+ resultText = _.isNull(result.winner) ? 'Draw' : `P-${result.winner + 1} won`;
} else {
- resultText = 'Game Ended Abruptly';
+ resultText = 'Game Ended Abruptly';
}
return {
player: 3,
- turn: '-',
- text: 'Game End',
+ turn: '',
+ text: 'END',
result: resultText,
};
}
@@ -274,45 +274,47 @@ class Server {
return {
player: result.player,
turn: result.state.turn.toString(),
- text: `Player${result.player + 1}: PASS`,
+ text: `P-${result.player + 1}: PASS`,
result: '',
};
- case MessageTypes.EXCHANGE:
+ case MessageTypes.EXCHANGE: {
+ const count = _.filter(move.tiles, tile => tile !== 0).length;
return {
player: result.player,
turn: result.state.turn.toString(),
- text: `Player${result.player + 1}: EXCHANGE ${
- _.filter(move.tiles, tile => tile !== 0).length
- } Tile(s)`,
+ text: `P-${result.player + 1}: EXCHANGE ${count} tile${count > 1 ? 's' : ''}`,
result: '',
};
+ }
case MessageTypes.PLAY:
return {
player: result.player,
turn: result.state.turn.toString(),
- text: `Player${result.player + 1}: ${String.fromCharCode(64 + move.col)}${move.row} ${
+ text: `P-${result.player + 1}: ${String.fromCharCode(64 + move.col)}${move.row}-${
move.dir === 0 ? 'RIGHT' : 'DOWN'
- } ${ScrabbleUtils.convertPlayableTilesToString(move.tiles)}`,
- result: `${result.score > 0 ? '+' : ''}${result.score}`,
+ } ${
+ ScrabbleUtils.convertPlayableTilesToString(move.tiles).split(',').map(tile => `${tile}`).join(' ')
+ }`,
+ result: `${result.score > 0 ? '+' : ''}${result.score}`,
};
case MessageTypes.NO_CHALLENGE:
return {
player: result.player,
- turn: '-',
- text: `Player${result.player + 1}: APPROVE`,
- result: result.missed ? 'Challenge Missed' : '',
+ turn: '',
+ text: `P-${result.player + 1}: APPROVE`,
+ result: result.missed ? 'Challenge Missed' : '',
};
case MessageTypes.CHALLENGE:
return {
player: result.player,
- turn: '-',
- text: `Player${result.player + 1}: CHALLENGE`,
- result: result.accepted ? 'Challenge Accepted' : 'Challenge Rejected',
+ turn: '',
+ text: `P-${result.player + 1}: CHALLENGE`,
+ result: result.accepted ? 'Challenge Accepted' : 'Challenge Rejected',
};
default:
return {
- player: null,
- turn: '-',
+ player: 3,
+ turn: '',
text: '',
result: '',
};
@@ -579,6 +581,7 @@ class Server {
});
this.updateServerUI();
} else if (event.type === EventTypes.START) {
+ _.times(3).forEach(() => { this.logger.info(_.repeat('*', 100)); });
if (event.data.useCheckPoint && !_.isNull(this.checkpoint)) {
// If user pressed pause, start from a checkpoint if any exists
this.logger.info('Starting game from a Checkpoint');
diff --git a/main/utils/structs.js b/main/utils/structs.js
index a9b2bcc..5a50f8d 100644
--- a/main/utils/structs.js
+++ b/main/utils/structs.js
@@ -1,3 +1,8 @@
+/**
+ * The structs defines how to pack objects to buffers and how to unpack buffers to objects
+ * The main structures, defined in the communication document, were reduced to 9 common structures
+ */
+
const stfu = require('struct-fu');
const TypeStruct = stfu.struct([
diff --git a/renderer/components/History.vue b/renderer/components/History.vue
index 005ad8c..b2d01cf 100644
--- a/renderer/components/History.vue
+++ b/renderer/components/History.vue
@@ -10,8 +10,8 @@
{{ move.turn }}
- {{ move.text }}
- {{ move.result }}
+
+
@@ -96,19 +96,19 @@ export default {
}
.start {
- background-color: rgb(52, 199, 73);
+ background-color: darkgrey;
}
.turn-1 {
- background-color: rgb(252, 86, 82);
+ background-color: $player-1-color;
}
.turn-2 {
- background-color: rgb(254, 195, 66);
+ background-color: $player-2-color;
}
.end {
- background-color: rgb(52, 91, 199);
+ background-color: darkgrey;
}
.move-text {
@@ -124,8 +124,56 @@ export default {
grid-area: result;
font-family: "Roboto", sans-serif;
padding: 5px;
- font-size: 14px;
+ font-size: 12px;
font-weight: 300;
color: white;
}
+
+.tag {
+ padding: 2px 5px;
+ border-radius: 5px;
+ font-family: "Roboto", sans-serif;
+ font-size: 12px;
+ font-weight: 300;
+}
+
+.tag.light {
+ background-color: darkgrey;
+ color: $background-color;
+}
+
+.tag.tile-tag {
+ padding: 2px 2px;
+ background-color: antiquewhite;
+ color: $background-color;
+}
+
+.tag.tile-tag.blank {
+ text-decoration: underline;
+}
+
+.tag.failure {
+ background-color: rgb(252, 86, 82);
+ color: $background-color;
+}
+
+.tag.alert {
+ background-color: rgb(254, 195, 66);
+ color: $background-color;
+}
+
+.tag.success {
+ background-color: rgb(52, 199, 73);
+ color: $background-color;
+}
+
+.tag.player-1 {
+ background-color: $player-1-color;
+ color: $background-color;
+}
+
+.tag.player-2 {
+ background-color: $player-2-color;
+ color: $background-color;
+}
diff --git a/renderer/components/ScoreBoard.vue b/renderer/components/ScoreBoard.vue
index faaf4f7..81d8989 100644
--- a/renderer/components/ScoreBoard.vue
+++ b/renderer/components/ScoreBoard.vue
@@ -108,9 +108,6 @@ export default {
font-weight: 100;
overflow: hidden;
text-overflow: ellipsis;
- //max-width: 95%;
- //max-height: 95%;
- //padding: 2.5%;
}
.player-turn {
@@ -123,11 +120,11 @@ export default {
}
.player-turn-1 {
- background-color: rgb(252, 86, 82);
+ background-color: $player-1-color;
}
.player-turn-2 {
- background-color: rgb(254, 195, 66);
+ background-color: $player-2-color;
}
.player-name {
diff --git a/renderer/variables.scss b/renderer/variables.scss
index 9856150..c4eb413 100644
--- a/renderer/variables.scss
+++ b/renderer/variables.scss
@@ -3,4 +3,7 @@ $box-color: rgb(61, 61, 61);
$border-color: rgb(134, 134, 134);
$border-width: 1px;
+$player-1-color: #89B6A5;
+$player-2-color: #845A6D;
+
$font-color: white;
\ No newline at end of file