Esempio n. 1
0
    private void SetStartDialogSpecial(SpecialStage specialStage)
    {
        // Show the Quest Dialog if this is the first time playing the a level in the special stage
        string key = string.Format("{0}_{1}", SharedResources.SpecialStageStartQuestDialogShownKey, specialStage.StageId);

        bool shown = PlayerPrefsFast.GetBool(key, false);

        if (!shown)
        {
            this.CompletedImage.SetActive(false);
            this.gameObject.SetActive(true);

            foreach (GameObject dialog in this.StageMapping)
            {
                dialog.SetActive(false);
            }

            foreach (IdkyKeyValuePairGameObject specialStageMapping in this.SpecialStageMappings)
            {
                specialStageMapping.GetValue().SetActive(specialStageMapping.GetKey().Equals(specialStage.StageId));
            }

            PlayerPrefsFast.SetBool(key, true);
            PlayerPrefsFast.Flush();
        }
    }
Esempio n. 2
0
    private void InitStoreData()
    {
        VirtualCurrencies      = StoreInfo.Currencies;
        VirtualGoods           = StoreInfo.Goods;
        VirtualCurrencyPacks   = StoreInfo.CurrencyPacks;
        VirtualGoodsDictionary = new Dictionary <string, VirtualGood>();

        foreach (VirtualGood virtualGood in VirtualGoods)
        {
            VirtualGoodsDictionary.Add(virtualGood.ItemId, virtualGood);
        }

        this.UpdateStoreBalances();

        Debug.Log("GNOME: Notifying Shop Data Initialized");
        this.NotifyShopDataInitialized();

        // Give 10 tokens for free if it's the first time playing
        if (PlayerPrefsFast.GetBool(SharedResources.FirstTimeUserKey, true))
        {
            StoreInventory.GiveItem(GnomeStoreAssets.TokenId, 10);
            PlayerPrefsFast.SetBool(SharedResources.FirstTimeUserKey, false);
            PlayerPrefsFast.Flush();
        }

        this.NotifyTokensChanged();
    }
Esempio n. 3
0
 private void Awake()
 {
     try
     {
         this.CurrentState = PlayerPrefsFast.GetBool(this.OptionKey, this.DefaultState);
         this.EnableObjects();
     }
     catch
     {
         // Set a default for this new key
         this.OnStateChanged(this.DefaultState);
     }
 }
Esempio n. 4
0
    private void SetEndDialogSpecial(SpecialStage specialStage)
    {
        // Show the Quest Dialog if all the special stages are beaten
        string key = string.Format("{0}_{1}", SharedResources.SpecialStageEndQuestDialogShownKey, specialStage.StageId);

        bool shown = PlayerPrefsFast.GetBool(key, false);

        if (!shown)
        {
            bool hasLevelIncomplete = false;

            foreach (int levelInStage in specialStage.LevelMapping.Keys)
            {
                string levelKey = string.Format(
                    "{0}_{1}_{2}", SharedResources.TimesLevelPlayedToCompletePrefix, specialStage.StageId, levelInStage);

                int timesToCompleteLevel = PlayerPrefsFast.GetInt(levelKey, 0);

                // Check if the level has been completed yet
                if (timesToCompleteLevel == 0)
                {
                    hasLevelIncomplete = true;
                    break;
                }
            }

            if (!hasLevelIncomplete)
            {
                this.CompletedImage.SetActive(true);
                this.gameObject.SetActive(true);

                foreach (GameObject dialog in this.StageMapping)
                {
                    dialog.SetActive(false);
                }

                foreach (IdkyKeyValuePairGameObject specialStageMapping in this.SpecialStageMappings)
                {
                    specialStageMapping.GetValue().SetActive(specialStageMapping.GetKey().Equals(specialStage.StageId));
                }

                PlayerPrefsFast.SetBool(key, true);
                PlayerPrefsFast.Flush();
            }
        }
    }
Esempio n. 5
0
 private void CheckOptions()
 {
     // Check if music and sound fx can be played
     this.PlayMusic  = PlayerPrefsFast.GetBool(this.MusicOptionKey);
     this.PlaySounds = PlayerPrefsFast.GetBool(this.SoundOptionKey);
 }