fix issues with player bgcolor/color and possibly name in replay

This commit is contained in:
Zutatensuppe 2021-06-07 00:41:01 +02:00
parent 10d56e2898
commit 59d0d0dc2a
3 changed files with 12 additions and 2 deletions

File diff suppressed because one or more lines are too long

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>🧩 jigsaw.hyottoko.club</title> <title>🧩 jigsaw.hyottoko.club</title>
<script type="module" crossorigin src="/assets/index.ac3207a7.js"></script> <script type="module" crossorigin src="/assets/index.c202d09d.js"></script>
<link rel="modulepreload" href="/assets/vendor.684f7bc8.js"> <link rel="modulepreload" href="/assets/vendor.684f7bc8.js">
<link rel="stylesheet" href="/assets/index.5c03949d.css"> <link rel="stylesheet" href="/assets/index.5c03949d.css">
</head> </head>

View file

@ -471,11 +471,17 @@ export async function main(
|| '#222222') || '#222222')
} }
const playerColor = () => { const playerColor = () => {
if (MODE === MODE_REPLAY) {
return localStorage.getItem('player_color') || '#ffffff'
}
return (Game.getPlayerColor(gameId, clientId) return (Game.getPlayerColor(gameId, clientId)
|| localStorage.getItem('player_color') || localStorage.getItem('player_color')
|| '#ffffff') || '#ffffff')
} }
const playerName = () => { const playerName = () => {
if (MODE === MODE_REPLAY) {
return localStorage.getItem('player_name') || '#ffffff'
}
return (Game.getPlayerName(gameId, clientId) return (Game.getPlayerName(gameId, clientId)
|| localStorage.getItem('player_name') || localStorage.getItem('player_name')
|| 'anon') || 'anon')
@ -763,11 +769,15 @@ export async function main(
_last_mouse_down = mouse _last_mouse_down = mouse
} }
} else if (type === Protocol.INPUT_EV_PLAYER_COLOR) {
updatePlayerCursorColor(evt[1])
} else if (type === Protocol.INPUT_EV_MOUSE_DOWN) { } else if (type === Protocol.INPUT_EV_MOUSE_DOWN) {
const pos = { x: evt[1], y: evt[2] } const pos = { x: evt[1], y: evt[2] }
_last_mouse_down = viewport.worldToViewport(pos) _last_mouse_down = viewport.worldToViewport(pos)
updatePlayerCursorState(true)
} else if (type === Protocol.INPUT_EV_MOUSE_UP) { } else if (type === Protocol.INPUT_EV_MOUSE_UP) {
_last_mouse_down = null _last_mouse_down = null
updatePlayerCursorState(false)
} else if (type === Protocol.INPUT_EV_ZOOM_IN) { } else if (type === Protocol.INPUT_EV_ZOOM_IN) {
const pos = { x: evt[1], y: evt[2] } const pos = { x: evt[1], y: evt[2] }
RERENDER = true RERENDER = true