SetBool() public static method

public static SetBool ( string name, bool booleanValue ) : void
name string
booleanValue bool
return void
示例#1
0
    /// <summary>
    /// Gets the high score from  CSV file.
    /// </summary>
    void GetHighScoreCSV()
    {
        string[,] highScoreStr = CSVReader.SplitCsvGrid(highScoreCSV.text);             //String array buffer
        int columns = highScoreStr.GetLength(0) - 2;                                    //Some parsing error

        highScore = new Score[columns];

        PlayerPrefsX.SetBool("HighScore", true);                                                                        //Put flag that there are a high score in prefs

        for (int i = 0; i < columns; i++)
        {                                                                                       //Fill the Score array
            highScore[i]      = new Score();
            highScore[i].name = highScoreStr[i, 0];
            PlayerPrefs.SetString("Player Name" + i, highScore[i].name);


            highScore[i].score = int.Parse(highScoreStr[i, 1]);
            PlayerPrefs.SetInt("Score" + i, highScore[i].score);


            highScore[i].date = highScoreStr[i, 2];

            PlayerPrefs.SetString("Date" + i, highScore[i].date);
        }
    }
 void IPController_OnProductPurchasedAtIndex(int indexPurchasedProduct, string purchaseType)
 {
     if (purchaseType == IPController.PURCHASED)
     {
         if (indexPurchasedProduct == 0)
         {
             PlayerPrefsX.SetBool(GameKeys.kprefIsAdRemoved, true);
             GoogleMobileAdController.Instance.DestoryBanner();
             // RemoveAds
         }
         else if (indexPurchasedProduct == 1)
         {
             AddDiamondScore(100);
         }
         else if (indexPurchasedProduct == 2)
         {
             AddDiamondScore(500);
         }
         else if (indexPurchasedProduct == 3)
         {
             AddDiamondScore(1000);
         }
         else if (indexPurchasedProduct == 4)
         {
             AddDiamondScore(2000);
         }
     }
     else if (purchaseType == IPController.RESTORED)
     {
         PlayerPrefsX.SetBool(GameKeys.kprefIsAdRemoved, true);
         GoogleMobileAdController.Instance.DestoryBanner();
     }
 }
示例#3
0
        public static void SetWebGM(string[] args)
        {
            if (args.Length > 0)
            {
                var param = args[0];

                switch (param)
                {
                case "on":
                {
                    PlayerPrefsX.SetBool(WebGMWakeupListener.kWebGMAutoStart, true);
                    CUDLR.Console.Log("Done. WebGM service will auto start when game start");
                    break;
                }

                case "off":
                {
                    PlayerPrefsX.SetBool(WebGMWakeupListener.kWebGMAutoStart, false);
                    CUDLR.Console.Log("Done. WebGM service will not auto start when game start");
                    break;
                }

                default:
                {
                    CUDLR.Console.Log("invalid params");
                    break;
                }
                }
            }
            else
            {
                CUDLR.Console.Log("invalid params");
            }
        }
示例#4
0
 public void SavePreferences()
 {
     PlayerPrefsX.SetBool(SettingsMusic, MusicEnabled);
     PlayerPrefsX.SetBool(SettingsSound, SoundEnabled);
     PlayerPrefs.SetInt(SettingsQuality, QualitySettings.GetQualityLevel());
     PlayerPrefs.Save();
 }
示例#5
0
            /// <summary>
            /// Method to Set (Update) this PlayerPref
            /// </summary>
            /// <param name="value">The value to set the PlayerPref to</param>
            public void SetPlayerPref(string value)
            {
                switch (DefinePlayerPref())
                {
                // Update String PlayerPref
                case PlayerPrefTypes.STRING:
                    PlayerPrefs.SetString(key, value);
                    break;

                // Update Int PlayerPref
                case PlayerPrefTypes.INT:
                    PlayerPrefs.SetInt(key, int.Parse(value));
                    break;

                // Update Bool PlayerPref
                case PlayerPrefTypes.BOOL:
                    PlayerPrefsX.SetBool(key, bool.Parse(value));
                    break;

                // No matching PlayerPref type found to update
                default:
                    Debug.LogError("NO TYPE MATCHED");
                    break;
                }
            }
示例#6
0
    public void IniciarGame()
    {
        //resetSavePanel = GameObject.Find ("resetSave");

        if (PlayerPrefs.HasKey("save"))
        {
            resetSavePanel.SetActive(true);
        }
        else
        {
            //carrega dados do save
            PlayerPrefsX.SetBool("save", true);
            PlayerPrefs.SetInt("Player_VidaMaxima", 100);
            PlayerPrefs.SetInt("Player_ManaMaxima", 100);
            PlayerPrefs.SetInt("Player_Forca", 1);
            PlayerPrefs.SetInt("Player_Defesa", 1);
            PlayerPrefs.SetInt("Player_Nivel", 1);
            PlayerPrefs.SetInt("Player_Dinheiro", 0);
            PlayerPrefs.SetInt("Player_Experiencia", 0);
            PlayerPrefs.SetInt("Player_Experiencia_Prox_Nivel", 100);

            //chama cena de historia inicial!
            LoadScene("HistoriaInicial");
        }
    }
示例#7
0
 // Start is called before the first frame update
 public void TestButton()
 {
     //To do
     PlayerPrefsX.SetBool(PrefsEntity.BattleEndFlag, true);
     LoadingManager.LoadSceneBattleToField();
     print("Test is done");
 }
示例#8
0
    public void DefaultOptions()
    {
        PlayerPrefsX.SetBool("autoMinions", true);

        PlayerPrefsX.SetBool("infiniteSwap", false);
        PlayerPrefsX.SetBool("itemsOn", true);
        PlayerPrefsX.SetBool("eventsOn", false);
        PlayerPrefsX.SetBool("skillsOn", false);
        PlayerPrefsX.SetBool("towersOn", true);
        PlayerPrefsX.SetBool("turboMode", false);
        PlayerPrefsX.SetBool("minionDiff", true);
        PlayerPrefsX.SetBool("hatsOn", false);
        PlayerPrefsX.SetBool("introOn", true);
        PlayerPrefsX.SetBool("bigGameHunters", false);
        PlayerPrefsX.SetBool("announcerOn", true);
        PlayerPrefsX.SetBool("immortalMiners", true);
        PlayerPrefs.SetFloat("masterVol", .5f);
        PlayerPrefs.SetFloat("sfxVol", .5f);
        PlayerPrefs.SetFloat("musicVol", .5f);

        GetSounds();
        foreach (Toggle t in allTogglesParent.GetComponentsInChildren <Toggle>())
        {
            t.gameObject.SetActive(false);
            t.gameObject.SetActive(true); //this should trigger the ToggleCheck OnEnable() function.
        }

        SetAllEventsOn();
        CheckEvents();
        //!this is not reliably working...
        Invoke("RidiculousDelay", 1f);
    }
    // setting up the help panel to display when it is a first time play
    void setUpHelpPanel()
    {
        switch (mode.text)
        {
        case "Standard":
            if (PlayerPrefsX.GetBool("First_Time_Level_Two_Standard", true))
            {
                toggleHelpPanel();
                PlayerPrefsX.SetBool("First_Time_Level_Two_Standard", false);
            }
            break;

        case "Time Trial":
            if (PlayerPrefsX.GetBool("First_Time_Level_Two_Trial", true))
            {
                toggleHelpPanel();
                PlayerPrefsX.SetBool("First_Time_Level_Two_Trial", false);
            }
            break;

        case "Extreme":
            if (PlayerPrefsX.GetBool("First_Time_Level_Two_Extreme", true))
            {
                toggleHelpPanel();
                PlayerPrefsX.SetBool("First_Time_Level_Two_Extreme", false);
            }
            break;

        default:
            break;
        }
    }
示例#10
0
 private void Unlock()
 {
     PlayerPrefsX.SetBool(unlockedKey, true);
     unlocked = true;
     texture.gameObject.SetActive(true);
     locked.gameObject.SetActive(false);
 }
    public void Zapisz()
    {
        PlayerPrefs.SetInt("rozdzielczoscSzer", Screen.width);
        PlayerPrefs.SetInt("rozdzielczoscWys", Screen.height);
        PlayerPrefs.SetInt("RefRat", roz.refreshRate);
        PlayerPrefsX.SetBool("FS", Screen.fullScreen);
        PlayerPrefs.SetFloat("Glosnosc", AudioListener.volume);


        BinaryFormatter Form       = new BinaryFormatter();
        FileStream      zapisUst   = File.Create(Application.persistentDataPath + "/UstawieniaDomyslne.d");
        Save            ustawienia = new Save();

        ustawienia.fullscreen = PlayerPrefsX.GetBool("FS");
        ustawienia.szerEkranu = PlayerPrefs.GetInt("rozdzielczoscSzer");
        ustawienia.wysEkranu  = PlayerPrefs.GetInt("rozdzielczoscWys");
        ustawienia.refRate    = PlayerPrefs.GetInt("RefRat");
        ustawienia.Glosnosc   = PlayerPrefs.GetFloat("Glosnosc");

        Form.Serialize(zapisUst, ustawienia);
        zapisUst.Close();

        menuInGame.SetActive(true);
        op.SetActive(false);
        zapis_opcji.SetActive(false);
    }
示例#12
0
 private void Start()
 {
     if (abilityUnlocked)
     {
         PlayerPrefsX.SetBool(abilityName, true);
     }
 }
示例#13
0
    // Use this for initialization
    void Start()
    {
        LeverAnimator = GetComponent <Animator>();

        if (PlayerPrefsX.GetBool("LeverLoading"))
        {
            if (gameObject.name == "LeftLever")
            {
                LeverAnimator.SetBool("Pulled", PlayerPrefsX.GetBool("LeftLeverPulled"));
                PlayerPrefsX.SetBool("LeftLeverDealtWith", true);
            }
            if (gameObject.name == "RightLever")
            {
                LeverAnimator.SetBool("Pulled", PlayerPrefsX.GetBool("RightLeverPulled"));
                PlayerPrefsX.SetBool("RightLeverDealtWith", true);
            }

            if (PlayerPrefsX.GetBool("LeftLeverDealtWith") && PlayerPrefsX.GetBool("RightLeverDealtWith"))
            {
                PlayerPrefsX.SetBool("LeverLoading", false); //this line is what is causing the issues with the left lever
                PlayerPrefsX.SetBool("LeftLeverDealtWith", false);
                PlayerPrefsX.SetBool("RightLeverDealtWith", false);
            }
        }
    }
示例#14
0
 public void TookWillpower()
 {
     PlayerPrefsX.SetBool("willpowerDay" + sL.GetCurrentSceneName().ToString(), false);
     willpower.IncreaseWillpower(50);
     pLight.ChooseLightMode();
     UpdateWillpower();
 }
    /// <summary>
    /// Sets the current state of the dyslexic font
    /// </summary>
    /// <param name="on"></param>
    public void SetDyslexicFontMode(bool on)
    {
        UseDyslexicFont = on;
        PlayerPrefsX.SetBool(USE_DYSLEXIC_FONT, UseDyslexicFont);
        PlayerPrefs.Save();

        if (UseDyslexicFont)
        {
            // Íf the dyslexic font option is on, the current font & scale will be the dyslexic font
            CurrentFont  = dyslexic.Font;
            CurrentScale = dyslexic.Scale;
        }
        else
        {
            // If the dyslexic font option isn't on, the current font & scale will be the regular font
            CurrentFont  = regular.Font;
            CurrentScale = regular.Scale;
        }

        if (OnChangeFont != null) //
        {
            // Inform text objects with ChangeFont class attached to update to the new font
            OnChangeFont.Invoke(CurrentFont, CurrentScale);
        }
    }
示例#16
0
    // Update is called once per frame
    public void onClick()
    {
        pinkFire   = PlayerPrefsX.SetBool("ThePinkFireN", false);
        greenShip  = PlayerPrefsX.SetBool("TheGreenShipN", false);
        yellowFire = PlayerPrefsX.SetBool("TheYellowFireN", false);
        yellowShip = PlayerPrefsX.SetBool("TheYellowShipN", false);
        redFire    = PlayerPrefsX.SetBool("TheRedFireN", false);
        blueFire   = PlayerPrefsX.SetBool("TheBlueFireN", false);
        pinkShip   = PlayerPrefsX.SetBool("ThePinkShipN", false);
        greenFire  = PlayerPrefsX.SetBool("TheGreenFireN", false);
        blueShip   = PlayerPrefsX.SetBool("TheBlueShipN", false);
        redShip    = PlayerPrefsX.SetBool("TheRedShipN", false);



        PlayerPrefsX.SetBool("pinkFireN", false);
        PlayerPrefsX.SetBool("yellowFireN", false);
        PlayerPrefsX.SetBool("blueFireN", false);
        PlayerPrefsX.SetBool("greenFireN", false);
        PlayerPrefsX.SetBool("redFireN", false);

        PlayerPrefsX.SetBool("greenShipN", false);
        PlayerPrefsX.SetBool("yellowShipN", false);
        PlayerPrefsX.SetBool("pinkShipN", false);
        PlayerPrefsX.SetBool("blueShipN", false);
        PlayerPrefsX.SetBool("redShipN", false);

        normalF.isOn = true;
        normalS.isOn = true;
    }
示例#17
0
    public void OnThisPressed()
    {
        //If we dont own the item
        if (item.isOwned == false)
        {
            Debug.Log("we dont own it");
            //if we have the money
            if (PlayerPrefs.GetInt("Money") >= item.price)
            {
                //Buy it
                PlayerPrefs.SetInt("Money", PlayerPrefs.GetInt("Money") - item.price);
                PlayerPrefsX.SetBool(item.name, true);
                item.isOwned   = true;
                priceText.text = "Owned";
                SetAlpha(1.0f);
                GameObject.FindGameObjectWithTag("ShopMenu").GetComponent <ShopMenu>().UpdateText();
                Debug.Log("We own it!");
            }
        }

        if (item.isOwned == true)
        {
            playerSpawner.ChosenPlayerItem = item;
            chosenImage.enabled            = true;
        }
    }
示例#18
0
    public void ToOptions()
    {
        if (_receiverIpValid)
        {
            PlayerPrefs.SetString("receiverIP", _receiverIp.text);
        }

        if (_receiverPortValid)
        {
            PlayerPrefs.SetInt("receiverPORT", int.Parse(_receiverPort.text));
        }

        PlayerPrefsX.SetBool("localServerON", _localServerOn);

        if (_localServerIpValid)
        {
            PlayerPrefs.SetString("localServerIP", _localServerIp.text);
        }

        if (_localServerPortValid)
        {
            PlayerPrefs.SetInt("localServerPORT", int.Parse(_localServerPort.text));
        }

        PlayerPrefs.Save();

        SceneManager.LoadScene("options");
    }
示例#19
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        //DontDestroyOnLoad(gameObject);
        if (!PlayerPrefs.HasKey("SoundOn"))
        {
            PlayerPrefsX.SetBool("SoundOn", true);
        }

        foreach (Sound s in sounds)
        {
            s.source        = gameObject.AddComponent <AudioSource>();
            s.source.clip   = s.clip;
            s.source.volume = s.volume;
            s.source.pitch  = s.pitch;
        }
    }
示例#20
0
 //These are save and load functions for the items class.
 //This is not currently in use but will be use in the future.
 public void SaveValues()
 {
     foreach (var item in m_items)
     {
         PlayerPrefs.SetInt("NumberOfItems", item.m_amountOfItemsForPlayer);
         PlayerPrefs.SetFloat("Durability", (float)item.durability);
         PlayerPrefs.SetFloat("ValueofItem", (float)item.valueOfItem);
         PlayerPrefs.SetString("ItemName " + item.name, item.name);
         PlayerPrefs.SetString("ItemDescription", item.description);
         PlayerPrefsX.SetBool("IsDurability", item.isDurability);
         PlayerPrefsX.SetBool("IsItemStatic", item.staticItem);
         PlayerPrefsX.SetBool("ValueIsPercentage", item.isAPercentage);
         PlayerPrefsX.SetBool("IsStackable", item.isStackable);
         //Saving only one of the arrays as they are all the same but
         //will be converted to the same number after it is loaded
         PlayerPrefsX.SetStringArray("StatusNames", item.statusNames[0].ToArray());
         PlayerPrefsX.SetStringArray("TypesNames", item.typesNames[0].ToArray());
         PlayerPrefsX.SetStringArray("StatsNames", item.allStatsEffected[0].ToArray());
         //_______________________________________________________________________________
         PlayerPrefsX.SetIntArray("StatsIndex", item.m_statIndex.ToArray());
         PlayerPrefsX.SetIntArray("TypeIndex", item.typesindex.ToArray());
         PlayerPrefsX.SetIntArray("StatusIndex", item.statusIndex.ToArray());
         PlayerPrefs.Save();
     }
 }
示例#21
0
    public void StartApp()
    {
        if (SetButton())
        {
            if (_receiverIpValid)
            {
                PlayerPrefs.SetString("receiverIP", _receiverIp.text);
            }

            if (_receiverPortValid)
            {
                PlayerPrefs.SetInt("receiverPORT", int.Parse(_receiverPort.text));
            }

            PlayerPrefsX.SetBool("localServerON", _localServerOn);

            if (_localServerIpValid)
            {
                PlayerPrefs.SetString("localServerIP", _localServerIp.text);
            }

            if (_localServerPortValid)
            {
                PlayerPrefs.SetInt("localServerPORT", int.Parse(_localServerPort.text));
            }

            PlayerPrefs.Save();
            SceneManager.LoadScene("app");
        }
    }
示例#22
0
 public void SaveGame()
 {
     PlayerPrefsX.SetVector3("PlayerPosition", player.transform.position);
     PlayerPrefsX.SetVector3("PlayerVelocity", player.GetComponent <Rigidbody2D>().velocity);
     PlayerPrefsX.SetVector3("LastCheckpoint", player.GetComponent <Player>().getLastCheckpoint());
     PlayerPrefs.SetInt("PlayerHealth", player.GetComponent <Player>().getHitPoints());
     PlayerPrefs.SetInt("PlayerLives", player.GetComponent <Player>().getRemainingLives());
     player.GetComponent <Player>().capturePowerUpInfo();
     PlayerPrefs.SetString("CurrentLevel", Application.loadedLevelName);
     if (Application.loadedLevelName == "Level2" || Application.loadedLevelName == "Level4" || Application.loadedLevelName == "Level6")
     {
         PlayerPrefsX.SetVector3("BossPosition", boss.transform.position);
         PlayerPrefsX.SetVector3("BossVelocity", boss.GetComponent <Rigidbody2D>().velocity);
         PlayerPrefs.SetInt("BossHealth", boss.GetComponent <Agent>().getHitPoints());
         if (Application.loadedLevelName == "Level2")
         {
             boss.GetComponent <Boss>().capturePhaseInformation();
         }
         if (Application.loadedLevelName == "Level4")
         {
             boss.GetComponent <BossTwo>().capturePowerUpInformation();
         }
         if (Application.loadedLevelName == "Level6")
         {
             boss.GetComponent <BossThree>().capturePowerUpInformation();
         }
     }
     else
     {
         PlayerPrefsX.SetBool("LeftLeverPulled", LeftLever.GetComponent <Animator>().GetBool("Pulled"));
         PlayerPrefsX.SetBool("RightLeverPulled", RightLever.GetComponent <Animator>().GetBool("Pulled"));
     }
 }
示例#23
0
        public void ShowHelp()
        {
            PlayerPrefsX.SetBool("first-time", false);

            SetPlayButtonInteractable(false);

            NavigationPointer     mainMenuPointer = new NavigationPointer(screenCategory, mainMenuName);
            NavigationPointer     helpPointer     = new NavigationPointer(screenCategory, helpName);
            NavigationPointer     help1Pointer    = new NavigationPointer(screenCategory, help1Name);
            NavigationPointerData data            = new NavigationPointerData(true);

            data.show.Add(helpPointer);
            data.show.Add(help1Pointer);
            data.hide.Add(mainMenuPointer);

            var temp = mainMenu.outAnimations.Copy();

            mainMenu.outAnimations = lastOutAnim.Copy();

            UINavigation.Show(data.show);
            UINavigation.Hide(data.hide);
            UINavigation.AddItemToHistory(data);

            mainMenu.outAnimations = temp;
        }
示例#24
0
    public static void startNewGame()
    {
        int[] area = { 0, 1, 2 };
        int   rand = (int)Random.Range(0, 2);
        int   temp;

        for (int j = 0; j < 10; j++)
        {
            for (int i = 2; i > 0; i--)
            {
                rand       = (int)Random.Range(0, 2);
                temp       = area[rand];
                area[rand] = area[i];
                area[i]    = temp;
            }
        }
        int area1 = (int)Random.Range((int)1, (int)11);
        int area2 = (int)Random.Range((int)1, (int)11);
        int area3 = (int)Random.Range((int)1, (int)11);

        bool[] doneArea = { false, false, false };

        PlayerPrefsX.SetIntArray("areaGame", area);
        PlayerPrefs.SetInt("area1Key", area1);
        PlayerPrefs.SetInt("area2Key", area2);
        PlayerPrefs.SetInt("area3Key", area3);
        PlayerPrefsX.SetBoolArray("areaDone", doneArea);
        PlayerPrefsX.SetBool("saved", false);
    }
 public void ReportAchievementToLeaderboard(int achievementIndex, int progresssPoint)
 {
     if (NPBinding.GameServices.LocalUser.IsAuthenticated)
     {
         PlayerPrefsX.SetBool(sAchievementID [achievementIndex], true);
         NPBinding.GameServices.ReportProgressWithID(sAchievementID [achievementIndex], 100.0f, ReportAchievementCompletion);
     }
 }
示例#26
0
 void setUpHelpPanel()
 {
     if (PlayerPrefsX.GetBool("First_Time_Level_Six", true))
     {
         helpPanel.SetActive(true);
         PlayerPrefsX.SetBool("First_Time_Level_Six", false);
     }
 }
示例#27
0
    /*public void PlaySingle(AudioClip clip) {
     *      fxSource.clip = clip;
     *      fxSource.Play();
     * } */

    /*public void RandomizeSfx (params AudioClip[] clips) {
     *      int randomIndex = Random.Range(0, clips.Length);
     *
     *      fxSource.clip = clips[randomIndex];
     *
     *      fxSource.Play();
     * } */

    // turns sound on and off
    public void ToggleSound()
    {
        Debug.Log("Sound toggled");
        bool s = PlayerPrefsX.GetBool("SoundOn");

        AudioListener.pause = s;
        PlayerPrefsX.SetBool("SoundOn", !s);
    }
示例#28
0
 //Saves the states of the bools
 public void OnSavePress()
 {
     PlayerPrefsX.SetBool("MusicToggle", MusicToggle.isOn);
     PlayerPrefsX.SetBool("SoundEffectsToggle", SoundEffectsToggle.isOn);
     PlayerPrefsX.SetBool("VibrateToggle", VibrateToggle.isOn);
     PlayerPrefs.SetString("ChosenControlScheme", ChosenControlScheme.text);
     OnBackPressed();
 }
示例#29
0
    public void ChangeFloor()
    {
        PlayerPrefs.SetInt(PrefsEntity.CurrentFloor, int.Parse(inputFieldFloor.text));
        PlayerPrefsX.SetBool(PrefsEntity.SaveFlag, false);
        Scene scene = SceneManager.GetActiveScene();

        LoadingManager.LoadSceneFieldToField();
    }
示例#30
0
    /*public void StartEnemies()
     * {
     *      enemySpawner.GetComponent<EnemySpawner> ().Start ();
     * }*/

    public void goToMenu()
    {
        PlayerPrefsX.SetBool("Timer1", TimerTest.instance.timerActive);
        audioU.PlayOneShot(click, 1f);
        gameOver = true;
        //PlayerPrefs.SetFloat ("TimeOnExit", PersistentTimer.instance.savedSeconds);
        SceneManager.LoadScene("Menu");
    }