Ejemplo n.º 1
0
    IEnumerator LoopToCheckChanges()
    {
        // se fija si cambio en el medio...
        yield return(new WaitForSeconds(1));

        if (Data.Instance.userData.mode == UserData.modes.SINGLEPLAYER)
        {
            LevelsData.LevelsScore ls = Data.Instance.levelsData.GetLevelScores(levelID);
            int  a       = 0;
            bool refresh = false;
            //foreach (LevelsData.ScoreData sd in ls.scoreData)
            //{
            if (ls.scoreData.Count > 0 && user1.score_float != ls.scoreData[0].score)
            {
                refresh = true;
            }
            // }
            if (refresh)
            {
                Refresh();
            }
            if (!infoLoaded)
            {
                Refresh();
            }
        }
        StartCoroutine("LoopToCheckChanges");
    }
Ejemplo n.º 2
0
    public void Init(LevelSelector levelSelector, int levelID, float myLastScore)
    {
        this.levelSelector = levelSelector;
        this.levelID       = levelID;
        this.myLastScore   = myLastScore;
        levelScore         = Data.Instance.levelsData.GetLevelScores(levelID);
        image   = GetComponent <Image>();
        this.id = levelID;


        OnChangePlayMode(Data.Instance.userData.mode);

        int  tournamentActive = Data.Instance.userData.GetTournamentAvailable();
        bool showFriends      = true;

        if (levelID > 8 && tournamentActive < 2)
        {
            showFriends = false;
        }
        else if (levelID > 16 && tournamentActive < 3)
        {
            showFriends = false;
        }
        else if (levelID > 24 && tournamentActive < 4)
        {
            showFriends = false;
        }
        if (showFriends)
        {
            StartCoroutine("LoopToCheckChanges");
        }


        if (myLastScore == 0 && levelID > 1)
        {
            SetLock(true);
        }
        else
        {
            SetLock(false);
        }

        button.onClick.AddListener(() =>
        {
            Clicked();
        });
    }