mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Merge branch 'master' into match-detail-area
This commit is contained in:
commit
14f632b532
@ -7,7 +7,9 @@ using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing.Input;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||
using osu.Game.Screens.Play;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Tests
|
||||
@ -21,12 +23,50 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
typeof(CursorTrail)
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
[Cached]
|
||||
private GameplayBeatmap gameplayBeatmap;
|
||||
|
||||
private ClickingCursorContainer lastContainer;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
public TestSceneGameplayCursor()
|
||||
{
|
||||
gameplayBeatmap = new GameplayBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
|
||||
}
|
||||
|
||||
[TestCase(1, 1)]
|
||||
[TestCase(5, 1)]
|
||||
[TestCase(10, 1)]
|
||||
[TestCase(1, 1.5f)]
|
||||
[TestCase(5, 1.5f)]
|
||||
[TestCase(10, 1.5f)]
|
||||
public void TestSizing(int circleSize, float userScale)
|
||||
{
|
||||
AddStep($"set user scale to {userScale}", () => config.Set(OsuSetting.GameplayCursorSize, userScale));
|
||||
AddStep($"adjust cs to {circleSize}", () => gameplayBeatmap.BeatmapInfo.BaseDifficulty.CircleSize = circleSize);
|
||||
AddStep("turn on autosizing", () => config.Set(OsuSetting.AutoCursorSize, true));
|
||||
|
||||
AddStep("load content", loadContent);
|
||||
|
||||
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == OsuCursorContainer.GetScaleForCircleSize(circleSize) * userScale);
|
||||
|
||||
AddStep("set user scale to 1", () => config.Set(OsuSetting.GameplayCursorSize, 1f));
|
||||
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == OsuCursorContainer.GetScaleForCircleSize(circleSize));
|
||||
|
||||
AddStep("turn off autosizing", () => config.Set(OsuSetting.AutoCursorSize, false));
|
||||
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == 1);
|
||||
|
||||
AddStep($"set user scale to {userScale}", () => config.Set(OsuSetting.GameplayCursorSize, userScale));
|
||||
AddUntilStep("cursor size correct", () => lastContainer.ActiveCursor.Scale.X == userScale);
|
||||
}
|
||||
|
||||
private void loadContent()
|
||||
{
|
||||
SetContents(() => new MovingCursorInputManager
|
||||
{
|
||||
Child = new ClickingCursorContainer
|
||||
Child = lastContainer = new ClickingCursorContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
|
@ -19,33 +19,46 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
|
||||
|
||||
/// <summary>
|
||||
/// How early before a hitobject's start time to trigger a hit.
|
||||
/// </summary>
|
||||
private const float relax_leniency = 3;
|
||||
|
||||
public void Update(Playfield playfield)
|
||||
{
|
||||
bool requiresHold = false;
|
||||
bool requiresHit = false;
|
||||
|
||||
const float relax_leniency = 3;
|
||||
double time = playfield.Clock.CurrentTime;
|
||||
|
||||
foreach (var drawable in playfield.HitObjectContainer.AliveObjects)
|
||||
foreach (var h in playfield.HitObjectContainer.AliveObjects.OfType<DrawableOsuHitObject>())
|
||||
{
|
||||
if (!(drawable is DrawableOsuHitObject osuHit))
|
||||
// we are not yet close enough to the object.
|
||||
if (time < h.HitObject.StartTime - relax_leniency)
|
||||
break;
|
||||
|
||||
// already hit or beyond the hittable end time.
|
||||
if (h.IsHit || (h.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime))
|
||||
continue;
|
||||
|
||||
double time = osuHit.Clock.CurrentTime;
|
||||
double relativetime = time - osuHit.HitObject.StartTime;
|
||||
|
||||
if (time < osuHit.HitObject.StartTime - relax_leniency) continue;
|
||||
|
||||
if ((osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime) || osuHit.IsHit)
|
||||
continue;
|
||||
|
||||
if (osuHit is DrawableHitCircle && osuHit.IsHovered)
|
||||
switch (h)
|
||||
{
|
||||
Debug.Assert(osuHit.HitObject.HitWindows != null);
|
||||
requiresHit |= osuHit.HitObject.HitWindows.CanBeHit(relativetime);
|
||||
}
|
||||
case DrawableHitCircle circle:
|
||||
handleHitCircle(circle);
|
||||
break;
|
||||
|
||||
requiresHold |= (osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered)) || osuHit is DrawableSpinner;
|
||||
case DrawableSlider slider:
|
||||
// Handles cases like "2B" beatmaps, where sliders may be overlapping and simply holding is not enough.
|
||||
if (!slider.HeadCircle.IsHit)
|
||||
handleHitCircle(slider.HeadCircle);
|
||||
|
||||
requiresHold |= slider.Ball.IsHovered || h.IsHovered;
|
||||
break;
|
||||
|
||||
case DrawableSpinner _:
|
||||
requiresHold = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (requiresHit)
|
||||
@ -55,6 +68,15 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
}
|
||||
|
||||
addAction(requiresHold);
|
||||
|
||||
void handleHitCircle(DrawableHitCircle circle)
|
||||
{
|
||||
if (!circle.IsHovered)
|
||||
return;
|
||||
|
||||
Debug.Assert(circle.HitObject.HitWindows != null);
|
||||
requiresHit |= circle.HitObject.HitWindows.CanBeHit(time - circle.HitObject.StartTime);
|
||||
}
|
||||
}
|
||||
|
||||
private bool wasHit;
|
||||
|
@ -12,6 +12,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Osu.Configuration;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
|
||||
@ -29,10 +30,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
private readonly Drawable cursorTrail;
|
||||
|
||||
public Bindable<float> CursorScale;
|
||||
public Bindable<float> CursorScale = new BindableFloat(1);
|
||||
|
||||
private Bindable<float> userCursorScale;
|
||||
private Bindable<bool> autoCursorScale;
|
||||
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
public OsuCursorContainer()
|
||||
{
|
||||
@ -43,37 +44,16 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
};
|
||||
}
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private GameplayBeatmap beatmap { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuConfigManager config, OsuRulesetConfigManager rulesetConfig, IBindable<WorkingBeatmap> beatmap)
|
||||
private void load(OsuConfigManager config, OsuRulesetConfigManager rulesetConfig)
|
||||
{
|
||||
rulesetConfig?.BindWith(OsuRulesetSetting.ShowCursorTrail, showTrail);
|
||||
|
||||
this.beatmap.BindTo(beatmap);
|
||||
this.beatmap.ValueChanged += _ => calculateScale();
|
||||
|
||||
userCursorScale = config.GetBindable<float>(OsuSetting.GameplayCursorSize);
|
||||
userCursorScale.ValueChanged += _ => calculateScale();
|
||||
|
||||
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
|
||||
autoCursorScale.ValueChanged += _ => calculateScale();
|
||||
|
||||
CursorScale = new BindableFloat();
|
||||
CursorScale.ValueChanged += e => ActiveCursor.Scale = cursorTrail.Scale = new Vector2(e.NewValue);
|
||||
|
||||
calculateScale();
|
||||
}
|
||||
|
||||
private void calculateScale()
|
||||
{
|
||||
float scale = userCursorScale.Value;
|
||||
|
||||
if (autoCursorScale.Value && beatmap.Value != null)
|
||||
{
|
||||
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
|
||||
scale *= 1f - 0.7f * (1f + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
|
||||
}
|
||||
|
||||
CursorScale.Value = scale;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -81,6 +61,46 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
base.LoadComplete();
|
||||
|
||||
showTrail.BindValueChanged(v => cursorTrail.FadeTo(v.NewValue ? 1 : 0, 200), true);
|
||||
|
||||
userCursorScale = config.GetBindable<float>(OsuSetting.GameplayCursorSize);
|
||||
userCursorScale.ValueChanged += _ => calculateScale();
|
||||
|
||||
autoCursorScale = config.GetBindable<bool>(OsuSetting.AutoCursorSize);
|
||||
autoCursorScale.ValueChanged += _ => calculateScale();
|
||||
|
||||
CursorScale.ValueChanged += e =>
|
||||
{
|
||||
var newScale = new Vector2(e.NewValue);
|
||||
|
||||
ActiveCursor.Scale = newScale;
|
||||
cursorTrail.Scale = newScale;
|
||||
};
|
||||
|
||||
calculateScale();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the scale applicable to the ActiveCursor based on a beatmap's circle size.
|
||||
/// </summary>
|
||||
public static float GetScaleForCircleSize(float circleSize) =>
|
||||
1f - 0.7f * (1f + circleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY;
|
||||
|
||||
private void calculateScale()
|
||||
{
|
||||
float scale = userCursorScale.Value;
|
||||
|
||||
if (autoCursorScale.Value && beatmap != null)
|
||||
{
|
||||
// if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier.
|
||||
scale *= GetScaleForCircleSize(beatmap.BeatmapInfo.BaseDifficulty.CircleSize);
|
||||
}
|
||||
|
||||
CursorScale.Value = scale;
|
||||
|
||||
var newScale = new Vector2(scale);
|
||||
|
||||
ActiveCursor.ScaleTo(newScale, 400, Easing.OutQuint);
|
||||
cursorTrail.Scale = newScale;
|
||||
}
|
||||
|
||||
private int downCount;
|
||||
|
97
osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs
Normal file
97
osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs
Normal file
@ -0,0 +1,97 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneOnlineViewContainer : OsuTestScene
|
||||
{
|
||||
private readonly TestOnlineViewContainer onlineView;
|
||||
|
||||
public TestSceneOnlineViewContainer()
|
||||
{
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = onlineView = new TestOnlineViewContainer()
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlineStateVisibility()
|
||||
{
|
||||
AddStep("set status to online", () => ((DummyAPIAccess)API).State = APIState.Online);
|
||||
|
||||
AddUntilStep("children are visible", () => onlineView.ViewTarget.IsPresent);
|
||||
AddUntilStep("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOfflineStateVisibility()
|
||||
{
|
||||
AddStep("set status to offline", () => ((DummyAPIAccess)API).State = APIState.Offline);
|
||||
|
||||
AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent);
|
||||
AddUntilStep("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConnectingStateVisibility()
|
||||
{
|
||||
AddStep("set status to connecting", () => ((DummyAPIAccess)API).State = APIState.Connecting);
|
||||
|
||||
AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent);
|
||||
AddUntilStep("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFailingStateVisibility()
|
||||
{
|
||||
AddStep("set status to failing", () => ((DummyAPIAccess)API).State = APIState.Failing);
|
||||
|
||||
AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent);
|
||||
AddUntilStep("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent);
|
||||
}
|
||||
|
||||
private class TestOnlineViewContainer : OnlineViewContainer
|
||||
{
|
||||
public new LoadingAnimation LoadingAnimation => base.LoadingAnimation;
|
||||
|
||||
public CompositeDrawable ViewTarget => base.Content;
|
||||
|
||||
public TestOnlineViewContainer()
|
||||
: base(@"Please sign in to view dummy test content")
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Blue.Opacity(0.8f),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "dummy online content",
|
||||
Font = OsuFont.Default.With(size: 40),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -33,7 +33,7 @@ namespace osu.Game.Online.API
|
||||
public APIState State
|
||||
{
|
||||
get => state;
|
||||
private set
|
||||
set
|
||||
{
|
||||
if (state == value)
|
||||
return;
|
||||
|
@ -152,7 +152,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
break;
|
||||
|
||||
case PlaceholderState.NotLoggedIn:
|
||||
replacePlaceholder(new LoginPlaceholder());
|
||||
replacePlaceholder(new LoginPlaceholder(@"Please sign in to view online leaderboards!"));
|
||||
break;
|
||||
|
||||
case PlaceholderState.NotSupporter:
|
||||
|
100
osu.Game/Online/OnlineViewContainer.cs
Normal file
100
osu.Game/Online/OnlineViewContainer.cs
Normal file
@ -0,0 +1,100 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.Placeholders;
|
||||
|
||||
namespace osu.Game.Online
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see cref="Container"/> for displaying online content which require a local user to be logged in.
|
||||
/// Shows its children only when the local user is logged in and supports displaying a placeholder if not.
|
||||
/// </summary>
|
||||
public abstract class OnlineViewContainer : Container, IOnlineComponent
|
||||
{
|
||||
protected LoadingAnimation LoadingAnimation { get; private set; }
|
||||
|
||||
protected override Container<Drawable> Content { get; } = new Container { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
private readonly string placeholderMessage;
|
||||
|
||||
private Placeholder placeholder;
|
||||
|
||||
private const double transform_duration = 300;
|
||||
|
||||
[Resolved]
|
||||
protected IAPIProvider API { get; private set; }
|
||||
|
||||
protected OnlineViewContainer(string placeholderMessage)
|
||||
{
|
||||
this.placeholderMessage = placeholderMessage;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
Content,
|
||||
placeholder = new LoginPlaceholder(placeholderMessage),
|
||||
LoadingAnimation = new LoadingAnimation
|
||||
{
|
||||
Alpha = 0,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
API.Register(this);
|
||||
}
|
||||
|
||||
public virtual void APIStateChanged(IAPIProvider api, APIState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case APIState.Offline:
|
||||
PopContentOut(Content);
|
||||
placeholder.ScaleTo(0.8f).Then().ScaleTo(1, 3 * transform_duration, Easing.OutQuint);
|
||||
placeholder.FadeInFromZero(2 * transform_duration, Easing.OutQuint);
|
||||
LoadingAnimation.Hide();
|
||||
break;
|
||||
|
||||
case APIState.Online:
|
||||
PopContentIn(Content);
|
||||
placeholder.FadeOut(transform_duration / 2, Easing.OutQuint);
|
||||
LoadingAnimation.Hide();
|
||||
break;
|
||||
|
||||
case APIState.Failing:
|
||||
case APIState.Connecting:
|
||||
PopContentOut(Content);
|
||||
LoadingAnimation.Show();
|
||||
placeholder.FadeOut(transform_duration / 2, Easing.OutQuint);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Applies a transform to the online content to make it hidden.
|
||||
/// </summary>
|
||||
protected virtual void PopContentOut(Drawable content) => content.FadeOut(transform_duration / 2, Easing.OutQuint);
|
||||
|
||||
/// <summary>
|
||||
/// Applies a transform to the online content to make it visible.
|
||||
/// </summary>
|
||||
protected virtual void PopContentIn(Drawable content) => content.FadeIn(transform_duration, Easing.OutQuint);
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
API?.Unregister(this);
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@ namespace osu.Game.Online.Placeholders
|
||||
[Resolved(CanBeNull = true)]
|
||||
private LoginOverlay login { get; set; }
|
||||
|
||||
public LoginPlaceholder()
|
||||
public LoginPlaceholder(string actionMessage)
|
||||
{
|
||||
AddIcon(FontAwesome.Solid.UserLock, cp =>
|
||||
{
|
||||
@ -22,7 +22,7 @@ namespace osu.Game.Online.Placeholders
|
||||
cp.Padding = new MarginPadding { Right = 10 };
|
||||
});
|
||||
|
||||
AddText(@"Please sign in to view online leaderboards!");
|
||||
AddText(actionMessage);
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
|
@ -2,10 +2,12 @@
|
||||
// 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;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osuTK;
|
||||
@ -30,6 +32,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
private float currentZoom = 1;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private IFrameBasedClock editorClock { get; set; }
|
||||
|
||||
public ZoomableScrollContainer()
|
||||
: base(Direction.Horizontal)
|
||||
{
|
||||
@ -104,8 +109,15 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
{
|
||||
if (e.IsPrecise)
|
||||
{
|
||||
// can't handle scroll correctly while playing.
|
||||
// the editor will handle this case for us.
|
||||
if (editorClock?.IsRunning == true)
|
||||
return false;
|
||||
|
||||
// for now, we don't support zoom when using a precision scroll device. this needs gesture support.
|
||||
return base.OnScroll(e);
|
||||
}
|
||||
|
||||
setZoomTarget(zoomTarget + e.ScrollDelta.Y, zoomedContent.ToLocalSpace(e.ScreenSpaceMousePosition).X);
|
||||
return true;
|
||||
|
42
osu.Game/Screens/Play/GameplayBeatmap.cs
Normal file
42
osu.Game/Screens/Play/GameplayBeatmap.cs
Normal file
@ -0,0 +1,42 @@
|
||||
// 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.Collections.Generic;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class GameplayBeatmap : Component, IBeatmap
|
||||
{
|
||||
public readonly IBeatmap PlayableBeatmap;
|
||||
|
||||
public GameplayBeatmap(IBeatmap playableBeatmap)
|
||||
{
|
||||
PlayableBeatmap = playableBeatmap;
|
||||
}
|
||||
|
||||
public BeatmapInfo BeatmapInfo
|
||||
{
|
||||
get => PlayableBeatmap.BeatmapInfo;
|
||||
set => PlayableBeatmap.BeatmapInfo = value;
|
||||
}
|
||||
|
||||
public BeatmapMetadata Metadata => PlayableBeatmap.Metadata;
|
||||
|
||||
public ControlPointInfo ControlPointInfo => PlayableBeatmap.ControlPointInfo;
|
||||
|
||||
public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks;
|
||||
|
||||
public double TotalBreakTime => PlayableBeatmap.TotalBreakTime;
|
||||
|
||||
public IReadOnlyList<HitObject> HitObjects => PlayableBeatmap.HitObjects;
|
||||
|
||||
public IEnumerable<BeatmapStatistic> GetStatistics() => PlayableBeatmap.GetStatistics();
|
||||
|
||||
public IBeatmap Clone() => PlayableBeatmap.Clone();
|
||||
}
|
||||
}
|
@ -110,6 +110,13 @@ namespace osu.Game.Screens.Play
|
||||
this.showResults = showResults;
|
||||
}
|
||||
|
||||
private GameplayBeatmap gameplayBeatmap;
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config)
|
||||
{
|
||||
@ -143,6 +150,10 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
InternalChild = GameplayClockContainer = new GameplayClockContainer(Beatmap.Value, Mods.Value, DrawableRuleset.GameplayStartTime);
|
||||
|
||||
AddInternal(gameplayBeatmap = new GameplayBeatmap(playableBeatmap));
|
||||
|
||||
dependencies.CacheAs(gameplayBeatmap);
|
||||
|
||||
addUnderlayComponents(GameplayClockContainer);
|
||||
addGameplayComponents(GameplayClockContainer, Beatmap.Value);
|
||||
addOverlayComponents(GameplayClockContainer, Beatmap.Value);
|
||||
|
@ -28,11 +28,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public readonly BeatmapDetails Details;
|
||||
|
||||
protected Bindable<BeatmapDetailAreaTabItem> CurrentTab
|
||||
{
|
||||
get => tabControl.Current;
|
||||
set => tabControl.Current = value;
|
||||
}
|
||||
protected Bindable<BeatmapDetailAreaTabItem> CurrentTab => tabControl.Current;
|
||||
|
||||
private readonly Container content;
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
Loading…
Reference in New Issue
Block a user