mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 11:22:55 +08:00
Merge branch 'master' into replay_extensibility
This commit is contained in:
commit
64378f6445
@ -1 +1 @@
|
|||||||
Subproject commit f85c594c182db2b01233e29ca52639b7baa00402
|
Subproject commit 2d8a6c1699ff1acd3915fc28e8906dabf1b145a3
|
212
osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs
Normal file
212
osu.Desktop.VisualTests/Tests/TestCaseTaikoHitObjects.cs
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
// 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;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Screens.Testing;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Modes.Taiko.Objects;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||||
|
|
||||||
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
|
{
|
||||||
|
internal class TestCaseTaikoHitObjects : TestCase
|
||||||
|
{
|
||||||
|
public override string Description => "Taiko hit objects";
|
||||||
|
|
||||||
|
private bool kiai;
|
||||||
|
|
||||||
|
public override void Reset()
|
||||||
|
{
|
||||||
|
base.Reset();
|
||||||
|
|
||||||
|
AddToggle("Kiai", b =>
|
||||||
|
{
|
||||||
|
kiai = !kiai;
|
||||||
|
Reset();
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new CentreHitCircle(new CirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Position = new Vector2(100, 100)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new CentreHitCircle(new AccentedCirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Position = new Vector2(350, 100)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new RimHitCircle(new CirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Position = new Vector2(100, 300)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new RimHitCircle(new AccentedCirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Position = new Vector2(350, 300)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new SwellCircle(new CirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Position = new Vector2(100, 500)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new SwellCircle(new AccentedCirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Position = new Vector2(350, 500)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new DrumRollCircle(new CirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Width = 250,
|
||||||
|
Position = new Vector2(575, 100)
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(new DrumRollCircle(new AccentedCirclePiece()
|
||||||
|
{
|
||||||
|
KiaiMode = kiai
|
||||||
|
})
|
||||||
|
{
|
||||||
|
Width = 250,
|
||||||
|
Position = new Vector2(575, 300)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private class SwellCircle : BaseCircle
|
||||||
|
{
|
||||||
|
public SwellCircle(CirclePiece piece)
|
||||||
|
: base(piece)
|
||||||
|
{
|
||||||
|
Piece.Add(new TextAwesome
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
TextSize = SYMBOL_INNER_SIZE,
|
||||||
|
Icon = FontAwesome.fa_asterisk,
|
||||||
|
Shadow = false
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Piece.AccentColour = colours.YellowDark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DrumRollCircle : BaseCircle
|
||||||
|
{
|
||||||
|
public DrumRollCircle(CirclePiece piece)
|
||||||
|
: base(piece)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Piece.AccentColour = colours.YellowDark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CentreHitCircle : BaseCircle
|
||||||
|
{
|
||||||
|
public CentreHitCircle(CirclePiece piece)
|
||||||
|
: base(piece)
|
||||||
|
{
|
||||||
|
Piece.Add(new CircularContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(SYMBOL_INNER_SIZE),
|
||||||
|
Masking = true,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Piece.AccentColour = colours.PinkDarker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RimHitCircle : BaseCircle
|
||||||
|
{
|
||||||
|
public RimHitCircle(CirclePiece piece)
|
||||||
|
: base(piece)
|
||||||
|
{
|
||||||
|
Piece.Add(new CircularContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(SYMBOL_SIZE),
|
||||||
|
BorderThickness = SYMBOL_BORDER,
|
||||||
|
BorderColour = Color4.White,
|
||||||
|
Masking = true,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0,
|
||||||
|
AlwaysPresent = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Piece.AccentColour = colours.BlueDarker;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private abstract class BaseCircle : Container
|
||||||
|
{
|
||||||
|
protected const float SYMBOL_SIZE = TaikoHitObject.CIRCLE_RADIUS * 2f * 0.45f;
|
||||||
|
protected const float SYMBOL_BORDER = 8;
|
||||||
|
protected const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER;
|
||||||
|
|
||||||
|
protected readonly CirclePiece Piece;
|
||||||
|
|
||||||
|
protected BaseCircle(CirclePiece piece)
|
||||||
|
{
|
||||||
|
Piece = piece;
|
||||||
|
|
||||||
|
Add(Piece);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -194,6 +194,7 @@
|
|||||||
<Compile Include="Tests\TestCaseReplay.cs" />
|
<Compile Include="Tests\TestCaseReplay.cs" />
|
||||||
<Compile Include="Tests\TestCaseScoreCounter.cs" />
|
<Compile Include="Tests\TestCaseScoreCounter.cs" />
|
||||||
<Compile Include="Tests\TestCaseTabControl.cs" />
|
<Compile Include="Tests\TestCaseTabControl.cs" />
|
||||||
|
<Compile Include="Tests\TestCaseTaikoHitObjects.cs" />
|
||||||
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
|
<Compile Include="Tests\TestCaseTaikoPlayfield.cs" />
|
||||||
<Compile Include="Tests\TestCaseTextAwesome.cs" />
|
<Compile Include="Tests\TestCaseTextAwesome.cs" />
|
||||||
<Compile Include="Tests\TestCasePlaySongSelect.cs" />
|
<Compile Include="Tests\TestCasePlaySongSelect.cs" />
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Modes.Objects.Drawables;
|
using osu.Game.Modes.Objects.Drawables;
|
||||||
using osu.Game.Modes.Taiko.Judgements;
|
using osu.Game.Modes.Taiko.Judgements;
|
||||||
|
using osu.Game.Modes.Taiko.Objects.Drawable.Pieces;
|
||||||
|
|
||||||
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
namespace osu.Game.Modes.Taiko.Objects.Drawable
|
||||||
{
|
{
|
||||||
@ -16,6 +17,11 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
RelativePositionAxes = Axes.X;
|
RelativePositionAxes = Axes.X;
|
||||||
|
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
CreateCircle()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -42,5 +48,7 @@ namespace osu.Game.Modes.Taiko.Objects.Drawable
|
|||||||
{
|
{
|
||||||
UpdateScrollPosition(Time.Current);
|
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
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -54,9 +54,11 @@
|
|||||||
<Compile Include="Judgements\TaikoHitResult.cs" />
|
<Compile Include="Judgements\TaikoHitResult.cs" />
|
||||||
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
|
||||||
<Compile Include="Objects\Bash.cs" />
|
<Compile Include="Objects\Bash.cs" />
|
||||||
|
<Compile Include="Objects\Drawable\Pieces\AccentedCirclePiece.cs" />
|
||||||
<Compile Include="Objects\DrumRoll.cs" />
|
<Compile Include="Objects\DrumRoll.cs" />
|
||||||
<Compile Include="Objects\DrumRollTick.cs" />
|
<Compile Include="Objects\DrumRollTick.cs" />
|
||||||
<Compile Include="Objects\Hit.cs" />
|
<Compile Include="Objects\Hit.cs" />
|
||||||
|
<Compile Include="Objects\Drawable\Pieces\CirclePiece.cs" />
|
||||||
<Compile Include="TaikoDifficultyCalculator.cs" />
|
<Compile Include="TaikoDifficultyCalculator.cs" />
|
||||||
<Compile Include="Objects\TaikoHitObject.cs" />
|
<Compile Include="Objects\TaikoHitObject.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
@ -160,7 +160,7 @@
|
|||||||
<Compile Include="Overlays\Notifications\ProgressCompletionNotification.cs" />
|
<Compile Include="Overlays\Notifications\ProgressCompletionNotification.cs" />
|
||||||
<Compile Include="Overlays\Notifications\ProgressNotification.cs" />
|
<Compile Include="Overlays\Notifications\ProgressNotification.cs" />
|
||||||
<Compile Include="Overlays\Notifications\SimpleNotification.cs" />
|
<Compile Include="Overlays\Notifications\SimpleNotification.cs" />
|
||||||
<Compile Include="Overlays\Options\OptionDropDown.cs" />
|
<Compile Include="Overlays\Options\OptionDropdown.cs" />
|
||||||
<Compile Include="Overlays\Options\OptionLabel.cs" />
|
<Compile Include="Overlays\Options\OptionLabel.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuDropdown.cs" />
|
<Compile Include="Graphics\UserInterface\OsuDropdown.cs" />
|
||||||
<Compile Include="Overlays\Options\OptionsFooter.cs" />
|
<Compile Include="Overlays\Options\OptionsFooter.cs" />
|
||||||
@ -320,7 +320,7 @@
|
|||||||
<Compile Include="Overlays\Options\OptionTextBox.cs" />
|
<Compile Include="Overlays\Options\OptionTextBox.cs" />
|
||||||
<Compile Include="Overlays\Options\OptionSlider.cs" />
|
<Compile Include="Overlays\Options\OptionSlider.cs" />
|
||||||
<Compile Include="Configuration\ProgressBarType.cs" />
|
<Compile Include="Configuration\ProgressBarType.cs" />
|
||||||
<Compile Include="Overlays\Options\OptionEnumDropDown.cs" />
|
<Compile Include="Overlays\Options\OptionEnumDropdown.cs" />
|
||||||
<Compile Include="Configuration\RankingType.cs" />
|
<Compile Include="Configuration\RankingType.cs" />
|
||||||
<Compile Include="Configuration\ScoreMeterType.cs" />
|
<Compile Include="Configuration\ScoreMeterType.cs" />
|
||||||
<Compile Include="Configuration\ReleaseStream.cs" />
|
<Compile Include="Configuration\ReleaseStream.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user