mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Make AccentColour a bindable
This commit is contained in:
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
if (HitObject is IHasComboInformation combo)
|
if (HitObject is IHasComboInformation combo)
|
||||||
AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White;
|
AccentColour.Value = skin.GetValue<SkinConfiguration, Color4?>(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateState(ArmedState state)
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
using osu.Game.Rulesets.Catch.Objects.Drawable.Pieces;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
||||||
{
|
{
|
||||||
@ -27,16 +26,8 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
AddInternal(pulp = new Pulp { Size = Size });
|
AddInternal(pulp = new Pulp { Size = Size });
|
||||||
}
|
|
||||||
|
|
||||||
public override Color4 AccentColour
|
AccentColour.BindValueChanged(colour => { pulp.AccentColour = colour.NewValue; }, true);
|
||||||
{
|
|
||||||
get => base.AccentColour;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.AccentColour = value;
|
|
||||||
pulp.AccentColour = AccentColour;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
// todo: this should come from the skin.
|
// todo: this should come from the skin.
|
||||||
AccentColour = colourForRepresentation(HitObject.VisualRepresentation);
|
AccentColour.Value = colourForRepresentation(HitObject.VisualRepresentation);
|
||||||
|
|
||||||
AddRangeInternal(new[]
|
AddRangeInternal(new[]
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
Hollow = !HitObject.HyperDash,
|
Hollow = !HitObject.HyperDash,
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Radius = 4 * radius_adjust,
|
Radius = 4 * radius_adjust,
|
||||||
Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Darken(1).Opacity(0.6f)
|
Colour = HitObject.HyperDash ? Color4.Red : AccentColour.Value.Darken(1).Opacity(0.6f)
|
||||||
},
|
},
|
||||||
Size = new Vector2(Height),
|
Size = new Vector2(Height),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
AlwaysPresent = true,
|
AlwaysPresent = true,
|
||||||
Colour = AccentColour,
|
Colour = AccentColour.Value,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
RelativeSizeAxes = Axes.Both
|
RelativeSizeAxes = Axes.Both
|
||||||
}
|
}
|
||||||
@ -115,32 +115,32 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(small_pulp),
|
Size = new Vector2(small_pulp),
|
||||||
Y = -0.34f,
|
Y = -0.34f,
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
Position = positionAt(0, distance_from_centre_4),
|
Position = positionAt(0, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
Position = positionAt(90, distance_from_centre_4),
|
Position = positionAt(90, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
Position = positionAt(180, distance_from_centre_4),
|
Position = positionAt(180, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Position = positionAt(270, distance_from_centre_4),
|
Position = positionAt(270, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -154,32 +154,32 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(small_pulp),
|
Size = new Vector2(small_pulp),
|
||||||
Y = -0.3f,
|
Y = -0.3f,
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
Position = positionAt(45, distance_from_centre_4),
|
Position = positionAt(45, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
Position = positionAt(135, distance_from_centre_4),
|
Position = positionAt(135, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
Position = positionAt(225, distance_from_centre_4),
|
Position = positionAt(225, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
Size = new Vector2(large_pulp_4),
|
Size = new Vector2(large_pulp_4),
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Position = positionAt(315, distance_from_centre_4),
|
Position = positionAt(315, distance_from_centre_4),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -193,26 +193,26 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(small_pulp),
|
Size = new Vector2(small_pulp),
|
||||||
Y = -0.33f,
|
Y = -0.33f,
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_3),
|
Size = new Vector2(large_pulp_3),
|
||||||
Position = positionAt(60, distance_from_centre_3),
|
Position = positionAt(60, distance_from_centre_3),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_3),
|
Size = new Vector2(large_pulp_3),
|
||||||
Position = positionAt(180, distance_from_centre_3),
|
Position = positionAt(180, distance_from_centre_3),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
Size = new Vector2(large_pulp_3),
|
Size = new Vector2(large_pulp_3),
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Position = positionAt(300, distance_from_centre_3),
|
Position = positionAt(300, distance_from_centre_3),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -226,26 +226,26 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(small_pulp),
|
Size = new Vector2(small_pulp),
|
||||||
Y = -0.25f,
|
Y = -0.25f,
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_3),
|
Size = new Vector2(large_pulp_3),
|
||||||
Position = positionAt(0, distance_from_centre_3),
|
Position = positionAt(0, distance_from_centre_3),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(large_pulp_3),
|
Size = new Vector2(large_pulp_3),
|
||||||
Position = positionAt(120, distance_from_centre_3),
|
Position = positionAt(120, distance_from_centre_3),
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
Size = new Vector2(large_pulp_3),
|
Size = new Vector2(large_pulp_3),
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Position = positionAt(240, distance_from_centre_3),
|
Position = positionAt(240, distance_from_centre_3),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -259,13 +259,13 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
{
|
{
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
Size = new Vector2(small_pulp),
|
Size = new Vector2(small_pulp),
|
||||||
Y = -0.3f
|
Y = -0.3f
|
||||||
},
|
},
|
||||||
new Pulp
|
new Pulp
|
||||||
{
|
{
|
||||||
AccentColour = AccentColour,
|
AccentColour = AccentColour.Value,
|
||||||
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,
|
||||||
},
|
},
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
Child = drawableObject = new DrawableHoldNote(holdNote)
|
Child = drawableObject = new DrawableHoldNote(holdNote)
|
||||||
{
|
{
|
||||||
Height = 300,
|
Height = 300,
|
||||||
AccentColour = OsuColour.Gray(0.3f)
|
AccentColour = { Value = OsuColour.Gray(0.3f) }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Child = new NoteContainer(direction, $"note {identifier}, scrolling {direction.ToString().ToLowerInvariant()}")
|
Child = new NoteContainer(direction, $"note {identifier}, scrolling {direction.ToString().ToLowerInvariant()}")
|
||||||
{
|
{
|
||||||
Child = hitObject = new DrawableNote(note) { AccentColour = Color4.OrangeRed }
|
Child = hitObject = new DrawableNote(note) { AccentColour = { Value = Color4.OrangeRed } }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
Child = hitObject = new DrawableHoldNote(note)
|
Child = hitObject = new DrawableHoldNote(note)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
AccentColour = Color4.OrangeRed,
|
AccentColour = { Value = Color4.OrangeRed },
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,6 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -36,11 +35,10 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool hasBroken;
|
private bool hasBroken;
|
||||||
|
|
||||||
private readonly Container<DrawableHoldNoteTick> tickContainer;
|
|
||||||
|
|
||||||
public DrawableHoldNote(HoldNote hitObject)
|
public DrawableHoldNote(HoldNote hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
|
Container<DrawableHoldNoteTick> tickContainer;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
@ -74,6 +72,14 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
|
|
||||||
AddNested(Head);
|
AddNested(Head);
|
||||||
AddNested(Tail);
|
AddNested(Tail);
|
||||||
|
|
||||||
|
AccentColour.BindValueChanged(colour =>
|
||||||
|
{
|
||||||
|
bodyPiece.AccentColour = colour.NewValue;
|
||||||
|
Head.AccentColour.Value = colour.NewValue;
|
||||||
|
Tail.AccentColour.Value = colour.NewValue;
|
||||||
|
tickContainer.ForEach(t => t.AccentColour.Value = colour.NewValue);
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
||||||
@ -83,20 +89,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
bodyPiece.Anchor = bodyPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
|
bodyPiece.Anchor = bodyPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
|
||||||
{
|
|
||||||
get => base.AccentColour;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.AccentColour = value;
|
|
||||||
|
|
||||||
bodyPiece.AccentColour = value;
|
|
||||||
Head.AccentColour = value;
|
|
||||||
Tail.AccentColour = value;
|
|
||||||
tickContainer.ForEach(t => t.AccentColour = value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (Tail.AllJudged)
|
if (Tail.AllJudged)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -23,11 +22,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Func<double?> HoldStartTime;
|
public Func<double?> HoldStartTime;
|
||||||
|
|
||||||
private readonly Container glowContainer;
|
|
||||||
|
|
||||||
public DrawableHoldNoteTick(HoldNoteTick hitObject)
|
public DrawableHoldNoteTick(HoldNoteTick hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
|
Container glowContainer;
|
||||||
|
|
||||||
Anchor = Anchor.TopCentre;
|
Anchor = Anchor.TopCentre;
|
||||||
Origin = Anchor.TopCentre;
|
Origin = Anchor.TopCentre;
|
||||||
|
|
||||||
@ -53,23 +52,17 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
public override Color4 AccentColour
|
AccentColour.BindValueChanged(colour =>
|
||||||
{
|
|
||||||
get => base.AccentColour;
|
|
||||||
set
|
|
||||||
{
|
{
|
||||||
base.AccentColour = value;
|
|
||||||
|
|
||||||
glowContainer.EdgeEffect = new EdgeEffectParameters
|
glowContainer.EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Radius = 2f,
|
Radius = 2f,
|
||||||
Roundness = 15f,
|
Roundness = 15f,
|
||||||
Colour = value.Opacity(0.3f)
|
Colour = colour.NewValue.Opacity(0.3f)
|
||||||
};
|
};
|
||||||
}
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
@ -30,6 +29,18 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
AddInternal(headPiece = new NotePiece());
|
AddInternal(headPiece = new NotePiece());
|
||||||
|
|
||||||
|
AccentColour.BindValueChanged(colour =>
|
||||||
|
{
|
||||||
|
headPiece.AccentColour = colour.NewValue;
|
||||||
|
|
||||||
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Type = EdgeEffectType.Glow,
|
||||||
|
Colour = colour.NewValue.Lighten(1f).Opacity(0.6f),
|
||||||
|
Radius = 10,
|
||||||
|
};
|
||||||
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
protected override void OnDirectionChanged(ValueChangedEvent<ScrollingDirection> e)
|
||||||
@ -39,23 +50,6 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
headPiece.Anchor = headPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
headPiece.Anchor = headPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Color4 AccentColour
|
|
||||||
{
|
|
||||||
get => base.AccentColour;
|
|
||||||
set
|
|
||||||
{
|
|
||||||
base.AccentColour = value;
|
|
||||||
headPiece.AccentColour = AccentColour;
|
|
||||||
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Type = EdgeEffectType.Glow,
|
|
||||||
Colour = AccentColour.Lighten(1f).Opacity(0.6f),
|
|
||||||
Radius = 10,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
{
|
{
|
||||||
if (!userTriggered)
|
if (!userTriggered)
|
||||||
|
@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
/// <param name="hitObject">The DrawableHitObject to add.</param>
|
/// <param name="hitObject">The DrawableHitObject to add.</param>
|
||||||
public override void Add(DrawableHitObject hitObject)
|
public override void Add(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
hitObject.AccentColour = AccentColour;
|
hitObject.AccentColour.Value = AccentColour;
|
||||||
hitObject.OnNewResult += OnNewResult;
|
hitObject.OnNewResult += OnNewResult;
|
||||||
|
|
||||||
HitObjectContainer.Add(hitObject);
|
HitObjectContainer.Add(hitObject);
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Glow,
|
Type = EdgeEffectType.Glow,
|
||||||
Colour = Interpolation.ValueAt(0.1f, judgedObject.AccentColour, Color4.White, 0, 1),
|
Colour = Interpolation.ValueAt(0.1f, judgedObject.AccentColour.Value, Color4.White, 0, 1),
|
||||||
Radius = 100,
|
Radius = 100,
|
||||||
},
|
},
|
||||||
Child = new Box
|
Child = new Box
|
||||||
|
@ -10,7 +10,6 @@ using osu.Game.Rulesets.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -98,19 +97,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
positionBindable.BindTo(HitObject.PositionBindable);
|
positionBindable.BindTo(HitObject.PositionBindable);
|
||||||
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
stackHeightBindable.BindTo(HitObject.StackHeightBindable);
|
||||||
scaleBindable.BindTo(HitObject.ScaleBindable);
|
scaleBindable.BindTo(HitObject.ScaleBindable);
|
||||||
}
|
|
||||||
|
|
||||||
public override Color4 AccentColour
|
AccentColour.BindValueChanged(colour =>
|
||||||
{
|
|
||||||
get => base.AccentColour;
|
|
||||||
set
|
|
||||||
{
|
{
|
||||||
base.AccentColour = value;
|
explode.Colour = colour.NewValue;
|
||||||
explode.Colour = AccentColour;
|
glow.Colour = colour.NewValue;
|
||||||
glow.Colour = AccentColour;
|
circle.Colour = colour.NewValue;
|
||||||
circle.Colour = AccentColour;
|
ApproachCircle.Colour = colour.NewValue;
|
||||||
ApproachCircle.Colour = AccentColour;
|
}, true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 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 System;
|
using System;
|
||||||
@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
if (HitObject is IHasComboInformation combo)
|
if (HitObject is IHasComboInformation combo)
|
||||||
AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White;
|
AccentColour.Value = skin.GetValue<SkinConfiguration, Color4?>(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadeIn);
|
protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadeIn);
|
||||||
|
@ -114,20 +114,15 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
pathBindable.BindTo(slider.PathBindable);
|
pathBindable.BindTo(slider.PathBindable);
|
||||||
|
|
||||||
pathBindable.BindValueChanged(_ => Body.Refresh());
|
pathBindable.BindValueChanged(_ => Body.Refresh());
|
||||||
}
|
|
||||||
|
|
||||||
public override Color4 AccentColour
|
AccentColour.BindValueChanged(colour =>
|
||||||
{
|
|
||||||
get => base.AccentColour;
|
|
||||||
set
|
|
||||||
{
|
{
|
||||||
base.AccentColour = value;
|
Body.AccentColour = colour.NewValue;
|
||||||
Body.AccentColour = AccentColour;
|
Ball.AccentColour = colour.NewValue;
|
||||||
Ball.AccentColour = AccentColour;
|
|
||||||
|
|
||||||
foreach (var drawableHitObject in NestedHitObjects)
|
foreach (var drawableHitObject in NestedHitObjects)
|
||||||
drawableHitObject.AccentColour = AccentColour;
|
drawableHitObject.AccentColour.Value = colour.NewValue;
|
||||||
}
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly Bindable<bool> Tracking = new Bindable<bool>();
|
public readonly Bindable<bool> Tracking = new Bindable<bool>();
|
||||||
@ -167,9 +162,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
base.SkinChanged(skin, allowFallback);
|
base.SkinChanged(skin, allowFallback);
|
||||||
|
|
||||||
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
|
Body.BorderSize = skin.GetValue<SkinConfiguration, float?>(s => s.SliderBorderSize) ?? SliderBody.DEFAULT_BORDER_SIZE;
|
||||||
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour;
|
Body.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderTrackOverride") ? s.CustomColours["SliderTrackOverride"] : (Color4?)null) ?? AccentColour.Value;
|
||||||
Body.BorderColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White;
|
Body.BorderColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBorder") ? s.CustomColours["SliderBorder"] : (Color4?)null) ?? Color4.White;
|
||||||
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour;
|
Ball.AccentColour = skin.GetValue<SkinConfiguration, Color4?>(s => s.CustomColours.ContainsKey("SliderBall") ? s.CustomColours["SliderBall"] : (Color4?)null) ?? AccentColour.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||||
|
@ -34,6 +34,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
CornerRadius = Size.X / 2,
|
CornerRadius = Size.X / 2,
|
||||||
|
Colour = AccentColour.Value,
|
||||||
|
|
||||||
BorderThickness = 2,
|
BorderThickness = 2,
|
||||||
BorderColour = Color4.White,
|
BorderColour = Color4.White,
|
||||||
@ -41,7 +42,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
Child = new Box
|
Child = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = AccentColour,
|
Colour = AccentColour.Value,
|
||||||
Alpha = 0.3f,
|
Alpha = 0.3f,
|
||||||
}
|
}
|
||||||
}, restrictSize: false)
|
}, restrictSize: false)
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -18,14 +17,14 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Objects.Drawables
|
namespace osu.Game.Rulesets.Objects.Drawables
|
||||||
{
|
{
|
||||||
public abstract class DrawableHitObject : SkinReloadableDrawable, IHasAccentColour
|
public abstract class DrawableHitObject : SkinReloadableDrawable
|
||||||
{
|
{
|
||||||
public readonly HitObject HitObject;
|
public readonly HitObject HitObject;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The colour used for various elements of this DrawableHitObject.
|
/// The colour used for various elements of this DrawableHitObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Color4 AccentColour { get; set; } = Color4.Gray;
|
public readonly Bindable<Color4> AccentColour = new Bindable<Color4>(Color4.Gray);
|
||||||
|
|
||||||
// Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first
|
// Todo: Rulesets should be overriding the resources instead, but we need to figure out where/when to apply overrides first
|
||||||
protected virtual string SampleNamespace => null;
|
protected virtual string SampleNamespace => null;
|
||||||
|
Reference in New Issue
Block a user