/// <summary> /// Adds a BeatmapAction to the stack. /// </summary> /// <param name="action">BeatmapAction to add.</param> public static void AddAction(BeatmapAction action) { instance.beatmapActions.RemoveAll(x => !x.Active); instance.beatmapActions.Add(action); instance.beatmapActions = instance.beatmapActions.Distinct().ToList(); Debug.Log($"Action of type {action.GetType().Name} added. ({action.Comment})"); }
private void DoRedo(BeatmapAction action) { BeatmapActionParams param = new BeatmapActionParams(this); action.Redo(param); action.Active = true; nodeEditor.ObjectWasSelected(); }
/// <summary> /// Adds a BeatmapAction to the stack. /// </summary> /// <param name="action">BeatmapAction to add.</param> /// <param name="perform">If true Redo will be triggered immediately. This means you don't need separate logic to perform the action the first time.</param> public static void AddAction(BeatmapAction action, bool perform = false) { instance.beatmapActions.RemoveAll(x => !x.Active); instance.beatmapActions.Add(action); if (perform) { instance.DoRedo(action); } Debug.Log($"Action of type {action.GetType().Name} added. ({action.Comment})"); }
/// <summary> /// Adds a BeatmapAction to the stack. /// </summary> /// <param name="action">BeatmapAction to add.</param> public static void AddAction(BeatmapAction action) { instance.beatmapActions.RemoveWhere(x => !x.Active); if (instance.beatmapActions.Add(action)) { Debug.Log($"Action of type {action.GetType().Name} added. ({action.Comment})"); } else { Debug.LogWarning($"This particular {action.GetType().Name} seems to already exist..."); } }
public void Redo() { BeatmapAction firstNotActive = beatmapActions.FirstOrDefault(x => !x.Active); if (firstNotActive == null) { return; } Debug.Log($"Redid a {firstNotActive.GetType().Name}."); BeatmapActionParams param = new BeatmapActionParams(this); firstNotActive.Redo(param); firstNotActive.Active = true; }
public void Undo() { BeatmapAction lastActive = beatmapActions.LastOrDefault(x => x.Active); if (lastActive == null) { return; } Debug.Log($"Undid a {lastActive.GetType().Name}."); BeatmapActionParams param = new BeatmapActionParams(this); lastActive.Undo(param); lastActive.Active = false; }
public void Redo() { if (!beatmapActions.Any(x => !x.Active)) { return; } BeatmapAction firstNotActive = beatmapActions.Find(x => !x.Active); if (firstNotActive == null) { return; } Debug.Log($"Redid a {firstNotActive?.GetType()?.Name ?? "UNKNOWN"}. ({firstNotActive?.Comment ?? "Unknown comment."})"); DoRedo(firstNotActive); }
public void Redo() { if (!beatmapActions.Any()) { return; } BeatmapAction firstNotActive = beatmapActions.FirstOrDefault(x => !x.Active); if (firstNotActive == null) { return; } Debug.Log($"Redid a {firstNotActive?.GetType()?.Name ?? "UNKNOWN"}. ({firstNotActive?.Comment ?? "Unknown comment."})"); BeatmapActionParams param = new BeatmapActionParams(this); firstNotActive.Redo(param); firstNotActive.Active = true; }
public void Undo() { if (!beatmapActions.Any()) { return; } BeatmapAction lastActive = beatmapActions.LastOrDefault(x => x.Active); if (lastActive == null) { return; } Debug.Log($"Undid a {lastActive?.GetType()?.Name ?? "UNKNOWN"}. ({lastActive?.Comment ?? "Unknown comment."})"); BeatmapActionParams param = new BeatmapActionParams(this); lastActive.Undo(param); lastActive.Active = false; }
/// <summary> /// Adds a BeatmapAction to the stack. /// </summary> /// <param name="action">BeatmapAction to add.</param> public static void AddAction(BeatmapAction action) { instance.beatmapActions.RemoveAll(x => !x.Active); instance.beatmapActions.Add(action); Debug.Log($"Action of type {action.GetType().Name} added."); }