Beispiel #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);
        }
    }
    public void OnTypeChange()
    {
        if (!EnableValueChange)
        {
            return;
        }
        if (Type.value == 5)
        {
            return;
        }
        int TypeTmp = ConvertValueToType(Type.value);
        List <Lanotalium.Chart.LanotaTapNote>  ToConvertTapNote  = new List <Lanotalium.Chart.LanotaTapNote>();
        List <Lanotalium.Chart.LanotaHoldNote> ToConvertHoldNote = new List <Lanotalium.Chart.LanotaHoldNote>();

        if (Mode == Lanotalium.Editor.ComponentTypeMode.Work)
        {
            foreach (Lanotalium.Chart.LanotaTapNote Tap in OperationManager.SelectedTapNote)
            {
                if (TypeTmp == 5)
                {
                    ToConvertTapNote.Add(Tap);
                }
                else
                {
                    OperationManager.SetTapNoteType(Tap, TypeTmp);
                }
            }
            foreach (Lanotalium.Chart.LanotaHoldNote Hold in OperationManager.SelectedHoldNote)
            {
                if (TypeTmp != 5)
                {
                    ToConvertHoldNote.Add(Hold);
                }
            }
            foreach (Lanotalium.Chart.LanotaTapNote Tap in ToConvertTapNote)
            {
                OperationManager.ConvertTapNoteToHoldNote(Tap);
            }
            foreach (Lanotalium.Chart.LanotaHoldNote Hold in ToConvertHoldNote)
            {
                OperationManager.ConvertHoldNoteToTapNote(Hold, TypeTmp);
            }
            OperationManager.SelectNothing();
        }
    }