mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 08:22:56 +08:00
Merge remote-tracking branch 'origin/master' into fix-non-async-load
This commit is contained in:
commit
e00702f4e4
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
{
|
{
|
||||||
public class CatchModAutoplay : ModAutoplay<CatchHitObject>
|
public class CatchModAutoplay : ModAutoplay<CatchHitObject>
|
||||||
{
|
{
|
||||||
protected override Score CreateReplayScore(Beatmap<CatchHitObject> beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!salad!" } },
|
||||||
Replay = new CatchAutoGenerator(beatmap).Generate(),
|
Replay = new CatchAutoGenerator(beatmap).Generate(),
|
||||||
|
@ -6,17 +6,20 @@ using System.Linq;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Replays
|
namespace osu.Game.Rulesets.Catch.Replays
|
||||||
{
|
{
|
||||||
internal class CatchAutoGenerator : AutoGenerator<CatchHitObject>
|
internal class CatchAutoGenerator : AutoGenerator
|
||||||
{
|
{
|
||||||
public const double RELEASE_DELAY = 20;
|
public const double RELEASE_DELAY = 20;
|
||||||
|
|
||||||
public CatchAutoGenerator(Beatmap<CatchHitObject> beatmap)
|
public new CatchBeatmap Beatmap => (CatchBeatmap)base.Beatmap;
|
||||||
|
|
||||||
|
public CatchAutoGenerator(IBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
Replay = new Replay();
|
Replay = new Replay();
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
{
|
{
|
||||||
public class ManiaModAutoplay : ModAutoplay<ManiaHitObject>
|
public class ManiaModAutoplay : ModAutoplay<ManiaHitObject>
|
||||||
{
|
{
|
||||||
protected override Score CreateReplayScore(Beatmap<ManiaHitObject> beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "osu!topus!" } },
|
||||||
Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(),
|
Replay = new ManiaAutoGenerator((ManiaBeatmap)beatmap).Generate(),
|
||||||
|
@ -5,13 +5,12 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Replays
|
namespace osu.Game.Rulesets.Mania.Replays
|
||||||
{
|
{
|
||||||
internal class ManiaAutoGenerator : AutoGenerator<ManiaHitObject>
|
internal class ManiaAutoGenerator : AutoGenerator
|
||||||
{
|
{
|
||||||
public const double RELEASE_DELAY = 20;
|
public const double RELEASE_DELAY = 20;
|
||||||
|
|
||||||
|
@ -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 });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
{
|
{
|
||||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).Append(typeof(OsuModSpunOut)).ToArray();
|
||||||
|
|
||||||
protected override Score CreateReplayScore(Beatmap<OsuHitObject> beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
|
||||||
Replay = new OsuAutoGenerator(beatmap).Generate()
|
Replay = new OsuAutoGenerator(beatmap).Generate()
|
||||||
|
@ -10,12 +10,15 @@ using System.Linq;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Replays
|
namespace osu.Game.Rulesets.Osu.Replays
|
||||||
{
|
{
|
||||||
public class OsuAutoGenerator : OsuAutoGeneratorBase
|
public class OsuAutoGenerator : OsuAutoGeneratorBase
|
||||||
{
|
{
|
||||||
|
public new OsuBeatmap Beatmap => (OsuBeatmap)base.Beatmap;
|
||||||
|
|
||||||
#region Parameters
|
#region Parameters
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -42,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
|
|
||||||
#region Construction / Initialisation
|
#region Construction / Initialisation
|
||||||
|
|
||||||
public OsuAutoGenerator(Beatmap<OsuHitObject> beatmap)
|
public OsuAutoGenerator(IBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
// Already superhuman, but still somewhat realistic
|
// Already superhuman, but still somewhat realistic
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
@ -12,7 +11,7 @@ using osu.Game.Rulesets.Replays;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Replays
|
namespace osu.Game.Rulesets.Osu.Replays
|
||||||
{
|
{
|
||||||
public abstract class OsuAutoGeneratorBase : AutoGenerator<OsuHitObject>
|
public abstract class OsuAutoGeneratorBase : AutoGenerator
|
||||||
{
|
{
|
||||||
#region Constants
|
#region Constants
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Replays
|
|||||||
protected Replay Replay;
|
protected Replay Replay;
|
||||||
protected List<ReplayFrame> Frames => Replay.Frames;
|
protected List<ReplayFrame> Frames => Replay.Frames;
|
||||||
|
|
||||||
protected OsuAutoGeneratorBase(Beatmap<OsuHitObject> beatmap)
|
protected OsuAutoGeneratorBase(IBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
Replay = new Replay();
|
Replay = new Replay();
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
{
|
{
|
||||||
public class TaikoModAutoplay : ModAutoplay<TaikoHitObject>
|
public class TaikoModAutoplay : ModAutoplay<TaikoHitObject>
|
||||||
{
|
{
|
||||||
protected override Score CreateReplayScore(Beatmap<TaikoHitObject> beatmap) => new Score
|
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
ScoreInfo = new ScoreInfo { User = new User { Username = "mekkadosu!" } },
|
||||||
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
Replay = new TaikoAutoGenerator(beatmap).Generate(),
|
||||||
|
@ -9,14 +9,17 @@ using osu.Game.Replays;
|
|||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Replays
|
namespace osu.Game.Rulesets.Taiko.Replays
|
||||||
{
|
{
|
||||||
public class TaikoAutoGenerator : AutoGenerator<TaikoHitObject>
|
public class TaikoAutoGenerator : AutoGenerator
|
||||||
{
|
{
|
||||||
|
public new TaikoBeatmap Beatmap => (TaikoBeatmap)base.Beatmap;
|
||||||
|
|
||||||
private const double swell_hit_speed = 50;
|
private const double swell_hit_speed = 50;
|
||||||
|
|
||||||
public TaikoAutoGenerator(Beatmap<TaikoHitObject> beatmap)
|
public TaikoAutoGenerator(IBeatmap beatmap)
|
||||||
: base(beatmap)
|
: base(beatmap)
|
||||||
{
|
{
|
||||||
Replay = new Replay();
|
Replay = new Replay();
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -14,15 +16,27 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
protected override Player CreatePlayer(Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
// We create a dummy RulesetContainer just to get the replay - we don't want to use mods here
|
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo);
|
||||||
// to simulate setting a replay rather than having the replay already set for us
|
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
|
||||||
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(Beatmap.Value);
|
|
||||||
|
|
||||||
// Reset the mods
|
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap));
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Where(m => !(m is ModAutoplay));
|
}
|
||||||
|
|
||||||
return new ReplayPlayer(dummyRulesetContainer.ReplayScore);
|
protected override void AddCheckSteps(Func<Player> player)
|
||||||
|
{
|
||||||
|
base.AddCheckSteps(player);
|
||||||
|
AddUntilStep(() => ((ScoreAccessibleReplayPlayer)player()).ScoreProcessor.TotalScore.Value > 0, "score above zero");
|
||||||
|
AddUntilStep(() => ((ScoreAccessibleReplayPlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys");
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||||
|
{
|
||||||
|
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||||
|
public new HUDOverlay HUDOverlay => base.HUDOverlay;
|
||||||
|
|
||||||
|
public ScoreAccessibleReplayPlayer(Score score)
|
||||||
|
: base(score)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T>
|
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T>
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
protected virtual Score CreateReplayScore(Beatmap<T> beatmap) => new Score { Replay = new Replay() };
|
|
||||||
|
|
||||||
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
|
|
||||||
|
|
||||||
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) => rulesetContainer.SetReplayScore(CreateReplayScore(rulesetContainer.Beatmap));
|
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) => rulesetContainer.SetReplayScore(CreateReplayScore(rulesetContainer.Beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -31,5 +27,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public bool AllowFail => false;
|
public bool AllowFail => false;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
|
||||||
|
|
||||||
|
public override bool HasImplementation => GetType().GenericTypeArguments.Length == 0;
|
||||||
|
|
||||||
|
public virtual Score CreateReplayScore(IBeatmap beatmap) => new Score { Replay = new Replay() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Replays
|
namespace osu.Game.Rulesets.Replays
|
||||||
{
|
{
|
||||||
public abstract class AutoGenerator<T> : IAutoGenerator
|
public abstract class AutoGenerator : IAutoGenerator
|
||||||
where T : HitObject
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates the auto replay and returns it.
|
/// Creates the auto replay and returns it.
|
||||||
@ -21,11 +19,11 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The beatmap we're making.
|
/// The beatmap we're making.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Beatmap<T> Beatmap;
|
protected IBeatmap Beatmap;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected AutoGenerator(Beatmap<T> beatmap)
|
protected AutoGenerator(IBeatmap beatmap)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// <returns>An enumerable of constructed <see cref="Mod"/>s</returns>
|
/// <returns>An enumerable of constructed <see cref="Mod"/>s</returns>
|
||||||
public virtual IEnumerable<Mod> ConvertLegacyMods(LegacyMods mods) => new Mod[] { };
|
public virtual IEnumerable<Mod> ConvertLegacyMods(LegacyMods mods) => new Mod[] { };
|
||||||
|
|
||||||
public Mod GetAutoplayMod() => GetAllMods().First(mod => mod is ModAutoplay);
|
public ModAutoplay GetAutoplayMod() => GetAllMods().OfType<ModAutoplay>().First();
|
||||||
|
|
||||||
protected Ruleset(RulesetInfo rulesetInfo = null)
|
protected Ruleset(RulesetInfo rulesetInfo = null)
|
||||||
{
|
{
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,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;
|
||||||
@ -20,7 +19,6 @@ using osu.Framework.Timing;
|
|||||||
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;
|
||||||
@ -34,7 +32,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
|
||||||
|
|
||||||
@ -59,9 +57,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;
|
|
||||||
|
|
||||||
private IAdjustableClock sourceClock;
|
private IAdjustableClock sourceClock;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -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