コード例 #1
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();
    }
コード例 #2
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();
        }
    }
コード例 #3
0
ファイル: SoundManager.cs プロジェクト: ttat/puzzlewarrior
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(this.gameObject);
        }

        Instance    = this;
        this.Paused = false;

        // Make sure music and sound fx is on by default if it's never been initialized
        if (!PlayerPrefsFast.HasKey(this.MusicOptionKey))
        {
            PlayerPrefsFast.SetBool(this.MusicOptionKey, true);
            PlayerPrefsFast.Flush();
        }

        if (!PlayerPrefsFast.HasKey(this.SoundOptionKey))
        {
            PlayerPrefsFast.SetBool(this.SoundOptionKey, true);
            PlayerPrefsFast.Flush();
        }

        this.CheckOptions();
        this.BackgroundMusicSource      = this.gameObject.AddComponent <AudioSource>();
        this.BackgroundMusicSource.loop = true;
        this.ContinuousSoundSource      = this.gameObject.AddComponent <AudioSource>();
        this.ContinuousSoundSource.loop = true;

        DontDestroyOnLoad(this.gameObject);
    }
コード例 #4
0
    public void OnStateChanged(bool state)
    {
        // Set the state
        this.CurrentState = state;
        this.EnableObjects();

        // Save the state
        PlayerPrefsFast.SetBool(this.OptionKey, state);
        PlayerPrefsFast.Flush();

        SoundManager.Instance.RecheckSounds();
    }
コード例 #5
0
    private void OnSignedOut(object sender, EventArgs args)
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("Signed Out");
        }

        // Signed out, so next time don't silently sign in
        PlayerPrefsFast.SetBool(this.GooglePlusKey, false);
        PlayerPrefsFast.Flush();

        this.SetActiveState();
    }
コード例 #6
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();
            }
        }
    }
コード例 #7
0
    private void OnSignInSucceeded(object sender, EventArgs args)
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("Sign In Succeeded");
        }

        // Successfully signed in, so silently sign in next time
        PlayerPrefsFast.SetBool(this.GooglePlusKey, true);
        PlayerPrefsFast.Flush();

        /*
         * if (this.clicked)
         * {
         *      LevelDataInitializer.InitializeLevels();
         * }
         */
        this.clicked = false;

        this.SetActiveState();
    }