1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 09:42:54 +08:00

Fix mania notes disappearing on seek to their end time

This commit is contained in:
Bartłomiej Dach 2024-11-18 14:30:17 +01:00
parent 28fb0bf909
commit 15a8cfe685
No known key found for this signature in database
5 changed files with 82 additions and 6 deletions

View File

@ -0,0 +1,45 @@
// 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.
using osu.Framework.Graphics;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.Edit
{
public partial class EditorColumn : Column
{
public EditorColumn(int index, bool isSpecial)
: base(index, isSpecial)
{
}
protected override void OnNewDrawableHitObject(DrawableHitObject drawableHitObject)
{
base.OnNewDrawableHitObject(drawableHitObject);
drawableHitObject.ApplyCustomUpdateState += (dho, state) =>
{
switch (dho)
{
// hold note heads are exempt from what follows due to the "freezing" mechanic
// which already ensures they'll never fade away on their own.
case DrawableHoldNoteHead:
break;
// mania features instantaneous hitobject fade-outs.
// this means that without manual intervention stopping the clock at the precise time of hitting the object
// means the object will fade out.
// this is anti-user in editor contexts, as the user is expecting to continue the see the note on the receptor line.
// therefore, apply a crude workaround to prevent it from going away.
default:
{
if (state == ArmedState.Hit)
dho.FadeTo(1).Delay(1).FadeOut().Expire();
break;
}
}
};
}
}
}

View File

@ -0,0 +1,18 @@
// 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.
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.UI;
namespace osu.Game.Rulesets.Mania.Edit
{
public partial class EditorStage : Stage
{
public EditorStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction columnStartAction)
: base(firstColumnIndex, definition, ref columnStartAction)
{
}
protected override Column CreateColumn(int index, bool isSpecial) => new EditorColumn(index, isSpecial);
}
}

View File

@ -13,5 +13,8 @@ namespace osu.Game.Rulesets.Mania.Edit
: base(stages)
{
}
protected override Stage CreateStage(int firstColumnIndex, StageDefinition stageDefinition, ref ManiaAction columnAction)
=> new EditorStage(firstColumnIndex, stageDefinition, ref columnAction);
}
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System;
using System.Collections.Generic;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Primitives;
using osu.Game.Rulesets.Mania.Beatmaps;
@ -71,7 +72,7 @@ namespace osu.Game.Rulesets.Mania.UI
for (int i = 0; i < stageDefinitions.Count; i++)
{
var newStage = new Stage(firstColumnIndex, stageDefinitions[i], ref columnAction);
var newStage = CreateStage(firstColumnIndex, stageDefinitions[i], ref columnAction);
playfieldGrid.Content[0][i] = newStage;
@ -82,6 +83,9 @@ namespace osu.Game.Rulesets.Mania.UI
}
}
[Pure]
protected virtual Stage CreateStage(int firstColumnIndex, StageDefinition stageDefinition, ref ManiaAction columnAction) => new Stage(firstColumnIndex, stageDefinition, ref columnAction);
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

@ -3,6 +3,7 @@
using System;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
@ -134,12 +135,14 @@ namespace osu.Game.Rulesets.Mania.UI
{
bool isSpecial = definition.IsSpecialColumn(i);
var column = new Column(firstColumnIndex + i, isSpecial)
var action = columnStartAction;
columnStartAction++;
var column = CreateColumn(firstColumnIndex + i, isSpecial).With(c =>
{
RelativeSizeAxes = Axes.Both,
Width = 1,
Action = { Value = columnStartAction++ }
};
c.RelativeSizeAxes = Axes.Both;
c.Width = 1;
c.Action.Value = action;
});
topLevelContainer.Add(column.TopLevelContainer.CreateProxy());
columnBackgrounds.Add(column.BackgroundContainer.CreateProxy());
@ -154,6 +157,9 @@ namespace osu.Game.Rulesets.Mania.UI
RegisterPool<BarLine, DrawableBarLine>(50, 200);
}
[Pure]
protected virtual Column CreateColumn(int index, bool isSpecial) => new Column(index, isSpecial);
[BackgroundDependencyLoader]
private void load(ISkinSource skin)
{