Inheritance: MonoBehaviour
示例#1
0
 void Update()
 {
     if (PlayerPrefsBool.GetBool("Pack") == true && PlayerPrefsBool.GetBool("Pack (1)") == true && PlayerPrefsBool.GetBool("Pack (2)") == true)
     {
         buyButton.sprite = purchased;
     }
 }
示例#2
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();
    }
示例#3
0
 void Update()
 {
     if (PlayerPrefsBool.GetBool(packOfObjects.name) == true)
     {
         buyButton.sprite = purchased;
     }
 }
    public void NextLevelBtn()
    {
        if (Application.loadedLevelName == "Level3Beta")
        {
            GameObject.FindGameObjectWithTag(Constants.Tags.WindowManager).GetComponent <WindowHandler>().CreateInfoDialog("Phrases/LastLevelHeader", "Phrases/LastLevelInfo", "Phrases/LastLevelButton", MainMenuBtn);
            return;
        }

        if (NextLevel == "Level3Beta" && !PlayerPrefsBool.GetBool("Level7"))
        {
            var bls = GameObject.FindGameObjectWithTag(Constants.Tags.GameMaster).GetComponent <BuyLevelSeven>();
            if (PlayerPrefs.GetInt("CurrencyAmount", CurrencyControl.currencyAmount) >= bls.cost)
            {
                bls.DoYouWannaBuy();
            }
            else
            {
                bls.NotEnoughOrbs();
            }
        }
        else
        {
            Application.LoadLevel(NextLevel);
        }
    }
示例#5
0
 void IsBought()
 {
     if (PlayerPrefsBool.GetBool(packOfObjects.name) == true)
     {
         buyButton.sprite = purchased;
         APack(packOfObjects);
     }
 }
示例#6
0
 // Use this for initialization
 void Start()
 {
     if (PlayerPrefsBool.GetBool("firstTime"))
     {
         PlayerPrefsBool.SetBool("firstTime", false);
         TutShopController.tutorial = true;
     }
 }
示例#7
0
        //GameObject hat;

        void Start()
        {
            Hat.SetActive(false);
            if (PlayerPrefsBool.GetBool(gameObject.tag + Constants.ShopItems.Hat))
            {
                Hat.SetActive(true);
                Hat.GetComponent <Renderer>().material.color = Color.blue;
            }
        }
示例#8
0
    void Awake()
    {
        audioSource = GetComponent <AudioSource>();

        bool  On = (PlayerPrefsBool.HasBoolKey("Music"))?PlayerPrefsBool.GetBool("Music"):true;
        float v  = (On)?1f:0f;

        SetVolume(v);
    }
示例#9
0
 void IsBought()
 {
     if (PlayerPrefsBool.GetBool("Pack") == true && PlayerPrefsBool.GetBool("Pack (1)") == true && PlayerPrefsBool.GetBool("Pack (2)") == true)
     {
         buyButton.sprite = purchased;
         APack(pack);
         APack(pack1);
         APack(pack2);
     }
 }
 void IsBought()
 {
     if (PlayerPrefsBool.GetBool("Pack (3)") == true && PlayerPrefsBool.GetBool("Pack (4)") == true && PlayerPrefsBool.GetBool("Pack (5)") == true)
     {
         buyButton.sprite = purchased;
         APack(pack3);
         APack(pack4);
         APack(pack5);
     }
 }
示例#11
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);
 }
示例#12
0
 public void RefreshAchievements()
 {
     if (LeverPulls.leverpulls == 7 && !PlayerPrefsBool.GetBool(achievement.name))
     {
         PlayerPrefsBool.SetBool(achievement.name, true);
         achievement.SetActive(true);
     }
     else
     {
         achievement.SetActive(false);
     }
 }
示例#13
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);
        }
    }
示例#14
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");
        }
    }
示例#15
0
    //Used to Unlock all the Levels
    public static void UnlockAllLevels()
    {
        int    LN         = 1;
        string PPLevelKey = getPPLevelKey(LN);

        while (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isLocked"))
        {
            Unlock(LN);

            LN++;
            PPLevelKey = getPPLevelKey(LN);
        }
    }
示例#16
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");
     }
 }
示例#17
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);
        }
    }
示例#18
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);
        }
    }
示例#19
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);
        }
    }
示例#20
0
    /// <summary>
    /// Calculates the sum of all levels won
    /// </summary>
    /// <returns>The sum.</returns>
    public static int WinSum()
    {
        int    result     = 0;
        int    LevelNum   = 1;
        string PPLevelKey = getPPLevelKey(LevelNum);

        while (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isWon"))
        {
            result += (PlayerPrefsBool.GetBool(PPLevelKey + "isWon"))? 1: 0;

            LevelNum++;
            PPLevelKey = getPPLevelKey(LevelNum);
        }

        return(result);
    }
示例#21
0
 void OnTriggerEnter2D(Collider2D colObj)
 {
     if (colObj.tag == "Player")
     {
         if (!PlayerPrefsBool.GetBool("hype2"))
         {
             text.enabled = true;
             particles.Play();
         }
         else
         {
             text.enabled = true;
             text.text    = "OWNED";
         }
     }
 }
示例#22
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");
     }
 }
示例#23
0
    //set up everything on start
    void Start()
    {
        On = (PlayerPrefsBool.HasBoolKey(Key))?PlayerPrefsBool.GetBool(Key):true;

        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);
        }
    }
示例#24
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;
         }
     }
 }
示例#25
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");
            }
        }
    }
示例#26
0
    /// <summary>
    /// Unlocks the levels based on the WinSum...read this method and change for your own use
    /// </summary>
    public static void UnlockLevels_WinSum()
    {
        int Sum = WinSum();

        int    LevelNum   = 1;
        string PPLevelKey = getPPLevelKey(LevelNum);

        while (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isLocked"))
        {
            //Level will be unlocked if the WinSum + 1 is greater than of equal to the LevelNum
            if ((Sum + 1) >= LevelNum)
            {
                Unlock(LevelNum);
            }

            LevelNum++;
            PPLevelKey = getPPLevelKey(LevelNum);
        }
    }
示例#27
0
    /// <summary>
    /// Unlocks the levels based on the StarSum...read this method and change for your own use
    /// </summary>
    public static void UnlockLevels_StarSum()
    {
        int Sum = StarSum();

        int    LevelNum   = 1;
        string PPLevelKey = getPPLevelKey(LevelNum);

        while (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isLocked"))
        {
            //Level will be unlocked if the StarSum is greater than of equal to the (LevelNum-1) * 2
            if (Sum >= ((LevelNum - 1) * 2))
            {
                Unlock(LevelNum);
            }

            LevelNum++;
            PPLevelKey = getPPLevelKey(LevelNum);
        }
    }
示例#28
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);
        }
    }
示例#29
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;
         }
     }
 }
示例#30
0
    /// <summary>
    /// Unlocks the levels based on the ScoreSum...read this method and change for your own use
    /// </summary>
    public static void UnlockLevels_ScoreSum()
    {
        float Sum = ScoreSum();

        int    LevelNum   = 1;
        string PPLevelKey = getPPLevelKey(LevelNum);

        while (PlayerPrefsBool.HasBoolKey(PPLevelKey + "isLocked"))
        {
            //Level will be unlocked if the StarSum is greater than of equal to the (LevelNum-1) * 80f
            //i think this score could be like a percent, but this can be adjusted based on how your game works
            if (Sum >= ((LevelNum - 1) * 80f))
            {
                Unlock(LevelNum);
            }

            LevelNum++;
            PPLevelKey = getPPLevelKey(LevelNum);
        }
    }