add move by arrows, add space for preview toggle

This commit is contained in:
Zutatensuppe 2021-04-19 23:59:14 +02:00
parent be6fc7a3a3
commit f5a93f1f57
3 changed files with 101 additions and 11 deletions

View file

@ -438,11 +438,11 @@ function handleInput(gameId, playerId, input, ts) {
let changes = []
const _dataChange = () => {
changes.push(['data', puzzle.data])
changes.push([Protocol.CHANGE_DATA, puzzle.data])
}
const _tileChange = (tileIdx) => {
changes.push(['tile', getTile(gameId, tileIdx)])
changes.push([Protocol.CHANGE_TILE, getTile(gameId, tileIdx)])
}
const _tileChanges = (tileIdxs) => {
@ -452,7 +452,7 @@ function handleInput(gameId, playerId, input, ts) {
}
const _playerChange = () => {
changes.push(['player', Util.encodePlayer(getPlayer(gameId, playerId))])
changes.push([Protocol.CHANGE_PLAYER, Util.encodePlayer(getPlayer(gameId, playerId))])
}
// put both tiles (and their grouped tiles) in the same group

View file

@ -58,6 +58,11 @@ const INPUT_EV_ZOOM_OUT = 5
const INPUT_EV_BG_COLOR = 6
const INPUT_EV_PLAYER_COLOR = 7
const INPUT_EV_PLAYER_NAME = 8
const INPUT_EV_MOVE = 9
const CHANGE_DATA = 1
const CHANGE_TILE = 2
const CHANGE_PLAYER = 3
export default {
EV_SERVER_EVENT,
@ -72,12 +77,19 @@ export default {
LOG_UPDATE_PLAYER,
LOG_HANDLE_INPUT,
INPUT_EV_MOVE, // move by x/y
INPUT_EV_MOUSE_DOWN,
INPUT_EV_MOUSE_UP,
INPUT_EV_MOUSE_MOVE,
INPUT_EV_ZOOM_IN,
INPUT_EV_ZOOM_OUT,
INPUT_EV_BG_COLOR,
INPUT_EV_PLAYER_COLOR,
INPUT_EV_PLAYER_NAME,
CHANGE_DATA,
CHANGE_TILE,
CHANGE_PLAYER,
}