1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Merge branch 'master' into toast-notification-tray

This commit is contained in:
Dan Balasescu 2022-08-31 16:07:11 +09:00 committed by GitHub
commit afe2862df4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 100 additions and 30 deletions

View File

@ -10,6 +10,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Database;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
@ -34,10 +35,14 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
{
AddStep("setup compose screen", () =>
{
var editorBeatmap = new EditorBeatmap(new ManiaBeatmap(new StageDefinition { Columns = 4 })
var beatmap = new ManiaBeatmap(new StageDefinition { Columns = 4 })
{
BeatmapInfo = { Ruleset = new ManiaRuleset().RulesetInfo },
});
};
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
var editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null));
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
@ -50,7 +55,11 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
(typeof(IBeatSnapProvider), editorBeatmap),
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
},
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
Children = new Drawable[]
{
editorBeatmap,
new ComposeScreen { State = { Value = Visibility.Visible } },
}
};
});

View File

@ -9,6 +9,7 @@ using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Overlays;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu;
@ -34,9 +35,11 @@ namespace osu.Game.Tests.Visual.Editing
{
var beatmap = new OsuBeatmap
{
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo }
BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo },
};
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
editorBeatmap = new EditorBeatmap(beatmap, new LegacyBeatmapSkin(beatmap.BeatmapInfo, null));
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
@ -50,7 +53,11 @@ namespace osu.Game.Tests.Visual.Editing
(typeof(IBeatSnapProvider), editorBeatmap),
(typeof(OverlayColourProvider), new OverlayColourProvider(OverlayColourScheme.Green)),
},
Child = new ComposeScreen { State = { Value = Visibility.Visible } },
Children = new Drawable[]
{
editorBeatmap,
new ComposeScreen { State = { Value = Visibility.Visible } },
}
};
});

View File

@ -27,8 +27,7 @@ namespace osu.Game.Tests.Visual.Gameplay
private const double skip_time = 6000;
[SetUp]
public void SetUp() => Schedule(() =>
private void createTest(double skipTime = skip_time) => AddStep("create test", () =>
{
requestCount = 0;
increment = skip_time;
@ -40,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
skip = new TestSkipOverlay(skip_time)
skip = new TestSkipOverlay(skipTime)
{
RequestSkip = () =>
{
@ -55,9 +54,25 @@ namespace osu.Game.Tests.Visual.Gameplay
gameplayClock = gameplayClockContainer;
});
[Test]
public void TestSkipTimeZero()
{
createTest(0);
AddUntilStep("wait for skip overlay expired", () => !skip.IsAlive);
}
[Test]
public void TestSkipTimeEqualToSkip()
{
createTest(MasterGameplayClockContainer.MINIMUM_SKIP_TIME);
AddUntilStep("wait for skip overlay expired", () => !skip.IsAlive);
}
[Test]
public void TestFadeOnIdle()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(Vector2.Zero));
AddUntilStep("fully visible", () => skip.FadingContent.Alpha == 1);
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha < 1);
@ -70,6 +85,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestClickableAfterFade()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddUntilStep("wait for fade", () => skip.FadingContent.Alpha == 0);
AddStep("click", () => InputManager.Click(MouseButton.Left));
@ -79,6 +96,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestClickOnlyActuatesOnce()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddStep("click", () =>
{
@ -94,6 +113,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestClickOnlyActuatesMultipleTimes()
{
createTest();
AddStep("set increment lower", () => increment = 3000);
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddStep("click", () => InputManager.Click(MouseButton.Left));
@ -106,6 +127,8 @@ namespace osu.Game.Tests.Visual.Gameplay
[Test]
public void TestDoesntFadeOnMouseDown()
{
createTest();
AddStep("move mouse", () => InputManager.MoveMouseTo(skip.ScreenSpaceDrawQuad.Centre));
AddStep("button down", () => InputManager.PressButton(MouseButton.Left));
AddUntilStep("wait for overlay disappear", () => !skip.OverlayContent.IsPresent);

View File

@ -40,5 +40,7 @@ namespace osu.Game.Tournament.Models
MinValue = 3,
MaxValue = 4,
};
public Bindable<bool> AutoProgressScreens = new BindableBool(true);
}
}

View File

@ -199,16 +199,19 @@ namespace osu.Game.Tournament.Screens.Gameplay
case TourneyState.Idle:
contract();
const float delay_before_progression = 4000;
// if we've returned to idle and the last screen was ranking
// we should automatically proceed after a short delay
if (lastState == TourneyState.Ranking && !warmup.Value)
if (LadderInfo.AutoProgressScreens.Value)
{
if (CurrentMatch.Value?.Completed.Value == true)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, delay_before_progression);
else if (CurrentMatch.Value?.Completed.Value == false)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression);
const float delay_before_progression = 4000;
// if we've returned to idle and the last screen was ranking
// we should automatically proceed after a short delay
if (lastState == TourneyState.Ranking && !warmup.Value)
{
if (CurrentMatch.Value?.Completed.Value == true)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(TeamWinScreen)); }, delay_before_progression);
else if (CurrentMatch.Value?.Completed.Value == false)
scheduledOperation = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(MapPoolScreen)); }, delay_before_progression);
}
}
break;

View File

@ -197,10 +197,13 @@ namespace osu.Game.Tournament.Screens.MapPool
setNextMode();
if (pickType == ChoiceType.Pick && CurrentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
if (LadderInfo.AutoProgressScreens.Value)
{
scheduledChange?.Cancel();
scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
if (pickType == ChoiceType.Pick && CurrentMatch.Value.PicksBans.Any(i => i.Type == ChoiceType.Pick))
{
scheduledChange?.Cancel();
scheduledChange = Scheduler.AddDelayed(() => { sceneManager?.SetScreen(typeof(GameplayScreen)); }, 10000);
}
}
}

View File

@ -131,6 +131,12 @@ namespace osu.Game.Tournament.Screens.Setup
windowSize.Value = new Size((int)(height * aspect_ratio / TournamentSceneManager.STREAM_AREA_WIDTH * TournamentSceneManager.REQUIRED_WIDTH), height);
}
},
new LabelledSwitchButton
{
Label = "Auto advance screens",
Description = "Screens will progress automatically from gameplay -> results -> map pool",
Current = LadderInfo.AutoProgressScreens,
},
};
}

View File

@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osuTK;
using osuTK.Graphics;
@ -227,7 +228,7 @@ namespace osu.Game.Overlays.Notifications
{
background = new Box
{
Colour = colourProvider.Background4,
Colour = OsuColour.Gray(0).Opacity(0.15f),
Alpha = 0,
RelativeSizeAxes = Axes.Both,
},

View File

@ -173,7 +173,7 @@ namespace osu.Game.Overlays.Notifications
public ProgressNotification()
{
Content.Add(textDrawable = new OsuTextFlowContainer
Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14, weight: FontWeight.Medium))
{
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,

View File

@ -3,6 +3,7 @@
#nullable disable
using System.Diagnostics;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -37,6 +38,10 @@ namespace osu.Game.Overlays.Profile
// todo: pending implementation.
// TabControl.AddItem(LayoutStrings.HeaderUsersModding);
// Haphazardly guaranteed by OverlayHeader constructor (see CreateBackground / CreateContent).
Debug.Assert(centreHeaderContainer != null);
Debug.Assert(detailHeaderContainer != null);
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
}

View File

@ -25,7 +25,12 @@ namespace osu.Game.Scoring
return;
using (var stream = store.GetStream(replayFilename))
{
if (stream == null)
return;
Replay = new DatabasedLegacyScoreDecoder(rulesets, beatmaps).Parse(stream).Replay;
}
}
}
}

View File

@ -64,7 +64,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (result != 0) return result;
}
return CompareReverseChildID(y, x);
return CompareReverseChildID(x, y);
}
protected override void Dispose(bool isDisposing)

View File

@ -114,16 +114,17 @@ namespace osu.Game.Screens.Play
{
base.LoadComplete();
displayTime = gameplayClock.CurrentTime;
// skip is not required if there is no extra "empty" time to skip.
// we may need to remove this if rewinding before the initial player load position becomes a thing.
if (fadeOutBeginTime < gameplayClock.CurrentTime)
if (fadeOutBeginTime <= displayTime)
{
Expire();
return;
}
button.Action = () => RequestSkip?.Invoke();
displayTime = gameplayClock.CurrentTime;
fadeContainer.TriggerShow();
@ -146,7 +147,12 @@ namespace osu.Game.Screens.Play
{
base.Update();
double progress = fadeOutBeginTime <= displayTime ? 1 : Math.Max(0, 1 - (gameplayClock.CurrentTime - displayTime) / (fadeOutBeginTime - displayTime));
// This case causes an immediate expire in `LoadComplete`, but `Update` may run once after that.
// Avoid div-by-zero below.
if (fadeOutBeginTime <= displayTime)
return;
double progress = Math.Max(0, 1 - (gameplayClock.CurrentTime - displayTime) / (fadeOutBeginTime - displayTime));
remainingTimeBox.Width = (float)Interpolation.Lerp(remainingTimeBox.Width, progress, Math.Clamp(Time.Elapsed / 40, 0, 1));

View File

@ -99,7 +99,7 @@ namespace osu.Game.Screens.Ranking
[Resolved]
private OsuGameBase game { get; set; }
private DrawableAudioMixer mixer;
private AudioContainer audioContent;
private bool displayWithFlair;
@ -130,7 +130,7 @@ namespace osu.Game.Screens.Ranking
// Adding a manual offset here allows the expanded version to take on an "acceptable" vertical centre when at 100% UI scale.
const float vertical_fudge = 20;
InternalChild = mixer = new DrawableAudioMixer
InternalChild = audioContent = new AudioContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -225,7 +225,7 @@ namespace osu.Game.Screens.Ranking
protected override void Update()
{
base.Update();
mixer.Balance.Value = (ScreenSpaceDrawQuad.Centre.X / game.ScreenSpaceDrawQuad.Width) * 2 - 1;
audioContent.Balance.Value = (ScreenSpaceDrawQuad.Centre.X / game.ScreenSpaceDrawQuad.Width) * 2 - 1;
}
private void playAppearSample()
@ -274,7 +274,7 @@ namespace osu.Game.Screens.Ranking
break;
}
mixer.ResizeTo(Size, RESIZE_DURATION, Easing.OutQuint);
audioContent.ResizeTo(Size, RESIZE_DURATION, Easing.OutQuint);
bool topLayerExpanded = topLayerContainer.Y < 0;