private void changeState(ExchangeScreenState state)
        {
            switch (state)
            {
            case ExchangeScreenState.Exchanging:
                if (currentState == ExchangeScreenState.Idle)
                {
                    rewardService.CalculateExchangeAllForCoins(this);
                    Service.Get <EventDispatcher>().AddListener <RewardServiceEvents.MyRewardCalculated>(onMyRewardCalculated);
                    ExchangeButton.gameObject.SetActive(value: false);
                    ProgressBar.SetActive(value: true);
                    CounterAnimator.SetTrigger("CounterEnabled");
                    animator.SetTrigger("ExchangeLoop");
                    progressBarImage.fillAmount = 0f;
                    Service.Get <TutorialManager>().SetTutorial(Collect1TutorialDefinition.Id, isComplete: true);
                    Service.Get <TutorialManager>().SetTutorial(Collect2TutorialDefinition.Id, isComplete: true);
                }
                break;

            case ExchangeScreenState.Complete:
                if (currentState == ExchangeScreenState.Exchanging)
                {
                    CoroutineRunner.Start(stopExchangeAnimation(), this, "exchangeStopAnimationDelay");
                    currentState = state;
                }
                break;
            }
        }
 private bool onMyRewardCalculated(RewardServiceEvents.MyRewardCalculated evt)
 {
     coinsToCollect = evt.Coins;
     totalAnimTime  = Mathf.Clamp((float)coinsToCollect * CoinAnimTimeRatio, MinAnimTime, MaxAnimTime);
     Service.Get <EventDispatcher>().RemoveListener <RewardServiceEvents.MyRewardCalculated>(onMyRewardCalculated);
     if (coinsToCollect == 0)
     {
         disableExchange();
         CoroutineRunner.Start(stopExchangeAnimation(), this, "exchangeStopAnimationDelay");
     }
     else
     {
         currentState = ExchangeScreenState.Exchanging;
         CoroutineRunner.Start(playExchangeAnimation(), this, "exchangeAnimationDelay");
     }
     return(false);
 }