1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-25 16:12:55 +08:00
osu-lazer/osu.Game.Rulesets.Mania/Skinning/Legacy/LegacyManiaColumnElement.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

48 lines
1.8 KiB
C#
Raw Normal View History

// 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 System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
2020-03-31 22:58:04 +08:00
using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Skinning;
2020-12-07 11:32:52 +08:00
namespace osu.Game.Rulesets.Mania.Skinning.Legacy
{
/// <summary>
/// A <see cref="CompositeDrawable"/> which is placed somewhere within a <see cref="Column"/>.
/// </summary>
public partial class LegacyManiaColumnElement : CompositeDrawable
{
[Resolved]
protected Column Column { get; private set; } = null!;
[Resolved]
private StageDefinition stage { get; set; } = null!;
/// <summary>
2020-03-31 22:58:04 +08:00
/// The column type identifier to use for texture lookups, in the case of no user-provided configuration.
/// </summary>
protected string FallbackColumnIndex { get; private set; } = null!;
[BackgroundDependencyLoader]
private void load()
{
if (Column.IsSpecial)
FallbackColumnIndex = "S";
else
2020-04-01 10:59:34 +08:00
{
// Account for cases like dual-stage (assume that all stages have the same column count for now).
int columnInStage = Column.Index % stage.Columns;
int distanceToEdge = Math.Min(columnInStage, (stage.Columns - 1) - columnInStage);
FallbackColumnIndex = distanceToEdge % 2 == 0 ? "1" : "2";
2020-04-01 10:59:34 +08:00
}
}
protected IBindable<T>? GetColumnSkinConfig<T>(ISkin skin, LegacyManiaSkinConfigurationLookups lookup) where T : notnull
=> skin.GetManiaSkinConfig<T>(lookup, Column.Index);
}
}