mirror of
https://github.com/osukey/osukey.git
synced 2025-06-07 20:37:57 +09:00
Move mania note height offset application to a much more suitable location
This commit is contained in:
parent
c0abce918f
commit
f7e055dbfe
@ -5,7 +5,10 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
|
using osu.Game.Rulesets.Mania.Skinning.Default;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||||
@ -52,8 +55,28 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
|||||||
{
|
{
|
||||||
base.UpdateTimeAndPosition(result);
|
base.UpdateTimeAndPosition(result);
|
||||||
|
|
||||||
if (PlacementActive == PlacementState.Waiting)
|
var playfield = (Column)result.Playfield;
|
||||||
Column = result.Playfield as Column;
|
|
||||||
|
// Apply an offset to better align with the visual grid.
|
||||||
|
// This should only be applied during placement, as during selection / drag operations the movement is relative
|
||||||
|
// to the initial point of interaction rather than the grid.
|
||||||
|
switch (playfield.ScrollingInfo.Direction.Value)
|
||||||
|
{
|
||||||
|
case ScrollingDirection.Down:
|
||||||
|
result.ScreenSpacePosition -= new Vector2(0, getNoteHeight(playfield) / 2);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ScrollingDirection.Up:
|
||||||
|
result.ScreenSpacePosition += new Vector2(0, getNoteHeight(playfield) / 2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (PlacementActive == PlacementState.Waiting)
|
||||||
|
Column = playfield;
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getNoteHeight(Column resultPlayfield) =>
|
||||||
|
resultPlayfield.ToScreenSpace(new Vector2(DefaultNotePiece.NOTE_HEIGHT)).Y -
|
||||||
|
resultPlayfield.ToScreenSpace(Vector2.Zero).Y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,14 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Edit;
|
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Rulesets.Mania.Skinning.Default;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -56,28 +55,6 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
protected override Playfield PlayfieldAtScreenSpacePosition(Vector2 screenSpacePosition) =>
|
||||||
Playfield.GetColumnByPosition(screenSpacePosition);
|
Playfield.GetColumnByPosition(screenSpacePosition);
|
||||||
|
|
||||||
public override SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.All)
|
|
||||||
{
|
|
||||||
var result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType);
|
|
||||||
|
|
||||||
switch (ScrollingInfo.Direction.Value)
|
|
||||||
{
|
|
||||||
case ScrollingDirection.Down:
|
|
||||||
result.ScreenSpacePosition -= new Vector2(0, getNoteHeight() / 2);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ScrollingDirection.Up:
|
|
||||||
result.ScreenSpacePosition += new Vector2(0, getNoteHeight() / 2);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
private float getNoteHeight() =>
|
|
||||||
Playfield.GetColumn(0).ToScreenSpace(new Vector2(DefaultNotePiece.NOTE_HEIGHT)).Y -
|
|
||||||
Playfield.GetColumn(0).ToScreenSpace(Vector2.Zero).Y;
|
|
||||||
|
|
||||||
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods = null)
|
||||||
{
|
{
|
||||||
drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods);
|
drawableRuleset = new DrawableManiaEditorRuleset(ruleset, beatmap, mods);
|
||||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer;
|
public new ScrollingHitObjectContainer HitObjectContainer => (ScrollingHitObjectContainer)base.HitObjectContainer;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IScrollingInfo ScrollingInfo { get; private set; }
|
public IScrollingInfo ScrollingInfo { get; private set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user