mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 14:42:56 +08:00
Merge remote-tracking branch 'upstream/master' into gameplay-clock-container
This commit is contained in:
commit
ed8c9bc88a
@ -16,18 +16,18 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseGameplayCursor : OsuTestCase, IProvideCursor
|
public class TestCaseGameplayCursor : OsuTestCase, IProvideCursor
|
||||||
{
|
{
|
||||||
private GameplayCursor cursor;
|
private GameplayCursorContainer cursorContainer;
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) };
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(CursorTrail) };
|
||||||
|
|
||||||
public CursorContainer Cursor => cursor;
|
public CursorContainer Cursor => cursorContainer;
|
||||||
|
|
||||||
public bool ProvidingUserCursor => true;
|
public bool ProvidingUserCursor => true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(cursor = new GameplayCursor { RelativeSizeAxes = Axes.Both });
|
Add(cursorContainer = new GameplayCursorContainer { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.UI.Cursor
|
namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||||
{
|
{
|
||||||
public class GameplayCursor : CursorContainer, IKeyBindingHandler<OsuAction>
|
public class GameplayCursorContainer : CursorContainer, IKeyBindingHandler<OsuAction>
|
||||||
{
|
{
|
||||||
protected override Drawable CreateCursor() => new OsuCursor();
|
protected override Drawable CreateCursor() => new OsuCursor();
|
||||||
|
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
|
|
||||||
private readonly Container<Drawable> fadeContainer;
|
private readonly Container<Drawable> fadeContainer;
|
||||||
|
|
||||||
public GameplayCursor()
|
public GameplayCursorContainer()
|
||||||
{
|
{
|
||||||
InternalChild = fadeContainer = new Container
|
InternalChild = fadeContainer = new Container
|
||||||
{
|
{
|
@ -60,6 +60,6 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override CursorContainer CreateCursor() => new GameplayCursor();
|
protected override CursorContainer CreateCursor() => new GameplayCursorContainer();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public class TestCaseUpdateableBeatmapBackgroundSprite : OsuTestCase
|
public class TestCaseUpdateableBeatmapBackgroundSprite : OsuTestCase
|
||||||
{
|
{
|
||||||
private UpdateableBeatmapBackgroundSprite backgroundSprite;
|
private TestUpdateableBeatmapBackgroundSprite backgroundSprite;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
@ -28,30 +28,36 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
var imported = ImportBeatmapTest.LoadOszIntoOsu(osu);
|
var imported = ImportBeatmapTest.LoadOszIntoOsu(osu);
|
||||||
|
|
||||||
Child = backgroundSprite = new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };
|
Child = backgroundSprite = new TestUpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
backgroundSprite.Beatmap.BindTo(beatmapBindable);
|
backgroundSprite.Beatmap.BindTo(beatmapBindable);
|
||||||
|
|
||||||
var req = new GetBeatmapSetRequest(1);
|
var req = new GetBeatmapSetRequest(1);
|
||||||
api.Queue(req);
|
api.Queue(req);
|
||||||
|
|
||||||
AddStep("null", () => beatmapBindable.Value = null);
|
AddStep("load null beatmap", () => beatmapBindable.Value = null);
|
||||||
|
AddUntilStep(() => backgroundSprite.ChildCount == 1, "wait for cleanup...");
|
||||||
AddStep("imported", () => beatmapBindable.Value = imported.Beatmaps.First());
|
AddStep("load imported beatmap", () => beatmapBindable.Value = imported.Beatmaps.First());
|
||||||
|
AddUntilStep(() => backgroundSprite.ChildCount == 1, "wait for cleanup...");
|
||||||
|
|
||||||
if (api.IsLoggedIn)
|
if (api.IsLoggedIn)
|
||||||
{
|
{
|
||||||
AddUntilStep(() => req.Result != null, "wait for api response");
|
AddUntilStep(() => req.Result != null, "wait for api response");
|
||||||
|
AddStep("load online beatmap", () => beatmapBindable.Value = new BeatmapInfo
|
||||||
AddStep("online", () => beatmapBindable.Value = new BeatmapInfo
|
|
||||||
{
|
{
|
||||||
BeatmapSet = req.Result?.ToBeatmapSet(rulesets)
|
BeatmapSet = req.Result?.ToBeatmapSet(rulesets)
|
||||||
});
|
});
|
||||||
|
AddUntilStep(() => backgroundSprite.ChildCount == 1, "wait for cleanup...");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddStep("online (login first)", () => { });
|
AddStep("online (login first)", () => { });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TestUpdateableBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite
|
||||||
|
{
|
||||||
|
public int ChildCount => InternalChildren.Count;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Display a baetmap background from a local source, but fallback to online source if not available.
|
/// Display a beatmap background from a local source, but fallback to online source if not available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<BeatmapInfo>
|
public class UpdateableBeatmapBackgroundSprite : ModelBackedDrawable<BeatmapInfo>
|
||||||
{
|
{
|
||||||
@ -26,37 +26,51 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
this.beatmapSetCoverType = beatmapSetCoverType;
|
this.beatmapSetCoverType = beatmapSetCoverType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateDrawable(BeatmapInfo model)
|
private BeatmapInfo lastModel;
|
||||||
|
|
||||||
|
protected override DelayedLoadWrapper CreateDelayedLoadWrapper(Drawable content, double timeBeforeLoad)
|
||||||
{
|
{
|
||||||
return new DelayedLoadUnloadWrapper(() =>
|
return new DelayedLoadUnloadWrapper(() =>
|
||||||
{
|
{
|
||||||
Drawable drawable;
|
// If DelayedLoadUnloadWrapper is attempting to RELOAD the same content (Beatmap), that means that it was
|
||||||
|
// previously UNLOADED and thus its children have been disposed of, so we need to recreate them here.
|
||||||
|
if (lastModel == Beatmap.Value && Beatmap.Value != null)
|
||||||
|
return CreateDrawable(Beatmap.Value);
|
||||||
|
|
||||||
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
|
// If the model has changed since the previous unload (or if there was no load), then we can safely use the given content
|
||||||
|
lastModel = Beatmap.Value;
|
||||||
if (model?.BeatmapSet?.OnlineInfo != null)
|
return content;
|
||||||
drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
}, timeBeforeLoad, 10000);
|
||||||
else if (localBeatmap.BeatmapInfo.ID != 0)
|
|
||||||
{
|
|
||||||
// Fall back to local background if one exists
|
|
||||||
drawable = new BeatmapBackgroundSprite(localBeatmap);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Use the default background if somehow an online set does not exist and we don't have a local copy.
|
|
||||||
drawable = new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
drawable.RelativeSizeAxes = Axes.Both;
|
|
||||||
drawable.Anchor = Anchor.Centre;
|
|
||||||
drawable.Origin = Anchor.Centre;
|
|
||||||
drawable.FillMode = FillMode.Fill;
|
|
||||||
drawable.OnLoadComplete = d => d.FadeInFromZero(400);
|
|
||||||
|
|
||||||
return drawable;
|
|
||||||
}, 500, 10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override double FadeDuration => 0;
|
protected override Drawable CreateDrawable(BeatmapInfo model)
|
||||||
|
{
|
||||||
|
Drawable drawable;
|
||||||
|
|
||||||
|
var localBeatmap = beatmaps.GetWorkingBeatmap(model);
|
||||||
|
|
||||||
|
if (model?.BeatmapSet?.OnlineInfo != null)
|
||||||
|
{
|
||||||
|
drawable = new BeatmapSetCover(model.BeatmapSet, beatmapSetCoverType);
|
||||||
|
}
|
||||||
|
else if (localBeatmap.BeatmapInfo.ID != 0)
|
||||||
|
{
|
||||||
|
// Fall back to local background if one exists
|
||||||
|
drawable = new BeatmapBackgroundSprite(localBeatmap);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Use the default background if somehow an online set does not exist and we don't have a local copy.
|
||||||
|
drawable = new BeatmapBackgroundSprite(beatmaps.DefaultBeatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
drawable.RelativeSizeAxes = Axes.Both;
|
||||||
|
drawable.Anchor = Anchor.Centre;
|
||||||
|
drawable.Origin = Anchor.Centre;
|
||||||
|
drawable.FillMode = FillMode.Fill;
|
||||||
|
drawable.OnLoadComplete = d => d.FadeInFromZero(400);
|
||||||
|
|
||||||
|
return drawable;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,9 @@ using System.Linq;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
@ -32,7 +34,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead.
|
/// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class RulesetContainer : Container
|
public abstract class RulesetContainer : Container, IProvideCursor
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The selected variant.
|
/// The selected variant.
|
||||||
@ -77,7 +79,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
|
/// The cursor provided by this <see cref="RulesetContainer"/>. May be null if no cursor is provided.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly CursorContainer Cursor;
|
public CursorContainer Cursor { get; }
|
||||||
|
|
||||||
|
public bool ProvidingUserCursor => Cursor != null && !HasReplayLoaded.Value;
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
|
||||||
|
|
||||||
public readonly Ruleset Ruleset;
|
public readonly Ruleset Ruleset;
|
||||||
|
|
||||||
|
@ -107,6 +107,14 @@ namespace osu.Game.Screens.Multi.Lounge
|
|||||||
Filter.Search.HoldFocus = false;
|
Filter.Search.HoldFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnResuming(IScreen last)
|
||||||
|
{
|
||||||
|
base.OnResuming(last);
|
||||||
|
|
||||||
|
if (currentRoom.Value?.RoomID.Value == null)
|
||||||
|
currentRoom.Value = new Room();
|
||||||
|
}
|
||||||
|
|
||||||
private void joinRequested(Room room)
|
private void joinRequested(Room room)
|
||||||
{
|
{
|
||||||
processingOverlay.Show();
|
processingOverlay.Show();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -13,6 +14,7 @@ using osu.Game.Beatmaps.Drawables;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Multi.Components;
|
using osu.Game.Screens.Multi.Components;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -108,7 +110,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods, true);
|
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods ?? Enumerable.Empty<Mod>(), true);
|
||||||
|
|
||||||
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
|
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Audio.Sample;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -17,7 +16,6 @@ using osu.Framework.Threading;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Cursor;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -31,7 +29,7 @@ using osu.Game.Storyboards.Drawables;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class Player : ScreenWithBeatmapBackground, IProvideCursor
|
public class Player : ScreenWithBeatmapBackground
|
||||||
{
|
{
|
||||||
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
protected override bool AllowBackButton => false; // handled by HoldForMenuButton
|
||||||
|
|
||||||
@ -55,9 +53,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public int RestartCount;
|
public int RestartCount;
|
||||||
|
|
||||||
public CursorContainer Cursor => RulesetContainer.Cursor;
|
|
||||||
public bool ProvidingUserCursor => RulesetContainer?.Cursor != null && !RulesetContainer.HasReplayLoaded.Value;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private ScoreManager scoreManager { get; set; }
|
private ScoreManager scoreManager { get; set; }
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
Ruleset.Value = CurrentItem.Value.Ruleset;
|
Ruleset.Value = CurrentItem.Value.Ruleset;
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap);
|
||||||
Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value.RequiredMods;
|
Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value.RequiredMods ?? Enumerable.Empty<Mod>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.Disabled = true;
|
Beatmap.Disabled = true;
|
||||||
|
@ -20,14 +20,14 @@ namespace osu.Game.Utils
|
|||||||
|
|
||||||
private readonly List<Task> tasks = new List<Task>();
|
private readonly List<Task> tasks = new List<Task>();
|
||||||
|
|
||||||
private Exception lastException;
|
|
||||||
|
|
||||||
public RavenLogger(OsuGame game)
|
public RavenLogger(OsuGame game)
|
||||||
{
|
{
|
||||||
raven.Release = game.Version;
|
raven.Release = game.Version;
|
||||||
|
|
||||||
if (!game.IsDeployedBuild) return;
|
if (!game.IsDeployedBuild) return;
|
||||||
|
|
||||||
|
Exception lastException = null;
|
||||||
|
|
||||||
Logger.NewEntry += entry =>
|
Logger.NewEntry += entry =>
|
||||||
{
|
{
|
||||||
if (entry.Level < LogLevel.Verbose) return;
|
if (entry.Level < LogLevel.Verbose) return;
|
||||||
|
Loading…
Reference in New Issue
Block a user