1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 09:03:01 +08:00

Update in line with new changes

This commit is contained in:
Dean Herbert 2024-08-09 00:19:36 +09:00
parent e645651ef4
commit 80c814008f
No known key found for this signature in database
7 changed files with 93 additions and 85 deletions

View File

@ -4,7 +4,6 @@
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
@ -37,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
// Modifications for global components.
if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup) as Container;
return base.GetDrawableComponent(lookup);
// Skin has configuration.
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer d)

View File

@ -2,7 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -15,7 +14,7 @@ using osuTK.Graphics;
namespace osu.Game.Rulesets.Mania.Skinning.Argon
{
public class ManiaArgonSkinTransformer : ArgonSkinTransformer
public class ManiaArgonSkinTransformer : SkinTransformer
{
private readonly ManiaBeatmap beatmap;
@ -30,14 +29,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
switch (containerLookup.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents when containerLookup.Ruleset != null:
Debug.Assert(containerLookup.Ruleset.ShortName == ManiaRuleset.SHORT_NAME);
if (containerLookup.Target != SkinComponentsContainerLookup.TargetArea.MainHUDComponents)
return base.GetDrawableComponent(lookup);
var rulesetHUDComponents = Skin.GetDrawableComponent(lookup);
// Only handle per ruleset defaults here.
if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup);
rulesetHUDComponents ??= new DefaultSkinComponentsContainer(container =>
// Skin has configuration.
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer d)
return d;
return new DefaultSkinComponentsContainer(container =>
{
var combo = container.ChildrenOfType<ArgonManiaComboCounter>().FirstOrDefault();
@ -52,11 +55,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Argon
new ArgonManiaComboCounter(),
};
return rulesetHUDComponents;
}
break;
case GameplaySkinComponentLookup<HitResult> resultComponent:
// This should eventually be moved to a skin setting, when supported.
if (Skin is ArgonProSkin && resultComponent.Component >= HitResult.Great)

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Skinning;
@ -49,7 +48,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
private void updateAnchor()
{
// if the anchor isn't a vertical center, set top or bottom anchor based on scroll direction
if (!Anchor.HasFlagFast(Anchor.y1))
if (!Anchor.HasFlag(Anchor.y1))
{
Anchor &= ~(Anchor.y0 | Anchor.y2);
Anchor |= direction.Value == ScrollingDirection.Up ? Anchor.y2 : Anchor.y0;

View File

@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
@ -82,14 +81,18 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
switch (containerLookup.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents when containerLookup.Ruleset != null:
Debug.Assert(containerLookup.Ruleset.ShortName == ManiaRuleset.SHORT_NAME);
if (containerLookup.Target != SkinComponentsContainerLookup.TargetArea.MainHUDComponents)
return base.GetDrawableComponent(lookup);
var rulesetHUDComponents = Skin.GetDrawableComponent(lookup);
// Modifications for global components.
if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup);
rulesetHUDComponents ??= new DefaultSkinComponentsContainer(container =>
// Skin has configuration.
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer d)
return d;
return new DefaultSkinComponentsContainer(container =>
{
var combo = container.ChildrenOfType<LegacyManiaComboCounter>().FirstOrDefault();
@ -104,11 +107,6 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
new LegacyManiaComboCounter(),
};
return rulesetHUDComponents;
}
break;
case GameplaySkinComponentLookup<HitResult> resultComponent:
return getResult(resultComponent.Component);

View File

@ -45,6 +45,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
if (containerLookup.Target != SkinComponentsContainerLookup.TargetArea.MainHUDComponents)
return base.GetDrawableComponent(lookup);
// Only handle per ruleset defaults here.
if (containerLookup.Ruleset == null)
return base.GetDrawableComponent(lookup);
@ -53,10 +56,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer d)
return d;
// Our own ruleset components default.
switch (containerLookup.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
return new DefaultSkinComponentsContainer(container =>
{
var keyCounter = container.OfType<LegacyKeyCounterDisplay>().FirstOrDefault();
@ -70,17 +69,23 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
// 340px is the default height inherit from stable
keyCounter.Y = container.ToLocalSpace(new Vector2(0, container.ScreenSpaceDrawQuad.Centre.Y - 340f)).Y;
}
var combo = container.OfType<LegacyDefaultComboCounter>().FirstOrDefault();
if (combo != null)
{
combo.Anchor = Anchor.BottomLeft;
combo.Origin = Anchor.BottomLeft;
combo.Scale = new Vector2(1.28f);
}
})
{
Children = new Drawable[]
{
new LegacyComboCounter(),
new LegacyDefaultComboCounter(),
new LegacyKeyCounterDisplay(),
}
};
}
return null;
case OsuSkinComponentLookup osuComponent:
switch (osuComponent.Component)

View File

@ -443,7 +443,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddAssert("no combo in global target", () => !globalHUDTarget.Components.OfType<LegacyComboCounter>().Any());
AddAssert("combo placed in ruleset target", () => rulesetHUDTarget.Components.OfType<LegacyComboCounter>().Count() == 1);
AddStep("add combo to global target", () => globalHUDTarget.Add(new LegacyComboCounter
AddStep("add combo to global target", () => globalHUDTarget.Add(new LegacyDefaultComboCounter
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -13,7 +13,6 @@ using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Audio;
@ -24,6 +23,7 @@ using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Scoring;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Play.HUD.HitErrorMeters;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Skinning
@ -367,10 +367,19 @@ namespace osu.Game.Skinning
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
if (containerLookup.Ruleset != null)
{
return new Container
return new DefaultSkinComponentsContainer(container =>
{
RelativeSizeAxes = Axes.Both,
Child = new LegacyComboCounter(),
var combo = container.OfType<LegacyDefaultComboCounter>().FirstOrDefault();
if (combo != null)
{
combo.Anchor = Anchor.BottomLeft;
combo.Origin = Anchor.BottomLeft;
combo.Scale = new Vector2(1.28f);
}
})
{
new LegacyDefaultComboCounter()
};
}