1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 21:02:55 +08:00

Merge branch 'master' into improve-catch-replay-frames

This commit is contained in:
Dan Balasescu 2019-09-13 19:23:15 +09:00 committed by GitHub
commit 125b3fda6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 804 additions and 174 deletions

View File

@ -62,7 +62,7 @@
<Reference Include="Java.Interop" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.913.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.911.0" />
</ItemGroup>
</Project>

View File

@ -71,11 +71,11 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
switch (state)
{
case ArmedState.Miss:
this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out).Expire();
this.FadeOut(250).RotateTo(Rotation * 2, 250, Easing.Out);
break;
case ArmedState.Hit:
this.FadeOut().Expire();
this.FadeOut();
break;
}
}

View File

@ -51,11 +51,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
switch (state)
{
case ArmedState.Miss:
this.FadeOut(150, Easing.In).Expire();
this.FadeOut(150, Easing.In);
break;
case ArmedState.Hit:
this.FadeOut(150, Easing.OutQuint).Expire();
this.FadeOut(150, Easing.OutQuint);
break;
}
}

View File

@ -86,6 +86,26 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
AccentColour.BindValueChanged(accent => ApproachCircle.Colour = accent.NewValue, true);
}
public override double LifetimeStart
{
get => base.LifetimeStart;
set
{
base.LifetimeStart = value;
ApproachCircle.LifetimeStart = value;
}
}
public override double LifetimeEnd
{
get => base.LifetimeEnd;
set
{
base.LifetimeEnd = value;
ApproachCircle.LifetimeEnd = value;
}
}
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
Debug.Assert(HitObject.HitWindows != null);
@ -122,6 +142,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateStateTransforms(ArmedState state)
{
base.UpdateStateTransforms(state);
Debug.Assert(HitObject.HitWindows != null);
switch (state)
@ -132,22 +154,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Expire(true);
hitArea.HitAction = null;
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.WindowFor(HitResult.Miss);
break;
case ArmedState.Miss:
ApproachCircle.FadeOut(50);
this.FadeOut(100);
Expire();
break;
case ArmedState.Hit:
ApproachCircle.FadeOut(50);
// todo: temporary / arbitrary
this.Delay(800).Expire();
this.Delay(800).FadeOut();
break;
}
}

View File

@ -41,6 +41,19 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected virtual void Shake(double maximumLength) => shakeContainer.Shake(maximumLength);
protected override void UpdateStateTransforms(ArmedState state)
{
base.UpdateStateTransforms(state);
switch (state)
{
case ArmedState.Idle:
// Manually set to reduce the number of future alive objects to a bare minimum.
LifetimeStart = HitObject.StartTime - HitObject.TimePreempt;
break;
}
}
protected override JudgementResult CreateResult(Judgement judgement) => new OsuJudgementResult(HitObject, judgement);
}
}

View File

@ -74,6 +74,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateStateTransforms(ArmedState state)
{
base.UpdateStateTransforms(state);
switch (state)
{
case ArmedState.Idle:

View File

@ -202,6 +202,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateStateTransforms(ArmedState state)
{
base.UpdateStateTransforms(state);
Ball.FadeIn();
Ball.ScaleTo(HitObject.Scale);
@ -219,10 +221,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
break;
}
this.FadeOut(fade_out_time, Easing.OutQuint).Expire();
this.FadeOut(fade_out_time, Easing.OutQuint);
}
Expire(true);
}
public Drawable ProxiedLayer => HeadCircle.ApproachCircle;

View File

@ -75,6 +75,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateStateTransforms(ArmedState state)
{
base.UpdateStateTransforms(state);
switch (state)
{
case ArmedState.Idle:

View File

@ -215,14 +215,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void UpdateStateTransforms(ArmedState state)
{
base.UpdateStateTransforms(state);
var sequence = this.Delay(Spinner.Duration).FadeOut(160);
switch (state)
{
case ArmedState.Idle:
Expire(true);
break;
case ArmedState.Hit:
sequence.ScaleTo(Scale * 1.2f, 320, Easing.Out);
break;
@ -231,8 +229,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
sequence.ScaleTo(Scale * 0.8f, 320, Easing.In);
break;
}
Expire();
}
}
}

View File

@ -70,13 +70,7 @@ namespace osu.Game.Rulesets.Osu.UI
base.Add(h);
}
private void addApproachCircleProxy(Drawable d)
{
var proxy = d.CreateProxy();
proxy.LifetimeStart = d.LifetimeStart;
proxy.LifetimeEnd = d.LifetimeEnd;
approachCircles.Add(proxy);
}
private void addApproachCircleProxy(Drawable d) => approachCircles.Add(d.CreateProxy());
public override void PostProcess()
{

View File

@ -94,7 +94,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
case ArmedState.Hit:
case ArmedState.Miss:
this.Delay(HitObject.Duration).FadeOut(100).Expire();
this.Delay(HitObject.Duration).FadeOut(100);
break;
}
}

View File

@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
switch (state)
{
case ArmedState.Hit:
this.ScaleTo(0, 100, Easing.OutQuint).Expire();
this.ScaleTo(0, 100, Easing.OutQuint);
break;
}
}

View File

@ -105,12 +105,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
validActionPressed = false;
UnproxyContent();
this.Delay(HitObject.HitWindows.WindowFor(HitResult.Miss)).Expire();
break;
case ArmedState.Miss:
this.FadeOut(100)
.Expire();
this.FadeOut(100);
break;
case ArmedState.Hit:
@ -129,9 +127,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
.Then()
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);
this.FadeOut(800)
.Expire();
this.FadeOut(800);
break;
}
}

View File

@ -208,8 +208,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
this.FadeOut(transition_duration, Easing.Out);
bodyContainer.ScaleTo(1.4f, transition_duration);
Expire();
}
break;

View File

@ -160,6 +160,15 @@ namespace osu.Game.Tests.Visual.Gameplay
exitAndConfirm();
}
[Test]
public void TestRestartAfterResume()
{
pauseAndConfirm();
resumeAndConfirm();
restart();
confirmExited();
}
private void pauseAndConfirm()
{
pause();
@ -198,6 +207,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("player exited", () => !Player.IsCurrentScreen());
}
private void restart() => AddStep("restart", () => Player.Restart());
private void pause() => AddStep("pause", () => Player.Pause());
private void resume() => AddStep("resume", () => Player.Resume());

View File

@ -0,0 +1,65 @@
// 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 System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Overlays.Rankings;
using osu.Game.Users;
using osuTK;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsDismissableFlag : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DismissableFlag),
};
public TestSceneRankingsDismissableFlag()
{
DismissableFlag flag;
SpriteText text;
var countryA = new Country
{
FlagName = "BY",
FullName = "Belarus"
};
var countryB = new Country
{
FlagName = "US",
FullName = "United States"
};
AddRange(new Drawable[]
{
flag = new DismissableFlag
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(30, 20),
Country = countryA,
},
text = new SpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Invoked",
Font = OsuFont.GetFont(size: 30),
Alpha = 0,
}
});
flag.Action += () => text.FadeIn().Then().FadeOut(1000, Easing.OutQuint);
AddStep("Trigger click", () => flag.Click());
AddStep("Change to country 2", () => flag.Country = countryB);
AddStep("Change to country 1", () => flag.Country = countryA);
}
}
}

View File

@ -0,0 +1,70 @@
// 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 System;
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays.Rankings;
using osu.Game.Rulesets;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsHeader : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DismissableFlag),
typeof(HeaderTitle),
typeof(RankingsRulesetSelector),
typeof(RankingsScopeSelector),
typeof(RankingsHeader),
};
public TestSceneRankingsHeader()
{
var countryBindable = new Bindable<Country>();
var ruleset = new Bindable<RulesetInfo>();
var scope = new Bindable<RankingsScope>();
Add(new RankingsHeader
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scope = { BindTarget = scope },
Country = { BindTarget = countryBindable },
Ruleset = { BindTarget = ruleset },
Spotlights = new[]
{
new Spotlight
{
Id = 1,
Text = "Spotlight 1"
},
new Spotlight
{
Id = 2,
Text = "Spotlight 2"
},
new Spotlight
{
Id = 3,
Text = "Spotlight 3"
}
}
});
var country = new Country
{
FlagName = "BY",
FullName = "Belarus"
};
AddStep("Set country", () => countryBindable.Value = country);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is Null", () => countryBindable.Value == null);
}
}
}

View File

@ -0,0 +1,60 @@
// 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 System;
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays.Rankings;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsHeaderTitle : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DismissableFlag),
typeof(HeaderTitle),
};
public TestSceneRankingsHeaderTitle()
{
var countryBindable = new Bindable<Country>();
var scope = new Bindable<RankingsScope>();
Add(new HeaderTitle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Country = { BindTarget = countryBindable },
Scope = { BindTarget = scope },
});
var countryA = new Country
{
FlagName = "BY",
FullName = "Belarus"
};
var countryB = new Country
{
FlagName = "US",
FullName = "United States"
};
AddStep("Set country", () => countryBindable.Value = countryA);
AddAssert("Check scope is Performance", () => scope.Value == RankingsScope.Performance);
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddAssert("Check country is Null", () => countryBindable.Value == null);
AddStep("Set country 1", () => countryBindable.Value = countryA);
AddStep("Set country 2", () => countryBindable.Value = countryB);
AddStep("Set null country", () => countryBindable.Value = null);
AddStep("Set scope to Performance", () => scope.Value = RankingsScope.Performance);
AddStep("Set scope to Spotlights", () => scope.Value = RankingsScope.Spotlights);
AddStep("Set scope to Score", () => scope.Value = RankingsScope.Score);
AddStep("Set scope to Country", () => scope.Value = RankingsScope.Country);
}
}
}

View File

@ -0,0 +1,54 @@
// 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 System;
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Overlays.Rankings;
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneRankingsScopeSelector : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(RankingsScopeSelector),
};
private readonly Box background;
public TestSceneRankingsScopeSelector()
{
var scope = new Bindable<RankingsScope>();
AddRange(new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both
},
new RankingsScopeSelector
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Current = scope,
}
});
AddStep(@"Select country", () => scope.Value = RankingsScope.Country);
AddStep(@"Select performance", () => scope.Value = RankingsScope.Performance);
AddStep(@"Select score", () => scope.Value = RankingsScope.Score);
AddStep(@"Select spotlights", () => scope.Value = RankingsScope.Spotlights);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.GreySeafoam;
}
}
}

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual.UserInterface
Add(overlay = new DialogOverlay());
AddStep("dialog #1", () => overlay.Push(new PopupDialog
AddStep("dialog #1", () => overlay.Push(new TestPopupDialog
{
Icon = FontAwesome.Regular.TrashAlt,
HeaderText = @"Confirm deletion of",
@ -37,7 +37,7 @@ namespace osu.Game.Tests.Visual.UserInterface
},
}));
AddStep("dialog #2", () => overlay.Push(new PopupDialog
AddStep("dialog #2", () => overlay.Push(new TestPopupDialog
{
Icon = FontAwesome.Solid.Cog,
HeaderText = @"What do you want to do with",
@ -71,5 +71,9 @@ namespace osu.Game.Tests.Visual.UserInterface
},
}));
}
private class TestPopupDialog : PopupDialog
{
}
}
}

View File

@ -13,13 +13,22 @@ namespace osu.Game.Tests.Visual.UserInterface
{
public TestScenePopupDialog()
{
var popup = new PopupDialog
Add(new TestPopupDialog
{
RelativeSizeAxes = Axes.Both,
State = { Value = Framework.Graphics.Containers.Visibility.Visible },
Icon = FontAwesome.Solid.AssistiveListeningSystems,
HeaderText = @"This is a test popup",
BodyText = "I can say lots of stuff and even wrap my words!",
});
}
private class TestPopupDialog : PopupDialog
{
public TestPopupDialog()
{
Icon = FontAwesome.Solid.AssistiveListeningSystems;
HeaderText = @"This is a test popup";
BodyText = "I can say lots of stuff and even wrap my words!";
Buttons = new PopupDialogButton[]
{
new PopupDialogCancelButton
@ -30,10 +39,8 @@ namespace osu.Game.Tests.Visual.UserInterface
{
Text = @"You're a fake!",
},
}
};
Add(popup);
};
}
}
}
}

View File

@ -21,8 +21,6 @@ namespace osu.Game.Graphics.Containers
private SampleChannel samplePopIn;
private SampleChannel samplePopOut;
protected virtual bool PlaySamplesOnStateChange => true;
protected override bool BlockNonPositionalInput => true;
/// <summary>
@ -126,12 +124,12 @@ namespace osu.Game.Graphics.Containers
return;
}
if (PlaySamplesOnStateChange) samplePopIn?.Play();
samplePopIn?.Play();
if (BlockScreenWideMouse && DimMainContent) game?.AddBlockingOverlay(this);
break;
case Visibility.Hidden:
if (PlaySamplesOnStateChange) samplePopOut?.Play();
samplePopOut?.Play();
if (BlockScreenWideMouse) game?.RemoveBlockingOverlay(this);
break;
}

View File

@ -0,0 +1,84 @@
// 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.UserInterface;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osuTK;
using osu.Framework.Graphics.Shapes;
using osuTK.Graphics;
using osu.Framework.Graphics.Colour;
namespace osu.Game.Graphics.UserInterface
{
public abstract class GradientLineTabControl<TModel> : PageTabControl<TModel>
{
protected Color4 LineColour
{
get => line.Colour;
set => line.Colour = value;
}
private readonly GradientLine line;
protected GradientLineTabControl()
{
RelativeSizeAxes = Axes.X;
AddInternal(line = new GradientLine
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
});
}
protected override Dropdown<TModel> CreateDropdown() => null;
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20, 0),
};
private class GradientLine : GridContainer
{
public GradientLine()
{
RelativeSizeAxes = Axes.X;
Size = new Vector2(0.8f, 1.5f);
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(mode: GridSizeMode.Relative, size: 0.4f),
new Dimension(),
};
Content = new[]
{
new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(Color4.Transparent, Color4.White)
},
new Box
{
RelativeSizeAxes = Axes.Both,
},
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(Color4.White, Color4.Transparent)
},
}
};
}
}
}
}

View File

@ -215,6 +215,7 @@ namespace osu.Game.Online.Leaderboards
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(1),
ChildrenEnumerable = score.Mods.Select(mod => new ModIcon(mod) { Scale = new Vector2(0.375f) })
},
},

View File

@ -1,60 +1,37 @@
// 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.UserInterface;
using osu.Game.Screens.Select.Leaderboards;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osuTK;
using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using osuTK.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Framework.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
public class LeaderboardScopeSelector : PageTabControl<BeatmapLeaderboardScope>
public class LeaderboardScopeSelector : GradientLineTabControl<BeatmapLeaderboardScope>
{
protected override bool AddEnumEntriesAutomatically => false;
protected override Dropdown<BeatmapLeaderboardScope> CreateDropdown() => null;
protected override TabItem<BeatmapLeaderboardScope> CreateTabItem(BeatmapLeaderboardScope value) => new ScopeSelectorTabItem(value);
public LeaderboardScopeSelector()
{
RelativeSizeAxes = Axes.X;
AddItem(BeatmapLeaderboardScope.Global);
AddItem(BeatmapLeaderboardScope.Country);
AddItem(BeatmapLeaderboardScope.Friend);
AddInternal(new GradientLine
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
});
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.Blue;
LineColour = Color4.Gray;
}
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20, 0),
};
private class ScopeSelectorTabItem : PageTabItem
{
public ScopeSelectorTabItem(BeatmapLeaderboardScope value)
@ -77,43 +54,5 @@ namespace osu.Game.Overlays.BeatmapSet
Text.FadeColour(Color4.White);
}
}
private class GradientLine : GridContainer
{
public GradientLine()
{
RelativeSizeAxes = Axes.X;
Size = new Vector2(0.8f, 1.5f);
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(mode: GridSizeMode.Relative, size: 0.4f),
new Dimension(),
};
Content = new[]
{
new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(Color4.Transparent, Color4.Gray),
},
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Gray,
},
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientHorizontal(Color4.Gray, Color4.Transparent),
},
}
};
}
}
}
}

View File

@ -171,6 +171,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(1),
ChildrenEnumerable = score.Mods.Select(m => new ModIcon(m)
{
AutoSizeAxes = Axes.Both,

View File

@ -172,7 +172,8 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
: this(new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal
Direction = FillDirection.Horizontal,
Spacing = new Vector2(1),
})
{
}

View File

@ -13,20 +13,17 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
using osu.Game.Input.Bindings;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
namespace osu.Game.Overlays.Dialog
{
public class PopupDialog : OsuFocusedOverlayContainer
public abstract class PopupDialog : VisibilityContainer
{
public static readonly float ENTER_DURATION = 500;
public static readonly float EXIT_DURATION = 200;
protected override bool BlockPositionalInput => false;
private readonly Vector2 ringSize = new Vector2(100f);
private readonly Vector2 ringMinifiedSize = new Vector2(20f);
private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f);
@ -90,7 +87,7 @@ namespace osu.Game.Overlays.Dialog
}
}
public PopupDialog()
protected PopupDialog()
{
RelativeSizeAxes = Axes.Both;
@ -202,18 +199,6 @@ namespace osu.Game.Overlays.Dialog
};
}
public override bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.Select:
Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.Click();
return true;
}
return base.OnPressed(action);
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.Repeat) return false;
@ -238,8 +223,6 @@ namespace osu.Game.Overlays.Dialog
protected override void PopIn()
{
base.PopIn();
actionInvoked = false;
// Reset various animations but only if the dialog animation fully completed
@ -263,7 +246,6 @@ namespace osu.Game.Overlays.Dialog
// This is presumed to always be a sane default "cancel" action.
buttonsContainer.Last().Click();
base.PopOut();
content.FadeOut(EXIT_DURATION, Easing.InSine);
}

View File

@ -5,6 +5,8 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays.Dialog;
using osu.Game.Graphics.Containers;
using osu.Game.Input.Bindings;
using System.Linq;
namespace osu.Game.Overlays
{
@ -41,8 +43,6 @@ namespace osu.Game.Overlays
Show();
}
protected override bool PlaySamplesOnStateChange => false;
protected override bool BlockNonPositionalInput => true;
private void onDialogOnStateChanged(VisibilityContainer dialog, Visibility v)
@ -74,5 +74,17 @@ namespace osu.Game.Overlays
this.FadeOut(PopupDialog.EXIT_DURATION, Easing.InSine);
}
public override bool OnPressed(GlobalAction action)
{
switch (action)
{
case GlobalAction.Select:
currentDialog?.Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.Click();
return true;
}
return base.OnPressed(action);
}
}
}

View File

@ -12,12 +12,13 @@ using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Beatmaps;
using osu.Framework.Localisation;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public abstract class DrawableProfileScore : DrawableProfileRow
{
private readonly ScoreModsContainer modsContainer;
private readonly FillFlowContainer modsContainer;
protected readonly ScoreInfo Score;
protected DrawableProfileScore(ScoreInfo score)
@ -28,12 +29,12 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Height = 60;
Children = new Drawable[]
{
modsContainer = new ScoreModsContainer
modsContainer = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Width = 60,
Spacing = new Vector2(1),
Margin = new MarginPadding { Right = 160 }
}
};

View File

@ -1,21 +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 osuTK;
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.UI;
using System.Collections.Generic;
using System.Linq;
namespace osu.Game.Overlays.Profile.Sections.Ranks
{
public class ScoreModsContainer : FlowContainer<ModIcon>
{
protected override IEnumerable<Vector2> ComputeLayoutPositions()
{
int count = FlowingChildren.Count();
for (int i = 0; i < count; i++)
yield return new Vector2(DrawWidth * i * (count == 1 ? 0 : 1f / (count - 1)), 0);
}
}
}

View File

@ -0,0 +1,55 @@
// 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.Framework.Graphics.Sprites;
using osu.Game.Users.Drawables;
using osuTK.Graphics;
using osuTK;
using osu.Framework.Input.Events;
using System;
namespace osu.Game.Overlays.Rankings
{
public class DismissableFlag : UpdateableFlag
{
private const int duration = 200;
public Action Action;
private readonly SpriteIcon hoverIcon;
public DismissableFlag()
{
AddInternal(hoverIcon = new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Depth = -1,
Alpha = 0,
Size = new Vector2(10),
Icon = FontAwesome.Solid.Times,
});
}
protected override bool OnHover(HoverEvent e)
{
hoverIcon.FadeIn(duration, Easing.OutQuint);
this.FadeColour(Color4.Gray, duration, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
hoverIcon.FadeOut(duration, Easing.OutQuint);
this.FadeColour(Color4.White, duration, Easing.OutQuint);
}
protected override bool OnClick(ClickEvent e)
{
Action?.Invoke();
return true;
}
}
}

View File

@ -0,0 +1,98 @@
// 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.Bindables;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Users;
using osu.Framework.Graphics;
using osuTK;
using osu.Game.Graphics;
using osu.Framework.Allocation;
namespace osu.Game.Overlays.Rankings
{
public class HeaderTitle : CompositeDrawable
{
private const int spacing = 10;
private const int flag_margin = 5;
private const int text_size = 40;
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();
public readonly Bindable<Country> Country = new Bindable<Country>();
private readonly SpriteText scopeText;
private readonly DismissableFlag flag;
public HeaderTitle()
{
AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(spacing, 0),
Children = new Drawable[]
{
flag = new DismissableFlag
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Margin = new MarginPadding { Bottom = flag_margin },
Size = new Vector2(30, 20),
},
scopeText = new SpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light)
},
new SpriteText
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Light),
Text = @"Ranking"
}
}
};
flag.Action += () => Country.Value = null;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
scopeText.Colour = colours.Lime;
}
protected override void LoadComplete()
{
Scope.BindValueChanged(onScopeChanged, true);
Country.BindValueChanged(onCountryChanged, true);
base.LoadComplete();
}
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope)
{
scopeText.Text = scope.NewValue.ToString();
if (scope.NewValue != RankingsScope.Performance)
Country.Value = null;
}
private void onCountryChanged(ValueChangedEvent<Country> country)
{
if (country.NewValue == null)
{
flag.Hide();
return;
}
Scope.Value = RankingsScope.Performance;
flag.Country = country.NewValue;
flag.Show();
}
}
}

View File

@ -0,0 +1,137 @@
// 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.Containers;
using osu.Framework.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Rulesets;
using osu.Game.Users;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osuTK;
using osu.Game.Graphics.UserInterface;
using System.Collections.Generic;
namespace osu.Game.Overlays.Rankings
{
public class RankingsHeader : CompositeDrawable
{
private const int content_height = 250;
private const int dropdown_height = 50;
public IEnumerable<Spotlight> Spotlights
{
get => dropdown.Items;
set => dropdown.Items = value;
}
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();
public readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
public readonly Bindable<Country> Country = new Bindable<Country>();
public readonly Bindable<Spotlight> Spotlight = new Bindable<Spotlight>();
private readonly Container dropdownPlaceholder;
private readonly OsuDropdown<Spotlight> dropdown;
public RankingsHeader()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
AddInternal(new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
new RankingsRulesetSelector
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Current = Ruleset
},
new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = content_height,
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Child = new HeaderBackground(),
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{
new RankingsScopeSelector
{
Margin = new MarginPadding { Top = 10 },
Current = Scope
},
new HeaderTitle
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Margin = new MarginPadding { Top = 10 },
Scope = { BindTarget = Scope },
Country = { BindTarget = Country },
},
dropdownPlaceholder = new Container
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
Height = dropdown_height,
Width = 0.8f,
AlwaysPresent = true,
Child = dropdown = new OsuDropdown<Spotlight>
{
RelativeSizeAxes = Axes.X,
Current = Spotlight,
}
}
}
},
}
}
}
});
}
protected override void LoadComplete()
{
Scope.BindValueChanged(onScopeChanged, true);
base.LoadComplete();
}
private void onScopeChanged(ValueChangedEvent<RankingsScope> scope) =>
dropdownPlaceholder.FadeTo(scope.NewValue == RankingsScope.Spotlights ? 1 : 0, 200, Easing.OutQuint);
private class HeaderBackground : Sprite
{
public HeaderBackground()
{
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fill;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
Texture = textures.Get(@"Headers/rankings");
}
}
}
}

View File

@ -0,0 +1,26 @@
// 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.Game.Graphics.UserInterface;
using osu.Framework.Allocation;
using osuTK.Graphics;
namespace osu.Game.Overlays.Rankings
{
public class RankingsScopeSelector : GradientLineTabControl<RankingsScope>
{
[BackgroundDependencyLoader]
private void load()
{
AccentColour = LineColour = Color4.Black;
}
}
public enum RankingsScope
{
Performance,
Spotlights,
Score,
Country
}
}

View File

@ -0,0 +1,18 @@
// 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 Newtonsoft.Json;
namespace osu.Game.Overlays.Rankings
{
public class Spotlight
{
[JsonProperty("id")]
public int Id;
[JsonProperty("text")]
public string Text;
public override string ToString() => Text;
}
}

View File

@ -153,6 +153,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (UseTransformStateManagement)
{
LifetimeEnd = double.MaxValue;
double transformTime = HitObject.StartTime - InitialLifetimeOffset;
base.ApplyTransformsAt(transformTime, true);
@ -170,6 +172,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
state.Value = newState;
}
}
if (state.Value != ArmedState.Idle && LifetimeEnd == double.MaxValue)
Expire();
}
else
state.Value = newState;
@ -200,6 +205,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <summary>
/// Apply transforms based on the current <see cref="ArmedState"/>. Previous states are automatically cleared.
/// In the case of a non-idle <see cref="ArmedState"/>, and if <see cref="Drawable.LifetimeEnd"/> was not set during this call, <see cref="Drawable.Expire"/> will be invoked.
/// </summary>
/// <param name="state">The new armed state.</param>
protected virtual void UpdateStateTransforms(ArmedState state)
@ -308,7 +314,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
/// <remarks>
/// This is only used as an optimisation to delay the initial update of this <see cref="DrawableHitObject"/> and may be tuned more aggressively if required.
/// It is indirectly used to decide the automatic transform offset provided to <see cref="UpdateInitialTransforms"/>.
/// A more accurate <see cref="LifetimeStart"/> should be set inside <see cref="UpdateState"/> for an <see cref="ArmedState.Idle"/> state.
/// A more accurate <see cref="LifetimeStart"/> should be set for further optimisation (in <see cref="LoadComplete"/>, for example).
/// </remarks>
protected virtual double InitialLifetimeOffset => 10000;

View File

@ -502,15 +502,18 @@ namespace osu.Game.Screens.Play
return true;
}
if (pauseCooldownActive && !GameplayClockContainer.IsPaused.Value)
// still want to block if we are within the cooldown period and not already paused.
return true;
if (HasFailed && ValidForResume && !FailOverlay.IsPresent)
// ValidForResume is false when restarting
// ValidForResume is false when restarting
if (ValidForResume)
{
failAnimation.FinishTransforms(true);
return true;
if (pauseCooldownActive && !GameplayClockContainer.IsPaused.Value)
// still want to block if we are within the cooldown period and not already paused.
return true;
if (HasFailed && !FailOverlay.IsPresent)
{
failAnimation.FinishTransforms(true);
return true;
}
}
GameplayClockContainer.ResetLocalAdjustments();

View File

@ -25,7 +25,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.913.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.911.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -117,7 +117,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.904.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.913.0" />
<PackageReference Include="ppy.osu.Framework" Version="2019.911.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.911.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />