From d504a44dfb08d78024bbd512695270198d80c3cd Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Sun, 20 May 2018 13:22:42 +0300 Subject: [PATCH 01/43] Implement mask layering (incomplete) --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 50 ++++++++++++++++ .../Overlays/ManiaHitObjectColumnMaskLayer.cs | 29 ++++++++++ .../Overlays/ManiaHitObjectMaskLayer.cs | 28 +++++++++ .../Overlays/ManiaHitObjectStageMaskLayer.cs | 31 ++++++++++ .../Layers/Selection/Overlays/NoteMask.cs | 35 +++++++++++ .../Edit/ManiaHitObjectComposer.cs | 58 +++++++++++++++++++ .../Objects/Drawables/DrawableHoldNote.cs | 26 ++++----- .../Objects/ManiaHitObject.cs | 34 ++++++++++- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 35 +++++++---- .../osu.Game.Rulesets.Mania.csproj | 3 + osu.Game/Rulesets/Edit/HitObjectComposer.cs | 24 +++++--- osu.Game/Rulesets/Edit/HitObjectMask.cs | 22 ++++++- .../Edit/Tools/HitObjectCompositionTool.cs | 16 ++++- .../Rulesets/Edit/Tools/ICompositionTool.cs | 6 ++ .../Rulesets/Edit/Types/IHasEditableColumn.cs | 12 ++++ .../Rulesets/Edit/Types/IHasEditableLayer.cs | 12 ++++ .../Rulesets}/Objects/Types/IHasColumn.cs | 2 +- .../Compose/Layers/HitObjectMaskLayer.cs | 24 +++++--- .../Screens/Compose/Layers/MaskContainer.cs | 16 +++++ .../Screens/Compose/Layers/MaskSelection.cs | 10 ++++ 20 files changed, 426 insertions(+), 47 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs create mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs create mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs rename {osu.Game.Rulesets.Mania => osu.Game/Rulesets}/Objects/Types/IHasColumn.cs (90%) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs new file mode 100644 index 0000000000..3106fedb30 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -0,0 +1,50 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Primitives; +using osu.Game.Graphics; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; +using OpenTK; +using OpenTK.Graphics; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class HoldNoteMask : HitObjectMask + { + private readonly BodyPiece body; + private readonly DrawableHoldNote holdNote; + + public HoldNoteMask(DrawableHoldNote hold) + : base(hold) + { + holdNote = hold; + + Position = hold.Position; + + var holdObject = hold.HitObject; + + InternalChildren = new Drawable[] + { + new NoteMask(hold.Head), + new NoteMask(hold.Tail), + body = new BodyPiece() + { + AccentColour = Color4.Transparent + }, + }; + + holdObject.ColumnChanged += _ => Position = hold.Position; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + body.BorderColour = colours.Yellow; + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs new file mode 100644 index 0000000000..1f8d391c99 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class ManiaHitObjectColumnMaskLayer : HitObjectMaskLayer + { + public readonly Column Column; + + public ManiaHitObjectColumnMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, Column column) + : base(playfield, composer) + { + Column = column; + } + + public void CreateMasks() => AddMasks(); + + protected override void AddMasks() + { + foreach (var obj in Column.HitObjects.Objects) + AddMask(obj); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs new file mode 100644 index 0000000000..012fc495b5 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class ManiaHitObjectMaskLayer : HitObjectMaskLayer + { + public readonly List Stages; + + public ManiaHitObjectMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer) + : base(playfield, composer) + { + Stages = new List(); + foreach (var s in ((ManiaEditPlayfield)Playfield).Stages) + Stages.Add(new ManiaHitObjectStageMaskLayer((ManiaEditPlayfield)Playfield, Composer, s)); + } + + protected override void AddMasks() + { + foreach (var s in Stages) + s.CreateMasks(); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs new file mode 100644 index 0000000000..ae800019c5 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs @@ -0,0 +1,31 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class ManiaHitObjectStageMaskLayer : HitObjectMaskLayer + { + public readonly List Columns; + + public ManiaHitObjectStageMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, ManiaStage s) + : base(playfield, composer) + { + Columns = new List(); + foreach (var c in s.Columns) + Columns.Add(new ManiaHitObjectColumnMaskLayer((ManiaEditPlayfield)Playfield, Composer, c)); + } + + public void CreateMasks() => AddMasks(); + + protected override void AddMasks() + { + foreach (var c in Columns) + c.CreateMasks(); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs new file mode 100644 index 0000000000..8228adf35f --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -0,0 +1,35 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; + +namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays +{ + public class NoteMask : HitObjectMask + { + public NoteMask(DrawableNote note) + : base(note) + { + Origin = Anchor.Centre; + + Position = note.Position; + Size = note.Size; + Scale = note.Scale; + + AddInternal(new NotePiece()); + + note.HitObject.ColumnChanged += _ => Position = note.Position; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Colour = colours.Yellow; + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs new file mode 100644 index 0000000000..3a2c398e84 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -0,0 +1,58 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Graphics; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Edit.Tools; +using osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Mania.Objects.Drawables; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaHitObjectComposer : HitObjectComposer + { + public BindableBeatDivisor BeatDivisor; + public ManiaHitObjectComposer(Ruleset ruleset, BindableBeatDivisor beatDivisor) + : base(ruleset) + { + BeatDivisor = beatDivisor; + } + + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap, BeatDivisor); + + protected override IReadOnlyList CompositionTools => new ICompositionTool[] + { + new HitObjectCompositionTool("Note"), + new HitObjectCompositionTool("Hold"), + }; + + // TODO: According to another proposal, extend this to support multiple layers for mania maps + // The logic could be moving all the layers that the beatmap has simultaneously + // To avoid using too many resources, this could be changed to simply changing the Alpha to something + // between 0.25f to 0.5f for notes that are in other layers (and may be also not selected) + // Will also need a tool to navigate through layers + // Please ignore the comment above, I just wanted to write my thoughts down so that I do not forget in 2 months when I get around to it + + public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) + { + switch (hitObject) + { + case DrawableNote note: + return new NoteMask(note); + case DrawableHoldNote holdNote: + return new HoldNoteMask(holdNote); + } + + return base.CreateMaskFor(hitObject); + } + + protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer((ManiaEditPlayfield)RulesetContainer.Playfield, this); + } +} diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 8791e8ed86..2f2d1abe6b 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -18,8 +18,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables /// public class DrawableHoldNote : DrawableManiaHitObject, IKeyBindingHandler { - private readonly DrawableNote head; - private readonly DrawableNote tail; + public readonly DrawableNote Head; + public readonly DrawableNote Tail; private readonly GlowPiece glowPiece; private readonly BodyPiece bodyPiece; @@ -64,12 +64,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables HoldStartTime = () => holdStartTime }) }, - head = new DrawableHeadNote(this, action) + Head = new DrawableHeadNote(this, action) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre }, - tail = new DrawableTailNote(this, action) + Tail = new DrawableTailNote(this, action) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre @@ -79,8 +79,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables foreach (var tick in tickContainer) AddNested(tick); - AddNested(head); - AddNested(tail); + AddNested(Head); + AddNested(Tail); } public override Color4 AccentColour @@ -92,8 +92,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables glowPiece.AccentColour = value; bodyPiece.AccentColour = value; - head.AccentColour = value; - tail.AccentColour = value; + Head.AccentColour = value; + Tail.AccentColour = value; } } @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override void CheckForJudgements(bool userTriggered, double timeOffset) { - if (tail.AllJudged) + if (Tail.AllJudged) AddJudgement(new HoldNoteJudgement { Result = HitResult.Perfect }); } @@ -119,12 +119,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables base.Update(); // Make the body piece not lie under the head note - bodyPiece.Y = head.Height; - bodyPiece.Height = DrawHeight - head.Height; + bodyPiece.Y = Head.Height; + bodyPiece.Height = DrawHeight - Head.Height; // Make the fullHeightContainer "contain" the height of the tail note, keeping in mind // that the tail note overshoots the height of this hit object - fullHeightContainer.Height = DrawHeight + tail.Height; + fullHeightContainer.Height = DrawHeight + Tail.Height; } public bool OnPressed(ManiaAction action) @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables holdStartTime = null; // If the key has been released too early, the user should not receive full score for the release - if (!tail.IsHit) + if (!Tail.IsHit) hasBroken = true; return true; diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index e183098a51..8b7191c4c4 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -1,14 +1,42 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Game.Rulesets.Mania.Objects.Types; +using osu.Game.Rulesets.Edit.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, IHasColumn + public abstract class ManiaHitObject : HitObject, IHasColumn, IHasLayer, IHasXPosition, IHasEditableColumn, IHasEditableLayer { - public virtual int Column { get; set; } + public event Action 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; protected override HitWindows CreateHitWindows() => new ManiaHitWindows(); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 4b936fc7f9..ae931e2f66 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -1,19 +1,19 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Game.Rulesets.Mania.Objects; 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 osu.Game.Rulesets.UI.Scrolling; using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Configuration; -using osu.Game.Rulesets.Judgements; -using osu.Game.Rulesets.Mania.Beatmaps; -using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.Mania.Configuration; -using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.UI { @@ -25,7 +25,11 @@ namespace osu.Game.Rulesets.Mania.UI public readonly Bindable Inverted = new Bindable(true); public List Columns => stages.SelectMany(x => x.Columns).ToList(); + private readonly List stages = new List(); + public IReadOnlyList Stages => stages; + + protected virtual bool DisplayJudgements => true; public ManiaPlayfield(List stageDefinitions) : base(ScrollingDirection.Up) @@ -50,7 +54,8 @@ namespace osu.Game.Rulesets.Mania.UI int firstColumnIndex = 0; for (int i = 0; i < stageDefinitions.Count; i++) { - var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); + var newStage = CreateStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); + newStage.DisplayJudgements = DisplayJudgements; newStage.VisibleTimeRange.BindTo(VisibleTimeRange); newStage.Inverted.BindTo(Inverted); @@ -63,7 +68,11 @@ namespace osu.Game.Rulesets.Mania.UI } } - public override void Add(DrawableHitObject h) => getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h); + public override void Add(DrawableHitObject h) + { + h.OnJudgement += OnJudgement; + getStageByColumn(((ManiaHitObject)h.HitObject).Column).Add(h); + } public void Add(BarLine barline) => stages.ForEach(s => s.Add(barline)); @@ -88,7 +97,13 @@ namespace osu.Game.Rulesets.Mania.UI 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); } } diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index a086da0565..1d95dbf004 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -10,4 +10,7 @@ + + + \ No newline at end of file diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 5f1b9a6bad..545c152bbd 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Edit protected ICompositionTool CurrentTool { get; private set; } - private RulesetContainer rulesetContainer; + protected RulesetContainer RulesetContainer; private readonly List layerContainers = new List(); private readonly Bindable beatmap = new Bindable(); @@ -44,8 +44,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) { @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Edit }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = new HitObjectMaskLayer(rulesetContainer.Playfield, this); + layerAboveRuleset.Child = CreateHitObjectMaskLayer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Edit Children = new Drawable[] { layerBelowRuleset, - rulesetContainer, + RulesetContainer, layerAboveRuleset } } @@ -116,13 +116,14 @@ 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); @@ -141,6 +142,11 @@ namespace osu.Game.Rulesets.Edit /// public virtual MaskSelection CreateMaskSelection() => new MaskSelection(); + /// + /// Creates a depending on the ruleset. + /// + protected virtual HitObjectMaskLayer CreateHitObjectMaskLayer() => new HitObjectMaskLayer(RulesetContainer.Playfield, this); + /// /// Creates a which provides a layer above or below the . /// diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 61fb700dd3..3caa4d9fbf 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -33,11 +33,21 @@ namespace osu.Game.Rulesets.Edit /// public event Action SelectionRequested; + /// + /// Invoked when this has started drag. + /// + public event Action DragStarted; + /// /// Invoked when this has requested drag. /// public event Action DragRequested; + /// + /// Invoked when this has ended drag. + /// + public event Action DragEnded; + /// /// The which this applies to. /// @@ -120,7 +130,11 @@ namespace osu.Game.Rulesets.Edit return base.OnClick(state); } - protected override bool OnDragStart(InputState state) => true; + protected override bool OnDragStart(InputState state) + { + DragStarted?.Invoke(this, state); + return true; + } protected override bool OnDrag(InputState state) { @@ -128,6 +142,12 @@ namespace osu.Game.Rulesets.Edit return true; } + protected override bool OnDragEnd(InputState state) + { + DragEnded?.Invoke(this, state); + return true; + } + /// /// The screen-space point that causes this to be selected. /// diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 2c3720fc8f..9c3f99127d 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -1,6 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // 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 @@ -8,6 +10,18 @@ namespace osu.Game.Rulesets.Edit.Tools public class HitObjectCompositionTool : ICompositionTool where T : HitObject { - public string Name => typeof(T).Name; + public string Name { get; } = typeof(T).Name; + + public Action OnMouseDown { get; } + public Action OnMouseUp { get; } + + public HitObjectCompositionTool() + { + } + + public HitObjectCompositionTool(string name) + { + Name = name; + } } } diff --git a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs index ce8b139b43..456c7e6fb3 100644 --- a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs @@ -1,10 +1,16 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Input; +using System; + namespace osu.Game.Rulesets.Edit.Tools { public interface ICompositionTool { string Name { get; } + + Action OnMouseDown { get; } + Action OnMouseUp { get; } } } diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs new file mode 100644 index 0000000000..2691223476 --- /dev/null +++ b/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// 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); + } +} diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs new file mode 100644 index 0000000000..3c886caba8 --- /dev/null +++ b/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs @@ -0,0 +1,12 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// 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 IHasEditableLayer : IHasLayer + { + void OffsetLayer(int offset); + } +} diff --git a/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs b/osu.Game/Rulesets/Objects/Types/IHasColumn.cs similarity index 90% rename from osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs rename to osu.Game/Rulesets/Objects/Types/IHasColumn.cs index 44a79de7db..ba9c7ac933 100644 --- a/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs +++ b/osu.Game/Rulesets/Objects/Types/IHasColumn.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -namespace osu.Game.Rulesets.Mania.Objects.Types +namespace osu.Game.Rulesets.Objects.Types { /// /// A type of hit object which lies in one of a number of predetermined columns. diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index b9a8e9914a..5339be7d57 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -14,17 +14,17 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { public class HitObjectMaskLayer : CompositeDrawable { - private readonly Playfield playfield; - private readonly HitObjectComposer composer; + protected readonly Playfield Playfield; + protected readonly HitObjectComposer Composer; private MaskContainer maskContainer; public HitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) { // we need the playfield as HitObjects may not be initialised until its BDL. - this.playfield = playfield; + this.Playfield = playfield; - this.composer = composer; + this.Composer = composer; RelativeSizeAxes = Axes.Both; } @@ -34,12 +34,14 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers { maskContainer = new MaskContainer(); - var maskSelection = composer.CreateMaskSelection(); + var maskSelection = Composer.CreateMaskSelection(); 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; @@ -53,9 +55,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer, dragLayer.CreateProxy() }; + AddMasks(); + } - foreach (var obj in playfield.HitObjects.Objects) - addMask(obj); + protected virtual void AddMasks() + { + foreach (var obj in Playfield.HitObjects.Objects) + AddMask(obj); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -68,9 +74,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. /// /// The to create a mask for. - private void addMask(DrawableHitObject hitObject) + protected void AddMask(DrawableHitObject hitObject) { - var mask = composer.CreateMaskFor(hitObject); + var mask = Composer.CreateMaskFor(hitObject); if (mask == null) return; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index df2691c28e..bce6d876be 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -29,11 +29,21 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// public event Action MaskSelectionRequested; + /// + /// Invoked when any starts drag. + /// + public event Action MaskDragStarted; + /// /// Invoked when any requests drag. /// public event Action MaskDragRequested; + /// + /// Invoked when any ends drag. + /// + public event Action MaskDragEnded; + private IEnumerable aliveMasks => AliveInternalChildren.Cast(); public MaskContainer() @@ -50,7 +60,9 @@ 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) @@ -64,7 +76,9 @@ 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; @@ -103,7 +117,9 @@ 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) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 54697bad77..7cd77eeb1c 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -25,6 +25,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private readonly List selectedMasks; private Drawable outline; + private Vector2 startingPosition; public MaskSelection() { @@ -54,6 +55,7 @@ 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 @@ -65,9 +67,17 @@ 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 From 61a18b952fef7ced177f3928680e24e374f0955b Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Mon, 21 May 2018 23:24:10 +0300 Subject: [PATCH 02/43] Remove useless things --- osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs | 2 +- osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 +++- osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs | 12 ------------ 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 8b7191c4c4..aeb998b694 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -8,7 +8,7 @@ using System; namespace osu.Game.Rulesets.Mania.Objects { - public abstract class ManiaHitObject : HitObject, IHasColumn, IHasLayer, IHasXPosition, IHasEditableColumn, IHasEditableLayer + public abstract class ManiaHitObject : HitObject, IHasColumn, IHasXPosition, IHasEditableColumn { public event Action ColumnChanged; diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 6566d44ef5..233e4420f7 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -8,7 +8,7 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.Mania.UI { - internal class DrawableManiaJudgement : DrawableJudgement + public class DrawableManiaJudgement : DrawableJudgement { public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject) : base(judgement, judgedObject) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 904be3a9e3..53631838ba 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Mania.UI /// /// A collection of s. /// - internal class ManiaStage : ScrollingPlayfield + public class ManiaStage : ScrollingPlayfield { public const float HIT_TARGET_POSITION = 50; @@ -34,6 +34,8 @@ namespace osu.Game.Rulesets.Mania.UI /// public readonly Bindable Inverted = new Bindable(true); + public bool DisplayJudgements = true; + public IReadOnlyList Columns => columnFlow.Children; private readonly FillFlowContainer columnFlow; diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs deleted file mode 100644 index 3c886caba8..0000000000 --- a/osu.Game/Rulesets/Edit/Types/IHasEditableLayer.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// 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 IHasEditableLayer : IHasLayer - { - void OffsetLayer(int offset); - } -} From 44cf2aa7a3bf0667812661992a7e646e67a425a0 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:00:11 +0300 Subject: [PATCH 03/43] Sync changes on composition tools --- osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs | 7 +++++-- osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs | 6 ------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 9c3f99127d..91062a211e 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -12,8 +12,11 @@ namespace osu.Game.Rulesets.Edit.Tools { public string Name { get; } = typeof(T).Name; - public Action OnMouseDown { get; } - public Action OnMouseUp { get; } + public Func OnMouseDown; + public Func OnMouseUp; + public Func OnDragStart; + public Func OnDragRequested; + public Func OnDragEnd; public HitObjectCompositionTool() { diff --git a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs index 456c7e6fb3..ce8b139b43 100644 --- a/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/ICompositionTool.cs @@ -1,16 +1,10 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; -using System; - namespace osu.Game.Rulesets.Edit.Tools { public interface ICompositionTool { string Name { get; } - - Action OnMouseDown { get; } - Action OnMouseUp { get; } } } From bbe7765a95d7a8ece6dedaffc6edeff74ae1696b Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:03:47 +0300 Subject: [PATCH 04/43] Add files to not require dependencies from #2534 --- .../Edit/ManiaEditPlayfield.cs | 29 +++++ .../Edit/ManiaEditRulesetContainer.cs | 102 ++++++++++++++++++ 2 files changed, 131 insertions(+) create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs new file mode 100644 index 0000000000..15ab4be52b --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs @@ -0,0 +1,29 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.UI; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaEditPlayfield : ManiaPlayfield + { + protected override bool DisplayJudgements => false; + + public ManiaEditPlayfield(List stages) + : base(stages) + { + } + + public void Add(EditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Add(editSnapLine)); + public void Remove(DrawableManiaEditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Remove(editSnapLine)); + public void ClearEditSnapLines() => Stages.Cast().ForEach(s => s.ClearEditSnapLines()); + + protected override ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) + => new ManiaEditStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs new file mode 100644 index 0000000000..49c13044e9 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -0,0 +1,102 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Cursor; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Rulesets.Mania.Edit +{ + public class ManiaEditRulesetContainer : ManiaRulesetContainer + { + public BindableBeatDivisor BeatDivisor; + + public List EditSnapLines; + + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) + : base(ruleset, beatmap) + { + BeatDivisor = beatDivisor; + } + + [BackgroundDependencyLoader] + private void load() + { + BeatDivisor.ValueChanged += OnBeatSnapDivisorChange; + OnBeatSnapDivisorChange(BeatDivisor.Value); + } + + public void OnBeatSnapDivisorChange(int newDivisor) + { + generateEditSnapLines(newDivisor); + } + + private void generateEditSnapLines(int newDivisor) + { + // Generate the edit lines + double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; + + var timingPoints = Beatmap.ControlPointInfo.TimingPoints; + EditSnapLines = new List(); + + // Create lines before the beginning of the first timing point + if (timingPoints.Any()) + { + double step = timingPoints[0].BeatLength / newDivisor; + int index = (int)(timingPoints[0].Time / step); + index += newDivisor - index % newDivisor - 1; + for (double t = timingPoints[0].Time - step; t >= 0; t -= step, index--) + { + EditSnapLines.Add(new EditSnapLine + { + StartTime = t, + ControlPoint = timingPoints[0], + BeatDivisor = BeatDivisor, + BeatIndex = index, + }); + } + } + + for (int i = 0; i < timingPoints.Count; i++) + { + TimingControlPoint point = timingPoints[i]; + + // Stop 1ms before the end of the timing point before the next one if any, otherwise stop at the last object's time + double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - 1 : lastObjectTime + point.BeatLength * (int)point.TimeSignature; + + int index = 0; + double step = point.BeatLength / newDivisor; + for (double t = timingPoints[i].Time; t <= endTime; t += step, index++) + { + EditSnapLines.Add(new EditSnapLine + { + StartTime = t, + ControlPoint = point, + BeatDivisor = BeatDivisor, + BeatIndex = index, + }); + } + } + + var editPlayfield = (ManiaEditPlayfield)Playfield; + + editPlayfield.ClearEditSnapLines(); + EditSnapLines.ForEach(editPlayfield.Add); + } + + protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages); + + protected override Vector2 PlayfieldArea => Vector2.One; + + protected override CursorContainer CreateCursor() => null; + } +} From 2769f6c47bd794c5b97f963846d1bdedf9ff729e Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:09:25 +0300 Subject: [PATCH 05/43] Fix issues --- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 5 +---- .../Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs | 1 - osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs | 8 -------- .../Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 4 ++-- 4 files changed, 3 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 3106fedb30..ea28d24752 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -3,13 +3,10 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; -using OpenTK; using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays @@ -32,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { new NoteMask(hold.Head), new NoteMask(hold.Tail), - body = new BodyPiece() + body = new BodyPiece { AccentColour = Color4.Transparent }, diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs index 1f8d391c99..6886ff83f7 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.UI; using osu.Game.Screens.Edit.Screens.Compose.Layers; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 3a2c398e84..f0e0f27818 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Tools; @@ -33,13 +32,6 @@ namespace osu.Game.Rulesets.Mania.Edit new HitObjectCompositionTool("Hold"), }; - // TODO: According to another proposal, extend this to support multiple layers for mania maps - // The logic could be moving all the layers that the beatmap has simultaneously - // To avoid using too many resources, this could be changed to simply changing the Alpha to something - // between 0.25f to 0.5f for notes that are in other layers (and may be also not selected) - // Will also need a tool to navigate through layers - // Please ignore the comment above, I just wanted to write my thoughts down so that I do not forget in 2 months when I get around to it - public override HitObjectMask CreateMaskFor(DrawableHitObject hitObject) { switch (hitObject) diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 5339be7d57..ffef177d00 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -22,9 +22,9 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers public HitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) { // we need the playfield as HitObjects may not be initialised until its BDL. - this.Playfield = playfield; + Playfield = playfield; - this.Composer = composer; + Composer = composer; RelativeSizeAxes = Axes.Both; } From 8aac1f50eea9127de3db49151fbea11dffd9274c Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:12:22 +0300 Subject: [PATCH 06/43] Remove more dependencies --- .../Edit/ManiaEditRulesetContainer.cs | 61 ------------------- .../UI/ManiaRulesetContainer.cs | 2 +- 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index 49c13044e9..442997f1f3 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -5,14 +5,9 @@ using OpenTK; using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; -using osu.Game.Beatmaps.ControlPoints; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.UI; -using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.UI; using osu.Game.Screens.Edit.Screens.Compose; -using System.Collections.Generic; -using System.Linq; namespace osu.Game.Rulesets.Mania.Edit { @@ -20,8 +15,6 @@ namespace osu.Game.Rulesets.Mania.Edit { public BindableBeatDivisor BeatDivisor; - public List EditSnapLines; - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) : base(ruleset, beatmap) { @@ -37,60 +30,6 @@ namespace osu.Game.Rulesets.Mania.Edit public void OnBeatSnapDivisorChange(int newDivisor) { - generateEditSnapLines(newDivisor); - } - - private void generateEditSnapLines(int newDivisor) - { - // Generate the edit lines - double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue; - - var timingPoints = Beatmap.ControlPointInfo.TimingPoints; - EditSnapLines = new List(); - - // Create lines before the beginning of the first timing point - if (timingPoints.Any()) - { - double step = timingPoints[0].BeatLength / newDivisor; - int index = (int)(timingPoints[0].Time / step); - index += newDivisor - index % newDivisor - 1; - for (double t = timingPoints[0].Time - step; t >= 0; t -= step, index--) - { - EditSnapLines.Add(new EditSnapLine - { - StartTime = t, - ControlPoint = timingPoints[0], - BeatDivisor = BeatDivisor, - BeatIndex = index, - }); - } - } - - for (int i = 0; i < timingPoints.Count; i++) - { - TimingControlPoint point = timingPoints[i]; - - // Stop 1ms before the end of the timing point before the next one if any, otherwise stop at the last object's time - double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - 1 : lastObjectTime + point.BeatLength * (int)point.TimeSignature; - - int index = 0; - double step = point.BeatLength / newDivisor; - for (double t = timingPoints[i].Time; t <= endTime; t += step, index++) - { - EditSnapLines.Add(new EditSnapLine - { - StartTime = t, - ControlPoint = point, - BeatDivisor = BeatDivisor, - BeatIndex = index, - }); - } - } - - var editPlayfield = (ManiaEditPlayfield)Playfield; - - editPlayfield.ClearEditSnapLines(); - EditSnapLines.ForEach(editPlayfield.Add); } protected override Playfield CreatePlayfield() => new ManiaEditPlayfield(Beatmap.Stages); diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 7123aab901..6618125176 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI BarLines.ForEach(Playfield.Add); } - protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) + protected override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, From a178c44b60e578cf654d57d2a98361d94d147737 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:12:51 +0300 Subject: [PATCH 07/43] Remove snap line dependencies --- osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs index 15ab4be52b..30ff591359 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs @@ -1,12 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.UI; using System.Collections.Generic; -using System.Linq; namespace osu.Game.Rulesets.Mania.Edit { @@ -19,10 +16,6 @@ namespace osu.Game.Rulesets.Mania.Edit { } - public void Add(EditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Add(editSnapLine)); - public void Remove(DrawableManiaEditSnapLine editSnapLine) => Stages.Cast().ForEach(s => s.Remove(editSnapLine)); - public void ClearEditSnapLines() => Stages.Cast().ForEach(s => s.ClearEditSnapLines()); - protected override ManiaStage CreateStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) => new ManiaEditStage(firstColumnIndex, definition, ref normalColumnStartAction, ref specialColumnStartAction); } From c7dfe88ad2229aaf4bdbaaa3953846489a1d3228 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 22 May 2018 09:18:02 +0300 Subject: [PATCH 08/43] Complete PR's independence --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 3 --- osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs | 16 ++++++++++++++++ .../Objects/ManiaHitObject.cs | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index ea28d24752..0b468515d3 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -14,13 +14,10 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public class HoldNoteMask : HitObjectMask { private readonly BodyPiece body; - private readonly DrawableHoldNote holdNote; public HoldNoteMask(DrawableHoldNote hold) : base(hold) { - holdNote = hold; - Position = hold.Position; var holdObject = hold.HitObject; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs new file mode 100644 index 0000000000..9068725023 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// 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) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index aeb998b694..4d28c39faa 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -8,7 +8,7 @@ using System; namespace osu.Game.Rulesets.Mania.Objects { - public abstract class ManiaHitObject : HitObject, IHasColumn, IHasXPosition, IHasEditableColumn + public abstract class ManiaHitObject : HitObject, IHasXPosition, IHasEditableColumn { public event Action ColumnChanged; From f715734662ee56224ac061790587b18d73aac4a7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 15:57:21 +0900 Subject: [PATCH 09/43] Remove unnecessary csproj edit --- osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj index 1d95dbf004..a086da0565 100644 --- a/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj +++ b/osu.Game.Rulesets.Mania/osu.Game.Rulesets.Mania.csproj @@ -10,7 +10,4 @@ - - - \ No newline at end of file From 279a2844f045e7d699f88148c264d9fd38463709 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 16:08:37 +0900 Subject: [PATCH 10/43] Actually make ManiaHitObjectComposer constructible/testable --- .../TestCaseEditor.cs | 17 +++++++++++++++++ .../Edit/ManiaEditRulesetContainer.cs | 18 +----------------- .../Edit/ManiaHitObjectComposer.cs | 7 ++----- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 4 ++++ 4 files changed, 24 insertions(+), 22 deletions(-) create mode 100644 osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs new file mode 100644 index 0000000000..799bb9efd8 --- /dev/null +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -0,0 +1,17 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Game.Tests.Visual; + +namespace osu.Game.Rulesets.Mania.Tests +{ + [TestFixture] + public class TestCaseEditor : EditorTestCase + { + public TestCaseEditor() + : base(new ManiaRuleset()) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index 442997f1f3..71ec668531 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -2,33 +2,17 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using osu.Framework.Allocation; using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaEditRulesetContainer : ManiaRulesetContainer { - public BindableBeatDivisor BeatDivisor; - - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, BindableBeatDivisor beatDivisor) + public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) - { - BeatDivisor = beatDivisor; - } - - [BackgroundDependencyLoader] - private void load() - { - BeatDivisor.ValueChanged += OnBeatSnapDivisorChange; - OnBeatSnapDivisorChange(BeatDivisor.Value); - } - - public void OnBeatSnapDivisorChange(int newDivisor) { } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index f0e0f27818..d04c70ae16 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose; using osu.Game.Screens.Edit.Screens.Compose.Layers; using System.Collections.Generic; @@ -17,14 +16,12 @@ namespace osu.Game.Rulesets.Mania.Edit { public class ManiaHitObjectComposer : HitObjectComposer { - public BindableBeatDivisor BeatDivisor; - public ManiaHitObjectComposer(Ruleset ruleset, BindableBeatDivisor beatDivisor) + public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { - BeatDivisor = beatDivisor; } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap, BeatDivisor); + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] { diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 02ecb3afda..9d7c37d9e9 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -16,8 +16,10 @@ using osu.Game.Rulesets.Mania.Replays; using osu.Game.Rulesets.Replays.Types; using osu.Game.Beatmaps.Legacy; using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Difficulty; +using osu.Game.Rulesets.Mania.Edit; using osu.Game.Rulesets.Scoring; namespace osu.Game.Rulesets.Mania @@ -28,6 +30,8 @@ namespace osu.Game.Rulesets.Mania public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap); public override PerformanceCalculator CreatePerformanceCalculator(IBeatmap beatmap, Score score) => new ManiaPerformanceCalculator(this, beatmap, score); + public override HitObjectComposer CreateHitObjectComposer() => new ManiaHitObjectComposer(this); + public override IEnumerable ConvertLegacyMods(LegacyMods mods) { if (mods.HasFlag(LegacyMods.Nightcore)) From d1b469c1a3b3737e02086a85b4bcd6dfeffb9700 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 16:27:49 +0900 Subject: [PATCH 11/43] Better handling of nested playfields' hitobjects --- .../Overlays/ManiaHitObjectColumnMaskLayer.cs | 28 ----------------- .../Overlays/ManiaHitObjectMaskLayer.cs | 28 ----------------- .../Overlays/ManiaHitObjectStageMaskLayer.cs | 31 ------------------- .../Edit/ManiaHitObjectComposer.cs | 3 -- .../Compose/Layers/HitObjectMaskLayer.cs | 15 ++++++--- 5 files changed, 10 insertions(+), 95 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs deleted file mode 100644 index 6886ff83f7..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectColumnMaskLayer.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mania.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; - -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays -{ - public class ManiaHitObjectColumnMaskLayer : HitObjectMaskLayer - { - public readonly Column Column; - - public ManiaHitObjectColumnMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, Column column) - : base(playfield, composer) - { - Column = column; - } - - public void CreateMasks() => AddMasks(); - - protected override void AddMasks() - { - foreach (var obj in Column.HitObjects.Objects) - AddMask(obj); - } - } -} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs deleted file mode 100644 index 012fc495b5..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectMaskLayer.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Edit; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using System.Collections.Generic; - -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays -{ - public class ManiaHitObjectMaskLayer : HitObjectMaskLayer - { - public readonly List Stages; - - public ManiaHitObjectMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer) - : base(playfield, composer) - { - Stages = new List(); - foreach (var s in ((ManiaEditPlayfield)Playfield).Stages) - Stages.Add(new ManiaHitObjectStageMaskLayer((ManiaEditPlayfield)Playfield, Composer, s)); - } - - protected override void AddMasks() - { - foreach (var s in Stages) - s.CreateMasks(); - } - } -} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs deleted file mode 100644 index ae800019c5..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/ManiaHitObjectStageMaskLayer.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Edit; -using osu.Game.Rulesets.Mania.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using System.Collections.Generic; - -namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays -{ - public class ManiaHitObjectStageMaskLayer : HitObjectMaskLayer - { - public readonly List Columns; - - public ManiaHitObjectStageMaskLayer(ManiaEditPlayfield playfield, HitObjectComposer composer, ManiaStage s) - : base(playfield, composer) - { - Columns = new List(); - foreach (var c in s.Columns) - Columns.Add(new ManiaHitObjectColumnMaskLayer((ManiaEditPlayfield)Playfield, Composer, c)); - } - - public void CreateMasks() => AddMasks(); - - protected override void AddMasks() - { - foreach (var c in Columns) - c.CreateMasks(); - } - } -} diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index d04c70ae16..b1968d0aff 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -9,7 +9,6 @@ using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; -using osu.Game.Screens.Edit.Screens.Compose.Layers; using System.Collections.Generic; namespace osu.Game.Rulesets.Mania.Edit @@ -41,7 +40,5 @@ namespace osu.Game.Rulesets.Mania.Edit return base.CreateMaskFor(hitObject); } - - protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer((ManiaEditPlayfield)RulesetContainer.Playfield, this); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index ffef177d00..9444e07f85 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -55,13 +55,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer, dragLayer.CreateProxy() }; - AddMasks(); + + addMasks(Playfield); } - protected virtual void AddMasks() + private void addMasks(Playfield playfield) { - foreach (var obj in Playfield.HitObjects.Objects) - AddMask(obj); + foreach (var obj in playfield.HitObjects.Objects) + addMask(obj); + + if (playfield.NestedPlayfields != null) + foreach (var p in playfield.NestedPlayfields) + addMasks(p); } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) @@ -74,7 +79,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// Adds a mask for a which adds movement support. /// /// The to create a mask for. - protected void AddMask(DrawableHitObject hitObject) + private void addMask(DrawableHitObject hitObject) { var mask = Composer.CreateMaskFor(hitObject); if (mask == null) From cd532cde2d7852d94d8969dbed881c115baec6ae Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 18:28:49 +0900 Subject: [PATCH 12/43] Fix note masks not working --- .../Edit/Layers/Selection/Overlays/NoteMask.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index 8228adf35f..9f34bb4fa4 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Graphics; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; @@ -15,10 +14,6 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public NoteMask(DrawableNote note) : base(note) { - Origin = Anchor.Centre; - - Position = note.Position; - Size = note.Size; Scale = note.Scale; AddInternal(new NotePiece()); @@ -31,5 +26,13 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { Colour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + Size = HitObject.DrawSize; + Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.BottomLeft); + } } } From f299ae0fbd18541f0078bc7cfac9fc45866c8988 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 18:59:52 +0900 Subject: [PATCH 13/43] Fix positioning --- .../Edit/Layers/ManiaHitObjectMaskLayer.cs | 27 +++++++++++++++++++ .../Layers/Selection/Overlays/NoteMask.cs | 3 ++- .../Edit/ManiaHitObjectComposer.cs | 11 ++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs new file mode 100644 index 0000000000..2bf9cbe6e0 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; +using OpenTK; + +namespace osu.Game.Rulesets.Mania.Edit.Layers +{ + public class ManiaHitObjectMaskLayer : HitObjectMaskLayer + { + public readonly IBindable Inverted = new Bindable(); + + public ManiaHitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) + : base(playfield, composer) + { + Inverted.ValueChanged += invertedChanged; + } + + private void invertedChanged(bool newValue) + { + Scale = new Vector2(1, newValue ? -1 : 1); + } + } +} diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index 9f34bb4fa4..d61ef114c5 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; @@ -32,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays base.Update(); Size = HitObject.DrawSize; - Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.BottomLeft); + Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); } } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index b1968d0aff..225f04479d 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -10,6 +10,9 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using System.Collections.Generic; +using osu.Game.Rulesets.Mania.Edit.Layers; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Screens.Edit.Screens.Compose.Layers; namespace osu.Game.Rulesets.Mania.Edit { @@ -40,5 +43,13 @@ namespace osu.Game.Rulesets.Mania.Edit return base.CreateMaskFor(hitObject); } + + protected override HitObjectMaskLayer CreateHitObjectMaskLayer() + { + var layer = new ManiaHitObjectMaskLayer(RulesetContainer.Playfield, this); + layer.Inverted.BindTo(((ManiaPlayfield)RulesetContainer.Playfield).Inverted); + + return layer; + } } } From 24b314b51f9c5c28be61b09fa6f56558c03c8100 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 19:00:02 +0900 Subject: [PATCH 14/43] Fix hold note masks not working --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 0b468515d3..648ec29e64 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -18,14 +18,12 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays public HoldNoteMask(DrawableHoldNote hold) : base(hold) { - Position = hold.Position; - var holdObject = hold.HitObject; InternalChildren = new Drawable[] { - new NoteMask(hold.Head), - new NoteMask(hold.Tail), + new HoldNoteNoteMask(hold.Head), + new HoldNoteNoteMask(hold.Tail), body = new BodyPiece { AccentColour = Color4.Transparent @@ -40,5 +38,29 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { body.BorderColour = colours.Yellow; } + + protected override void Update() + { + base.Update(); + + Size = HitObject.DrawSize; + Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); + } + + private class HoldNoteNoteMask : NoteMask + { + public HoldNoteNoteMask(DrawableNote note) + : base(note) + { + Select(); + } + + protected override void Update() + { + base.Update(); + + Position = HitObject.DrawPosition; + } + } } } From ce7a5e8914af475684e95d6420d6aa2ff8ff7055 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 7 Jun 2018 19:19:32 +0900 Subject: [PATCH 15/43] Update visual style to match new notes --- .../Edit/Layers/Selection/Overlays/NoteMask.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index d61ef114c5..8c46e20835 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; @@ -17,6 +16,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { Scale = note.Scale; + CornerRadius = 5; + Masking = true; + AddInternal(new NotePiece()); note.HitObject.ColumnChanged += _ => Position = note.Position; From 0b66f63f7d436f518abbf0fe1c1b40546e492fdd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:35:32 +0900 Subject: [PATCH 16/43] Invert flow order of hitobjects between composer and mask layers --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 12 +++++++++++- .../Compose/Layers/HitObjectMaskLayer.cs | 18 ++++++------------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 0c91c9f548..1c55f0a09f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -28,6 +28,9 @@ namespace osu.Game.Rulesets.Edit private RulesetContainer rulesetContainer; private readonly List layerContainers = new List(); + public IEnumerable HitObjects => rulesetContainer.Playfield.HitObjects.Objects; + public IEnumerable AliveHitObjects => rulesetContainer.Playfield.HitObjects.AliveObjects; + private readonly IBindable beatmap = new Bindable(); protected HitObjectComposer(Ruleset ruleset) @@ -60,7 +63,7 @@ namespace osu.Game.Rulesets.Edit }; var layerAboveRuleset = CreateLayerContainer(); - layerAboveRuleset.Child = new HitObjectMaskLayer(rulesetContainer.Playfield, this); + layerAboveRuleset.Child = new HitObjectMaskLayer(); layerContainers.Add(layerBelowRuleset); layerContainers.Add(layerAboveRuleset); @@ -110,6 +113,13 @@ namespace osu.Game.Rulesets.Edit toolboxCollection.Items[0].Select(); } + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(this); + return dependencies; + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index b9a8e9914a..9e5b7300ab 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -8,30 +8,24 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; -using osu.Game.Rulesets.UI; namespace osu.Game.Screens.Edit.Screens.Compose.Layers { public class HitObjectMaskLayer : CompositeDrawable { - private readonly Playfield playfield; - private readonly HitObjectComposer composer; - private MaskContainer maskContainer; + private HitObjectComposer composer; - public HitObjectMaskLayer(Playfield playfield, HitObjectComposer composer) + public HitObjectMaskLayer() { - // we need the playfield as HitObjects may not be initialised until its BDL. - this.playfield = playfield; - - this.composer = composer; - RelativeSizeAxes = Axes.Both; } [BackgroundDependencyLoader] - private void load() + private void load(HitObjectComposer composer) { + this.composer = composer; + maskContainer = new MaskContainer(); var maskSelection = composer.CreateMaskSelection(); @@ -54,7 +48,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers dragLayer.CreateProxy() }; - foreach (var obj in playfield.HitObjects.Objects) + foreach (var obj in composer.HitObjects) addMask(obj); } From 48190e3b5a055e7e0c17176d92171430b36349ef Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:48:51 +0900 Subject: [PATCH 17/43] Make NestedPlayfields non-null --- osu.Game/Rulesets/UI/Playfield.cs | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index f2c9b49900..43999e3d29 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -1,10 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; +using osu.Framework.Extensions.IEnumerableExtensions; namespace osu.Game.Rulesets.UI { @@ -15,11 +18,8 @@ namespace osu.Game.Rulesets.UI /// public HitObjectContainer HitObjects { get; private set; } - /// - /// All the s nested inside this playfield. - /// - public IReadOnlyList NestedPlayfields => nestedPlayfields; - private List nestedPlayfields; + private readonly Lazy> nestedPlayfields = new Lazy>(); + public IEnumerable NestedPlayfields => nestedPlayfields.IsValueCreated ? nestedPlayfields.Value : Enumerable.Empty(); /// /// A container for keeping track of DrawableHitObjects. @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.UI /// /// Performs post-processing tasks (if any) after all DrawableHitObjects are loaded into this Playfield. /// - public virtual void PostProcess() => nestedPlayfields?.ForEach(p => p.PostProcess()); + public virtual void PostProcess() => NestedPlayfields.ForEach(p => p.PostProcess()); /// /// Adds a DrawableHitObject to this Playfield. @@ -67,13 +67,7 @@ namespace osu.Game.Rulesets.UI /// This does not add the to the draw hierarchy. /// /// The to add. - protected void AddNested(Playfield otherPlayfield) - { - if (nestedPlayfields == null) - nestedPlayfields = new List(); - - nestedPlayfields.Add(otherPlayfield); - } + protected void AddNested(Playfield otherPlayfield) => nestedPlayfields.Value.Add(otherPlayfield); /// /// Creates the container that will be used to contain the s. From 3905a9105c5bc1e563bd2a02704ee47015cc6914 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:51:10 +0900 Subject: [PATCH 18/43] Add a playfield method to retrieve all hitobjects --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 3 +-- osu.Game/Rulesets/UI/Playfield.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 1c55f0a09f..8b199c7e02 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -28,8 +28,7 @@ namespace osu.Game.Rulesets.Edit private RulesetContainer rulesetContainer; private readonly List layerContainers = new List(); - public IEnumerable HitObjects => rulesetContainer.Playfield.HitObjects.Objects; - public IEnumerable AliveHitObjects => rulesetContainer.Playfield.HitObjects.AliveObjects; + public IEnumerable HitObjects => rulesetContainer.Playfield.AllHitObjects; private readonly IBindable beatmap = new Bindable(); diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 43999e3d29..7a7360afe2 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -14,13 +14,22 @@ namespace osu.Game.Rulesets.UI public abstract class Playfield : ScalableContainer { /// - /// The HitObjects contained in this Playfield. + /// The contained in this Playfield. /// public HitObjectContainer HitObjects { get; private set; } - private readonly Lazy> nestedPlayfields = new Lazy>(); + /// + /// All the s contained in this and all . + /// + public IEnumerable AllHitObjects => HitObjects?.Objects.Concat(NestedPlayfields.SelectMany(p => p.AllHitObjects)) ?? Enumerable.Empty(); + + /// + /// All s nested inside this . + /// public IEnumerable NestedPlayfields => nestedPlayfields.IsValueCreated ? nestedPlayfields.Value : Enumerable.Empty(); + private readonly Lazy> nestedPlayfields = new Lazy>(); + /// /// A container for keeping track of DrawableHitObjects. /// From 48c1561676540486e59e03cfd6c4cb0f10445bcb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:01:14 +0900 Subject: [PATCH 19/43] Remove now unnecessary mask layer --- .../Edit/Layers/ManiaHitObjectMaskLayer.cs | 24 ------------------- 1 file changed, 24 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs b/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs deleted file mode 100644 index a2df612d79..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/Layers/ManiaHitObjectMaskLayer.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Configuration; -using osu.Game.Screens.Edit.Screens.Compose.Layers; -using OpenTK; - -namespace osu.Game.Rulesets.Mania.Edit.Layers -{ - public class ManiaHitObjectMaskLayer : HitObjectMaskLayer - { - public readonly IBindable Inverted = new Bindable(); - - public ManiaHitObjectMaskLayer() - { - Inverted.ValueChanged += invertedChanged; - } - - private void invertedChanged(bool newValue) - { - Scale = new Vector2(1, newValue ? -1 : 1); - } - } -} From c51fe6a119c60414a994a4848ebe58fa1d1153c3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:01:47 +0900 Subject: [PATCH 20/43] Remove more unused stuff --- .../Edit/ManiaHitObjectComposer.cs | 4 ---- .../Screens/Compose/Layers/HitObjectMaskLayer.cs | 14 -------------- 2 files changed, 18 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 03553480d9..b1968d0aff 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -10,8 +10,6 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using System.Collections.Generic; -using osu.Game.Rulesets.Mania.Edit.Layers; -using osu.Game.Screens.Edit.Screens.Compose.Layers; namespace osu.Game.Rulesets.Mania.Edit { @@ -42,7 +40,5 @@ namespace osu.Game.Rulesets.Mania.Edit return base.CreateMaskFor(hitObject); } - - protected override HitObjectMaskLayer CreateHitObjectMaskLayer() => new ManiaHitObjectMaskLayer(); } } diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index 6d73c03cad..db4ea05e59 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -72,18 +71,5 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers maskContainer.Add(mask); } - - /// - /// Removes the mask for a . - /// - /// The to remove the mask for. - private void removeMask(DrawableHitObject hitObject) - { - var mask = maskContainer.FirstOrDefault(h => h.HitObject == hitObject); - if (mask == null) - return; - - maskContainer.Remove(mask); - } } } From 9b7d01397b7f8aedeadc1866c55d6a261211df19 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:53:32 +0900 Subject: [PATCH 21/43] Add ruleset config to HitObjectComposer --- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 18a84ccee0..2301620116 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Logging; using osu.Framework.Timing; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Edit.Tools; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; @@ -25,6 +26,8 @@ namespace osu.Game.Rulesets.Edit protected ICompositionTool CurrentTool { get; private set; } + protected IRulesetConfigManager Config { get; private set; } + protected RulesetContainer RulesetContainer; private readonly List layerContainers = new List(); @@ -115,7 +118,10 @@ namespace osu.Game.Rulesets.Edit protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(this); + Config = dependencies.Get().GetConfigFor(ruleset); + return dependencies; } From 54e288f09b8953514b5d28dae5e3d2b4777ff7a8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 16:55:50 +0900 Subject: [PATCH 22/43] Correctly give note masks a scrolling info --- .../Edit/ManiaHitObjectComposer.cs | 12 ++++++++++ .../UI/ManiaRulesetContainer.cs | 19 ++++----------- .../UI/ManiaScrollingInfo.cs | 23 +++++++++++++++++++ 3 files changed, 40 insertions(+), 14 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index b1968d0aff..f37d8134ce 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -10,16 +10,28 @@ using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Edit { public class ManiaHitObjectComposer : HitObjectComposer { + protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config; + public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) { } + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.CacheAs(new ManiaScrollingInfo(Config)); + return dependencies; + } + protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) => new ManiaEditRulesetContainer(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new ICompositionTool[] diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 810a6fad9b..09ebde2799 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input; @@ -35,9 +34,7 @@ namespace osu.Game.Rulesets.Mania.UI public IEnumerable BarLines; - private readonly Bindable configDirection = new Bindable(); - private ManiaScrollingInfo scrollingInfo; - protected IScrollingInfo ScrollingInfo => scrollingInfo; + protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config; public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) @@ -74,9 +71,6 @@ namespace osu.Game.Rulesets.Mania.UI private void load() { BarLines.ForEach(Playfield.Add); - - ((ManiaConfigManager)Config).BindWith(ManiaSetting.ScrollDirection, configDirection); - configDirection.BindValueChanged(d => scrollingInfo.Direction.Value = (ScrollingDirection)d, true); } private DependencyContainer dependencies; @@ -84,7 +78,10 @@ namespace osu.Game.Rulesets.Mania.UI protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - dependencies.CacheAs(scrollingInfo = new ManiaScrollingInfo()); + + if (dependencies.Get() == null) + dependencies.CacheAs(new ManiaScrollingInfo(Config)); + return dependencies; } @@ -116,11 +113,5 @@ namespace osu.Game.Rulesets.Mania.UI protected override Vector2 PlayfieldArea => new Vector2(1, 0.8f); protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new ManiaFramedReplayInputHandler(replay); - - private class ManiaScrollingInfo : IScrollingInfo - { - public readonly Bindable Direction = new Bindable(); - IBindable IScrollingInfo.Direction => Direction; - } } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs new file mode 100644 index 0000000000..a1cc7cfbc7 --- /dev/null +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingInfo.cs @@ -0,0 +1,23 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.UI.Scrolling; + +namespace osu.Game.Rulesets.Mania.UI +{ + public class ManiaScrollingInfo : IScrollingInfo + { + private readonly Bindable configDirection = new Bindable(); + + public readonly Bindable Direction = new Bindable(); + IBindable IScrollingInfo.Direction => Direction; + + public ManiaScrollingInfo(ManiaConfigManager config) + { + config.BindWith(ManiaSetting.ScrollDirection, configDirection); + configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v); + } + } +} From b7721edc80d1620b49be12956bfcc767aaf61403 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Jul 2018 17:04:51 +0900 Subject: [PATCH 23/43] Remove more unnecessary changes --- .../Layers/Selection/Overlays/HoldNoteMask.cs | 4 --- .../Layers/Selection/Overlays/NoteMask.cs | 2 -- .../Edit/ManiaEditPlayfield.cs | 5 --- .../Edit/ManiaEditRulesetContainer.cs | 3 -- .../Edit/ManiaEditStage.cs | 16 --------- .../Objects/ManiaHitObject.cs | 34 ++----------------- .../Objects/Types/IHasColumn.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 27 ++------------- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 4 +-- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 31 +++++++---------- osu.Game/Rulesets/Edit/HitObjectMask.cs | 22 +----------- .../Edit/Tools/HitObjectCompositionTool.cs | 11 ++---- .../Rulesets/Edit/Types/IHasEditableColumn.cs | 12 ------- .../Compose/Layers/HitObjectMaskLayer.cs | 2 -- .../Screens/Compose/Layers/MaskContainer.cs | 16 --------- .../Screens/Compose/Layers/MaskSelection.cs | 10 ------ 16 files changed, 22 insertions(+), 179 deletions(-) delete mode 100644 osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs rename {osu.Game/Rulesets => osu.Game.Rulesets.Mania}/Objects/Types/IHasColumn.cs (90%) delete mode 100644 osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 648ec29e64..d0faea564c 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -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] diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs index 8c46e20835..78f876cb14 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/NoteMask.cs @@ -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] diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs index 30ff591359..e7bc526471 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditPlayfield.cs @@ -9,14 +9,9 @@ namespace osu.Game.Rulesets.Mania.Edit { public class ManiaEditPlayfield : ManiaPlayfield { - protected override bool DisplayJudgements => false; - public ManiaEditPlayfield(List 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); } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs index fa33f41de3..a01947a60b 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs @@ -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; } } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs b/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs deleted file mode 100644 index 9068725023..0000000000 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditStage.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// 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) - { - } - } -} diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 4d28c39faa..e183098a51 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -1,42 +1,14 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // 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 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(); } diff --git a/osu.Game/Rulesets/Objects/Types/IHasColumn.cs b/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs similarity index 90% rename from osu.Game/Rulesets/Objects/Types/IHasColumn.cs rename to osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs index ba9c7ac933..44a79de7db 100644 --- a/osu.Game/Rulesets/Objects/Types/IHasColumn.cs +++ b/osu.Game.Rulesets.Mania/Objects/Types/IHasColumn.cs @@ -1,7 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // 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 { /// /// A type of hit object which lies in one of a number of predetermined columns. diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index b3d11307a7..57a00f3820 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -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 Columns => stages.SelectMany(x => x.Columns).ToList(); - private readonly List stages = new List(); - public IReadOnlyList Stages => stages; - - protected virtual bool DisplayJudgements => true; public ManiaPlayfield(List 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); } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 867eb1214b..b22217b73a 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -23,12 +23,10 @@ namespace osu.Game.Rulesets.Mania.UI /// /// A collection of s. /// - public class ManiaStage : ScrollingPlayfield + public class ManiaStage : ManiaScrollingPlayfield { public const float HIT_TARGET_POSITION = 50; - - public bool DisplayJudgements = true; public IReadOnlyList Columns => columnFlow.Children; private readonly FillFlowContainer columnFlow; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 2301620116..a36f703fe6 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -24,17 +24,16 @@ namespace osu.Game.Rulesets.Edit { private readonly Ruleset ruleset; - protected ICompositionTool CurrentTool { get; private set; } + public IEnumerable HitObjects => rulesetContainer.Playfield.AllHitObjects; + protected ICompositionTool CurrentTool { get; private set; } protected IRulesetConfigManager Config { get; private set; } - protected RulesetContainer RulesetContainer; private readonly List layerContainers = new List(); - - public IEnumerable HitObjects => RulesetContainer.Playfield.AllHitObjects; - private readonly IBindable beatmap = new Bindable(); + 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 /// public virtual MaskSelection CreateMaskSelection() => new MaskSelection(); - /// - /// Creates a depending on the ruleset. - /// - protected virtual HitObjectMaskLayer CreateHitObjectMaskLayer() => new HitObjectMaskLayer(); - /// /// Creates a which provides a layer above or below the . /// diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 3caa4d9fbf..61fb700dd3 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -33,21 +33,11 @@ namespace osu.Game.Rulesets.Edit /// public event Action SelectionRequested; - /// - /// Invoked when this has started drag. - /// - public event Action DragStarted; - /// /// Invoked when this has requested drag. /// public event Action DragRequested; - /// - /// Invoked when this has ended drag. - /// - public event Action DragEnded; - /// /// The which this applies to. /// @@ -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; - } - /// /// The screen-space point that causes this to be selected. /// diff --git a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs index 91062a211e..78ad236e74 100644 --- a/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs +++ b/osu.Game/Rulesets/Edit/Tools/HitObjectCompositionTool.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // 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 : ICompositionTool where T : HitObject { - public string Name { get; } = typeof(T).Name; - - public Func OnMouseDown; - public Func OnMouseUp; - public Func OnDragStart; - public Func OnDragRequested; - public Func OnDragEnd; + public string Name { get; } public HitObjectCompositionTool() + : this(typeof(T).Name) { } diff --git a/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs b/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs deleted file mode 100644 index 2691223476..0000000000 --- a/osu.Game/Rulesets/Edit/Types/IHasEditableColumn.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// 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); - } -} diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index db4ea05e59..41987a6bf9 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -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; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index bce6d876be..df2691c28e 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -29,21 +29,11 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers /// public event Action MaskSelectionRequested; - /// - /// Invoked when any starts drag. - /// - public event Action MaskDragStarted; - /// /// Invoked when any requests drag. /// public event Action MaskDragRequested; - /// - /// Invoked when any ends drag. - /// - public event Action MaskDragEnded; - private IEnumerable aliveMasks => AliveInternalChildren.Cast(); 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) { diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 7cd77eeb1c..54697bad77 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -25,7 +25,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers private readonly List 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 From be297ddf76b51cfa108f2d30e7d9563575dc105a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Jul 2018 19:30:20 +0900 Subject: [PATCH 24/43] Fix direction reversal not quite working correctly --- .../TestCaseEditor.cs | 15 ++++++++++++ .../Layers/Selection/Overlays/HoldNoteMask.cs | 23 +++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs index 799bb9efd8..6c0f931cda 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -2,6 +2,10 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Game.Rulesets.Mania.Configuration; +using osu.Game.Rulesets.Mania.UI; using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Mania.Tests @@ -9,9 +13,20 @@ namespace osu.Game.Rulesets.Mania.Tests [TestFixture] public class TestCaseEditor : EditorTestCase { + private readonly Bindable direction = new Bindable(); + public TestCaseEditor() : base(new ManiaRuleset()) { + AddStep("upwards scroll", () => direction.Value = ManiaScrollingDirection.Up); + AddStep("downwards scroll", () => direction.Value = ManiaScrollingDirection.Down); + } + + [BackgroundDependencyLoader] + private void load(RulesetConfigCache configCache) + { + var config = (ManiaConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); + config.BindWith(ManiaSetting.ScrollDirection, direction); } } } diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index d0faea564c..745ce25a3e 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -2,17 +2,25 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Mania.UI; +using osu.Game.Rulesets.UI.Scrolling; +using OpenTK; using OpenTK.Graphics; namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { public class HoldNoteMask : HitObjectMask { + public new DrawableHoldNote HitObject => (DrawableHoldNote)base.HitObject; + + private readonly IBindable direction = new Bindable(); + private readonly BodyPiece body; public HoldNoteMask(DrawableHoldNote hold) @@ -30,17 +38,25 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, IScrollingInfo scrollingInfo) { body.BorderColour = colours.Yellow; + + direction.BindTo(scrollingInfo.Direction); } protected override void Update() { base.Update(); - Size = HitObject.DrawSize; + Size = HitObject.DrawSize + new Vector2(0, HitObject.Tail.DrawHeight); Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); + + // This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do + // When scrolling upwards our origin is at the top of the head note (which is where the origin already is), + // but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note) + if (direction.Value == ScrollingDirection.Down) + Y -= HitObject.Tail.DrawHeight; } private class HoldNoteNoteMask : NoteMask @@ -55,6 +71,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays { base.Update(); + Anchor = HitObject.Anchor; + Origin = HitObject.Origin; + Position = HitObject.DrawPosition; } } From c3c270621bf93b0916f871a18376df62af8e0932 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 19 Jul 2018 19:32:47 +0900 Subject: [PATCH 25/43] Fix hold note note masks blocking mouse input --- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 745ce25a3e..4b13bce39d 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -76,6 +76,9 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Position = HitObject.DrawPosition; } + + // Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input. + public override bool HandleMouseInput => false; } } } From 824c217a0d837a75e6b01987bbe0578f93bd4918 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Thu, 19 Jul 2018 19:44:06 +0900 Subject: [PATCH 26/43] Adjust comment --- .../Edit/Layers/Selection/Overlays/HoldNoteMask.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs index 4b13bce39d..bfa6bc0a17 100644 --- a/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs +++ b/osu.Game.Rulesets.Mania/Edit/Layers/Selection/Overlays/HoldNoteMask.cs @@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Layers.Selection.Overlays Position = Parent.ToLocalSpace(HitObject.ScreenSpaceDrawQuad.TopLeft); // This is a side-effect of not matching the hitobject's anchors/origins, which is kinda hard to do - // When scrolling upwards our origin is at the top of the head note (which is where the origin already is), + // When scrolling upwards our origin is already at the top of the head note (which is the intended location), // but when scrolling downwards our origin is at the _bottom_ of the tail note (where we need to be at the _top_ of the tail note) if (direction.Value == ScrollingDirection.Down) Y -= HitObject.Tail.DrawHeight; From 3c06655672ca01929f224c5e286c2f5104dae989 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 18:00:42 +0900 Subject: [PATCH 27/43] Split out Special mods into Automation and Conversion --- osu.Game.Rulesets.Catch/CatchRuleset.cs | 6 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 6 +- osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs | 1 + .../Mods/ManiaModDualStages.cs | 1 + .../Mods/ManiaModMirror.cs | 2 +- .../Mods/ManiaModRandom.cs | 1 + osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs | 1 + osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs | 1 + osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs | 1 + osu.Game.Rulesets.Osu/OsuRuleset.cs | 12 +- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 6 +- osu.Game.Tests/Visual/TestCaseMods.cs | 9 +- osu.Game/Overlays/Mods/ModSection.cs | 13 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 264 +++++++++--------- .../AutomationSection.cs} | 12 +- .../Mods/Sections/ConversionSection.cs | 27 ++ .../DifficultyIncreaseSection.cs | 4 +- .../DifficultyReductionSection.cs | 4 +- osu.Game/Overlays/Mods/Sections/FunSection.cs | 27 ++ osu.Game/Rulesets/Mods/Mod.cs | 2 +- osu.Game/Rulesets/Mods/ModAutoplay.cs | 1 + osu.Game/Rulesets/Mods/ModRelax.cs | 1 + osu.Game/Rulesets/Mods/ModType.cs | 4 +- osu.Game/Rulesets/UI/ModIcon.cs | 15 +- 24 files changed, 250 insertions(+), 171 deletions(-) rename osu.Game/Overlays/Mods/{SpecialSection.cs => Sections/AutomationSection.cs} (71%) create mode 100644 osu.Game/Overlays/Mods/Sections/ConversionSection.cs rename osu.Game/Overlays/Mods/{ => Sections}/DifficultyIncreaseSection.cs (94%) rename osu.Game/Overlays/Mods/{ => Sections}/DifficultyReductionSection.cs (94%) create mode 100644 osu.Game/Overlays/Mods/Sections/FunSection.cs diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index fc6e23c884..1f1d2475f6 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -93,13 +93,11 @@ namespace osu.Game.Rulesets.Catch new CatchModHidden(), new CatchModFlashlight(), }; - case ModType.Special: + case ModType.Automation: return new Mod[] { - new CatchModRelax(), - null, - null, new MultiMod(new CatchModAutoplay(), new ModCinema()), + new CatchModRelax(), }; default: return new Mod[] { }; diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 3d58e63da5..1cd1714705 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -120,7 +120,7 @@ namespace osu.Game.Rulesets.Mania new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()), new ManiaModFlashlight(), }; - case ModType.Special: + case ModType.Conversion: return new Mod[] { new MultiMod(new ManiaModKey4(), @@ -135,6 +135,10 @@ namespace osu.Game.Rulesets.Mania new ManiaModRandom(), new ManiaModDualStages(), new ManiaModMirror(), + }; + case ModType.Automation: + return new Mod[] + { new MultiMod(new ManiaModAutoplay(), new ModCinema()), }; default: diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs b/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs index 6bfe295c3d..6d91c03c13 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaKeyMod.cs @@ -13,6 +13,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string ShortenedName => Name; public abstract int KeyCount { get; } + public override ModType Type => ModType.Conversion; public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier public override bool Ranked => true; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index 256811b4c1..aecfb50fbe 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Mania.Mods public override string Name => "Dual Stages"; public override string ShortenedName => "DS"; public override string Description => @"Double the stages, double the fun!"; + public override ModType Type => ModType.Conversion; public override double ScoreMultiplier => 1; private bool isForCurrentRuleset; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs index 4192ec78da..847b0037f1 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModMirror.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string Name => "Mirror"; public override string ShortenedName => "MR"; - public override ModType Type => ModType.Special; + public override ModType Type => ModType.Conversion; public override double ScoreMultiplier => 1; public override bool Ranked => true; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs index 2f951461c3..0915b80742 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModRandom.cs @@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Mania.Mods { public override string Name => "Random"; public override string ShortenedName => "RD"; + public override ModType Type => ModType.Conversion; public override FontAwesome Icon => FontAwesome.fa_osu_dice; public override string Description => @"Shuffle around the keys!"; public override double ScoreMultiplier => 1; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs index b2ddd65e38..37d5f57fcb 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModAutopilot.cs @@ -12,6 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Autopilot"; public override string ShortenedName => "AP"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot; + public override ModType Type => ModType.Automation; public override string Description => @"Automatic cursor movement - just follow the rhythm."; public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) }; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs index d14af57bab..6aa864d9b2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModSpunOut.cs @@ -12,6 +12,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override string Name => "Spun Out"; public override string ShortenedName => "SO"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout; + public override ModType Type => ModType.DifficultyReduction; public override string Description => @"Spinners will be automatically completed."; public override double ScoreMultiplier => 0.9; public override bool Ranked => true; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs index ce53857a09..139ce4cc4b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTarget.cs @@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Osu.Mods { public override string Name => "Target"; public override string ShortenedName => "TP"; + public override ModType Type => ModType.Conversion; public override FontAwesome Icon => FontAwesome.fa_osu_mod_target; public override string Description => @"Practice keeping up with the beat of the song."; public override double ScoreMultiplier => 1; diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index b8ba1e2945..fa6e9a018a 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -94,6 +94,7 @@ namespace osu.Game.Rulesets.Osu new OsuModEasy(), new OsuModNoFail(), new MultiMod(new OsuModHalfTime(), new OsuModDaycore()), + new OsuModSpunOut(), }; case ModType.DifficultyIncrease: return new Mod[] @@ -104,14 +105,17 @@ namespace osu.Game.Rulesets.Osu new OsuModHidden(), new OsuModFlashlight(), }; - case ModType.Special: + case ModType.Conversion: return new Mod[] { + new OsuModTarget(), + }; + case ModType.Automation: + return new Mod[] + { + new MultiMod(new OsuModAutoplay(), new ModCinema()), new OsuModRelax(), new OsuModAutopilot(), - new OsuModSpunOut(), - new MultiMod(new OsuModAutoplay(), new ModCinema()), - new OsuModTarget(), }; default: return new Mod[] { }; diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 609fd27bb4..7d9bc98957 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -93,13 +93,11 @@ namespace osu.Game.Rulesets.Taiko new TaikoModHidden(), new TaikoModFlashlight(), }; - case ModType.Special: + case ModType.Automation: return new Mod[] { - new TaikoModRelax(), - null, - null, new MultiMod(new TaikoModAutoplay(), new ModCinema()), + new TaikoModRelax(), }; default: return new Mod[] { }; diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index 1a28442e38..cc396a63e3 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -16,6 +16,7 @@ using System.Collections.Generic; using osu.Game.Rulesets.Osu; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; +using osu.Game.Overlays.Mods.Sections; using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.UI; @@ -36,7 +37,9 @@ namespace osu.Game.Tests.Visual typeof(ModButtonEmpty), typeof(DifficultyReductionSection), typeof(DifficultyIncreaseSection), - typeof(SpecialSection), + typeof(AutomationSection), + typeof(ConversionSection), + typeof(FunSection), }; private RulesetStore rulesets; @@ -95,7 +98,7 @@ namespace osu.Game.Tests.Visual { var easierMods = ruleset.GetModsFor(ModType.DifficultyReduction); var harderMods = ruleset.GetModsFor(ModType.DifficultyIncrease); - var assistMods = ruleset.GetModsFor(ModType.Special); + var assistMods = ruleset.GetModsFor(ModType.Automation); var noFailMod = easierMods.FirstOrDefault(m => m is OsuModNoFail); var hiddenMod = harderMods.FirstOrDefault(m => m is OsuModHidden); @@ -119,7 +122,7 @@ namespace osu.Game.Tests.Visual private void testManiaMods(ManiaRuleset ruleset) { - testRankedText(ruleset.GetModsFor(ModType.Special).First(m => m is ManiaModRandom)); + testRankedText(ruleset.GetModsFor(ModType.Conversion).First(m => m is ManiaModRandom)); } private void testSingleMod(Mod mod) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 2fb44bb927..16ae070c1c 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -73,9 +73,12 @@ namespace osu.Game.Overlays.Mods protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { - var index = Array.IndexOf(ToggleKeys, args.Key); - if (index > -1 && index < buttons.Length) - buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); + if (ToggleKeys != null) + { + var index = Array.IndexOf(ToggleKeys, args.Key); + if (index > -1 && index < buttons.Length) + buttons[index].SelectNext(state.Keyboard.ShiftPressed ? -1 : 1); + } return base.OnKeyDown(state, args); } @@ -125,6 +128,10 @@ namespace osu.Game.Overlays.Mods protected ModSection() { AutoSizeAxes = Axes.Y; + RelativeSizeAxes = Axes.X; + + Origin = Anchor.TopCentre; + Anchor = Anchor.TopCentre; Children = new Drawable[] { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 98cf111ba0..4745eba68d 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -21,6 +21,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Game.Rulesets; using osu.Game.Graphics.UserInterface; +using osu.Game.Overlays.Mods.Sections; namespace osu.Game.Overlays.Mods { @@ -188,6 +189,7 @@ namespace osu.Game.Overlays.Mods Waves.FourthWaveColour = OsuColour.FromHex(@"003a4e"); Height = 510; + Children = new Drawable[] { new Container @@ -211,178 +213,172 @@ namespace osu.Game.Overlays.Mods }, }, }, - new FillFlowContainer + new GridContainer { - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.Both, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0f, 10f), - Children = new Drawable[] + RowDimensions = new[] { - // Header - new Container + new Dimension(GridSizeMode.Absolute, 90), + new Dimension(GridSizeMode.Distributed), + new Dimension(GridSizeMode.Absolute, 70), + }, + Content = new[] + { + new Drawable[] { - RelativeSizeAxes = Axes.X, - Height = 82, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] + new Container { - new Box + RelativeSizeAxes = Axes.Both, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.Gray(10).Opacity(100), - }, - new FillFlowContainer - { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Direction = FillDirection.Vertical, - Width = content_width, - Padding = new MarginPadding + new Box { - Top = 10, - Bottom = 10, + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.Gray(10).Opacity(100), }, - Children = new Drawable[] + new FillFlowContainer { - new OsuSpriteText + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Direction = FillDirection.Vertical, + Width = content_width, + Children = new Drawable[] { - Font = @"Exo2.0-Bold", - Text = @"Gameplay Mods", - TextSize = 22, - Shadow = true, - Margin = new MarginPadding + new OsuSpriteText { - Bottom = 4, + Font = @"Exo2.0-Bold", + Text = @"Gameplay Mods", + TextSize = 22, + Shadow = true, + Margin = new MarginPadding + { + Bottom = 4, + }, + }, + new OsuTextFlowContainer(text => + { + text.TextSize = 18; + text.Shadow = true; + }) + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Text = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.\nOthers are just for fun.", }, - }, - new OsuSpriteText - { - Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.", - TextSize = 18, - Shadow = true, - }, - new OsuSpriteText - { - Text = @"Others are just for fun.", - TextSize = 18, - Shadow = true, }, }, }, }, }, - // Body - ModSectionsContainer = new FillFlowContainer + new Drawable[] { - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - RelativeSizeAxes = Axes.X, - AutoSizeAxes = Axes.Y, - Spacing = new Vector2(0f, 10f), - Width = content_width, - Children = new ModSection[] + // Body + new OsuScrollContainer { - new DifficultyReductionSection + ScrollbarVisible = false, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Vertical = 10 }, + Child = ModSectionsContainer = new FillFlowContainer { - RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Action = modButtonPressed, - }, - new DifficultyIncreaseSection - { RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - }, - new SpecialSection - { - RelativeSizeAxes = Axes.X, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Action = modButtonPressed, - }, - } - }, - // Footer - new Container - { - RelativeSizeAxes = Axes.X, - Height = 70, - Origin = Anchor.TopCentre, - Anchor = Anchor.TopCentre, - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = new Color4(172, 20, 116, 255), - Alpha = 0.5f, - }, - footerContainer = new FillFlowContainer - { - Origin = Anchor.BottomCentre, - Anchor = Anchor.BottomCentre, AutoSizeAxes = Axes.Y, - RelativeSizeAxes = Axes.X, + Spacing = new Vector2(0f, 10f), Width = content_width, - Direction = FillDirection.Horizontal, - Padding = new MarginPadding + Children = new ModSection[] { - Vertical = 15 + new DifficultyReductionSection { Action = modButtonPressed }, + new DifficultyIncreaseSection { Action = modButtonPressed }, + new AutomationSection { Action = modButtonPressed }, + new ConversionSection { Action = modButtonPressed }, + new FunSection { Action = modButtonPressed }, + } + }, + }, + }, + new Drawable[] + { + // Footer + new Container + { + RelativeSizeAxes = Axes.Both, + Origin = Anchor.TopCentre, + Anchor = Anchor.TopCentre, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = new Color4(172, 20, 116, 255), + Alpha = 0.5f, }, - Children = new Drawable[] + footerContainer = new FillFlowContainer { - DeselectAllButton = new TriangleButton + Origin = Anchor.BottomCentre, + Anchor = Anchor.BottomCentre, + AutoSizeAxes = Axes.Y, + RelativeSizeAxes = Axes.X, + Width = content_width, + Direction = FillDirection.Horizontal, + Padding = new MarginPadding { - Width = 180, - Text = "Deselect All", - Action = DeselectAll, - Margin = new MarginPadding - { - Right = 20 - } + Vertical = 15 }, - new OsuSpriteText + Children = new Drawable[] { - Text = @"Score Multiplier:", - TextSize = 30, - Margin = new MarginPadding + DeselectAllButton = new TriangleButton { - Top = 5, - Right = 10 - } - }, - MultiplierLabel = new OsuSpriteText - { - Font = @"Exo2.0-Bold", - TextSize = 30, - Margin = new MarginPadding + Width = 180, + Text = "Deselect All", + Action = DeselectAll, + Margin = new MarginPadding + { + Right = 20 + } + }, + new OsuSpriteText { - Top = 5 - } - }, - UnrankedLabel = new OsuSpriteText - { - Font = @"Exo2.0-Bold", - Text = @"(Unranked)", - TextSize = 30, - Margin = new MarginPadding + Text = @"Score Multiplier:", + TextSize = 30, + Margin = new MarginPadding + { + Top = 5, + Right = 10 + } + }, + MultiplierLabel = new OsuSpriteText { - Top = 5, - Left = 10 + Font = @"Exo2.0-Bold", + TextSize = 30, + Margin = new MarginPadding + { + Top = 5 + } + }, + UnrankedLabel = new OsuSpriteText + { + Font = @"Exo2.0-Bold", + Text = @"(Unranked)", + TextSize = 30, + Margin = new MarginPadding + { + Top = 5, + Left = 10 + } } } } - } - }, + }, + } }, }, }, diff --git a/osu.Game/Overlays/Mods/SpecialSection.cs b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs similarity index 71% rename from osu.Game/Overlays/Mods/SpecialSection.cs rename to osu.Game/Overlays/Mods/Sections/AutomationSection.cs index b3540cf915..6d3b1fe7e6 100644 --- a/osu.Game/Overlays/Mods/SpecialSection.cs +++ b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs @@ -1,17 +1,17 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; +using OpenTK.Input; -namespace osu.Game.Overlays.Mods +namespace osu.Game.Overlays.Mods.Sections { - public class SpecialSection : ModSection + public class AutomationSection : ModSection { protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; - public override ModType ModType => ModType.Special; + public override ModType ModType => ModType.Automation; [BackgroundDependencyLoader] private void load(OsuColour colours) @@ -19,9 +19,9 @@ namespace osu.Game.Overlays.Mods SelectedColour = colours.BlueLight; } - public SpecialSection() + public AutomationSection() { - Header = @"Special"; + Header = @"Automation"; } } } diff --git a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs new file mode 100644 index 0000000000..c757a59073 --- /dev/null +++ b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using OpenTK.Input; + +namespace osu.Game.Overlays.Mods.Sections +{ + public class ConversionSection : ModSection + { + protected override Key[] ToggleKeys => null; + public override ModType ModType => ModType.Conversion; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + SelectedColour = colours.Purple; + } + + public ConversionSection() + { + Header = @"Conversion"; + } + } +} diff --git a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs similarity index 94% rename from osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs rename to osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs index d7d9a90e77..ed585cff22 100644 --- a/osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; +using OpenTK.Input; -namespace osu.Game.Overlays.Mods +namespace osu.Game.Overlays.Mods.Sections { public class DifficultyIncreaseSection : ModSection { diff --git a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs similarity index 94% rename from osu.Game/Overlays/Mods/DifficultyReductionSection.cs rename to osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs index 013deea579..4aa8b1f16f 100644 --- a/osu.Game/Overlays/Mods/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs @@ -1,12 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using OpenTK.Input; using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Rulesets.Mods; +using OpenTK.Input; -namespace osu.Game.Overlays.Mods +namespace osu.Game.Overlays.Mods.Sections { public class DifficultyReductionSection : ModSection { diff --git a/osu.Game/Overlays/Mods/Sections/FunSection.cs b/osu.Game/Overlays/Mods/Sections/FunSection.cs new file mode 100644 index 0000000000..ec6d469329 --- /dev/null +++ b/osu.Game/Overlays/Mods/Sections/FunSection.cs @@ -0,0 +1,27 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using OpenTK.Input; + +namespace osu.Game.Overlays.Mods.Sections +{ + public class FunSection : ModSection + { + protected override Key[] ToggleKeys => null; + public override ModType ModType => ModType.Fun; + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + SelectedColour = colours.PinkLight; + } + + public FunSection() + { + Header = @"Fun"; + } + } +} diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index 9fb554b5c5..a991f7e7b0 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mods /// /// The type of this mod. /// - public virtual ModType Type => ModType.Special; + public virtual ModType Type => ModType.Fun; /// /// The user readable description of this mod. diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 8f73ff4c2d..5c03cb9736 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Mods public override string Name => "Autoplay"; public override string ShortenedName => "AT"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto; + public override ModType Type => ModType.Automation; public override string Description => "Watch a perfect automated play through the song."; public override double ScoreMultiplier => 1; public bool AllowFail => false; diff --git a/osu.Game/Rulesets/Mods/ModRelax.cs b/osu.Game/Rulesets/Mods/ModRelax.cs index 0bd9becd78..04aa295893 100644 --- a/osu.Game/Rulesets/Mods/ModRelax.cs +++ b/osu.Game/Rulesets/Mods/ModRelax.cs @@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods public override string Name => "Relax"; public override string ShortenedName => "RX"; public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax; + public override ModType Type => ModType.Automation; public override double ScoreMultiplier => 1; public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) }; } diff --git a/osu.Game/Rulesets/Mods/ModType.cs b/osu.Game/Rulesets/Mods/ModType.cs index 913ba23701..9c962bbcd5 100644 --- a/osu.Game/Rulesets/Mods/ModType.cs +++ b/osu.Game/Rulesets/Mods/ModType.cs @@ -7,6 +7,8 @@ namespace osu.Game.Rulesets.Mods { DifficultyReduction, DifficultyIncrease, - Special + Conversion, + Automation, + Fun } } diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index cdc1248049..92e9a4831f 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -79,10 +79,18 @@ namespace osu.Game.Rulesets.UI backgroundColour = colours.Green; highlightedColour = colours.GreenLight; break; - case ModType.Special: + case ModType.Automation: backgroundColour = colours.Blue; highlightedColour = colours.BlueLight; break; + case ModType.Conversion: + backgroundColour = colours.Purple; + highlightedColour = colours.PurpleLight; + break; + case ModType.Fun: + backgroundColour = colours.Pink; + highlightedColour = colours.PinkLight; + break; } applyStyle(); @@ -92,10 +100,7 @@ namespace osu.Game.Rulesets.UI public bool Highlighted { - get - { - return highlighted; - } + get { return highlighted; } set { From 582bc58715ae163c53322c8983292541a9173353 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 31 Jul 2018 18:05:14 +0900 Subject: [PATCH 28/43] Remove unused colour propagation --- osu.Game/Overlays/Mods/ModSection.cs | 16 ---------------- .../Overlays/Mods/Sections/AutomationSection.cs | 8 -------- .../Overlays/Mods/Sections/ConversionSection.cs | 8 -------- .../Mods/Sections/DifficultyIncreaseSection.cs | 8 -------- .../Mods/Sections/DifficultyReductionSection.cs | 8 -------- osu.Game/Overlays/Mods/Sections/FunSection.cs | 8 -------- 6 files changed, 56 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 16ae070c1c..37bffaaf12 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK; -using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -45,7 +44,6 @@ namespace osu.Game.Overlays.Mods return new ModButton(m) { - SelectedColour = selectedColour, SelectionChanged = Action, }; }).ToArray(); @@ -57,20 +55,6 @@ namespace osu.Game.Overlays.Mods private ModButton[] buttons = { }; - private Color4 selectedColour = Color4.White; - public Color4 SelectedColour - { - get => selectedColour; - set - { - if (value == selectedColour) return; - selectedColour = value; - - foreach (ModButton button in buttons) - button.SelectedColour = value; - } - } - protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) { if (ToggleKeys != null) diff --git a/osu.Game/Overlays/Mods/Sections/AutomationSection.cs b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs index 6d3b1fe7e6..2b509d539e 100644 --- a/osu.Game/Overlays/Mods/Sections/AutomationSection.cs +++ b/osu.Game/Overlays/Mods/Sections/AutomationSection.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M }; public override ModType ModType => ModType.Automation; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.BlueLight; - } - public AutomationSection() { Header = @"Automation"; diff --git a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs index c757a59073..568f0ecfce 100644 --- a/osu.Game/Overlays/Mods/Sections/ConversionSection.cs +++ b/osu.Game/Overlays/Mods/Sections/ConversionSection.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => null; public override ModType ModType => ModType.Conversion; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.Purple; - } - public ConversionSection() { Header = @"Conversion"; diff --git a/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs index ed585cff22..5aced7ed5d 100644 --- a/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyIncreaseSection.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L }; public override ModType ModType => ModType.DifficultyIncrease; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.YellowLight; - } - public DifficultyIncreaseSection() { Header = @"Difficulty Increase"; diff --git a/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs index 4aa8b1f16f..29fae2c70a 100644 --- a/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs +++ b/osu.Game/Overlays/Mods/Sections/DifficultyReductionSection.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P }; public override ModType ModType => ModType.DifficultyReduction; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.GreenLight; - } - public DifficultyReductionSection() { Header = @"Difficulty Reduction"; diff --git a/osu.Game/Overlays/Mods/Sections/FunSection.cs b/osu.Game/Overlays/Mods/Sections/FunSection.cs index ec6d469329..ef975d9d75 100644 --- a/osu.Game/Overlays/Mods/Sections/FunSection.cs +++ b/osu.Game/Overlays/Mods/Sections/FunSection.cs @@ -1,8 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Allocation; -using osu.Game.Graphics; using osu.Game.Rulesets.Mods; using OpenTK.Input; @@ -13,12 +11,6 @@ namespace osu.Game.Overlays.Mods.Sections protected override Key[] ToggleKeys => null; public override ModType ModType => ModType.Fun; - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - SelectedColour = colours.PinkLight; - } - public FunSection() { Header = @"Fun"; From 4f1736ceb2e6018aebab5e6169de453be5c8806c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 02:58:39 +0900 Subject: [PATCH 29/43] Make squirrel work again --- osu.Desktop/OsuGameDesktop.cs | 10 +++++----- osu.Desktop/Updater/SquirrelUpdateManager.cs | 2 -- osu.Desktop/osu.Desktop.csproj | 8 +++----- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index a4270f22b4..79ac24a1da 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -13,6 +13,7 @@ using osu.Game; using OpenTK.Input; using Microsoft.Win32; using osu.Desktop.Updater; +using osu.Framework; using osu.Framework.Platform.Windows; namespace osu.Desktop @@ -51,11 +52,10 @@ namespace osu.Desktop v.State = Visibility.Visible; }); -#if NET_FRAMEWORK - Add(new SquirrelUpdateManager()); -#else - Add(new SimpleUpdateManager()); -#endif + if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) + Add(new SquirrelUpdateManager()); + else + Add(new SimpleUpdateManager()); } } diff --git a/osu.Desktop/Updater/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs index 81da26cff2..1f8bff74f4 100644 --- a/osu.Desktop/Updater/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -#if NET_FRAMEWORK using System; using System.Threading.Tasks; using osu.Framework.Allocation; @@ -162,4 +161,3 @@ namespace osu.Desktop.Updater } } } -#endif diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 1d9928134d..880ef3b2a9 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -13,9 +13,6 @@ 0.0.0 0.0.0 - - $(DefineConstants);NET_FRAMEWORK - osu.Desktop.Program @@ -29,11 +26,12 @@ + + - - \ No newline at end of file + From 854beaab5f590f3a3e6fc0bd6f788c8fc2ed792e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 02:58:49 +0900 Subject: [PATCH 30/43] Remove only remaining .NET desktop code --- osu.Desktop/Program.cs | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 7e6a07c89f..cc08e08653 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -8,10 +8,6 @@ using osu.Framework; using osu.Framework.Platform; using osu.Game.IPC; -#if NET_FRAMEWORK -using System.Runtime; -#endif - namespace osu.Desktop { public static class Program @@ -19,8 +15,6 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - useMultiCoreJit(); - // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; @@ -51,14 +45,5 @@ namespace osu.Desktop return 0; } } - - private static void useMultiCoreJit() - { -#if NET_FRAMEWORK - var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); - ProfileOptimization.SetProfileRoot(directory.FullName); - ProfileOptimization.StartProfile("Startup.Profile"); -#endif - } } } From 3d136bf207eff2d6ee0d39881eb13cb04beaf6e5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 03:37:59 +0900 Subject: [PATCH 31/43] Remove unused nuspec --- osu.Game/osu.nuspec | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 osu.Game/osu.nuspec diff --git a/osu.Game/osu.nuspec b/osu.Game/osu.nuspec deleted file mode 100644 index bb7d382cee..0000000000 --- a/osu.Game/osu.nuspec +++ /dev/null @@ -1,26 +0,0 @@ - - - - osulazer - 0.0.0 - osulazer - ppy Pty Ltd - Dean Herbert - https://osu.ppy.sh/ - https://puu.sh/tYyXZ/9a01a5d1b0.ico - false - click the circles. to the beat. - click the circles. - testing - Copyright ppy Pty Ltd 2007-2018 - en-AU - - - - - - - - - - From 139f6d8c4fadb14a9e00bb2d16811c57a1462f98 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 12:30:09 +0900 Subject: [PATCH 32/43] Fix incorrect nuspec title --- osu.Desktop/osu.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/osu.nuspec b/osu.Desktop/osu.nuspec index 316a5443ef..cdd232a9b2 100644 --- a/osu.Desktop/osu.nuspec +++ b/osu.Desktop/osu.nuspec @@ -3,7 +3,7 @@ osulazer 0.0.0 - osulazer + osu!lazer ppy Pty Ltd Dean Herbert https://osu.ppy.sh/ From ecc6d55380a89334702082b8579ebb40334d7bef Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 1 Aug 2018 16:20:29 +0900 Subject: [PATCH 33/43] Fix player loader not gets ready when multiple mouse button is down --- osu.Game/Screens/Play/PlayerLoader.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 4abc0dfcd9..97a728ffb7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -6,8 +6,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.EventArgs; -using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -123,23 +121,9 @@ namespace osu.Game.Screens.Play logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo); } - private bool weHandledMouseDown; - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - weHandledMouseDown = true; - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - weHandledMouseDown = false; - return base.OnMouseUp(state, args); - } - private ScheduledDelegate pushDebounce; - private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && (!GetContainingInputManager().CurrentState.Mouse.HasAnyButtonPressed || weHandledMouseDown); + private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; private void pushWhenLoaded() { From 4224d35a7570c18f16aac0cbb0b7ce5dbfcac9b2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 16:56:36 +0900 Subject: [PATCH 34/43] Use forked squirrel Allows for updating SharpCompress, too. --- osu.Desktop/osu.Desktop.csproj | 2 +- osu.Game/osu.Game.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 880ef3b2a9..87c518b492 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index aa74641d28..157b4f71c2 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -19,7 +19,7 @@ - + From 6ce32bd431e91bda590536cb37fd361e0f8f634a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 16:56:46 +0900 Subject: [PATCH 35/43] Update remaining nuget deps --- osu.Desktop/osu.Desktop.csproj | 2 +- .../osu.Game.Rulesets.Catch.Tests.csproj | 2 +- .../osu.Game.Rulesets.Mania.Tests.csproj | 2 +- osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj | 2 +- .../osu.Game.Rulesets.Taiko.Tests.csproj | 2 +- osu.Game.Tests/osu.Game.Tests.csproj | 2 +- osu.Game/osu.Game.csproj | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 87c518b492..6ee9c3155e 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,7 +27,7 @@ - + diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index 9bef8f258c..51343d9e91 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index 61057a64a1..3165f69a6b 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 9e10a556a4..247d5e18c1 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index 0e29da1549..08a0579561 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index 478a06ed30..d638af0c38 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -2,7 +2,7 @@ - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 157b4f71c2..89e80bd06b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 21a19dc5522189f05a7afbfdfee2ab2eaea951b0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 22:07:39 +0900 Subject: [PATCH 36/43] Remove remaining references to net471 --- README.md | 2 +- appveyor_deploy.yml | 6 +-- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- .../.vscode/launch.json | 36 ++------------- .../.vscode/tasks.json | 46 ++----------------- 10 files changed, 31 insertions(+), 305 deletions(-) diff --git a/README.md b/README.md index a1932b0fdf..a1f478e39a 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Clone the repository including submodules Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) -- From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` +- From command line using `dotnet run --project osu.Desktop` If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build. diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index 0247714cdf..abfe1e4368 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -16,11 +16,9 @@ build_script: - cd osu-deploy - nuget restore -verbosity quiet - msbuild osu.Desktop.Deploy.csproj - - cmd: ..\appveyor-tools\secure-file -decrypt ..\fdc6f19b04.enc -secret %decode_secret% -out bin\Debug\net471\osu.Desktop.Deploy.exe.config - - cd bin\Debug\net471\ - - osu.Desktop.Deploy.exe %code_signing_password% %APPVEYOR_REPO_TAG_NAME% + - cmd: ..\appveyor-tools\secure-file -decrypt ..\fdc6f19b04.enc -secret %decode_secret% -out bin\Debug\netcoreapp2.1\osu.Desktop.Deploy.dll.config + - dotnet bin/Debug/netcoreapp2.1/osu.Desktop.Deploy.dll %code_signing_password% %APPVEYOR_REPO_TAG_NAME% environment: - TargetFramework: net471 decode_secret: secure: i67IC2xj6DjjxmA6Oj2jing3+MwzLkq6CbGsjfZ7rdY= code_signing_password: diff --git a/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json b/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json index 2a82d65014..da9344b6a2 100644 --- a/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Catch.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Catch.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Catch.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Catch.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Catch.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json index 6c6d562512..18a6f8ca70 100644 --- a/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Catch.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Catch.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ diff --git a/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json b/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json index bc41d4ccf9..c781b0e64e 100644 --- a/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Mania.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Mania.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Mania.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Mania.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Mania.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json index 7fc2f7b2ef..608c4340ac 100644 --- a/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Mania.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Mania.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ diff --git a/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json b/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json index 13aba025fd..fe3ecbec47 100644 --- a/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Osu.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Osu.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Osu.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Osu.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Osu.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json index 62cf51382f..ed2a015e11 100644 --- a/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Osu.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Osu.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ diff --git a/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json b/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json index df49e177dc..de7bf77070 100644 --- a/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json +++ b/osu.Game.Rulesets.Taiko.Tests/.vscode/launch.json @@ -2,35 +2,7 @@ "version": "0.2.0", "configurations": [ { - "name": "VisualTests (Debug, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Debug/net471/osu.Game.Rulesets.Taiko.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Release, net471)", - "windows": { - "type": "clr" - }, - "type": "mono", - "request": "launch", - "program": "${workspaceRoot}/bin/Release/net471/osu.Game.Rulesets.Taiko.Tests.exe", - "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, msbuild)", - "runtimeExecutable": null, - "env": {}, - "console": "internalConsole" - }, - { - "name": "VisualTests (Debug, netcoreapp2.1)", + "name": "VisualTests (Debug)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -38,12 +10,12 @@ "${workspaceRoot}/bin/Debug/netcoreapp2.1/osu.Game.Rulesets.Taiko.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Debug, dotnet)", + "preLaunchTask": "Build (Debug)", "env": {}, "console": "internalConsole" }, { - "name": "VisualTests (Release, netcoreapp2.1)", + "name": "VisualTests (Release)", "type": "coreclr", "request": "launch", "program": "dotnet", @@ -51,7 +23,7 @@ "${workspaceRoot}/bin/Release/netcoreapp2.1/osu.Game.Rulesets.Taiko.Tests.dll" ], "cwd": "${workspaceRoot}", - "preLaunchTask": "Build (Release, dotnet)", + "preLaunchTask": "Build (Release)", "env": {}, "console": "internalConsole" } diff --git a/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json b/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json index 7c8beed00f..9b91f2c9b9 100644 --- a/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json +++ b/osu.Game.Rulesets.Taiko.Tests/.vscode/tasks.json @@ -4,43 +4,13 @@ "version": "2.0.0", "tasks": [ { - "label": "Build (Debug, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Release, msbuild)", - "type": "shell", - "command": "msbuild", - "args": [ - "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:Configuration=Release", - "/p:TargetFramework=net471", - "/p:GenerateFullPaths=true", - "/m", - "/verbosity:m" - ], - "group": "build", - "problemMatcher": "$msCompile" - }, - { - "label": "Build (Debug, dotnet)", + "label": "Build (Debug)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:GenerateFullPaths=true", "/m", "/verbosity:m" @@ -49,14 +19,13 @@ "problemMatcher": "$msCompile" }, { - "label": "Build (Release, dotnet)", + "label": "Build (Release)", "type": "shell", "command": "dotnet", "args": [ "build", "--no-restore", "osu.Game.Rulesets.Taiko.Tests.csproj", - "/p:TargetFramework=netcoreapp2.1", "/p:Configuration=Release", "/p:GenerateFullPaths=true", "/m", @@ -66,16 +35,7 @@ "problemMatcher": "$msCompile" }, { - "label": "Restore (net471)", - "type": "shell", - "command": "nuget", - "args": [ - "restore" - ], - "problemMatcher": [] - }, - { - "label": "Restore (netcoreapp2.1)", + "label": "Restore", "type": "shell", "command": "dotnet", "args": [ From d454dbfdc2106cd79c22a71e19e7cacf4cba370e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 1 Aug 2018 22:34:45 +0900 Subject: [PATCH 37/43] Fix artifact collection --- appveyor_deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor_deploy.yml b/appveyor_deploy.yml index abfe1e4368..6d8d95e773 100644 --- a/appveyor_deploy.yml +++ b/appveyor_deploy.yml @@ -24,7 +24,7 @@ environment: code_signing_password: secure: 34tLNqvjmmZEi97MLKfrnQ== artifacts: - - path: 'Releases\*' + - path: 'osu-deploy/releases/*' deploy: - provider: Environment name: github \ No newline at end of file From 70ee7e4afdea9a442e4f197577f2de82f1a46af4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 07:59:48 +0900 Subject: [PATCH 38/43] Scroll chat to end of buffer when posting a new message --- osu.Game/Overlays/Chat/DrawableChannel.cs | 6 +++--- osu.Game/Overlays/ChatOverlay.cs | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index bcc8879902..acc145af68 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Chat protected override void LoadComplete() { base.LoadComplete(); - scrollToEnd(); + ScrollToEnd(); } protected override void Dispose(bool isDisposing) @@ -86,7 +86,7 @@ namespace osu.Game.Overlays.Chat if (!IsLoaded) return; if (scroll.IsScrolledToEnd(10) || !flow.Children.Any()) - scrollToEnd(); + ScrollToEnd(); var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); int count = staleMessages.Length - Channel.MAX_HISTORY; @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Chat flow.Children.FirstOrDefault(c => c.Message == removed)?.FadeColour(Color4.Red, 400).FadeOut(600).Expire(); } - private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); + public void ScrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); private class ChatLineContainer : FillFlowContainer { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 8e20d76914..f86c5204bb 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -475,6 +475,8 @@ namespace osu.Game.Overlays if (target == null) return; + currentChannelContainer.Child.ScrollToEnd(); + if (!api.IsLoggedIn) { target.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!")); From 4a11f2ec2ac4114cc3c89a843ff45d1700a3adef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 18:16:36 +0900 Subject: [PATCH 39/43] Improve UX when adjusting visual settings at loading screen --- osu.Game/Screens/Play/PlayerLoader.cs | 32 +++++++++++++++++-- .../PlayerSettings/PlayerSettingsGroup.cs | 22 ++++++++++++- .../Play/ScreenWithBeatmapBackground.cs | 17 ++++++++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 97a728ffb7..e9aa012cd7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -1,11 +1,13 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -20,6 +22,8 @@ namespace osu.Game.Screens.Play { public class PlayerLoader : ScreenWithBeatmapBackground { + private static readonly Vector2 background_blur = new Vector2(15); + private Player player; private BeatmapMetadataDisplay info; @@ -60,7 +64,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding(25), Children = new PlayerSettingsGroup[] { - new VisualSettings(), + visualSettings = new VisualSettings(), new InputSettings() } }); @@ -122,9 +126,33 @@ namespace osu.Game.Screens.Play } private ScheduledDelegate pushDebounce; + private VisualSettings visualSettings; private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; + protected override bool OnHover(InputState state) + { + // restore our screen defaults + InitializeBackgroundElements(); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + if (GetContainingInputManager().HoveredDrawables.Contains(visualSettings)) + { + // show user setting preview + UpdateBackgroundElements(); + } + base.OnHoverLost(state); + } + + protected override void InitializeBackgroundElements() + { + Background?.FadeTo(1, BACKGROUND_FADE_DURATION, Easing.OutQuint); + Background?.BlurTo(background_blur, BACKGROUND_FADE_DURATION, Easing.OutQuint); + } + private void pushWhenLoaded() { if (!IsCurrentScreen) return; @@ -215,7 +243,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.TopCentre, Origin = Anchor.TopRight, Margin = new MarginPadding { Right = 5 }, - Colour = OsuColour.Gray(0.5f), + Colour = OsuColour.Gray(0.8f), Text = left, }, new OsuSpriteText diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index c4767f404d..64c49099f2 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -128,6 +128,27 @@ namespace osu.Game.Screens.Play.PlayerSettings }; } + private const float fade_duration = 800; + private const float inactive_alpha = 0.5f; + + protected override void LoadComplete() + { + base.LoadComplete(); + this.Delay(600).FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); + } + + protected override bool OnHover(InputState state) + { + this.FadeIn(fade_duration, Easing.OutQuint); + return true; + } + + protected override void OnHoverLost(InputState state) + { + this.FadeTo(inactive_alpha, fade_duration, Easing.OutQuint); + base.OnHoverLost(state); + } + [BackgroundDependencyLoader] private void load(OsuColour colours) { @@ -140,7 +161,6 @@ namespace osu.Game.Screens.Play.PlayerSettings protected override Container Content => content; - protected override bool OnHover(InputState state) => true; protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true; } } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 7f18305b1c..26d3218fbf 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -15,6 +15,8 @@ namespace osu.Game.Screens.Play { protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); + protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background; + public override bool AllowBeatmapRulesetChange => false; protected const float BACKGROUND_FADE_DURATION = 800; @@ -43,21 +45,30 @@ namespace osu.Game.Screens.Play DimLevel.ValueChanged += _ => UpdateBackgroundElements(); BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); - UpdateBackgroundElements(); + InitializeBackgroundElements(); } protected override void OnResuming(Screen last) { base.OnResuming(last); - UpdateBackgroundElements(); + InitializeBackgroundElements(); } + /// + /// Called once on entering screen. By Default, performs a full call. + /// + protected virtual void InitializeBackgroundElements() => UpdateBackgroundElements(); + + /// + /// Called wen background elements require updates, usually due to a user changing a setting. + /// + /// protected virtual void UpdateBackgroundElements() { if (!IsCurrentScreen) return; Background?.FadeTo(BackgroundOpacity, BACKGROUND_FADE_DURATION, Easing.OutQuint); - (Background as BackgroundScreenBeatmap)?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint); + Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint); } } } From 7097ecb740bfb26d3a9061b393cf8df3ea3450e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 2 Aug 2018 19:08:23 +0900 Subject: [PATCH 40/43] Fix discrepancies in how elements of play mode fade when restarting/exiting --- osu.Game/Screens/Play/Player.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index cc649960ea..2e23bb16f0 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -213,7 +213,7 @@ namespace osu.Game.Screens.Play { if (!IsCurrentScreen) return; - pauseContainer.Hide(); + fadeOut(true); Restart(); }, } @@ -364,16 +364,10 @@ namespace osu.Game.Screens.Play return true; } - private void fadeOut() + private void fadeOut(bool instant = false) { - const float fade_out_duration = 250; - - RulesetContainer?.FadeOut(fade_out_duration); - Content.FadeOut(fade_out_duration); - - hudOverlay?.ScaleTo(0.7f, fade_out_duration * 3, Easing.In); - - Background?.FadeTo(1f, fade_out_duration); + float fadeOutDuration = instant ? 0 : 250; + Content.FadeOut(fadeOutDuration); } protected override bool OnScroll(InputState state) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; From 4c57e629ffe0905e90cb524d59fc3e714b7eb556 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 19:32:34 +0900 Subject: [PATCH 41/43] Use private implementation --- osu.Game/Overlays/Chat/DrawableChannel.cs | 8 ++++---- osu.Game/Overlays/ChatOverlay.cs | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index acc145af68..4586d4d87c 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -64,7 +64,7 @@ namespace osu.Game.Overlays.Chat protected override void LoadComplete() { base.LoadComplete(); - ScrollToEnd(); + scrollToEnd(); } protected override void Dispose(bool isDisposing) @@ -85,8 +85,8 @@ namespace osu.Game.Overlays.Chat if (!IsLoaded) return; - if (scroll.IsScrolledToEnd(10) || !flow.Children.Any()) - ScrollToEnd(); + if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m.GetType() == typeof(LocalEchoMessage))) + scrollToEnd(); var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); int count = staleMessages.Length - Channel.MAX_HISTORY; @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Chat flow.Children.FirstOrDefault(c => c.Message == removed)?.FadeColour(Color4.Red, 400).FadeOut(600).Expire(); } - public void ScrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); + private void scrollToEnd() => ScheduleAfterChildren(() => scroll.ScrollToEnd()); private class ChatLineContainer : FillFlowContainer { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index f86c5204bb..8e20d76914 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -475,8 +475,6 @@ namespace osu.Game.Overlays if (target == null) return; - currentChannelContainer.Child.ScrollToEnd(); - if (!api.IsLoggedIn) { target.AddNewMessages(new ErrorMessage("Please sign in to participate in chat!")); From b4ef3dd4dd970e55a7c29c02d6903751762d1507 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 20:02:12 +0900 Subject: [PATCH 42/43] Add LocalMessage --- osu.Game/Online/Chat/InfoMessage.cs | 2 +- osu.Game/Online/Chat/LocalEchoMessage.cs | 2 +- osu.Game/Online/Chat/LocalMessage.cs | 16 ++++++++++++++++ osu.Game/Overlays/Chat/DrawableChannel.cs | 2 +- 4 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 osu.Game/Online/Chat/LocalMessage.cs diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 2be025e403..2ff901deb1 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -6,7 +6,7 @@ using osu.Game.Users; namespace osu.Game.Online.Chat { - public class InfoMessage : Message + public class InfoMessage : LocalMessage { private static int infoID = -1; diff --git a/osu.Game/Online/Chat/LocalEchoMessage.cs b/osu.Game/Online/Chat/LocalEchoMessage.cs index 2e90b9d3fd..7d678029aa 100644 --- a/osu.Game/Online/Chat/LocalEchoMessage.cs +++ b/osu.Game/Online/Chat/LocalEchoMessage.cs @@ -3,7 +3,7 @@ namespace osu.Game.Online.Chat { - public class LocalEchoMessage : Message + public class LocalEchoMessage : LocalMessage { public LocalEchoMessage() : base(null) { diff --git a/osu.Game/Online/Chat/LocalMessage.cs b/osu.Game/Online/Chat/LocalMessage.cs new file mode 100644 index 0000000000..93f1e7f9ea --- /dev/null +++ b/osu.Game/Online/Chat/LocalMessage.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Online.Chat +{ + /// + /// A message which is generated and displayed locally. + /// + public class LocalMessage : Message + { + protected LocalMessage(long? id) + : base(id) + { + } + } +} diff --git a/osu.Game/Overlays/Chat/DrawableChannel.cs b/osu.Game/Overlays/Chat/DrawableChannel.cs index 4586d4d87c..c57e71b5ad 100644 --- a/osu.Game/Overlays/Chat/DrawableChannel.cs +++ b/osu.Game/Overlays/Chat/DrawableChannel.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Chat if (!IsLoaded) return; - if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m.GetType() == typeof(LocalEchoMessage))) + if (scroll.IsScrolledToEnd(10) || !flow.Children.Any() || newMessages.Any(m => m is LocalMessage)) scrollToEnd(); var staleMessages = flow.Children.Where(c => c.LifetimeEnd == double.MaxValue).ToArray(); From 8d98826f69b6dd0226e0b8919bffe10716393679 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 3 Aug 2018 21:17:17 +0900 Subject: [PATCH 43/43] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 89e80bd06b..1fed7f46bc 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - +