Exemple #1
0
    private void OnEnable()
    {
        // es un nuevo usuario es necesario validarlo, solo se aceptan 10 puntajes
        scoreManager.UpdatePlayerScoreList();
        golist = new List <GameObject>();
        SL_playersScoreList save = new SL_playersScoreList();

        save.scores = new SL_playersScoreList[10];
        string[] names = scoreManager.GetPlayerNames();
        int      rank  = 0;

        foreach (string name in names)
        {
            rank++;
            int        _score = scoreManager.GetScore(name);
            GameObject go     = (GameObject)Instantiate(playerScoreEntryPrefab);
            go.transform.SetParent(this.transform);
            //go.GetComponent<RectTransform>().anchoredPosition = GetComponent<RectTransform>().anchoredPosition;
            go.transform.localScale = Vector3.one;
            go.GetComponent <PlayerScoreEntry>().SetPlayerScoreData(rank, name, _score);
            go.SetActive(true);
            golist.Add(go);
            save.scores[rank - 1] = new SL_playersScoreList(name, _score);
            //print(name.ToString() + " / " + _score);
        }
        //guardo los puntajes
        //busoc si se encuentra alguna memoria guardada
        Helper.SavePlayersScore(NameDictionary.playerScoreListKey_lvl_01, save);
    }
Exemple #2
0
    void Init()
    {
        if (playerScores != null)
        {
            return;
        }
        playerScores = new Dictionary <string, int>();

        //busoc si se encuentra alguna memoria guardada
        SL_playersScoreList load = (SL_playersScoreList)Helper.LoadPlayersScore(NameDictionary.playerScoreListKey_lvl_01);

        if (load != null)
        {
            foreach (SL_playersScoreList sl in load.scores)
            {
                SetScore(sl.name, sl.score);
            }

            print("Se cargo la memoria de < " + NameDictionary.playerScoreListKey_lvl_01 + " >");
        }
        else
        {
            //default data
            //SetScore("Nuevo record", 0);
            SetScore("Barto14", 100);
            SetScore("Garfield", 200);
            SetScore("Luffy", 300);
            SetScore("Balrog", 400);
            SetScore("JustinWong", 500);
            SetScore("OnePunch1", 600);
            SetScore("ElGato", 700);
            SetScore("Homero", 800);
            SetScore("KillYou", 900);
            SetScore("KissMe", 1000);

            print("Lista por default");
        }

        //print("---------------");
    }