Exemple #1
0
    private void Awake()
    {
        //Disable music
        if (Sound.instance != null)
        {
            Sound.instance.GetComponent <AudioSource>().enabled = false;
        }

        currentLevel = PlayerPrefsPersister.GetCurrentLevel();

        levelTimmings = RatingsManager.levelTimmings;
        if (levelTimmings == null || levelTimmings.Count == 0)
        {
            RatingsManager.FillLevels();
        }
        currentLevelTimmings = levelTimmings.Where(l => l.LevelId == currentLevel).FirstOrDefault();

        //add level prefab
        GameObject levelPrefab = Instantiate(levels[currentLevel]);

        levelPrefab.transform.SetParent(levelContainer);
        timerText.enabled = false;

        //if this is the last level -> hide "Next" button;
        if (currentLevel == levels.Count - 1)
        {
            NextBtn.GetComponent <Button>().interactable = false;
        }
    }
    private void Awake()
    {
        levelTimmings = RatingsManager.levelTimmings;
        if (levelTimmings == null || levelTimmings.Count == 0)
        {
            RatingsManager.FillLevels();
        }
        levelTimmings.OrderBy(l => l.LevelId);
        levelReached = PlayerPrefsPersister.GetLevelReached();

        //if(!Sound.instance.GetComponent<AudioSource>().enabled && PlayerPrefsPersister.GetAudioStatus())
        //{
        //    Sound.instance.GetComponent<AudioSource>().enabled = true;
        //}
    }
Exemple #3
0
        private RateMyPClient()
        {
            var httpClient = new HttpClient();

            //httpClient.BaseAddress = new Uri("https://localhost:44382");
            httpClient.BaseAddress = new Uri("https://ratemypserver79.azurewebsites.net");
            httpClient.DefaultRequestHeaders.Accept.Clear();
            httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            Teachers = new TeachersManager(httpClient);
            Students = new StudentsManager(httpClient);
            Ratings  = new RatingsManager(httpClient);
            Courses  = new CoursesManager(httpClient);
            Tags     = new TagsManager(httpClient);
        }
Exemple #4
0
    void End()
    {
        SetTimeScale(0);
        finalTime = (Time.time - initialTime);
        if (finalTime < bestTime || bestTime == 0)
        {
            PlayerPrefsPersister.SetRecord(currentLevel, finalTime);
            bestTime = finalTime;
        }

        //set level stars
        RatingsManager.SetLevelStars(currentLevelTimmings.Timmings, stars, finalTime, starTexts);
        finishMenuTime.text   = finalTime.ToString("##.##") + "s";
        finishMenuRecord.text = bestTime.ToString("##.##") + "s";

        CheckUnblockLevel();

        audioWin.enabled = true;
        audioWin.Play();
        finishMenu.SetActive(true);
    }
    void SetLevelButton(GameObject levelButton, bool isUnblocked, RatingsManager.LevelTimmings level = null)
    {
        levelButton.transform.SetParent(levelsPanel);

        //Setting position && anchors
        RectTransform levelButtonRect = levelButton.GetComponent <RectTransform>();

        levelButtonRect.localPosition = new Vector3(0, 0, 0);

        levelButtonRect.anchorMax = new Vector2(offsetXmax, offsetYmax);
        levelButtonRect.anchorMin = new Vector2(offsetXmin, offsetYmin);

        levelButtonRect.offsetMax = new Vector2(0, 0);
        levelButtonRect.offsetMin = new Vector2(0, 0);

        levelButtonRect.localScale = new Vector3(1, 1, 1);

        x          += 170;
        offsetXmax += offsetXincrement;
        offsetXmin += offsetXincrement;

        if (isUnblocked)
        {
            FillListener(levelButton.GetComponentInChildren <Button>(), level.LevelId);
            levelButton.GetComponentInChildren <Text>().text = (level.LevelId + 1).ToString();

            levelBestTime = PlayerPrefsPersister.GetLevelBestTime(level.LevelId);
            stars         = levelButton.GetComponentsInChildren <Image>().Where(s => s.tag == "Star").ToArray();

            //if 'levelBestTime' != 0(to check if at least has been completed 1 time) set the amount of stars the user has got
            if (levelBestTime != 0)
            {
                RatingsManager.SetLevelStars(level.Timmings, stars, levelBestTime);
            }
        }
        else
        {
            levelButton.GetComponent <Button>().interactable = false;
        }
    }
 public int?TestFileRatingFromPlexRating(int?plexRating)
 {
     return(RatingsManager.FileRatingFromPlexRating(plexRating));
 }
 public int?TestPlexRatingFromFile(string file)
 {
     return(RatingsManager.PlexRatingFromFile(file));
 }
 public uint?TestFileRating(string file)
 {
     return(RatingsManager.FileRating(file));
 }