mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Remove more unnecessary changes
This commit is contained in:
parent
54e288f09b
commit
b7721edc80
@ -18,8 +18,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
||||
public HoldNoteMask(DrawableHoldNote hold)
|
||||
: base(hold)
|
||||
{
|
||||
var holdObject = hold.HitObject;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new HoldNoteNoteMask(hold.Head),
|
||||
@ -29,8 +27,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
||||
AccentColour = Color4.Transparent
|
||||
},
|
||||
};
|
||||
|
||||
holdObject.ColumnChanged += _ => Position = hold.Position;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays
|
||||
Masking = true;
|
||||
|
||||
AddInternal(new NotePiece());
|
||||
|
||||
note.HitObject.ColumnChanged += _ => Position = note.Position;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -9,14 +9,9 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
{
|
||||
public class ManiaEditPlayfield : ManiaPlayfield
|
||||
{
|
||||
protected override bool DisplayJudgements => false;
|
||||
|
||||
public ManiaEditPlayfield(List<StageDefinition> stages)
|
||||
: base(stages)
|
||||
{
|
||||
}
|
||||
|
||||
protected override ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction)
|
||||
=> new ManiaEditStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -24,7 +23,5 @@ namespace osu.Game.Rulesets.Mania.Edit
|
||||
};
|
||||
|
||||
protected override Vector2 PlayfieldArea => Vector2.One;
|
||||
|
||||
protected override CursorContainer CreateCursor() => null;
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Edit
|
||||
{
|
||||
public class ManiaEditStage : ManiaStage
|
||||
{
|
||||
public ManiaEditStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction)
|
||||
: base(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +1,14 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Edit.Types;
|
||||
using osu.Game.Rulesets.Mania.Objects.Types;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Objects
|
||||
{
|
||||
public abstract class ManiaHitObject : HitObject, IHasXPosition, IHasEditableColumn
|
||||
public abstract class ManiaHitObject : HitObject, IHasColumn
|
||||
{
|
||||
public event Action<int> ColumnChanged;
|
||||
|
||||
private int column { get; set; }
|
||||
|
||||
public virtual int Column
|
||||
{
|
||||
get => column;
|
||||
set
|
||||
{
|
||||
if (column == value)
|
||||
return;
|
||||
column = value;
|
||||
|
||||
ColumnChanged?.Invoke(value);
|
||||
}
|
||||
}
|
||||
|
||||
public virtual int Layer { get; set; }
|
||||
|
||||
public virtual float X
|
||||
{
|
||||
get => Column;
|
||||
}
|
||||
|
||||
public virtual void OffsetColumn(int offset) => Column += offset;
|
||||
|
||||
public virtual void OffsetLayer(int offset) => Layer += offset;
|
||||
public virtual int Column { get; set; }
|
||||
|
||||
protected override HitWindows CreateHitWindows() => new ManiaHitWindows();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
namespace osu.Game.Rulesets.Mania.Objects.Types
|
||||
{
|
||||
/// <summary>
|
||||
/// A type of hit object which lies in one of a number of predetermined columns.
|
@ -4,25 +4,18 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||
using osu.Game.Rulesets.Mania.Configuration;
|
||||
using osu.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
public class ManiaPlayfield : ManiaScrollingPlayfield
|
||||
{
|
||||
public List<Column> Columns => stages.SelectMany(x => x.Columns).ToList();
|
||||
|
||||
private readonly List<ManiaStage> stages = new List<ManiaStage>();
|
||||
public IReadOnlyList<ManiaStage> Stages => stages;
|
||||
|
||||
protected virtual bool DisplayJudgements => true;
|
||||
|
||||
public ManiaPlayfield(List<StageDefinition> stageDefinitions)
|
||||
{
|
||||
@ -44,8 +37,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
int firstColumnIndex = 0;
|
||||
for (int i = 0; i < stageDefinitions.Count; i++)
|
||||
{
|
||||
var newStage = CreateStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction);
|
||||
newStage.DisplayJudgements = DisplayJudgements;
|
||||
var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction);
|
||||
newStage.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||
|
||||
playfieldGrid.Content[0][i] = newStage;
|
||||
@ -57,11 +49,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
}
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject h)
|
||||
{
|
||||
h.OnJudgement += OnJudgement;
|
||||
getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h);
|
||||
}
|
||||
public override void Add(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h);
|
||||
|
||||
public void Add(BarLine barline) => stages.ForEach(s => s.Add(barline));
|
||||
|
||||
@ -83,16 +71,5 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
{
|
||||
maniaConfig.BindWith(ManiaSetting.ScrollTime, VisibleTimeRange);
|
||||
}
|
||||
|
||||
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||
{
|
||||
if (!judgedObject.DisplayJudgement || !DisplayJudgements)
|
||||
return;
|
||||
|
||||
getStageByColumn(((ManiaHitObject)judgedObject.HitObject).Column).OnJudgement(judgedObject, judgement);
|
||||
}
|
||||
|
||||
protected virtual ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction)
|
||||
=> new ManiaStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction);
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,10 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
/// <summary>
|
||||
/// A collection of <see cref="Column"/>s.
|
||||
/// </summary>
|
||||
public class ManiaStage : ScrollingPlayfield
|
||||
public class ManiaStage : ManiaScrollingPlayfield
|
||||
{
|
||||
public const float HIT_TARGET_POSITION = 50;
|
||||
|
||||
|
||||
public bool DisplayJudgements = true;
|
||||
public IReadOnlyList<Column> Columns => columnFlow.Children;
|
||||
private readonly FillFlowContainer<Column> columnFlow;
|
||||
|
||||
|
@ -24,17 +24,16 @@ namespace osu.Game.Rulesets.Edit
|
||||
{
|
||||
private readonly Ruleset ruleset;
|
||||
|
||||
protected ICompositionTool CurrentTool { get; private set; }
|
||||
public IEnumerable<DrawableHitObject> HitObjects => rulesetContainer.Playfield.AllHitObjects;
|
||||
|
||||
protected ICompositionTool CurrentTool { get; private set; }
|
||||
protected IRulesetConfigManager Config { get; private set; }
|
||||
|
||||
protected RulesetContainer RulesetContainer;
|
||||
private readonly List<Container> layerContainers = new List<Container>();
|
||||
|
||||
public IEnumerable<DrawableHitObject> HitObjects => RulesetContainer.Playfield.AllHitObjects;
|
||||
|
||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
private RulesetContainer rulesetContainer;
|
||||
|
||||
protected HitObjectComposer(Ruleset ruleset)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
@ -49,8 +48,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
try
|
||||
{
|
||||
RulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value);
|
||||
RulesetContainer.Clock = framedClock;
|
||||
rulesetContainer = CreateRulesetContainer(ruleset, beatmap.Value);
|
||||
rulesetContainer.Clock = framedClock;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -65,7 +64,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
};
|
||||
|
||||
var layerAboveRuleset = CreateLayerContainer();
|
||||
layerAboveRuleset.Child = CreateHitObjectMaskLayer();
|
||||
layerAboveRuleset.Child = new HitObjectMaskLayer();
|
||||
|
||||
layerContainers.Add(layerBelowRuleset);
|
||||
layerContainers.Add(layerAboveRuleset);
|
||||
@ -95,7 +94,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
Children = new Drawable[]
|
||||
{
|
||||
layerBelowRuleset,
|
||||
RulesetContainer,
|
||||
rulesetContainer,
|
||||
layerAboveRuleset
|
||||
}
|
||||
}
|
||||
@ -131,14 +130,13 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
layerContainers.ForEach(l =>
|
||||
{
|
||||
l.Anchor = RulesetContainer.Playfield.Anchor;
|
||||
l.Origin = RulesetContainer.Playfield.Origin;
|
||||
l.Position = RulesetContainer.Playfield.Position;
|
||||
l.Size = RulesetContainer.Playfield.Size;
|
||||
l.Anchor = rulesetContainer.Playfield.Anchor;
|
||||
l.Origin = rulesetContainer.Playfield.Origin;
|
||||
l.Position = rulesetContainer.Playfield.Position;
|
||||
l.Size = rulesetContainer.Playfield.Size;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
private void setCompositionTool(ICompositionTool tool) => CurrentTool = tool;
|
||||
|
||||
protected virtual RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => ruleset.CreateRulesetContainerWith(beatmap);
|
||||
@ -157,11 +155,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
public virtual MaskSelection CreateMaskSelection() => new MaskSelection();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="HitObjectMaskLayer"/> depending on the ruleset.
|
||||
/// </summary>
|
||||
protected virtual HitObjectMaskLayer CreateHitObjectMaskLayer() => new HitObjectMaskLayer();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a <see cref="ScalableContainer"/> which provides a layer above or below the <see cref="Playfield"/>.
|
||||
/// </summary>
|
||||
|
@ -33,21 +33,11 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> SelectionRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when this <see cref="HitObjectMask"/> has started drag.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> DragStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when this <see cref="HitObjectMask"/> has requested drag.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> DragRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when this <see cref="HitObjectMask"/> has ended drag.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> DragEnded;
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="DrawableHitObject"/> which this <see cref="HitObjectMask"/> applies to.
|
||||
/// </summary>
|
||||
@ -130,11 +120,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(InputState state)
|
||||
{
|
||||
DragStarted?.Invoke(this, state);
|
||||
return true;
|
||||
}
|
||||
protected override bool OnDragStart(InputState state) => true;
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
@ -142,12 +128,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(InputState state)
|
||||
{
|
||||
DragEnded?.Invoke(this, state);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The screen-space point that causes this <see cref="HitObjectMask"/> to be selected.
|
||||
/// </summary>
|
||||
|
@ -1,8 +1,6 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Tools
|
||||
@ -10,15 +8,10 @@ namespace osu.Game.Rulesets.Edit.Tools
|
||||
public class HitObjectCompositionTool<T> : ICompositionTool
|
||||
where T : HitObject
|
||||
{
|
||||
public string Name { get; } = typeof(T).Name;
|
||||
|
||||
public Func<InputState, MouseDownEventArgs, bool> OnMouseDown;
|
||||
public Func<InputState, MouseDownEventArgs, bool> OnMouseUp;
|
||||
public Func<InputState, MouseDownEventArgs, bool> OnDragStart;
|
||||
public Func<InputState, MouseDownEventArgs, bool> OnDragRequested;
|
||||
public Func<InputState, MouseDownEventArgs, bool> OnDragEnd;
|
||||
public string Name { get; }
|
||||
|
||||
public HitObjectCompositionTool()
|
||||
: this(typeof(T).Name)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
namespace osu.Game.Rulesets.Edit.Types
|
||||
{
|
||||
public interface IHasEditableColumn : IHasColumn
|
||||
{
|
||||
void OffsetColumn(int offset);
|
||||
}
|
||||
}
|
@ -32,9 +32,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
maskContainer.MaskSelected += maskSelection.HandleSelected;
|
||||
maskContainer.MaskDeselected += maskSelection.HandleDeselected;
|
||||
maskContainer.MaskSelectionRequested += maskSelection.HandleSelectionRequested;
|
||||
maskContainer.MaskDragStarted += maskSelection.HandleDragStart;
|
||||
maskContainer.MaskDragRequested += maskSelection.HandleDrag;
|
||||
maskContainer.MaskDragEnded += maskSelection.HandleDragEnd;
|
||||
|
||||
maskSelection.DeselectAll = maskContainer.DeselectAll;
|
||||
|
||||
|
@ -29,21 +29,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> MaskSelectionRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when any <see cref="HitObjectMask"/> starts drag.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> MaskDragStarted;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when any <see cref="HitObjectMask"/> requests drag.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> MaskDragRequested;
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when any <see cref="HitObjectMask"/> ends drag.
|
||||
/// </summary>
|
||||
public event Action<HitObjectMask, InputState> MaskDragEnded;
|
||||
|
||||
private IEnumerable<HitObjectMask> aliveMasks => AliveInternalChildren.Cast<HitObjectMask>();
|
||||
|
||||
public MaskContainer()
|
||||
@ -60,9 +50,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
drawable.Selected += onMaskSelected;
|
||||
drawable.Deselected += onMaskDeselected;
|
||||
drawable.SelectionRequested += onSelectionRequested;
|
||||
drawable.DragStarted += onDragStarted;
|
||||
drawable.DragRequested += onDragRequested;
|
||||
drawable.DragEnded += onDragEnded;
|
||||
}
|
||||
|
||||
public override bool Remove(HitObjectMask drawable)
|
||||
@ -76,9 +64,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
drawable.Selected -= onMaskSelected;
|
||||
drawable.Deselected -= onMaskDeselected;
|
||||
drawable.SelectionRequested -= onSelectionRequested;
|
||||
drawable.DragStarted -= onDragStarted;
|
||||
drawable.DragRequested -= onDragRequested;
|
||||
drawable.DragEnded -= onDragEnded;
|
||||
}
|
||||
|
||||
return result;
|
||||
@ -117,9 +103,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
}
|
||||
|
||||
private void onSelectionRequested(HitObjectMask mask, InputState state) => MaskSelectionRequested?.Invoke(mask, state);
|
||||
private void onDragStarted(HitObjectMask mask, InputState state) => MaskDragStarted?.Invoke(mask, state);
|
||||
private void onDragRequested(HitObjectMask mask, InputState state) => MaskDragRequested?.Invoke(mask, state);
|
||||
private void onDragEnded(HitObjectMask mask, InputState state) => MaskDragEnded?.Invoke(mask, state);
|
||||
|
||||
protected override int Compare(Drawable x, Drawable y)
|
||||
{
|
||||
|
@ -25,7 +25,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
private readonly List<HitObjectMask> selectedMasks;
|
||||
|
||||
private Drawable outline;
|
||||
private Vector2 startingPosition;
|
||||
|
||||
public MaskSelection()
|
||||
{
|
||||
@ -55,7 +54,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
|
||||
#region User Input Handling
|
||||
|
||||
public void HandleDragStart(HitObjectMask m, InputState state) => startingPosition = state.Mouse.Position;
|
||||
public void HandleDrag(HitObjectMask m, InputState state)
|
||||
{
|
||||
// Todo: Various forms of snapping
|
||||
@ -67,17 +65,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
|
||||
case IHasEditablePosition editablePosition:
|
||||
editablePosition.OffsetPosition(state.Mouse.Delta);
|
||||
break;
|
||||
case IHasEditableColumn editableColumn:
|
||||
if (IsDragged)
|
||||
editableColumn.OffsetColumn((int)((startingPosition.X - state.Mouse.Position.X) / m.Width)); // Perform snapping, needs fixing
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
public void HandleDragEnd(HitObjectMask m, InputState state)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user