Exemple #1
0
    public void InitBarByScore(int pieceIndex, int barIndex, UIBar uiBar)
    {
        uiBar.startBeat = occupiedBeats;

        //QTE BAR
        if (QTEbarIndex >= 0)
        {
            uiBar.type = UIBar.barType.QTEBar;

            uiBar.ReadScore(QTEscore.QTEscore[QTEbarIndex].notes);
            uiBar.beatsThisBar = QTEscore.QTEscore[QTEbarIndex].beatsThisBar;
        }
        if (QTEbarIndex < 0)
        {
            uiBar.type = UIBar.barType.inputBar;

            //判断当前所在的段落,读取单小节乐谱
            OneBarScore _barScore = pieceIndex > 0 ? score.mainlude[barIndex] : score.prelude[barIndex];

            uiBar.ReadScore(_barScore.notes);
            uiBar.beatsThisBar = _barScore.beatsThisBar;
        }

        //        Debug.Log("startbeat=" + uiBar.startBeat);
//    Debug.Log("occupiedBeats=" + occupiedBeats);

        uiBar.Init();
        uiBar.GetComponent <UIBar>().SetPinAlpha(0);
        uiBar.GetComponent <UIBar>().active = true;

        currentEnergyNotes.AddRange(uiBar.GetComponent <UIBar>().noteList_energy);
        currentQTENotes.AddRange(uiBar.GetComponent <UIBar>().noteList_QTE);
        occupiedBeats += uiBar.beatsThisBar;
    }
Exemple #2
0
    public GameObject CreateBarByScore(int pieceIndex, int barIndex)
    {
        GameObject instBar = Instantiate((GameObject)Resources.Load("Prefab/UI/Bar/UI_Bar", typeof(GameObject)), transform);

        instBar.GetComponent <UIBar>().startBeat = occupiedBeats;


        if (QTEbarIndex >= 0)
        {
            instBar.GetComponent <UIBar>().type = UIBar.barType.QTEBar;
            instBar.GetComponent <UIBar>().ReadScore(QTEscore.QTEscore[QTEbarIndex].notes);
            instBar.GetComponent <UIBar>().beatsThisBar = QTEscore.QTEscore[QTEbarIndex].beatsThisBar;
        }
        if (QTEbarIndex < 0)
        {
            instBar.GetComponent <UIBar>().type = UIBar.barType.inputBar;

            //判断当前所在的段落,读取单小节乐谱

            OneBarScore _barScore = pieceIndex > 0 ? score.mainlude[barIndex] : score.prelude[barIndex];


            //将音符收进两个轨道
            instBar.GetComponent <UIBar>().ReadScore(_barScore.notes);
            instBar.GetComponent <UIBar>().beatsThisBar = _barScore.beatsThisBar;
        }
        instBar.GetComponent <UIBar>().Init();
        instBar.GetComponent <UIBar>().SetPinAlpha(0);
        instBar.GetComponent <UIBar>().active = true;

        occupiedBeats += instBar.GetComponent <UIBar>().beatsThisBar;


        return(instBar);
    }
Exemple #3
0
    public static OneSongScore ReadQTEScoreData(QTEScoreData data)
    {
        if (!data)
        {
            Debug.Log("没找到QTE SCORE DATA");
            Debug.Break();
        }
        Debug.Log("start reading QTE score");

        OneSongScore _score = new OneSongScore
        {
            QTEscore = new List <OneBarScore>()
        };



        for (int i = 0; i < data.QTEscore.Count; i++)
        {
            OneBarScore _onebarscore = new OneBarScore
            {
                beatsThisBar = data.QTEscore[i].beatsThisBar,
                notes        = new List <Note>()
            };
            for (int j = 0; j < data.QTEscore[i].notes.Count; j++)
            {
                _onebarscore.notes.Add(new Note
                {
                    type         = data.QTEscore[i].notes[j].type,
                    beatInBar    = data.QTEscore[i].notes[j].beatInBar,
                    SuccessSkill = data.QTEscore[i].notes[j].SuccessSkill,
                    MissSkill    = data.QTEscore[i].notes[j].MissSkill,
                    BadSkill     = data.QTEscore[i].notes[j].BadSkill
                });
//                Debug.Log("success skill=" + _onebarscore.notes[0].SuccessSkill);

                //                Debug.Log("added mainlude note ");
            }
            _score.QTEscore.Add(_onebarscore);
        }

//        Debug.Log("" + _score.QTEscore.Count);

        return(_score);
    }
Exemple #4
0
    public static OneSongScore ReadScoreData(ScoreData data)
    {
        if (!data)
        {
            Debug.Log("没找到SCORE DATA");
            Debug.Break();
        }
        Debug.Log("start reading score");

        OneSongScore _score = new OneSongScore
        {
            mainlude = new List <OneBarScore>(),
            prelude  = new List <OneBarScore>()
        };



        //_score.mainlude = data.mainlude;
        for (int i = 0; i < data.mainlude.Count; i++)
        {
            OneBarScore _onebarscore = new OneBarScore
            {
                beatsThisBar = data.mainlude[i].beatsThisBar,
                notes        = new List <Note>()
            };
            for (int j = 0; j < data.mainlude[i].notes.Count; j++)
            {
                _onebarscore.notes.Add(new Note
                {
                    type      = data.mainlude[i].notes[j].type,
                    beatInBar = data.mainlude[i].notes[j].beatInBar
                });
                //                Debug.Log("added mainlude note ");
            }
            _score.mainlude.Add(_onebarscore);
        }

        //_score.prelude = data.prelude;

        for (int i = 0; i < data.prelude.Count; i++)
        {
            OneBarScore _onebarscore = new OneBarScore
            {
                beatsThisBar = data.prelude[i].beatsThisBar,
                notes        = new List <Note>()
            };
            for (int j = 0; j < data.prelude[i].notes.Count; j++)
            {
                _onebarscore.notes.Add(new Note
                {
                    type = data.prelude[i].notes[j].type,
                    //_note.note = data.mainlude[j].notes[j].note;
                    beatInBar = data.prelude[i].notes[j].beatInBar
                });
            }
            _score.prelude.Add(_onebarscore);
        }


        return(_score);
    }