예제 #1
0
    public async void TryConnect()
    {
        for (int i = 0; i < 30; i++)
        {
            if (!string.IsNullOrEmpty(authorizationCode))
            {
                connection = await Twitch.Base.TwitchConnection.ConnectViaAuthorizationCode(Secrets.CLIENT_ID, Secrets.OAUTH_TOKEN, authorizationCode, redirectUrl : "http://localhost:8919");

                CurrentUser = await connection.V5API.Users.GetCurrentUser();

                if (CurrentUser != null && CurrentUser.id != null)
                {
                    CurrentChannel = await connection.V5API.Channels.GetCurrentChannel();

                    //CanvasIntro.enabled = false;
                    UnityEngine.Debug.Log("Escutando eventos");
                    EscutaEventos();
                }
                break;
            }
            UnityEngine.Debug.Log("Twitch Tentativa " + i.ToString());
            await Task.Delay(1000);
        }

        UnityEngine.Debug.Log(authorizationCode);
    }