mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Merge remote-tracking branch 'upstream/master' into pause-logic-simplification
This commit is contained in:
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
typeof(DrawableBananaShower),
|
typeof(DrawableBananaShower),
|
||||||
|
|
||||||
typeof(CatchRuleset),
|
typeof(CatchRuleset),
|
||||||
typeof(CatchRulesetContainer),
|
typeof(DrawableCatchRuleset),
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestCaseBananaShower()
|
public TestCaseBananaShower()
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
{
|
{
|
||||||
public class CatchRuleset : Ruleset
|
public class CatchRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new CatchRulesetContainer(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableCatchRuleset(this, beatmap);
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap);
|
||||||
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new CatchBeatmapProcessor(beatmap);
|
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new CatchBeatmapProcessor(beatmap);
|
||||||
|
|
||||||
|
@ -21,10 +21,10 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
|
|
||||||
private CatchPlayfield playfield;
|
private CatchPlayfield playfield;
|
||||||
|
|
||||||
public override void ApplyToRulesetContainer(RulesetContainer<CatchHitObject> rulesetContainer)
|
public override void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
playfield = (CatchPlayfield)rulesetContainer.Playfield;
|
playfield = (CatchPlayfield)drawableRuleset.Playfield;
|
||||||
base.ApplyToRulesetContainer(rulesetContainer);
|
base.ApplyToDrawableRuleset(drawableRuleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CatchFlashlight : Flashlight
|
private class CatchFlashlight : Flashlight
|
||||||
|
@ -20,6 +20,13 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
|
|
||||||
public void ApplyToHitObject(HitObject hitObject)
|
public void ApplyToHitObject(HitObject hitObject)
|
||||||
{
|
{
|
||||||
|
if (hitObject is JuiceStream stream)
|
||||||
|
{
|
||||||
|
lastPosition = stream.EndX;
|
||||||
|
lastStartTime = stream.EndTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!(hitObject is Fruit))
|
if (!(hitObject is Fruit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -70,7 +77,7 @@ namespace osu.Game.Rulesets.Catch.Mods
|
|||||||
private void applyRandomOffset(ref float position, double maxOffset)
|
private void applyRandomOffset(ref float position, double maxOffset)
|
||||||
{
|
{
|
||||||
bool right = RNG.NextBool();
|
bool right = RNG.NextBool();
|
||||||
float rand = Math.Min(20, (float)RNG.NextDouble(0, maxOffset)) / CatchPlayfield.BASE_WIDTH;
|
float rand = Math.Min(20, (float)RNG.NextDouble(0, Math.Max(0, maxOffset))) / CatchPlayfield.BASE_WIDTH;
|
||||||
|
|
||||||
if (right)
|
if (right)
|
||||||
{
|
{
|
||||||
|
@ -13,8 +13,8 @@ namespace osu.Game.Rulesets.Catch.Scoring
|
|||||||
{
|
{
|
||||||
public class CatchScoreProcessor : ScoreProcessor<CatchHitObject>
|
public class CatchScoreProcessor : ScoreProcessor<CatchHitObject>
|
||||||
{
|
{
|
||||||
public CatchScoreProcessor(RulesetContainer<CatchHitObject> rulesetContainer)
|
public CatchScoreProcessor(DrawableRuleset<CatchHitObject> drawableRuleset)
|
||||||
: base(rulesetContainer)
|
: base(drawableRuleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,13 +17,13 @@ using osu.Game.Rulesets.UI.Scrolling;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.UI
|
namespace osu.Game.Rulesets.Catch.UI
|
||||||
{
|
{
|
||||||
public class CatchRulesetContainer : ScrollingRulesetContainer<CatchPlayfield, CatchHitObject>
|
public class DrawableCatchRuleset : DrawableScrollingRuleset<CatchHitObject>
|
||||||
{
|
{
|
||||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant;
|
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant;
|
||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableCatchRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
Direction.Value = ScrollingDirection.Down;
|
Direction.Value = ScrollingDirection.Down;
|
||||||
@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new CatchPlayfield(Beatmap.BeatmapInfo.BaseDifficulty, GetVisualRepresentation);
|
protected override Playfield CreatePlayfield() => new CatchPlayfield(Beatmap.BeatmapInfo.BaseDifficulty, GetVisualRepresentation);
|
||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
protected override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
public override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h)
|
public override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h)
|
||||||
{
|
{
|
@ -10,11 +10,11 @@ using osu.Game.Rulesets.UI.Scrolling;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Edit
|
namespace osu.Game.Rulesets.Mania.Edit
|
||||||
{
|
{
|
||||||
public class ManiaEditRulesetContainer : ManiaRulesetContainer
|
public class DrawableManiaEditRuleset : DrawableManiaRuleset
|
||||||
{
|
{
|
||||||
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
||||||
|
|
||||||
public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableManiaEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
[Cached(Type = typeof(IManiaHitObjectComposer))]
|
[Cached(Type = typeof(IManiaHitObjectComposer))]
|
||||||
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>, IManiaHitObjectComposer
|
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>, IManiaHitObjectComposer
|
||||||
{
|
{
|
||||||
protected new ManiaEditRulesetContainer RulesetContainer { get; private set; }
|
protected new DrawableManiaEditRuleset DrawableRuleset { get; private set; }
|
||||||
|
|
||||||
public ManiaHitObjectComposer(Ruleset ruleset)
|
public ManiaHitObjectComposer(Ruleset ruleset)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
@ -32,23 +32,23 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="screenSpacePosition">The screen-space position.</param>
|
/// <param name="screenSpacePosition">The screen-space position.</param>
|
||||||
/// <returns>The column which intersects with <paramref name="screenSpacePosition"/>.</returns>
|
/// <returns>The column which intersects with <paramref name="screenSpacePosition"/>.</returns>
|
||||||
public Column ColumnAt(Vector2 screenSpacePosition) => RulesetContainer.GetColumnByPosition(screenSpacePosition);
|
public Column ColumnAt(Vector2 screenSpacePosition) => DrawableRuleset.GetColumnByPosition(screenSpacePosition);
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
public int TotalColumns => ((ManiaPlayfield)RulesetContainer.Playfield).TotalColumns;
|
public int TotalColumns => ((ManiaPlayfield)DrawableRuleset.Playfield).TotalColumns;
|
||||||
|
|
||||||
protected override RulesetContainer<ManiaHitObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
RulesetContainer = new ManiaEditRulesetContainer(ruleset, beatmap);
|
DrawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap);
|
||||||
|
|
||||||
// This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it
|
// This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it
|
||||||
dependencies.CacheAs(RulesetContainer.ScrollingInfo);
|
dependencies.CacheAs(DrawableRuleset.ScrollingInfo);
|
||||||
|
|
||||||
return RulesetContainer;
|
return DrawableRuleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
{
|
{
|
||||||
public class ManiaRuleset : Ruleset
|
public class ManiaRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new ManiaRulesetContainer(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableManiaRuleset(this, beatmap);
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap);
|
||||||
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new ManiaPerformanceCalculator(this, beatmap, score);
|
public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new ManiaPerformanceCalculator(this, beatmap, score);
|
||||||
|
|
||||||
|
@ -92,8 +92,8 @@ namespace osu.Game.Rulesets.Mania.Scoring
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ManiaScoreProcessor(RulesetContainer<ManiaHitObject> rulesetContainer)
|
public ManiaScoreProcessor(DrawableRuleset<ManiaHitObject> drawableRuleset)
|
||||||
: base(rulesetContainer)
|
: base(drawableRuleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,8 +28,10 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.UI
|
namespace osu.Game.Rulesets.Mania.UI
|
||||||
{
|
{
|
||||||
public class ManiaRulesetContainer : ScrollingRulesetContainer<ManiaPlayfield, ManiaHitObject>
|
public class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObject>
|
||||||
{
|
{
|
||||||
|
protected new ManiaPlayfield Playfield => (ManiaPlayfield)base.Playfield;
|
||||||
|
|
||||||
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
|
public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap;
|
||||||
|
|
||||||
public IEnumerable<BarLine> BarLines;
|
public IEnumerable<BarLine> BarLines;
|
||||||
@ -38,7 +40,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
||||||
|
|
||||||
public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableManiaRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
// Generate the bar lines
|
// Generate the bar lines
|
||||||
@ -97,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public override int Variant => (int)(Beatmap.Stages.Count == 1 ? PlayfieldType.Single : PlayfieldType.Dual) + Beatmap.TotalColumns;
|
public override int Variant => (int)(Beatmap.Stages.Count == 1 ? PlayfieldType.Single : PlayfieldType.Dual) + Beatmap.TotalColumns;
|
||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant);
|
protected override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant);
|
||||||
|
|
||||||
public override DrawableHitObject<ManiaHitObject> GetVisualRepresentation(ManiaHitObject h)
|
public override DrawableHitObject<ManiaHitObject> GetVisualRepresentation(ManiaHitObject h)
|
||||||
{
|
{
|
@ -8,9 +8,9 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
{
|
{
|
||||||
public class OsuEditRulesetContainer : OsuRulesetContainer
|
public class DrawableOsuEditRuleset : DrawableOsuRuleset
|
||||||
{
|
{
|
||||||
public OsuEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableOsuEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
@ -26,8 +26,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override RulesetContainer<OsuHitObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
=> new OsuEditRulesetContainer(ruleset, beatmap);
|
=> new DrawableOsuEditRuleset(ruleset, beatmap);
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModBlinds : Mod, IApplicableToRulesetContainer<OsuHitObject>, IApplicableToScoreProcessor
|
public class OsuModBlinds : Mod, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToScoreProcessor
|
||||||
{
|
{
|
||||||
public override string Name => "Blinds";
|
public override string Name => "Blinds";
|
||||||
public override string Description => "Play with blinds on your screen.";
|
public override string Description => "Play with blinds on your screen.";
|
||||||
@ -32,9 +32,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
public override double ScoreMultiplier => 1.12;
|
public override double ScoreMultiplier => 1.12;
|
||||||
private DrawableOsuBlinds blinds;
|
private DrawableOsuBlinds blinds;
|
||||||
|
|
||||||
public void ApplyToRulesetContainer(RulesetContainer<OsuHitObject> rulesetContainer)
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
rulesetContainer.Overlays.Add(blinds = new DrawableOsuBlinds(rulesetContainer.Playfield.HitObjectContainer, rulesetContainer.Beatmap));
|
drawableRuleset.Overlays.Add(blinds = new DrawableOsuBlinds(drawableRuleset.Playfield.HitObjectContainer, drawableRuleset.Beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||||
|
@ -13,7 +13,7 @@ using static osu.Game.Input.Handlers.ReplayInputHandler;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Mods
|
namespace osu.Game.Rulesets.Osu.Mods
|
||||||
{
|
{
|
||||||
public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToRulesetContainer<OsuHitObject>
|
public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>
|
||||||
{
|
{
|
||||||
public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
|
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();
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray();
|
||||||
@ -79,10 +79,10 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
state.Apply(osuInputManager.CurrentState, osuInputManager);
|
state.Apply(osuInputManager.CurrentState, osuInputManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ApplyToRulesetContainer(RulesetContainer<OsuHitObject> rulesetContainer)
|
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
// grab the input manager for future use.
|
// grab the input manager for future use.
|
||||||
osuInputManager = (OsuInputManager)rulesetContainer.KeyBindingInputManager;
|
osuInputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager;
|
||||||
osuInputManager.AllowUserPresses = false;
|
osuInputManager.AllowUserPresses = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
{
|
{
|
||||||
public class OsuRuleset : Ruleset
|
public class OsuRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new OsuRulesetContainer(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableOsuRuleset(this, beatmap);
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap);
|
||||||
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap);
|
public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap);
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
|||||||
{
|
{
|
||||||
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject>
|
internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject>
|
||||||
{
|
{
|
||||||
public OsuScoreProcessor(RulesetContainer<OsuHitObject> rulesetContainer)
|
public OsuScoreProcessor(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||||
: base(rulesetContainer)
|
: base(drawableRuleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,11 +17,11 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.UI
|
namespace osu.Game.Rulesets.Osu.UI
|
||||||
{
|
{
|
||||||
public class OsuRulesetContainer : RulesetContainer<OsuPlayfield, OsuHitObject>
|
public class DrawableOsuRuleset : DrawableRuleset<OsuHitObject>
|
||||||
{
|
{
|
||||||
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
|
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
|
||||||
|
|
||||||
public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableOsuRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
protected override Playfield CreatePlayfield() => new OsuPlayfield();
|
||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
protected override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
public override DrawableHitObject<OsuHitObject> GetVisualRepresentation(OsuHitObject h)
|
public override DrawableHitObject<OsuHitObject> GetVisualRepresentation(OsuHitObject h)
|
||||||
{
|
{
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
protected override double TimePerAction => default_duration * 2;
|
protected override double TimePerAction => default_duration * 2;
|
||||||
|
|
||||||
private readonly Random rng = new Random(1337);
|
private readonly Random rng = new Random(1337);
|
||||||
private TaikoRulesetContainer rulesetContainer;
|
private DrawableTaikoRuleset drawableRuleset;
|
||||||
private Container playfieldContainer;
|
private Container playfieldContainer;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 768,
|
Height = 768,
|
||||||
Children = new[] { rulesetContainer = new TaikoRulesetContainer(new TaikoRuleset(), beatmap) }
|
Children = new[] { drawableRuleset = new DrawableTaikoRuleset(new TaikoRuleset(), beatmap) }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||||
|
|
||||||
((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addStrongHitJudgement(bool kiai)
|
private void addStrongHitJudgement(bool kiai)
|
||||||
@ -154,33 +154,33 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) };
|
||||||
|
|
||||||
((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult });
|
||||||
((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMissJudgement()
|
private void addMissJudgement()
|
||||||
{
|
{
|
||||||
((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss });
|
((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addBarLine(bool major, double delay = scroll_time)
|
private void addBarLine(bool major, double delay = scroll_time)
|
||||||
{
|
{
|
||||||
BarLine bl = new BarLine { StartTime = rulesetContainer.Playfield.Time.Current + delay };
|
BarLine bl = new BarLine { StartTime = drawableRuleset.Playfield.Time.Current + delay };
|
||||||
|
|
||||||
rulesetContainer.Playfield.Add(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl));
|
drawableRuleset.Playfield.Add(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSwell(double duration = default_duration)
|
private void addSwell(double duration = default_duration)
|
||||||
{
|
{
|
||||||
var swell = new Swell
|
var swell = new Swell
|
||||||
{
|
{
|
||||||
StartTime = rulesetContainer.Playfield.Time.Current + scroll_time,
|
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
|
||||||
Duration = duration,
|
Duration = duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
rulesetContainer.Playfield.Add(new DrawableSwell(swell));
|
drawableRuleset.Playfield.Add(new DrawableSwell(swell));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDrumRoll(bool strong, double duration = default_duration)
|
private void addDrumRoll(bool strong, double duration = default_duration)
|
||||||
@ -190,40 +190,40 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
|
|
||||||
var d = new DrumRoll
|
var d = new DrumRoll
|
||||||
{
|
{
|
||||||
StartTime = rulesetContainer.Playfield.Time.Current + scroll_time,
|
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
|
||||||
IsStrong = strong,
|
IsStrong = strong,
|
||||||
Duration = duration,
|
Duration = duration,
|
||||||
};
|
};
|
||||||
|
|
||||||
d.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
d.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
rulesetContainer.Playfield.Add(new DrawableDrumRoll(d));
|
drawableRuleset.Playfield.Add(new DrawableDrumRoll(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addCentreHit(bool strong)
|
private void addCentreHit(bool strong)
|
||||||
{
|
{
|
||||||
Hit h = new Hit
|
Hit h = new Hit
|
||||||
{
|
{
|
||||||
StartTime = rulesetContainer.Playfield.Time.Current + scroll_time,
|
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
|
||||||
IsStrong = strong
|
IsStrong = strong
|
||||||
};
|
};
|
||||||
|
|
||||||
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
rulesetContainer.Playfield.Add(new DrawableCentreHit(h));
|
drawableRuleset.Playfield.Add(new DrawableCentreHit(h));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addRimHit(bool strong)
|
private void addRimHit(bool strong)
|
||||||
{
|
{
|
||||||
Hit h = new Hit
|
Hit h = new Hit
|
||||||
{
|
{
|
||||||
StartTime = rulesetContainer.Playfield.Time.Current + scroll_time,
|
StartTime = drawableRuleset.Playfield.Time.Current + scroll_time,
|
||||||
IsStrong = strong
|
IsStrong = strong
|
||||||
};
|
};
|
||||||
|
|
||||||
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||||
|
|
||||||
rulesetContainer.Playfield.Add(new DrawableRimHit(h));
|
drawableRuleset.Playfield.Add(new DrawableRimHit(h));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestStrongNestedHit : DrawableStrongNestedHit
|
private class TestStrongNestedHit : DrawableStrongNestedHit
|
||||||
|
@ -22,10 +22,10 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
|||||||
|
|
||||||
private TaikoPlayfield playfield;
|
private TaikoPlayfield playfield;
|
||||||
|
|
||||||
public override void ApplyToRulesetContainer(RulesetContainer<TaikoHitObject> rulesetContainer)
|
public override void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
playfield = (TaikoPlayfield)rulesetContainer.Playfield;
|
playfield = (TaikoPlayfield)drawableRuleset.Playfield;
|
||||||
base.ApplyToRulesetContainer(rulesetContainer);
|
base.ApplyToDrawableRuleset(drawableRuleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TaikoFlashlight : Flashlight
|
private class TaikoFlashlight : Flashlight
|
||||||
|
@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private double hpMissMultiplier;
|
private double hpMissMultiplier;
|
||||||
|
|
||||||
public TaikoScoreProcessor(RulesetContainer<TaikoHitObject> rulesetContainer)
|
public TaikoScoreProcessor(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
||||||
: base(rulesetContainer)
|
: base(drawableRuleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
{
|
{
|
||||||
public class TaikoRuleset : Ruleset
|
public class TaikoRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new TaikoRulesetContainer(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableTaikoRuleset(this, beatmap);
|
||||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap);
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap);
|
||||||
|
|
||||||
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
|
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
|
||||||
|
@ -20,13 +20,13 @@ using osu.Game.Rulesets.UI.Scrolling;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
{
|
{
|
||||||
public class TaikoRulesetContainer : ScrollingRulesetContainer<TaikoPlayfield, TaikoHitObject>
|
public class DrawableTaikoRuleset : DrawableScrollingRuleset<TaikoHitObject>
|
||||||
{
|
{
|
||||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableTaikoRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
Direction.Value = ScrollingDirection.Left;
|
Direction.Value = ScrollingDirection.Left;
|
||||||
@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);
|
public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this);
|
||||||
|
|
||||||
public override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo);
|
protected override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo);
|
||||||
|
|
||||||
protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo);
|
protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo);
|
||||||
|
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
public class TaikoPlayfield : ScrollingPlayfield
|
public class TaikoPlayfield : ScrollingPlayfield
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="TaikoRulesetContainer"/>.
|
/// Default height of a <see cref="TaikoPlayfield"/> when inside a <see cref="DrawableTaikoRuleset"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const float DEFAULT_HEIGHT = 178;
|
public const float DEFAULT_HEIGHT = 178;
|
||||||
|
|
||||||
|
@ -242,6 +242,61 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestImportWithDuplicateBeatmapIDs()
|
||||||
|
{
|
||||||
|
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost("TestImportWithDuplicateBeatmapID"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = loadOsu(host);
|
||||||
|
|
||||||
|
var metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Artist = "SomeArtist",
|
||||||
|
AuthorString = "SomeAuthor"
|
||||||
|
};
|
||||||
|
|
||||||
|
var difficulty = new BeatmapDifficulty();
|
||||||
|
|
||||||
|
var toImport = new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapSetID = 1,
|
||||||
|
Metadata = metadata,
|
||||||
|
Beatmaps = new List<BeatmapInfo>
|
||||||
|
{
|
||||||
|
new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapID = 2,
|
||||||
|
Metadata = metadata,
|
||||||
|
BaseDifficulty = difficulty
|
||||||
|
},
|
||||||
|
new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapID = 2,
|
||||||
|
Metadata = metadata,
|
||||||
|
Status = BeatmapSetOnlineStatus.Loved,
|
||||||
|
BaseDifficulty = difficulty
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||||
|
|
||||||
|
var imported = manager.Import(toImport);
|
||||||
|
|
||||||
|
Assert.NotNull(imported);
|
||||||
|
Assert.AreEqual(null, imported.Beatmaps[0].OnlineBeatmapID);
|
||||||
|
Assert.AreEqual(null, imported.Beatmaps[1].OnlineBeatmapID);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[NonParallelizable]
|
[NonParallelizable]
|
||||||
[Ignore("Binding IPC on Appveyor isn't working (port in use). Need to figure out why")]
|
[Ignore("Binding IPC on Appveyor isn't working (port in use). Need to figure out why")]
|
||||||
|
@ -348,7 +348,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Thread.Sleep(1);
|
Thread.Sleep(1);
|
||||||
StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
StoryboardEnabled = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
ReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
|
ReplacesBackground.BindTo(Background.StoryboardReplacesBackground);
|
||||||
RulesetContainer.IsPaused.BindTo(IsPaused);
|
DrawableRuleset.IsPaused.BindTo(IsPaused);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,11 +105,14 @@ namespace osu.Game.Beatmaps
|
|||||||
validateOnlineIds(beatmapSet);
|
validateOnlineIds(beatmapSet);
|
||||||
|
|
||||||
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
foreach (BeatmapInfo b in beatmapSet.Beatmaps)
|
||||||
fetchAndPopulateOnlineValues(b, beatmapSet.Beatmaps);
|
fetchAndPopulateOnlineValues(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PreImport(BeatmapSetInfo beatmapSet)
|
protected override void PreImport(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
|
if (beatmapSet.Beatmaps.Any(b => b.BaseDifficulty == null))
|
||||||
|
throw new InvalidOperationException($"Cannot import {nameof(BeatmapInfo)} with null {nameof(BeatmapInfo.BaseDifficulty)}.");
|
||||||
|
|
||||||
// check if a set already exists with the same online id, delete if it does.
|
// check if a set already exists with the same online id, delete if it does.
|
||||||
if (beatmapSet.OnlineBeatmapSetID != null)
|
if (beatmapSet.OnlineBeatmapSetID != null)
|
||||||
{
|
{
|
||||||
@ -382,7 +385,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="otherBeatmaps">The other beatmaps contained within this set.</param>
|
/// <param name="otherBeatmaps">The other beatmaps contained within this set.</param>
|
||||||
/// <param name="force">Whether to re-query if the provided beatmap already has populated values.</param>
|
/// <param name="force">Whether to re-query if the provided beatmap already has populated values.</param>
|
||||||
/// <returns>True if population was successful.</returns>
|
/// <returns>True if population was successful.</returns>
|
||||||
private bool fetchAndPopulateOnlineValues(BeatmapInfo beatmap, IEnumerable<BeatmapInfo> otherBeatmaps, bool force = false)
|
private bool fetchAndPopulateOnlineValues(BeatmapInfo beatmap, bool force = false)
|
||||||
{
|
{
|
||||||
if (api?.State != APIState.Online)
|
if (api?.State != APIState.Online)
|
||||||
return false;
|
return false;
|
||||||
@ -405,13 +408,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
beatmap.Status = res.Status;
|
beatmap.Status = res.Status;
|
||||||
beatmap.BeatmapSet.Status = res.BeatmapSet.Status;
|
beatmap.BeatmapSet.Status = res.BeatmapSet.Status;
|
||||||
|
|
||||||
if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID))
|
|
||||||
{
|
|
||||||
Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID;
|
beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID;
|
||||||
beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
|
beatmap.OnlineBeatmapID = res.OnlineBeatmapID;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };
|
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };
|
||||||
|
|
||||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap)
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -11,14 +11,14 @@ using osu.Game.Rulesets.UI;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
public abstract class EditRulesetContainer : CompositeDrawable
|
public abstract class DrawableEditRuleset : CompositeDrawable
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="Playfield"/> contained by this <see cref="EditRulesetContainer"/>.
|
/// The <see cref="Playfield"/> contained by this <see cref="DrawableEditRuleset"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract Playfield Playfield { get; }
|
public abstract Playfield Playfield { get; }
|
||||||
|
|
||||||
internal EditRulesetContainer()
|
internal DrawableEditRuleset()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
@ -38,21 +38,21 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
internal abstract DrawableHitObject Remove(HitObject hitObject);
|
internal abstract DrawableHitObject Remove(HitObject hitObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class EditRulesetContainer<TObject> : EditRulesetContainer
|
public class DrawableEditRuleset<TObject> : DrawableEditRuleset
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
public override Playfield Playfield => rulesetContainer.Playfield;
|
public override Playfield Playfield => drawableRuleset.Playfield;
|
||||||
|
|
||||||
private Ruleset ruleset => rulesetContainer.Ruleset;
|
private Ruleset ruleset => drawableRuleset.Ruleset;
|
||||||
private Beatmap<TObject> beatmap => rulesetContainer.Beatmap;
|
private Beatmap<TObject> beatmap => drawableRuleset.Beatmap;
|
||||||
|
|
||||||
private readonly RulesetContainer<TObject> rulesetContainer;
|
private readonly DrawableRuleset<TObject> drawableRuleset;
|
||||||
|
|
||||||
public EditRulesetContainer(RulesetContainer<TObject> rulesetContainer)
|
public DrawableEditRuleset(DrawableRuleset<TObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
this.rulesetContainer = rulesetContainer;
|
this.drawableRuleset = drawableRuleset;
|
||||||
|
|
||||||
InternalChild = rulesetContainer;
|
InternalChild = drawableRuleset;
|
||||||
|
|
||||||
Playfield.DisplayJudgements.Value = false;
|
Playfield.DisplayJudgements.Value = false;
|
||||||
}
|
}
|
||||||
@ -73,10 +73,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
processor?.PostProcess();
|
processor?.PostProcess();
|
||||||
|
|
||||||
// Add visual representation
|
// Add visual representation
|
||||||
var drawableObject = rulesetContainer.GetVisualRepresentation(tObject);
|
var drawableObject = drawableRuleset.GetVisualRepresentation(tObject);
|
||||||
|
|
||||||
rulesetContainer.Playfield.Add(drawableObject);
|
drawableRuleset.Playfield.Add(drawableObject);
|
||||||
rulesetContainer.Playfield.PostProcess();
|
drawableRuleset.Playfield.PostProcess();
|
||||||
|
|
||||||
return drawableObject;
|
return drawableObject;
|
||||||
}
|
}
|
||||||
@ -97,8 +97,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
// Remove visual representation
|
// Remove visual representation
|
||||||
var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject);
|
var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject);
|
||||||
|
|
||||||
rulesetContainer.Playfield.Remove(drawableObject);
|
drawableRuleset.Playfield.Remove(drawableObject);
|
||||||
rulesetContainer.Playfield.PostProcess();
|
drawableRuleset.Playfield.PostProcess();
|
||||||
|
|
||||||
return drawableObject;
|
return drawableObject;
|
||||||
}
|
}
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
public abstract class HitObjectComposer : CompositeDrawable
|
public abstract class HitObjectComposer : CompositeDrawable
|
||||||
{
|
{
|
||||||
public IEnumerable<DrawableHitObject> HitObjects => RulesetContainer.Playfield.AllHitObjects;
|
public IEnumerable<DrawableHitObject> HitObjects => DrawableRuleset.Playfield.AllHitObjects;
|
||||||
|
|
||||||
protected readonly Ruleset Ruleset;
|
protected readonly Ruleset Ruleset;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
|
|
||||||
protected EditRulesetContainer RulesetContainer { get; private set; }
|
protected DrawableEditRuleset DrawableRuleset { get; private set; }
|
||||||
|
|
||||||
private BlueprintContainer blueprintContainer;
|
private BlueprintContainer blueprintContainer;
|
||||||
|
|
||||||
@ -54,8 +54,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RulesetContainer = CreateRulesetContainer();
|
DrawableRuleset = CreateDrawableRuleset();
|
||||||
RulesetContainer.Clock = framedClock;
|
DrawableRuleset.Clock = framedClock;
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
layerBelowRuleset,
|
layerBelowRuleset,
|
||||||
RulesetContainer,
|
DrawableRuleset,
|
||||||
layerAboveRuleset
|
layerAboveRuleset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,27 +140,27 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
|
|
||||||
layerContainers.ForEach(l =>
|
layerContainers.ForEach(l =>
|
||||||
{
|
{
|
||||||
l.Anchor = RulesetContainer.Playfield.Anchor;
|
l.Anchor = DrawableRuleset.Playfield.Anchor;
|
||||||
l.Origin = RulesetContainer.Playfield.Origin;
|
l.Origin = DrawableRuleset.Playfield.Origin;
|
||||||
l.Position = RulesetContainer.Playfield.Position;
|
l.Position = DrawableRuleset.Playfield.Position;
|
||||||
l.Size = RulesetContainer.Playfield.Size;
|
l.Size = DrawableRuleset.Playfield.Size;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the user's cursor is currently in an area of the <see cref="HitObjectComposer"/> that is valid for placement.
|
/// Whether the user's cursor is currently in an area of the <see cref="HitObjectComposer"/> that is valid for placement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool CursorInPlacementArea => RulesetContainer.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
|
public virtual bool CursorInPlacementArea => DrawableRuleset.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
|
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(RulesetContainer.Add(hitObject));
|
public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(DrawableRuleset.Add(hitObject));
|
||||||
|
|
||||||
public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(RulesetContainer.Remove(hitObject));
|
public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(DrawableRuleset.Remove(hitObject));
|
||||||
|
|
||||||
internal abstract EditRulesetContainer CreateRulesetContainer();
|
internal abstract DrawableEditRuleset CreateDrawableRuleset();
|
||||||
|
|
||||||
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
@ -189,9 +189,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override EditRulesetContainer CreateRulesetContainer()
|
internal override DrawableEditRuleset CreateDrawableRuleset()
|
||||||
=> new EditRulesetContainer<TObject>(CreateRulesetContainer(Ruleset, Beatmap.Value));
|
=> new DrawableEditRuleset<TObject>(CreateDrawableRuleset(Ruleset, Beatmap.Value));
|
||||||
|
|
||||||
protected abstract RulesetContainer<TObject> CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap);
|
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@ using osu.Game.Rulesets.UI;
|
|||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// An interface for <see cref="Mod"/>s that can be applied to <see cref="RulesetContainer"/>s.
|
/// An interface for <see cref="Mod"/>s that can be applied to <see cref="DrawableRuleset"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IApplicableToRulesetContainer<TObject> : IApplicableMod
|
public interface IApplicableToDrawableRuleset<TObject> : IApplicableMod
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies this <see cref="IApplicableToRulesetContainer{TObject}"/> to a <see cref="RulesetContainer{TObject}"/>.
|
/// Applies this <see cref="IApplicableToDrawableRuleset{TObject}"/> to a <see cref="DrawableRuleset{TObject}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="rulesetContainer">The <see cref="RulesetContainer{TObject}"/> to apply to.</param>
|
/// <param name="drawableRuleset">The <see cref="DrawableRuleset{TObject}"/> to apply to.</param>
|
||||||
void ApplyToRulesetContainer(RulesetContainer<TObject> rulesetContainer);
|
void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,10 +11,10 @@ using osu.Game.Scoring;
|
|||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableToRulesetContainer<T>
|
public abstract class ModAutoplay<T> : ModAutoplay, IApplicableToDrawableRuleset<T>
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer) => rulesetContainer.SetReplayScore(CreateReplayScore(rulesetContainer.Beatmap));
|
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset) => drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap));
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ModAutoplay : Mod, IApplicableFailOverride
|
public abstract class ModAutoplay : Mod, IApplicableFailOverride
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class ModFlashlight<T> : ModFlashlight, IApplicableToRulesetContainer<T>, IApplicableToScoreProcessor
|
public abstract class ModFlashlight<T> : ModFlashlight, IApplicableToDrawableRuleset<T>, IApplicableToScoreProcessor
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
public const double FLASHLIGHT_FADE_DURATION = 800;
|
public const double FLASHLIGHT_FADE_DURATION = 800;
|
||||||
@ -45,15 +45,15 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
Combo.BindTo(scoreProcessor.Combo);
|
Combo.BindTo(scoreProcessor.Combo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ApplyToRulesetContainer(RulesetContainer<T> rulesetContainer)
|
public virtual void ApplyToDrawableRuleset(DrawableRuleset<T> drawableRuleset)
|
||||||
{
|
{
|
||||||
var flashlight = CreateFlashlight();
|
var flashlight = CreateFlashlight();
|
||||||
flashlight.Combo = Combo;
|
flashlight.Combo = Combo;
|
||||||
flashlight.RelativeSizeAxes = Axes.Both;
|
flashlight.RelativeSizeAxes = Axes.Both;
|
||||||
flashlight.Colour = Color4.Black;
|
flashlight.Colour = Color4.Black;
|
||||||
rulesetContainer.KeyBindingInputManager.Add(flashlight);
|
drawableRuleset.KeyBindingInputManager.Add(flashlight);
|
||||||
|
|
||||||
flashlight.Breaks = rulesetContainer.Beatmap.Breaks;
|
flashlight.Breaks = drawableRuleset.Beatmap.Breaks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Flashlight CreateFlashlight();
|
public abstract Flashlight CreateFlashlight();
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
||||||
/// <exception cref="BeatmapInvalidForRulesetException">Unable to successfully load the beatmap to be usable with this ruleset.</exception>
|
/// <exception cref="BeatmapInvalidForRulesetException">Unable to successfully load the beatmap to be usable with this ruleset.</exception>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap);
|
public abstract DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="IBeatmapConverter"/> to convert a <see cref="IBeatmap"/> to one that is applicable for this <see cref="Ruleset"/>.
|
/// Creates a <see cref="IBeatmapConverter"/> to convert a <see cref="IBeatmap"/> to one that is applicable for this <see cref="Ruleset"/>.
|
||||||
|
@ -210,15 +210,15 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScoreProcessor(RulesetContainer<TObject> rulesetContainer)
|
public ScoreProcessor(DrawableRuleset<TObject> drawableRuleset)
|
||||||
{
|
{
|
||||||
Debug.Assert(base_portion + combo_portion == 1.0);
|
Debug.Assert(base_portion + combo_portion == 1.0);
|
||||||
|
|
||||||
rulesetContainer.OnNewResult += applyResult;
|
drawableRuleset.OnNewResult += applyResult;
|
||||||
rulesetContainer.OnRevertResult += revertResult;
|
drawableRuleset.OnRevertResult += revertResult;
|
||||||
|
|
||||||
ApplyBeatmap(rulesetContainer.Beatmap);
|
ApplyBeatmap(drawableRuleset.Beatmap);
|
||||||
SimulateAutoplay(rulesetContainer.Beatmap);
|
SimulateAutoplay(drawableRuleset.Beatmap);
|
||||||
Reset(true);
|
Reset(true);
|
||||||
|
|
||||||
if (maxBaseScore == 0 || maxHighestCombo == 0)
|
if (maxBaseScore == 0 || maxHighestCombo == 0)
|
||||||
|
@ -25,16 +25,16 @@ using osu.Game.Replays;
|
|||||||
using osu.Game.Rulesets.Configuration;
|
using osu.Game.Rulesets.Configuration;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Rulesets.UI
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base RulesetContainer. Doesn't hold objects.
|
/// Displays an interactive ruleset gameplay instance.
|
||||||
/// <para>
|
|
||||||
/// Should not be derived - derive <see cref="RulesetContainer{TObject}"/> instead.
|
|
||||||
/// </para>
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class RulesetContainer : Container, IProvideCursor
|
/// <typeparam name="TObject">The type of HitObject contained by this DrawableRuleset.</typeparam>
|
||||||
|
public abstract class DrawableRuleset<TObject> : DrawableRuleset, IProvideCursor, ICanAttachKeyCounter
|
||||||
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The selected variant.
|
/// The selected variant.
|
||||||
@ -42,27 +42,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public virtual int Variant => 0;
|
public virtual int Variant => 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The input manager for this RulesetContainer.
|
/// The key conversion input manager for this DrawableRuleset.
|
||||||
/// </summary>
|
|
||||||
internal IHasReplayHandler ReplayInputManager => KeyBindingInputManager as IHasReplayHandler;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The key conversion input manager for this RulesetContainer.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PassThroughInputManager KeyBindingInputManager;
|
public PassThroughInputManager KeyBindingInputManager;
|
||||||
|
|
||||||
/// <summary>
|
public override double GameplayStartTime => Objects.First().StartTime - 2000;
|
||||||
/// Whether a replay is currently loaded.
|
|
||||||
/// </summary>
|
|
||||||
public readonly BindableBool HasReplayLoaded = new BindableBool();
|
|
||||||
|
|
||||||
public abstract IEnumerable<HitObject> Objects { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The point in time at which gameplay starts, including any required lead-in for display purposes.
|
|
||||||
/// Defaults to two seconds before the first <see cref="HitObject"/>. Override as necessary.
|
|
||||||
/// </summary>
|
|
||||||
public virtual double GameplayStartTime => Objects.First().StartTime - 2000;
|
|
||||||
|
|
||||||
private readonly Lazy<Playfield> playfield;
|
private readonly Lazy<Playfield> playfield;
|
||||||
|
|
||||||
@ -74,27 +58,54 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Place to put drawables above hit objects but below UI.
|
/// Place to put drawables above hit objects but below UI.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Container Overlays { get; protected set; }
|
public Container Overlays { get; private set; }
|
||||||
|
|
||||||
public CursorContainer Cursor => Playfield.Cursor;
|
/// <summary>
|
||||||
|
/// Invoked when a <see cref="JudgementResult"/> has been applied by a <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<JudgementResult> OnNewResult;
|
||||||
|
|
||||||
public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value;
|
/// <summary>
|
||||||
|
/// Invoked when a <see cref="JudgementResult"/> is being reverted by a <see cref="DrawableHitObject"/>.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<JudgementResult> OnRevertResult;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
|
/// <summary>
|
||||||
|
/// The beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public Beatmap<TObject> Beatmap;
|
||||||
|
|
||||||
public readonly Ruleset Ruleset;
|
public override IEnumerable<HitObject> Objects => Beatmap.HitObjects;
|
||||||
|
|
||||||
protected IRulesetConfigManager Config { get; private set; }
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The mods which are to be applied.
|
||||||
|
/// </summary>
|
||||||
|
private readonly IEnumerable<Mod> mods;
|
||||||
|
|
||||||
|
private FrameStabilityContainer frameStabilityContainer;
|
||||||
|
|
||||||
private OnScreenDisplay onScreenDisplay;
|
private OnScreenDisplay onScreenDisplay;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A visual representation of a <see cref="Rulesets.Ruleset"/>.
|
/// Creates a ruleset visualisation for the provided ruleset and beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
/// <param name="ruleset">The ruleset being represented.</param>
|
||||||
protected RulesetContainer(Ruleset ruleset)
|
/// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param>
|
||||||
|
protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap)
|
||||||
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
Ruleset = ruleset;
|
Debug.Assert(workingBeatmap != null, "DrawableRuleset initialized with a null beatmap.");
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
||||||
|
|
||||||
|
mods = workingBeatmap.Mods.Value;
|
||||||
|
applyBeatmapMods(mods);
|
||||||
|
|
||||||
|
KeyBindingInputManager = CreateInputManager();
|
||||||
playfield = new Lazy<Playfield>(CreatePlayfield);
|
playfield = new Lazy<Playfield>(CreatePlayfield);
|
||||||
|
|
||||||
IsPaused.ValueChanged += paused =>
|
IsPaused.ValueChanged += paused =>
|
||||||
@ -122,171 +133,103 @@ namespace osu.Game.Rulesets.UI
|
|||||||
return dependencies;
|
return dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract ScoreProcessor CreateScoreProcessor();
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
KeyBindingInputManager.AddRange(new Drawable[]
|
||||||
|
{
|
||||||
|
Playfield
|
||||||
|
});
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
frameStabilityContainer = new FrameStabilityContainer
|
||||||
|
{
|
||||||
|
Child = KeyBindingInputManager,
|
||||||
|
},
|
||||||
|
Overlays = new Container { RelativeSizeAxes = Axes.Both }
|
||||||
|
};
|
||||||
|
|
||||||
|
applyRulesetMods(mods, config);
|
||||||
|
|
||||||
|
loadObjects();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates and adds drawable representations of hit objects to the play field.
|
||||||
|
/// </summary>
|
||||||
|
private void loadObjects()
|
||||||
|
{
|
||||||
|
foreach (TObject h in Beatmap.HitObjects)
|
||||||
|
addRepresentation(h);
|
||||||
|
|
||||||
|
Playfield.PostProcess();
|
||||||
|
|
||||||
|
foreach (var mod in mods.OfType<IApplicableToDrawableHitObjects>())
|
||||||
|
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void RequestResume(Action continueResume) => continueResume();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates and adds the visual representation of a <see cref="TObject"/> to this <see cref="DrawableRuleset{TObject}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="TObject"/> to add the visual representation for.</param>
|
||||||
|
private void addRepresentation(TObject hitObject)
|
||||||
|
{
|
||||||
|
var drawableObject = GetVisualRepresentation(hitObject);
|
||||||
|
|
||||||
|
if (drawableObject == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r);
|
||||||
|
drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r);
|
||||||
|
|
||||||
|
Playfield.Add(drawableObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void SetReplayScore(Score replayScore)
|
||||||
|
{
|
||||||
|
if (!(KeyBindingInputManager is IHasReplayHandler replayInputManager))
|
||||||
|
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available");
|
||||||
|
|
||||||
|
var handler = (ReplayScore = replayScore) != null ? CreateReplayInputHandler(replayScore.Replay) : null;
|
||||||
|
|
||||||
|
replayInputManager.ReplayInputHandler = handler;
|
||||||
|
frameStabilityContainer.ReplayInputHandler = handler;
|
||||||
|
|
||||||
|
HasReplayLoaded.Value = replayInputManager.ReplayInputHandler != null;
|
||||||
|
|
||||||
|
if (replayInputManager.ReplayInputHandler != null)
|
||||||
|
replayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a DrawableHitObject from a HitObject.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="h">The HitObject to make drawable.</param>
|
||||||
|
/// <returns>The DrawableHitObject.</returns>
|
||||||
|
public abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
||||||
|
|
||||||
|
public void Attach(KeyCounterCollection keyCounter) =>
|
||||||
|
(KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a key conversion input manager. An exception will be thrown if a valid <see cref="RulesetInputManager{T}"/> is not returned.
|
/// Creates a key conversion input manager. An exception will be thrown if a valid <see cref="RulesetInputManager{T}"/> is not returned.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The input manager.</returns>
|
/// <returns>The input manager.</returns>
|
||||||
public abstract PassThroughInputManager CreateInputManager();
|
protected abstract PassThroughInputManager CreateInputManager();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when the interactive user requests resuming from a paused state.
|
|
||||||
/// Allows potentially delaying the resume process until an interaction is performed.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="continueResume">The action to run when resuming is to be completed.</param>
|
|
||||||
public void RequestResume(Action continueResume) => continueResume();
|
|
||||||
|
|
||||||
protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null;
|
protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null;
|
||||||
|
|
||||||
protected FrameStabilityContainer FrameStabilityContainer;
|
|
||||||
|
|
||||||
public Score ReplayScore { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the game is paused. Used to block user input.
|
|
||||||
/// </summary>
|
|
||||||
public readonly BindableBool IsPaused = new BindableBool();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets a replay to be used, overriding local input.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="replayScore">The replay, null for local input.</param>
|
|
||||||
public virtual void SetReplayScore(Score replayScore)
|
|
||||||
{
|
|
||||||
if (ReplayInputManager == null)
|
|
||||||
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available");
|
|
||||||
|
|
||||||
ReplayScore = replayScore;
|
|
||||||
|
|
||||||
var handler = replayScore != null ? CreateReplayInputHandler(replayScore.Replay) : null;
|
|
||||||
|
|
||||||
ReplayInputManager.ReplayInputHandler = handler;
|
|
||||||
FrameStabilityContainer.ReplayInputHandler = handler;
|
|
||||||
|
|
||||||
HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates the cursor. May be null if the <see cref="RulesetContainer"/> doesn't provide a custom cursor.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual CursorContainer CreateCursor() => null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a Playfield.
|
/// Creates a Playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The Playfield.</returns>
|
/// <returns>The Playfield.</returns>
|
||||||
protected abstract Playfield CreatePlayfield();
|
protected abstract Playfield CreatePlayfield();
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (Config != null)
|
|
||||||
{
|
|
||||||
onScreenDisplay?.StopTracking(this, Config);
|
|
||||||
Config = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield
|
|
||||||
/// and does not load drawable hit objects.
|
|
||||||
/// <para>
|
|
||||||
/// Should not be derived - derive <see cref="RulesetContainer{TPlayfield, TObject}"/> instead.
|
|
||||||
/// </para>
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
|
|
||||||
public abstract class RulesetContainer<TObject> : RulesetContainer
|
|
||||||
where TObject : HitObject
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="JudgementResult"/> has been applied by a <see cref="DrawableHitObject"/>.
|
|
||||||
/// </summary>
|
|
||||||
public event Action<JudgementResult> OnNewResult;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Invoked when a <see cref="JudgementResult"/> is being reverted by a <see cref="DrawableHitObject"/>.
|
|
||||||
/// </summary>
|
|
||||||
public event Action<JudgementResult> OnRevertResult;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The Beatmap
|
|
||||||
/// </summary>
|
|
||||||
public Beatmap<TObject> Beatmap;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// All the converted hit objects contained by this hit renderer.
|
|
||||||
/// </summary>
|
|
||||||
public override IEnumerable<HitObject> Objects => Beatmap.HitObjects;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The mods which are to be applied.
|
|
||||||
/// </summary>
|
|
||||||
protected IEnumerable<Mod> Mods;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="WorkingBeatmap"/> this <see cref="RulesetContainer{TObject}"/> was created with.
|
|
||||||
/// </summary>
|
|
||||||
protected readonly WorkingBeatmap WorkingBeatmap;
|
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor<TObject>(this);
|
public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor<TObject>(this);
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
|
||||||
private Container content;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether to assume the beatmap passed into this <see cref="RulesetContainer{TObject}"/> is for the current ruleset.
|
|
||||||
/// Creates a hit renderer for a beatmap.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
|
||||||
/// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param>
|
|
||||||
protected RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap)
|
|
||||||
: base(ruleset)
|
|
||||||
{
|
|
||||||
Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap.");
|
|
||||||
|
|
||||||
WorkingBeatmap = workingBeatmap;
|
|
||||||
// ReSharper disable once PossibleNullReferenceException
|
|
||||||
Mods = workingBeatmap.Mods.Value;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
|
||||||
|
|
||||||
KeyBindingInputManager = CreateInputManager();
|
|
||||||
|
|
||||||
applyBeatmapMods(Mods);
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuConfigManager config)
|
|
||||||
{
|
|
||||||
KeyBindingInputManager.AddRange(new Drawable[]
|
|
||||||
{
|
|
||||||
content = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
Playfield
|
|
||||||
});
|
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
|
||||||
{
|
|
||||||
FrameStabilityContainer = new FrameStabilityContainer
|
|
||||||
{
|
|
||||||
Child = KeyBindingInputManager,
|
|
||||||
},
|
|
||||||
Overlays = new Container { RelativeSizeAxes = Axes.Both }
|
|
||||||
};
|
|
||||||
|
|
||||||
// Apply mods
|
|
||||||
applyRulesetMods(Mods, config);
|
|
||||||
|
|
||||||
loadObjects();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies the active mods to the Beatmap.
|
/// Applies the active mods to the Beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -301,7 +244,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Applies the active mods to this RulesetContainer.
|
/// Applies the active mods to this DrawableRuleset.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mods"></param>
|
/// <param name="mods"></param>
|
||||||
private void applyRulesetMods(IEnumerable<Mod> mods, OsuConfigManager config)
|
private void applyRulesetMods(IEnumerable<Mod> mods, OsuConfigManager config)
|
||||||
@ -309,83 +252,108 @@ namespace osu.Game.Rulesets.UI
|
|||||||
if (mods == null)
|
if (mods == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IApplicableToRulesetContainer<TObject>>())
|
foreach (var mod in mods.OfType<IApplicableToDrawableRuleset<TObject>>())
|
||||||
mod.ApplyToRulesetContainer(this);
|
mod.ApplyToDrawableRuleset(this);
|
||||||
|
|
||||||
foreach (var mod in mods.OfType<IReadFromConfig>())
|
foreach (var mod in mods.OfType<IReadFromConfig>())
|
||||||
mod.ReadFromConfig(config);
|
mod.ReadFromConfig(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void SetReplayScore(Score replayScore)
|
#region IProvideCursor
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor
|
||||||
|
|
||||||
|
public override CursorContainer Cursor => Playfield.Cursor;
|
||||||
|
|
||||||
|
public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.SetReplayScore(replayScore);
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
if (ReplayInputManager?.ReplayInputHandler != null)
|
if (Config != null)
|
||||||
ReplayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace;
|
{
|
||||||
|
onScreenDisplay?.StopTracking(this, Config);
|
||||||
|
Config = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates and adds drawable representations of hit objects to the play field.
|
|
||||||
/// </summary>
|
|
||||||
private void loadObjects()
|
|
||||||
{
|
|
||||||
foreach (TObject h in Beatmap.HitObjects)
|
|
||||||
AddRepresentation(h);
|
|
||||||
|
|
||||||
Playfield.PostProcess();
|
|
||||||
|
|
||||||
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
|
||||||
mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates and adds the visual representation of a <see cref="TObject"/> to this <see cref="RulesetContainer{TObject}"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The <see cref="TObject"/> to add the visual representation for.</param>
|
|
||||||
internal void AddRepresentation(TObject hitObject)
|
|
||||||
{
|
|
||||||
var drawableObject = GetVisualRepresentation(hitObject);
|
|
||||||
|
|
||||||
if (drawableObject == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r);
|
|
||||||
drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r);
|
|
||||||
|
|
||||||
Playfield.Add(drawableObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Creates a DrawableHitObject from a HitObject.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="h">The HitObject to make drawable.</param>
|
|
||||||
/// <returns>The DrawableHitObject.</returns>
|
|
||||||
public abstract DrawableHitObject<TObject> GetVisualRepresentation(TObject h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A derivable RulesetContainer that manages the Playfield and HitObjects.
|
/// Displays an interactive ruleset gameplay instance.
|
||||||
|
/// <remarks>
|
||||||
|
/// This type is required only for adding non-generic type to the draw hierarchy.
|
||||||
|
/// Once IDrawable is a thing, this can also become an interface.
|
||||||
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <typeparam name="TPlayfield">The type of Playfield contained by this RulesetContainer.</typeparam>
|
public abstract class DrawableRuleset : CompositeDrawable
|
||||||
/// <typeparam name="TObject">The type of HitObject contained by this RulesetContainer.</typeparam>
|
|
||||||
public abstract class RulesetContainer<TPlayfield, TObject> : RulesetContainer<TObject>
|
|
||||||
where TObject : HitObject
|
|
||||||
where TPlayfield : Playfield
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The playfield.
|
/// Whether a replay is currently loaded.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected new TPlayfield Playfield => (TPlayfield)base.Playfield;
|
public readonly BindableBool HasReplayLoaded = new BindableBool();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a hit renderer for a beatmap.
|
/// Whether the game is paused. Used to block user input.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ruleset">The ruleset being repesented.</param>
|
public readonly BindableBool IsPaused = new BindableBool();
|
||||||
/// <param name="beatmap">The beatmap to create the hit renderer for.</param>
|
|
||||||
protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
/// <summary>~
|
||||||
: base(ruleset, beatmap)
|
/// The associated ruleset.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Ruleset Ruleset;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a ruleset visualisation for the provided ruleset.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ruleset">The ruleset.</param>
|
||||||
|
internal DrawableRuleset(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
|
Ruleset = ruleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All the converted hit objects contained by this hit renderer.
|
||||||
|
/// </summary>
|
||||||
|
public abstract IEnumerable<HitObject> Objects { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The point in time at which gameplay starts, including any required lead-in for display purposes.
|
||||||
|
/// Defaults to two seconds before the first <see cref="HitObject"/>. Override as necessary.
|
||||||
|
/// </summary>
|
||||||
|
public abstract double GameplayStartTime { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The currently loaded replay. Usually null in the case of a local player.
|
||||||
|
/// </summary>
|
||||||
|
public Score ReplayScore { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The cursor being displayed by the <see cref="Playfield"/>. May be null if no cursor is provided.
|
||||||
|
/// </summary>
|
||||||
|
public abstract CursorContainer Cursor { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets a replay to be used, overriding local input.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="replayScore">The replay, null for local input.</param>
|
||||||
|
public abstract void SetReplayScore(Score replayScore);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when the interactive user requests resuming from a paused state.
|
||||||
|
/// Allows potentially delaying the resume process until an interaction is performed.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="continueResume">The action to run when resuming is to be completed.</param>
|
||||||
|
public abstract void RequestResume(Action continueResume);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a <see cref="ScoreProcessor"/> for the associated ruleset and link with this
|
||||||
|
/// <see cref="DrawableRuleset"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>A score processor.</returns>
|
||||||
|
public abstract ScoreProcessor CreateScoreProcessor();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BeatmapInvalidForRulesetException : ArgumentException
|
public class BeatmapInvalidForRulesetException : ArgumentException
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -20,12 +21,11 @@ using osu.Game.Rulesets.UI.Scrolling.Algorithms;
|
|||||||
namespace osu.Game.Rulesets.UI.Scrolling
|
namespace osu.Game.Rulesets.UI.Scrolling
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A type of <see cref="RulesetContainer{TPlayfield,TObject}"/> that supports a <see cref="ScrollingPlayfield"/>.
|
/// A type of <see cref="DrawableRuleset{TObject}"/> that supports a <see cref="ScrollingPlayfield"/>.
|
||||||
/// <see cref="HitObject"/>s inside this <see cref="RulesetContainer{TPlayfield,TObject}"/> will scroll within the playfield.
|
/// <see cref="HitObject"/>s inside this <see cref="DrawableRuleset{TObject}"/> will scroll within the playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ScrollingRulesetContainer<TPlayfield, TObject> : RulesetContainer<TPlayfield, TObject>, IKeyBindingHandler<GlobalAction>
|
public abstract class DrawableScrollingRuleset<TObject> : DrawableRuleset<TObject>, IKeyBindingHandler<GlobalAction>
|
||||||
where TObject : HitObject
|
where TObject : HitObject
|
||||||
where TPlayfield : ScrollingPlayfield
|
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The default span of time visible by the length of the scrolling axes.
|
/// The default span of time visible by the length of the scrolling axes.
|
||||||
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
|
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
|
||||||
/// inside this <see cref="RulesetContainer{TPlayfield,TObject}"/>.
|
/// inside this <see cref="DrawableRuleset{TObject}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private readonly SortedList<MultiplierControlPoint> controlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
private readonly SortedList<MultiplierControlPoint> controlPoints = new SortedList<MultiplierControlPoint>(Comparer<MultiplierControlPoint>.Default);
|
||||||
@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
[Cached(Type = typeof(IScrollingInfo))]
|
[Cached(Type = typeof(IScrollingInfo))]
|
||||||
private readonly LocalScrollingInfo scrollingInfo;
|
private readonly LocalScrollingInfo scrollingInfo;
|
||||||
|
|
||||||
protected ScrollingRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap)
|
protected DrawableScrollingRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap)
|
||||||
{
|
{
|
||||||
scrollingInfo = new LocalScrollingInfo();
|
scrollingInfo = new LocalScrollingInfo();
|
||||||
@ -167,6 +167,14 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (!(Playfield is ScrollingPlayfield))
|
||||||
|
throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset<TObject>)}.");
|
||||||
|
}
|
||||||
|
|
||||||
public bool OnReleased(GlobalAction action) => false;
|
public bool OnReleased(GlobalAction action) => false;
|
||||||
|
|
||||||
private class LocalScrollingInfo : IScrollingInfo
|
private class LocalScrollingInfo : IScrollingInfo
|
@ -11,6 +11,7 @@ namespace osu.Game.Screens
|
|||||||
public class BackgroundScreenStack : ScreenStack
|
public class BackgroundScreenStack : ScreenStack
|
||||||
{
|
{
|
||||||
public BackgroundScreenStack()
|
public BackgroundScreenStack()
|
||||||
|
: base(false)
|
||||||
{
|
{
|
||||||
Scale = new Vector2(1.06f);
|
Scale = new Vector2(1.06f);
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// 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.Threading;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -26,7 +27,24 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both };
|
protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
public virtual WorkingBeatmap Beatmap
|
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
||||||
|
{
|
||||||
|
Beatmap = beatmap;
|
||||||
|
InternalChild = fadeContainer = CreateFadeContainer();
|
||||||
|
fadeContainer.EnableUserDim.BindTo(EnableUserDim);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
var background = new BeatmapBackground(beatmap);
|
||||||
|
LoadComponent(background);
|
||||||
|
switchBackground(background);
|
||||||
|
}
|
||||||
|
|
||||||
|
private CancellationTokenSource cancellationSource;
|
||||||
|
|
||||||
|
public WorkingBeatmap Beatmap
|
||||||
{
|
{
|
||||||
get => beatmap;
|
get => beatmap;
|
||||||
set
|
set
|
||||||
@ -38,54 +56,52 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() =>
|
if ((Background as BeatmapBackground)?.Beatmap == beatmap)
|
||||||
{
|
return;
|
||||||
float newDepth = 0;
|
|
||||||
if (Background != null)
|
|
||||||
{
|
|
||||||
newDepth = Background.Depth + 1;
|
|
||||||
Background.FinishTransforms();
|
|
||||||
Background.FadeOut(250);
|
|
||||||
Background.Expire();
|
|
||||||
}
|
|
||||||
|
|
||||||
b.Depth = newDepth;
|
cancellationSource?.Cancel();
|
||||||
fadeContainer.Add(Background = b);
|
LoadComponentAsync(new BeatmapBackground(beatmap), switchBackground, (cancellationSource = new CancellationTokenSource()).Token);
|
||||||
Background.BlurSigma = BlurTarget;
|
|
||||||
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
|
|
||||||
}));
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
private void switchBackground(BeatmapBackground b)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
float newDepth = 0;
|
||||||
InternalChild = fadeContainer = CreateFadeContainer();
|
if (Background != null)
|
||||||
fadeContainer.EnableUserDim.BindTo(EnableUserDim);
|
{
|
||||||
|
newDepth = Background.Depth + 1;
|
||||||
|
Background.FinishTransforms();
|
||||||
|
Background.FadeOut(250);
|
||||||
|
Background.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
b.Depth = newDepth;
|
||||||
|
fadeContainer.Add(Background = b);
|
||||||
|
Background.BlurSigma = BlurTarget;
|
||||||
|
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Equals(BackgroundScreen other)
|
public override bool Equals(BackgroundScreen other)
|
||||||
{
|
{
|
||||||
var otherBeatmapBackground = other as BackgroundScreenBeatmap;
|
if (!(other is BackgroundScreenBeatmap otherBeatmapBackground)) return false;
|
||||||
if (otherBeatmapBackground == null) return false;
|
|
||||||
|
|
||||||
return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap;
|
return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class BeatmapBackground : Background
|
protected class BeatmapBackground : Background
|
||||||
{
|
{
|
||||||
private readonly WorkingBeatmap beatmap;
|
public readonly WorkingBeatmap Beatmap;
|
||||||
|
|
||||||
public BeatmapBackground(WorkingBeatmap beatmap)
|
public BeatmapBackground(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(TextureStore textures)
|
private void load(TextureStore textures)
|
||||||
{
|
{
|
||||||
Sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg1");
|
Sprite.Texture = Beatmap?.Background ?? textures.Get(@"Backgrounds/bg1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
currentDisplay = RNG.Next(0, background_count);
|
currentDisplay = RNG.Next(0, background_count);
|
||||||
|
|
||||||
Next();
|
display(createBackground());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void display(Background newBackground)
|
private void display(Background newBackground)
|
||||||
@ -51,19 +51,21 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
public void Next()
|
public void Next()
|
||||||
{
|
{
|
||||||
nextTask?.Cancel();
|
nextTask?.Cancel();
|
||||||
nextTask = Scheduler.AddDelayed(() =>
|
nextTask = Scheduler.AddDelayed(() => { LoadComponentAsync(createBackground(), display); }, 100);
|
||||||
{
|
}
|
||||||
Background background;
|
|
||||||
|
|
||||||
if (user.Value?.IsSupporter ?? false)
|
private Background createBackground()
|
||||||
background = new SkinnedBackground(skin.Value, backgroundName);
|
{
|
||||||
else
|
Background background;
|
||||||
background = new Background(backgroundName);
|
|
||||||
|
|
||||||
background.Depth = currentDisplay;
|
if (user.Value?.IsSupporter ?? false)
|
||||||
|
background = new SkinnedBackground(skin.Value, backgroundName);
|
||||||
|
else
|
||||||
|
background = new Background(backgroundName);
|
||||||
|
|
||||||
LoadComponentAsync(background, display);
|
background.Depth = currentDisplay;
|
||||||
}, 100);
|
|
||||||
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SkinnedBackground : Background
|
private class SkinnedBackground : Background
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
protected Vector2 BlurTarget;
|
protected Vector2 BlurTarget;
|
||||||
|
|
||||||
public TransformSequence<Background> BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None)
|
public TransformSequence<Background> BlurTo(Vector2 sigma, double duration = 0, Easing easing = Easing.None)
|
||||||
{
|
{
|
||||||
BlurTarget = sigma;
|
BlurTarget = sigma;
|
||||||
return Background?.BlurTo(BlurTarget, duration, easing);
|
return Background?.BlurTo(BlurTarget, duration, easing);
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
|
||||||
// TODO: should probably be done at a RulesetContainer level to share logic with Player.
|
// TODO: should probably be done at a DrawableRuleset level to share logic with Player.
|
||||||
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||||
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false };
|
||||||
clock.ChangeSource(sourceClock);
|
clock.ChangeSource(sourceClock);
|
||||||
|
@ -40,7 +40,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private GameHost host { get; set; }
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
private BackgroundScreenDefault background;
|
||||||
|
|
||||||
|
protected override BackgroundScreen CreateBackground() => background;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuGame game = null)
|
private void load(OsuGame game = null)
|
||||||
@ -89,6 +91,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
buttons.OnDirect = game.ToggleDirect;
|
buttons.OnDirect = game.ToggleDirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadComponentAsync(background = new BackgroundScreenDefault());
|
||||||
preloadSongSelect();
|
preloadSongSelect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private const float height = 30;
|
private const float height = 30;
|
||||||
private const float transition_duration = 100;
|
private const float transition_duration = 100;
|
||||||
|
|
||||||
private Container rulesetContainer;
|
private Container drawableRuleset;
|
||||||
|
|
||||||
public ModeTypeInfo()
|
public ModeTypeInfo()
|
||||||
{
|
{
|
||||||
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
LayoutDuration = 100,
|
LayoutDuration = 100,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
rulesetContainer = new Container
|
drawableRuleset = new Container
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
@ -55,11 +55,11 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
{
|
{
|
||||||
if (item?.Beatmap != null)
|
if (item?.Beatmap != null)
|
||||||
{
|
{
|
||||||
rulesetContainer.FadeIn(transition_duration);
|
drawableRuleset.FadeIn(transition_duration);
|
||||||
rulesetContainer.Child = new DifficultyIcon(item.Beatmap, item.Ruleset) { Size = new Vector2(height) };
|
drawableRuleset.Child = new DifficultyIcon(item.Beatmap, item.Ruleset) { Size = new Vector2(height) };
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rulesetContainer.FadeOut(transition_duration);
|
drawableRuleset.FadeOut(transition_duration);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public Action<double> RequestSeek;
|
public Action<double> RequestSeek;
|
||||||
|
|
||||||
public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, WorkingBeatmap working)
|
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, WorkingBeatmap working)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -90,10 +90,10 @@ namespace osu.Game.Screens.Play
|
|||||||
};
|
};
|
||||||
|
|
||||||
BindProcessor(scoreProcessor);
|
BindProcessor(scoreProcessor);
|
||||||
BindRulesetContainer(rulesetContainer);
|
BindDrawableRuleset(drawableRuleset);
|
||||||
|
|
||||||
Progress.Objects = rulesetContainer.Objects;
|
Progress.Objects = drawableRuleset.Objects;
|
||||||
Progress.AllowSeeking = rulesetContainer.HasReplayLoaded.Value;
|
Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value;
|
||||||
Progress.RequestSeek = time => RequestSeek(time);
|
Progress.RequestSeek = time => RequestSeek(time);
|
||||||
|
|
||||||
ModDisplay.Current.BindTo(working.Mods);
|
ModDisplay.Current.BindTo(working.Mods);
|
||||||
@ -143,13 +143,13 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer)
|
protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset)
|
||||||
{
|
{
|
||||||
(rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter);
|
(drawableRuleset as ICanAttachKeyCounter)?.Attach(KeyCounter);
|
||||||
|
|
||||||
replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
|
replayLoaded.BindTo(drawableRuleset.HasReplayLoaded);
|
||||||
|
|
||||||
Progress.BindRulestContainer(rulesetContainer);
|
Progress.BindDrawableRuleset(drawableRuleset);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(KeyDownEvent e)
|
protected override bool OnKeyDown(KeyDownEvent e)
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private SampleChannel sampleRestart;
|
private SampleChannel sampleRestart;
|
||||||
|
|
||||||
protected ScoreProcessor ScoreProcessor { get; private set; }
|
protected ScoreProcessor ScoreProcessor { get; private set; }
|
||||||
protected RulesetContainer RulesetContainer { get; private set; }
|
protected DrawableRuleset DrawableRuleset { get; private set; }
|
||||||
|
|
||||||
protected HUDOverlay HUDOverlay { get; private set; }
|
protected HUDOverlay HUDOverlay { get; private set; }
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ namespace osu.Game.Screens.Play
|
|||||||
EnableUserDim = { Value = true }
|
EnableUserDim = { Value = true }
|
||||||
};
|
};
|
||||||
|
|
||||||
public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true;
|
public bool LoadedBeatmapSuccessfully => DrawableRuleset?.Objects.Any() == true;
|
||||||
|
|
||||||
protected GameplayClockContainer GameplayClockContainer { get; private set; }
|
protected GameplayClockContainer GameplayClockContainer { get; private set; }
|
||||||
|
|
||||||
@ -118,11 +118,11 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||||
|
|
||||||
ScoreProcessor = RulesetContainer.CreateScoreProcessor();
|
ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
|
||||||
if (!ScoreProcessor.Mode.Disabled)
|
if (!ScoreProcessor.Mode.Disabled)
|
||||||
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
||||||
|
|
||||||
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, RulesetContainer.GameplayStartTime);
|
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, DrawableRuleset.GameplayStartTime);
|
||||||
|
|
||||||
GameplayClockContainer.Children = new[]
|
GameplayClockContainer.Children = new[]
|
||||||
{
|
{
|
||||||
@ -132,7 +132,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Child = new LocalSkinOverrideContainer(working.Skin)
|
Child = new LocalSkinOverrideContainer(working.Skin)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = RulesetContainer
|
Child = DrawableRuleset
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
|
new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor)
|
||||||
@ -142,17 +142,17 @@ namespace osu.Game.Screens.Play
|
|||||||
Breaks = working.Beatmap.Breaks
|
Breaks = working.Beatmap.Breaks
|
||||||
},
|
},
|
||||||
// display the cursor above some HUD elements.
|
// display the cursor above some HUD elements.
|
||||||
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
|
||||||
HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working)
|
HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, working)
|
||||||
{
|
{
|
||||||
HoldToQuit = { Action = performUserRequestedExit },
|
HoldToQuit = { Action = performUserRequestedExit },
|
||||||
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
|
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
|
||||||
KeyCounter = { Visible = { BindTarget = RulesetContainer.HasReplayLoaded } },
|
KeyCounter = { Visible = { BindTarget = DrawableRuleset.HasReplayLoaded } },
|
||||||
RequestSeek = GameplayClockContainer.Seek,
|
RequestSeek = GameplayClockContainer.Seek,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
},
|
},
|
||||||
new SkipOverlay(RulesetContainer.GameplayStartTime)
|
new SkipOverlay(DrawableRuleset.GameplayStartTime)
|
||||||
{
|
{
|
||||||
RequestSeek = GameplayClockContainer.Seek
|
RequestSeek = GameplayClockContainer.Seek
|
||||||
},
|
},
|
||||||
@ -181,7 +181,7 @@ namespace osu.Game.Screens.Play
|
|||||||
};
|
};
|
||||||
|
|
||||||
// bind clock into components that require it
|
// bind clock into components that require it
|
||||||
RulesetContainer.IsPaused.BindTo(GameplayClockContainer.IsPaused);
|
DrawableRuleset.IsPaused.BindTo(GameplayClockContainer.IsPaused);
|
||||||
|
|
||||||
// load storyboard as part of player's load if we can
|
// load storyboard as part of player's load if we can
|
||||||
initializeStoryboard(false);
|
initializeStoryboard(false);
|
||||||
@ -212,18 +212,18 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working);
|
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(working);
|
||||||
}
|
}
|
||||||
catch (BeatmapInvalidForRulesetException)
|
catch (BeatmapInvalidForRulesetException)
|
||||||
{
|
{
|
||||||
// we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset
|
// we may fail to create a DrawableRuleset if the beatmap cannot be loaded with the user's preferred ruleset
|
||||||
// let's try again forcing the beatmap's ruleset.
|
// let's try again forcing the beatmap's ruleset.
|
||||||
ruleset = beatmap.BeatmapInfo.Ruleset;
|
ruleset = beatmap.BeatmapInfo.Ruleset;
|
||||||
rulesetInstance = ruleset.CreateInstance();
|
rulesetInstance = ruleset.CreateInstance();
|
||||||
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap.Value);
|
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RulesetContainer.Objects.Any())
|
if (!DrawableRuleset.Objects.Any())
|
||||||
{
|
{
|
||||||
Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error);
|
Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error);
|
||||||
return null;
|
return null;
|
||||||
@ -275,7 +275,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
var score = CreateScore();
|
var score = CreateScore();
|
||||||
if (RulesetContainer.ReplayScore == null)
|
if (DrawableRuleset.ReplayScore == null)
|
||||||
scoreManager.Import(score);
|
scoreManager.Import(score);
|
||||||
|
|
||||||
this.Push(CreateResults(score));
|
this.Push(CreateResults(score));
|
||||||
@ -287,7 +287,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected virtual ScoreInfo CreateScore()
|
protected virtual ScoreInfo CreateScore()
|
||||||
{
|
{
|
||||||
var score = RulesetContainer.ReplayScore?.ScoreInfo ?? new ScoreInfo
|
var score = DrawableRuleset.ReplayScore?.ScoreInfo ?? new ScoreInfo
|
||||||
{
|
{
|
||||||
Beatmap = Beatmap.Value.BeatmapInfo,
|
Beatmap = Beatmap.Value.BeatmapInfo,
|
||||||
Ruleset = ruleset,
|
Ruleset = ruleset,
|
||||||
@ -347,7 +347,7 @@ namespace osu.Game.Screens.Play
|
|||||||
// must pass basic screen conditions (beatmap loaded, instance allows pause)
|
// must pass basic screen conditions (beatmap loaded, instance allows pause)
|
||||||
LoadedBeatmapSuccessfully && AllowPause && ValidForResume
|
LoadedBeatmapSuccessfully && AllowPause && ValidForResume
|
||||||
// replays cannot be paused and exit immediately
|
// replays cannot be paused and exit immediately
|
||||||
&& !RulesetContainer.HasReplayLoaded.Value
|
&& !DrawableRuleset.HasReplayLoaded.Value
|
||||||
// cannot pause if we are already in a fail state
|
// cannot pause if we are already in a fail state
|
||||||
&& !HasFailed
|
&& !HasFailed
|
||||||
// cannot pause if already paused (and not in the process of resuming)
|
// cannot pause if already paused (and not in the process of resuming)
|
||||||
@ -395,7 +395,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (GameplayClockContainer.GameplayClock.CurrentTime < Beatmap.Value.Beatmap.HitObjects.First().StartTime)
|
if (GameplayClockContainer.GameplayClock.CurrentTime < Beatmap.Value.Beatmap.HitObjects.First().StartTime)
|
||||||
completeResume();
|
completeResume();
|
||||||
else
|
else
|
||||||
RulesetContainer.RequestResume(completeResume);
|
DrawableRuleset.RequestResume(completeResume);
|
||||||
|
|
||||||
void completeResume()
|
void completeResume()
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play
|
|||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
RulesetContainer?.SetReplayScore(score);
|
DrawableRuleset?.SetReplayScore(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ScoreInfo CreateScore() => score.ScoreInfo;
|
protected override ScoreInfo CreateScore() => score.ScoreInfo;
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Called when background elements require updates, usually due to a user changing a setting.
|
/// Called when background elements require updates, usually due to a user changing a setting.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userChange"></param>
|
/// <param name="userChange"></param>
|
||||||
protected virtual void UpdateBackgroundElements()
|
protected void UpdateBackgroundElements()
|
||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
|
@ -109,9 +109,9 @@ namespace osu.Game.Screens.Play
|
|||||||
replayLoaded.TriggerChange();
|
replayLoaded.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BindRulestContainer(RulesetContainer rulesetContainer)
|
public void BindDrawableRuleset(DrawableRuleset drawableRuleset)
|
||||||
{
|
{
|
||||||
replayLoaded.BindTo(rulesetContainer.HasReplayLoaded);
|
replayLoaded.BindTo(drawableRuleset.HasReplayLoaded);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool allowSeeking;
|
private bool allowSeeking;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// 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.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -61,7 +61,12 @@ namespace osu.Game.Screens.Select
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected readonly Container FooterPanels;
|
protected readonly Container FooterPanels;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap();
|
protected override BackgroundScreen CreateBackground()
|
||||||
|
{
|
||||||
|
var background = new BackgroundScreenBeatmap();
|
||||||
|
background.BlurTo(background_blur);
|
||||||
|
return background;
|
||||||
|
}
|
||||||
|
|
||||||
protected readonly BeatmapCarousel Carousel;
|
protected readonly BeatmapCarousel Carousel;
|
||||||
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
||||||
|
Reference in New Issue
Block a user