1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-07 13:47:33 +08:00

Merge pull request #541 from smoogipooo/use_more_accentcolour

Use more accentcolour
This commit is contained in:
Dean Herbert 2017-03-23 17:42:50 +09:00 committed by GitHub
commit 6e42a75fca
9 changed files with 67 additions and 36 deletions

View File

@ -44,11 +44,8 @@ namespace osu.Game.Modes.Osu.Beatmaps
{ {
StartTime = original.StartTime, StartTime = original.StartTime,
Sample = original.Sample, Sample = original.Sample,
CurveObject = curveData, CurveObject = curveData,
Position = positionData?.Position ?? Vector2.Zero, Position = positionData?.Position ?? Vector2.Zero,
NewCombo = comboData?.NewCombo ?? false NewCombo = comboData?.NewCombo ?? false
}; };
} }
@ -60,7 +57,6 @@ namespace osu.Game.Modes.Osu.Beatmaps
StartTime = original.StartTime, StartTime = original.StartTime,
Sample = original.Sample, Sample = original.Sample,
Position = new Vector2(512, 384) / 2, Position = new Vector2(512, 384) / 2,
EndTime = endTimeData.EndTime EndTime = endTimeData.EndTime
}; };
} }
@ -69,9 +65,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
{ {
StartTime = original.StartTime, StartTime = original.StartTime,
Sample = original.Sample, Sample = original.Sample,
Position = positionData?.Position ?? Vector2.Zero, Position = positionData?.Position ?? Vector2.Zero,
NewCombo = comboData?.NewCombo ?? false NewCombo = comboData?.NewCombo ?? false
}; };
} }

View File

@ -13,8 +13,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
{ {
private readonly OsuHitObject osuObject;
public ApproachCircle ApproachCircle; public ApproachCircle ApproachCircle;
private readonly CirclePiece circle; private readonly CirclePiece circle;
private readonly RingPiece ring; private readonly RingPiece ring;
@ -27,20 +25,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
Origin = Anchor.Centre; Origin = Anchor.Centre;
osuObject = h; Position = HitObject.StackedPosition;
Scale = new Vector2(HitObject.Scale);
Position = osuObject.StackedPosition;
Scale = new Vector2(osuObject.Scale);
Children = new Drawable[] Children = new Drawable[]
{ {
glow = new GlowPiece glow = new GlowPiece
{ {
Colour = osuObject.ComboColour Colour = AccentColour
}, },
circle = new CirclePiece circle = new CirclePiece
{ {
Colour = osuObject.ComboColour, Colour = AccentColour,
Hit = () => Hit = () =>
{ {
if (Judgement.Result.HasValue) return false; if (Judgement.Result.HasValue) return false;
@ -58,11 +54,11 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
flash = new FlashPiece(), flash = new FlashPiece(),
explode = new ExplodePiece explode = new ExplodePiece
{ {
Colour = osuObject.ComboColour, Colour = AccentColour,
}, },
ApproachCircle = new ApproachCircle ApproachCircle = new ApproachCircle
{ {
Colour = osuObject.ComboColour, Colour = AccentColour,
} }
}; };
@ -115,8 +111,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
ApproachCircle.FadeOut(); ApproachCircle.FadeOut();
double endTime = (osuObject as IHasEndTime)?.EndTime ?? osuObject.StartTime; double endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
double duration = endTime - osuObject.StartTime; double duration = endTime - HitObject.StartTime;
glow.Delay(duration); glow.Delay(duration);
glow.FadeOut(400); glow.FadeOut(400);

View File

@ -13,9 +13,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
public const float TIME_FADEIN = 400; public const float TIME_FADEIN = 400;
public const float TIME_FADEOUT = 500; public const float TIME_FADEOUT = 500;
public DrawableOsuHitObject(OsuHitObject hitObject) protected DrawableOsuHitObject(OsuHitObject hitObject)
: base(hitObject) : base(hitObject)
{ {
AccentColour = HitObject.ComboColour;
} }
protected override OsuJudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 }; protected override OsuJudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 };

View File

@ -39,6 +39,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
body = new SliderBody(s) body = new SliderBody(s)
{ {
AccentColour = AccentColour,
Position = s.StackedPosition, Position = s.StackedPosition,
PathWidth = s.Scale * 64, PathWidth = s.Scale * 64,
}, },
@ -56,6 +57,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
ball = new SliderBall(s) ball = new SliderBall(s)
{ {
Scale = new Vector2(s.Scale), Scale = new Vector2(s.Scale),
AccentColour = AccentColour
}, },
initialCircle = new DrawableHitCircle(new HitCircle initialCircle = new DrawableHitCircle(new HitCircle
{ {

View File

@ -48,7 +48,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
new Box new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = sliderTick.ComboColour, Colour = AccentColour,
Alpha = 0.3f, Alpha = 0.3f,
} }
}; };

View File

@ -48,7 +48,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
Alpha = 0, Alpha = 0,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
DiscColour = s.ComboColour DiscColour = AccentColour
}, },
circleContainer = new Container circleContainer = new Container
{ {

View File

@ -12,10 +12,26 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
public class SliderBall : CircularContainer, ISliderProgress public class SliderBall : CircularContainer, ISliderProgress
{ {
private const float width = 128;
private Color4 accentColour = Color4.Black;
/// <summary>
/// The colour that is used for the slider ball.
/// </summary>
public Color4 AccentColour
{
get { return accentColour; }
set
{
accentColour = value;
if (ball != null)
ball.Colour = value;
}
}
private readonly Slider slider; private readonly Slider slider;
private readonly Box follow; private readonly Box follow;
private readonly Box ball;
private const float width = 128;
public SliderBall(Slider slider) public SliderBall(Slider slider)
{ {
@ -49,9 +65,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
Alpha = 1, Alpha = 1,
Children = new[] Children = new[]
{ {
new Box ball = new Box
{ {
Colour = slider.ComboColour, Colour = AccentColour,
Alpha = 0.4f, Alpha = 0.4f,
Width = width, Width = width,
Height = width, Height = width,

View File

@ -13,6 +13,7 @@ using osu.Framework.Graphics.Textures;
using osu.Game.Configuration; using osu.Game.Configuration;
using OpenTK; using OpenTK;
using OpenTK.Graphics.ES30; using OpenTK.Graphics.ES30;
using OpenTK.Graphics;
namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
@ -24,15 +25,32 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
public float PathWidth public float PathWidth
{ {
get { return path.PathWidth; } get { return path.PathWidth; }
set set { path.PathWidth = value; }
{
path.PathWidth = value;
}
} }
public double? SnakedStart { get; private set; } public double? SnakedStart { get; private set; }
public double? SnakedEnd { get; private set; } public double? SnakedEnd { get; private set; }
private Color4 accentColour;
/// <summary>
/// Used to colour the path.
/// </summary>
public Color4 AccentColour
{
get { return accentColour; }
set
{
if (accentColour == value)
return;
accentColour = value;
if (LoadState == LoadState.Loaded)
Schedule(reloadTexture);
}
}
private int textureWidth => (int)PathWidth * 2;
private readonly Slider slider; private readonly Slider slider;
public SliderBody(Slider s) public SliderBody(Slider s)
{ {
@ -82,7 +100,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders); snakingIn = config.GetBindable<bool>(OsuConfig.SnakingInSliders);
snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders); snakingOut = config.GetBindable<bool>(OsuConfig.SnakingOutSliders);
int textureWidth = (int)PathWidth * 2; reloadTexture();
}
private void reloadTexture()
{
var texture = new Texture(textureWidth, 1);
//initialise background //initialise background
var upload = new TextureUpload(textureWidth * 4); var upload = new TextureUpload(textureWidth * 4);
@ -110,14 +133,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
progress -= border_portion; progress -= border_portion;
bytes[i * 4] = (byte)(slider.ComboColour.R * 255); bytes[i * 4] = (byte)(AccentColour.R * 255);
bytes[i * 4 + 1] = (byte)(slider.ComboColour.G * 255); bytes[i * 4 + 1] = (byte)(AccentColour.G * 255);
bytes[i * 4 + 2] = (byte)(slider.ComboColour.B * 255); bytes[i * 4 + 2] = (byte)(AccentColour.B * 255);
bytes[i * 4 + 3] = (byte)((opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * (slider.ComboColour.A * 255)); bytes[i * 4 + 3] = (byte)((opacity_at_edge - (opacity_at_edge - opacity_at_centre) * progress / gradient_portion) * (AccentColour.A * 255));
} }
} }
var texture = new Texture(textureWidth, 1);
texture.SetData(upload); texture.SetData(upload);
path.Texture = texture; path.Texture = texture;
} }

View File

@ -36,7 +36,7 @@ namespace osu.Game.Modes.Osu.Objects
public float Scale { get; set; } = 1; public float Scale { get; set; } = 1;
public Color4 ComboColour { get; set; } public Color4 ComboColour { get; set; } = Color4.Gray;
public virtual bool NewCombo { get; set; } public virtual bool NewCombo { get; set; }
public int ComboIndex { get; set; } public int ComboIndex { get; set; }