void ProcessServerMessage(string message) { MsgHeader header = JsonUtility.FromJson <MsgHeader>(message); switch (header.cmd ^ Commands.SERVER_UPDATE) { case Commands.ROOM_UPDATED: //Process room from added player break; case Commands.SLOT_REJECTED: //Continue playing break; case Commands.BOARD_UPDATE: //Update board break; case Commands.TURN_UPDATE: TurnUpdateMsg turnMsg = JsonUtility.FromJson <TurnUpdateMsg>(message); //decide what to use as a base IsTurn = turnMsg.playerTurn == NetPlayer.Username; //update turn accordingly break; case Commands.GAME_SET: //Display Winner break; } }
void UpdateTurn() { if (m_CurrentPlayerTurn == 0) { //Send Update Turn message via server TurnUpdateMsg tmsg = new TurnUpdateMsg(); tmsg.playerTurn = m_players[1]; } }