Update WebUI to display server, check, and hint info. CURRENT HINT POINTS DO NOT WORK YET

This commit is contained in:
Chris
2020-06-14 18:04:03 -04:00
parent aa7fe2aa9d
commit e11f33b589
8 changed files with 173 additions and 21 deletions

View File

@@ -1,17 +1,20 @@
import _assign from 'lodash-es/assign';
const initialState = {
serverVersion: null,
forfeitMode: null,
remainingMode: null,
connections: {
snesDevice: '',
snesConnected: false,
serverAddress: null,
serverConnected: false,
},
hints: {
hintCost: null,
checkPoints: null,
playerPoints: 0,
},
totalChecks: 0,
lastCheck: null,
hintCost: null,
checkPoints: null,
hintPoints: 0,
};
const gameStateReducer = (state = initialState, action) => {

View File

@@ -60,6 +60,22 @@ class WebSocketUtils {
parseInt(data.content.iAmFinder, 10) === 1, parseInt(data.content.iAmRecipient, 10) === 1,
data.content.entranceLocation));
case 'gameInfo':
return updateGameState({
serverVersion: data.content.serverVersion,
forfeitMode: data.content.forfeitMode,
remainingMode: data.content.remainingMode,
hintCost: parseInt(data.content.hintCost, 10),
checkPoints: parseInt(data.content.checkPoints, 10),
});
case 'locationCheck':
return updateGameState({
totalChecks: parseInt(data.content.totalChecks, 10),
lastCheck: data.content.lastCheck,
hintPoints: parseInt(data.content.hintPoints, 10),
});
// The client prints several types of messages to the console
case 'critical':
case 'error':