// Copyright (c) ppy Pty Ltd . 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; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.UI; using osu.Game.Skinning; namespace osu.Game.Rulesets.Mania.Skinning.Legacy { /// /// A which is placed somewhere within a . /// public partial class LegacyManiaColumnElement : CompositeDrawable { [Resolved] protected Column Column { get; private set; } = null!; [Resolved] private StageDefinition stage { get; set; } = null!; /// /// The column type identifier to use for texture lookups, in the case of no user-provided configuration. /// protected string FallbackColumnIndex { get; private set; } = null!; [BackgroundDependencyLoader] private void load() { if (Column.IsSpecial) FallbackColumnIndex = "S"; else { // 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"; } } protected IBindable? GetColumnSkinConfig(ISkin skin, LegacyManiaSkinConfigurationLookups lookup) where T : notnull => skin.GetManiaSkinConfig(lookup, Column.Index); } }