//Read messages from the server private void onIncomingData(string data) { Debug.Log("CLIENT: " + data); string[] aData = data.Split('|'); switch (aData[0]) { case "SWHO": for (int i = 1; i < aData.Length - 1; i++) { userConnected(aData[i], false); } send("CWHO|" + clientName + "|" + ((isHost ? 1 : 0).ToString())); break; case "SCNN": //Connect userConnected(aData[1], false); break; case "SDCNN": //Someone Disconnected. BoardManager.Instance.disconnectedPanel.SetActive(true); BoardManager.Instance.panelState(true); break; case "SMOV": //Move Piece BoardManager.Instance.moveChessPiece(int.Parse(aData[1]), int.Parse(aData[2]), int.Parse(aData[3]), int.Parse(aData[4])); break; case "SUPGR": //Upgrade BoardManager.Instance.pawnUpgrade(int.Parse(aData[1]), int.Parse(aData[2]), int.Parse(aData[3])); break; case "SSPELL": //Spell Upgrade BoardManager.Instance.actionSpell(aData[1], int.Parse(aData[2]), int.Parse(aData[3])); break; case "SCHAT": //Chat Bubble ChatBubble.createChatBubble(BoardManager.Instance.chatPanel, GameManager.Instance.chatBubble, bool.Parse(aData[1]), aData[2]); break; case "SRST": BoardManager.Instance.restartGameRequests += 1; break; } }