Merge branch 'master' into osu-logo-no-update-transforms

This commit is contained in:
Dan Balasescu
2020-07-28 15:36:37 +09:00
committed by GitHub
25 changed files with 375 additions and 251 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.715.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.727.1" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.723.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.723.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -4,62 +4,109 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Pooling; using osu.Framework.Graphics.Pooling;
using osu.Framework.Testing;
using osu.Game.Configuration;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
namespace osu.Game.Rulesets.Osu.Tests namespace osu.Game.Rulesets.Osu.Tests
{ {
public class TestSceneDrawableJudgement : OsuSkinnableTestScene public class TestSceneDrawableJudgement : OsuSkinnableTestScene
{ {
[Resolved]
private OsuConfigManager config { get; set; }
private readonly List<DrawablePool<TestDrawableOsuJudgement>> pools;
public TestSceneDrawableJudgement() public TestSceneDrawableJudgement()
{ {
var pools = new List<DrawablePool<DrawableOsuJudgement>>(); pools = new List<DrawablePool<TestDrawableOsuJudgement>>();
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1)) foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
showResult(result);
}
[Test]
public void TestHitLightingDisabled()
{
AddStep("hit lighting disabled", () => config.Set(OsuSetting.HitLighting, false));
showResult(HitResult.Great);
AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any());
AddAssert("judgement body immediately visible",
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.JudgementBody.Alpha == 1));
AddAssert("hit lighting hidden",
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.Lighting.Alpha == 0));
}
[Test]
public void TestHitLightingEnabled()
{
AddStep("hit lighting enabled", () => config.Set(OsuSetting.HitLighting, true));
showResult(HitResult.Great);
AddUntilStep("judgements shown", () => this.ChildrenOfType<TestDrawableOsuJudgement>().Any());
AddAssert("judgement body not immediately visible",
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.JudgementBody.Alpha > 0 && judgement.JudgementBody.Alpha < 1));
AddAssert("hit lighting shown",
() => this.ChildrenOfType<TestDrawableOsuJudgement>().All(judgement => judgement.Lighting.Alpha > 0));
}
private void showResult(HitResult result)
{
AddStep("Show " + result.GetDescription(), () =>
{ {
AddStep("Show " + result.GetDescription(), () => int poolIndex = 0;
SetContents(() =>
{ {
int poolIndex = 0; DrawablePool<TestDrawableOsuJudgement> pool;
SetContents(() => if (poolIndex >= pools.Count)
pools.Add(pool = new DrawablePool<TestDrawableOsuJudgement>(1));
else
{ {
DrawablePool<DrawableOsuJudgement> pool; pool = pools[poolIndex];
if (poolIndex >= pools.Count) // We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent.
pools.Add(pool = new DrawablePool<DrawableOsuJudgement>(1)); ((Container)pool.Parent).Clear(false);
else }
var container = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
pool = pools[poolIndex]; pool,
pool.Get(j => j.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)).With(j =>
// We need to make sure neither the pool nor the judgement get disposed when new content is set, and they both share the same parent.
((Container)pool.Parent).Clear(false);
}
var container = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{ {
pool, j.Anchor = Anchor.Centre;
pool.Get(j => j.Apply(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)).With(j => j.Origin = Anchor.Centre;
{ })
j.Anchor = Anchor.Centre; }
j.Origin = Anchor.Centre; };
})
}
};
poolIndex++; poolIndex++;
return container; return container;
});
}); });
} });
}
private class TestDrawableOsuJudgement : DrawableOsuJudgement
{
public new SkinnableSprite Lighting => base.Lighting;
public new Container JudgementBody => base.JudgementBody;
} }
} }
} }

View File

@ -142,7 +142,7 @@ namespace osu.Game.Rulesets.Osu.Tests
{ {
// multipled by 2 to nullify the score multiplier. (autoplay mod selected) // multipled by 2 to nullify the score multiplier. (autoplay mod selected)
var totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2; var totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2;
return totalScore == (int)(drawableSpinner.Disc.CumulativeRotation / 360) * 100; return totalScore == (int)(drawableSpinner.Disc.CumulativeRotation / 360) * SpinnerTick.SCORE_PER_TICK;
}); });
addSeekStep(0); addSeekStep(0);

View File

@ -16,9 +16,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
{ {
public class DrawableOsuJudgement : DrawableJudgement public class DrawableOsuJudgement : DrawableJudgement
{ {
private SkinnableSprite lighting; protected SkinnableSprite Lighting;
private Bindable<Color4> lightingColour; private Bindable<Color4> lightingColour;
[Resolved]
private OsuConfigManager config { get; set; }
public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject) public DrawableOsuJudgement(JudgementResult result, DrawableHitObject judgedObject)
: base(result, judgedObject) : base(result, judgedObject)
{ {
@ -29,18 +33,16 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load()
{ {
if (config.Get<bool>(OsuSetting.HitLighting)) AddInternal(Lighting = new SkinnableSprite("lighting")
{ {
AddInternal(lighting = new SkinnableSprite("lighting") Anchor = Anchor.Centre,
{ Origin = Anchor.Centre,
Anchor = Anchor.Centre, Blending = BlendingParameters.Additive,
Origin = Anchor.Centre, Depth = float.MaxValue,
Blending = BlendingParameters.Additive, Alpha = 0
Depth = float.MaxValue });
});
}
} }
public override void Apply(JudgementResult result, DrawableHitObject judgedObject) public override void Apply(JudgementResult result, DrawableHitObject judgedObject)
@ -60,33 +62,39 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
lightingColour?.UnbindAll(); lightingColour?.UnbindAll();
if (lighting != null) Lighting.ResetAnimation();
{
lighting.ResetAnimation();
if (JudgedObject != null) if (JudgedObject != null)
{ {
lightingColour = JudgedObject.AccentColour.GetBoundCopy(); lightingColour = JudgedObject.AccentColour.GetBoundCopy();
lightingColour.BindValueChanged(colour => lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true); lightingColour.BindValueChanged(colour => Lighting.Colour = Result.Type == HitResult.Miss ? Color4.Transparent : colour.NewValue, true);
} }
else else
{ {
lighting.Colour = Color4.White; Lighting.Colour = Color4.White;
}
} }
} }
protected override double FadeOutDelay => lighting == null ? base.FadeOutDelay : 1400; private double fadeOutDelay;
protected override double FadeOutDelay => fadeOutDelay;
protected override void ApplyHitAnimations() protected override void ApplyHitAnimations()
{ {
if (lighting != null) bool hitLightingEnabled = config.Get<bool>(OsuSetting.HitLighting);
if (hitLightingEnabled)
{ {
JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400); JudgementBody.FadeIn().Delay(FadeInDuration).FadeOut(400);
lighting.ScaleTo(0.8f).ScaleTo(1.2f, 600, Easing.Out); Lighting.ScaleTo(0.8f).ScaleTo(1.2f, 600, Easing.Out);
lighting.FadeIn(200).Then().Delay(200).FadeOut(1000); Lighting.FadeIn(200).Then().Delay(200).FadeOut(1000);
} }
else
{
JudgementBody.Alpha = 1;
}
fadeOutDelay = hitLightingEnabled ? 1400 : base.FadeOutDelay;
JudgementText?.TransformSpacingTo(Vector2.Zero).Then().TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint); JudgementText?.TransformSpacingTo(Vector2.Zero).Then().TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
base.ApplyHitAnimations(); base.ApplyHitAnimations();

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
return; return;
displayedCount = count; displayedCount = count;
bonusCounter.Text = $"{1000 * count}"; bonusCounter.Text = $"{SpinnerBonusTick.SCORE_PER_TICK * count}";
bonusCounter.FadeOutFromOne(1500); bonusCounter.FadeOutFromOne(1500);
bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint); bonusCounter.ScaleTo(1.5f).Then().ScaleTo(1f, 1000, Easing.OutQuint);
} }

View File

@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
public class SpinnerBonusTick : SpinnerTick public class SpinnerBonusTick : SpinnerTick
{ {
public new const int SCORE_PER_TICK = 50;
public SpinnerBonusTick() public SpinnerBonusTick()
{ {
Samples.Add(new HitSampleInfo { Name = "spinnerbonus" }); Samples.Add(new HitSampleInfo { Name = "spinnerbonus" });
@ -18,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Objects
public class OsuSpinnerBonusTickJudgement : OsuSpinnerTickJudgement public class OsuSpinnerBonusTickJudgement : OsuSpinnerTickJudgement
{ {
protected override int NumericResultFor(HitResult result) => 1100; protected override int NumericResultFor(HitResult result) => SCORE_PER_TICK;
protected override double HealthIncreaseFor(HitResult result) => base.HealthIncreaseFor(result) * 2; protected override double HealthIncreaseFor(HitResult result) => base.HealthIncreaseFor(result) * 2;
} }

View File

@ -9,6 +9,8 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
public class SpinnerTick : OsuHitObject public class SpinnerTick : OsuHitObject
{ {
public const int SCORE_PER_TICK = 10;
public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement(); public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement();
protected override HitWindows CreateHitWindows() => HitWindows.Empty; protected override HitWindows CreateHitWindows() => HitWindows.Empty;
@ -17,7 +19,7 @@ namespace osu.Game.Rulesets.Osu.Objects
{ {
public override bool AffectsCombo => false; public override bool AffectsCombo => false;
protected override int NumericResultFor(HitResult result) => 100; protected override int NumericResultFor(HitResult result) => SCORE_PER_TICK;
protected override double HealthIncreaseFor(HitResult result) => result == MaxResult ? 0.6 * base.HealthIncreaseFor(result) : 0; protected override double HealthIncreaseFor(HitResult result) => result == MaxResult ? 0.6 * base.HealthIncreaseFor(result) : 0;
} }

View File

@ -92,7 +92,7 @@ namespace osu.Game.Rulesets.Osu.Skinning
case OsuSkinComponents.HitCircleText: case OsuSkinComponents.HitCircleText:
var font = GetConfig<OsuSkinConfiguration, string>(OsuSkinConfiguration.HitCirclePrefix)?.Value ?? "default"; var font = GetConfig<OsuSkinConfiguration, string>(OsuSkinConfiguration.HitCirclePrefix)?.Value ?? "default";
var overlap = GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? 0; var overlap = GetConfig<OsuSkinConfiguration, float>(OsuSkinConfiguration.HitCircleOverlap)?.Value ?? -2;
return !hasFont(font) return !hasFont(font)
? null ? null

View File

@ -11,6 +11,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osuTK; using osuTK;
using osuTK.Input; using osuTK.Input;
@ -221,6 +222,31 @@ namespace osu.Game.Tests.Visual.Gameplay
confirmExited(); confirmExited();
} }
[Test]
public void TestPauseSoundLoop()
{
AddStep("seek before gameplay", () => Player.GameplayClockContainer.Seek(-5000));
SkinnableSound getLoop() => Player.ChildrenOfType<PauseOverlay>().FirstOrDefault()?.ChildrenOfType<SkinnableSound>().FirstOrDefault();
pauseAndConfirm();
AddAssert("loop is playing", () => getLoop().IsPlaying);
resumeAndConfirm();
AddUntilStep("loop is stopped", () => !getLoop().IsPlaying);
AddUntilStep("pause again", () =>
{
Player.Pause();
return !Player.GameplayClockContainer.GameplayClock.IsRunning;
});
AddAssert("loop is playing", () => getLoop().IsPlaying);
resumeAndConfirm();
AddUntilStep("loop is stopped", () => !getLoop().IsPlaying);
}
private void pauseAndConfirm() private void pauseAndConfirm()
{ {
pause(); pause();

View File

@ -11,14 +11,14 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Tests.Visual.UserInterface namespace osu.Game.Tests.Visual.UserInterface
{ {
[TestFixture] [TestFixture]
public class TestSceneHueAnimation : OsuTestScene public class TestSceneLogoAnimation : OsuTestScene
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LargeTextureStore textures) private void load(LargeTextureStore textures)
{ {
HueAnimation anim2; LogoAnimation anim2;
Add(anim2 = new HueAnimation Add(anim2 = new LogoAnimation
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
@ -26,9 +26,9 @@ namespace osu.Game.Tests.Visual.UserInterface
Colour = Colour4.White, Colour = Colour4.White,
}); });
HueAnimation anim; LogoAnimation anim;
Add(anim = new HueAnimation Add(anim = new LogoAnimation
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,

View File

@ -11,13 +11,13 @@ using osu.Framework.Graphics.Textures;
namespace osu.Game.Graphics.Sprites namespace osu.Game.Graphics.Sprites
{ {
public class HueAnimation : Sprite public class LogoAnimation : Sprite
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures) private void load(ShaderManager shaders, TextureStore textures)
{ {
TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); TextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation");
RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"HueAnimation"); // Masking isn't supported for now RoundedTextureShader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, @"LogoAnimation"); // Masking isn't supported for now
} }
private float animationProgress; private float animationProgress;
@ -36,15 +36,15 @@ namespace osu.Game.Graphics.Sprites
public override bool IsPresent => true; public override bool IsPresent => true;
protected override DrawNode CreateDrawNode() => new HueAnimationDrawNode(this); protected override DrawNode CreateDrawNode() => new LogoAnimationDrawNode(this);
private class HueAnimationDrawNode : SpriteDrawNode private class LogoAnimationDrawNode : SpriteDrawNode
{ {
private HueAnimation source => (HueAnimation)Source; private LogoAnimation source => (LogoAnimation)Source;
private float progress; private float progress;
public HueAnimationDrawNode(HueAnimation source) public LogoAnimationDrawNode(LogoAnimation source)
: base(source) : base(source)
{ {
} }

View File

@ -0,0 +1,48 @@
// 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.
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Comments.Buttons
{
public class ChevronButton : OsuHoverContainer
{
public readonly BindableBool Expanded = new BindableBool(true);
private readonly SpriteIcon icon;
public ChevronButton()
{
Size = new Vector2(40, 22);
Child = icon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(12),
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = HoverColour = colourProvider.Foreground1;
}
protected override void LoadComplete()
{
base.LoadComplete();
Action = Expanded.Toggle;
Expanded.BindValueChanged(onExpandedChanged, true);
}
private void onExpandedChanged(ValueChangedEvent<bool> expanded)
{
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown;
}
}
}

View File

@ -32,10 +32,6 @@ namespace osu.Game.Overlays.Comments.Buttons
protected CommentRepliesButton() protected CommentRepliesButton()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Margin = new MarginPadding
{
Vertical = 2
};
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new CircularContainer new CircularContainer

View File

@ -8,38 +8,42 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using System.Collections.Generic; using System.Collections.Generic;
using osuTK; using osuTK;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Comments namespace osu.Game.Overlays.Comments.Buttons
{ {
public abstract class GetCommentRepliesButton : LoadingButton public class ShowMoreButton : LoadingButton
{ {
private const int duration = 200;
protected override IEnumerable<Drawable> EffectTargets => new[] { text }; protected override IEnumerable<Drawable> EffectTargets => new[] { text };
private OsuSpriteText text; private OsuSpriteText text;
protected GetCommentRepliesButton() public ShowMoreButton()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
LoadingAnimationSize = new Vector2(8); LoadingAnimationSize = new Vector2(8);
} }
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Light2;
HoverColour = colourProvider.Light1;
}
protected override Drawable CreateContent() => new Container protected override Drawable CreateContent() => new Container
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Child = text = new OsuSpriteText Child = text = new OsuSpriteText
{ {
AlwaysPresent = true, AlwaysPresent = true,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = GetText() Text = "show more"
} }
}; };
protected abstract string GetText(); protected override void OnLoadStarted() => text.FadeOut(200, Easing.OutQuint);
protected override void OnLoadStarted() => text.FadeOut(duration, Easing.OutQuint); protected override void OnLoadFinished() => text.FadeIn(200, Easing.OutQuint);
protected override void OnLoadFinished() => text.FadeIn(duration, Easing.OutQuint);
} }
} }

View File

@ -23,8 +23,6 @@ namespace osu.Game.Overlays.Comments
public DeletedCommentsCounter() public DeletedCommentsCounter()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Margin = new MarginPadding { Vertical = 10, Left = 80 };
InternalChild = new FillFlowContainer InternalChild = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,

View File

@ -28,7 +28,6 @@ namespace osu.Game.Overlays.Comments
public class DrawableComment : CompositeDrawable public class DrawableComment : CompositeDrawable
{ {
private const int avatar_size = 40; private const int avatar_size = 40;
private const int margin = 10;
public Action<DrawableComment, int> RepliesRequested; public Action<DrawableComment, int> RepliesRequested;
@ -58,7 +57,7 @@ namespace osu.Game.Overlays.Comments
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OverlayColourProvider colourProvider)
{ {
LinkFlowContainer username; LinkFlowContainer username;
FillFlowContainer info; FillFlowContainer info;
@ -70,25 +69,25 @@ namespace osu.Game.Overlays.Comments
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new FillFlowContainer new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Padding = getPadding(Comment.IsTopLevel),
Children = new Drawable[] Child = new FillFlowContainer
{ {
new Container RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{ {
RelativeSizeAxes = Axes.X, content = new GridContainer
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding(margin) { Left = margin + 5, Top = Comment.IsTopLevel ? 10 : 0 },
Child = content = new GridContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
ColumnDimensions = new[] ColumnDimensions = new[]
{ {
new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Absolute, size: avatar_size + 10),
new Dimension(), new Dimension(),
}, },
RowDimensions = new[] RowDimensions = new[]
@ -99,93 +98,84 @@ namespace osu.Game.Overlays.Comments
{ {
new Drawable[] new Drawable[]
{ {
new FillFlowContainer new Container
{ {
AutoSizeAxes = Axes.Both, Size = new Vector2(avatar_size),
Margin = new MarginPadding { Horizontal = margin },
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
new Container
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Width = 40,
AutoSizeAxes = Axes.Y,
Child = votePill = new VotePill(Comment)
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}
},
new UpdateableAvatar(Comment.User) new UpdateableAvatar(Comment.User)
{ {
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(avatar_size), Size = new Vector2(avatar_size),
Masking = true, Masking = true,
CornerRadius = avatar_size / 2f, CornerRadius = avatar_size / 2f,
CornerExponent = 2, CornerExponent = 2,
}, },
votePill = new VotePill(Comment)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreRight,
Margin = new MarginPadding
{
Right = 5
}
}
} }
}, },
new FillFlowContainer new FillFlowContainer
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0, 3), Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 4),
Margin = new MarginPadding
{
Vertical = 2
},
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Spacing = new Vector2(7, 0), Spacing = new Vector2(10, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true)) username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold))
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both
}, },
new ParentUsername(Comment), new ParentUsername(Comment),
new OsuSpriteText new OsuSpriteText
{ {
Alpha = Comment.IsDeleted ? 1 : 0, Alpha = Comment.IsDeleted ? 1 : 0,
Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold),
Text = @"deleted", Text = "deleted"
} }
} }
}, },
message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14)) message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14))
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y
Padding = new MarginPadding { Right = 40 }
}, },
new FillFlowContainer info = new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical, Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
info = new FillFlowContainer new DrawableDate(Comment.CreatedAt, 12, false)
{ {
AutoSizeAxes = Axes.Both, Colour = colourProvider.Foreground1
Direction = FillDirection.Horizontal, }
Spacing = new Vector2(10, 0), }
Children = new Drawable[] },
{ new Container
new OsuSpriteText {
{ AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft, Children = new Drawable[]
Origin = Anchor.CentreLeft, {
Font = OsuFont.GetFont(size: 12),
Colour = OsuColour.Gray(0.7f),
Text = HumanizerUtils.Humanize(Comment.CreatedAt)
},
}
},
showRepliesButton = new ShowRepliesButton(Comment.RepliesCount) showRepliesButton = new ShowRepliesButton(Comment.RepliesCount)
{ {
Expanded = { BindTarget = childrenExpanded } Expanded = { BindTarget = childrenExpanded }
@ -200,41 +190,51 @@ namespace osu.Game.Overlays.Comments
} }
} }
} }
} },
}, childCommentsVisibilityContainer = new FillFlowContainer
childCommentsVisibilityContainer = new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{ {
childCommentsContainer = new FillFlowContainer RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Left = 20 },
Children = new Drawable[]
{ {
Padding = new MarginPadding { Left = 20 }, childCommentsContainer = new FillFlowContainer
RelativeSizeAxes = Axes.X, {
AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical AutoSizeAxes = Axes.Y,
}, Direction = FillDirection.Vertical
deletedCommentsCounter = new DeletedCommentsCounter },
{ deletedCommentsCounter = new DeletedCommentsCounter
ShowDeleted = { BindTarget = ShowDeleted } {
}, ShowDeleted = { BindTarget = ShowDeleted },
showMoreButton = new ShowMoreButton Margin = new MarginPadding
{ {
Action = () => RepliesRequested(this, ++currentPage) Top = 10
}
},
showMoreButton = new ShowMoreButton
{
Action = () => RepliesRequested(this, ++currentPage)
}
} }
} },
}, }
} }
}, },
chevronButton = new ChevronButton new Container
{ {
Size = new Vector2(70, 40),
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Margin = new MarginPadding { Right = 30, Top = margin }, Margin = new MarginPadding { Horizontal = 5 },
Expanded = { BindTarget = childrenExpanded }, Child = chevronButton = new ChevronButton
Alpha = 0 {
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Expanded = { BindTarget = childrenExpanded },
Alpha = 0
}
} }
}; };
@ -247,10 +247,9 @@ namespace osu.Game.Overlays.Comments
{ {
info.Add(new OsuSpriteText info.Add(new OsuSpriteText
{ {
Anchor = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular),
Origin = Anchor.CentreLeft, Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}",
Font = OsuFont.GetFont(size: 12), Colour = colourProvider.Foreground1
Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}"
}); });
} }
@ -357,35 +356,21 @@ namespace osu.Game.Overlays.Comments
showMoreButton.IsLoading = loadRepliesButton.IsLoading = false; showMoreButton.IsLoading = loadRepliesButton.IsLoading = false;
} }
private class ChevronButton : ShowChildrenButton private MarginPadding getPadding(bool isTopLevel)
{ {
private readonly SpriteIcon icon; if (isTopLevel)
public ChevronButton()
{ {
Child = icon = new SpriteIcon return new MarginPadding
{ {
Size = new Vector2(12), Horizontal = 70,
Vertical = 15
}; };
} }
protected override void OnExpandedChanged(ValueChangedEvent<bool> expanded) return new MarginPadding
{ {
icon.Icon = expanded.NewValue ? FontAwesome.Solid.ChevronUp : FontAwesome.Solid.ChevronDown; Top = 10
} };
}
private class ShowMoreButton : GetCommentRepliesButton
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Margin = new MarginPadding { Vertical = 10, Left = 80 };
IdleColour = colourProvider.Light2;
HoverColour = colourProvider.Light1;
}
protected override string GetText() => @"Show More";
} }
private class ParentUsername : FillFlowContainer, IHasTooltip private class ParentUsername : FillFlowContainer, IHasTooltip

View File

@ -1,33 +0,0 @@
// 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.
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
using osu.Framework.Bindables;
using osuTK.Graphics;
using osu.Game.Graphics;
namespace osu.Game.Overlays.Comments
{
public abstract class ShowChildrenButton : OsuHoverContainer
{
public readonly BindableBool Expanded = new BindableBool(true);
protected ShowChildrenButton()
{
AutoSizeAxes = Axes.Both;
IdleColour = OsuColour.Gray(0.7f);
HoverColour = Color4.White;
}
protected override void LoadComplete()
{
Action = Expanded.Toggle;
Expanded.BindValueChanged(OnExpandedChanged, true);
base.LoadComplete();
}
protected abstract void OnExpandedChanged(ValueChangedEvent<bool> expanded);
}
}

View File

@ -130,7 +130,11 @@ namespace osu.Game.Rulesets.Judgements
if (type == currentDrawableType) if (type == currentDrawableType)
return; return;
InternalChild = JudgementBody = new Container // sub-classes might have added their own children that would be removed here if .InternalChild was used.
if (JudgementBody != null)
RemoveInternal(JudgementBody);
AddInternal(JudgementBody = new Container
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -142,7 +146,7 @@ namespace osu.Game.Rulesets.Judgements
Colour = colours.ForHitResult(type), Colour = colours.ForHitResult(type),
Scale = new Vector2(0.85f, 1), Scale = new Vector2(0.85f, 1),
}, confineMode: ConfineMode.NoScaling) }, confineMode: ConfineMode.NoScaling)
}; });
currentDrawableType = type; currentDrawableType = type;
} }

View File

@ -260,7 +260,7 @@ namespace osu.Game.Screens.Menu
private class LazerLogo : CompositeDrawable private class LazerLogo : CompositeDrawable
{ {
private HueAnimation highlight, background; private LogoAnimation highlight, background;
public float Progress public float Progress
{ {
@ -282,13 +282,13 @@ namespace osu.Game.Screens.Menu
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
highlight = new HueAnimation highlight = new LogoAnimation
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Texture = textures.Get(@"Intro/Triangles/logo-highlight"), Texture = textures.Get(@"Intro/Triangles/logo-highlight"),
Colour = Color4.White, Colour = Color4.White,
}, },
background = new HueAnimation background = new LogoAnimation
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Texture = textures.Get(@"Intro/Triangles/logo-background"), Texture = textures.Get(@"Intro/Triangles/logo-background"),

View File

@ -24,7 +24,8 @@ namespace osu.Game.Screens.Play
{ {
public abstract class GameplayMenuOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction> public abstract class GameplayMenuOverlay : OverlayContainer, IKeyBindingHandler<GlobalAction>
{ {
private const int transition_duration = 200; protected const int TRANSITION_DURATION = 200;
private const int button_height = 70; private const int button_height = 70;
private const float background_alpha = 0.75f; private const float background_alpha = 0.75f;
@ -156,8 +157,8 @@ namespace osu.Game.Screens.Play
} }
} }
protected override void PopIn() => this.FadeIn(transition_duration, Easing.In); protected override void PopIn() => this.FadeIn(TRANSITION_DURATION, Easing.In);
protected override void PopOut() => this.FadeOut(transition_duration, Easing.In); protected override void PopOut() => this.FadeOut(TRANSITION_DURATION, Easing.In);
// Don't let mouse down events through the overlay or people can click circles while paused. // Don't let mouse down events through the overlay or people can click circles while paused.
protected override bool OnMouseDown(MouseDownEvent e) => true; protected override bool OnMouseDown(MouseDownEvent e) => true;

View File

@ -4,7 +4,10 @@
using System; using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Audio;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Skinning;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
@ -13,17 +16,46 @@ namespace osu.Game.Screens.Play
{ {
public Action OnResume; public Action OnResume;
public override bool IsPresent => base.IsPresent || pauseLoop.IsPlaying;
public override string Header => "paused"; public override string Header => "paused";
public override string Description => "you're not going to do what i think you're going to do, are ya?"; public override string Description => "you're not going to do what i think you're going to do, are ya?";
private SkinnableSound pauseLoop;
protected override Action BackAction => () => InternalButtons.Children.First().Click(); protected override Action BackAction => () => InternalButtons.Children.First().Click();
private const float minimum_volume = 0.0001f;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
AddButton("Continue", colours.Green, () => OnResume?.Invoke()); AddButton("Continue", colours.Green, () => OnResume?.Invoke());
AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke());
AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke());
AddInternal(pauseLoop = new SkinnableSound(new SampleInfo("pause-loop"))
{
Looping = true,
});
// SkinnableSound only plays a sound if its aggregate volume is > 0, so the volume must be turned up before playing it
pauseLoop.VolumeTo(minimum_volume);
}
protected override void PopIn()
{
base.PopIn();
pauseLoop.VolumeTo(1.0f, TRANSITION_DURATION, Easing.InQuint);
pauseLoop.Play();
}
protected override void PopOut()
{
base.PopOut();
pauseLoop.VolumeTo(minimum_volume, TRANSITION_DURATION, Easing.OutQuad).Finally(_ => pauseLoop.Stop());
} }
} }
} }

View File

@ -48,6 +48,10 @@ namespace osu.Game.Skinning
public BindableNumber<double> Tempo => samplesContainer.Tempo; public BindableNumber<double> Tempo => samplesContainer.Tempo;
public override bool IsPresent => Scheduler.HasPendingTasks || IsPlaying;
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
/// <summary> /// <summary>
/// Smoothly adjusts <see cref="Volume"/> over time. /// Smoothly adjusts <see cref="Volume"/> over time.
/// </summary> /// </summary>
@ -97,8 +101,6 @@ namespace osu.Game.Skinning
public void Stop() => samplesContainer.ForEach(c => c.Stop()); public void Stop() => samplesContainer.ForEach(c => c.Stop());
public override bool IsPresent => Scheduler.HasPendingTasks;
protected override void SkinChanged(ISkinSource skin, bool allowFallback) protected override void SkinChanged(ISkinSource skin, bool allowFallback)
{ {
bool wasPlaying = samplesContainer.Any(s => s.Playing); bool wasPlaying = samplesContainer.Any(s => s.Playing);

View File

@ -305,8 +305,10 @@ namespace osu.Game.Tests.Visual
{ {
double refTime = referenceClock.CurrentTime; double refTime = referenceClock.CurrentTime;
if (lastReferenceTime.HasValue) double? lastRefTime = lastReferenceTime;
accumulated += (refTime - lastReferenceTime.Value) * Rate;
if (lastRefTime != null)
accumulated += (refTime - lastRefTime.Value) * Rate;
lastReferenceTime = refTime; lastReferenceTime = refTime;
} }

View File

@ -25,9 +25,9 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.723.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.723.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.715.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.727.1" />
<PackageReference Include="Sentry" Version="2.1.4" /> <PackageReference Include="Sentry" Version="2.1.5" />
<PackageReference Include="SharpCompress" Version="0.25.1" /> <PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />
</ItemGroup> </ItemGroup>

View File

@ -71,7 +71,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.723.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.723.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.715.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.727.1" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
@ -81,7 +81,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.723.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.723.0" />
<PackageReference Include="SharpCompress" Version="0.25.1" /> <PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" /> <PackageReference Include="System.ComponentModel.Annotations" Version="4.7.0" />