// 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.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Skinning; using osuTK.Graphics; namespace osu.Game.Rulesets.Mania.Skinning.Default { public class ManiaTrianglesSkinTransformer : SkinTransformer { private readonly ManiaBeatmap beatmap; public ManiaTrianglesSkinTransformer(ISkin skin, IBeatmap beatmap) : base(skin) { this.beatmap = (ManiaBeatmap)beatmap; } private readonly Color4 colourEven = new Color4(6, 84, 0, 255); private readonly Color4 colourOdd = new Color4(94, 0, 57, 255); private readonly Color4 colourSpecial = new Color4(0, 48, 63, 255); public override IBindable? GetConfig(TLookup lookup) { if (lookup is ManiaSkinConfigurationLookup maniaLookup) { switch (maniaLookup.Lookup) { case LegacyManiaSkinConfigurationLookups.ColumnBackgroundColour: int column = maniaLookup.ColumnIndex ?? 0; var stage = beatmap.GetStageForColumnIndex(column); int columnInStage = column % stage.Columns; if (stage.IsSpecialColumn(columnInStage)) return SkinUtils.As(new Bindable(colourSpecial)); int distanceToEdge = Math.Min(columnInStage, (stage.Columns - 1) - columnInStage); return SkinUtils.As(new Bindable(distanceToEdge % 2 == 0 ? colourOdd : colourEven)); } } return base.GetConfig(lookup); } } }