mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 19:52:55 +08:00
Merge branch 'master' into user-status-wiring
This commit is contained in:
commit
5887008fb3
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
|
|
||||||
protected override Player CreatePlayer(Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray();
|
||||||
return base.CreatePlayer(ruleset);
|
return base.CreatePlayer(ruleset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
{
|
{
|
||||||
public class CatchRuleset : Ruleset
|
public class CatchRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableCatchRuleset(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableCatchRuleset(this, beatmap, mods);
|
||||||
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);
|
||||||
|
|
||||||
|
@ -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.Collections.Generic;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
@ -10,6 +11,7 @@ using osu.Game.Rulesets.Catch.Objects;
|
|||||||
using osu.Game.Rulesets.Catch.Objects.Drawable;
|
using osu.Game.Rulesets.Catch.Objects.Drawable;
|
||||||
using osu.Game.Rulesets.Catch.Replays;
|
using osu.Game.Rulesets.Catch.Replays;
|
||||||
using osu.Game.Rulesets.Catch.Scoring;
|
using osu.Game.Rulesets.Catch.Scoring;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -23,8 +25,8 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
public DrawableCatchRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableCatchRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
Direction.Value = ScrollingDirection.Down;
|
Direction.Value = ScrollingDirection.Down;
|
||||||
TimeRange.Value = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450);
|
TimeRange.Value = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450);
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -8,6 +10,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Rulesets.Mania.Edit;
|
using osu.Game.Rulesets.Mania.Edit;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -21,6 +24,9 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
{
|
{
|
||||||
private readonly Column column;
|
private readonly Column column;
|
||||||
|
|
||||||
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
|
private IReadOnlyList<Mod> mods { get; set; } = Array.Empty<Mod>();
|
||||||
|
|
||||||
protected ManiaPlacementBlueprintTestCase()
|
protected ManiaPlacementBlueprintTestCase()
|
||||||
{
|
{
|
||||||
Add(column = new Column(0)
|
Add(column = new Column(0)
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Rulesets.Mania.Objects;
|
|||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
using osu.Game.Rulesets.Mania.UI.Components;
|
using osu.Game.Rulesets.Mania.UI.Components;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -31,6 +32,9 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
typeof(ColumnHitObjectArea)
|
typeof(ColumnHitObjectArea)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
|
private IReadOnlyList<Mod> mods { get; set; } = Array.Empty<Mod>();
|
||||||
|
|
||||||
private readonly List<Column> columns = new List<Column>();
|
private readonly List<Column> columns = new List<Column>();
|
||||||
|
|
||||||
public TestCaseColumn()
|
public TestCaseColumn()
|
||||||
|
@ -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 NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -13,6 +14,7 @@ using osu.Game.Rulesets.Mania.Beatmaps;
|
|||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -24,6 +26,9 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
{
|
{
|
||||||
private const int columns = 4;
|
private const int columns = 4;
|
||||||
|
|
||||||
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
|
private IReadOnlyList<Mod> mods { get; set; } = Array.Empty<Mod>();
|
||||||
|
|
||||||
private readonly List<ManiaStage> stages = new List<ManiaStage>();
|
private readonly List<ManiaStage> stages = new List<ManiaStage>();
|
||||||
|
|
||||||
private FillFlowContainer<ScrollingTestContainer> fill;
|
private FillFlowContainer<ScrollingTestContainer> fill;
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
|
||||||
@ -14,8 +16,8 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
{
|
{
|
||||||
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
||||||
|
|
||||||
public DrawableManiaEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableManiaEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using System.Collections.Generic;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
using osu.Game.Rulesets.Mania.Edit.Blueprints;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -41,9 +42,9 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
|
|
||||||
public int TotalColumns => ((ManiaPlayfield)DrawableRuleset.Playfield).TotalColumns;
|
public int TotalColumns => ((ManiaPlayfield)DrawableRuleset.Playfield).TotalColumns;
|
||||||
|
|
||||||
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
DrawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap);
|
DrawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap, mods);
|
||||||
|
|
||||||
// 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(DrawableRuleset.ScrollingInfo);
|
dependencies.CacheAs(DrawableRuleset.ScrollingInfo);
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
{
|
{
|
||||||
public class ManiaRuleset : Ruleset
|
public class ManiaRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableManiaRuleset(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableManiaRuleset(this, beatmap, mods);
|
||||||
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);
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ using osu.Game.Rulesets.Mania.Objects;
|
|||||||
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
using osu.Game.Rulesets.Mania.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Mania.Replays;
|
using osu.Game.Rulesets.Mania.Replays;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
@ -39,8 +40,8 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
||||||
|
|
||||||
public DrawableManiaRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableManiaRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
// Generate the bar lines
|
// Generate the bar lines
|
||||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// 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.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Tests.Beatmaps;
|
using osu.Game.Tests.Beatmaps;
|
||||||
using Decoder = osu.Game.Beatmaps.Formats.Decoder;
|
using Decoder = osu.Game.Beatmaps.Formats.Decoder;
|
||||||
@ -22,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
using (var reader = new StreamReader(stream))
|
using (var reader = new StreamReader(stream))
|
||||||
{
|
{
|
||||||
var beatmap = Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
|
var beatmap = Decoder.GetDecoder<Beatmap>(reader).Decode(reader);
|
||||||
var converted = new TestWorkingBeatmap(beatmap).GetPlayableBeatmap(new OsuRuleset().RulesetInfo);
|
var converted = new TestWorkingBeatmap(beatmap).GetPlayableBeatmap(new OsuRuleset().RulesetInfo, Array.Empty<Mod>());
|
||||||
|
|
||||||
var objects = converted.HitObjects.ToList();
|
var objects = converted.HitObjects.ToList();
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private int depthIndex;
|
private int depthIndex;
|
||||||
protected readonly List<Mod> Mods = new List<Mod>();
|
|
||||||
|
|
||||||
public TestCaseHitCircle()
|
public TestCaseHitCircle()
|
||||||
{
|
{
|
||||||
@ -68,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Depth = depthIndex++
|
Depth = depthIndex++
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
||||||
|
|
||||||
Add(drawable);
|
Add(drawable);
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
public TestCaseHitCircleHidden()
|
public TestCaseHitCircleHidden()
|
||||||
{
|
{
|
||||||
Mods.Add(new OsuModHidden());
|
Mods.Value = new[] { new OsuModHidden() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private int depthIndex;
|
private int depthIndex;
|
||||||
protected readonly List<Mod> Mods = new List<Mod>();
|
|
||||||
|
|
||||||
public TestCaseSlider()
|
public TestCaseSlider()
|
||||||
{
|
{
|
||||||
@ -292,7 +291,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Depth = depthIndex++
|
Depth = depthIndex++
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
||||||
|
|
||||||
drawable.OnNewResult += onNewResult;
|
drawable.OnNewResult += onNewResult;
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
public TestCaseSliderHidden()
|
public TestCaseSliderHidden()
|
||||||
{
|
{
|
||||||
Mods.Add(new OsuModHidden());
|
Mods.Value = new[] { new OsuModHidden() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private int depthIndex;
|
private int depthIndex;
|
||||||
protected readonly List<Mod> Mods = new List<Mod>();
|
|
||||||
|
|
||||||
public TestCaseSpinner()
|
public TestCaseSpinner()
|
||||||
{
|
{
|
||||||
@ -57,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
Depth = depthIndex++
|
Depth = depthIndex++
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var mod in Mods.OfType<IApplicableToDrawableHitObjects>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToDrawableHitObjects>())
|
||||||
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
mod.ApplyToDrawableHitObjects(new[] { drawable });
|
||||||
|
|
||||||
Add(drawable);
|
Add(drawable);
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
public TestCaseSpinnerHidden()
|
public TestCaseSpinnerHidden()
|
||||||
{
|
{
|
||||||
Mods.Add(new OsuModHidden());
|
Mods.Value = new[] { new OsuModHidden() };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.UI;
|
using osu.Game.Rulesets.Osu.UI;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -10,8 +12,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
public class DrawableOsuEditRuleset : DrawableOsuRuleset
|
public class DrawableOsuEditRuleset : DrawableOsuRuleset
|
||||||
{
|
{
|
||||||
public DrawableOsuEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableOsuEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders;
|
||||||
@ -23,8 +24,8 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
=> new DrawableOsuEditRuleset(ruleset, beatmap);
|
=> new DrawableOsuEditRuleset(ruleset, beatmap, mods);
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
{
|
{
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
{
|
{
|
||||||
public class OsuRuleset : Ruleset
|
public class OsuRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableOsuRuleset(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableOsuRuleset(this, beatmap, mods);
|
||||||
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);
|
||||||
|
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Osu.Configuration;
|
using osu.Game.Rulesets.Osu.Configuration;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
@ -22,8 +24,8 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
{
|
{
|
||||||
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
|
protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config;
|
||||||
|
|
||||||
public DrawableOsuRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableOsuRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Judgements;
|
using osu.Game.Rulesets.Taiko.Judgements;
|
||||||
@ -86,7 +87,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[] { drawableRuleset = new DrawableTaikoRuleset(new TaikoRuleset(), beatmap) }
|
Children = new[] { drawableRuleset = new DrawableTaikoRuleset(new TaikoRuleset(), beatmap, Array.Empty<Mod>()) }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
{
|
{
|
||||||
public class TaikoRuleset : Ruleset
|
public class TaikoRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableTaikoRuleset(this, beatmap);
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableTaikoRuleset(this, beatmap, mods);
|
||||||
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[]
|
||||||
|
@ -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.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -16,6 +17,7 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
@ -26,8 +28,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
public DrawableTaikoRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
public DrawableTaikoRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
Direction.Value = ScrollingDirection.Left;
|
Direction.Value = ScrollingDirection.Left;
|
||||||
TimeRange.Value = 7000;
|
TimeRange.Value = 7000;
|
||||||
|
@ -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.IO;
|
using System.IO;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -13,6 +14,7 @@ using osu.Game.Rulesets.Objects.Types;
|
|||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Catch.Beatmaps;
|
using osu.Game.Rulesets.Catch.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -39,7 +41,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
|
|
||||||
Assert.AreEqual(6, working.BeatmapInfo.BeatmapVersion);
|
Assert.AreEqual(6, working.BeatmapInfo.BeatmapVersion);
|
||||||
Assert.AreEqual(6, working.Beatmap.BeatmapInfo.BeatmapVersion);
|
Assert.AreEqual(6, working.Beatmap.BeatmapInfo.BeatmapVersion);
|
||||||
Assert.AreEqual(6, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapVersion);
|
Assert.AreEqual(6, working.GetPlayableBeatmap(new OsuRuleset().RulesetInfo, Array.Empty<Mod>()).BeatmapInfo.BeatmapVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
AddUntilStep("Song select has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
AddUntilStep("Song select has selection", () => songSelect.Carousel.SelectedBeatmap != null);
|
||||||
AddStep("Set default user settings", () =>
|
AddStep("Set default user settings", () =>
|
||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() });
|
Mods.Value = Mods.Value.Concat(new[] { new OsuModNoFail() }).ToArray();
|
||||||
songSelect.DimLevel.Value = 0.7f;
|
songSelect.DimLevel.Value = 0.7f;
|
||||||
songSelect.BlurLevel.Value = 0.4f;
|
songSelect.BlurLevel.Value = 0.4f;
|
||||||
});
|
});
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
protected override Player CreatePlayer(Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
Mods.Value = Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray();
|
||||||
return new ScoreAccessiblePlayer();
|
return new ScoreAccessiblePlayer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -15,7 +17,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
protected override Player CreatePlayer(Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo);
|
var beatmap = Beatmap.Value.GetPlayableBeatmap(ruleset.RulesetInfo, Array.Empty<Mod>());
|
||||||
|
|
||||||
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap));
|
return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap));
|
||||||
}
|
}
|
||||||
|
@ -4,11 +4,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
@ -23,6 +25,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Playfield) };
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Playfield) };
|
||||||
|
|
||||||
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
|
private IReadOnlyList<Mod> mods { get; set; } = Array.Empty<Mod>();
|
||||||
|
|
||||||
private readonly ScrollingTestContainer[] scrollContainers = new ScrollingTestContainer[4];
|
private readonly ScrollingTestContainer[] scrollContainers = new ScrollingTestContainer[4];
|
||||||
private readonly TestPlayfield[] playfields = new TestPlayfield[4];
|
private readonly TestPlayfield[] playfields = new TestPlayfield[4];
|
||||||
|
|
||||||
|
@ -35,10 +35,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
private WorkingBeatmap defaultBeatmap;
|
private WorkingBeatmap defaultBeatmap;
|
||||||
private DatabaseContextFactory factory;
|
private DatabaseContextFactory factory;
|
||||||
|
|
||||||
[Cached]
|
|
||||||
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
|
|
||||||
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(Screens.Select.SongSelect),
|
typeof(Screens.Select.SongSelect),
|
||||||
@ -175,19 +171,19 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddStep("change ruleset", () =>
|
AddStep("change ruleset", () =>
|
||||||
{
|
{
|
||||||
songSelect.CurrentBeatmap.Mods.ValueChanged += onModChange;
|
Mods.ValueChanged += onModChange;
|
||||||
songSelect.Ruleset.ValueChanged += onRulesetChange;
|
songSelect.Ruleset.ValueChanged += onRulesetChange;
|
||||||
|
|
||||||
Ruleset.Value = new TaikoRuleset().RulesetInfo;
|
Ruleset.Value = new TaikoRuleset().RulesetInfo;
|
||||||
|
|
||||||
songSelect.CurrentBeatmap.Mods.ValueChanged -= onModChange;
|
Mods.ValueChanged -= onModChange;
|
||||||
songSelect.Ruleset.ValueChanged -= onRulesetChange;
|
songSelect.Ruleset.ValueChanged -= onRulesetChange;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
|
AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex);
|
||||||
AddAssert("empty mods", () => !selectedMods.Value.Any());
|
AddAssert("empty mods", () => !Mods.Value.Any());
|
||||||
|
|
||||||
void onModChange(ValueChangedEvent<IEnumerable<Mod>> e) => modChangeIndex = actionIndex++;
|
void onModChange(ValueChangedEvent<IReadOnlyList<Mod>> e) => modChangeIndex = actionIndex++;
|
||||||
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--;
|
void onRulesetChange(ValueChangedEvent<RulesetInfo> e) => rulesetChangeIndex = actionIndex--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +214,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
private static int importId;
|
private static int importId;
|
||||||
private int getImportId() => ++importId;
|
private int getImportId() => ++importId;
|
||||||
|
|
||||||
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => selectedMods.Value = mods);
|
private void changeMods(params Mod[] mods) => AddStep($"change mods to {string.Join(", ", mods.Select(m => m.Acronym))}", () => Mods.Value = mods);
|
||||||
|
|
||||||
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id));
|
private void changeRuleset(int id) => AddStep($"change ruleset to {id}", () => Ruleset.Value = rulesets.AvailableRulesets.First(r => r.ID == id));
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private class TestModSelectOverlay : ModSelectOverlay
|
private class TestModSelectOverlay : ModSelectOverlay
|
||||||
{
|
{
|
||||||
public new Bindable<IEnumerable<Mod>> SelectedMods => base.SelectedMods;
|
public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods;
|
||||||
|
|
||||||
public ModButton GetModButton(Mod mod)
|
public ModButton GetModButton(Mod mod)
|
||||||
{
|
{
|
||||||
|
@ -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 DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap)
|
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,6 @@ using osu.Framework.IO.File;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.IO.Serialization;
|
using osu.Game.IO.Serialization;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -28,16 +27,12 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public readonly BeatmapMetadata Metadata;
|
public readonly BeatmapMetadata Metadata;
|
||||||
|
|
||||||
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
|
||||||
|
|
||||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo)
|
protected WorkingBeatmap(BeatmapInfo beatmapInfo)
|
||||||
{
|
{
|
||||||
BeatmapInfo = beatmapInfo;
|
BeatmapInfo = beatmapInfo;
|
||||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
Mods.ValueChanged += _ => applyRateAdjustments();
|
|
||||||
|
|
||||||
beatmap = new RecyclableLazy<IBeatmap>(() =>
|
beatmap = new RecyclableLazy<IBeatmap>(() =>
|
||||||
{
|
{
|
||||||
var b = GetBeatmap() ?? new Beatmap();
|
var b = GetBeatmap() ?? new Beatmap();
|
||||||
@ -51,14 +46,7 @@ namespace osu.Game.Beatmaps
|
|||||||
return b;
|
return b;
|
||||||
});
|
});
|
||||||
|
|
||||||
track = new RecyclableLazy<Track>(() =>
|
track = new RecyclableLazy<Track>(() => GetTrack() ?? new VirtualBeatmapTrack(Beatmap));
|
||||||
{
|
|
||||||
// we want to ensure that we always have a track, even if it's a fake one.
|
|
||||||
var t = GetTrack() ?? new VirtualBeatmapTrack(Beatmap);
|
|
||||||
applyRateAdjustments(t);
|
|
||||||
return t;
|
|
||||||
});
|
|
||||||
|
|
||||||
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
||||||
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
||||||
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
||||||
@ -87,7 +75,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="ruleset">The <see cref="RulesetInfo"/> to create a playable <see cref="IBeatmap"/> for.</param>
|
/// <param name="ruleset">The <see cref="RulesetInfo"/> to create a playable <see cref="IBeatmap"/> for.</param>
|
||||||
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
||||||
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
||||||
public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset)
|
public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
var rulesetInstance = ruleset.CreateInstance();
|
var rulesetInstance = ruleset.CreateInstance();
|
||||||
|
|
||||||
@ -98,19 +86,19 @@ namespace osu.Game.Beatmaps
|
|||||||
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmaps.Beatmap)} can not be converted for the ruleset (ruleset: {ruleset.InstantiationInfo}, converter: {converter}).");
|
throw new BeatmapInvalidForRulesetException($"{nameof(Beatmaps.Beatmap)} can not be converted for the ruleset (ruleset: {ruleset.InstantiationInfo}, converter: {converter}).");
|
||||||
|
|
||||||
// Apply conversion mods
|
// Apply conversion mods
|
||||||
foreach (var mod in Mods.Value.OfType<IApplicableToBeatmapConverter>())
|
foreach (var mod in mods.OfType<IApplicableToBeatmapConverter>())
|
||||||
mod.ApplyToBeatmapConverter(converter);
|
mod.ApplyToBeatmapConverter(converter);
|
||||||
|
|
||||||
// Convert
|
// Convert
|
||||||
IBeatmap converted = converter.Convert();
|
IBeatmap converted = converter.Convert();
|
||||||
|
|
||||||
// Apply difficulty mods
|
// Apply difficulty mods
|
||||||
if (Mods.Value.Any(m => m is IApplicableToDifficulty))
|
if (mods.Any(m => m is IApplicableToDifficulty))
|
||||||
{
|
{
|
||||||
converted.BeatmapInfo = converted.BeatmapInfo.Clone();
|
converted.BeatmapInfo = converted.BeatmapInfo.Clone();
|
||||||
converted.BeatmapInfo.BaseDifficulty = converted.BeatmapInfo.BaseDifficulty.Clone();
|
converted.BeatmapInfo.BaseDifficulty = converted.BeatmapInfo.BaseDifficulty.Clone();
|
||||||
|
|
||||||
foreach (var mod in Mods.Value.OfType<IApplicableToDifficulty>())
|
foreach (var mod in mods.OfType<IApplicableToDifficulty>())
|
||||||
mod.ApplyToDifficulty(converted.BeatmapInfo.BaseDifficulty);
|
mod.ApplyToDifficulty(converted.BeatmapInfo.BaseDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,7 +110,7 @@ namespace osu.Game.Beatmaps
|
|||||||
foreach (var obj in converted.HitObjects)
|
foreach (var obj in converted.HitObjects)
|
||||||
obj.ApplyDefaults(converted.ControlPointInfo, converted.BeatmapInfo.BaseDifficulty);
|
obj.ApplyDefaults(converted.ControlPointInfo, converted.BeatmapInfo.BaseDifficulty);
|
||||||
|
|
||||||
foreach (var mod in Mods.Value.OfType<IApplicableToHitObject>())
|
foreach (var mod in mods.OfType<IApplicableToHitObject>())
|
||||||
foreach (var obj in converted.HitObjects)
|
foreach (var obj in converted.HitObjects)
|
||||||
mod.ApplyToHitObject(obj);
|
mod.ApplyToHitObject(obj);
|
||||||
|
|
||||||
@ -188,16 +176,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void RecycleTrack() => track.Recycle();
|
public void RecycleTrack() => track.Recycle();
|
||||||
|
|
||||||
private void applyRateAdjustments(Track t = null)
|
|
||||||
{
|
|
||||||
if (t == null && track.IsResultAvailable) t = Track;
|
|
||||||
if (t == null) return;
|
|
||||||
|
|
||||||
t.ResetSpeedAdjustments();
|
|
||||||
foreach (var mod in Mods.Value.OfType<IApplicableToClock>())
|
|
||||||
mod.ApplyToClock(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class RecyclableLazy<T>
|
public class RecyclableLazy<T>
|
||||||
{
|
{
|
||||||
private Lazy<T> lazy;
|
private Lazy<T> lazy;
|
||||||
|
@ -112,8 +112,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
// todo: move this to SongSelect once Screen has the ability to unsuspend.
|
||||||
[Cached]
|
[Cached]
|
||||||
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
|
[Cached(typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||||
private readonly Bindable<IEnumerable<Mod>> selectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
public OsuGame(string[] args = null)
|
public OsuGame(string[] args = null)
|
||||||
{
|
{
|
||||||
@ -293,9 +293,8 @@ namespace osu.Game
|
|||||||
performFromMainMenu(() =>
|
performFromMainMenu(() =>
|
||||||
{
|
{
|
||||||
ruleset.Value = databasedScoreInfo.Ruleset;
|
ruleset.Value = databasedScoreInfo.Ruleset;
|
||||||
|
|
||||||
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap);
|
||||||
Beatmap.Value.Mods.Value = databasedScoreInfo.Mods;
|
mods.Value = databasedScoreInfo.Mods;
|
||||||
|
|
||||||
menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
|
menuScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore)));
|
||||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||||
|
@ -42,19 +42,19 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
|
protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
|
||||||
|
|
||||||
protected readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
protected readonly Bindable<IReadOnlyList<Mod>> SelectedMods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
protected readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
protected readonly IBindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IEnumerable<Mod>> selectedMods)
|
private void load(OsuColour colours, IBindable<RulesetInfo> ruleset, AudioManager audio, Bindable<IReadOnlyList<Mod>> mods)
|
||||||
{
|
{
|
||||||
LowMultiplierColour = colours.Red;
|
LowMultiplierColour = colours.Red;
|
||||||
HighMultiplierColour = colours.Green;
|
HighMultiplierColour = colours.Green;
|
||||||
UnrankedLabel.Colour = colours.Blue;
|
UnrankedLabel.Colour = colours.Blue;
|
||||||
|
|
||||||
Ruleset.BindTo(ruleset);
|
Ruleset.BindTo(ruleset);
|
||||||
if (selectedMods != null) SelectedMods.BindTo(selectedMods);
|
if (mods != null) SelectedMods.BindTo(mods);
|
||||||
|
|
||||||
sampleOn = audio.Sample.Get(@"UI/check-on");
|
sampleOn = audio.Sample.Get(@"UI/check-on");
|
||||||
sampleOff = audio.Sample.Get(@"UI/check-off");
|
sampleOff = audio.Sample.Get(@"UI/check-off");
|
||||||
@ -87,14 +87,14 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
// attempt to re-select any already selected mods.
|
// attempt to re-select any already selected mods.
|
||||||
// this may be the first time we are receiving the ruleset, in which case they will still match.
|
// this may be the first time we are receiving the ruleset, in which case they will still match.
|
||||||
selectedModsChanged(new ValueChangedEvent<IEnumerable<Mod>>(SelectedMods.Value, SelectedMods.Value));
|
selectedModsChanged(new ValueChangedEvent<IReadOnlyList<Mod>>(SelectedMods.Value, SelectedMods.Value));
|
||||||
|
|
||||||
// write the mods back to the SelectedMods bindable in the case a change was not applicable.
|
// write the mods back to the SelectedMods bindable in the case a change was not applicable.
|
||||||
// this generally isn't required as the previous line will perform deselection; just here for safety.
|
// this generally isn't required as the previous line will perform deselection; just here for safety.
|
||||||
refreshSelectedMods();
|
refreshSelectedMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectedModsChanged(ValueChangedEvent<IEnumerable<Mod>> e)
|
private void selectedModsChanged(ValueChangedEvent<IReadOnlyList<Mod>> e)
|
||||||
{
|
{
|
||||||
foreach (ModSection section in ModSectionsContainer.Children)
|
foreach (ModSection section in ModSectionsContainer.Children)
|
||||||
section.SelectTypes(e.NewValue.Select(m => m.GetType()).ToList());
|
section.SelectTypes(e.NewValue.Select(m => m.GetType()).ToList());
|
||||||
|
@ -22,6 +22,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays.Music;
|
using osu.Game.Overlays.Music;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -54,7 +55,11 @@ namespace osu.Game.Overlays
|
|||||||
private Container dragContainer;
|
private Container dragContainer;
|
||||||
private Container playerContainer;
|
private Container playerContainer;
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
[Resolved]
|
||||||
|
private Bindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provide a source for the toolbar height.
|
/// Provide a source for the toolbar height.
|
||||||
@ -73,7 +78,6 @@ namespace osu.Game.Overlays
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(Bindable<WorkingBeatmap> beatmap, BeatmapManager beatmaps, OsuColour colours)
|
private void load(Bindable<WorkingBeatmap> beatmap, BeatmapManager beatmaps, OsuColour colours)
|
||||||
{
|
{
|
||||||
this.beatmap.BindTo(beatmap);
|
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -231,6 +235,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
beatmap.BindValueChanged(beatmapChanged, true);
|
beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
beatmap.BindDisabledChanged(beatmapDisabledChanged, true);
|
beatmap.BindDisabledChanged(beatmapDisabledChanged, true);
|
||||||
|
mods.BindValueChanged(_ => updateAudioAdjustments(), true);
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,10 +359,23 @@ namespace osu.Game.Overlays
|
|||||||
progressBar.CurrentTime = 0;
|
progressBar.CurrentTime = 0;
|
||||||
|
|
||||||
updateDisplay(current, direction);
|
updateDisplay(current, direction);
|
||||||
|
updateAudioAdjustments();
|
||||||
|
|
||||||
queuedDirection = null;
|
queuedDirection = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateAudioAdjustments()
|
||||||
|
{
|
||||||
|
var track = current?.Track;
|
||||||
|
if (track == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
track.ResetSpeedAdjustments();
|
||||||
|
|
||||||
|
foreach (var mod in mods.Value.OfType<IApplicableToClock>())
|
||||||
|
mod.ApplyToClock(track);
|
||||||
|
}
|
||||||
|
|
||||||
private void currentTrackCompleted() => Schedule(() =>
|
private void currentTrackCompleted() => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (!current.Track.Looping && !beatmap.Disabled && beatmapSets.Any())
|
if (!current.Track.Looping && !beatmap.Disabled && beatmapSets.Any())
|
||||||
|
@ -39,8 +39,7 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
{
|
{
|
||||||
mods = mods.Select(m => m.CreateCopy()).ToArray();
|
mods = mods.Select(m => m.CreateCopy()).ToArray();
|
||||||
|
|
||||||
beatmap.Mods.Value = mods;
|
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
|
||||||
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
|
||||||
|
|
||||||
var clock = new StopwatchClock();
|
var clock = new StopwatchClock();
|
||||||
mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock));
|
mods.OfType<IApplicableToClock>().ForEach(m => m.ApplyToClock(clock));
|
||||||
@ -106,7 +105,7 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public Mod[] CreateDifficultyAdjustmentModCombinations()
|
public Mod[] CreateDifficultyAdjustmentModCombinations()
|
||||||
{
|
{
|
||||||
return createDifficultyAdjustmentModCombinations(Enumerable.Empty<Mod>(), DifficultyAdjustmentMods).ToArray();
|
return createDifficultyAdjustmentModCombinations(Array.Empty<Mod>(), DifficultyAdjustmentMods).ToArray();
|
||||||
|
|
||||||
IEnumerable<Mod> createDifficultyAdjustmentModCombinations(IEnumerable<Mod> currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0)
|
IEnumerable<Mod> createDifficultyAdjustmentModCombinations(IEnumerable<Mod> currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0)
|
||||||
{
|
{
|
||||||
|
@ -26,8 +26,7 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
Score = score;
|
Score = score;
|
||||||
|
|
||||||
beatmap.Mods.Value = score.Mods;
|
Beatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo, score.Mods);
|
||||||
Beatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
|
||||||
|
|
||||||
Attributes = ruleset.CreateDifficultyCalculator(beatmap).Calculate(score.Mods);
|
Attributes = ruleset.CreateDifficultyCalculator(beatmap).Calculate(score.Mods);
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ using osu.Framework.Timing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Configuration;
|
using osu.Game.Rulesets.Configuration;
|
||||||
using osu.Game.Rulesets.Edit.Tools;
|
using osu.Game.Rulesets.Edit.Tools;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
@ -185,8 +186,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal override DrawableEditRuleset CreateDrawableRuleset()
|
internal override DrawableEditRuleset CreateDrawableRuleset()
|
||||||
=> new DrawableEditRuleset<TObject>(CreateDrawableRuleset(Ruleset, Beatmap.Value));
|
=> new DrawableEditRuleset<TObject>(CreateDrawableRuleset(Ruleset, Beatmap.Value, Array.Empty<Mod>()));
|
||||||
|
|
||||||
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap);
|
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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 DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap);
|
public abstract DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods);
|
||||||
|
|
||||||
/// <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"/>.
|
||||||
|
@ -11,7 +11,6 @@ using osu.Game.Rulesets.Objects;
|
|||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
@ -82,7 +81,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The mods which are to be applied.
|
/// The mods which are to be applied.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly IEnumerable<Mod> mods;
|
[Cached(typeof(IReadOnlyList<Mod>))]
|
||||||
|
private readonly IReadOnlyList<Mod> mods;
|
||||||
|
|
||||||
private FrameStabilityContainer frameStabilityContainer;
|
private FrameStabilityContainer frameStabilityContainer;
|
||||||
|
|
||||||
@ -93,16 +93,18 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ruleset">The ruleset being represented.</param>
|
/// <param name="ruleset">The ruleset being represented.</param>
|
||||||
/// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param>
|
/// <param name="workingBeatmap">The beatmap to create the hit renderer for.</param>
|
||||||
protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap)
|
protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
Debug.Assert(workingBeatmap != null, "DrawableRuleset initialized with a null beatmap.");
|
if (workingBeatmap == null)
|
||||||
|
throw new ArgumentException("Beatmap cannot be null.", nameof(workingBeatmap));
|
||||||
|
|
||||||
|
this.mods = mods.ToArray();
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);
|
||||||
|
|
||||||
mods = workingBeatmap.Mods.Value;
|
|
||||||
applyBeatmapMods(mods);
|
applyBeatmapMods(mods);
|
||||||
|
|
||||||
KeyBindingInputManager = CreateInputManager();
|
KeyBindingInputManager = CreateInputManager();
|
||||||
@ -255,7 +257,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// Applies the active mods to the Beatmap.
|
/// Applies the active mods to the Beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="mods"></param>
|
/// <param name="mods"></param>
|
||||||
private void applyBeatmapMods(IEnumerable<Mod> mods)
|
private void applyBeatmapMods(IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
if (mods == null)
|
if (mods == null)
|
||||||
return;
|
return;
|
||||||
@ -268,7 +270,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// Applies the active mods to this DrawableRuleset.
|
/// 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(IReadOnlyList<Mod> mods, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
if (mods == null)
|
if (mods == null)
|
||||||
return;
|
return;
|
||||||
|
@ -57,13 +57,15 @@ namespace osu.Game.Rulesets.UI
|
|||||||
hitObjectContainerLazy = new Lazy<HitObjectContainer>(CreateHitObjectContainer);
|
hitObjectContainerLazy = new Lazy<HitObjectContainer>(CreateHitObjectContainer);
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkingBeatmap beatmap;
|
[Resolved]
|
||||||
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IReadOnlyList<Mod> mods { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IBindable<WorkingBeatmap> beatmap)
|
private void load()
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap.Value;
|
|
||||||
|
|
||||||
Cursor = CreateCursor();
|
Cursor = CreateCursor();
|
||||||
if (Cursor != null)
|
if (Cursor != null)
|
||||||
AddInternal(Cursor);
|
AddInternal(Cursor);
|
||||||
@ -123,7 +125,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (beatmap != null)
|
if (beatmap != null)
|
||||||
foreach (var mod in beatmap.Mods.Value)
|
foreach (var mod in mods)
|
||||||
if (mod is IUpdatableByPlayfield updatable)
|
if (mod is IUpdatableByPlayfield updatable)
|
||||||
updatable.Update(this);
|
updatable.Update(this);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Timing;
|
using osu.Game.Rulesets.Timing;
|
||||||
@ -80,8 +81,8 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
[Cached(Type = typeof(IScrollingInfo))]
|
[Cached(Type = typeof(IScrollingInfo))]
|
||||||
private readonly LocalScrollingInfo scrollingInfo;
|
private readonly LocalScrollingInfo scrollingInfo;
|
||||||
|
|
||||||
protected DrawableScrollingRuleset(Ruleset ruleset, WorkingBeatmap beatmap)
|
protected DrawableScrollingRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
scrollingInfo = new LocalScrollingInfo();
|
scrollingInfo = new LocalScrollingInfo();
|
||||||
scrollingInfo.Direction.BindTo(Direction);
|
scrollingInfo.Direction.BindTo(Direction);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -110,7 +109,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods ?? Enumerable.Empty<Mod>(), true);
|
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods?.ToArray() ?? Array.Empty<Mod>(), true);
|
||||||
|
|
||||||
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
|
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
|
||||||
}
|
}
|
||||||
|
@ -1,8 +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.Collections.Generic;
|
using System;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -42,9 +41,6 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
|
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
protected Bindable<IEnumerable<Mod>> SelectedMods { get; private set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmapManager { get; set; }
|
private BeatmapManager beatmapManager { get; set; }
|
||||||
|
|
||||||
@ -182,6 +178,9 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
RoomManager?.PartRoom();
|
RoomManager?.PartRoom();
|
||||||
|
|
||||||
|
Mods.Value = Array.Empty<Mod>();
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID);
|
var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID);
|
||||||
|
|
||||||
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap);
|
||||||
SelectedMods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty<Mod>();
|
Mods.Value = e.NewValue?.RequiredMods?.ToArray() ?? Array.Empty<Mod>();
|
||||||
if (e.NewValue?.Ruleset != null)
|
if (e.NewValue?.Ruleset != null)
|
||||||
Ruleset.Value = e.NewValue.Ruleset;
|
Ruleset.Value = e.NewValue.Ruleset;
|
||||||
}
|
}
|
||||||
@ -222,8 +221,6 @@ namespace osu.Game.Screens.Multi.Match
|
|||||||
|
|
||||||
private void onStart()
|
private void onStart()
|
||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = SelectedMods.Value.ToArray();
|
|
||||||
|
|
||||||
switch (type.Value)
|
switch (type.Value)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
@ -14,7 +13,6 @@ using osu.Game.Online.API;
|
|||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Multi.Ranking;
|
using osu.Game.Screens.Multi.Ranking;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -37,9 +35,6 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private Bindable<IEnumerable<Mod>> selectedMods { get; set; }
|
|
||||||
|
|
||||||
public TimeshiftPlayer(PlaylistItem playlistItem)
|
public TimeshiftPlayer(PlaylistItem playlistItem)
|
||||||
{
|
{
|
||||||
this.playlistItem = playlistItem;
|
this.playlistItem = playlistItem;
|
||||||
@ -61,7 +56,7 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
if (ruleset.Value.ID != playlistItem.Ruleset.ID)
|
if (ruleset.Value.ID != playlistItem.Ruleset.ID)
|
||||||
throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
|
throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset");
|
||||||
|
|
||||||
if (!playlistItem.RequiredMods.All(m => selectedMods.Value.Contains(m)))
|
if (!playlistItem.RequiredMods.All(m => Mods.Value.Contains(m)))
|
||||||
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
|
throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods");
|
||||||
|
|
||||||
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);
|
var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID);
|
||||||
|
@ -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.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore.Internal;
|
using Microsoft.EntityFrameworkCore.Internal;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -16,6 +17,7 @@ using osu.Game.Screens.Menu;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
{
|
{
|
||||||
@ -69,9 +71,11 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public virtual float BackgroundParallaxAmount => 1;
|
public virtual float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
public Bindable<WorkingBeatmap> Beatmap { get; set; }
|
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||||
|
|
||||||
public Bindable<RulesetInfo> Ruleset { get; set; }
|
public Bindable<RulesetInfo> Ruleset { get; private set; }
|
||||||
|
|
||||||
|
public Bindable<IReadOnlyList<Mod>> Mods { get; private set; }
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
@ -79,6 +83,7 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
Beatmap = screenDependencies.Beatmap;
|
Beatmap = screenDependencies.Beatmap;
|
||||||
Ruleset = screenDependencies.Ruleset;
|
Ruleset = screenDependencies.Ruleset;
|
||||||
|
Mods = screenDependencies.Mods;
|
||||||
|
|
||||||
return base.CreateChildDependencies(screenDependencies);
|
return base.CreateChildDependencies(screenDependencies);
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
namespace osu.Game.Screens
|
||||||
{
|
{
|
||||||
@ -14,6 +16,8 @@ namespace osu.Game.Screens
|
|||||||
|
|
||||||
public Bindable<RulesetInfo> Ruleset { get; }
|
public Bindable<RulesetInfo> Ruleset { get; }
|
||||||
|
|
||||||
|
public Bindable<IReadOnlyList<Mod>> Mods { get; }
|
||||||
|
|
||||||
public OsuScreenDependencies(bool requireLease, IReadOnlyDependencyContainer parent)
|
public OsuScreenDependencies(bool requireLease, IReadOnlyDependencyContainer parent)
|
||||||
: base(parent)
|
: base(parent)
|
||||||
{
|
{
|
||||||
@ -21,20 +25,21 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
|
Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
|
||||||
if (Beatmap == null)
|
if (Beatmap == null)
|
||||||
{
|
|
||||||
Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false));
|
Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false));
|
||||||
}
|
|
||||||
|
|
||||||
Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
|
Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
|
||||||
if (Ruleset == null)
|
if (Ruleset == null)
|
||||||
{
|
|
||||||
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));
|
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));
|
||||||
}
|
|
||||||
|
Mods = parent.Get<LeasedBindable<IReadOnlyList<Mod>>>()?.GetBoundCopy();
|
||||||
|
if (Mods == null)
|
||||||
|
Cache(Mods = parent.Get<Bindable<IReadOnlyList<Mod>>>().BeginLease(true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Beatmap = (parent.Get<LeasedBindable<WorkingBeatmap>>() ?? parent.Get<Bindable<WorkingBeatmap>>()).GetBoundCopy();
|
Beatmap = (parent.Get<LeasedBindable<WorkingBeatmap>>() ?? parent.Get<Bindable<WorkingBeatmap>>()).GetBoundCopy();
|
||||||
Ruleset = (parent.Get<LeasedBindable<RulesetInfo>>() ?? parent.Get<Bindable<RulesetInfo>>()).GetBoundCopy();
|
Ruleset = (parent.Get<LeasedBindable<RulesetInfo>>() ?? parent.Get<Bindable<RulesetInfo>>()).GetBoundCopy();
|
||||||
|
Mods = (parent.Get<LeasedBindable<IReadOnlyList<Mod>>>() ?? parent.Get<Bindable<IReadOnlyList<Mod>>>()).GetBoundCopy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
@ -23,6 +24,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public class GameplayClockContainer : Container
|
public class GameplayClockContainer : Container
|
||||||
{
|
{
|
||||||
private readonly WorkingBeatmap beatmap;
|
private readonly WorkingBeatmap beatmap;
|
||||||
|
private readonly IReadOnlyList<Mod> mods;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The original source (usually a <see cref="WorkingBeatmap"/>'s track).
|
/// The original source (usually a <see cref="WorkingBeatmap"/>'s track).
|
||||||
@ -58,9 +60,10 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly FramedOffsetClock platformOffsetClock;
|
private readonly FramedOffsetClock platformOffsetClock;
|
||||||
|
|
||||||
public GameplayClockContainer(WorkingBeatmap beatmap, double gameplayStartTime)
|
public GameplayClockContainer(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods, double gameplayStartTime)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
this.mods = mods;
|
||||||
this.gameplayStartTime = gameplayStartTime;
|
this.gameplayStartTime = gameplayStartTime;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -170,7 +173,7 @@ namespace osu.Game.Screens.Play
|
|||||||
else
|
else
|
||||||
sourceClock.Rate = UserPlaybackRate.Value;
|
sourceClock.Rate = UserPlaybackRate.Value;
|
||||||
|
|
||||||
foreach (var mod in beatmap.Mods.Value.OfType<IApplicableToClock>())
|
foreach (var mod in mods.OfType<IApplicableToClock>())
|
||||||
mod.ApplyToClock(sourceClock);
|
mod.ApplyToClock(sourceClock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,15 +18,15 @@ using osu.Game.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Play.HUD
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public class ModDisplay : Container, IHasCurrentValue<IEnumerable<Mod>>
|
public class ModDisplay : Container, IHasCurrentValue<IReadOnlyList<Mod>>
|
||||||
{
|
{
|
||||||
private const int fade_duration = 1000;
|
private const int fade_duration = 1000;
|
||||||
|
|
||||||
public bool DisplayUnrankedText = true;
|
public bool DisplayUnrankedText = true;
|
||||||
|
|
||||||
private readonly Bindable<IEnumerable<Mod>> current = new Bindable<IEnumerable<Mod>>();
|
private readonly Bindable<IReadOnlyList<Mod>> current = new Bindable<IReadOnlyList<Mod>>();
|
||||||
|
|
||||||
public Bindable<IEnumerable<Mod>> Current
|
public Bindable<IReadOnlyList<Mod>> Current
|
||||||
{
|
{
|
||||||
get => current;
|
get => current;
|
||||||
set
|
set
|
||||||
|
@ -2,16 +2,17 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
@ -42,7 +43,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public Action<double> RequestSeek;
|
public Action<double> RequestSeek;
|
||||||
|
|
||||||
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, WorkingBeatmap working)
|
public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -96,7 +97,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value;
|
Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value;
|
||||||
Progress.RequestSeek = time => RequestSeek(time);
|
Progress.RequestSeek = time => RequestSeek(time);
|
||||||
|
|
||||||
ModDisplay.Current.BindTo(working.Mods);
|
ModDisplay.Current.Value = mods;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
|
@ -105,7 +105,7 @@ namespace osu.Game.Screens.Play
|
|||||||
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, DrawableRuleset.GameplayStartTime);
|
InternalChild = GameplayClockContainer = new GameplayClockContainer(working, Mods.Value, DrawableRuleset.GameplayStartTime);
|
||||||
|
|
||||||
GameplayClockContainer.Children = new[]
|
GameplayClockContainer.Children = new[]
|
||||||
{
|
{
|
||||||
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
// display the cursor above some HUD elements.
|
// display the cursor above some HUD elements.
|
||||||
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
|
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
|
||||||
HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, working)
|
HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, Mods.Value)
|
||||||
{
|
{
|
||||||
HoldToQuit = { Action = performUserRequestedExit },
|
HoldToQuit = { Action = performUserRequestedExit },
|
||||||
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
|
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
|
||||||
@ -173,7 +173,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ScoreProcessor.AllJudged += onCompletion;
|
ScoreProcessor.AllJudged += onCompletion;
|
||||||
ScoreProcessor.Failed += onFail;
|
ScoreProcessor.Failed += onFail;
|
||||||
|
|
||||||
foreach (var mod in Beatmap.Value.Mods.Value.OfType<IApplicableToScoreProcessor>())
|
foreach (var mod in Mods.Value.OfType<IApplicableToScoreProcessor>())
|
||||||
mod.ApplyToScoreProcessor(ScoreProcessor);
|
mod.ApplyToScoreProcessor(ScoreProcessor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(working);
|
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(working, Mods.Value);
|
||||||
}
|
}
|
||||||
catch (BeatmapInvalidForRulesetException)
|
catch (BeatmapInvalidForRulesetException)
|
||||||
{
|
{
|
||||||
@ -203,7 +203,7 @@ namespace osu.Game.Screens.Play
|
|||||||
// 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();
|
||||||
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(Beatmap.Value);
|
DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(Beatmap.Value, Mods.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DrawableRuleset.Objects.Any())
|
if (!DrawableRuleset.Objects.Any())
|
||||||
@ -274,7 +274,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
Beatmap = Beatmap.Value.BeatmapInfo,
|
Beatmap = Beatmap.Value.BeatmapInfo,
|
||||||
Ruleset = ruleset,
|
Ruleset = ruleset,
|
||||||
Mods = Beatmap.Value.Mods.Value.ToArray(),
|
Mods = Mods.Value.ToArray(),
|
||||||
User = api.LocalUser.Value,
|
User = api.LocalUser.Value,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -328,7 +328,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private bool onFail()
|
private bool onFail()
|
||||||
{
|
{
|
||||||
if (Beatmap.Value.Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
if (Mods.Value.OfType<IApplicableFailOverride>().Any(m => !m.AllowFail))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GameplayClockContainer.Stop();
|
GameplayClockContainer.Stop();
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -16,6 +17,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osu.Game.Screens.Play.PlayerSettings;
|
using osu.Game.Screens.Play.PlayerSettings;
|
||||||
@ -69,7 +71,7 @@ namespace osu.Game.Screens.Play
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
info = new BeatmapMetadataDisplay(Beatmap.Value)
|
info = new BeatmapMetadataDisplay(Beatmap.Value, Mods.Value)
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -302,6 +304,7 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly WorkingBeatmap beatmap;
|
private readonly WorkingBeatmap beatmap;
|
||||||
|
private readonly IReadOnlyList<Mod> mods;
|
||||||
private LoadingAnimation loading;
|
private LoadingAnimation loading;
|
||||||
private Sprite backgroundSprite;
|
private Sprite backgroundSprite;
|
||||||
private ModDisplay modDisplay;
|
private ModDisplay modDisplay;
|
||||||
@ -323,9 +326,10 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapMetadataDisplay(WorkingBeatmap beatmap)
|
public BeatmapMetadataDisplay(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
this.mods = mods;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -406,7 +410,7 @@ namespace osu.Game.Screens.Play
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Margin = new MarginPadding { Top = 20 },
|
Margin = new MarginPadding { Top = 20 },
|
||||||
Current = beatmap.Mods
|
Current = { Value = mods }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ using osu.Framework.Graphics.Cursor;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
@ -309,12 +310,12 @@ namespace osu.Game.Screens.Select
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Try to get the beatmap with the user's ruleset
|
// Try to get the beatmap with the user's ruleset
|
||||||
playableBeatmap = beatmap.GetPlayableBeatmap(ruleset);
|
playableBeatmap = beatmap.GetPlayableBeatmap(ruleset, Array.Empty<Mod>());
|
||||||
}
|
}
|
||||||
catch (BeatmapInvalidForRulesetException)
|
catch (BeatmapInvalidForRulesetException)
|
||||||
{
|
{
|
||||||
// Can't be converted to the user's ruleset, so use the beatmap's own ruleset
|
// Can't be converted to the user's ruleset, so use the beatmap's own ruleset
|
||||||
playableBeatmap = beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset);
|
playableBeatmap = beatmap.GetPlayableBeatmap(beatmap.BeatmapInfo.Ruleset, Array.Empty<Mod>());
|
||||||
}
|
}
|
||||||
|
|
||||||
labels.AddRange(playableBeatmap.GetStatistics().Select(s => new InfoLabel(s)));
|
labels.AddRange(playableBeatmap.GetStatistics().Select(s => new InfoLabel(s)));
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -26,9 +24,6 @@ namespace osu.Game.Screens.Select
|
|||||||
[Resolved(typeof(Room))]
|
[Resolved(typeof(Room))]
|
||||||
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
|
protected Bindable<PlaylistItem> CurrentItem { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private Bindable<IEnumerable<Mod>> selectedMods { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
@ -46,7 +41,7 @@ namespace osu.Game.Screens.Select
|
|||||||
RulesetID = Ruleset.Value.ID ?? 0
|
RulesetID = Ruleset.Value.ID ?? 0
|
||||||
};
|
};
|
||||||
|
|
||||||
item.RequiredMods.AddRange(SelectedMods.Value);
|
item.RequiredMods.AddRange(Mods.Value);
|
||||||
|
|
||||||
Selected?.Invoke(item);
|
Selected?.Invoke(item);
|
||||||
|
|
||||||
@ -65,11 +60,12 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
Ruleset.Value = CurrentItem.Value.Ruleset;
|
Ruleset.Value = CurrentItem.Value.Ruleset;
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value.Beatmap);
|
||||||
Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value.RequiredMods ?? Enumerable.Empty<Mod>();
|
Mods.Value = CurrentItem.Value.RequiredMods?.ToArray() ?? Array.Empty<Mod>();
|
||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.Disabled = true;
|
Beatmap.Disabled = true;
|
||||||
Ruleset.Disabled = true;
|
Ruleset.Disabled = true;
|
||||||
|
Mods.Disabled = true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -80,6 +76,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
Beatmap.Disabled = false;
|
Beatmap.Disabled = false;
|
||||||
Ruleset.Disabled = false;
|
Ruleset.Disabled = false;
|
||||||
|
Mods.Disabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,10 @@ namespace osu.Game.Screens.Select
|
|||||||
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
var auto = Ruleset.Value.CreateInstance().GetAutoplayMod();
|
||||||
var autoType = auto.GetType();
|
var autoType = auto.GetType();
|
||||||
|
|
||||||
var mods = SelectedMods.Value;
|
var mods = Mods.Value;
|
||||||
if (mods.All(m => m.GetType() != autoType))
|
if (mods.All(m => m.GetType() != autoType))
|
||||||
{
|
{
|
||||||
SelectedMods.Value = mods.Append(auto);
|
Mods.Value = mods.Append(auto).ToArray();
|
||||||
removeAutoModOnResume = true;
|
removeAutoModOnResume = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,8 +84,8 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
[Cached(Type = typeof(IBindable<IEnumerable<Mod>>))]
|
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||||
protected readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
|
private readonly Bindable<IReadOnlyList<Mod>> mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>()); // Bound to the game's mods, but is not reset on exiting
|
||||||
|
|
||||||
protected SongSelect()
|
protected SongSelect()
|
||||||
{
|
{
|
||||||
@ -217,10 +217,9 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, Bindable<IEnumerable<Mod>> selectedMods)
|
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins)
|
||||||
{
|
{
|
||||||
if (selectedMods != null)
|
mods.BindTo(Mods);
|
||||||
SelectedMods.BindTo(selectedMods);
|
|
||||||
|
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
{
|
{
|
||||||
@ -269,6 +268,7 @@ namespace osu.Game.Screens.Select
|
|||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
dependencies.CacheAs(this);
|
dependencies.CacheAs(this);
|
||||||
dependencies.CacheAs(decoupledRuleset);
|
dependencies.CacheAs(decoupledRuleset);
|
||||||
dependencies.CacheAs<IBindable<RulesetInfo>>(decoupledRuleset);
|
dependencies.CacheAs<IBindable<RulesetInfo>>(decoupledRuleset);
|
||||||
@ -394,7 +394,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\"");
|
Logger.Log($"ruleset changed from \"{decoupledRuleset.Value}\" to \"{ruleset}\"");
|
||||||
|
|
||||||
Beatmap.Value.Mods.Value = Enumerable.Empty<Mod>();
|
mods.Value = Array.Empty<Mod>();
|
||||||
decoupledRuleset.Value = ruleset;
|
decoupledRuleset.Value = ruleset;
|
||||||
|
|
||||||
// force a filter before attempting to change the beatmap.
|
// force a filter before attempting to change the beatmap.
|
||||||
@ -529,8 +529,8 @@ namespace osu.Game.Screens.Select
|
|||||||
if (Beatmap.Value.Track != null)
|
if (Beatmap.Value.Track != null)
|
||||||
Beatmap.Value.Track.Looping = false;
|
Beatmap.Value.Track.Looping = false;
|
||||||
|
|
||||||
SelectedMods.UnbindAll();
|
mods.UnbindAll();
|
||||||
Beatmap.Value.Mods.Value = new Mod[] { };
|
Mods.Value = Array.Empty<Mod>();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -557,8 +557,6 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <param name="beatmap">The working beatmap.</param>
|
/// <param name="beatmap">The working beatmap.</param>
|
||||||
protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
|
protected virtual void UpdateBeatmap(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
beatmap.Mods.BindTo(SelectedMods);
|
|
||||||
|
|
||||||
Logger.Log($"working beatmap updated to {beatmap}");
|
Logger.Log($"working beatmap updated to {beatmap}");
|
||||||
|
|
||||||
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
||||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
var working = CreateWorkingBeatmap(beatmap, Clock);
|
var working = CreateWorkingBeatmap(beatmap, Clock);
|
||||||
|
|
||||||
Beatmap.Value = working;
|
Beatmap.Value = working;
|
||||||
Beatmap.Value.Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) };
|
Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) };
|
||||||
|
|
||||||
Player?.Exit();
|
Player?.Exit();
|
||||||
Player = null;
|
Player = null;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -10,16 +11,26 @@ using osu.Framework.Platform;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
public abstract class OsuTestCase : TestCase
|
public abstract class OsuTestCase : TestCase
|
||||||
{
|
{
|
||||||
|
[Cached(typeof(Bindable<WorkingBeatmap>))]
|
||||||
|
[Cached(typeof(IBindable<WorkingBeatmap>))]
|
||||||
private readonly OsuTestBeatmap beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap());
|
private readonly OsuTestBeatmap beatmap = new OsuTestBeatmap(new DummyWorkingBeatmap());
|
||||||
|
|
||||||
protected BindableBeatmap Beatmap => beatmap;
|
protected BindableBeatmap Beatmap => beatmap;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
[Cached(typeof(IBindable<RulesetInfo>))]
|
||||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
[Cached(Type = typeof(IBindable<IReadOnlyList<Mod>>))]
|
||||||
|
protected readonly Bindable<IReadOnlyList<Mod>> Mods = new Bindable<IReadOnlyList<Mod>>(Array.Empty<Mod>());
|
||||||
|
|
||||||
protected DependencyContainer Dependencies { get; private set; }
|
protected DependencyContainer Dependencies { get; private set; }
|
||||||
|
|
||||||
private readonly Lazy<Storage> localStorage;
|
private readonly Lazy<Storage> localStorage;
|
||||||
@ -27,18 +38,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
{
|
{
|
||||||
Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
||||||
|
|
||||||
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
// This is the earliest we can get OsuGameBase, which is used by the dummy working beatmap to find textures
|
||||||
beatmap.Default = new DummyWorkingBeatmap(Dependencies.Get<OsuGameBase>());
|
beatmap.Default = new DummyWorkingBeatmap(parent.Get<OsuGameBase>());
|
||||||
|
|
||||||
Dependencies.CacheAs<Bindable<WorkingBeatmap>>(beatmap);
|
return Dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
Dependencies.CacheAs<IBindable<WorkingBeatmap>>(beatmap);
|
|
||||||
|
|
||||||
Dependencies.CacheAs(Ruleset);
|
|
||||||
Dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
|
|
||||||
|
|
||||||
return Dependencies;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OsuTestCase()
|
protected OsuTestCase()
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock);
|
Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock);
|
||||||
|
|
||||||
if (!AllowFail)
|
if (!AllowFail)
|
||||||
Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
|
Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) };
|
||||||
|
|
||||||
Player = CreatePlayer(ruleset);
|
Player = CreatePlayer(ruleset);
|
||||||
LoadScreen(Player);
|
LoadScreen(Player);
|
||||||
|
Loading…
Reference in New Issue
Block a user