コード例 #1
0
    void CheckCommand()
    {
        if (LaatJeLikken.commands.Count > 0)
        {
            ClientData command       = LaatJeLikken.commands.Dequeue();
            Command    parsedCommand = JsonConvert.DeserializeObject <Command>(command.Data);
            Debug.Log("Data sent: " + parsedCommand.data);
            Debug.Log(parsedCommand.command);

            if (parsedCommand.command == Command.CommandType.TextInput)
            {
                CheckTextInput(parsedCommand.data);
            }

            else if (parsedCommand.command == Command.CommandType.Pause)
            {
                videoPlayer.TogglePause();
            }

            else if (parsedCommand.command == Command.CommandType.VoteSkip)
            {
                if (!votedUsers.Contains(command.address))
                {
                    votedUsers.Add(command.address);
                    votedUserCount++;
                    text.text = votedUserCount.ToString() + " / " + LaatJeLikken.userCount + " voted skip";
                    text.gameObject.SetActive(true);
                    CheckVoteSkip();
                }
            }
        }
    }