private void Awake()
        {
            _logger  = NLog.LogManager.GetCurrentClassLogger();
            Instance = this;

            foreach (var sprite in Resources.FindObjectsOfTypeAll <Sprite>())
            {
                Icons.Add(sprite);
            }

            try
            {
                _buttonInstance           = Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "QuitButton"));
                _backButtonInstance       = Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "BackArrowButton"));
                MainMenuViewController    = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                _mainMenuRectTransform    = _buttonInstance.transform.parent as RectTransform;
                _loadingIndicatorInstance = Resources.FindObjectsOfTypeAll <GameObject>().First(x => x.name == "LoadingIndicator");
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }

            try
            {
                CreateTwitchModeButton();
                CreateDebugButton();
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }
        }
 private void Awake()
 {
     if (Instance != this)
     {
         DontDestroyOnLoad(this);
         Instance = this;
         CreateUI();
     }
 }
        public void Init(string songName, string requestorName)
        {
            _ui                  = TwitchIntegrationUi.Instance;
            _logger              = LogManager.GetCurrentClassLogger();
            _songTitle           = songName;
            _requestorNameString = requestorName;


            _initialized = true;
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (activationType != ActivationType.AddedToHierarchy)
            {
                return;
            }

            _ui = TwitchIntegrationUi.Instance;

            if (_backButtonObject == null)
            {
                _backButtonObject = _ui.CreateBackButton(rectTransform);
            }

            _backButtonObject.gameObject.SetActive(true);

            _backButtonObject.onClick.AddListener(DismissButtonWasPressed);
        }
        public void Present(VRUIViewController parentViewController, bool fromDebug)
        {
            _ui     = TwitchIntegrationUi.Instance;
            _logger = LogManager.GetCurrentClassLogger();

            try
            {
                _menuSceneSetupData     = Resources.FindObjectsOfTypeAll <MenuSceneSetupData>().First();
                _mainGameSceneSetupData = Resources.FindObjectsOfTypeAll <MainGameSceneSetupData>().First();
                _resultsFlowCoordinator = Resources.FindObjectsOfTypeAll <ResultsFlowCoordinator>().First();

                if (_levelRequestNavigationController == null)
                {
                    _levelRequestNavigationController =
                        _ui.CreateViewController <LevelRequestNavigationController>("LevelRequestNavController");
                }

                if (_requestInfoViewController == null)
                {
                    _requestInfoViewController = _ui.CreateViewController <RequestInfoViewController>("RequestInfo");
                    _requestInfoViewController.rectTransform.anchorMin = new Vector2(0.3f, 0f);
                    _requestInfoViewController.rectTransform.anchorMax = new Vector2(0.7f, 1f);
                }

                _levelDifficultyViewController =
                    Resources.FindObjectsOfTypeAll <StandardLevelDifficultyViewController>().First();
                _levelDetailViewController =
                    Resources.FindObjectsOfTypeAll <StandardLevelDetailViewController>().First();
            }
            catch (Exception e)
            {
                _logger.Error("Unable to load UI components: " + e);
                return;
            }

            if (!_initialized)
            {
                DidFinishEvent += Finish;
                _levelRequestNavigationController.DidFinishEvent        += HandleLevelRequestNavigationControllerDidfinish;
                _levelDifficultyViewController.didSelectDifficultyEvent +=
                    HandleDifficultyViewControllerDidSelectDifficulty;
                _levelDetailViewController.didPressPlayButtonEvent += HandleDetailViewControllerDidPressPlayButton;



                _requestInfoViewController.DownloadButtonpressed += HandleDidPressDownloadButton;
                _requestInfoViewController.SkipButtonPressed     += HandleDidPressSkipButton;

                _initialized = true;
            }

            //_levelRequestNavigationController.Init();
            parentViewController.PresentModalViewController(_levelRequestNavigationController, null,
                                                            StaticData.DidStartFromQueue);
            _requestInfoViewController.Init("Default Song Name", "Default User");

            _levelRequestNavigationController.PushViewController(_requestInfoViewController, true);

            if (!fromDebug)
            {
                return;             //Loading song preview arrests control from the results controller, causing it to display improperly.
            }
            CheckQueueAndUpdate();
        }