Settings and activity
3 results found
-
2 votes
An error occurred while saving the comment
b00mzer
supported this idea
·
-
9 votes
An error occurred while saving the comment
b00mzer
commented
Try that
const float REFRESH_SECOND = 1;
readonly TwitchOAuthScope[] SCOPES = new TwitchOAuthScope[] {
TwitchOAuthScope.Bits.Read,
TwitchOAuthScope.Channel.ManageBroadcast,
TwitchOAuthScope.Channel.ManagePolls,
TwitchOAuthScope.Channel.ManageRedemptions,
TwitchOAuthScope.Channel.ReadHypeTrain,
TwitchOAuthScope.Channel.ManagePredictions,
TwitchOAuthScope.Clips.Edit,
TwitchOAuthScope.User.ReadSubscriptions};GameTask<AuthenticationInfo> _authInfoTask;
GameTask<AuthState> _curAuthState;/// <summary>
/// Thread for the connection to twitch API
/// </summary>
/// <returns></returns>
private void ConnectionToApplicationAPI()
{
switch (_curAuthState.MaybeResult.Status)
{
case AuthStatus.LoggedIn:
break;case AuthStatus.WaitingForCode:
break;case AuthStatus.LoggedOut:
case AuthStatus.Loading:
//Remake a connection
if (_authInfoTask == null)
_authInfoTask = Twitch.API.GetAuthenticationInfo(SCOPES);StartCoroutine(CheckAuthInfoTask());
break;
}
}/// <summary>
/// Thread to open a web page for logging the user
/// </summary>
/// <returns></returns>
IEnumerator CheckAuthInfoTask ()
{
while (true)
{
switch (_authInfoTask.Task.Status)
{
case TaskStatus.Created:
case TaskStatus.WaitingForActivation:
case TaskStatus.WaitingToRun:
case TaskStatus.Running:
case TaskStatus.WaitingForChildrenToComplete:
case TaskStatus.RanToCompletion:
Application.OpenURL(_authInfoTask.Task.Result.Uri);
yield break;
case TaskStatus.Canceled:
yield break;
case TaskStatus.Faulted:
yield break;
}yield return new WaitForSeconds(REFRESH_SECOND);
}
}
b00mzer
supported this idea
·
-
20 votes
An error occurred while saving the comment
b00mzer
commented
On unity I solved the problem
const float REFRESH_SECOND = 1;
readonly TwitchOAuthScope[] SCOPES = new TwitchOAuthScope[] {
TwitchOAuthScope.Bits.Read,
TwitchOAuthScope.Channel.ManageBroadcast,
TwitchOAuthScope.Channel.ManagePolls,
TwitchOAuthScope.Channel.ManageRedemptions,
TwitchOAuthScope.Channel.ReadHypeTrain,
TwitchOAuthScope.Channel.ManagePredictions,
TwitchOAuthScope.Clips.Edit,
TwitchOAuthScope.User.ReadSubscriptions};GameTask<AuthenticationInfo> _authInfoTask;
GameTask<AuthState> _curAuthState;/// <summary>
/// Thread for the connection to twitch API
/// </summary>
/// <returns></returns>
private void ConnectionToApplicationAPI()
{
switch (_curAuthState.MaybeResult.Status)
{
case AuthStatus.LoggedIn:
break;case AuthStatus.WaitingForCode:
break;case AuthStatus.LoggedOut:
case AuthStatus.Loading:
//Remake a connection
if (_authInfoTask == null)
_authInfoTask = Twitch.API.GetAuthenticationInfo(SCOPES);StartCoroutine(CheckAuthInfoTask());
break;
}
}/// <summary>
/// Thread to open a web page for logging the user
/// </summary>
/// <returns></returns>
IEnumerator CheckAuthInfoTask ()
{
while (true)
{
switch (_authInfoTask.Task.Status)
{
case TaskStatus.Created:
case TaskStatus.WaitingForActivation:
case TaskStatus.WaitingToRun:
case TaskStatus.Running:
case TaskStatus.WaitingForChildrenToComplete:
case TaskStatus.RanToCompletion:
Application.OpenURL(_authInfoTask.Task.Result.Uri);
yield break;
case TaskStatus.Canceled:
yield break;
case TaskStatus.Faulted:
yield break;
}yield return new WaitForSeconds(REFRESH_SECOND);
}
}
b00mzer
supported this idea
·
the sdk is not complete :/