mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Merge branch 'master' into fix-mod-select-overflowing
This commit is contained in:
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Backgrounds
|
||||
/// <summary>
|
||||
/// The amount of blur to be applied in addition to user-specified blur.
|
||||
/// </summary>
|
||||
public readonly Bindable<float> BlurAmount = new Bindable<float>();
|
||||
public readonly Bindable<float> BlurAmount = new BindableFloat();
|
||||
|
||||
internal readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
||||
|
||||
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Backgrounds
|
||||
/// <remarks>
|
||||
/// Used in contexts where there can potentially be both user and screen-specified blurring occuring at the same time, such as in <see cref="PlayerLoader"/>
|
||||
/// </remarks>
|
||||
public readonly Bindable<float> BlurAmount = new Bindable<float>();
|
||||
public readonly Bindable<float> BlurAmount = new BindableFloat();
|
||||
|
||||
public Background Background
|
||||
{
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
for (var i = 0; i < beatmap.ControlPointInfo.TimingPoints.Count; i++)
|
||||
{
|
||||
var point = beatmap.ControlPointInfo.TimingPoints[i];
|
||||
var until = beatmap.ControlPointInfo.TimingPoints.Count < i + 1 ? beatmap.ControlPointInfo.TimingPoints[i + 1].Time : working.Value.Track.Length;
|
||||
var until = i + 1 < beatmap.ControlPointInfo.TimingPoints.Count ? beatmap.ControlPointInfo.TimingPoints[i + 1].Time : working.Value.Track.Length;
|
||||
|
||||
int beat = 0;
|
||||
|
||||
|
@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||
Child = screenStack = new OsuScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both }
|
||||
Child = screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }
|
||||
},
|
||||
new Header(screenStack),
|
||||
createButton = new HeaderButton
|
||||
@ -120,6 +120,8 @@ namespace osu.Game.Screens.Multi
|
||||
}
|
||||
};
|
||||
|
||||
screenStack.Push(loungeSubScreen = new LoungeSubScreen());
|
||||
|
||||
screenStack.ScreenPushed += screenPushed;
|
||||
screenStack.ScreenExited += screenExited;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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 Microsoft.EntityFrameworkCore.Internal;
|
||||
using osu.Framework.Allocation;
|
||||
@ -95,15 +96,30 @@ namespace osu.Game.Screens
|
||||
|
||||
public Bindable<IReadOnlyList<Mod>> Mods { get; private set; }
|
||||
|
||||
private OsuScreenDependencies screenDependencies;
|
||||
|
||||
internal void CreateLeasedDependencies(IReadOnlyDependencyContainer dependencies) => createDependencies(dependencies);
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
var screenDependencies = new OsuScreenDependencies(DisallowExternalBeatmapRulesetChanges, parent);
|
||||
if (screenDependencies == null)
|
||||
{
|
||||
if (DisallowExternalBeatmapRulesetChanges)
|
||||
throw new InvalidOperationException($"Screens that specify {nameof(DisallowExternalBeatmapRulesetChanges)} must be pushed immediately.");
|
||||
|
||||
createDependencies(parent);
|
||||
}
|
||||
|
||||
return base.CreateChildDependencies(screenDependencies);
|
||||
}
|
||||
|
||||
private void createDependencies(IReadOnlyDependencyContainer dependencies)
|
||||
{
|
||||
screenDependencies = new OsuScreenDependencies(DisallowExternalBeatmapRulesetChanges, dependencies);
|
||||
|
||||
Beatmap = screenDependencies.Beatmap;
|
||||
Ruleset = screenDependencies.Ruleset;
|
||||
Mods = screenDependencies.Mods;
|
||||
|
||||
return base.CreateChildDependencies(screenDependencies);
|
||||
}
|
||||
|
||||
protected BackgroundScreen Background => backgroundStack?.CurrentScreen as BackgroundScreen;
|
||||
|
@ -13,22 +13,11 @@ namespace osu.Game.Screens
|
||||
[Cached]
|
||||
private BackgroundScreenStack backgroundScreenStack;
|
||||
|
||||
private ParallaxContainer parallaxContainer;
|
||||
private readonly ParallaxContainer parallaxContainer;
|
||||
|
||||
protected float ParallaxAmount => parallaxContainer.ParallaxAmount;
|
||||
|
||||
public OsuScreenStack()
|
||||
{
|
||||
initializeStack();
|
||||
}
|
||||
|
||||
public OsuScreenStack(IScreen baseScreen)
|
||||
: base(baseScreen)
|
||||
{
|
||||
initializeStack();
|
||||
}
|
||||
|
||||
private void initializeStack()
|
||||
{
|
||||
InternalChild = parallaxContainer = new ParallaxContainer
|
||||
{
|
||||
@ -36,13 +25,32 @@ namespace osu.Game.Screens
|
||||
Child = backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both },
|
||||
};
|
||||
|
||||
ScreenPushed += onScreenChange;
|
||||
ScreenExited += onScreenChange;
|
||||
ScreenPushed += screenPushed;
|
||||
ScreenExited += screenExited;
|
||||
}
|
||||
|
||||
private void onScreenChange(IScreen prev, IScreen next)
|
||||
private void screenPushed(IScreen prev, IScreen next)
|
||||
{
|
||||
parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next)?.BackgroundParallaxAmount ?? 1.0f;
|
||||
if (LoadState < LoadState.Ready)
|
||||
{
|
||||
// dependencies must be present to stay in a sane state.
|
||||
// this is generally only ever hit by test scenes.
|
||||
Schedule(() => screenPushed(prev, next));
|
||||
return;
|
||||
}
|
||||
|
||||
// create dependencies synchronously to ensure leases are in a sane state.
|
||||
((OsuScreen)next).CreateLeasedDependencies((prev as OsuScreen)?.Dependencies ?? Dependencies);
|
||||
|
||||
setParallax(next);
|
||||
}
|
||||
|
||||
private void screenExited(IScreen prev, IScreen next)
|
||||
{
|
||||
setParallax(next);
|
||||
}
|
||||
|
||||
private void setParallax(IScreen next) =>
|
||||
parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next)?.BackgroundParallaxAmount ?? 1.0f;
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ using System.Collections.Generic;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using System.Linq;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
@ -26,7 +27,8 @@ namespace osu.Game.Screens.Select.Details
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
private readonly StatisticRow firstValue, hpDrain, accuracy, approachRate, starDifficulty;
|
||||
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
||||
private readonly StatisticRow starDifficulty;
|
||||
|
||||
private BeatmapInfo beatmap;
|
||||
|
||||
@ -52,10 +54,10 @@ namespace osu.Game.Screens.Select.Details
|
||||
Spacing = new Vector2(4f),
|
||||
Children = new[]
|
||||
{
|
||||
firstValue = new StatisticRow(), //circle size/key amount
|
||||
hpDrain = new StatisticRow { Title = "HP Drain" },
|
||||
accuracy = new StatisticRow { Title = "Accuracy" },
|
||||
approachRate = new StatisticRow { Title = "Approach Rate" },
|
||||
FirstValue = new StatisticRow(), //circle size/key amount
|
||||
HpDrain = new StatisticRow { Title = "HP Drain" },
|
||||
Accuracy = new StatisticRow { Title = "Accuracy" },
|
||||
ApproachRate = new StatisticRow { Title = "Approach Rate" },
|
||||
starDifficulty = new StatisticRow(10, true) { Title = "Star Difficulty" },
|
||||
},
|
||||
};
|
||||
@ -122,24 +124,24 @@ namespace osu.Game.Screens.Select.Details
|
||||
case 3:
|
||||
// Account for mania differences locally for now
|
||||
// Eventually this should be handled in a more modular way, allowing rulesets to return arbitrary difficulty attributes
|
||||
firstValue.Title = "Key Count";
|
||||
firstValue.Value = (baseDifficulty?.CircleSize ?? 0, null);
|
||||
FirstValue.Title = "Key Count";
|
||||
FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, null);
|
||||
break;
|
||||
|
||||
default:
|
||||
firstValue.Title = "Circle Size";
|
||||
firstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize);
|
||||
FirstValue.Title = "Circle Size";
|
||||
FirstValue.Value = (baseDifficulty?.CircleSize ?? 0, adjustedDifficulty?.CircleSize);
|
||||
break;
|
||||
}
|
||||
|
||||
starDifficulty.Value = ((float)(Beatmap?.StarDifficulty ?? 0), null);
|
||||
|
||||
hpDrain.Value = (baseDifficulty?.DrainRate ?? 0, adjustedDifficulty?.DrainRate);
|
||||
accuracy.Value = (baseDifficulty?.OverallDifficulty ?? 0, adjustedDifficulty?.OverallDifficulty);
|
||||
approachRate.Value = (baseDifficulty?.ApproachRate ?? 0, adjustedDifficulty?.ApproachRate);
|
||||
HpDrain.Value = (baseDifficulty?.DrainRate ?? 0, adjustedDifficulty?.DrainRate);
|
||||
Accuracy.Value = (baseDifficulty?.OverallDifficulty ?? 0, adjustedDifficulty?.OverallDifficulty);
|
||||
ApproachRate.Value = (baseDifficulty?.ApproachRate ?? 0, adjustedDifficulty?.ApproachRate);
|
||||
}
|
||||
|
||||
private class StatisticRow : Container, IHasAccentColour
|
||||
public class StatisticRow : Container, IHasAccentColour
|
||||
{
|
||||
private const float value_width = 25;
|
||||
private const float name_width = 70;
|
||||
@ -147,7 +149,8 @@ namespace osu.Game.Screens.Select.Details
|
||||
private readonly float maxValue;
|
||||
private readonly bool forceDecimalPlaces;
|
||||
private readonly OsuSpriteText name, valueText;
|
||||
private readonly Bar bar, modBar;
|
||||
private readonly Bar bar;
|
||||
public readonly Bar ModBar;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
@ -173,14 +176,14 @@ namespace osu.Game.Screens.Select.Details
|
||||
bar.Length = value.baseValue / maxValue;
|
||||
|
||||
valueText.Text = (value.adjustedValue ?? value.baseValue).ToString(forceDecimalPlaces ? "0.00" : "0.##");
|
||||
modBar.Length = (value.adjustedValue ?? 0) / maxValue;
|
||||
ModBar.Length = (value.adjustedValue ?? 0) / maxValue;
|
||||
|
||||
if (value.adjustedValue > value.baseValue)
|
||||
modBar.AccentColour = valueText.Colour = colours.Red;
|
||||
if (Precision.AlmostEquals(value.baseValue, value.adjustedValue ?? value.baseValue, 0.05f))
|
||||
ModBar.AccentColour = valueText.Colour = Color4.White;
|
||||
else if (value.adjustedValue > value.baseValue)
|
||||
ModBar.AccentColour = valueText.Colour = colours.Red;
|
||||
else if (value.adjustedValue < value.baseValue)
|
||||
modBar.AccentColour = valueText.Colour = colours.BlueDark;
|
||||
else
|
||||
modBar.AccentColour = valueText.Colour = Color4.White;
|
||||
ModBar.AccentColour = valueText.Colour = colours.BlueDark;
|
||||
}
|
||||
}
|
||||
|
||||
@ -217,7 +220,7 @@ namespace osu.Game.Screens.Select.Details
|
||||
BackgroundColour = Color4.White.Opacity(0.5f),
|
||||
Padding = new MarginPadding { Left = name_width + 10, Right = value_width + 10 },
|
||||
},
|
||||
modBar = new Bar
|
||||
ModBar = new Bar
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
|
@ -149,8 +149,8 @@ namespace osu.Game.Screens.Select
|
||||
private readonly IBindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private readonly Bindable<bool> showConverted = new Bindable<bool>();
|
||||
private readonly Bindable<double> minimumStars = new Bindable<double>();
|
||||
private readonly Bindable<double> maximumStars = new Bindable<double>();
|
||||
private readonly Bindable<double> minimumStars = new BindableDouble();
|
||||
private readonly Bindable<double> maximumStars = new BindableDouble();
|
||||
|
||||
public readonly Box Background;
|
||||
|
||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
player = null;
|
||||
|
||||
if (removeAutoModOnResume)
|
||||
@ -41,8 +43,6 @@ namespace osu.Game.Screens.Select
|
||||
ModSelect.DeselectTypes(new[] { autoType }, true);
|
||||
removeAutoModOnResume = false;
|
||||
}
|
||||
|
||||
base.OnResuming(last);
|
||||
}
|
||||
|
||||
protected override bool OnStart()
|
||||
@ -68,10 +68,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
SampleConfirm?.Play();
|
||||
|
||||
LoadComponentAsync(player = new PlayerLoader(() => new Player()), l =>
|
||||
{
|
||||
if (this.IsCurrentScreen()) this.Push(player);
|
||||
});
|
||||
this.Push(player = new PlayerLoader(() => new Player()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ namespace osu.Game.Screens.Select
|
||||
[Resolved(canBeNull: true)]
|
||||
private NotificationOverlay notificationOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; }
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
protected BeatmapCarousel Carousel { get; private set; }
|
||||
@ -474,6 +477,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
this.FadeInFromZero(250);
|
||||
FilterControl.Activate();
|
||||
|
||||
ModSelect.SelectedMods.BindTo(selectedMods);
|
||||
}
|
||||
|
||||
private const double logo_transition = 250;
|
||||
@ -514,6 +519,12 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
|
||||
// required due to https://github.com/ppy/osu-framework/issues/3218
|
||||
ModSelect.SelectedMods.Disabled = false;
|
||||
ModSelect.SelectedMods.BindTo(selectedMods);
|
||||
|
||||
Carousel.AllowSelection = true;
|
||||
|
||||
BeatmapDetails.Leaderboard.RefreshScores();
|
||||
@ -529,8 +540,6 @@ namespace osu.Game.Screens.Select
|
||||
music?.Play();
|
||||
}
|
||||
|
||||
base.OnResuming(last);
|
||||
|
||||
this.FadeIn(250);
|
||||
|
||||
this.ScaleTo(1, 250, Easing.OutSine);
|
||||
@ -540,6 +549,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public override void OnSuspending(IScreen next)
|
||||
{
|
||||
ModSelect.SelectedMods.UnbindFrom(selectedMods);
|
||||
ModSelect.Hide();
|
||||
|
||||
BeatmapOptions.Hide();
|
||||
|
Reference in New Issue
Block a user