// 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 JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Mania.UI; using osu.Game.Skinning; namespace osu.Game.Rulesets.Mania.Skinning { /// /// A which is placed somewhere within a . /// public class LegacyManiaColumnElement : CompositeDrawable { [Resolved(CanBeNull = true)] [CanBeNull] protected ManiaStage Stage { get; private set; } [Resolved] protected Column Column { get; private set; } /// /// The column index to use for texture lookups, in the case of no user-provided configuration. /// protected int FallbackColumnIndex { get; private set; } [BackgroundDependencyLoader] private void load() { if (Stage == null) FallbackColumnIndex = Column.Index % 2 + 1; else { int dist = Math.Min(Column.Index, Stage.Columns.Count - Column.Index - 1); FallbackColumnIndex = dist % 2 + 1; } } /// /// Retrieve a per-column skin configuration. /// /// The skin from which configuration is retrieved. /// The value to retrieve. /// The index of the column to which the entry applies. protected IBindable GetManiaSkinConfig(ISkin skin, LegacyManiaSkinConfigurationLookups lookup, int? index = null) => skin.GetConfig( new LegacyManiaSkinConfigurationLookup(Stage?.Columns.Count ?? 4, lookup, index ?? Column.Index)); } }