Commit a669016d authored by Chunchi Che's avatar Chunchi Che

update small

parent 0509adc7
...@@ -34,7 +34,7 @@ export default function WaitRoom() { ...@@ -34,7 +34,7 @@ export default function WaitRoom() {
} }
ws.current.onopen = () => { ws.current.onopen = () => {
console.log("websocket open"); console.log("Websocket open");
if ( if (
player != null && player != null &&
...@@ -53,7 +53,7 @@ export default function WaitRoom() { ...@@ -53,7 +53,7 @@ export default function WaitRoom() {
}; };
ws.current.onclose = () => { ws.current.onclose = () => {
console.log("websocket closed"); console.log("Websocket closed");
}; };
ws.current.onmessage = e => { ws.current.onmessage = e => {
...@@ -103,8 +103,6 @@ export default function WaitRoom() { ...@@ -103,8 +103,6 @@ export default function WaitRoom() {
break; break;
} }
case ygopro.StocHsPlayerChange.State.READY: { case ygopro.StocHsPlayerChange.State.READY: {
console.log("Player " + change.pos + " has ready");
const updateState = (player: Player) => { const updateState = (player: Player) => {
const state = "ready"; const state = "ready";
player.state = state; player.state = state;
...@@ -114,13 +112,10 @@ export default function WaitRoom() { ...@@ -114,13 +112,10 @@ export default function WaitRoom() {
change.pos == 0 change.pos == 0
? setPlayer0(updateState) ? setPlayer0(updateState)
: setPlayer1(updateState); : setPlayer1(updateState);
forceUpdate();
break; break;
} }
case ygopro.StocHsPlayerChange.State.NO_READY: { case ygopro.StocHsPlayerChange.State.NO_READY: {
console.log("Player " + change.pos + " not ready");
const updateState = (player: Player) => { const updateState = (player: Player) => {
const state = "not ready"; const state = "not ready";
player.state = state; player.state = state;
...@@ -130,20 +125,15 @@ export default function WaitRoom() { ...@@ -130,20 +125,15 @@ export default function WaitRoom() {
change.pos == 0 change.pos == 0
? setPlayer0(updateState) ? setPlayer0(updateState)
: setPlayer1(updateState); : setPlayer1(updateState);
forceUpdate();
break; break;
} }
case ygopro.StocHsPlayerChange.State.LEAVE: { case ygopro.StocHsPlayerChange.State.LEAVE: {
console.log("Player " + change.pos + " has leave");
change.pos == 0 ? setPlayer0({}) : setPlayer1({}); change.pos == 0 ? setPlayer0({}) : setPlayer1({});
break; break;
} }
case ygopro.StocHsPlayerChange.State.TO_OBSERVER: { case ygopro.StocHsPlayerChange.State.TO_OBSERVER: {
console.log("Player " + change.pos + " has moved to observer");
change.pos == 0 ? setPlayer0({}) : setPlayer1({}); change.pos == 0 ? setPlayer0({}) : setPlayer1({});
setObserverCount(observerCount + 1); setObserverCount(observerCount + 1);
...@@ -153,6 +143,8 @@ export default function WaitRoom() { ...@@ -153,6 +143,8 @@ export default function WaitRoom() {
break; break;
} }
} }
forceUpdate();
} }
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment