Esempio n. 1
0
    public void CopySelectedNotes()
    {
        if (!OperationManager.TunerManager.isInitialized)
        {
            return;
        }
        if (!ValidateCopyInstruction())
        {
            return;
        }

        bool  HasTap = false, HasHold = false;
        float FirstNoteTime = 0;

        if (OperationManager.SelectedTapNote.Count != 0)
        {
            OperationManager.SelectedTapNote.Sort((Lanotalium.Chart.LanotaTapNote a, Lanotalium.Chart.LanotaTapNote b) => { return(a.Time.CompareTo(b.Time)); });
            FirstNoteTime = OperationManager.SelectedTapNote[0].Time;
            HasTap        = true;
        }
        if (OperationManager.SelectedHoldNote.Count != 0)
        {
            OperationManager.SelectedHoldNote.Sort((Lanotalium.Chart.LanotaHoldNote a, Lanotalium.Chart.LanotaHoldNote b) => { return(a.Time.CompareTo(b.Time)); });
            FirstNoteTime = OperationManager.SelectedHoldNote[0].Time;
            HasHold       = true;
        }
        if (HasTap && HasHold)
        {
            FirstNoteTime = Mathf.Min(OperationManager.SelectedTapNote[0].Time, OperationManager.SelectedHoldNote[0].Time);
        }
        if (!HasTap && !HasHold)
        {
            return;
        }
        if (HasTap)
        {
            foreach (float Target in CopyTargets)
            {
                float Delta = Target - FirstNoteTime;
                foreach (Lanotalium.Chart.LanotaTapNote Tap in OperationManager.SelectedTapNote)
                {
                    Lanotalium.Chart.LanotaTapNote New = Tap.DeepCopy();
                    New.Time += Delta;
                    OperationManager.AddTapNote(New, true, false, false);
                }
            }
        }
        if (HasHold)
        {
            foreach (float Target in CopyTargets)
            {
                float Delta = Target - FirstNoteTime;
                foreach (Lanotalium.Chart.LanotaHoldNote Hold in OperationManager.SelectedHoldNote)
                {
                    Lanotalium.Chart.LanotaHoldNote New = Hold.DeepCopy();
                    New.Time += Delta;
                    OperationManager.AddHoldNote(New, true, false, false);
                }
            }
        }
        OperationManager.SelectNothing();
        LimNotifyIcon.ShowMessage(LimLanguageManager.TextDict["Copier_Msg_Success"]);
    }