Exemplo n.º 1
0
        private void ContinueButtonOnClickHandler()
        {
            _soundManager.PlaySound(Enumerators.SoundType.CLICK, Constants.SfxSoundVolume, false, false, true);

            _uiManager.GetPopup <OverlordAbilitySelectionPopup>().PopupHiding += AbilityPopupClosedEvent;
            _uiManager.DrawPopup <OverlordAbilitySelectionPopup>(_currentOverlordObject.SelfHero);
        }
Exemplo n.º 2
0
        public void StartTutorial()
        {
            _battlegroundController.SetupBattlegroundAsSpecific(CurrentTutorial.SpecificBattlegroundInfo);

            IsBubbleShow = true;
            _uiManager.DrawPopup <TutorialPopup>();
            _popup = _uiManager.GetPopup <TutorialPopup>();
            UpdateTutorialVisual();
            _soundManager.PlaySound(Enumerators.SoundType.TUTORIAL, CurrentTutorialDataStep.SoundName, Constants.TutorialSoundVolume, false);

            IsTutorial = true;
        }
Exemplo n.º 3
0
        private void DeleteButtonOnClickHandler()
        {
            if (ShowConnectionLostPopupIfNeeded())
            {
                return;
            }

            HordeDeckObject deck = _hordeDecks.FirstOrDefault(o => o.SelfDeck.Id == _selectedDeckId);

            if (deck != null)
            {
                _soundManager.PlaySound(Enumerators.SoundType.CLICK, Constants.SfxSoundVolume, false, false, true);

                _uiManager.GetPopup <QuestionPopup>().ConfirmationReceived += ConfirmDeleteDeckReceivedHandler;

                _uiManager.DrawPopup <QuestionPopup>("Do you really want to delete " + deck.SelfDeck.Name + "?");
            }
        }
Exemplo n.º 4
0
        private async void ReconnectButtonOnClickHandler()
        {
            try
            {
                ConnectionPopup connectionPopup = _uiManager.GetPopup <ConnectionPopup>();

                Func <Task> connectFunc = async() =>
                {
                    bool success = true;
                    try
                    {
                        await _backendDataControlMediator.LoginAndLoadData();
                    }
                    catch (Exception)
                    {
                        // HACK: ignore to allow offline mode
                    }

                    if (!_backendFacade.IsConnected)
                    {
                        success = false;
                    }

                    if (success)
                    {
                        connectionPopup.Hide();
                    }
                    else
                    {
                        connectionPopup.ShowFailedOnMenu();
                    }
                };
                _uiManager.DrawPopup <ConnectionPopup>();
                connectionPopup.ConnectFunc = connectFunc;
                await connectionPopup.ExecuteConnection();
            }
            catch (Exception e)
            {
                Debug.LogException(e);
                OpenAlertDialog(
                    $"Reconnect failed. Please check your Internet connection.\n\nAdditional info: {e.GetType().Name} [{e.Message}]");
            }
        }
Exemplo n.º 5
0
        public void Update()
        {
            IsInteractable = false;
            if (_uiManager.GetPopup <CardInfoPopup>().Self == null &&
                _uiManager.GetPopup <DesintigrateCardPopup>().Self == null &&
                _uiManager.GetPopup <WarningPopup>().Self == null)
            {
                if (!IsStateChanging && _previewCard != null)
                {
                    Close();
                }

                if (!IsStateChanging)
                {
                    IsInteractable = true;
                }
            }
        }
Exemplo n.º 6
0
        private void CheckBackButton()
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                _isBackButtonCounting = true;
                _backButtonClicksCount++;
                _backButtonTimer = 0f;

                if (_backButtonClicksCount >= 2)
                {
                    if (_uiManager.GetPopup <ConfirmationPopup>().Self == null)
                    {
                        Action[] actions = new Action[2];
                        actions[0] = () =>
                        {
                            Application.Quit();
                        };
                        actions[1] = () => { };

                        _uiManager.DrawPopup <ConfirmationPopup>(actions);
                    }
                }
            }

            if (_isBackButtonCounting)
            {
                _backButtonTimer += Time.deltaTime;

                if (_backButtonTimer >= BackButtonResetDelay)
                {
                    _backButtonTimer       = 0f;
                    _backButtonClicksCount = 0;
                    _isBackButtonCounting  = false;
                }
            }
        }
Exemplo n.º 7
0
        public async void Update()
        {
            if (_selfPage == null)
            {
                return;
            }

            if (!_selfPage.activeInHierarchy ||
                GameClient.Get <IAppStateManager>().AppState != Enumerators.AppState.APP_INIT)
            {
                return;
            }

            if (!_isLoaded)
            {
                _percentage          += 1f;
                _loaderBar.fillAmount = Mathf.Clamp(_percentage / 100f, 0.03f, 1f);
                if (_percentage >= 100)
                {
                    _isLoaded = true;
                    _progressBar.gameObject.SetActive(false);
                    _pressAnyText.gameObject.SetActive(true);
                }
            }
            else
            {
                if (!Input.anyKey)
                {
                    return;
                }

                if (!_pressAnyText.gameObject.activeSelf)
                {
                    return;
                }

                _pressAnyText.gameObject.SetActive(false);

                if (_backendDataControlMediator.LoadUserDataModel() &&
                    _backendDataControlMediator.UserDataModel.IsValid)
                {
                    ConnectionPopup connectionPopup = _uiManager.GetPopup <ConnectionPopup>();

                    Func <Task> connectFunc = async() =>
                    {
                        bool success = true;
                        try
                        {
                            await _backendDataControlMediator.LoginAndLoadData();
                        }
                        catch (GameVersionMismatchException e)
                        {
                            success = false;
                            _uiManager.DrawPopup <LoginPopup>();
                            _uiManager.GetPopup <LoginPopup>().Show(e);
                        }
                        catch (Exception e)
                        {
                            // HACK: ignore to allow offline mode
                            Debug.LogWarning(e);
                        }

                        connectionPopup.Hide();

                        if (success)
                        {
                            GameClient.Get <IAppStateManager>().ChangeAppState(Enumerators.AppState.MAIN_MENU);
                        }
                    };
                    _uiManager.DrawPopup <ConnectionPopup>();
                    connectionPopup.ConnectFunc = connectFunc;
                    await connectionPopup.ExecuteConnection();
                }
                else
                {
                    _uiManager.DrawPopup <LoginPopup>();
                }
            }
        }
Exemplo n.º 8
0
 private void ChooseBuilding(int i)
 {
     _chosenBuldingId = i;
     BuildState       = BUILD_STATE.BuildingChosen;
     _uiManager.GetPopup <BuildingInfoPopup>().Show(BuildingViews[i].scriptObj.Description);
 }