Ejemplo n.º 1
0
    public void PopulateSongSelect()
    {
        foreach (BeatmapUIObj songObj in songObjs)
        {
            Destroy(songObj.gameObject);
        }
        songObjs.Clear();

        bool moreThanSeven = OszUnpacker.bmds.Count > 7;

        if (moreThanSeven)
        {
            songHolder.sizeDelta        = new Vector2(sizePerNewObj * OszUnpacker.bmds.Count, songHolder.sizeDelta.y);
            songHolder.anchoredPosition = new Vector2(105, songHolder.anchoredPosition.y);
            content.sizeDelta           = new Vector2(songHolder.sizeDelta.x + sizePerNewObj * 6, content.sizeDelta.y);   //6 because can view max 7 at once. 3 at start, 3 at end. Required so that the First and Last Obj can be at the middle
        }
        else
        {
            songHolder.sizeDelta        = new Vector2(245, songHolder.sizeDelta.y);
            songHolder.anchoredPosition = new Vector2(0, songHolder.anchoredPosition.y);
            content.sizeDelta           = new Vector2(songHolder.sizeDelta.x, content.sizeDelta.y);
        }

        for (int i = 0; i < OszUnpacker.bmds.Count; i++)
        {
            OszUnpacker.bmds = OszUnpacker.LoadBeatmapData();
            BeatmapUIObj songObj = Instantiate(songObjPrefab, songHolder);
            songObj.transform.position = new Vector3(songObj.transform.position.x, songObj.transform.position.y, songObj.transform.position.z - 0.01f);
            songObj.AssignBmData(i, scroll);
            songObj.mainImg.SizeToFillParent();
            songObjs.Add(songObj);
        }
    }
Ejemplo n.º 2
0
    public void ClearHighScores(bool clear)
    {
        if (clear)
        {
            BeatmapInfo bmi = OszUnpacker.bmds[currentSelectedSong.bmdIndex].mapInfos[currentSelectedBeatmap.bmiIndex];
            bmi.scores = new List <ScoreInfo>();
            OszUnpacker.bmds[currentSelectedSong.bmdIndex].mapInfos[currentSelectedBeatmap.bmiIndex] = bmi;
            OszUnpacker.SaveBeatmapData(OszUnpacker.bmds);
            RepopulateHighscores(bmi);
        }

        CloseOpenMenu(1);
    }
Ejemplo n.º 3
0
    void OnSongEnd()
    {
        gameState = GameState.Ended;

        CalculateGrade();

        bool isNewHighscore = false;

        // Compare with Previous Highscores
        if (OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores.Count >= 3)
        {
            if ((scoreInfo.score > OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2].score) ||
                (scoreInfo.score == OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2].score && (int)scoreInfo.grade < (int)OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2].grade))
            {
                OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores[2] = scoreInfo;
                isNewHighscore = true;
            }
        }
        else
        {
            isNewHighscore = true;
            OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores.Add(scoreInfo);
            OszUnpacker.SaveBeatmapData(OszUnpacker.bmds);
        }

        if (isNewHighscore)
        {
            OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex].scores.Sort((x, y) => y.score.CompareTo(x.score));             //Sort According to Highest Score
            UIManager.inst.RepopulateHighscores(OszUnpacker.bmds[bmdIndex].mapInfos[bmiIndex]);
            OszUnpacker.SaveBeatmapData(OszUnpacker.bmds);
        }

        UIManager.inst.PopulateScore(scoreInfo, isNewHighscore);
        UIManager.inst.ShowEndScore();

        ResetScoring();
        UIManager.inst.UpdateScores(scoreInfo.score, combo, scoreMult);
    }