1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 06:02:54 +08:00

Merge branch 'master' into more-skinning

This commit is contained in:
Dean Herbert 2018-03-12 11:55:50 +09:00 committed by GitHub
commit eb643b690a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 176 additions and 181 deletions

@ -1 +1 @@
Subproject commit 6915954abdba64e72f698aa58698b00159f3678d Subproject commit 59004b46f2c96ac02fec712e66f9f96fe252f2fa

View File

@ -4,13 +4,14 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.Mania.UI namespace osu.Game.Rulesets.Mania.UI
{ {
internal class DrawableManiaJudgement : DrawableJudgement internal class DrawableManiaJudgement : DrawableJudgement
{ {
public DrawableManiaJudgement(Judgement judgement) public DrawableManiaJudgement(Judgement judgement, DrawableHitObject judgedObject)
: base(judgement) : base(judgement, judgedObject)
{ {
} }

View File

@ -15,6 +15,7 @@ using osu.Game.Rulesets.Mania.Beatmaps;
using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Objects.Drawables;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -40,7 +41,7 @@ namespace osu.Game.Rulesets.Mania.UI
private readonly Container<Drawable> content; private readonly Container<Drawable> content;
public Container<DrawableManiaJudgement> Judgements => judgements; public Container<DrawableManiaJudgement> Judgements => judgements;
private readonly Container<DrawableManiaJudgement> judgements; private readonly JudgementContainer<DrawableManiaJudgement> judgements;
private readonly Container topLevelContainer; private readonly Container topLevelContainer;
@ -114,7 +115,7 @@ namespace osu.Game.Rulesets.Mania.UI
Padding = new MarginPadding { Top = HIT_TARGET_POSITION } Padding = new MarginPadding { Top = HIT_TARGET_POSITION }
} }
}, },
judgements = new Container<DrawableManiaJudgement> judgements = new JudgementContainer<DrawableManiaJudgement>
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -171,7 +172,7 @@ namespace osu.Game.Rulesets.Mania.UI
internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement)
{ {
judgements.Clear(); judgements.Clear();
judgements.Add(new DrawableManiaJudgement(judgement) judgements.Add(new DrawableManiaJudgement(judgement, judgedObject)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -2,17 +2,17 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu.Judgements;
using OpenTK; using OpenTK;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Osu.Objects.Drawables namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public class DrawableOsuJudgement : DrawableJudgement public class DrawableOsuJudgement : DrawableJudgement
{ {
public DrawableOsuJudgement(OsuJudgement judgement) public DrawableOsuJudgement(Judgement judgement, DrawableHitObject judgedObject)
: base(judgement) : base(judgement, judgedObject)
{ {
} }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.UI
public class OsuPlayfield : Playfield public class OsuPlayfield : Playfield
{ {
private readonly Container approachCircles; private readonly Container approachCircles;
private readonly Container judgementLayer; private readonly JudgementContainer<DrawableOsuJudgement> judgementLayer;
private readonly ConnectionRenderer<OsuHitObject> connectionLayer; private readonly ConnectionRenderer<OsuHitObject> connectionLayer;
// Todo: This should not be a thing, but is currently required for the editor // Todo: This should not be a thing, but is currently required for the editor
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.UI
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = 2, Depth = 2,
}, },
judgementLayer = new Container judgementLayer = new JudgementContainer<DrawableOsuJudgement>
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = 1, Depth = 1,
@ -75,16 +75,13 @@ namespace osu.Game.Rulesets.Osu.UI
private void onJudgement(DrawableHitObject judgedObject, Judgement judgement) private void onJudgement(DrawableHitObject judgedObject, Judgement judgement)
{ {
var osuJudgement = (OsuJudgement)judgement;
var osuObject = (OsuHitObject)judgedObject.HitObject;
if (!judgedObject.DisplayJudgement) if (!judgedObject.DisplayJudgement)
return; return;
DrawableOsuJudgement explosion = new DrawableOsuJudgement(osuJudgement) DrawableOsuJudgement explosion = new DrawableOsuJudgement(judgement, judgedObject)
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Position = osuObject.StackedEndPosition + osuJudgement.PositionOffset Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition + ((OsuJudgement)judgement).PositionOffset
}; };
judgementLayer.Add(explosion); judgementLayer.Add(explosion);

View File

@ -15,17 +15,14 @@ namespace osu.Game.Rulesets.Taiko.UI
/// </summary> /// </summary>
public class DrawableTaikoJudgement : DrawableJudgement public class DrawableTaikoJudgement : DrawableJudgement
{ {
public readonly DrawableHitObject JudgedObject;
/// <summary> /// <summary>
/// Creates a new judgement text. /// Creates a new judgement text.
/// </summary> /// </summary>
/// <param name="judgedObject">The object which is being judged.</param> /// <param name="judgedObject">The object which is being judged.</param>
/// <param name="judgement">The judgement to visualise.</param> /// <param name="judgement">The judgement to visualise.</param>
public DrawableTaikoJudgement(DrawableHitObject judgedObject, Judgement judgement) public DrawableTaikoJudgement(Judgement judgement, DrawableHitObject judgedObject)
: base(judgement) : base(judgement, judgedObject)
{ {
JudgedObject = judgedObject;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -16,6 +16,7 @@ using System.Linq;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Beatmaps.ControlPoints; using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;
namespace osu.Game.Rulesets.Taiko.UI namespace osu.Game.Rulesets.Taiko.UI
@ -41,7 +42,7 @@ namespace osu.Game.Rulesets.Taiko.UI
private readonly Container<HitExplosion> hitExplosionContainer; private readonly Container<HitExplosion> hitExplosionContainer;
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer; private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;
private readonly Container<DrawableTaikoJudgement> judgementContainer; private readonly JudgementContainer<DrawableTaikoJudgement> judgementContainer;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private readonly Container content; private readonly Container content;
@ -131,7 +132,7 @@ namespace osu.Game.Rulesets.Taiko.UI
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET }, Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
Blending = BlendingMode.Additive Blending = BlendingMode.Additive
}, },
judgementContainer = new Container<DrawableTaikoJudgement> judgementContainer = new JudgementContainer<DrawableTaikoJudgement>
{ {
Name = "Judgements", Name = "Judgements",
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
@ -227,7 +228,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{ {
if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null)
{ {
judgementContainer.Add(new DrawableTaikoJudgement(judgedObject, judgement) judgementContainer.Add(new DrawableTaikoJudgement(judgement, judgedObject)
{ {
Anchor = judgement.IsHit ? Anchor.TopLeft : Anchor.CentreLeft, Anchor = judgement.IsHit ? Anchor.TopLeft : Anchor.CentreLeft,
Origin = judgement.IsHit ? Anchor.BottomCentre : Anchor.Centre, Origin = judgement.IsHit ? Anchor.BottomCentre : Anchor.Centre,

View File

@ -3,9 +3,9 @@
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Screens.Play.BreaksOverlay;
using System.Collections.Generic; using System.Collections.Generic;
using NUnit.Framework; using NUnit.Framework;
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual
{ {

View File

@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning; using osu.Game.Skinning;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -24,15 +25,18 @@ namespace osu.Game.Rulesets.Judgements
protected readonly Judgement Judgement; protected readonly Judgement Judgement;
public readonly DrawableHitObject JudgedObject;
protected SpriteText JudgementText; protected SpriteText JudgementText;
/// <summary> /// <summary>
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>. /// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
/// </summary> /// </summary>
/// <param name="judgement">The judgement to visualise.</param> /// <param name="judgement">The judgement to visualise.</param>
public DrawableJudgement(Judgement judgement) public DrawableJudgement(Judgement judgement, DrawableHitObject judgedObject)
{ {
Judgement = judgement; Judgement = judgement;
JudgedObject = judgedObject;
Size = new Vector2(judgement_size); Size = new Vector2(judgement_size);
} }

View File

@ -0,0 +1,24 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Judgements;
namespace osu.Game.Rulesets.UI
{
public class JudgementContainer<T> : Container<T>
where T : DrawableJudgement
{
public override void Add(T judgement)
{
if (judgement == null) throw new ArgumentNullException(nameof(judgement));
// remove any existing judgements for the judged object.
// this can be the case when rewinding.
RemoveAll(c => c.JudgedObject == judgement.JudgedObject);
base.Add(judgement);
}
}
}

View File

@ -1,13 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using OpenTK;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class BlurredIcon : BufferedContainer public class BlurredIcon : BufferedContainer
{ {

View File

@ -1,18 +1,15 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using OpenTK; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Beatmaps.Timing; using OpenTK;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class ArrowsOverlay : VisibilityContainer public class BreakArrows : CompositeDrawable
{ {
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
private const int glow_icon_size = 60; private const int glow_icon_size = 60;
private const int glow_icon_blur_sigma = 10; private const int glow_icon_blur_sigma = 10;
private const float glow_icon_final_offset = 0.22f; private const float glow_icon_final_offset = 0.22f;
@ -29,10 +26,10 @@ namespace osu.Game.Screens.Play.BreaksOverlay
private readonly BlurredIcon leftBlurredIcon; private readonly BlurredIcon leftBlurredIcon;
private readonly BlurredIcon rightBlurredIcon; private readonly BlurredIcon rightBlurredIcon;
public ArrowsOverlay() public BreakArrows()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
leftGlowIcon = new GlowIcon leftGlowIcon = new GlowIcon
{ {
@ -82,22 +79,22 @@ namespace osu.Game.Screens.Play.BreaksOverlay
}; };
} }
protected override void PopIn() public void Show(double duration)
{ {
leftGlowIcon.MoveToX(-glow_icon_final_offset, fade_duration, Easing.OutQuint); leftGlowIcon.MoveToX(-glow_icon_final_offset, duration, Easing.OutQuint);
rightGlowIcon.MoveToX(glow_icon_final_offset, fade_duration, Easing.OutQuint); rightGlowIcon.MoveToX(glow_icon_final_offset, duration, Easing.OutQuint);
leftBlurredIcon.MoveToX(-blurred_icon_final_offset, fade_duration, Easing.OutQuint); leftBlurredIcon.MoveToX(-blurred_icon_final_offset, duration, Easing.OutQuint);
rightBlurredIcon.MoveToX(blurred_icon_final_offset, fade_duration, Easing.OutQuint); rightBlurredIcon.MoveToX(blurred_icon_final_offset, duration, Easing.OutQuint);
} }
protected override void PopOut() public void Hide(double duration)
{ {
leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, fade_duration, Easing.OutQuint); leftGlowIcon.MoveToX(-glow_icon_offscreen_offset, duration, Easing.OutQuint);
rightGlowIcon.MoveToX(glow_icon_offscreen_offset, fade_duration, Easing.OutQuint); rightGlowIcon.MoveToX(glow_icon_offscreen_offset, duration, Easing.OutQuint);
leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint); leftBlurredIcon.MoveToX(-blurred_icon_offscreen_offset, duration, Easing.OutQuint);
rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, fade_duration, Easing.OutQuint); rightBlurredIcon.MoveToX(blurred_icon_offscreen_offset, duration, Easing.OutQuint);
} }
} }
} }

View File

@ -1,24 +1,21 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Beatmaps.Timing; using OpenTK;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class InfoContainer : VisibilityContainer public class BreakInfo : Container
{ {
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2; public PercentageBreakInfoLine AccuracyDisplay;
public BreakInfoLine<int> RankDisplay;
public BreakInfoLine<ScoreRank> GradeDisplay;
public PercentageInfoLine AccuracyDisplay; public BreakInfo()
public InfoLine<int> RankDisplay;
public InfoLine<ScoreRank> GradeDisplay;
public InfoContainer()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Child = new FillFlowContainer Child = new FillFlowContainer
@ -43,16 +40,13 @@ namespace osu.Game.Screens.Play.BreaksOverlay
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
AccuracyDisplay = new PercentageInfoLine("Accuracy"), AccuracyDisplay = new PercentageBreakInfoLine("Accuracy"),
RankDisplay = new InfoLine<int>("Rank"), RankDisplay = new BreakInfoLine<int>("Rank"),
GradeDisplay = new InfoLine<ScoreRank>("Grade"), GradeDisplay = new BreakInfoLine<ScoreRank>("Grade"),
}, },
} }
}, },
}; };
} }
protected override void PopIn() => this.FadeIn(fade_duration);
protected override void PopOut() => this.FadeOut(fade_duration);
} }
} }

View File

@ -8,9 +8,9 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class InfoLine<T> : Container public class BreakInfoLine<T> : Container
where T : struct where T : struct
{ {
private const int margin = 2; private const int margin = 2;
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
private readonly string prefix; private readonly string prefix;
public InfoLine(string name, string prefix = @"") public BreakInfoLine(string name, string prefix = @"")
{ {
this.prefix = prefix; this.prefix = prefix;
@ -71,9 +71,9 @@ namespace osu.Game.Screens.Play.BreaksOverlay
} }
} }
public class PercentageInfoLine : InfoLine<double> public class PercentageBreakInfoLine : BreakInfoLine<double>
{ {
public PercentageInfoLine(string name, string prefix = "") : base(name, prefix) public PercentageBreakInfoLine(string name, string prefix = "") : base(name, prefix)
{ {
} }

View File

@ -1,13 +1,13 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Graphics.Containers; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using OpenTK; using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class GlowIcon : Container public class GlowIcon : Container
{ {
@ -16,24 +16,24 @@ namespace osu.Game.Screens.Play.BreaksOverlay
public override Vector2 Size public override Vector2 Size
{ {
get { return base.Size; }
set set
{ {
blurredIcon.Size = spriteIcon.Size = value; blurredIcon.Size = spriteIcon.Size = value;
blurredIcon.ForceRedraw(); blurredIcon.ForceRedraw();
} }
get { return base.Size; }
} }
public Vector2 BlurSigma public Vector2 BlurSigma
{ {
set { blurredIcon.BlurSigma = value; }
get { return blurredIcon.BlurSigma; } get { return blurredIcon.BlurSigma; }
set { blurredIcon.BlurSigma = value; }
} }
public FontAwesome Icon public FontAwesome Icon
{ {
set { spriteIcon.Icon = blurredIcon.Icon = value; }
get { return spriteIcon.Icon; } get { return spriteIcon.Icon; }
set { spriteIcon.Icon = blurredIcon.Icon = value; }
} }
public GlowIcon() public GlowIcon()

View File

@ -1,18 +1,16 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps.Timing; using OpenTK.Graphics;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class LetterboxOverlay : VisibilityContainer public class LetterboxOverlay : CompositeDrawable
{ {
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
private const int height = 350; private const int height = 350;
private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0); private static readonly Color4 transparent_black = new Color4(0, 0, 0, 0);
@ -20,7 +18,7 @@ namespace osu.Game.Screens.Play.BreaksOverlay
public LetterboxOverlay() public LetterboxOverlay()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Children = new Drawable[] InternalChildren = new Drawable[]
{ {
new Container new Container
{ {
@ -48,8 +46,5 @@ namespace osu.Game.Screens.Play.BreaksOverlay
} }
}; };
} }
protected override void PopIn() => this.FadeIn(fade_duration);
protected override void PopOut() => this.FadeOut(fade_duration);
} }
} }

View File

@ -1,18 +1,15 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics;
using System; using System;
using osu.Game.Beatmaps.Timing; using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play.Break
{ {
public class RemainingTimeCounter : Counter public class RemainingTimeCounter : Counter
{ {
private const double fade_duration = BreakPeriod.MIN_BREAK_DURATION / 2;
private readonly OsuSpriteText counter; private readonly OsuSpriteText counter;
public RemainingTimeCounter() public RemainingTimeCounter()
@ -25,13 +22,8 @@ namespace osu.Game.Screens.Play.BreaksOverlay
TextSize = 33, TextSize = 33,
Font = "Venera", Font = "Venera",
}; };
Alpha = 0;
} }
protected override void OnCountChanged(double count) => counter.Text = ((int)Math.Ceiling(count / 1000)).ToString(); protected override void OnCountChanged(double count) => counter.Text = ((int)Math.Ceiling(count / 1000)).ToString();
public override void Show() => this.FadeIn(fade_duration);
public override void Hide() => this.FadeOut(fade_duration);
} }
} }

View File

@ -1,15 +1,16 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
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.Graphics.UserInterface;
using osu.Game.Beatmaps.Timing; using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using System.Collections.Generic; using osu.Game.Screens.Play.Break;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Screens.Play.BreaksOverlay namespace osu.Game.Screens.Play
{ {
public class BreakOverlay : Container public class BreakOverlay : Container
{ {
@ -18,28 +19,26 @@ namespace osu.Game.Screens.Play.BreaksOverlay
private const int vertical_margin = 25; private const int vertical_margin = 25;
private List<BreakPeriod> breaks; private List<BreakPeriod> breaks;
private readonly Container fadeContainer;
public List<BreakPeriod> Breaks public List<BreakPeriod> Breaks
{ {
get => breaks;
set set
{ {
breaks = value; breaks = value;
initializeBreaks(); initializeBreaks();
} }
get
{
return breaks;
}
} }
public override bool RemoveCompletedTransforms => false; public override bool RemoveCompletedTransforms => false;
private readonly bool letterboxing;
private readonly LetterboxOverlay letterboxOverlay;
private readonly Container remainingTimeAdjustmentBox; private readonly Container remainingTimeAdjustmentBox;
private readonly Container remainingTimeBox; private readonly Container remainingTimeBox;
private readonly RemainingTimeCounter remainingTimeCounter; private readonly RemainingTimeCounter remainingTimeCounter;
private readonly InfoContainer info; private readonly BreakInfo info;
private readonly ArrowsOverlay arrowsOverlay; private readonly BreakArrows breakArrows;
public BreakOverlay(bool letterboxing, ScoreProcessor scoreProcessor) public BreakOverlay(bool letterboxing, ScoreProcessor scoreProcessor)
: this(letterboxing) : this(letterboxing)
@ -49,13 +48,16 @@ namespace osu.Game.Screens.Play.BreaksOverlay
public BreakOverlay(bool letterboxing) public BreakOverlay(bool letterboxing)
{ {
this.letterboxing = letterboxing;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Child = fadeContainer = new Container
{
Alpha = 0,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
letterboxOverlay = new LetterboxOverlay new LetterboxOverlay
{ {
Alpha = letterboxing ? 1 : 0,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
}, },
@ -83,27 +85,35 @@ namespace osu.Game.Screens.Play.BreaksOverlay
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
Margin = new MarginPadding { Bottom = vertical_margin }, Margin = new MarginPadding { Bottom = vertical_margin },
}, },
info = new InfoContainer info = new BreakInfo
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = vertical_margin }, Margin = new MarginPadding { Top = vertical_margin },
}, },
arrowsOverlay = new ArrowsOverlay breakArrows = new BreakArrows
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
} }
}
}; };
} }
protected override void LoadComplete()
{
base.LoadComplete();
initializeBreaks();
}
private void initializeBreaks() private void initializeBreaks()
{ {
if (!IsLoaded) return; // we need a clock.
FinishTransforms(true); FinishTransforms(true);
Scheduler.CancelDelayedTasks(); Scheduler.CancelDelayedTasks();
if (breaks == null) if (breaks == null) return; //we need breaks.
return;
foreach (var b in breaks) foreach (var b in breaks)
{ {
@ -112,6 +122,9 @@ namespace osu.Game.Screens.Play.BreaksOverlay
using (BeginAbsoluteSequence(b.StartTime, true)) using (BeginAbsoluteSequence(b.StartTime, true))
{ {
fadeContainer.FadeIn(fade_duration);
breakArrows.Show(fade_duration);
remainingTimeAdjustmentBox remainingTimeAdjustmentBox
.ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint) .ResizeWidthTo(remaining_time_container_max_size, fade_duration, Easing.OutQuint)
.Delay(b.Duration - fade_duration) .Delay(b.Duration - fade_duration)
@ -123,35 +136,14 @@ namespace osu.Game.Screens.Play.BreaksOverlay
.ResizeWidthTo(1); .ResizeWidthTo(1);
remainingTimeCounter.CountTo(b.Duration).CountTo(0, b.Duration); remainingTimeCounter.CountTo(b.Duration).CountTo(0, b.Duration);
}
using (BeginAbsoluteSequence(b.StartTime)) using (BeginDelayedSequence(b.Duration - fade_duration, true))
{ {
Schedule(showBreak); fadeContainer.FadeOut(fade_duration);
using (BeginDelayedSequence(b.Duration - fade_duration)) breakArrows.Hide(fade_duration);
Schedule(hideBreak);
} }
} }
} }
private void showBreak()
{
if (letterboxing)
letterboxOverlay.Show();
remainingTimeCounter.Show();
info.Show();
arrowsOverlay.Show();
}
private void hideBreak()
{
if (letterboxing)
letterboxOverlay.Hide();
remainingTimeCounter.Hide();
info.Hide();
arrowsOverlay.Hide();
} }
private void bindProcessor(ScoreProcessor processor) private void bindProcessor(ScoreProcessor processor)

View File

@ -25,7 +25,6 @@ using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
using osu.Game.Screens.Play.BreaksOverlay;
using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking;
using osu.Game.Storyboards.Drawables; using osu.Game.Storyboards.Drawables;

View File

@ -378,6 +378,7 @@
<Compile Include="Rulesets\Replays\ReplayFrame.cs" /> <Compile Include="Rulesets\Replays\ReplayFrame.cs" />
<Compile Include="Rulesets\Replays\Types\IConvertibleReplayFrame.cs" /> <Compile Include="Rulesets\Replays\Types\IConvertibleReplayFrame.cs" />
<Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" /> <Compile Include="Rulesets\Scoring\Legacy\LegacyScoreParser.cs" />
<Compile Include="Rulesets\UI\JudgementContainer.cs" />
<Compile Include="Screens\Play\ScreenWithBeatmapBackground.cs" /> <Compile Include="Screens\Play\ScreenWithBeatmapBackground.cs" />
<Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" /> <Compile Include="Screens\Play\PlayerSettings\VisualSettings.cs" />
<Compile Include="Rulesets\Objects\CatmullApproximator.cs" /> <Compile Include="Rulesets\Objects\CatmullApproximator.cs" />
@ -409,14 +410,14 @@
<Compile Include="Screens\Edit\Screens\Compose\RadioButtons\RadioButtonCollection.cs" /> <Compile Include="Screens\Edit\Screens\Compose\RadioButtons\RadioButtonCollection.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" /> <Compile Include="Screens\Edit\Screens\Compose\Timeline\BeatmapWaveformGraph.cs" />
<Compile Include="Screens\Edit\Screens\Compose\Timeline\TimelineButton.cs" /> <Compile Include="Screens\Edit\Screens\Compose\Timeline\TimelineButton.cs" />
<Compile Include="Screens\Play\BreaksOverlay\ArrowsOverlay.cs" /> <Compile Include="Screens\Play\Break\BreakArrows.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BlurredIcon.cs" /> <Compile Include="Screens\Play\Break\BlurredIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\BreakOverlay.cs" /> <Compile Include="Screens\Play\BreakOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\GlowIcon.cs" /> <Compile Include="Screens\Play\Break\GlowIcon.cs" />
<Compile Include="Screens\Play\BreaksOverlay\InfoContainer.cs" /> <Compile Include="Screens\Play\Break\BreakInfo.cs" />
<Compile Include="Screens\Play\BreaksOverlay\InfoLine.cs" /> <Compile Include="Screens\Play\Break\BreakInfoLine.cs" />
<Compile Include="Screens\Play\BreaksOverlay\LetterboxOverlay.cs" /> <Compile Include="Screens\Play\Break\LetterboxOverlay.cs" />
<Compile Include="Screens\Play\BreaksOverlay\RemainingTimeCounter.cs" /> <Compile Include="Screens\Play\Break\RemainingTimeCounter.cs" />
<Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" /> <Compile Include="Beatmaps\Legacy\LegacyBeatmap.cs" />
<Compile Include="Beatmaps\RankStatus.cs" /> <Compile Include="Beatmaps\RankStatus.cs" />
<Compile Include="Beatmaps\Timing\BreakPeriod.cs" /> <Compile Include="Beatmaps\Timing\BreakPeriod.cs" />