Example #1
0
    public void SetQualitySettings(int level)
    {
        if (level == qualitySettings)
        {
            return;
        }
        SharedUtilities.GetInstance().SetQualitySettings(level);
        switch (level)
        {
        case 0:
            toast.EnqueueToast("Quality set to low", null, 1f);
            qualitySettings = 0;
            lowEnabledIcon.gameObject.SetActive(true);
            mediumEnabledIcon.gameObject.SetActive(false);
            highEnabledIcon.gameObject.SetActive(false);
            ultraEnabledIcon.gameObject.SetActive(false);
            settingsData.qualityLevel = 0;
            break;

        case 1:
            toast.EnqueueToast("Quality set to medium", null, 1f);
            qualitySettings = 1;
            lowEnabledIcon.gameObject.SetActive(false);
            mediumEnabledIcon.gameObject.SetActive(true);
            highEnabledIcon.gameObject.SetActive(false);
            ultraEnabledIcon.gameObject.SetActive(false);
            settingsData.qualityLevel = 1;
            break;

        case 2:
            toast.EnqueueToast("Quality set to high", null, 1f);
            qualitySettings = 2;
            lowEnabledIcon.gameObject.SetActive(false);
            mediumEnabledIcon.gameObject.SetActive(false);
            highEnabledIcon.gameObject.SetActive(true);
            ultraEnabledIcon.gameObject.SetActive(false);
            settingsData.qualityLevel = 2;
            break;

        case 3:
            toast.EnqueueToast("Quality set to ultra", null, 1f);
            qualitySettings = 3;
            lowEnabledIcon.gameObject.SetActive(false);
            mediumEnabledIcon.gameObject.SetActive(false);
            highEnabledIcon.gameObject.SetActive(false);
            ultraEnabledIcon.gameObject.SetActive(true);
            settingsData.qualityLevel = 3;
            break;
        }
        SaveManager.GetInstance().SavePersistentData(settingsData, SaveManager.SETTINGS_PATH);
    }
Example #2
0
    public void BuyHighlightedProduct()
    {
        currencyData.gravitons -= (int)highlightedProduct.price;
        switch (highlightedProduct.type)
        {
        case StoreProduct.ProductType.GRAVITY_POINT:
            currencyData.gravityPoints += highlightedProduct.amount;
            iconToast.EnqueueToast(highlightedProduct.amount + " Gravity Points purchased", GPSprite, 1.5f);
            break;

        case StoreProduct.ProductType.ASPECT:
            aspectData.UnlockAspect(highlightedProduct.id);
            SaveManager.GetInstance().SavePersistentData(aspectData, SaveManager.ASPECTDATA_PATH);
            GetProductWithID(highlightedProduct.id)?.SetProductState(StoreProduct.ProductState.PURCHASED);
            toast.ShowToast("Aspect purchased: " + aspectData.AspectStringFromId(highlightedProduct.id), null, 2f);
            break;

        case StoreProduct.ProductType.POWER_UP:

            if (highlightedProduct.id.Equals("GRB4"))
            {
                skillsData.gammaRayBurstPoints = 4;
                SaveManager.GetInstance().SavePersistentData(skillsData, SaveManager.SKILLSDATA_PATH);
                GetProductWithID("GRB4")?.SetProductState(StoreProduct.ProductState.CONSUMED);
                iconToast.EnqueueToast("GRB 4 purchased", grbSprite, 2f);
            }
            else if (highlightedProduct.id.Equals("MSU"))
            {
                skillsData.magneticShieldBundleUnlocked = true;
                SaveManager.GetInstance().SavePersistentData(skillsData, SaveManager.SKILLSDATA_PATH);
                GetProductWithID("MSU")?.SetProductState(StoreProduct.ProductState.CONSUMED);
                iconToast.EnqueueToast("Magnetic shield bundle purchased", shieldSprite, 1.5f);
            }
            break;

        default:
            currencyData.gravitons += (int)highlightedProduct.price;
            break;
        }
        SaveManager.GetInstance().SavePersistentData(currencyData, SaveManager.CURRENCY_PATH);
        gravitonsText.text = currencyData.gravitons.ToString();
        disclaimerPanel.SetActive(false);
        highlightedProduct = null;
    }
Example #3
0
    private IEnumerator ToastCoroutine(ToastScript toast, string message, Sprite sprite, float duration, float delay, bool enqueue)
    {
        yield return(new WaitForSeconds(delay));

        if (enqueue)
        {
            toast.EnqueueToast(message, sprite, duration);
        }
        else
        {
            toast.ShowToast(message, sprite, duration);
        }
    }
Example #4
0
    public void GetDailyReward()
    {
        if (rewardReady)
        {
            rewardReady = false;
            GoogleAdsManager.GetInstance().ShowRewardedAd(GoogleAdsManager.RewardedAdType.TIMED_REWARD);
            if (Application.isEditor)
            {
                EarnReward(true);
            }
        }
        else
        {
            currencyData = SaveManager.GetInstance().LoadPersistentData(SaveManager.CURRENCY_PATH).GetData <CurrencyData>();
            if (currencyData.gravitons < PersistentPrefs.GetInstance().gravitonsCost)
            {
                toast.EnqueueToast("Not enough gravitons", null, 1.5f);
                return;
            }

            OpenConfirmPanel(true);
        }
    }