mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:23:22 +08:00
convert older elements to LegacyManiaColumnElement
Also added xmldoc for new shorthand method.
This commit is contained in:
parent
5179635b2d
commit
ec3d21e2b7
@ -16,19 +16,13 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Skinning
|
||||
{
|
||||
public class LegacyColumnBackground : CompositeDrawable, IKeyBindingHandler<ManiaAction>
|
||||
public class LegacyColumnBackground : LegacyManiaColumnElement, IKeyBindingHandler<ManiaAction>
|
||||
{
|
||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||
|
||||
private Container lightContainer;
|
||||
private Sprite light;
|
||||
|
||||
[Resolved]
|
||||
private Column column { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private ManiaStage stage { get; set; }
|
||||
|
||||
public LegacyColumnBackground()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
@ -38,19 +32,19 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
|
||||
{
|
||||
string lightImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>(
|
||||
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LightImage, 0))?.Value
|
||||
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LightImage, 0))?.Value
|
||||
?? "mania-stage-light";
|
||||
|
||||
float leftLineWidth = skin.GetConfig<LegacyManiaSkinConfigurationLookup, float>(
|
||||
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LeftLineWidth, column.Index))
|
||||
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.LeftLineWidth, Column.Index))
|
||||
?.Value ?? 1;
|
||||
float rightLineWidth = skin.GetConfig<LegacyManiaSkinConfigurationLookup, float>(
|
||||
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.RightLineWidth, column.Index))
|
||||
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.RightLineWidth, Column.Index))
|
||||
?.Value ?? 1;
|
||||
|
||||
bool hasLeftLine = leftLineWidth > 0;
|
||||
bool hasRightLine = rightLineWidth > 0 && skin.GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value >= 2.4m
|
||||
|| stage == null || column.Index == stage.Columns.Count - 1;
|
||||
|| Stage == null || Column.Index == Stage.Columns.Count - 1;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -109,7 +103,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
|
||||
public bool OnPressed(ManiaAction action)
|
||||
{
|
||||
if (action == column.Action.Value)
|
||||
if (action == Column.Action.Value)
|
||||
{
|
||||
light.FadeIn();
|
||||
light.ScaleTo(Vector2.One);
|
||||
@ -123,7 +117,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
// Todo: Should be 400 * 100 / CurrentBPM
|
||||
const double animation_length = 250;
|
||||
|
||||
if (action == column.Action.Value)
|
||||
if (action == Column.Action.Value)
|
||||
{
|
||||
light.FadeTo(0, animation_length);
|
||||
light.ScaleTo(new Vector2(1, 0), animation_length);
|
||||
|
@ -14,13 +14,10 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Skinning
|
||||
{
|
||||
public class LegacyHitTarget : CompositeDrawable
|
||||
public class LegacyHitTarget : LegacyManiaColumnElement
|
||||
{
|
||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private ManiaStage stage { get; set; }
|
||||
|
||||
private Container directionContainer;
|
||||
|
||||
public LegacyHitTarget()
|
||||
@ -32,11 +29,11 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
private void load(ISkinSource skin, IScrollingInfo scrollingInfo)
|
||||
{
|
||||
string targetImage = skin.GetConfig<LegacyManiaSkinConfigurationLookup, string>(
|
||||
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.HitTargetImage))?.Value
|
||||
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.HitTargetImage))?.Value
|
||||
?? "mania-stage-hint";
|
||||
|
||||
bool showJudgementLine = skin.GetConfig<LegacyManiaSkinConfigurationLookup, bool>(
|
||||
new LegacyManiaSkinConfigurationLookup(stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.ShowJudgementLine))?.Value
|
||||
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, LegacyManiaSkinConfigurationLookups.ShowJudgementLine))?.Value
|
||||
?? true;
|
||||
|
||||
InternalChild = directionContainer = new Container
|
||||
|
@ -40,7 +40,12 @@ namespace osu.Game.Rulesets.Mania.Skinning
|
||||
}
|
||||
}
|
||||
|
||||
protected IBindable<T> GetManiaSkinConfig<T>(ISkinSource skin, LegacyManiaSkinConfigurationLookups lookup)
|
||||
/// <summary>
|
||||
/// Retrieve a per-column skin configuration.
|
||||
/// </summary>
|
||||
/// <param name="skin">The skin from which configuration is retrieved.</param>
|
||||
/// <param name="lookup">The value to retrieve.</param>
|
||||
protected IBindable<T> GetManiaSkinConfig<T>(ISkin skin, LegacyManiaSkinConfigurationLookups lookup)
|
||||
=> skin.GetConfig<LegacyManiaSkinConfigurationLookup, T>(
|
||||
new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, Column.Index));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user