Exemple #1
0
 public InteractiveTimerData(
     InteractiveTimerType newType,
     float newInterval
     )
 {
     type     = newType;
     interval = newInterval;
 }
Exemple #2
0
    void Update()
    {
        if (_singletonInstance != null)
        {
            foreach (_InteractiveWebRequestData _queuedWebRequest in _queuedWebRequests)
            {
                _runningCoRoutines.Add(new CoRoutineInfo(
                                           "MakeWebRequestCoRoutine",
                                           StartCoroutine(MakeWebRequestCoRoutine(
                                                              _queuedWebRequest.requestID,
                                                              _queuedWebRequest.requestUrl,
                                                              _queuedWebRequest.headers,
                                                              _queuedWebRequest.httpVerb,
                                                              _queuedWebRequest.postData)
                                                          )));
            }
            _queuedWebRequests.Clear();

            foreach (InteractiveTimerData _queuedStartTimerRequest in _queuedStartTimerRequests)
            {
                InteractiveTimerType type = _queuedStartTimerRequest.type;
                float interval            = _queuedStartTimerRequest.interval;
                switch (type)
                {
                case InteractiveTimerType.CheckAuthStatus:
                    StopCoroutineByName("CheckAuthStatusCoRoutine");
                    _runningCoRoutines.Add(new CoRoutineInfo(
                                               "CheckAuthStatusCoRoutine",
                                               StartCoroutine(CheckAuthStatusCoRoutine(interval)
                                                              )));
                    break;

                case InteractiveTimerType.RefreshShortCode:
                    StopCoroutineByName("RefreshShortCodeCoRoutine");
                    _runningCoRoutines.Add(new CoRoutineInfo(
                                               "RefreshShortCodeCoRoutine",
                                               StartCoroutine(RefreshShortCodeCoRoutine(interval)
                                                              )));
                    break;

                case InteractiveTimerType.Reconnect:
                    StopCoroutineByName("ReconnectCodeCoRoutine");
                    _runningCoRoutines.Add(new CoRoutineInfo(
                                               "ReconnectCodeCoRoutine",
                                               StartCoroutine(ReconnectCodeCoRoutine(interval)
                                                              )));
                    break;

                default:
                    // No-op
                    break;
                }
            }
            _queuedStartTimerRequests.Clear();

            foreach (InteractiveTimerType _queuedStopTimerRequest in _queuedStopTimerRequests)
            {
                switch (_queuedStopTimerRequest)
                {
                case InteractiveTimerType.CheckAuthStatus:
                    StopCoroutineByName("CheckAuthStatusCoRoutine");
                    break;

                case InteractiveTimerType.RefreshShortCode:
                    StopCoroutineByName("RefreshShortCodeCoRoutine");
                    break;

                case InteractiveTimerType.Reconnect:
                    StopCoroutineByName("ReconnectCodeCoRoutine");
                    break;

                default:
                    // No-op
                    break;
                }
            }
            _queuedStopTimerRequests.Clear();

            if (_queuedTryGetAuthTokensFromCacheRequest)
            {
                TryGetAuthTokensFromCacheEventArgs tryGetAuthTokensFromCacheEventArgs = new TryGetAuthTokensFromCacheEventArgs();
                tryGetAuthTokensFromCacheEventArgs.AuthToken    = PlayerPrefs.GetString("MixerInteractive-AuthToken");
                tryGetAuthTokensFromCacheEventArgs.RefreshToken = PlayerPrefs.GetString("MixerInteractive-RefreshToken");
                if (OnTryGetAuthTokensFromCacheCallback != null)
                {
                    OnTryGetAuthTokensFromCacheCallback(this, tryGetAuthTokensFromCacheEventArgs);
                }
                _queuedTryGetAuthTokensFromCacheRequest = false;
            }

            if (_queuedWriteAuthTokensToCacheRequest)
            {
                WriteAuthTokensToCacheImpl();
            }
        }
    }
Exemple #3
0
 internal void StartTimer(InteractiveTimerType type, float interval)
 {
     _queuedStartTimerRequests.Add(new InteractiveTimerData(type, interval));
 }
Exemple #4
0
 internal void StopTimer(InteractiveTimerType type)
 {
     _queuedStopTimerRequests.Add(type);
 }
    void Update()
    {
        if (_singletonInstance != null)
        {
            foreach (InteractiveWebRequestData _queuedWebRequest in _queuedWebRequests)
            {
                _runningCoRoutines.Add(new CoRoutineInfo(
                                           "MakeWebRequestCoRoutine",
                                           StartCoroutine(MakeWebRequestCoRoutine(
                                                              _queuedWebRequest.requestID,
                                                              _queuedWebRequest.requestUrl,
                                                              _queuedWebRequest.headers,
                                                              _queuedWebRequest.httpVerb,
                                                              _queuedWebRequest.postData)
                                                          )));
            }
            _queuedWebRequests.Clear();

            foreach (InteractiveTimerData _queuedStartTimerRequest in _queuedStartTimerRequests)
            {
                InteractiveTimerType type = _queuedStartTimerRequest.type;
                float interval            = _queuedStartTimerRequest.interval;
                switch (type)
                {
                case InteractiveTimerType.CheckAuthStatus:
                    StopCoroutineByName("CheckAuthStatusCoRoutine");
                    _runningCoRoutines.Add(new CoRoutineInfo(
                                               "CheckAuthStatusCoRoutine",
                                               StartCoroutine(CheckAuthStatusCoRoutine(interval)
                                                              )));
                    break;

                case InteractiveTimerType.RefreshShortCode:
                    StopCoroutineByName("RefreshShortCodeCoRoutine");
                    _runningCoRoutines.Add(new CoRoutineInfo(
                                               "RefreshShortCodeCoRoutine",
                                               StartCoroutine(RefreshShortCodeCoRoutine(interval)
                                                              )));
                    break;

                case InteractiveTimerType.Reconnect:
                    StopCoroutineByName("ReconnectCodeCoRoutine");
                    _runningCoRoutines.Add(new CoRoutineInfo(
                                               "ReconnectCodeCoRoutine",
                                               StartCoroutine(ReconnectCodeCoRoutine(interval)
                                                              )));
                    break;

                default:
                    // No-op
                    break;
                }
            }
            _queuedStartTimerRequests.Clear();

            foreach (InteractiveTimerType _queuedStopTimerRequest in _queuedStopTimerRequests)
            {
                switch (_queuedStopTimerRequest)
                {
                case InteractiveTimerType.CheckAuthStatus:
                    StopCoroutineByName("CheckAuthStatusCoRoutine");
                    break;

                case InteractiveTimerType.RefreshShortCode:
                    StopCoroutineByName("RefreshShortCodeCoRoutine");
                    break;

                case InteractiveTimerType.Reconnect:
                    StopCoroutineByName("ReconnectCodeCoRoutine");
                    break;

                default:
                    // No-op
                    break;
                }
            }
            _queuedStopTimerRequests.Clear();
        }
    }