1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 10:33:22 +08:00

Revert "Migrate legacy health bar display to per-ruleset target"

This reverts commit 76f79ce083.
This commit is contained in:
Salman Alshamrani 2024-11-25 20:35:11 -05:00
parent 76f79ce083
commit 7df7727591
3 changed files with 3 additions and 56 deletions

View File

@ -376,8 +376,7 @@ namespace osu.Game.Skinning
}
})
{
new LegacyDefaultComboCounter(),
new LegacyHealthDisplay(),
new LegacyDefaultComboCounter()
};
}
@ -416,6 +415,7 @@ namespace osu.Game.Skinning
new LegacyScoreCounter(),
new LegacyAccuracyCounter(),
new LegacySongProgress(),
new LegacyHealthDisplay(),
new BarHitErrorMeter(),
}
};

View File

@ -23,7 +23,6 @@ using osu.Game.Database;
using osu.Game.IO;
using osu.Game.Rulesets;
using osu.Game.Screens.Play.HUD;
using osuTK;
namespace osu.Game.Skinning
{
@ -318,57 +317,6 @@ namespace osu.Game.Skinning
break;
}
case 2:
{
// Legacy health bar is moved from the global HUD components target into per-ruleset.
// On osu!mania, the health bar is moved from the HUD to Playfield target for stage-based positioning.
if (resources == null)
break;
var hudLayout = layoutInfos.GetValueOrDefault(GlobalSkinnableContainers.MainHUDComponents);
var playfieldLayout = layoutInfos.GetValueOrDefault(GlobalSkinnableContainers.Playfield);
if (hudLayout == null || !hudLayout.TryGetDrawableInfo(null, out var globalHUDComponents))
globalHUDComponents = Array.Empty<SerialisedDrawableInfo>();
var legacyHealthBars = globalHUDComponents.Where(h => h.Type.Name == nameof(LegacyHealthDisplay)).ToArray();
hudLayout?.Update(null, globalHUDComponents.Except(legacyHealthBars).ToArray());
resources.RealmAccess.Run(r =>
{
foreach (var ruleset in r.All<RulesetInfo>())
{
if (ruleset.ShortName == @"mania")
{
// should avoid adding legacy health bar to non-legacy skins (unless explicitly added by user).
if (!legacyHealthBars.Any())
break;
var legacyManiaHealthDisplay = new LegacyHealthDisplay
{
Rotation = -90f,
Anchor = Anchor.BottomRight,
Origin = Anchor.TopLeft,
X = 1,
Scale = new Vector2(0.7f),
}.CreateSerialisedInfo();
playfieldLayout?.Update(ruleset, playfieldLayout.TryGetDrawableInfo(ruleset, out var maniaPlayfieldComponents)
? maniaPlayfieldComponents.Append(legacyManiaHealthDisplay).ToArray()
: new[] { legacyManiaHealthDisplay });
}
else
{
hudLayout?.Update(ruleset, hudLayout.TryGetDrawableInfo(ruleset, out var rulesetHUDComponents)
? rulesetHUDComponents.Concat(legacyHealthBars).ToArray()
: legacyHealthBars);
}
}
});
break;
}
}
}

View File

@ -26,10 +26,9 @@ namespace osu.Game.Skinning
/// <list type="bullet">
/// <item><description>0: Initial version of all skin layouts.</description></item>
/// <item><description>1: Moves existing combo counters from global to per-ruleset HUD targets.</description></item>
/// <item><description>2: Moves existing legacy health bars from global to per-ruleset HUD targets, and to playfield target on mania.</description></item>
/// </list>
/// </remarks>
public const int LATEST_VERSION = 2;
public const int LATEST_VERSION = 1;
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int Version = LATEST_VERSION;