Merge branch 'master' into s-rank-change

This commit is contained in:
Bartłomiej Dach 2024-01-22 19:54:53 +01:00
commit 5bae9074aa
No known key found for this signature in database
14 changed files with 81 additions and 59 deletions

View File

@ -65,14 +65,15 @@ public virtual void PlayAnimation()
if (Result == HitResult.IgnoreMiss || Result == HitResult.LargeTickMiss)
{
this.RotateTo(-45);
this.ScaleTo(1.8f);
this.ScaleTo(1.6f);
this.ScaleTo(1.2f, 100, Easing.In);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 10), 800, Easing.InQuint);
this.FadeOutFromOne(400);
}
else if (Result.IsMiss())
{
this.FadeOutFromOne(800);
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
@ -84,14 +85,14 @@ public virtual void PlayAnimation()
}
else
{
this.FadeOutFromOne(800);
JudgementText
.FadeInFromZero(300, Easing.OutQuint)
.ScaleTo(Vector2.One)
.ScaleTo(new Vector2(1.2f), 1800, Easing.OutQuint);
}
this.FadeOutFromOne(800);
ringExplosion?.PlayAnimation();
}

View File

@ -1,7 +1,6 @@
// 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 osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -153,16 +152,12 @@ public bool OnPressed(KeyBindingPressEvent<TaikoAction> e)
if (target != null)
{
const float alpha_amount = 1;
const float down_time = 80;
const float up_time = 50;
target.Animate(
t => t.FadeTo(Math.Min(target.Alpha + alpha_amount, 1), down_time)
).Then(
t => t.FadeOut(up_time)
);
target
.FadeTo(1, down_time * (1 - target.Alpha), Easing.Out)
.Delay(100).FadeOut(up_time);
}
return false;

View File

@ -10,9 +10,9 @@ public static class BeatmapOffsetControlStrings
private const string prefix = @"osu.Game.Resources.Localisation.BeatmapOffsetControl";
/// <summary>
/// "Beatmap offset"
/// "Audio offset (this beatmap)"
/// </summary>
public static LocalisableString BeatmapOffset => new TranslatableString(getKey(@"beatmap_offset"), @"Beatmap offset");
public static LocalisableString AudioOffsetThisBeatmap => new TranslatableString(getKey(@"beatmap_offset"), @"Audio offset (this beatmap)");
/// <summary>
/// "Previous play:"

View File

@ -12,12 +12,14 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation;
using osu.Game.Screens.Play.PlayerSettings;
using osuTK;
namespace osu.Game.Overlays.Settings.Sections.Audio
@ -67,7 +69,7 @@ private void load(SessionAverageHitErrorTracker hitErrorTracker)
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new TimeSlider
new OffsetSliderBar
{
RelativeSizeAxes = Axes.X,
Current = { BindTarget = Current },
@ -157,6 +159,11 @@ private void updateHintText()
: $@"Based on the last {averageHitErrorHistory.Count} play(s), the suggested offset is {SuggestedOffset.Value:N0} ms.";
applySuggestion.Enabled.Value = SuggestedOffset.Value != null;
}
private partial class OffsetSliderBar : RoundedSliderBar<double>
{
public override LocalisableString TooltipText => BeatmapOffsetControl.GetOffsetExplanatoryText(Current.Value);
}
}
}
}

View File

@ -45,13 +45,14 @@ public virtual void PlayAnimation()
if (Result == HitResult.IgnoreMiss || Result == HitResult.LargeTickMiss)
{
this.RotateTo(-45);
this.ScaleTo(1.8f);
this.ScaleTo(1.6f);
this.ScaleTo(1.2f, 100, Easing.In);
this.MoveTo(Vector2.Zero);
this.MoveToOffset(new Vector2(0, 10), 800, Easing.InQuint);
this.FadeOutFromOne(400);
return;
}
else if (Result.IsMiss())
if (Result.IsMiss())
{
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);

View File

@ -3,6 +3,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics.Textures;
using osu.Framework.Threading;
using osu.Framework.Utils;
using osu.Game.Graphics;
using osu.Game.Skinning;
@ -43,8 +44,6 @@ public partial class StarFountainSpewer : ParticleSpewer
private const double shoot_duration = 800;
protected override bool CanSpawnParticles => lastShootTime != null && Time.Current - lastShootTime < shoot_duration;
[Resolved]
private ISkinSource skin { get; set; } = null!;
@ -57,7 +56,6 @@ public StarFountainSpewer()
private void load(TextureStore textures)
{
Texture = skin.GetTexture("Menu/fountain-star") ?? textures.Get("Menu/fountain-star");
Active.Value = true;
}
protected override FallingParticle CreateParticle()
@ -81,8 +79,15 @@ private float getCurrentAngle()
return lastShootDirection * x_velocity_from_direction * (float)(1 - 2 * (Clock.CurrentTime - lastShootTime!.Value) / shoot_duration) + getRandomVariance(x_velocity_random_variance);
}
private ScheduledDelegate? deactivateDelegate;
public void Shoot(int direction)
{
Active.Value = true;
deactivateDelegate?.Cancel();
deactivateDelegate = Scheduler.AddDelayed(() => Active.Value = false, shoot_duration);
lastShootTime = Clock.CurrentTime;
lastShootDirection = direction;
}

View File

@ -40,8 +40,6 @@ public abstract partial class LoungeSubScreen : OnlinePlaySubScreen
{
public override string Title => "Lounge";
protected override bool PlayExitSound => false;
protected override BackgroundScreen CreateBackground() => new LoungeBackgroundScreen
{
SelectedRoom = { BindTarget = SelectedRoom }

View File

@ -44,8 +44,6 @@ public partial class MultiplayerMatchSubScreen : RoomSubScreen, IHandlePresentBe
public override string ShortTitle => "room";
protected override bool PlayExitSound => !exitConfirmed;
[Resolved]
private MultiplayerClient client { get; set; }

View File

@ -13,6 +13,8 @@ public abstract partial class OnlinePlaySubScreen : OsuScreen, IOnlinePlaySubScr
public virtual string ShortTitle => Title;
protected sealed override bool PlayExitSound => false;
[Resolved]
protected IRoomManager? RoomManager { get; private set; }

View File

@ -223,7 +223,12 @@ public override void OnEntering(ScreenTransitionEvent e)
public override bool OnExiting(ScreenExitEvent e)
{
if (ValidForResume && PlayExitSound)
// Only play the exit sound if we are the last screen in the exit sequence.
// This stops many sample playbacks from stacking when a huge screen purge happens (ie. returning to menu via the home button
// from a deeply nested screen).
bool arrivingAtFinalDestination = e.Next == e.Destination;
if (ValidForResume && PlayExitSound && arrivingAtFinalDestination)
sampleExit?.Play();
if (ValidForResume && logo != null)

View File

@ -99,6 +99,9 @@ protected override bool ShouldBeConsideredForInput(Drawable child)
private readonly SkinComponentsContainer mainComponents;
[CanBeNull]
private readonly SkinComponentsContainer rulesetComponents;
/// <summary>
/// A flow which sits at the left side of the screen to house leaderboard (and related) components.
/// Will automatically be positioned to avoid colliding with top scoring elements.
@ -111,7 +114,6 @@ protected override bool ShouldBeConsideredForInput(Drawable child)
public HUDOverlay([CanBeNull] DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods, bool alwaysShowLeaderboard = true)
{
Drawable rulesetComponents;
this.drawableRuleset = drawableRuleset;
this.mods = mods;
@ -125,8 +127,8 @@ public HUDOverlay([CanBeNull] DrawableRuleset drawableRuleset, IReadOnlyList<Mod
clicksPerSecondController = new ClicksPerSecondController(),
InputCountController = new InputCountController(),
mainComponents = new HUDComponentsContainer { AlwaysPresent = true, },
rulesetComponents = drawableRuleset != null
? new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, }
drawableRuleset != null
? (rulesetComponents = new HUDComponentsContainer(drawableRuleset.Ruleset.RulesetInfo) { AlwaysPresent = true, })
: Empty(),
playfieldComponents = drawableRuleset != null
? new SkinComponentsContainer(new SkinComponentsContainerLookup(SkinComponentsContainerLookup.TargetArea.Playfield, drawableRuleset.Ruleset.RulesetInfo)) { AlwaysPresent = true, }
@ -170,7 +172,10 @@ public HUDOverlay([CanBeNull] DrawableRuleset drawableRuleset, IReadOnlyList<Mod
},
};
hideTargets = new List<Drawable> { mainComponents, rulesetComponents, playfieldComponents, topRightElements };
hideTargets = new List<Drawable> { mainComponents, playfieldComponents, topRightElements };
if (rulesetComponents != null)
hideTargets.Add(rulesetComponents);
if (!alwaysShowLeaderboard)
hideTargets.Add(LeaderboardFlow);
@ -256,13 +261,37 @@ protected override void Update()
// LINQ cast can be removed when IDrawable interface includes Anchor / RelativeSizeAxes.
foreach (var element in mainComponents.Components.Cast<Drawable>())
processDrawable(element);
if (rulesetComponents != null)
{
foreach (var element in rulesetComponents.Components.Cast<Drawable>())
processDrawable(element);
}
if (lowestTopScreenSpaceRight.HasValue)
topRightElements.Y = MathHelper.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceRight.Value)).Y, 0, DrawHeight - topRightElements.DrawHeight);
else
topRightElements.Y = 0;
if (lowestTopScreenSpaceLeft.HasValue)
LeaderboardFlow.Y = MathHelper.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceLeft.Value)).Y, 0, DrawHeight - LeaderboardFlow.DrawHeight);
else
LeaderboardFlow.Y = 0;
if (highestBottomScreenSpace.HasValue)
bottomRightElements.Y = BottomScoringElementsHeight = -MathHelper.Clamp(DrawHeight - ToLocalSpace(highestBottomScreenSpace.Value).Y, 0, DrawHeight - bottomRightElements.DrawHeight);
else
bottomRightElements.Y = 0;
void processDrawable(Drawable element)
{
// for now align some top components with the bottom-edge of the lowest top-anchored hud element.
if (element.Anchor.HasFlagFast(Anchor.y0))
{
// health bars are excluded for the sake of hacky legacy skins which extend the health bar to take up the full screen area.
if (element is LegacyHealthDisplay)
continue;
return;
float bottom = element.ScreenSpaceDrawQuad.BottomRight.Y;
@ -288,21 +317,6 @@ protected override void Update()
highestBottomScreenSpace = topLeft;
}
}
if (lowestTopScreenSpaceRight.HasValue)
topRightElements.Y = MathHelper.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceRight.Value)).Y, 0, DrawHeight - topRightElements.DrawHeight);
else
topRightElements.Y = 0;
if (lowestTopScreenSpaceLeft.HasValue)
LeaderboardFlow.Y = MathHelper.Clamp(ToLocalSpace(new Vector2(0, lowestTopScreenSpaceLeft.Value)).Y, 0, DrawHeight - LeaderboardFlow.DrawHeight);
else
LeaderboardFlow.Y = 0;
if (highestBottomScreenSpace.HasValue)
bottomRightElements.Y = BottomScoringElementsHeight = -MathHelper.Clamp(DrawHeight - ToLocalSpace(highestBottomScreenSpace.Value).Y, 0, DrawHeight - bottomRightElements.DrawHeight);
else
bottomRightElements.Y = 0;
}
private void updateVisibility()

View File

@ -86,7 +86,7 @@ public BeatmapOffsetControl()
new OffsetSliderBar
{
KeyboardStep = 5,
LabelText = BeatmapOffsetControlStrings.BeatmapOffset,
LabelText = BeatmapOffsetControlStrings.AudioOffsetThisBeatmap,
Current = Current,
},
referenceScoreContainer = new FillFlowContainer
@ -307,7 +307,7 @@ LocalisableString getEarlyLateText(double value)
}
}
public partial class OffsetSliderBar : PlayerSliderBar<double>
private partial class OffsetSliderBar : PlayerSliderBar<double>
{
protected override Drawable CreateControl() => new CustomSliderBar();

View File

@ -107,11 +107,11 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
return true;
case GlobalAction.SeekReplayBackward:
SeekInDirection(-1);
SeekInDirection(-5);
return true;
case GlobalAction.SeekReplayForward:
SeekInDirection(1);
SeekInDirection(5);
return true;
case GlobalAction.TogglePauseReplay:

View File

@ -63,14 +63,10 @@ public virtual void PlayAnimation()
// missed ticks / slider end don't get the normal animation.
if (isMissedTick())
{
this.ScaleTo(1.6f);
this.ScaleTo(1, 100, Easing.In);
this.ScaleTo(1.2f);
this.ScaleTo(1f, 100, Easing.In);
if (legacyVersion > 1.0m)
{
this.MoveTo(new Vector2(0, -2f));
this.MoveToOffset(new Vector2(0, 10), fade_out_delay + fade_out_length, Easing.In);
}
this.FadeOutFromOne(400);
}
else
{