Esempio n. 1
0
    public void ConvertSelectedToHoldNote()
    {
        if (LimSystem.ChartContainer == null)
        {
            return;
        }
        OperationManager.SelectedTapNote.Sort((Lanotalium.Chart.LanotaTapNote a, Lanotalium.Chart.LanotaTapNote b) => { return(a.Time.CompareTo(b.Time)); });
        int Quantity = OperationManager.SelectedTapNote.Count;

        if (Quantity == 0)
        {
            return;
        }
        else if (Quantity == 1)
        {
            OperationManager.ConvertTapNoteToHoldNote(OperationManager.SelectedTapNote[0]); return;
        }
        else
        {
            Lanotalium.Chart.LanotaHoldNote New = new Lanotalium.Chart.LanotaHoldNote
            {
                Duration = OperationManager.SelectedTapNote[Quantity - 1].Time - OperationManager.SelectedTapNote[0].Time,
                Time     = OperationManager.SelectedTapNote[0].Time,
                Degree   = OperationManager.SelectedTapNote[0].Degree,
                Type     = 5,
                Size     = 1,
                Jcount   = Quantity - 1,
                Joints   = new List <Lanotalium.Chart.LanotaJoints>()
            };
            float DegreeCount = New.Degree;
            float TimeCount   = New.Time;
            for (int i = 1; i < Quantity; ++i)
            {
                Lanotalium.Chart.LanotaJoints NewJ = new Lanotalium.Chart.LanotaJoints();
                NewJ.Cfmi    = 0;
                NewJ.dTime   = Mathf.Max(0.0001f, OperationManager.SelectedTapNote[i].Time - TimeCount);
                NewJ.dDegree = OperationManager.SelectedTapNote[i].Degree - DegreeCount;
                New.Joints.Add(NewJ);
                TimeCount   += NewJ.dTime;
                DegreeCount += NewJ.dDegree;
            }
            foreach (Lanotalium.Chart.LanotaTapNote Tap in OperationManager.SelectedTapNote)
            {
                OperationManager.DeleteTapNote(Tap);
            }
            OperationManager.SelectedTapNote.Clear();
            OperationManager.AddHoldNote(New, true, true, true);
        }
    }