Example #1
0
 public void AudioOnOff()
 {
     audioStatus = !audioStatus;
     PlayerPrefs2.SetBool(DataKeys.audioStatusKey, audioStatus);
     DataManager.instance.audioStatus = audioStatus;
     ChangeAudioIcon();
 }
Example #2
0
    public void ToggleFPSCounter(bool isToggled)
    {
        AudioManager.instance.Play("ClickButton");
        if (isToggled)
        {
            FPSToggleParticles.Play();

            PlayerPrefs2.SetBool("FPSCounter", true);
            if (fpsCanvas == null)
            {
                fpsCanvas = Instantiate(fpsCanvasPrefab) as GameObject;
                fpsCanvas.transform.SetParent(FindObjectOfType <Canvas>().transform);
            }
        }
        else
        {
            FPSToggleParticles.Stop();

            PlayerPrefs2.SetBool("FPSCounter", false);
            if (fpsCanvas != null)
            {
                Destroy(fpsCanvas);
            }
        }
    }
Example #3
0
 //load everything, use when starting app
 //if key exists, load value, otherwise default
 public static void load()
 {
     //music
     if (PlayerPrefs.HasKey("isMusicOn"))
     {
         isMusicOn = PlayerPrefs2.GetBool("isMusicOn");
         Debug.Log("Music was " + isMusicOn + " last time");
     }
     else
     {
         Debug.Log("Just gonna turn some music on");
         PlayerPrefs2.SetBool("isMusicOn", true);
         isMusicOn = true;
     }
     //tokens
     if (PlayerPrefs.HasKey("tokens"))
     {
         tokens = PlayerPrefs.GetInt("tokens");
         Debug.Log("Player had " + tokens + " tokens last time");
     }
     else
     {
         Debug.Log("Ya got nada tokens");
         PlayerPrefs.SetInt("tokens", 0);
         tokens = 0;
     }
 }
 //BOOLEAN ARRAY-------------------------------------------------------------------------------
 public static void SetBoolArray(string name, bool[] boolArray)
 {
     PlayerPrefs.SetInt(name + "Length", boolArray.Length);
     for (int i = 0; i < boolArray.Length; i++)
     {
         PlayerPrefs2.SetBool(name + "[" + i + "]", boolArray[i]);
     }
 }
 private void LOAD_VALUES()
 {
     if (!debugMode)
     {
         timeManager.setTime(PlayerPrefs.GetInt("SSTime"));
         print("time loaded");
         cpu.computerText = PlayerPrefs.GetString("SSCPUText");
         print("CPU state loaded");
         print("Loading checkpoints");
         firstCheckpoint         = PlayerPrefs2.GetBool("SSfirstCheckpoint");
         firstDayNotShown        = PlayerPrefs2.GetBool("SSfirstDayNotShown");
         firstDayIndicatorHidden = PlayerPrefs2.GetBool("SSfirstDayIndicatorHidden");
         print("Done loading checkpoints");
         mousePosition.setMouseRotation(PlayerPrefs2.GetVector2("SSmousePosition"));
         playerPositionStuff.setPlayerPosition(PlayerPrefs2.GetVector3("SSPlayerPosition"));
         cameraManager.setCPUEnabled(PlayerPrefs2.GetBool("SSCPUcameraEnabled"));
         playerInRoom     = PlayerPrefs.GetInt("SSPlayerInRoom");
         secondCheckpoint = PlayerPrefs2.GetBool("SSsecondCheckpoint");
         float[][] floatThing = new float[4][];
         for (int i = 0; i < 4; i++)
         {
             floatThing[i] = PlayerPrefs2.GetFloatArray("SSSystemManagerData[" + i + "]");
         }
         string[][] inventoryChangerLoadString = new string[3][];
         for (int i = 0; i < 3; i++)
         {
             Debug.Log("Loading InventoryChangerValues[" + i + "]");
             inventoryChangerLoadString[i] = PlayerPrefs2.GetStringArray("SSInventoryChangerValues[" + i + "]");
             Debug.Log("Loaded InventoryChangerValues[" + i + "] it is " + inventoryChangerLoadString[i].Length + " objects long.");
         }
         inventoryChanger.Load(inventoryChangerLoadString);
         systemManager.setValuesOfAll(floatThing);
         inventoryManager.Player        = PlayerPrefs2.GetInventoryObject("SSPlayerInventory");
         inventoryManager.BetaStorage1  = PlayerPrefs2.GetInventoryObject("SSBetaStorage1Inventory");
         inventoryManager.BetaStorage2  = PlayerPrefs2.GetInventoryObject("SSBetaStorage2Inventory");
         inventoryManager.BetaStorage3  = PlayerPrefs2.GetInventoryObject("SSBetaStorage3Inventory");
         inventoryManager.BetaStorage4  = PlayerPrefs2.GetInventoryObject("SSBetaStorage4Inventory");
         inventoryManager.AlphaStorage1 = PlayerPrefs2.GetInventoryObject("SSAlphaStorage1Inventory");
         stationInitialized             = PlayerPrefs2.GetBool("SSStationInitialized");
         thirdCheckpoint   = PlayerPrefs2.GetBool("SSthirdCheckpoint");
         fourthCheckpoint  = PlayerPrefs2.GetBool("SSfourthCheckpoint");
         commandEntered    = PlayerPrefs2.GetBool("SScommandEntered");
         fifthCheckpoint   = PlayerPrefs2.GetBool("SSfifthCheckpoint");
         sixthCheckpoint   = PlayerPrefs2.GetBool("SSsixthCheckpoint");
         seventhCheckpoint = PlayerPrefs2.GetBool("SSseventhCheckpoint");
         pumpGameComplete  = PlayerPrefs2.GetBool("SSpumpGameComplete");
         eighthCheckpoint  = PlayerPrefs2.GetBool("SSeighthCheckpoint");
         ninthCheckpoint   = PlayerPrefs2.GetBool("SSninthCheckpoint");
         tenthCheckpoint   = PlayerPrefs2.GetBool("SStenthCheckpoint");
         powerManager.loadValues(PlayerPrefs2.GetBoolArray("SSRoomsPowered"));
         emergencyMode         = PlayerPrefs2.GetBool("SSEmergencyMode");
         timeOfImpact          = PlayerPrefs.GetInt("SStimeOfImpact", int.MaxValue);
         emergencyMessageShown = PlayerPrefs2.GetBool("SSEmergencyMessageShown");
         startedLosing         = PlayerPrefs2.GetBool("SSStartedLosing");
         helpTextShown         = PlayerPrefs2.GetBool("SSHelpTextShown");
     }
 }
 private void OnEnable()
 {
     _enableInstructions     = PlayerPrefs2.GetBool(InlineStrings.INSTRUCTIONSTATUS);
     _instructionToggle.isOn = !_enableInstructions;
     if (SceneManager.GetActiveScene().name == "Main")
     {
         _instructionScreen.SetActive(_enableInstructions);
     }
 }
Example #7
0
 private void Start()
 {
     continueCanvas.gameObject.SetActive(false);
     menuCanvas.gameObject.SetActive(false);
     gameOverCanvas.gameObject.SetActive(false);
     gold        = DataManager.instance.gold;
     audioStatus = PlayerPrefs2.GetBool(DataKeys.audioStatusKey);
     ChangeAudioIcon();
 }
Example #8
0
 private void Start()
 {
     canRemember = PlayerPrefs2.GetBool("Remember");
     if (canRemember)
     {
         inputName.text     = PlayerPrefs.GetString("NickName");
         inputPassword.text = PlayerPrefs.GetString("PasswordAccount");
     }
 }
Example #9
0
 public void PurchaseStatus(string productId, bool success)
 {
     if (success)
     {
         DataManager.instance.isAdsActive = false;
         PlayerPrefs2.SetBool(DataKeys.isAdsActiveKey, false);
         removeAdsButton.gameObject.SetActive(false);
     }
 }
    public static bool[] GetBoolArray(string name)
    {
        int length = PlayerPrefs.GetInt(name + "Length");

        bool[] returnBool = new bool[length];
        for (int i = 0; i < length; i++)
        {
            returnBool[i] = PlayerPrefs2.GetBool(name + "[" + i + "]");
        }
        return(returnBool);
    }
 public void LoadSavedGame()
 {
     if (loadFromSave && !PlayerPrefs2.GetBool("Reset"))
     {
         LOAD_VALUES();
     }
     else
     {
         print("Game Wasn't actually loaded because loadFromSave == " + loadFromSave);
         PlayerPrefs2.SetBool("Reset", false);
     }
 }
Example #12
0
    public void SaveSettings()
    {
        PlayerPrefs2.SetBool("fullscreen", gameSettings.fullscreen);
        PlayerPrefs.SetInt("resolution", gameSettings.resolutionIndex);
        PlayerPrefs.SetInt("textureQuality", gameSettings.textureQuality);
        PlayerPrefs.SetInt("antialiasing", gameSettings.antialiasing);
        PlayerPrefs.SetInt("vSync", gameSettings.vSync);
        PlayerPrefs.SetFloat("volume", gameSettings.musicVolume);

        //string jsonData = JsonUtility.ToJson(gameSettings, true);
        //File.WriteAllText(Application.persistentDataPath + "/gamesettings.json", jsonData);
        Debug.Log("Settings saved");
    }
    private void SAVE_VALUES()
    {
        PlayerPrefs.SetInt("SSTime", timeManager.time);
        print("Time saved");
        PlayerPrefs.SetString("SSCPUText", cpu.computerText);
        print("CPU state saved");
        print("Saving Checkpoints");
        PlayerPrefs2.SetBool("SSfirstCheckpoint", firstCheckpoint);
        PlayerPrefs2.SetBool("SSfirstDayNotShown", firstDayNotShown);
        PlayerPrefs2.SetBool("SSfirstDayIndicatorHidden", firstDayIndicatorHidden);

        PlayerPrefs2.SetVector2("SSmousePosition", mousePosition.valuesINeedSaved());
        PlayerPrefs2.SetVector3("SSPlayerPosition", playerPositionStuff.valuesINeedSaved());
        PlayerPrefs2.SetBool("SSCPUcameraEnabled", cameraManager.valuesINeedSaved());
        PlayerPrefs.SetInt("SSPlayerInRoom", playerInRoom);
        PlayerPrefs2.SetBool("SSsecondCheckpoint", secondCheckpoint);
        PlayerPrefs2.SetInventoryObject("SSPlayerInventory", inventoryManager.Player);
        PlayerPrefs2.SetInventoryObject("SSBetaStorage1Inventory", inventoryManager.BetaStorage1);
        PlayerPrefs2.SetInventoryObject("SSBetaStorage2Inventory", inventoryManager.BetaStorage2);
        PlayerPrefs2.SetInventoryObject("SSBetaStorage3Inventory", inventoryManager.BetaStorage3);
        PlayerPrefs2.SetInventoryObject("SSBetaStorage4Inventory", inventoryManager.BetaStorage4);
        PlayerPrefs2.SetInventoryObject("SSAlphaStorage1Inventory", inventoryManager.AlphaStorage1);
        for (int i = 0; i < systemManager.valuesINeedSaved().Length; i++)
        {
            PlayerPrefs2.SetFloatArray("SSSystemManagerData[" + i + "]", systemManager.valuesINeedSaved()[i]);
        }
        for (int i = 0; i < inventoryChanger.stuffINeedSaved().Length; i++)
        {
            Debug.Log("Saving InventoryChanger stuff[" + i + "]");
            Debug.Log("That stuff is: " + inventoryChanger.stuffINeedSaved()[i].ToString());
            PlayerPrefs2.SetStringArray("SSInventoryChangerValues[" + i + "]", inventoryChanger.stuffINeedSaved()[i]);
        }
        PlayerPrefs2.SetBool("SSStationInitialized", stationInitialized);
        PlayerPrefs2.SetBool("SSthirdCheckpoint", thirdCheckpoint);
        PlayerPrefs2.SetBool("SSfourthCheckpoint", fourthCheckpoint);
        PlayerPrefs2.SetBool("SScommandEntered", commandEntered);
        PlayerPrefs2.SetBool("SSfifthCheckpoint", fifthCheckpoint);
        PlayerPrefs2.SetBool("SSsixthCheckpoint", sixthCheckpoint);
        PlayerPrefs2.SetBool("SSseventhCheckpoint", seventhCheckpoint);
        PlayerPrefs2.SetBool("SSpumpGameComplete", pumpGameComplete);
        PlayerPrefs2.SetBool("SSeighthCheckpoint", eighthCheckpoint);
        PlayerPrefs2.SetBool("SSninthCheckpoint", ninthCheckpoint);
        PlayerPrefs2.SetBool("SStenthCheckpoint", tenthCheckpoint);
        PlayerPrefs2.SetBoolArray("SSRoomsPowered", powerManager.valuesINeedSaved());
        PlayerPrefs2.SetBool("SSEmergencyMode", emergencyMode);
        PlayerPrefs.SetInt("SStimeOfImpact", timeOfImpact);
        PlayerPrefs2.SetBool("SSEmergencyMessageShown", emergencyMessageShown);
        PlayerPrefs2.SetBool("SSStartedLosing", startedLosing);
        PlayerPrefs2.SetBool("SSHelpTextShown", helpTextShown);
    }
Example #14
0
    void Start()
    {
        instance = this;
        AudioManager.Instance.SetClipInLoopSource(AudioManager.Instance.storeIndex);
        iap = GetComponent <IAP>();

        activeSkinName = DataManager.instance.skinName;

        for (int i = 0; i < blockSprites.Count; i++)
        {
            bool status = PlayerPrefs2.GetBool(blockSprites[i].name);

            GameObject gObject = Instantiate(skinButton) as GameObject;
            gObject.name = blockSprites[i].name;
            gObject.transform.SetParent(buttonContentPanel.transform, false);

            if (status)
            {
                gObject.GetComponent <Image>().sprite = blockSprites[i];
            }
            else
            {
                gObject.GetComponent <Image>().sprite = blockSpritesLocked[i];
            }
            gObject.GetComponent <StoreButton>().isUnlocked = status;

            if (gObject.name == activeSkinName)
            {
                gObject.transform.GetChild(0).gameObject.SetActive(true);
            }
            else
            {
                gObject.transform.GetChild(0).gameObject.SetActive(false);
            }
        }

        string price = "";

        iap.GetProductPrice("skins");

        if (price == null)
        {
            skinPriceMessage.text = "Check your internet connection for skin prices.";
        }
        else
        {
            skinPriceMessage.text = "Each skin price is " + price;
        }
    }
Example #15
0
    public void ShowOptionsMenu()
    {
        AudioManager.instance.Play("ClickButton");
        mainMenu.SetActive(false);
        optionsMenu.SetActive(true);

        if (PlayerPrefs2.GetBool("FPSCounter", true))
        {
            fpsToggle.isOn = true;
            FPSToggleParticles.Play();
        }
        else
        {
            fpsToggle.isOn = false;
        }
    }
Example #16
0
    public void LoadSettings()
    {
        //if (File.Exists(Application.persistentDataPath + "/gamesettings.json"))
        //{    //Check if file exists in order to be able to load it
        //string jsonData = File.ReadAllText(Application.persistentDataPath + "/gamesettings.json");
        //gameSettings = JsonUtility.FromJson<GameSettings>(jsonData);
        Debug.Log("Settings Loaded");

        if (PlayerPrefs.HasKey("volume"))
        {
            gameSettings.musicVolume = PlayerPrefs.GetFloat("volume");
        }
        else
        {
            gameSettings.musicVolume = soundVolumeSlider.value;
        }
        if (PlayerPrefs.HasKey("vSync"))
        {
            gameSettings.vSync = PlayerPrefs.GetInt("vSync");
        }
        if (PlayerPrefs.HasKey("antialiasing"))
        {
            gameSettings.antialiasing = PlayerPrefs.GetInt("antialiasing");
        }
        if (PlayerPrefs.HasKey("textureQuality"))
        {
            gameSettings.textureQuality = PlayerPrefs.GetInt("textureQuality");
        }
        if (PlayerPrefs.HasKey("resolution"))
        {
            gameSettings.resolutionIndex = PlayerPrefs.GetInt("resolution");
        }
        if (PlayerPrefs.HasKey("fullscreen"))
        {
            gameSettings.fullscreen = PlayerPrefs2.GetBool("fullscreen");
        }

        soundVolumeSlider.value       = gameSettings.musicVolume;
        vSyncDropdown.value           = gameSettings.vSync;
        antialiasingDropdown.value    = gameSettings.antialiasing;
        textureQualityDrowpdown.value = gameSettings.textureQuality;
        resolutionDropdown.value      = gameSettings.resolutionIndex;
        fullscreenToggle.isOn         = gameSettings.fullscreen;
        Screen.fullScreen             = gameSettings.fullscreen;

        resolutionDropdown.RefreshShownValue();
    }
Example #17
0
 public void InitializeFPSCounter()
 {
     if (PlayerPrefs2.GetBool("FPSCounter", true))
     {
         if (FrameRate.instance == null)
         {
             fpsCanvas = Instantiate(fpsCanvasPrefab) as GameObject;
             fpsCanvas.transform.SetParent(FindObjectOfType <Canvas>().transform);
         }
         else
         {
             fpsCanvas = FrameRate.instance;
         }
     }
     else if (fpsCanvas != null)
     {
         Destroy(fpsCanvas);
     }
 }
Example #18
0
    public void Update()
    {
        if (canRemember)
        {
            Username = PlayerPrefs.GetString("NickName");
            Password = PlayerPrefs.GetString("PasswordAccount");

            PlayerPrefs.SetString("NickName", inputName.text);
            PlayerPrefs.SetString("PasswordAccount", inputPassword.text);
            PlayerPrefs2.SetBool("Remember", canRemember);

            checkImg.SetActive(true);

            buttonToRemember.onClick.AddListener(DontSaveParameters);
        }
        else
        {
            PlayerPrefs2.SetBool("Remember", canRemember);
            checkImg.SetActive(false);
            buttonToRemember.onClick.AddListener(SaveParameters);
        }
    }
Example #19
0
 private void Load()
 {
     _resourcesAmount    = PlayerPrefs2.GetDouble("resourcesAmount", ResourcesBaseAmount);
     _resourcesCollected = PlayerPrefs2.GetDouble("resourcesCollected", _resourcesAmount);
 }
Example #20
0
 //save everything to playerprefs, use when exiting app or switching scenes
 public static void save()
 {
     PlayerPrefs2.SetBool("isMusicOn", isMusicOn);
     PlayerPrefs.SetInt("tokens", tokens);
     PlayerPrefs.Save();
 }
 public void SetToggle()
 {
     PlayerPrefs2.SetBool(InlineStrings.INSTRUCTIONSTATUS, !_instructionToggle.isOn);
 }
Example #22
0
 public void Clear()
 {
     PlayerPrefs.DeleteAll();
     PlayerPrefs2.SetBool(InlineStrings.INSTRUCTIONSTATUS, true);
 }
Example #23
0
 public void ChangeToggle()
 {
     PlayerPrefs2.SetBool(InlineStrings.INSTRUCTIONSTATUS, _tutToggle.isOn);
 }
Example #24
0
        private void OnEnable()
        {
            _isTutorialEnabled = PlayerPrefs2.GetBool(InlineStrings.INSTRUCTIONSTATUS);

            _tutToggle.isOn = _isTutorialEnabled;
        }
 public void Reset()
 {
     PlayerPrefs2.SetBool("Reset", true);
     Time.timeScale = 1.0f;
     SceneManager.LoadScene("mainscene");
 }
Example #26
0
 public bool ReadBoolData(string key)
 {
     return(PlayerPrefs2.GetBool(key));
 }
Example #27
0
 public void WriteData(string key, bool value)
 {
     PlayerPrefs2.SetBool(key, value);
 }
Example #28
0
 private void Save()
 {
     PlayerPrefs2.SetDouble("resourcesAmount", _resourcesAmount);
     PlayerPrefs2.SetDouble("resourcesCollected", _resourcesCollected);
 }