예제 #1
0
    protected void Replay()
    {
        // Dont check mana
        if (true)
        {
            // Hide
            Hide(false, GameManager.Instance.Replay);
        }
        else
        {
            if (noMoreManaPopupPrefab != null)
            {
                // Create popup
                GameObject            noMoreManaPopup = noMoreManaPopupPrefab.CreateUI(transform.parent);
                NoMoreManaPopupScript script          = noMoreManaPopup.GetComponent <NoMoreManaPopupScript>();

                if (script != null)
                {
                    NotificationManager.AddManaEventHandler(OnManaChanged);

                    script.Show(null);
                }
            }
            else
            {
                //Log.Debug("No more mana!");
            }
        }
    }
예제 #2
0
    void OnMapSelected(int map, bool unlocked)
    {
        if (unlocked)
        {
            // Set selected map
            _selectedMap = map;

            // Check if enough mana
            // Dont check mana
            if (true)
            {
                // Play sound
                SoundManager.PlayButtonClick();

                if (map != _userData.Map)
                {
                    // Disable interaction
                    SetInteractable(false);

                    this.map.JumpToMap(map, () => {
                        // Set current map
                        _userData.Map = map;

                        // Enable interaction
                        SetInteractable(true);

                        // Show map info
                        ShowMapInfo(map);
                    });
                }
                else
                {
                    // Show map info
                    ShowMapInfo(map);
                }
            }
            else
            {
                // Play sound
                SoundManager.Instance.PlaySound(SoundID.CyrusWrongInput);

                // Create popup
                GameObject            noMoreManaPopup = _noMoreManaPopupPrefab.CreateUI(_canvas.transform);
                NoMoreManaPopupScript script          = noMoreManaPopup.GetComponent <NoMoreManaPopupScript>();

                if (script != null)
                {
                    script.Show(OnBuyManaCallback);
                }
            }
        }
        else
        {
            SoundManager.Instance.PlaySound(SoundID.SelectLockedMap);
        }
    }
예제 #3
0
    void OnManaChanged(int mana)
    {
        if (_manaText != null)
        {
            _manaText.text = mana.ToString();
        }

        if (mana >= Settings.MaxMana)
        {
            if (_manaCountdown != null)
            {
                _manaCountdown.text = "FULL";
            }

            _lastManaCountdown = TimeManager.ManaCountdown;
        }

        if (mana > 0)
        {
            NoMoreManaPopupScript script = FindObjectOfType <NoMoreManaPopupScript>();

            if (script != null)
            {
                Manager.Instance.ForceCloseDialog();

                // Force close
                script.ForceClose();

                if (_selectedMap != _userData.Map)
                {
                    // Disable interaction
                    SetInteractable(false);

                    map.JumpToMap(_selectedMap, () => {
                        // Set current map
                        _userData.Map = _selectedMap;

                        // Enable interaction
                        SetInteractable(true);

                        // Show map info
                        ShowMapInfo(_selectedMap);
                    });
                }
                else
                {
                    // Show map info
                    ShowMapInfo(_selectedMap);
                }
            }
        }
    }
예제 #4
0
    void OnManaChanged(int mana)
    {
        NotificationManager.RemoveManaEventHandler(OnManaChanged);

        if (mana > 0)
        {
            NoMoreManaPopupScript script = FindObjectOfType <NoMoreManaPopupScript>();

            if (script != null)
            {
                script.ForceClose();
            }
        }
    }