Example #1
0
    public static void ApplyAction(SongObject songObject)
    {
        ChartEditor editor = ChartEditor.Instance;
        Song        song   = editor.currentSong;
        Chart       chart  = editor.currentChart;

        songObject = songObject.Clone();    // Add a new version of the object

        switch (songObject.classID)
        {
        case (int)SongObject.ID.Note:
            Note note = songObject as Note;
            chart.Add(note);

            foreach (Note chordNote in note.chord)
            {
                if (chordNote.controller)
                {
                    chordNote.controller.SetDirty();
                }
            }

            Note next = note.nextSeperateNote;
            if (next != null)
            {
                foreach (Note chordNote in next.chord)
                {
                    if (chordNote.controller)
                    {
                        chordNote.controller.SetDirty();
                    }
                }
            }
            break;

        case (int)SongObject.ID.Starpower:
            Starpower sp = songObject as Starpower;
            chart.Add(sp, false);
            SongEditAdd.SetNotesDirty(sp, editor.currentChart.chartObjects);
            break;

        case (int)SongObject.ID.ChartEvent:
            chart.Add(songObject as ChartObject, false);
            break;

        case (int)SongObject.ID.Section:
        case (int)SongObject.ID.Event:
            song.Add(songObject as Event, false);
            break;

        case (int)SongObject.ID.BPM:
            song.Add(songObject as SyncTrack, false);
            ChartEditor.Instance.songObjectPoolManager.SetAllPoolsDirty();
            break;

        case (int)SongObject.ID.TimeSignature:
            song.Add(songObject as SyncTrack, false);
            break;
        }
    }
Example #2
0
    protected virtual void Update()
    {
        if (currentSongObject == null || prevSongObject != currentSongObject)
        {
            // F*****g awful but it works. Basically a work-around due to how you can no longer use != to compare between events because they compare the strings of their titles.
            if (!(currentSongObject != null && prevSongObject != null && currentSongObject.GetType() == prevSongObjectRef.GetType() &&
                  (currentSongObject.GetType() == typeof(ChartEvent) || currentSongObject.GetType() == typeof(Event)) &&
                  ReferenceEquals(prevSongObjectRef, currentSongObject)))
            {
                resetActionRecording();
            }
        }

        prevSongObject    = currentSongObject.Clone();
        prevSongObjectRef = currentSongObject;
    }
Example #3
0
    public override void InvokeSongEditCommand()
    {
        if (hasValidatedSongObjects)
        {
            ApplyPostValidatedAction(validatedSongObjects, overwrittenSongObjects);
        }
        else
        {
            ApplyActionAndFillValidation(GameSettings.extendedSustainsEnabled);
            songObjects.Clear();
            for (int i = validatedSongObjects.Count - 1; i >= 0; --i)
            {
                SongObject so = validatedSongObjects[i];
                if (so.song == null)
                {
                    // Song object was probably removed during the initial add process, thus was never added at all
                    validatedSongObjects.RemoveAt(i);
                    overwrittenSongObjects.Remove(so);
                }
                else
                {
                    validatedSongObjects[i] = so.Clone();
                }
            }

            hasValidatedSongObjects = true;
        }
    }
    void StartRealEdit(SongObject eventObject)
    {
        currentEventToCustomise = eventObject;
        originalEvent           = eventObject.Clone();

        eventInputField.text = currentChartEvent != null ? currentChartEvent.eventName : currentEvent.title;

        gameObject.SetActive(true);
    }
Example #5
0
 void AddClone(SongObject songObject)
 {
     songObjects.Add(songObject.Clone());
 }
Example #6
0
 protected BaseAction(SongObject so, TypeTag tag)
 {
     songObject = so.Clone();        // Clone to preserve the state it was added in
     typeTag    = tag;
 }
Example #7
0
 protected BaseAction(SongObject so)
 {
     songObject = so.Clone();        // Clone to preserve the state it was added in
     typeTag    = TypeTag.None;
 }
 private void LateUpdate()
 {
     prevSongObject    = currentSongObject.Clone();
     prevSongObjectRef = currentSongObject;
 }