mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'master' into editor-beatmap-component
This commit is contained in:
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
|
||||
protected override IEnumerable<LeaderboardScoreStatistic> GetStatistics(ScoreInfo model) => new[]
|
||||
{
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:0%}" : @"{0:0.00%}", model.Accuracy)),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", model.DisplayAccuracy),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", score.TotalAttempts.ToString()),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", score.CompletedBeatmaps.ToString()),
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -14,18 +14,32 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class KeyCounterDisplay : FillFlowContainer<KeyCounter>
|
||||
public class KeyCounterDisplay : Container<KeyCounter>
|
||||
{
|
||||
private const int duration = 100;
|
||||
private const double key_fade_time = 80;
|
||||
|
||||
public readonly Bindable<bool> Visible = new Bindable<bool>(true);
|
||||
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
|
||||
|
||||
protected readonly FillFlowContainer<KeyCounter> KeyFlow;
|
||||
|
||||
protected override Container<KeyCounter> Content => KeyFlow;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the key counter should be visible regardless of the configuration value.
|
||||
/// This is true by default, but can be changed.
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> AlwaysVisible = new Bindable<bool>(true);
|
||||
|
||||
public KeyCounterDisplay()
|
||||
{
|
||||
Direction = FillDirection.Horizontal;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = KeyFlow = new FillFlowContainer<KeyCounter>
|
||||
{
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
};
|
||||
}
|
||||
|
||||
public override void Add(KeyCounter key)
|
||||
@ -49,7 +63,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Visible.BindValueChanged(_ => updateVisibility());
|
||||
AlwaysVisible.BindValueChanged(_ => updateVisibility());
|
||||
configVisibility.BindValueChanged(_ => updateVisibility(), true);
|
||||
}
|
||||
|
||||
@ -100,7 +114,9 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
|
||||
private void updateVisibility() => this.FadeTo(Visible.Value || configVisibility.Value ? 1 : 0, duration);
|
||||
private void updateVisibility() =>
|
||||
// Isolate changing visibility of the key counters from fading this component.
|
||||
KeyFlow.FadeTo(AlwaysVisible.Value || configVisibility.Value ? 1 : 0, duration);
|
||||
|
||||
public override bool HandleNonPositionalInput => receptor == null;
|
||||
public override bool HandlePositionalInput => receptor == null;
|
||||
|
@ -219,7 +219,7 @@ namespace osu.Game.Screens.Play
|
||||
IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
|
||||
},
|
||||
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
|
||||
KeyCounter = { Visible = { BindTarget = DrawableRuleset.HasReplayLoaded } },
|
||||
KeyCounter = { AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded } },
|
||||
RequestSeek = GameplayClockContainer.Seek,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
|
@ -211,7 +211,7 @@ namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Text = $"{Score.Accuracy:P2}",
|
||||
Text = Score.DisplayAccuracy,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40),
|
||||
RelativePositionAxes = Axes.X,
|
||||
X = 0.9f,
|
||||
|
@ -32,8 +32,7 @@ namespace osu.Game.Screens.Select
|
||||
BeatmapInfo beatmap = beatmapManager.QueryBeatmap(b => b.ID == score.BeatmapInfoID);
|
||||
Debug.Assert(beatmap != null);
|
||||
|
||||
string accuracy = string.Format(score.Accuracy == 1 ? "{0:0%}" : "{0:0.00%}", score.Accuracy);
|
||||
BodyText = $"{score.User} ({accuracy}, {score.Rank})";
|
||||
BodyText = $"{score.User} ({score.DisplayAccuracy}, {score.Rank})";
|
||||
|
||||
Icon = FontAwesome.Regular.TrashAlt;
|
||||
HeaderText = "Confirm deletion of local score";
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -224,23 +224,37 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (ShowFooter)
|
||||
{
|
||||
AddRangeInternal(new[]
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
FooterPanels = new Container
|
||||
new GridContainer // used for max height implementation
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Bottom = Footer.HEIGHT },
|
||||
Children = new Drawable[]
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RowDimensions = new[]
|
||||
{
|
||||
BeatmapOptions = new BeatmapOptionsOverlay(),
|
||||
ModSelect = new ModSelectOverlay
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
null,
|
||||
new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
FooterPanels = new Container
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Bottom = Footer.HEIGHT },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
BeatmapOptions = new BeatmapOptionsOverlay(),
|
||||
ModSelect = new ModSelectOverlay
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user