1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 10:33:22 +08:00

Fix formatting

This commit is contained in:
Marvin Schürz 2024-10-10 15:30:24 +02:00
parent 597396d64a
commit 3fb986e8bb

View File

@ -3,34 +3,34 @@
namespace osu.Game.Screens.Edit.Commands
{
public abstract class PropertyChangeCommand<TTarget, TProperty> : IEditorCommand, IMergeableCommand where TTarget : class
{
protected abstract TProperty ReadValue(TTarget target);
protected abstract void WriteValue(TTarget target, TProperty value);
protected abstract PropertyChangeCommand<TTarget, TProperty> CreateInstance(TTarget target, TProperty value);
public readonly TTarget Target;
public readonly TProperty Value;
protected PropertyChangeCommand(TTarget target, TProperty value)
public abstract class PropertyChangeCommand<TTarget, TProperty> : IEditorCommand, IMergeableCommand where TTarget : class
{
Target = target;
Value = value;
}
protected abstract TProperty ReadValue(TTarget target);
public void Apply() => WriteValue(Target, Value);
protected abstract void WriteValue(TTarget target, TProperty value);
public IEditorCommand CreateUndo() => CreateInstance(Target, Value);
protected abstract PropertyChangeCommand<TTarget, TProperty> CreateInstance(TTarget target, TProperty value);
public IEditorCommand? MergeWith(IEditorCommand previous)
{
if (previous is PropertyChangeCommand<TTarget, TProperty> command && command.Target == Target)
return this;
public readonly TTarget Target;
return null;
public readonly TProperty Value;
protected PropertyChangeCommand(TTarget target, TProperty value)
{
Target = target;
Value = value;
}
public void Apply() => WriteValue(Target, Value);
public IEditorCommand CreateUndo() => CreateInstance(Target, Value);
public IEditorCommand? MergeWith(IEditorCommand previous)
{
if (previous is PropertyChangeCommand<TTarget, TProperty> command && command.Target == Target)
return this;
return null;
}
}
}
}