mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Fix banana colouring for skins
This commit is contained in:
parent
3eeb60f60f
commit
24e33abcbf
@ -1,6 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
||||||
{
|
{
|
||||||
public class DrawableBanana : DrawableFruit
|
public class DrawableBanana : DrawableFruit
|
||||||
@ -9,5 +13,35 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
AccentColour.BindValueChanged(accentChanged, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4? colour;
|
||||||
|
|
||||||
|
private void accentChanged(ValueChangedEvent<Color4> obj)
|
||||||
|
{
|
||||||
|
// override any external colour changes with banananana
|
||||||
|
AccentColour.Value = (colour ??= getBananaColour());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 getBananaColour()
|
||||||
|
{
|
||||||
|
switch (RNG.Next(0, 3))
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
return new Color4(255, 240, 0, 255);
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
return new Color4(255, 192, 0, 255);
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
return new Color4(214, 221, 28, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -250,8 +249,6 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
|
|
||||||
case FruitVisualRepresentation.Banana:
|
case FruitVisualRepresentation.Banana:
|
||||||
|
|
||||||
Color4 bananaColour = getBananaColour();
|
|
||||||
|
|
||||||
return new Container
|
return new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -259,13 +256,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = { Value = bananaColour },
|
AccentColour = { BindTarget = accentColour },
|
||||||
Size = new Vector2(small_pulp),
|
Size = new Vector2(small_pulp),
|
||||||
Y = -0.3f
|
Y = -0.3f
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = { Value = bananaColour },
|
AccentColour = { BindTarget = accentColour },
|
||||||
Size = new Vector2(large_pulp_4 * 0.8f, large_pulp_4 * 2.5f),
|
Size = new Vector2(large_pulp_4 * 0.8f, large_pulp_4 * 2.5f),
|
||||||
Y = 0.05f,
|
Y = 0.05f,
|
||||||
},
|
},
|
||||||
@ -273,20 +270,5 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 getBananaColour()
|
|
||||||
{
|
|
||||||
switch (RNG.Next(0, 3))
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
return new Color4(255, 240, 0, 255);
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
return new Color4(255, 192, 0, 255);
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
return new Color4(214, 221, 28, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user