2022-10-04 18:50:55 +08:00
|
|
|
// 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.Bindables;
|
2022-10-06 13:51:17 +08:00
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
2022-10-04 18:50:55 +08:00
|
|
|
using osu.Game.Skinning;
|
|
|
|
using osuTK.Graphics;
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Skinning.Default
|
|
|
|
{
|
|
|
|
public class ManiaTrianglesSkinTransformer : SkinTransformer
|
|
|
|
{
|
2022-10-06 13:51:17 +08:00
|
|
|
private readonly ManiaBeatmap beatmap;
|
|
|
|
|
|
|
|
public ManiaTrianglesSkinTransformer(ISkin skin, IBeatmap beatmap)
|
2022-10-04 18:50:55 +08:00
|
|
|
: base(skin)
|
|
|
|
{
|
2022-10-06 13:51:17 +08:00
|
|
|
this.beatmap = (ManiaBeatmap)beatmap;
|
2022-10-04 18:50:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
|
|
|
|
{
|
|
|
|
if (lookup is ManiaSkinConfigurationLookup maniaLookup)
|
|
|
|
{
|
|
|
|
switch (maniaLookup.Lookup)
|
|
|
|
{
|
|
|
|
case LegacyManiaSkinConfigurationLookups.ColumnBackgroundColour:
|
|
|
|
int column = maniaLookup.ColumnIndex ?? 0;
|
|
|
|
|
2022-10-06 13:51:17 +08:00
|
|
|
var stage = beatmap.GetStageForColumnIndex(column);
|
|
|
|
|
|
|
|
if (stage.IsSpecialColumn(column))
|
2022-10-04 18:50:55 +08:00
|
|
|
return SkinUtils.As<TValue>(new Bindable<Color4>(colourSpecial));
|
|
|
|
|
2022-10-06 13:51:17 +08:00
|
|
|
int distanceToEdge = Math.Min(column, (stage.Columns - 1) - column);
|
2022-10-04 18:50:55 +08:00
|
|
|
return SkinUtils.As<TValue>(new Bindable<Color4>(distanceToEdge % 2 == 0 ? colourOdd : colourEven));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return base.GetConfig<TLookup, TValue>(lookup);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|