SetBool() public static method

public static SetBool ( string name, bool booleanValue ) : void
name string
booleanValue bool
return void
示例#1
0
    public void ResetUserData()
    {
        // PlaterPrefs
        PlayerPrefsBool.SetBool("Pack", false);
        PlayerPrefsBool.SetBool("Pack (1)", false);
        PlayerPrefsBool.SetBool("Pack (2)", false);
        PlayerPrefsBool.SetBool("Pack (3)", false);
        PlayerPrefsBool.SetBool("Pack (4)", false);
        PlayerPrefsBool.SetBool("Pack (5)", false);
        PlayerPrefsBool.SetBool("Pack123", false);
        PlayerPrefsBool.SetBool("Pack456", false);
        PlayerPrefsBool.SetBool("PackAll", false);
        PlayerPrefs.SetInt("CurrencyAmount", CurrencyControl.currencyAmount * 0);
        PlayerPrefsBool.SetBool("Level7", false);
        PlayerPrefsBool.SetBool("SevenElever", false);
        LeverPulls.leverpulls = 0;

        Userlevels.GetInstance().ClearUserLevels();

        // XML's
        var signsPath = GetFilePath(Constants.XmlFiles.Signs);
        var bindata   = (TextAsset)Resources.Load("Signs");

        File.WriteAllBytes(signsPath, bindata.bytes);
        signsPath = GetFilePath(Constants.XmlFiles.Sentences);
        bindata   = (TextAsset)Resources.Load("Sentences");
        File.WriteAllBytes(signsPath, bindata.bytes);
        signsPath = GetFilePath(Constants.XmlFiles.Alphabet);
        bindata   = (TextAsset)Resources.Load("Alphabet");
        File.WriteAllBytes(signsPath, bindata.bytes);

        LoadData();
    }
示例#2
0
 // Use this for initialization
 void Start()
 {
     if (PlayerPrefsBool.GetBool("firstTime"))
     {
         PlayerPrefsBool.SetBool("firstTime", false);
         TutShopController.tutorial = true;
     }
 }
示例#3
0
 public void RefreshAchievements()
 {
     if (LeverPulls.leverpulls == 7 && !PlayerPrefsBool.GetBool(achievement.name))
     {
         PlayerPrefsBool.SetBool(achievement.name, true);
         achievement.SetActive(true);
     }
     else
     {
         achievement.SetActive(false);
     }
 }
示例#4
0
 // Use this for initialization
 void Start()
 {
     PlayerPrefsBool.SetBool("Pack", false);
     PlayerPrefsBool.SetBool("Pack (1)", false);
     PlayerPrefsBool.SetBool("Pack (2)", false);
     PlayerPrefsBool.SetBool("Pack (3)", false);
     PlayerPrefsBool.SetBool("Pack (4)", false);
     PlayerPrefsBool.SetBool("Pack (5)", false);
     PlayerPrefsBool.SetBool("Pack123", false);
     PlayerPrefsBool.SetBool("Pack456", false);
     PlayerPrefsBool.SetBool("PackAll", false);
 }
示例#5
0
    /// <summary>
    /// Animates the stars.
    /// </summary>
    /// <param name="LevelNum">Level number.</param>
    /// <param name="animate">If set to <c>true</c> animate.</param>
    public static void AnimateStars(int LevelNum, bool animate = true)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        if (PlayerPrefsBool.HasBoolKey(PPLevelKey + "animateStars"))
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "animateStars", animate);
        }
        else
        {
            Debug.LogWarning("Level doesn't Exists");
        }
    }
示例#6
0
    /// <summary>
    /// sets whether or not the level has been won
    /// </summary>
    /// <param name="LevelNum">Level number.</param>
    /// <param name="Won">If set to <c>true</c> won.</param>
    public static void setWon(int LevelNum, bool Won)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        if (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isWon"))
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "isWon", Won);
        }
        else
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "isWon", false);
        }
    }
示例#7
0
    /// <summary>
    /// Whether the star animation will be played
    /// </summary>
    /// <returns><c>true</c>, if animate stars was gotten, <c>false</c> otherwise.</returns>
    /// <param name="LevelNum">Level number.</param>
    public static bool getAnimateStars(int LevelNum)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        if (PlayerPrefsBool.HasBoolKey(PPLevelKey + "animateStars"))
        {
            return(PlayerPrefsBool.GetBool(PPLevelKey + "animateStars"));
        }
        else
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "animateStars", false);
            return(false);
        }
    }
示例#8
0
    /// <summary>
    /// determine if the Level is Locked
    /// </summary>
    /// <returns><c>true</c>, if locked was ised, <c>false</c> otherwise.</returns>
    /// <param name="LevelNum">Level number.</param>
    public static bool isLocked(int LevelNum)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        if (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isLocked"))
        {
            return(PlayerPrefsBool.GetBool(PPLevelKey + "isLocked"));
        }
        else
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "isLocked", true);
            return(true);
        }
    }
示例#9
0
 public void BuyThisItem()
 {
     if (PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) >= cost && PlayerPrefsBool.GetBool(packOfObjects.name) == false)
     {
         PlayerPrefsBool.SetBool(packOfObjects.name, true);
         am.ClickBtnPlay();
         IsBought();
         PlayerPrefs.SetInt("CurrencyAmount", PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) - cost);
     }
     else
     {
         Debug.Log("YOU DONT HAVE SO MUCH MONEY");
     }
 }
示例#10
0
    /// <summary>
    /// determine if the level has been won
    /// </summary>
    /// <returns><c>true</c>, if won was ised, <c>false</c> otherwise.</returns>
    /// <param name="LevelNum">Level number.</param>
    public static bool isWon(int LevelNum)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        if (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isWon"))
        {
            return(PlayerPrefsBool.GetBool(PPLevelKey + "isWon"));
        }
        else
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "isWon", false);
            return(false);
        }
    }
示例#11
0
 public void BuyThisItem()
 {
     if (PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) >= cost && (PlayerPrefsBool.GetBool("Pack") == false || PlayerPrefsBool.GetBool("Pack (1)") == false || PlayerPrefsBool.GetBool("Pack (2)") == false))
     {
         PlayerPrefsBool.SetBool("Pack", true);
         PlayerPrefsBool.SetBool("Pack (1)", true);
         PlayerPrefsBool.SetBool("Pack (2)", true);
         PlayerPrefsBool.SetBool("Pack123", true);
         am.ClickBtnPlay();
         IsBought();
         PlayerPrefs.SetInt("CurrencyAmount", PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) - cost);
     }
     else
     {
         Debug.Log("YOU DONT HAVE SO MUCH MONEY");
     }
 }
示例#12
0
 void OnTriggerStay2D(Collider2D colObj)
 {
     if (colObj.tag == "Player")
     {
         if (Input.GetButton("Interact") && !PlayerPrefsBool.GetBool("hype1") && (PlayerPrefs.GetInt("lifetimeLoot") - price) >= 0)
         {
             text.enabled = false;
             PlayerPrefsBool.SetBool("hype1", true);
             particles.Stop();
             PlayerPrefs.SetInt("lifetimeLoot", (PlayerPrefs.GetInt("lifetimeLoot") - price));
             HYPEController.HYPEMode = gameObject.GetComponentInParent <Shop>().HYPEColor;
         }
         if (Input.GetButton("Interact") && !PlayerPrefsBool.GetBool("hype1"))
         {
             HYPEController.HYPEMode = gameObject.GetComponentInParent <Shop>().HYPEColor;
         }
     }
 }
示例#13
0
    void UnlockLevelSeven()
    {
        if (PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) >= cost && PlayerPrefsBool.GetBool("Level7") == false)
        {
            PlayerPrefsBool.SetBool("Level7", true);
            Userlevels.GetInstance().AddUserLevel("7");
            PlayerPrefs.SetInt("CurrencyAmount", PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) - cost);

            if (ls != null)
            {
                ls.GetComponent <LevelSelector>().UpdateLevels();
            }
            else
            {
                Application.LoadLevel("Level3Beta");
            }
        }
    }
示例#14
0
    //OnPress switch
    public void OnPress()
    {
        On = !On;

        PlayerPrefsBool.SetBool(Key, On);

        image.sprite = (On)?OnSprite:OffSprite;

        float v = (On)?1f:0f;

        if (Key == "Music")
        {
            MusicManager.Instance.SetVolume(v);
        }
        else if (Key == "Sound")
        {
            SoundManager.Instance.SetVolume(v);
        }
    }
示例#15
0
 void OnTriggerStay2D(Collider2D colObj)
 {
     if (colObj.tag == "Player")
     {
         if (Input.GetButton("Interact") && !PlayerPrefsBool.GetBool("skin3") && (PlayerPrefs.GetInt("lifetimeLoot") - price) >= 0)
         {
             text.enabled = false;
             PlayerPrefsBool.SetBool("skin3", true);
             particles.Stop();
             PlayerPrefs.SetInt("lifetimeLoot", (PlayerPrefs.GetInt("lifetimeLoot") - price));
             arm.GetComponentInParent <SpriteRenderer>().sprite = gunArm;
             gameObject.GetComponentInParent <Shop>().player.GetComponent <Animator>().runtimeAnimatorController = gameObject.GetComponentInParent <Shop>().skin;
         }
         if (Input.GetButton("Interact") && !PlayerPrefsBool.GetBool("skin3") == true)
         {
             arm.GetComponentInParent <SpriteRenderer>().sprite = gunArm;
             gameObject.GetComponentInParent <Shop>().player.GetComponent <Animator>().runtimeAnimatorController = gameObject.GetComponentInParent <Shop>().skin;
         }
     }
 }
示例#16
0
    /// <summary>
    /// Sets the lock to a level
    /// </summary>
    /// <param name="LevelNum">Level number.</param>
    /// <param name="Locked">If set to <c>true</c> locked.</param>
    public static void setLock(int LevelNum, bool isLocked)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        if (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isLocked"))
        {
            if (
                PlayerPrefsBool.GetBool(PPLevelKey + "isLocked") &&
                isLocked == false
                )
            {
                AnimateUnlock(LevelNum, true);
            }

            PlayerPrefsBool.SetBool(PPLevelKey + "isLocked", isLocked);
        }
        else
        {
            PlayerPrefsBool.SetBool(PPLevelKey + "isLocked", true);
        }
    }
示例#17
0
    /*public static Game current;
     * public static int lifetimeLoot;
     * public static int currLoot;
     * public static int skin;
     * public static int hype;
     * public static int carsCleared;
     * public int enemiesKilled;
     * public int hypeModesActivated;
     * public int shotsFired;
     * public int deaths;
     * public float accuracy;
     * public static bool skin1 = true;
     * public static bool skin2 = false;
     * public static bool skin3 = false;
     * public static bool skin4 = false;
     * public static bool hype1 = true;
     * public static bool hype2 = false;
     * public static bool firstTime = true;
     * public static bool firstTime = true;*/

    void Start()
    {
        if (!PlayerPrefs.HasKey("lifetimeLoot"))
        {
            PlayerPrefs.SetInt("lifetimeLoot", 0);
            PlayerPrefs.SetInt("currLoot", 0);
            PlayerPrefs.SetInt("skin", 0);
            PlayerPrefs.SetInt("hype", 0);
            PlayerPrefs.SetInt("carsCleared", 0);
            PlayerPrefs.SetInt("enemiesKilled", 0);
            PlayerPrefs.SetInt("hypeModesActivated", 0);
            PlayerPrefs.SetInt("shotsFired", 0);
            PlayerPrefs.SetInt("deaths", 0);
            PlayerPrefs.SetFloat("accuracy", 0);
            PlayerPrefsBool.SetBool("skin1", true);
            PlayerPrefsBool.SetBool("skin2", false);
            PlayerPrefsBool.SetBool("skin3", false);
            PlayerPrefsBool.SetBool("skin4", false);
            PlayerPrefsBool.SetBool("hype1", true);
            PlayerPrefsBool.SetBool("hype2", false);
            PlayerPrefsBool.SetBool("firstTime", true);
        }
    }
示例#18
0
    /// <summary>
    /// Animates the unlock.
    /// </summary>
    /// <param name="LevelNum">Level number.</param>
    /// <param name="animate">If set to <c>true</c> animate.</param>
    public static void AnimateUnlock(int LevelNum, bool animate = true)
    {
        string PPLevelKey = getPPLevelKey(LevelNum);

        PlayerPrefsBool.SetBool(PPLevelKey + "animateUnlock", animate);
    }