1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Move out of playfield so touch overlay is not affected by playfield position

This commit is contained in:
Dean Herbert 2024-05-06 15:24:32 +08:00
parent a761a7bced
commit 12e98fe55d
No known key found for this signature in database
3 changed files with 15 additions and 30 deletions

View File

@ -31,6 +31,7 @@ using osu.Game.Skinning;
namespace osu.Game.Rulesets.Mania.UI
{
[Cached]
public partial class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObject>
{
/// <summary>
@ -43,7 +44,7 @@ namespace osu.Game.Rulesets.Mania.UI
/// </summary>
public const double MAX_TIME_RANGE = 11485;
protected new ManiaPlayfield Playfield => (ManiaPlayfield)base.Playfield;
public new ManiaPlayfield Playfield => (ManiaPlayfield)base.Playfield;
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
@ -103,6 +104,11 @@ namespace osu.Game.Rulesets.Mania.UI
configScrollSpeed.BindValueChanged(speed => this.TransformTo(nameof(smoothTimeRange), ComputeScrollTime(speed.NewValue), 200, Easing.OutQuint));
TimeRange.Value = smoothTimeRange = ComputeScrollTime(configScrollSpeed.Value);
KeyBindingInputManager.Add(touchOverlay = new ManiaTouchInputOverlay
{
RelativeSizeAxes = Axes.Both
});
}
protected override void AdjustScrollSpeed(int amount) => configScrollSpeed.Value += amount;
@ -116,6 +122,8 @@ namespace osu.Game.Rulesets.Mania.UI
private ScheduledDelegate? pendingSkinChange;
private float hitPosition;
private ManiaTouchInputOverlay touchOverlay = null!;
private void onSkinChange()
{
// schedule required to avoid calls after disposed.

View File

@ -7,12 +7,10 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling;
@ -27,8 +25,6 @@ namespace osu.Game.Rulesets.Mania.UI
private readonly List<Stage> stages = new List<Stage>();
private readonly ManiaTouchInputOverlay touchOverlay;
public override Quad SkinnableComponentScreenSpaceDrawQuad
{
get
@ -64,23 +60,10 @@ namespace osu.Game.Rulesets.Mania.UI
throw new ArgumentException("Can't have zero or fewer stages.");
GridContainer playfieldGrid;
RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X;
AddRangeInternal(new Drawable[]
AddInternal(playfieldGrid = new GridContainer
{
playfieldGrid = new GridContainer
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Content = new[] { new Drawable[stageDefinitions.Count] },
ColumnDimensions = Enumerable.Range(0, stageDefinitions.Count).Select(_ => new Dimension(GridSizeMode.AutoSize)).ToArray()
},
touchOverlay = new ManiaTouchInputOverlay
{
RelativeSizeAxes = Axes.Both
}
RelativeSizeAxes = Axes.Both,
Content = new[] { new Drawable[stageDefinitions.Count] }
});
var normalColumnAction = ManiaAction.Key1;
@ -100,13 +83,6 @@ namespace osu.Game.Rulesets.Mania.UI
}
}
protected override void LoadComplete()
{
base.LoadComplete();
touchOverlay.Alpha = Mods?.Any(m => m is ModTouchDevice) == true ? 1 : 0;
}
public override void Add(HitObject hitObject) => getStageByColumn(((ManiaHitObject)hitObject).Column).Add(hitObject);
public override bool Remove(HitObject hitObject) => getStageByColumn(((ManiaHitObject)hitObject).Column).Remove(hitObject);

View File

@ -33,12 +33,13 @@ namespace osu.Game.Rulesets.Mania.UI
};
[Resolved]
private ManiaPlayfield playfield { get; set; } = null!;
private DrawableManiaRuleset drawableRuleset { get; set; } = null!;
public ManiaTouchInputOverlay()
{
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre;
RelativeSizeAxes = Axes.Both;
Height = 0.5f;
}
@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.UI
bool first = true;
foreach (var stage in playfield.Stages)
foreach (var stage in drawableRuleset.Playfield.Stages)
{
foreach (var column in stage.Columns)
{