示例#1
0
    void create()
    {
        int[]          timeline = PlayerPrefsX.GetIntArray(timelinename);
        GameObject     newNote  = Instantiate(n, transform.position, Quaternion.identity);
        SpriteRenderer sr       = newNote.GetComponent <SpriteRenderer>();

        if (i >= timeline.Length)
        {
            return;
        }
        time = timeline[i];
        if (time == 1)
        {
            //sr.color=Color.red;
        }
        if (time == 2)
        {
            //sr.color=Color.blue;
        }
        if (time == 3)
        {
            //sr.color=Color.green;
        }
        i++;
        Invoke("create", time);
    }
示例#2
0
    public void DeactiveCard()
    {
        if (PlayerPrefsX.GetIntArray("SelectedCardsIDs").Length > 15)           // VERIFICA SE TEM PELO MENOS 15 CARTAS SELECIONADAS
        {
            activebutton.sprite = activeFalse;
            isactivebutton      = false;
            int[] original = PlayerPrefsX.GetIntArray("SelectedCardsIDs");

            List <int> iList = new List <int> ();

            for (int i = 0; i < original.Length; i++)
            {
                iList.Add(original [i]);
            }

            iList.Remove(CardID);

            int[] finalArray = new int[iList.Count];

            int x = 0;
            foreach (int i in iList)
            {
                finalArray [x] = i;
                x++;
            }

            PlayerPrefsX.SetIntArray("SelectedCardsIDs", finalArray);
        }
    }
    // Use this for initialization
    void Start()
    {
        temp = new int[10];
        Camera.main.gameObject.GetComponent <AudioSource> ().loop = true;
        Camera.main.gameObject.GetComponent <AudioSource> ().clip = bgMusic;
        Camera.main.gameObject.GetComponent <AudioSource> ().Play();

        for (int i = 0; i < 10; i++)
        {
            temp[i] = Random.Range(1, 22);
        }

        if (PlayerPrefsX.GetIntArray("PlayerCardsIDs").Length <= 0)
        {
            PlayerPrefsX.SetIntArray("PlayerCardsIDs", temp);
            if (temp.Length < 15)
            {
                PlayerPrefsX.SetIntArray("SelectedCardsIDs", temp);
            }
            Debug.Log(PlayerPrefsX.GetIntArray("SelectedCardsIDs").Length);
        }
        else
        {
            if (PlayerPrefsX.GetIntArray("PlayerCardsIDs").Length > 0 || PlayerPrefsX.GetIntArray("PlayerCardsIDs").Length <= 15)
            {
                PlayerPrefsX.SetIntArray("SelectedCardsIDs", PlayerPrefsX.GetIntArray("PlayerCardsIDs"));
            }
            temp = empty;
        }

        PlayerPrefs.SetString("Tutorial", "True");
    }
示例#4
0
    public void EndGame()
    {
        bool newHighScore = false;
        int  tempScore    = 0;
        int  nextScore    = 0;

        highScores = PlayerPrefsX.GetIntArray("scores");
        PlayerPrefs.SetInt("orderInScore", 99);
        for (int i = 0; i < highScores.Length; i++)
        {
            if (newHighScore == false)
            {
                if (MyScore >= highScores [i])
                {
                    newHighScore   = true;
                    tempScore      = highScores [i];
                    highScores [i] = MyScore;
                    PlayerPrefs.SetInt("orderInScore", i);
                }
            }
            else
            {
                nextScore      = highScores [i];
                highScores [i] = tempScore;
                tempScore      = nextScore;
            }
        }
        PlayerPrefsX.SetIntArray("scores", highScores);
    }
示例#5
0
    // Use this for initialization
    void Start()
    {
        database = GetComponent <AnimalDatabase>();
        // How many slots
        slotAmount = 25;
        // Find InventoryPanel and instantiate slots
        inventoryPanel = GameObject.Find("Inventory Panel");
        slotPanel      = inventoryPanel.transform.Find("SlotPanel").gameObject;
        for (int i = 0; i < slotAmount; i++)
        {
            animals.Add(new Animal());
            slots.Add(GameObject.Instantiate(inventorySlot));
            slots[i].transform.SetParent(slotPanel.transform);
        }

        aquired = PlayerPrefsX.GetIntArray("AnimalsAquired");
        for (int i = 1; i <= database.Count(); i++)
        {
            if (!contains(i))
            {
                addAnimal(-i);
            }
            else
            {
                addAnimal(i);
            }
        }
    }
示例#6
0
    // Start is called before the first frame update
    public void Start()
    {
        var timesList = PlayerPrefsX.GetStringArray("TimeKEY");

        Debug.Log(timesList);
        var scoreList = PlayerPrefsX.GetIntArray("KEY");

        foreach (int A in scoreList)
        {
            Debug.Log(A);
        }

        //得点を新しい順に表示するコード
        var zip = scoreList.Zip(timesList, (scores, times) => new { scores, times })
                  .OrderByDescending(pair => pair.times)
                  .Select((pair, index) => $"{pair.times} 得点:{pair.scores}");

        //削除:No.{index + 1}
        foreach (string A in zip)
        {
            ResultBox = Instantiate(ResultBoxPrefab);
            ResultBox.transform.SetParent(canvas.transform, false);
            var txtComp = ResultBox.GetComponentInChildren <Text>();
            txtComp.text = A;

            Debug.Log(A);


            rankingList.Add(txtComp);
            Debug.Log(rankingList[0]);
        }
    }
    void napolniHighscore()
    {
        int[]    highScoreArr = PlayerPrefsX.GetIntArray("HighScore");
        string[] Names        = PlayerPrefsX.GetStringArray("Names");

        //Debug.Log(highScoreArr.Length + "  " + Names.Length);

        if (highScoreArr.Length > 0 && Names.Length > 0)
        {
            if (highScoreArr.Length == Names.Length)
            {
                for (int i = 0; i < highScoreArr.Length; i++)
                {
                    highscoreText[i].text = Names[i] + " - " + highScoreArr[i];
                }
            }
            else
            {
                Debug.Log("Error?");
            }
        }
        //else
        //{
        //    int[] tempArrayINT = new int[10] { 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100 };
        //    string[] tempArraySTR = new string[10] { "PC Master", "Luka", "Rok", "Aljaz", "Matjaz", "Ziga", "Janez", "Micka", "Francka", "Joze" };
        //    PlayerPrefsX.SetIntArray("HighScore", tempArrayINT);
        //    PlayerPrefsX.SetStringArray("Names", tempArraySTR);
        //    //highscoreText[0].text = "Napolnim";
        //    Debug.Log("Prazno... zaj polnim");
        //}
    }
示例#8
0
    public void ActiveCard()
    {
        lastCard.GetComponent <CardScript> ().SetActiveButton();
        int[] original = PlayerPrefsX.GetIntArray("SelectedCardsIDs");

        List <int> iList = new List <int>();

        for (int i = 0; i < original.Length; i++)
        {
            iList.Add(original [i]);
        }

        iList.Add(lastCard.GetComponent <CardScript> ().CardID);

        int[] finalArray = new int[iList.Count];

        int x = 0;

        foreach (int i in iList)
        {
            finalArray [x] = i;
            x++;
        }

//		int[] finalArray = new  int[original.Length + 1 ];
//
//		for(int i = 0; i < original.Length; i ++ ) {
//			finalArray[i] = original[i];
//		}

//		finalArray[finalArray.Length - 1] = lastCard.GetComponent<CardScript>().CardID;
        PlayerPrefsX.SetIntArray("SelectedCardsIDs", finalArray);
    }
示例#9
0
    public void DeactiveCard()
    {
        lastCard.GetComponent <CardScript> ().SetDesativeButton();
        int[] original = PlayerPrefsX.GetIntArray("SelectedCardsIDs");

        List <int> iList = new List <int>();

        for (int i = 0; i < original.Length; i++)
        {
            iList.Add(original [i]);
        }

        iList.Remove(lastCard.GetComponent <CardScript> ().CardID);

        int[] finalArray = new int[iList.Count];

        int x = 0;

        foreach (int i in iList)
        {
            finalArray [x] = i;
            x++;
        }

        PlayerPrefsX.SetIntArray("SelectedCardsIDs", finalArray);
    }
示例#10
0
    public void SendCard(GameObject o)
    {
        lastCard         = o;
        cardname.text    = o.GetComponent <CardScript> ().cardname;
        descrition.text  = o.GetComponent <CardScript> ().descrition;
        cost.text        = o.GetComponent <CardScript> ().cost;
        damage.text      = o.GetComponent <CardScript> ().damage;
        efect.sprite     = o.GetComponent <CardScript> ().efect.sprite;
        image.sprite     = o.GetComponent <CardScript> ().image;
        character.sprite = o.GetComponent <CardScript> ().peson;
        Debug.Log(PlayerPrefsX.GetIntArray("SelectedCardsIDs").Length);
        if (PlayerPrefsX.GetIntArray("SelectedCardsIDs").Length <= 15 && enableButton != null)
        {
            enableButton.GetComponent <Button> ().interactable = false;
        }
        else if (enableButton != null)
        {
            enableButton.GetComponent <Button> ().interactable = true;
        }

        if (enableButton != null && disableButton != null)
        {
            if (o.GetComponent <CardScript> ().isactivebutton)
            {
                enableButton.SetActive(true);
                disableButton.SetActive(false);
            }
            else
            {
                enableButton.SetActive(false);
                disableButton.SetActive(true);
            }
        }
    }
示例#11
0
    public void RemoveCard()
    {
        int[] original = PlayerPrefsX.GetIntArray("PlayerCardsIDs");

        if (original.Length > 5)
        {
            List <int> iList = new List <int> ();


            for (int i = 0; i < original.Length; i++)
            {
                iList.Add(original [i]);
            }

            iList.Remove(lastCard.GetComponent <CardScript> ().CardID);

            int[] finalArray = new int[iList.Count];

            int x = 0;
            foreach (int i in iList)
            {
                finalArray [x] = i;
                x++;
            }

            PlayerPrefsX.SetIntArray("PlayerCardsIDs", finalArray);
            DeactiveCard();
            Destroy(lastCard.gameObject);
            this.gameObject.SetActive(false);
        }
    }
示例#12
0
    // Update is called once per frame
    //void Update () {

    public void SelectCharcter()
    {
        OwnedSkinIndexs = PlayerPrefsX.GetIntArray("OwnedSkinIndexs", 27, 1);
        ChosenCharcter  = SkinIndex;
        BuyButton.gameObject.SetActive(false);
        Buy.ShowBuyBtn(ChosenCharcter, this.gameObject);
        for (int i = 0; i < OwnedSkinIndexs.Length; i++)
        {
            if (ChosenCharcter == OwnedSkinIndexs[i])
            {
                PlayerPrefs.SetInt("ChosenSkin", ChosenCharcter);
                BuyButton.gameObject.SetActive(true);
                Debug.Log(ChosenCharcter + "--" + ChosenCharcter + "--" + OwnedSkinIndexs[i]);
            }
        }

        PlayerPrefs.SetInt("ChosenSkin", ChosenCharcter);

        CharcterView.SetActive(false);
        CharcterView.GetComponent <SpriteRenderer> ().sprite = PlayerSkins[SkinIndex];

        CharcterView.transform.position = StartupPosition;
        CharcterView.transform.Rotate(0f, 0f, 10f);
        CharcterView.SetActive(true);
    }
示例#13
0
    public static int LoadTheGame(int loadSlot) //should be 1-4
    {
        //check if load exists, if not doesn't load the game
        if (PlayerPrefsX.GetVector3("respawn" + loadSlot) == null)
        {
            return(-1); //failure
        }
        plants.Clear();
        loadedSlot = loadSlot;
        //LOADS THE GAME
        SceneManager.LoadScene(PlayerPrefs.GetString("activeScene" + loadSlot));

        //change update player next respawn
        spawnLocation         = PlayerPrefsX.GetVector3("respawn" + loadSlot);
        Globals.player.health = PlayerPrefs.GetInt("playerHealth" + loadSlot);
        inventory             = PlayerPrefsX.GetIntArray("playerInventory" + loadSlot);
        print(inventory);

        PlayerPrefsX.GetBool("lavaBossBeaten" + loadSlot, lavaBossBeaten);
        PlayerPrefsX.GetBool("windBossBeaten" + loadSlot, windBossBeaten);
        PlayerPrefsX.GetBool("caveBossBeaten" + loadSlot, caveBossBeaten);

        Vector3[] tempPlantPositions  = PlayerPrefsX.GetVector3Array("PlantPositions" + loadSlot);
        int[]     tempPlantTypes      = PlayerPrefsX.GetIntArray("PlantTypes" + loadSlot);
        String[]  tempPlantScenes     = PlayerPrefsX.GetStringArray("PlantScenes" + loadSlot);
        int[]     tempPlantDirections = PlayerPrefsX.GetIntArray("PlantDirections" + loadSlot);


        for (int i = 0; i < tempPlantDirections.Length; i++)
        {
            plants.Add(new PlantData(tempPlantPositions[i], tempPlantScenes[i], (Direction)tempPlantDirections[i]), tempPlantTypes[i]);
        }

        return(1); //success
    }
示例#14
0
 public void End(string name)
 {
     if (testNetwork.isConnect)
     {
         myParse.InsertScore(combo, name);
         GameObject.Find("Preload").GetComponent <Preload>().FirstInStartScene();
         Application.LoadLevel("Start");
     }
     int[]    scores = PlayerPrefsX.GetIntArray("scores");
     string[] names  = PlayerPrefsX.GetStringArray("names");
     scores[10] = combo;
     names[10]  = name;
     for (int i = 0; i < scores.Length; i++)
     {
         for (int j = i; j < scores.Length; j++)
         {
             if (scores[j] > scores[i])
             {
                 int temp = scores[j];
                 scores[j] = scores[i];
                 scores[i] = temp;
                 string temp1 = names[j];
                 names[j] = names[i];
                 names[i] = temp1;
             }
         }
     }
     PlayerPrefsX.SetIntArray("scores", scores);
     PlayerPrefsX.SetStringArray("names", names);
 }
示例#15
0
    public void UnlockLevel(string nameWorld, int indexLevel)
    {
        var tempListLockLevel = PlayerPrefsX.GetIntArray("levelLocked" + nameWorld).ToList();

        tempListLockLevel.Remove(indexLevel);
        PlayerPrefsX.SetIntArray("levelLocked" + nameWorld, tempListLockLevel.ToArray());
    }
    private int[] highScoresArray = new int[10]; // Array with ten high scores

    // Use this for initialization
    void Start()
    {
        //Gets high score array
        highScoresArray = PlayerPrefsX.GetIntArray("HighScoreArray");
        //Gest scores from ScoresCounter class
        totalPoints.text = ScoresCounter.score.ToString();
        //Calculate the total points for the game over screen
        totalPoints.text = int.Parse(totalPoints.text).ToString();
        //Parses points to int
        score = int.Parse(totalPoints.text);
        //Checks if the score is higher then the last element in the array
        if (score > highScoresArray[9])
        {
            for (int i = 0; i < 10; i++)        //Loops the array to add a high score
            {
                if (score > highScoresArray[i]) //Check if score is higher then the pleace in array that is in
                {
                    for (int j = 9; j > i; j--) //Scores go down by one in the array
                    {
                        highScoresArray[j] = highScoresArray[j - 1];
                    }//End of for
                    highScoresArray[i] = score;//Found the pleace in the array
                    break;//Found the pleace so it won't look for more
                } //End of if
            }     //End of for loop
        }         //End of if

        PlayerPrefsX.SetIntArray("HighScoreArray", highScoresArray);//Adds result to the high score array
    }//End of start method
示例#17
0
 public void LoadLevelInfo()
 {
     int[] lvlArray = PlayerPrefsX.GetIntArray("LevelInfo");
     if (lvlArray.Length < LevelDataTable.Length)
     {
         int oldArraySize = lvlArray.Length;
         Array.Resize <int>(ref lvlArray, LevelDataTable.Length);
         for (int i = oldArraySize; i < LevelDataTable.Length; i++)
         {
             if (i == 0)
             {
                 lvlArray[0] = 0;
             }
             else
             {
                 lvlArray[i] = LEVEL_LOCKED;
             }
         }
     }
     else if (lvlArray.Length > LevelDataTable.Length)
     {
         Array.Resize <int>(ref lvlArray, LevelDataTable.Length);
     }
     for (int i = 0; i < LevelDataTable.Length; i++)
     {
         LevelDataTable[i].locked    = (lvlArray[i] & LEVEL_LOCKED) > 0;          //Bitwise check if level is locked i.e. 1 or 3
         LevelDataTable[i].completed = (lvlArray[i] & LEVEL_COMPLETED) > 0;       // ditto for completed i.e. 2 or 3
     }
 }
示例#18
0
    void Start()
    {
        highScoresArray       = PlayerPrefsX.GetIntArray("HighScoreArray");
        gainedPointsText.text = PointsManager.points.ToString();

        GameManager = GameObject.Find("GameManager");
        extraLifesBonusText.text = (GameManager.GetComponent <CarDurabilityManager>().lifes *everyExtraLifeBonus).ToString();

        if ((PlayerCar = GameObject.FindWithTag("Player")) != null)
        {
            if (PlayerCar.GetComponent <PlayerCarMovement>().durability == PlayerCar.GetComponent <PlayerCarMovement>().maxDurability)
            {
                noCollisionBonusText.text = noCollisionBonus.ToString();
            }
        }
        altogetherPointsText.text = (int.Parse(gainedPointsText.text) + int.Parse(extraLifesBonusText.text) + int.Parse(noCollisionBonusText.text)).ToString();

        score = int.Parse(altogetherPointsText.text);
        if (score > highScoresArray[9])
        {
            for (int i = 0; i < 10; i++)
            {
                if (score > highScoresArray[i])
                {
                    for (int j = 9; j > i; j--)
                    {
                        highScoresArray[j] = highScoresArray[j - 1];
                    }
                    highScoresArray[i] = score;
                    break;
                }
            }
        }
        PlayerPrefsX.SetIntArray("HighScoreArray", highScoresArray);
    }
示例#19
0
    public void LoadPlayerSave(Monster playerMonster)
    {
        Debug.Log("Load save");
        for (int i = 0; i < allParts.Length; ++i)
        {
            allParts[i].playerlevel     = PlayerPrefsX.GetIntArray($"PartsLevels_{allParts[i].type}");
            allParts[i].isOwnedByPlayer = PlayerPrefsX.GetBoolArray($"IsOwnedByPlayer_{allParts[i].type}");
        }

        LoadBodyPart(BodyPartType.Body);

        LoadBodyPart(BodyPartType.Arms);
        LoadBodyPart(BodyPartType.Legs);
        LoadBodyPart(BodyPartType.Tail);
        LoadBodyPart(BodyPartType.Wings);
        LoadBodyPart(BodyPartType.Fur);

        LoadBodyPart(BodyPartType.Head);
        LoadBodyPart(BodyPartType.Teeth);
        LoadBodyPart(BodyPartType.Eyes);
        LoadBodyPart(BodyPartType.Horns);

        void LoadBodyPart(BodyPartType type)
        {
            int id = PlayerPrefs.GetInt($"EquipedId_{type}");

            allParts[(int)type].parts[id].isEquipedByPlayer = true;
            playerMonster.usedBodyParts.Add(GetAllParts(type)[id]);
        }

        OnNewPlayerPartsAvaliable?.Invoke();
    }
示例#20
0
 void LoadArray()
 {
     players.Clear();
     scores.Clear();
     players.AddRange(PlayerPrefsX.GetStringArray("Leaderboard.players"));
     scores.AddRange(PlayerPrefsX.GetIntArray("Leaderboard.scores"));
 }
    public static void loadGame()
    {
        //PlayerPrefs.DeleteAll();
        UserName      = PlayerPrefs.GetString(STRING_USER_NAME);
        Coin          = PlayerPrefs.GetInt(STRING_COIN);
        mUnblockLevel = PlayerPrefs.GetInt(STRING_UNBLOCK_LEVEL);
        starArray     = PlayerPrefsX.GetIntArray(STRING_LEVEL_STAR);
        if (starArray.Length < 10)
        {
            starArray = new int[120];
        }
        mBoom    = PlayerPrefs.GetInt(STRING_BOOM);
        mPush    = PlayerPrefs.GetInt(STRING_PUSH);
        mThrough = PlayerPrefs.GetInt(STRING_THROUGH);

        if (mUnblockLevel < 1)
        {
            mBoom         = 3;
            mPush         = 3;
            mThrough      = 3;
            mUnblockLevel = 1;
        }
        // mUnblockLevel = 50;
        if (UserName.Length <= 4)
        {
            UserName = "******";
        }
    }
示例#22
0
        private static string getEntityFiltersString()
        {
            int[]  entityFilters         = PlayerPrefsX.GetIntArray("EntitiesCodes");
            string filteredFiltersString = "(";
            int    totalFilters          = entityFilters.Length;

            if (totalFilters == 0)
            {
                return("");
            }

            if (totalFilters > 50)
            {
                totalFilters = 50;                 // maxiumum number for Query API
            }
            for (int x = 0; x < totalFilters; x++)
            {
                filteredFiltersString += "'" + entityFilters[x].ToString() + "'";
                if (x < (totalFilters - 1))
                {
                    filteredFiltersString += ", ";
                }
                else
                {
                    filteredFiltersString += ")";
                }
            }

            Debug.Log(filteredFiltersString);
            return(filteredFiltersString);
        }
示例#23
0
    void Update()
    {
        guns = GunData.guns;
        int[] currentGuns = PlayerPrefsX.GetIntArray("gunsEquipped", 0, 2);
        //Debug.Log(guns.Count);
        GameObject Gun1 = transform.Find(guns[currentGuns[0]].gunName).gameObject;
        GameObject Gun2 = transform.Find(guns[currentGuns[1]].gunName).gameObject;

        foreach (Transform child in Weapon1.transform)
        {
            Destroy(child.gameObject);
        }
        foreach (Transform child in Weapon2.transform)
        {
            Destroy(child.gameObject);
        }
        if (currentGuns[0] == currentGuns[1])
        {
            GameObject Image1 = Object.Instantiate(Gun1);
            Image1.transform.SetParent(Weapon1.transform, false);
            Image1.SetActive(true);
            return;
        }
        GameObject newImage1 = Object.Instantiate(Gun1);
        GameObject newImage2 = Object.Instantiate(Gun2);

        newImage1.transform.SetParent(Weapon1.transform, false);
        newImage2.transform.SetParent(Weapon2.transform, false);
        newImage1.SetActive(true);
        newImage2.SetActive(true);
    }
示例#24
0
    public void Load()
    {
        StopAllCoroutines();
        Vector3[] monsterLocations = PlayerPrefsX.GetVector3Array("monsterLocations");
        int[]     monsterTypes     = PlayerPrefsX.GetIntArray("monsterTypes");
        if (monsterLocations != null && monsterTypes != null)
        {
            foreach (Transform child in transform)
            {
                GameObject.Destroy(child.gameObject);
            }

            for (int i = 0; i < monsterLocations.Length; i++)
            {
                int     monsterType    = monsterTypes[i];
                Vector3 targetLocation = monsterLocations[i];

                GameObject   monsterPrefab = monsterPrefabs[monsterType];
                MonsterMover mover         = monsterPrefab.GetComponent <MonsterMover>();

                InstantiateMonster(monsterPrefab, mover, targetLocation, monsterType);
            }
        }
        StartCoroutine(Respawn());
    }
示例#25
0
    public void DoAction()
    {
        movementScript.KillMovement();
        movementScript.enabled = false;

        endLevelCanvas.SetActive(true);
        pedestrianCollissionText.text = GUIController.instance.pedestrianCollissionText.text;
        wallCollissionsText.text      = GUIController.instance.wallCollissionsText.text;
        resetsText.text   = GUIController.instance.resetsText.text;
        currentScore.text = GUIController.instance.currentScore.text;
        if (fallScore != null)
        {
            fallScore.text = GUIController.instance.fallText.text;
        }
        PlayerPrefs.SetInt(lastScoreName, Convert.ToInt32(currentScore.text));
        int[] lastScores = PlayerPrefsX.GetIntArray(levelName, 0, 10);
        for (int i = lastScores.Length - 1; i > 0; i--)
        {
            lastScores[i] = lastScores[i - 1];
        }
        lastScores[0] = Convert.ToInt32(currentScore.text);
        PlayerPrefsX.SetIntArray(levelName, lastScores);
        PlayerPrefs.Save();
        GameController.instance.endLevel = true;
    }
示例#26
0
    /// <summary>
    /// Saves the player's recent score so it can be displayed in the end
    /// screen. Also checks if the score should be in the player's top five
    /// scores.
    /// </summary>
    public void SaveScore()
    {
        // Save recent score
        PlayerPrefs.SetInt(scoreKey, int.Parse(scoreDisplay.text));
        int recentScore = PlayerPrefs.GetInt(scoreKey);

        List <int> highscores = new List <int>(PlayerPrefsX.GetIntArray(highscoresKey, 0, 5));

        // Check if recent score has beaten any previous scores
        for (int i = 0; i < highscores.Count; i++)
        {
            if (recentScore > highscores[i])
            {
                highscores.Insert(i, recentScore);
                break;
            }
        }

        // Remove any scores not in the top five
        for (int i = 5; i < highscores.Count;)
        {
            highscores.RemoveAt(maxNumScores);
        }

        // Save list of high scores
        PlayerPrefsX.SetIntArray(highscoresKey, highscores.ToArray());
    }
示例#27
0
    public void UnlockCharacter(int _index)
    {
        bool[] ballU = PlayerPrefsX.GetBoolArray(GameKeys.kprefBallPrizeUnlock);

        int totalDiamonds = PlayerPrefs.GetInt(GameKeys.kprefDiamonds);

        int[] ball_PrizeC = PlayerPrefsX.GetIntArray(GameKeys.kprefBallPrize);
        if (ballU [_index])
        {
            PlayerPrefs.SetInt("INDEX", _index);
            return;
        }
        else
        {
            if (ball_PrizeC [_index] <= totalDiamonds)
            {
                int new_Diamond = totalDiamonds - ball_PrizeC [_index];
//				GameController.instance.diamondScoreText.text = new_Diamond.ToString ();
                PlayerPrefs.SetInt(GameKeys.kprefDiamonds, new_Diamond);
                UpdateDiamondScore();
                IPScrollView.Instance.scrollableObjects [_index].GetChild(0).GetChild(0).gameObject.SetActive(false);
                ballU [_index] = true;
                PlayerPrefsX.SetBoolArray(GameKeys.kprefBallPrizeUnlock, ballU);
                PlayerPrefs.SetInt("INDEX", _index);
            }
        }
    }
示例#28
0
 void Start()
 {
     highUser   = PlayerPrefsX.GetStringArray("userArray", "Anonim", 15);
     highScores = PlayerPrefsX.GetIntArray("scoreArray", 0, 15);
     insertScore();
     setupSetting();
 }
示例#29
0
    private void LoadPrefs()
    {
        _currentLevel = PlayerPrefs.GetInt("currentLevel");

        bool [] levelsAvailable = PlayerPrefsX.GetBoolArray("levelsAvalable");
        bool [] levelsCompleted = PlayerPrefsX.GetBoolArray("levelsCompleted");
        bool [] levelsVisited   = PlayerPrefsX.GetBoolArray("levelsVisited");
        int []  levelsStars     = PlayerPrefsX.GetIntArray("levelsStars");

        _levelsPrefs = new List <Level> ();
        for (int i = 0; i < levelsTotal; i++)
        {
            _levelsPrefs.Add(new Level(levelsAvailable[i], levelsCompleted[i], levelsStars[i], levelsVisited[i]));
            if (i < levelsTotal - 1)
            {
                if (_levelsInfo.transitions != null && i < _levelsInfo.transitions.Count)
                {
                    _levelsPrefs[i].transitions = _levelsInfo.transitions[i];
                }
                else
                {
                    _levelsPrefs[i].transitions = new List <int>();
                    _levelsPrefs[i].transitions.Add(i + 1);
                }
            }
            else
            {
                _levelsPrefs[i].transitions = null;
            }
        }
    }
示例#30
0
    void Start()
    {
        this.gameObject.GetComponent <Text>().text = Points.points.ToString();

        highScoresArray = PlayerPrefsX.GetIntArray("HighScoreArray");
        score           = Points.points;

        if (score > highScoresArray[9])
        {
            for (int i = 0; i < highScoresArray.Length; i++)
            {
                if (score > highScoresArray[i])
                {
                    for (int j = highScoresArray.Length - 1; j > i; j--)
                    {
                        highScoresArray[j] = highScoresArray[j - 1];
                    }
                    highScoresArray[i] = score;
                    break;
                }
            }
        }

        PlayerPrefsX.SetIntArray("HighScoreArray", highScoresArray);
    }