mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Merge remote-tracking branch 'origin/master' into taiko_bash_drawable
Conflicts: osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Modes.Objects.Drawables;
|
||||
using osu.Game.Modes.Taiko.Judgements;
|
||||
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
@ -16,6 +17,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
RelativePositionAxes = Axes.X;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
CreateCircle()
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -42,5 +48,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||
{
|
||||
UpdateScrollPosition(Time.Current);
|
||||
}
|
||||
|
||||
protected abstract CirclePiece CreateCircle();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,25 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// A type of circle piece which is drawn at a higher scale as an "accent".
|
||||
/// </summary>
|
||||
public class AccentedCirclePiece : CirclePiece
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount to scale up the base circle to show it as an "accented" piece.
|
||||
/// </summary>
|
||||
private const float accent_scale = 1.5f;
|
||||
|
||||
public AccentedCirclePiece()
|
||||
{
|
||||
SymbolContainer.Scale = new Vector2(accent_scale);
|
||||
}
|
||||
|
||||
public override Vector2 Size => new Vector2(base.Size.X, base.Size.Y * accent_scale);
|
||||
}
|
||||
}
|
156
osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs
Normal file
156
osu.Game.Modes.Taiko/Objects/Drawable/Pieces/CirclePiece.cs
Normal file
@ -0,0 +1,156 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using OpenTK.Graphics;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Modes.Taiko.Objects.Drawable.Pieces
|
||||
{
|
||||
/// <summary>
|
||||
/// A circle piece which is used uniformly through osu!taiko to visualise hitobjects.
|
||||
/// <para>
|
||||
/// The body of this piece will overshoot its parent by <see cref="CirclePiece.Height"/> to form
|
||||
/// a rounded (_[-Width-]_) figure such that a regular "circle" is the result of a parent with Width = 0.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public class CirclePiece : Container
|
||||
{
|
||||
private Color4 accentColour;
|
||||
/// <summary>
|
||||
/// The colour of the inner circle and outer glows.
|
||||
/// </summary>
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
|
||||
innerBackground.Colour = AccentColour;
|
||||
|
||||
triangles.ColourLight = AccentColour;
|
||||
triangles.ColourDark = AccentColour.Darken(0.1f);
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
}
|
||||
|
||||
private bool kiaiMode;
|
||||
/// <summary>
|
||||
/// Whether Kiai mode effects are enabled for this circle piece.
|
||||
/// </summary>
|
||||
public bool KiaiMode
|
||||
{
|
||||
get { return kiaiMode; }
|
||||
set
|
||||
{
|
||||
kiaiMode = value;
|
||||
|
||||
resetEdgeEffects();
|
||||
}
|
||||
}
|
||||
|
||||
public override Anchor Origin
|
||||
{
|
||||
get { return Anchor.CentreLeft; }
|
||||
set { throw new InvalidOperationException($"{nameof(CirclePiece)} must always use CentreLeft origin."); }
|
||||
}
|
||||
|
||||
protected override Container<Framework.Graphics.Drawable> Content => SymbolContainer;
|
||||
protected readonly Container SymbolContainer;
|
||||
|
||||
private readonly Container innerLayer;
|
||||
private readonly Container innerCircleContainer;
|
||||
private readonly Box innerBackground;
|
||||
private readonly Triangles triangles;
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = TaikoHitObject.CIRCLE_RADIUS * 2;
|
||||
|
||||
// The "inner layer" is the body of the CirclePiece that overshoots it by Height/2 px on both sides
|
||||
AddInternal(innerLayer = new Container
|
||||
{
|
||||
Name = "Inner Layer",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerCircleContainer = new CircularContainer
|
||||
{
|
||||
Name = "Inner Circle",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Framework.Graphics.Drawable[]
|
||||
{
|
||||
innerBackground = new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
triangles = new Triangles
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
}
|
||||
}
|
||||
},
|
||||
new CircularContainer
|
||||
{
|
||||
Name = "Ring",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BorderThickness = 8,
|
||||
BorderColour = Color4.White,
|
||||
Masking = true,
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
},
|
||||
SymbolContainer = new Container
|
||||
{
|
||||
Name = "Symbol",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
// Add the overshoot to compensate for corner radius
|
||||
innerLayer.Width = DrawWidth + DrawHeight;
|
||||
}
|
||||
|
||||
private void resetEdgeEffects()
|
||||
{
|
||||
innerCircleContainer.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour,
|
||||
Radius = KiaiMode ? 50 : 8
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user