1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

fetch ScorePosition from the skin

This commit is contained in:
Firmatorenio 2020-12-13 19:59:34 +06:00
parent 60379b09db
commit f14e49c72e
3 changed files with 49 additions and 9 deletions

View File

@ -8,16 +8,33 @@ namespace osu.Game.Rulesets.Mania.UI
{
public class DrawableManiaJudgementAdjustmentContainer : JudgementContainer<DrawableManiaJudgement>
{
private float scorePosition => 0;
public DrawableManiaJudgementAdjustmentContainer(float hitTargetPosition)
private float hitTargetPosition = 110;
private float scorePosition;
public float HitTargetPosition
{
get => hitTargetPosition;
set
{
hitTargetPosition = value;
Y = value + scorePosition + 150;
}
}
public float ScorePosition
{
set
{
scorePosition = value;
Y = hitTargetPosition + value + 150;
}
}
public DrawableManiaJudgementAdjustmentContainer()
{
Anchor = Anchor.TopCentre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
Y = hitTargetPosition + 150;
}
public DrawableManiaJudgementAdjustmentContainer()
: this(110) { }
}
}

View File

@ -10,6 +10,7 @@ using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Mania.Skinning;
using osu.Game.Rulesets.Mania.UI.Components;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
@ -32,7 +33,7 @@ namespace osu.Game.Rulesets.Mania.UI
public IReadOnlyList<Column> Columns => columnFlow.Content;
private readonly ColumnFlow<Column> columnFlow;
private readonly JudgementContainer<DrawableManiaJudgement> judgements;
private DrawableManiaJudgementAdjustmentContainer judgements;
private readonly DrawablePool<DrawableManiaJudgement> judgementPool;
private readonly Drawable barLineContainer;
@ -101,7 +102,10 @@ namespace osu.Game.Rulesets.Mania.UI
{
RelativeSizeAxes = Axes.Both
},
judgements = new DrawableManiaJudgementAdjustmentContainer(HIT_TARGET_POSITION),
judgements = new DrawableManiaJudgementAdjustmentContainer()
{
HitTargetPosition = HIT_TARGET_POSITION,
},
topLevelContainer = new Container { RelativeSizeAxes = Axes.Both }
}
}
@ -175,6 +179,13 @@ namespace osu.Game.Rulesets.Mania.UI
}));
}
protected override void OnSkinChanged()
{
judgements.ScorePosition = CurrentSkin.GetConfig<ManiaSkinConfigurationLookup, float>(
new ManiaSkinConfigurationLookup(LegacyManiaSkinConfigurationLookups.ScorePosition))
?.Value ?? 0;
}
protected override void Update()
{
// Due to masking differences, it is not possible to get the width of the columns container automatically

View File

@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.UI.Scrolling
@ -18,10 +19,21 @@ namespace osu.Game.Rulesets.UI.Scrolling
[Resolved]
protected IScrollingInfo ScrollingInfo { get; private set; }
protected ISkinSource CurrentSkin;
[BackgroundDependencyLoader]
private void load()
private void load(ISkinSource skin)
{
Direction.BindTo(ScrollingInfo.Direction);
CurrentSkin = skin;
skin.SourceChanged += OnSkinChanged;
OnSkinChanged();
}
protected virtual void OnSkinChanged()
{
}
/// <summary>