void JsonPaser(string json)
    {
        try{
            FromServerData data = JsonUtility.FromJson <FromServerData>(json);

            if (data == null)
            {
                return;
            }

            if (data.type == FromServerDataParameter.Type_WaitRoomRefresh)
            {
                GameManager.instance.userManager.ReCalcuUsers(data.usersData);
            }

            if (data.type == FromServerDataParameter.Type_RecvQuestion)
            {
                GameManager.instance.EnterGame();
                GameManager.instance.RecieveNewQuestion(data.questionData);
            }

            if (data.type == FromServerDataParameter.Type_Ending)
            {
                GameManager.instance.EndingGame();
            }
        } catch (System.Exception e) {
            Debug.LogError(e.Message.ToString());
        }
    }
Exemplo n.º 2
0
    public void EmuEnding()
    {
        FromServerData emuData = new FromServerData();

        emuData.type = FromServerDataParameter.Type_Ending;
        webSocketClient.DoEmuRecieve(JsonUtility.ToJson(emuData, false));
    }