mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Merge branch 'master' into accuracy-bar
This commit is contained in:
commit
1d77e3764d
@ -60,7 +60,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.809.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.830.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.821.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.830.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Audio;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Catch.Tests
|
namespace osu.Game.Rulesets.Catch.Tests
|
||||||
{
|
{
|
||||||
@ -92,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public SampleChannel GetSample(string sampleName) =>
|
public SampleChannel GetSample(ISampleInfo sampleInfo) =>
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
||||||
public Texture GetTexture(string componentName) =>
|
public Texture GetTexture(string componentName) =>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
{
|
{
|
||||||
public class CatchRuleset : Ruleset
|
public class CatchRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableCatchRuleset(this, beatmap, mods);
|
public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap 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);
|
||||||
|
|
||||||
|
@ -58,14 +58,12 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
|
|||||||
ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
|
ApplyResult(r => r.Type = CheckPosition.Invoke(HitObject) ? HitResult.Perfect : HitResult.Miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool UseTransformStateManagement => false;
|
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateInitialTransforms() => this.FadeInFromZero(200);
|
||||||
|
|
||||||
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
// TODO: update to use new state management.
|
|
||||||
using (BeginAbsoluteSequence(HitObject.StartTime - HitObject.TimePreempt))
|
|
||||||
this.FadeIn(200);
|
|
||||||
|
|
||||||
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
|
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
|
||||||
|
|
||||||
using (BeginAbsoluteSequence(endTime, true))
|
using (BeginAbsoluteSequence(endTime, true))
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
if (lastPlateableFruit == null)
|
if (lastPlateableFruit == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// this is required to make this run after the last caught fruit runs UpdateState at least once.
|
// this is required to make this run after the last caught fruit runs updateState() at least once.
|
||||||
// TODO: find a better alternative
|
// TODO: find a better alternative
|
||||||
if (lastPlateableFruit.IsLoaded)
|
if (lastPlateableFruit.IsLoaded)
|
||||||
action();
|
action();
|
||||||
|
@ -25,11 +25,11 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
public DrawableCatchRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public DrawableCatchRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: 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.Beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this);
|
public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this);
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
{
|
{
|
||||||
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;
|
||||||
|
|
||||||
public DrawableManiaEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public DrawableManiaEditRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
[Cached(Type = typeof(IManiaHitObjectComposer))]
|
[Cached(Type = typeof(IManiaHitObjectComposer))]
|
||||||
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>, IManiaHitObjectComposer
|
public class ManiaHitObjectComposer : HitObjectComposer<ManiaHitObject>, IManiaHitObjectComposer
|
||||||
{
|
{
|
||||||
protected new DrawableManiaEditRuleset DrawableRuleset { get; private set; }
|
private DrawableManiaEditRuleset drawableRuleset;
|
||||||
|
|
||||||
public ManiaHitObjectComposer(Ruleset ruleset)
|
public ManiaHitObjectComposer(Ruleset ruleset)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
@ -33,23 +33,23 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="screenSpacePosition">The screen-space position.</param>
|
/// <param name="screenSpacePosition">The screen-space position.</param>
|
||||||
/// <returns>The column which intersects with <paramref name="screenSpacePosition"/>.</returns>
|
/// <returns>The column which intersects with <paramref name="screenSpacePosition"/>.</returns>
|
||||||
public Column ColumnAt(Vector2 screenSpacePosition) => DrawableRuleset.GetColumnByPosition(screenSpacePosition);
|
public Column ColumnAt(Vector2 screenSpacePosition) => drawableRuleset.GetColumnByPosition(screenSpacePosition);
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
=> dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
public int TotalColumns => ((ManiaPlayfield)DrawableRuleset.Playfield).TotalColumns;
|
public int TotalColumns => ((ManiaPlayfield)drawableRuleset.Playfield).TotalColumns;
|
||||||
|
|
||||||
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
protected override DrawableRuleset<ManiaHitObject> CreateDrawableRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
DrawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap, mods);
|
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);
|
||||||
|
|
||||||
return DrawableRuleset;
|
return drawableRuleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
{
|
{
|
||||||
public class ManiaRuleset : Ruleset
|
public class ManiaRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableManiaRuleset(this, beatmap, mods);
|
public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap 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);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
Alpha = 0.2f;
|
Alpha = 0.2f;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
|
||||||
@ -104,6 +105,12 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
bodyPiece.Height = DrawHeight - Head.Height / 2 + Tail.Height / 2;
|
bodyPiece.Height = DrawHeight - Head.Height / 2 + Tail.Height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
|
{
|
||||||
|
using (BeginDelayedSequence(HitObject.Duration, true))
|
||||||
|
base.UpdateStateTransforms(state);
|
||||||
|
}
|
||||||
|
|
||||||
protected void BeginHold()
|
protected void BeginHold()
|
||||||
{
|
{
|
||||||
holdStartTime = Time.Current;
|
holdStartTime = Time.Current;
|
||||||
|
@ -45,24 +45,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
{
|
{
|
||||||
Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
where TObject : ManiaHitObject
|
|
||||||
{
|
|
||||||
public new readonly TObject HitObject;
|
|
||||||
|
|
||||||
protected DrawableManiaHitObject(TObject hitObject)
|
|
||||||
: base(hitObject)
|
|
||||||
{
|
{
|
||||||
HitObject = hitObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool UseTransformStateManagement => false;
|
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
// TODO: update to use new state management.
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
@ -75,4 +60,16 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract class DrawableManiaHitObject<TObject> : DrawableManiaHitObject
|
||||||
|
where TObject : ManiaHitObject
|
||||||
|
{
|
||||||
|
public new readonly TObject HitObject;
|
||||||
|
|
||||||
|
protected DrawableManiaHitObject(TObject hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
HitObject = hitObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
@ -77,13 +78,37 @@ namespace osu.Game.Rulesets.Mania.Replays
|
|||||||
|
|
||||||
private IEnumerable<IActionPoint> generateActionPoints()
|
private IEnumerable<IActionPoint> generateActionPoints()
|
||||||
{
|
{
|
||||||
foreach (var obj in Beatmap.HitObjects)
|
for (int i = 0; i < Beatmap.HitObjects.Count; i++)
|
||||||
{
|
{
|
||||||
yield return new HitPoint { Time = obj.StartTime, Column = obj.Column };
|
var currentObject = Beatmap.HitObjects[i];
|
||||||
yield return new ReleasePoint { Time = ((obj as IHasEndTime)?.EndTime ?? obj.StartTime) + RELEASE_DELAY, Column = obj.Column };
|
var nextObjectInColumn = GetNextObject(i); // Get the next object that requires pressing the same button
|
||||||
|
|
||||||
|
double endTime = (currentObject as IHasEndTime)?.EndTime ?? currentObject.StartTime;
|
||||||
|
|
||||||
|
bool canDelayKeyUp = nextObjectInColumn == null ||
|
||||||
|
nextObjectInColumn.StartTime > endTime + RELEASE_DELAY;
|
||||||
|
|
||||||
|
double calculatedDelay = canDelayKeyUp ? RELEASE_DELAY : (nextObjectInColumn.StartTime - endTime) * 0.9;
|
||||||
|
|
||||||
|
yield return new HitPoint { Time = currentObject.StartTime, Column = currentObject.Column };
|
||||||
|
|
||||||
|
yield return new ReleasePoint { Time = endTime + calculatedDelay, Column = currentObject.Column };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override HitObject GetNextObject(int currentIndex)
|
||||||
|
{
|
||||||
|
int desiredColumn = Beatmap.HitObjects[currentIndex].Column;
|
||||||
|
|
||||||
|
for (int i = currentIndex + 1; i < Beatmap.HitObjects.Count; i++)
|
||||||
|
{
|
||||||
|
if (Beatmap.HitObjects[i].Column == desiredColumn)
|
||||||
|
return Beatmap.HitObjects[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private interface IActionPoint
|
private interface IActionPoint
|
||||||
{
|
{
|
||||||
double Time { get; set; }
|
double Time { get; set; }
|
||||||
|
@ -36,11 +36,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
|
|
||||||
public IEnumerable<BarLine> BarLines;
|
public IEnumerable<BarLine> BarLines;
|
||||||
|
|
||||||
|
protected override bool RelativeScaleBeatLengths => true;
|
||||||
|
|
||||||
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config;
|
||||||
|
|
||||||
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
|
||||||
|
|
||||||
public DrawableManiaRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public DrawableManiaRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
// Generate the bar lines
|
// Generate the bar lines
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
public class DrawableOsuEditRuleset : DrawableOsuRuleset
|
public class DrawableOsuEditRuleset : DrawableOsuRuleset
|
||||||
{
|
{
|
||||||
public DrawableOsuEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public DrawableOsuEditRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
protected override DrawableRuleset<OsuHitObject> CreateDrawableRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
=> new DrawableOsuEditRuleset(ruleset, beatmap, mods);
|
=> new DrawableOsuEditRuleset(ruleset, beatmap, mods);
|
||||||
|
|
||||||
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
protected override IReadOnlyList<HitObjectCompositionTool> CompositionTools => new HitObjectCompositionTool[]
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
private readonly HitArea hitArea;
|
private readonly HitArea hitArea;
|
||||||
|
|
||||||
|
private readonly SkinnableDrawable mainContent;
|
||||||
|
|
||||||
public DrawableHitCircle(HitCircle h)
|
public DrawableHitCircle(HitCircle h)
|
||||||
: base(h)
|
: base(h)
|
||||||
{
|
{
|
||||||
@ -56,7 +58,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
|
mainContent = new SkinnableDrawable("Play/osu/hitcircle", _ => new MainCirclePiece(HitObject.IndexInCurrentCombo)),
|
||||||
ApproachCircle = new ApproachCircle
|
ApproachCircle = new ApproachCircle
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
@ -108,6 +110,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
base.UpdateInitialTransforms();
|
base.UpdateInitialTransforms();
|
||||||
|
|
||||||
|
mainContent.FadeInFromZero(HitObject.TimeFadeIn);
|
||||||
|
|
||||||
ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt));
|
ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt));
|
||||||
ApproachCircle.ScaleTo(1f, HitObject.TimePreempt);
|
ApproachCircle.ScaleTo(1f, HitObject.TimePreempt);
|
||||||
ApproachCircle.Expire(true);
|
ApproachCircle.Expire(true);
|
||||||
|
@ -36,8 +36,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
|
|
||||||
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
|
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||||
|
|
||||||
protected override void UpdateInitialTransforms() => this.FadeIn(HitObject.TimeFadeIn);
|
|
||||||
|
|
||||||
private OsuInputManager osuActionInputManager;
|
private OsuInputManager osuActionInputManager;
|
||||||
internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager);
|
internal OsuInputManager OsuActionInputManager => osuActionInputManager ?? (osuActionInputManager = GetContainingInputManager() as OsuInputManager);
|
||||||
|
|
||||||
|
@ -93,6 +93,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void UpdateInitialTransforms()
|
||||||
|
{
|
||||||
|
base.UpdateInitialTransforms();
|
||||||
|
|
||||||
|
Body.FadeInFromZero(HitObject.TimeFadeIn);
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
{
|
{
|
||||||
public class OsuRuleset : Ruleset
|
public class OsuRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableOsuRuleset(this, beatmap, mods);
|
public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap 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);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ 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, IReadOnlyList<Mod> mods)
|
public DrawableOsuRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -247,10 +247,6 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
|||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -53,9 +53,5 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
Alpha = 0.75f
|
Alpha = 0.75f
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,13 +88,13 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
ApplyResult(r => r.Type = HitResult.Miss);
|
ApplyResult(r => r.Type = HitResult.Miss);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
this.FadeOut(100).Expire();
|
this.Delay(HitObject.Duration).FadeOut(100).Expire();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
ApplyResult(r => r.Type = HitResult.Great);
|
ApplyResult(r => r.Type = HitResult.Great);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -92,56 +92,42 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
Size = BaseSize * Parent.RelativeChildSize;
|
Size = BaseSize * Parent.RelativeChildSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
{
|
{
|
||||||
// TODO: update to use new state management.
|
switch (state)
|
||||||
var circlePiece = MainPiece as CirclePiece;
|
|
||||||
circlePiece?.FlashBox.FinishTransforms();
|
|
||||||
|
|
||||||
var offset = !AllJudged ? 0 : Time.Current - HitObject.StartTime;
|
|
||||||
|
|
||||||
using (BeginDelayedSequence(HitObject.StartTime - Time.Current + offset, true))
|
|
||||||
{
|
{
|
||||||
switch (State.Value)
|
case ArmedState.Idle:
|
||||||
{
|
validActionPressed = false;
|
||||||
case ArmedState.Idle:
|
|
||||||
validActionPressed = false;
|
|
||||||
|
|
||||||
UnproxyContent();
|
UnproxyContent();
|
||||||
this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire();
|
this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
this.FadeOut(100)
|
this.FadeOut(100)
|
||||||
.Expire();
|
.Expire();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
// If we're far enough away from the left stage, we should bring outselves in front of it
|
// If we're far enough away from the left stage, we should bring outselves in front of it
|
||||||
ProxyContent();
|
ProxyContent();
|
||||||
|
|
||||||
var flash = circlePiece?.FlashBox;
|
var flash = (MainPiece as CirclePiece)?.FlashBox;
|
||||||
|
flash?.FadeTo(0.9f).FadeOut(300);
|
||||||
|
|
||||||
if (flash != null)
|
const float gravity_time = 300;
|
||||||
{
|
const float gravity_travel_height = 200;
|
||||||
flash.FadeTo(0.9f);
|
|
||||||
flash.FadeOut(300);
|
|
||||||
}
|
|
||||||
|
|
||||||
const float gravity_time = 300;
|
this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
|
||||||
const float gravity_travel_height = 200;
|
|
||||||
|
|
||||||
this.ScaleTo(0.8f, gravity_time * 2, Easing.OutQuad);
|
this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
|
||||||
|
.Then()
|
||||||
|
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);
|
||||||
|
|
||||||
this.MoveToY(-gravity_travel_height, gravity_time, Easing.Out)
|
this.FadeOut(800)
|
||||||
.Then()
|
.Expire();
|
||||||
.MoveToY(gravity_travel_height * 2, gravity_time * 2, Easing.In);
|
|
||||||
|
|
||||||
this.FadeOut(800)
|
break;
|
||||||
.Expire();
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,9 +18,5 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
MainObject = mainObject;
|
MainObject = mainObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,11 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
private const float target_ring_scale = 5f;
|
private const float target_ring_scale = 5f;
|
||||||
private const float inner_ring_alpha = 0.65f;
|
private const float inner_ring_alpha = 0.65f;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Offset away from the start time of the swell at which the ring starts appearing.
|
||||||
|
/// </summary>
|
||||||
|
private const double ring_appear_offset = 100;
|
||||||
|
|
||||||
private readonly List<DrawableSwellTick> ticks = new List<DrawableSwellTick>();
|
private readonly List<DrawableSwellTick> ticks = new List<DrawableSwellTick>();
|
||||||
|
|
||||||
private readonly Container bodyContainer;
|
private readonly Container bodyContainer;
|
||||||
@ -179,26 +184,34 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
protected override void UpdateInitialTransforms()
|
||||||
{
|
{
|
||||||
const float preempt = 100;
|
base.UpdateInitialTransforms();
|
||||||
const float out_transition_time = 300;
|
|
||||||
|
using (BeginAbsoluteSequence(HitObject.StartTime - ring_appear_offset, true))
|
||||||
|
targetRing.ScaleTo(target_ring_scale, 400, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void UpdateStateTransforms(ArmedState state)
|
||||||
|
{
|
||||||
|
const double transition_duration = 300;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Idle:
|
case ArmedState.Idle:
|
||||||
UnproxyContent();
|
|
||||||
expandingRing.FadeTo(0);
|
expandingRing.FadeTo(0);
|
||||||
using (BeginAbsoluteSequence(HitObject.StartTime - preempt, true))
|
|
||||||
targetRing.ScaleTo(target_ring_scale, preempt * 4, Easing.OutQuint);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ArmedState.Miss:
|
case ArmedState.Miss:
|
||||||
case ArmedState.Hit:
|
case ArmedState.Hit:
|
||||||
this.FadeOut(out_transition_time, Easing.Out);
|
using (BeginAbsoluteSequence(Time.Current, true))
|
||||||
bodyContainer.ScaleTo(1.4f, out_transition_time);
|
{
|
||||||
|
this.FadeOut(transition_duration, Easing.Out);
|
||||||
|
bodyContainer.ScaleTo(1.4f, transition_duration);
|
||||||
|
|
||||||
|
Expire();
|
||||||
|
}
|
||||||
|
|
||||||
Expire();
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -212,9 +225,10 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
// Make the swell stop at the hit target
|
// Make the swell stop at the hit target
|
||||||
X = Math.Max(0, X);
|
X = Math.Max(0, X);
|
||||||
|
|
||||||
double t = Math.Min(HitObject.StartTime, Time.Current);
|
if (Time.Current >= HitObject.StartTime - ring_appear_offset)
|
||||||
if (t == HitObject.StartTime)
|
|
||||||
ProxyContent();
|
ProxyContent();
|
||||||
|
else
|
||||||
|
UnproxyContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool? lastWasCentre;
|
private bool? lastWasCentre;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||||
@ -21,10 +20,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool OnPressed(TaikoAction action) => false;
|
public override bool OnPressed(TaikoAction action) => false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,10 +78,29 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
public abstract bool OnPressed(TaikoAction action);
|
public abstract bool OnPressed(TaikoAction action);
|
||||||
public virtual bool OnReleased(TaikoAction action) => false;
|
public virtual bool OnReleased(TaikoAction action) => false;
|
||||||
|
|
||||||
|
public override double LifetimeStart
|
||||||
|
{
|
||||||
|
get => base.LifetimeStart;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.LifetimeStart = value;
|
||||||
|
proxiedContent.LifetimeStart = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override double LifetimeEnd
|
||||||
|
{
|
||||||
|
get => base.LifetimeEnd;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.LifetimeEnd = value;
|
||||||
|
proxiedContent.LifetimeEnd = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class ProxiedContentContainer : Container
|
private class ProxiedContentContainer : Container
|
||||||
{
|
{
|
||||||
public override double LifetimeStart => Parent?.LifetimeStart ?? base.LifetimeStart;
|
public override bool RemoveWhenNotAlive => false;
|
||||||
public override double LifetimeEnd => Parent?.LifetimeEnd ?? base.LifetimeEnd;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,8 +140,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool UseTransformStateManagement => false;
|
|
||||||
|
|
||||||
// Normal and clap samples are handled by the drum
|
// Normal and clap samples are handled by the drum
|
||||||
protected override IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP);
|
protected override IEnumerable<HitSampleInfo> GetSamples() => HitObject.Samples.Where(s => s.Name != HitSampleInfo.HIT_NORMAL && s.Name != HitSampleInfo.HIT_CLAP);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Rulesets.Objects.Types;
|
|||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
using osu.Game.Rulesets.Taiko.Beatmaps;
|
using osu.Game.Rulesets.Taiko.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Replays
|
namespace osu.Game.Rulesets.Taiko.Replays
|
||||||
{
|
{
|
||||||
@ -113,7 +114,13 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
|||||||
else
|
else
|
||||||
throw new InvalidOperationException("Unknown hit object type.");
|
throw new InvalidOperationException("Unknown hit object type.");
|
||||||
|
|
||||||
Frames.Add(new TaikoReplayFrame(endTime + KEY_UP_DELAY));
|
var nextHitObject = GetNextObject(i); // Get the next object that requires pressing the same button
|
||||||
|
|
||||||
|
bool canDelayKeyUp = nextHitObject == null || nextHitObject.StartTime > endTime + KEY_UP_DELAY;
|
||||||
|
|
||||||
|
double calculatedDelay = canDelayKeyUp ? KEY_UP_DELAY : (nextHitObject.StartTime - endTime) * 0.9;
|
||||||
|
|
||||||
|
Frames.Add(new TaikoReplayFrame(endTime + calculatedDelay));
|
||||||
|
|
||||||
if (i < Beatmap.HitObjects.Count - 1)
|
if (i < Beatmap.HitObjects.Count - 1)
|
||||||
{
|
{
|
||||||
@ -127,5 +134,24 @@ namespace osu.Game.Rulesets.Taiko.Replays
|
|||||||
|
|
||||||
return Replay;
|
return Replay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override HitObject GetNextObject(int currentIndex)
|
||||||
|
{
|
||||||
|
Type desiredType = Beatmap.HitObjects[currentIndex].GetType();
|
||||||
|
|
||||||
|
for (int i = currentIndex + 1; i < Beatmap.HitObjects.Count; i++)
|
||||||
|
{
|
||||||
|
var currentObj = Beatmap.HitObjects[i];
|
||||||
|
|
||||||
|
if (currentObj.GetType() == desiredType ||
|
||||||
|
// Un-press all keys before a DrumRoll or Swell
|
||||||
|
currentObj is DrumRoll || currentObj is Swell)
|
||||||
|
{
|
||||||
|
return Beatmap.HitObjects[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
{
|
{
|
||||||
public class TaikoRuleset : Ruleset
|
public class TaikoRuleset : Ruleset
|
||||||
{
|
{
|
||||||
public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new DrawableTaikoRuleset(this, beatmap, mods);
|
public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap 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[]
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
|
|
||||||
protected override bool UserScrollSpeedAdjustment => false;
|
protected override bool UserScrollSpeedAdjustment => false;
|
||||||
|
|
||||||
public DrawableTaikoRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
public DrawableTaikoRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
Direction.Value = ScrollingDirection.Left;
|
Direction.Value = ScrollingDirection.Left;
|
||||||
|
@ -44,9 +44,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
private readonly JudgementContainer<DrawableTaikoJudgement> judgementContainer;
|
private readonly JudgementContainer<DrawableTaikoJudgement> judgementContainer;
|
||||||
internal readonly HitTarget HitTarget;
|
internal readonly HitTarget HitTarget;
|
||||||
|
|
||||||
private readonly Container topLevelHitContainer;
|
private readonly ProxyContainer topLevelHitContainer;
|
||||||
|
private readonly ProxyContainer barlineContainer;
|
||||||
private readonly Container barlineContainer;
|
|
||||||
|
|
||||||
private readonly Container overlayBackgroundContainer;
|
private readonly Container overlayBackgroundContainer;
|
||||||
private readonly Container backgroundContainer;
|
private readonly Container backgroundContainer;
|
||||||
@ -108,7 +107,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
barlineContainer = new Container
|
barlineContainer = new ProxyContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }
|
Padding = new MarginPadding { Left = HIT_TARGET_OFFSET }
|
||||||
@ -183,7 +182,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
topLevelHitContainer = new Container
|
topLevelHitContainer = new ProxyContainer
|
||||||
{
|
{
|
||||||
Name = "Top level hit objects",
|
Name = "Top level hit objects",
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -256,5 +255,15 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class ProxyContainer : LifetimeManagementContainer
|
||||||
|
{
|
||||||
|
public new MarginPadding Padding
|
||||||
|
{
|
||||||
|
set => base.Padding = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Add(Drawable proxy) => AddInternal(proxy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
|
|
||||||
int spriteCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
|
int spriteCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
|
||||||
int animationCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardAnimation));
|
int animationCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardAnimation));
|
||||||
int sampleCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSample));
|
int sampleCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardSampleInfo));
|
||||||
|
|
||||||
Assert.AreEqual(15, spriteCount);
|
Assert.AreEqual(15, spriteCount);
|
||||||
Assert.AreEqual(1, animationCount);
|
Assert.AreEqual(1, animationCount);
|
||||||
|
@ -16,15 +16,13 @@ using osu.Game.Rulesets.Osu.Edit;
|
|||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles;
|
||||||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.Edit.Compose;
|
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Editor
|
namespace osu.Game.Tests.Visual.Editor
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
[Cached(Type = typeof(IPlacementHandler))]
|
public class TestSceneHitObjectComposer : OsuTestScene
|
||||||
public class TestSceneHitObjectComposer : OsuTestScene, IPlacementHandler
|
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -39,8 +37,6 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
typeof(HitCirclePlacementBlueprint),
|
typeof(HitCirclePlacementBlueprint),
|
||||||
};
|
};
|
||||||
|
|
||||||
private HitObjectComposer composer;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -67,15 +63,7 @@ namespace osu.Game.Tests.Visual.Editor
|
|||||||
Dependencies.CacheAs<IAdjustableClock>(clock);
|
Dependencies.CacheAs<IAdjustableClock>(clock);
|
||||||
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
Dependencies.CacheAs<IFrameBasedClock>(clock);
|
||||||
|
|
||||||
Child = composer = new OsuHitObjectComposer(new OsuRuleset());
|
Child = new OsuHitObjectComposer(new OsuRuleset());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginPlacement(HitObject hitObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EndPlacement(HitObject hitObject) => composer.Add(hitObject);
|
|
||||||
|
|
||||||
public void Delete(HitObject hitObject) => composer.Remove(hitObject);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,305 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Difficulty;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneDrawableScrollingRuleset : OsuTestScene
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of time visible by the "view window" of the playfield.
|
||||||
|
/// All hitobjects added through <see cref="createBeatmap"/> are spaced apart by this value, such that for a beat length of 1000,
|
||||||
|
/// there will be at most 2 hitobjects visible in the "view window".
|
||||||
|
/// </summary>
|
||||||
|
private const double time_range = 1000;
|
||||||
|
|
||||||
|
private readonly ManualClock testClock = new ManualClock();
|
||||||
|
private TestDrawableScrollingRuleset drawableRuleset;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup() => Schedule(() => testClock.CurrentTime = 0);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRelativeBeatLengthScaleSingleTimingPoint()
|
||||||
|
{
|
||||||
|
var beatmap = createBeatmap(new TimingControlPoint { BeatLength = time_range / 2 });
|
||||||
|
|
||||||
|
createTest(beatmap, d => d.RelativeScaleBeatLengthsOverride = true);
|
||||||
|
|
||||||
|
assertPosition(0, 0f);
|
||||||
|
|
||||||
|
// The single timing point is 1x speed relative to itself, such that the hitobject occurring time_range milliseconds later should appear
|
||||||
|
// at the bottom of the view window regardless of the timing point's beat length
|
||||||
|
assertPosition(1, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRelativeBeatLengthScaleTimingPointBeyondEndDoesNotBecomeDominant()
|
||||||
|
{
|
||||||
|
var beatmap = createBeatmap(
|
||||||
|
new TimingControlPoint { BeatLength = time_range / 2 },
|
||||||
|
new TimingControlPoint { Time = 12000, BeatLength = time_range },
|
||||||
|
new TimingControlPoint { Time = 100000, BeatLength = time_range });
|
||||||
|
|
||||||
|
createTest(beatmap, d => d.RelativeScaleBeatLengthsOverride = true);
|
||||||
|
|
||||||
|
assertPosition(0, 0f);
|
||||||
|
assertPosition(1, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRelativeBeatLengthScaleFromSecondTimingPoint()
|
||||||
|
{
|
||||||
|
var beatmap = createBeatmap(
|
||||||
|
new TimingControlPoint { BeatLength = time_range },
|
||||||
|
new TimingControlPoint { Time = 3 * time_range, BeatLength = time_range / 2 });
|
||||||
|
|
||||||
|
createTest(beatmap, d => d.RelativeScaleBeatLengthsOverride = true);
|
||||||
|
|
||||||
|
// The first timing point should have a relative velocity of 2
|
||||||
|
assertPosition(0, 0f);
|
||||||
|
assertPosition(1, 0.5f);
|
||||||
|
assertPosition(2, 1f);
|
||||||
|
|
||||||
|
// Move to the second timing point
|
||||||
|
setTime(3 * time_range);
|
||||||
|
assertPosition(3, 0f);
|
||||||
|
|
||||||
|
// As above, this is the timing point that is 1x speed relative to itself, so the hitobject occurring time_range milliseconds later should be at the bottom of the view window
|
||||||
|
assertPosition(4, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNonRelativeScale()
|
||||||
|
{
|
||||||
|
var beatmap = createBeatmap(
|
||||||
|
new TimingControlPoint { BeatLength = time_range },
|
||||||
|
new TimingControlPoint { Time = 3 * time_range, BeatLength = time_range / 2 });
|
||||||
|
|
||||||
|
createTest(beatmap);
|
||||||
|
|
||||||
|
assertPosition(0, 0f);
|
||||||
|
assertPosition(1, 1);
|
||||||
|
|
||||||
|
// Move to the second timing point
|
||||||
|
setTime(3 * time_range);
|
||||||
|
assertPosition(3, 0f);
|
||||||
|
|
||||||
|
// For a beat length of 500, the view window of this timing point is elongated 2x (1000 / 500), such that the second hitobject is two TimeRanges away (offscreen)
|
||||||
|
// To bring it on-screen, half TimeRange is added to the current time, bringing the second half of the view window into view, and the hitobject should appear at the bottom
|
||||||
|
setTime(3 * time_range + time_range / 2);
|
||||||
|
assertPosition(4, 1f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertPosition(int index, float relativeY) => AddAssert($"hitobject {index} at {relativeY}",
|
||||||
|
() => Precision.AlmostEquals(drawableRuleset.Playfield.AllHitObjects.ElementAt(index).DrawPosition.Y, drawableRuleset.Playfield.HitObjectContainer.DrawHeight * relativeY));
|
||||||
|
|
||||||
|
private void setTime(double time)
|
||||||
|
{
|
||||||
|
AddStep($"set time = {time}", () => testClock.CurrentTime = time);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates an <see cref="IBeatmap"/>, containing 10 hitobjects and user-provided timing points.
|
||||||
|
/// The hitobjects are spaced <see cref="time_range"/> milliseconds apart.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="timingControlPoints">The timing points to add to the beatmap.</param>
|
||||||
|
/// <returns>The <see cref="IBeatmap"/>.</returns>
|
||||||
|
private IBeatmap createBeatmap(params TimingControlPoint[] timingControlPoints)
|
||||||
|
{
|
||||||
|
var beatmap = new Beatmap<HitObject> { BeatmapInfo = { Ruleset = new OsuRuleset().RulesetInfo } };
|
||||||
|
|
||||||
|
beatmap.ControlPointInfo.TimingPoints.AddRange(timingControlPoints);
|
||||||
|
|
||||||
|
for (int i = 0; i < 10; i++)
|
||||||
|
beatmap.HitObjects.Add(new HitObject { StartTime = i * time_range });
|
||||||
|
|
||||||
|
return beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createTest(IBeatmap beatmap, Action<TestDrawableScrollingRuleset> overrideAction = null) => AddStep("create test", () =>
|
||||||
|
{
|
||||||
|
var ruleset = new TestScrollingRuleset();
|
||||||
|
|
||||||
|
drawableRuleset = (TestDrawableScrollingRuleset)ruleset.CreateDrawableRulesetWith(CreateWorkingBeatmap(beatmap), Array.Empty<Mod>());
|
||||||
|
drawableRuleset.FrameStablePlayback = false;
|
||||||
|
|
||||||
|
overrideAction?.Invoke(drawableRuleset);
|
||||||
|
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Height = 0.75f,
|
||||||
|
Width = 400,
|
||||||
|
Masking = true,
|
||||||
|
Clock = new FramedClock(testClock),
|
||||||
|
Child = drawableRuleset
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
#region Ruleset
|
||||||
|
|
||||||
|
private class TestScrollingRuleset : Ruleset
|
||||||
|
{
|
||||||
|
public TestScrollingRuleset(RulesetInfo rulesetInfo = null)
|
||||||
|
: base(rulesetInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<Mod> GetModsFor(ModType type) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods) => new TestDrawableScrollingRuleset(this, beatmap, mods);
|
||||||
|
|
||||||
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TestBeatmapConverter(beatmap);
|
||||||
|
|
||||||
|
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
public override string Description { get; } = string.Empty;
|
||||||
|
|
||||||
|
public override string ShortName { get; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestDrawableScrollingRuleset : DrawableScrollingRuleset<TestHitObject>
|
||||||
|
{
|
||||||
|
public bool RelativeScaleBeatLengthsOverride { get; set; }
|
||||||
|
|
||||||
|
protected override bool RelativeScaleBeatLengths => RelativeScaleBeatLengthsOverride;
|
||||||
|
|
||||||
|
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||||
|
|
||||||
|
public TestDrawableScrollingRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
|
: base(ruleset, beatmap, mods)
|
||||||
|
{
|
||||||
|
TimeRange.Value = time_range;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override DrawableHitObject<TestHitObject> CreateDrawableRepresentation(TestHitObject h) => new DrawableTestHitObject(h);
|
||||||
|
|
||||||
|
protected override PassThroughInputManager CreateInputManager() => new PassThroughInputManager();
|
||||||
|
|
||||||
|
protected override Playfield CreatePlayfield() => new TestPlayfield();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestPlayfield : ScrollingPlayfield
|
||||||
|
{
|
||||||
|
public TestPlayfield()
|
||||||
|
{
|
||||||
|
AddInternal(new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0.2f,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding { Top = 150 },
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 2,
|
||||||
|
Colour = Color4.Green
|
||||||
|
},
|
||||||
|
HitObjectContainer
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestBeatmapConverter : BeatmapConverter<TestHitObject>
|
||||||
|
{
|
||||||
|
public TestBeatmapConverter(IBeatmap beatmap)
|
||||||
|
: base(beatmap)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<Type> ValidConversionTypes => new[] { typeof(HitObject) };
|
||||||
|
|
||||||
|
protected override IEnumerable<TestHitObject> ConvertHitObject(HitObject original, IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
yield return new TestHitObject
|
||||||
|
{
|
||||||
|
StartTime = original.StartTime,
|
||||||
|
EndTime = (original as IHasEndTime)?.EndTime ?? (original.StartTime + 100)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region HitObject
|
||||||
|
|
||||||
|
private class TestHitObject : HitObject, IHasEndTime
|
||||||
|
{
|
||||||
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
|
public double Duration => EndTime - StartTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
private class DrawableTestHitObject : DrawableHitObject<TestHitObject>
|
||||||
|
{
|
||||||
|
public DrawableTestHitObject(TestHitObject hitObject)
|
||||||
|
: base(hitObject)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
Origin = Anchor.TopCentre;
|
||||||
|
|
||||||
|
Size = new Vector2(100, 25);
|
||||||
|
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.LightPink
|
||||||
|
},
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Height = 2,
|
||||||
|
Colour = Color4.Red
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -200,10 +200,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestDrawableHitObject : DrawableHitObject<HitObject>
|
private class TestDrawableHitObject : DrawableHitObject<HitObject>
|
||||||
@ -216,10 +212,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddInternal(new Box { Size = new Vector2(75) });
|
AddInternal(new Box { Size = new Vector2(75) });
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateState(ArmedState state)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ 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.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Audio;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
@ -253,7 +254,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -264,7 +265,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@ -275,7 +276,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
public Texture GetTexture(string componentName) => throw new NotImplementedException();
|
||||||
|
|
||||||
public SampleChannel GetSample(string sampleName) => throw new NotImplementedException();
|
public SampleChannel GetSample(ISampleInfo sampleInfo) => throw new NotImplementedException();
|
||||||
|
|
||||||
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
public TValue GetValue<TConfiguration, TValue>(Func<TConfiguration, TValue> query) where TConfiguration : SkinConfiguration => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -135,6 +135,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
});
|
});
|
||||||
|
|
||||||
downloadAssert(true);
|
downloadAssert(true);
|
||||||
|
|
||||||
|
AddStep("show many difficulties", () => overlay.ShowBeatmapSet(createManyDifficultiesBeatmapSet()));
|
||||||
|
downloadAssert(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -222,6 +225,56 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep(@"show without reload", overlay.Show);
|
AddStep(@"show without reload", overlay.Show);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private BeatmapSetInfo createManyDifficultiesBeatmapSet()
|
||||||
|
{
|
||||||
|
var beatmaps = new List<BeatmapInfo>();
|
||||||
|
|
||||||
|
for (int i = 1; i < 41; i++)
|
||||||
|
{
|
||||||
|
beatmaps.Add(new BeatmapInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapID = i * 10,
|
||||||
|
Version = $"Test #{i}",
|
||||||
|
Ruleset = Ruleset.Value,
|
||||||
|
StarDifficulty = 2 + i * 0.1,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
OverallDifficulty = 3.5f,
|
||||||
|
},
|
||||||
|
OnlineInfo = new BeatmapOnlineInfo(),
|
||||||
|
Metrics = new BeatmapMetrics
|
||||||
|
{
|
||||||
|
Fails = Enumerable.Range(1, 100).Select(j => j % 12 - 6).ToArray(),
|
||||||
|
Retries = Enumerable.Range(-2, 100).Select(j => j % 12 - 6).ToArray(),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapSetID = 123,
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Title = @"many difficulties beatmap",
|
||||||
|
Artist = @"none",
|
||||||
|
Author = new User
|
||||||
|
{
|
||||||
|
Username = @"BanchoBot",
|
||||||
|
Id = 3,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
OnlineInfo = new BeatmapSetOnlineInfo
|
||||||
|
{
|
||||||
|
Preview = @"https://b.ppy.sh/preview/123.mp3",
|
||||||
|
HasVideo = true,
|
||||||
|
HasStoryboard = true,
|
||||||
|
Covers = new BeatmapSetOnlineCovers(),
|
||||||
|
},
|
||||||
|
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
|
||||||
|
Beatmaps = beatmaps,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
private void downloadAssert(bool shown)
|
private void downloadAssert(bool shown)
|
||||||
{
|
{
|
||||||
AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.DownloadButtonsVisible == shown);
|
AddAssert($"is download button {(shown ? "shown" : "hidden")}", () => overlay.DownloadButtonsVisible == shown);
|
||||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -24,7 +23,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
typeof(IconPill)
|
typeof(IconPill)
|
||||||
};
|
};
|
||||||
|
|
||||||
private BeatmapSetInfo getUndownloadableBeatmapSet(RulesetInfo ruleset) => new BeatmapSetInfo
|
private BeatmapSetInfo getUndownloadableBeatmapSet() => new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
OnlineBeatmapSetID = 123,
|
OnlineBeatmapSetID = 123,
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
@ -56,23 +55,62 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
new BeatmapInfo
|
new BeatmapInfo
|
||||||
{
|
{
|
||||||
Ruleset = ruleset,
|
Ruleset = Ruleset.Value,
|
||||||
Version = "Test",
|
Version = "Test",
|
||||||
StarDifficulty = 6.42,
|
StarDifficulty = 6.42,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private BeatmapSetInfo getManyDifficultiesBeatmapSet(RulesetStore rulesets)
|
||||||
private void load()
|
|
||||||
{
|
{
|
||||||
var ruleset = new OsuRuleset().RulesetInfo;
|
var beatmaps = new List<BeatmapInfo>();
|
||||||
|
|
||||||
var normal = CreateWorkingBeatmap(ruleset).BeatmapSetInfo;
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
beatmaps.Add(new BeatmapInfo
|
||||||
|
{
|
||||||
|
Ruleset = rulesets.GetRuleset(i % 4),
|
||||||
|
StarDifficulty = 2 + i % 4 * 2,
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
OverallDifficulty = 3.5f,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return new BeatmapSetInfo
|
||||||
|
{
|
||||||
|
OnlineBeatmapSetID = 1,
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Title = "many difficulties beatmap",
|
||||||
|
Artist = "test",
|
||||||
|
Author = new User
|
||||||
|
{
|
||||||
|
Username = "BanchoBot",
|
||||||
|
Id = 3,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
OnlineInfo = new BeatmapSetOnlineInfo
|
||||||
|
{
|
||||||
|
HasVideo = true,
|
||||||
|
HasStoryboard = true,
|
||||||
|
Covers = new BeatmapSetOnlineCovers(),
|
||||||
|
},
|
||||||
|
Beatmaps = beatmaps,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(RulesetStore rulesets)
|
||||||
|
{
|
||||||
|
var normal = CreateWorkingBeatmap(Ruleset.Value).BeatmapSetInfo;
|
||||||
normal.OnlineInfo.HasVideo = true;
|
normal.OnlineInfo.HasVideo = true;
|
||||||
normal.OnlineInfo.HasStoryboard = true;
|
normal.OnlineInfo.HasStoryboard = true;
|
||||||
|
|
||||||
var undownloadable = getUndownloadableBeatmapSet(ruleset);
|
var undownloadable = getUndownloadableBeatmapSet();
|
||||||
|
var manyDifficulties = getManyDifficultiesBeatmapSet(rulesets);
|
||||||
|
|
||||||
Child = new BasicScrollContainer
|
Child = new BasicScrollContainer
|
||||||
{
|
{
|
||||||
@ -81,15 +119,17 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Full,
|
||||||
Padding = new MarginPadding(20),
|
Padding = new MarginPadding(20),
|
||||||
Spacing = new Vector2(0, 20),
|
Spacing = new Vector2(5, 20),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DirectGridPanel(normal),
|
new DirectGridPanel(normal),
|
||||||
new DirectListPanel(normal),
|
|
||||||
new DirectGridPanel(undownloadable),
|
new DirectGridPanel(undownloadable),
|
||||||
|
new DirectGridPanel(manyDifficulties),
|
||||||
|
new DirectListPanel(normal),
|
||||||
new DirectListPanel(undownloadable),
|
new DirectListPanel(undownloadable),
|
||||||
|
new DirectListPanel(manyDifficulties),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -516,6 +516,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
OnlineBeatmapID = b * 10,
|
OnlineBeatmapID = b * 10,
|
||||||
Path = $"extra{b}.osu",
|
Path = $"extra{b}.osu",
|
||||||
Version = $"Extra {b}",
|
Version = $"Extra {b}",
|
||||||
|
Ruleset = rulesets.GetRuleset((b - 1) % 4),
|
||||||
StarDifficulty = 2,
|
StarDifficulty = 2,
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.MathUtils;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -79,8 +80,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default));
|
||||||
|
|
||||||
Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
|
|
||||||
|
Dependencies.Cache(config = new OsuConfigManager(LocalStorage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private OsuConfigManager config;
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public virtual void SetUp() => Schedule(() =>
|
public virtual void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
@ -111,13 +116,15 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
|
AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap);
|
||||||
|
|
||||||
AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; });
|
var sortMode = config.GetBindable<SortMode>(OsuSetting.SongSelectSortingMode);
|
||||||
AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; });
|
|
||||||
AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; });
|
AddStep(@"Sort by Artist", delegate { sortMode.Value = SortMode.Artist; });
|
||||||
AddStep(@"Sort by DateAdded", delegate { songSelect.FilterControl.Sort = SortMode.DateAdded; });
|
AddStep(@"Sort by Title", delegate { sortMode.Value = SortMode.Title; });
|
||||||
AddStep(@"Sort by BPM", delegate { songSelect.FilterControl.Sort = SortMode.BPM; });
|
AddStep(@"Sort by Author", delegate { sortMode.Value = SortMode.Author; });
|
||||||
AddStep(@"Sort by Length", delegate { songSelect.FilterControl.Sort = SortMode.Length; });
|
AddStep(@"Sort by DateAdded", delegate { sortMode.Value = SortMode.DateAdded; });
|
||||||
AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; });
|
AddStep(@"Sort by BPM", delegate { sortMode.Value = SortMode.BPM; });
|
||||||
|
AddStep(@"Sort by Length", delegate { sortMode.Value = SortMode.Length; });
|
||||||
|
AddStep(@"Sort by Difficulty", delegate { sortMode.Value = SortMode.Difficulty; });
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.14.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.15.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Project">
|
<PropertyGroup Label="Project">
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A Beatmap containing converted HitObjects.
|
/// A Beatmap containing converted HitObjects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class Beatmap<T> : IBeatmap
|
public class Beatmap<T> : IBeatmap<T>
|
||||||
where T : HitObject
|
where T : HitObject
|
||||||
{
|
{
|
||||||
public BeatmapInfo BeatmapInfo { get; set; } = new BeatmapInfo
|
public BeatmapInfo BeatmapInfo { get; set; } = new BeatmapInfo
|
||||||
@ -36,17 +36,13 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public List<BreakPeriod> Breaks { get; set; } = new List<BreakPeriod>();
|
public List<BreakPeriod> Breaks { get; set; } = new List<BreakPeriod>();
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Total amount of break time in the beatmap.
|
|
||||||
/// </summary>
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
public double TotalBreakTime => Breaks.Sum(b => b.Duration);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The HitObjects this Beatmap contains.
|
|
||||||
/// </summary>
|
|
||||||
[JsonConverter(typeof(TypedListConverter<HitObject>))]
|
[JsonConverter(typeof(TypedListConverter<HitObject>))]
|
||||||
public List<T> HitObjects = new List<T>();
|
public List<T> HitObjects { get; set; } = new List<T>();
|
||||||
|
|
||||||
|
IReadOnlyList<T> IBeatmap<T>.HitObjects => HitObjects;
|
||||||
|
|
||||||
IReadOnlyList<HitObject> IBeatmap.HitObjects => HitObjects;
|
IReadOnlyList<HitObject> IBeatmap.HitObjects => HitObjects;
|
||||||
|
|
||||||
|
@ -138,19 +138,15 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override Skin GetSkin()
|
protected override Skin GetSkin()
|
||||||
{
|
{
|
||||||
Skin skin;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
skin = new LegacyBeatmapSkin(BeatmapInfo, store, AudioManager);
|
return new LegacyBeatmapSkin(BeatmapInfo, store, AudioManager);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
Logger.Error(e, "Skin failed to load");
|
Logger.Error(e, "Skin failed to load");
|
||||||
skin = new DefaultSkin();
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return skin;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public TimeSignatures TimeSignature = TimeSignatures.SimpleQuadruple;
|
public TimeSignatures TimeSignature = TimeSignatures.SimpleQuadruple;
|
||||||
|
|
||||||
|
public const double DEFAULT_BEAT_LENGTH = 1000;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The beat length at this control point.
|
/// The beat length at this control point.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -23,7 +25,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
|||||||
set => beatLength = MathHelper.Clamp(value, 6, 60000);
|
set => beatLength = MathHelper.Clamp(value, 6, 60000);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double beatLength = 1000;
|
private double beatLength = DEFAULT_BEAT_LENGTH;
|
||||||
|
|
||||||
public bool Equals(TimingControlPoint other)
|
public bool Equals(TimingControlPoint other)
|
||||||
=> base.Equals(other)
|
=> base.Equals(other)
|
||||||
|
@ -19,23 +19,33 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Beatmaps.Drawables
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
{
|
{
|
||||||
public class DifficultyIcon : Container, IHasCustomTooltip
|
public class DifficultyIcon : CompositeDrawable, IHasCustomTooltip
|
||||||
{
|
{
|
||||||
private readonly BeatmapInfo beatmap;
|
private readonly BeatmapInfo beatmap;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
|
private readonly Container iconContainer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Size of this difficulty icon.
|
||||||
|
/// </summary>
|
||||||
|
public new Vector2 Size
|
||||||
|
{
|
||||||
|
get => iconContainer.Size;
|
||||||
|
set => iconContainer.Size = value;
|
||||||
|
}
|
||||||
|
|
||||||
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null, bool shouldShowTooltip = true)
|
public DifficultyIcon(BeatmapInfo beatmap, RulesetInfo ruleset = null, bool shouldShowTooltip = true)
|
||||||
{
|
{
|
||||||
if (beatmap == null)
|
this.beatmap = beatmap ?? throw new ArgumentNullException(nameof(beatmap));
|
||||||
throw new ArgumentNullException(nameof(beatmap));
|
|
||||||
|
|
||||||
this.beatmap = beatmap;
|
|
||||||
|
|
||||||
this.ruleset = ruleset ?? beatmap.Ruleset;
|
this.ruleset = ruleset ?? beatmap.Ruleset;
|
||||||
if (shouldShowTooltip)
|
if (shouldShowTooltip)
|
||||||
TooltipContent = beatmap;
|
TooltipContent = beatmap;
|
||||||
|
|
||||||
Size = new Vector2(20);
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = iconContainer = new Container { Size = new Vector2(20f) };
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TooltipText { get; set; }
|
public string TooltipText { get; set; }
|
||||||
@ -47,7 +57,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
iconContainer.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new CircularContainer
|
new CircularContainer
|
||||||
{
|
{
|
||||||
|
37
osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs
Normal file
37
osu.Game/Beatmaps/Drawables/GroupedDifficultyIcon.cs
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A difficulty icon that contains a counter on the right-side of it.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Used in cases when there are too many difficulty icons to show.
|
||||||
|
/// </remarks>
|
||||||
|
public class GroupedDifficultyIcon : DifficultyIcon
|
||||||
|
{
|
||||||
|
public GroupedDifficultyIcon(List<BeatmapInfo> beatmaps, RulesetInfo ruleset, Color4 counterColour)
|
||||||
|
: base(beatmaps.OrderBy(b => b.StarDifficulty).Last(), ruleset, false)
|
||||||
|
{
|
||||||
|
AddInternal(new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.CentreRight,
|
||||||
|
Origin = Anchor.CentreRight,
|
||||||
|
Padding = new MarginPadding { Left = Size.X },
|
||||||
|
Margin = new MarginPadding { Left = 2, Right = 5 },
|
||||||
|
Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold),
|
||||||
|
Text = beatmaps.Count.ToString(),
|
||||||
|
Colour = counterColour,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -54,7 +54,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, IReadOnlyList<Mod> mods)
|
public override DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint
|
private class LegacyDifficultyCalculatorControlPoint : TimingControlPoint
|
||||||
{
|
{
|
||||||
public override double BeatLength { get; set; } = 1000;
|
public override double BeatLength { get; set; } = DEFAULT_BEAT_LENGTH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
var layer = parseLayer(split[2]);
|
var layer = parseLayer(split[2]);
|
||||||
var path = cleanFilename(split[3]);
|
var path = cleanFilename(split[3]);
|
||||||
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
|
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
|
||||||
storyboard.GetLayer(layer).Add(new StoryboardSample(path, time, volume));
|
storyboard.GetLayer(layer).Add(new StoryboardSampleInfo(path, time, (int)volume));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,4 +53,13 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The shallow-cloned beatmap.</returns>
|
/// <returns>The shallow-cloned beatmap.</returns>
|
||||||
IBeatmap Clone();
|
IBeatmap Clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IBeatmap<out T> : IBeatmap
|
||||||
|
where T : HitObject
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The hitobjects contained by this beatmap.
|
||||||
|
/// </summary>
|
||||||
|
new IReadOnlyList<T> HitObjects { get; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
61
osu.Game/Beatmaps/IWorkingBeatmap.cs
Normal file
61
osu.Game/Beatmaps/IWorkingBeatmap.cs
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
public interface IWorkingBeatmap
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="IBeatmap"/> which this <see cref="WorkingBeatmap"/> represents.
|
||||||
|
/// </summary>
|
||||||
|
IBeatmap Beatmap { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the background for this <see cref="WorkingBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
Texture Background { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the audio track for this <see cref="WorkingBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
Track Track { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="Waveform"/> for the <see cref="Track"/> of this <see cref="WorkingBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
Waveform Waveform { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="Storyboard"/> which this <see cref="WorkingBeatmap"/> provides.
|
||||||
|
/// </summary>
|
||||||
|
Storyboard Storyboard { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the <see cref="Skin"/> which this <see cref="WorkingBeatmap"/> provides.
|
||||||
|
/// </summary>
|
||||||
|
Skin Skin { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructs a playable <see cref="IBeatmap"/> from <see cref="Beatmap"/> using the applicable converters for a specific <see cref="RulesetInfo"/>.
|
||||||
|
/// <para>
|
||||||
|
/// The returned <see cref="IBeatmap"/> is in a playable state - all <see cref="HitObject"/> and <see cref="BeatmapDifficulty"/> <see cref="Mod"/>s
|
||||||
|
/// have been applied, and <see cref="HitObject"/>s have been fully constructed.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ruleset">The <see cref="RulesetInfo"/> to create a playable <see cref="IBeatmap"/> for.</param>
|
||||||
|
/// <param name="mods">The <see cref="Mod"/>s to apply to the <see cref="IBeatmap"/>.</param>
|
||||||
|
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
||||||
|
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
||||||
|
IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods);
|
||||||
|
}
|
||||||
|
}
|
@ -16,14 +16,13 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Statistics;
|
using osu.Framework.Statistics;
|
||||||
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.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public abstract class WorkingBeatmap : IDisposable
|
public abstract class WorkingBeatmap : IWorkingBeatmap, IDisposable
|
||||||
{
|
{
|
||||||
public readonly BeatmapInfo BeatmapInfo;
|
public readonly BeatmapInfo BeatmapInfo;
|
||||||
|
|
||||||
@ -97,17 +96,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The applicable <see cref="IBeatmapConverter"/>.</returns>
|
/// <returns>The applicable <see cref="IBeatmapConverter"/>.</returns>
|
||||||
protected virtual IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) => ruleset.CreateBeatmapConverter(beatmap);
|
protected virtual IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap, Ruleset ruleset) => ruleset.CreateBeatmapConverter(beatmap);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Constructs a playable <see cref="IBeatmap"/> from <see cref="Beatmap"/> using the applicable converters for a specific <see cref="RulesetInfo"/>.
|
|
||||||
/// <para>
|
|
||||||
/// The returned <see cref="IBeatmap"/> is in a playable state - all <see cref="HitObject"/> and <see cref="BeatmapDifficulty"/> <see cref="Mod"/>s
|
|
||||||
/// have been applied, and <see cref="HitObject"/>s have been fully constructed.
|
|
||||||
/// </para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ruleset">The <see cref="RulesetInfo"/> to create a playable <see cref="IBeatmap"/> for.</param>
|
|
||||||
/// <param name="mods">The <see cref="Mod"/>s to apply to the <see cref="IBeatmap"/>.</param>
|
|
||||||
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
|
||||||
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
|
||||||
public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods)
|
public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods)
|
||||||
{
|
{
|
||||||
var rulesetInstance = ruleset.CreateInstance();
|
var rulesetInstance = ruleset.CreateInstance();
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Platform;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
using osu.Game.Screens.Select.Filter;
|
||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
{
|
{
|
||||||
@ -17,7 +18,7 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
// UI/selection defaults
|
// UI/selection defaults
|
||||||
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
|
Set(OsuSetting.Ruleset, 0, 0, int.MaxValue);
|
||||||
Set(OsuSetting.Skin, 0, 0, int.MaxValue);
|
Set(OsuSetting.Skin, 0, -1, int.MaxValue);
|
||||||
|
|
||||||
Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details);
|
Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details);
|
||||||
|
|
||||||
@ -25,6 +26,9 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1);
|
||||||
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
|
Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1);
|
||||||
|
|
||||||
|
Set(OsuSetting.SongSelectGroupingMode, GroupMode.All);
|
||||||
|
Set(OsuSetting.SongSelectSortingMode, SortMode.Title);
|
||||||
|
|
||||||
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation);
|
||||||
|
|
||||||
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1);
|
||||||
@ -152,6 +156,8 @@ namespace osu.Game.Configuration
|
|||||||
SaveUsername,
|
SaveUsername,
|
||||||
DisplayStarsMinimum,
|
DisplayStarsMinimum,
|
||||||
DisplayStarsMaximum,
|
DisplayStarsMaximum,
|
||||||
|
SongSelectGroupingMode,
|
||||||
|
SongSelectSortingMode,
|
||||||
RandomSelectAlgorithm,
|
RandomSelectAlgorithm,
|
||||||
ShowFpsDisplay,
|
ShowFpsDisplay,
|
||||||
ChatDisplayHeight,
|
ChatDisplayHeight,
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.Overlays;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
|
[Cached(typeof(IPreviewTrackOwner))]
|
||||||
public abstract class OsuFocusedOverlayContainer : FocusedOverlayContainer, IPreviewTrackOwner, IKeyBindingHandler<GlobalAction>
|
public abstract class OsuFocusedOverlayContainer : FocusedOverlayContainer, IPreviewTrackOwner, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private SampleChannel samplePopIn;
|
private SampleChannel samplePopIn;
|
||||||
@ -38,13 +39,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
||||||
{
|
|
||||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
||||||
dependencies.CacheAs<IPreviewTrackOwner>(this);
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
@ -68,15 +62,23 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
closeIfOutside(e);
|
||||||
{
|
|
||||||
Hide();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnClick(e);
|
return base.OnClick(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnDragEnd(DragEndEvent e)
|
||||||
|
{
|
||||||
|
closeIfOutside(e);
|
||||||
|
return base.OnDragEnd(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void closeIfOutside(MouseEvent e)
|
||||||
|
{
|
||||||
|
if (!base.ReceivePositionalInputAt(e.ScreenSpaceMousePosition))
|
||||||
|
Hide();
|
||||||
|
}
|
||||||
|
|
||||||
public virtual bool OnPressed(GlobalAction action)
|
public virtual bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
switch (action)
|
switch (action)
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
// 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 Humanizer;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics
|
namespace osu.Game.Graphics
|
||||||
{
|
{
|
||||||
@ -71,7 +71,7 @@ namespace osu.Game.Graphics
|
|||||||
Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate);
|
Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual string Format() => Date.Humanize();
|
protected virtual string Format() => HumanizerUtils.Humanize(Date);
|
||||||
|
|
||||||
private void updateTime() => Text = Format();
|
private void updateTime() => Text = Format();
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ using SixLabors.ImageSharp;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics
|
namespace osu.Game.Graphics
|
||||||
{
|
{
|
||||||
public class ScreenshotManager : Container, IKeyBindingHandler<GlobalAction>, IHandleGlobalInput
|
public class ScreenshotManager : Container, IKeyBindingHandler<GlobalAction>, IHandleGlobalKeyboardInput
|
||||||
{
|
{
|
||||||
private readonly BindableBool cursorVisibility = new BindableBool(true);
|
private readonly BindableBool cursorVisibility = new BindableBool(true);
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ using osu.Framework.Input.Bindings;
|
|||||||
|
|
||||||
namespace osu.Game.Input.Bindings
|
namespace osu.Game.Input.Bindings
|
||||||
{
|
{
|
||||||
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalInput
|
public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalKeyboardInput
|
||||||
{
|
{
|
||||||
private readonly Drawable handler;
|
private readonly Drawable handler;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Input
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Track whether the end-user is in an idle state, based on their last interaction with the game.
|
/// Track whether the end-user is in an idle state, based on their last interaction with the game.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class IdleTracker : Component, IKeyBindingHandler<PlatformAction>, IHandleGlobalInput
|
public class IdleTracker : Component, IKeyBindingHandler<PlatformAction>, IHandleGlobalKeyboardInput
|
||||||
{
|
{
|
||||||
private readonly double timeToIdle;
|
private readonly double timeToIdle;
|
||||||
|
|
||||||
|
@ -182,7 +182,26 @@ namespace osu.Game
|
|||||||
// bind config int to database SkinInfo
|
// bind config int to database SkinInfo
|
||||||
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
|
configSkin = LocalConfig.GetBindable<int>(OsuSetting.Skin);
|
||||||
SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
|
SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID;
|
||||||
configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default;
|
configSkin.ValueChanged += skinId =>
|
||||||
|
{
|
||||||
|
var skinInfo = SkinManager.Query(s => s.ID == skinId.NewValue);
|
||||||
|
|
||||||
|
if (skinInfo == null)
|
||||||
|
{
|
||||||
|
switch (skinId.NewValue)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
skinInfo = DefaultLegacySkin.Info;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
skinInfo = SkinInfo.Default;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SkinManager.CurrentSkinInfo.Value = skinInfo;
|
||||||
|
};
|
||||||
configSkin.TriggerChange();
|
configSkin.TriggerChange();
|
||||||
|
|
||||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
runMigrations();
|
runMigrations();
|
||||||
|
|
||||||
dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio));
|
dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy")));
|
||||||
dependencies.CacheAs<ISkinSource>(SkinManager);
|
dependencies.CacheAs<ISkinSource>(SkinManager);
|
||||||
|
|
||||||
API = new APIAccess(LocalConfig);
|
API = new APIAccess(LocalConfig);
|
||||||
|
@ -91,7 +91,8 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
difficulties = new DifficultiesContainer
|
difficulties = new DifficultiesContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
Margin = new MarginPadding { Left = -(tile_icon_padding + tile_spacing / 2) },
|
Margin = new MarginPadding { Left = -(tile_icon_padding + tile_spacing / 2) },
|
||||||
OnLostHover = () =>
|
OnLostHover = () =>
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// 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 Humanizer;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -14,6 +13,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -132,7 +132,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
{
|
{
|
||||||
avatar.User = value.User;
|
avatar.User = value.User;
|
||||||
flag.Country = value.User.Country;
|
flag.Country = value.User.Country;
|
||||||
date.Text = $@"achieved {value.Date.Humanize()}";
|
date.Text = $@"achieved {HumanizerUtils.Humanize(value.Date)}";
|
||||||
|
|
||||||
usernameText.Clear();
|
usernameText.Clear();
|
||||||
usernameText.AddUserLink(value.User);
|
usernameText.AddUserLink(value.User);
|
||||||
|
@ -151,7 +151,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Height = 20,
|
Height = 20,
|
||||||
Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding },
|
Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding },
|
||||||
Children = GetDifficultyIcons(),
|
Children = GetDifficultyIcons(colours),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -129,7 +129,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Height = 20,
|
Height = 20,
|
||||||
Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding },
|
Margin = new MarginPadding { Top = vertical_padding, Bottom = vertical_padding },
|
||||||
Children = GetDifficultyIcons(),
|
Children = GetDifficultyIcons(colours),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
public readonly BeatmapSetInfo SetInfo;
|
public readonly BeatmapSetInfo SetInfo;
|
||||||
|
|
||||||
private const double hover_transition_time = 400;
|
private const double hover_transition_time = 400;
|
||||||
|
private const int maximum_difficulty_icons = 15;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
|
|
||||||
@ -138,12 +139,18 @@ namespace osu.Game.Overlays.Direct
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<DifficultyIcon> GetDifficultyIcons()
|
protected List<DifficultyIcon> GetDifficultyIcons(OsuColour colours)
|
||||||
{
|
{
|
||||||
var icons = new List<DifficultyIcon>();
|
var icons = new List<DifficultyIcon>();
|
||||||
|
|
||||||
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty))
|
if (SetInfo.Beatmaps.Count > maximum_difficulty_icons)
|
||||||
icons.Add(new DifficultyIcon(b));
|
{
|
||||||
|
foreach (var ruleset in SetInfo.Beatmaps.Select(b => b.Ruleset).Distinct())
|
||||||
|
icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset)), ruleset, this is DirectListPanel ? Color4.White : colours.Gray5));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty))
|
||||||
|
icons.Add(new DifficultyIcon(b));
|
||||||
|
|
||||||
return icons;
|
return icons;
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
// 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.Linq;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||||
{
|
{
|
||||||
public class PaginatedBeatmapContainer : PaginatedContainer
|
public class PaginatedBeatmapContainer : PaginatedContainer<APIBeatmapSet>
|
||||||
{
|
{
|
||||||
private const float panel_padding = 10f;
|
private const float panel_padding = 10f;
|
||||||
private readonly BeatmapSetType type;
|
private readonly BeatmapSetType type;
|
||||||
private GetUserBeatmapsRequest request;
|
|
||||||
|
|
||||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string header, string missing = "None... yet.")
|
||||||
: base(user, header, missing)
|
: base(user, header, missing)
|
||||||
@ -27,40 +28,15 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
|||||||
ItemsContainer.Spacing = new Vector2(panel_padding);
|
ItemsContainer.Spacing = new Vector2(panel_padding);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ShowMore()
|
protected override APIRequest<List<APIBeatmapSet>> CreateRequest() =>
|
||||||
{
|
new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
||||||
request = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
|
||||||
request.Success += sets => Schedule(() =>
|
protected override Drawable CreateDrawableItem(APIBeatmapSet model) => !model.OnlineBeatmapSetID.HasValue
|
||||||
|
? null
|
||||||
|
: new DirectGridPanel(model.ToBeatmapSet(Rulesets))
|
||||||
{
|
{
|
||||||
MoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0);
|
Anchor = Anchor.TopCentre,
|
||||||
MoreButton.IsLoading = false;
|
Origin = Anchor.TopCentre,
|
||||||
|
};
|
||||||
if (!sets.Any() && VisiblePages == 1)
|
|
||||||
{
|
|
||||||
MissingText.Show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var s in sets)
|
|
||||||
{
|
|
||||||
if (!s.OnlineBeatmapSetID.HasValue)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
ItemsContainer.Add(new DirectGridPanel(s.ToBeatmapSet(Rulesets))
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Api.Queue(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
request?.Cancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
// 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.Linq;
|
using System.Collections.Generic;
|
||||||
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.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Historical
|
namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||||
{
|
{
|
||||||
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer
|
public class PaginatedMostPlayedBeatmapContainer : PaginatedContainer<APIUserMostPlayedBeatmap>
|
||||||
{
|
{
|
||||||
private GetUserMostPlayedBeatmapsRequest request;
|
|
||||||
|
|
||||||
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
|
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
|
||||||
: base(user, "Most Played Beatmaps", "No records. :(")
|
: base(user, "Most Played Beatmaps", "No records. :(")
|
||||||
{
|
{
|
||||||
@ -22,35 +22,10 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
ItemsContainer.Direction = FillDirection.Vertical;
|
ItemsContainer.Direction = FillDirection.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ShowMore()
|
protected override APIRequest<List<APIUserMostPlayedBeatmap>> CreateRequest() =>
|
||||||
{
|
new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
|
||||||
request = new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
|
|
||||||
request.Success += beatmaps => Schedule(() =>
|
|
||||||
{
|
|
||||||
MoreButton.FadeTo(beatmaps.Count == ItemsPerPage ? 1 : 0);
|
|
||||||
MoreButton.IsLoading = false;
|
|
||||||
|
|
||||||
if (!beatmaps.Any() && VisiblePages == 1)
|
protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap model) =>
|
||||||
{
|
new DrawableMostPlayedBeatmap(model.GetBeatmapInfo(Rulesets), model.PlayCount);
|
||||||
MissingText.Show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MissingText.Hide();
|
|
||||||
|
|
||||||
foreach (var beatmap in beatmaps)
|
|
||||||
{
|
|
||||||
ItemsContainer.Add(new DrawableMostPlayedBeatmap(beatmap.GetBeatmapInfo(Rulesets), beatmap.PlayCount));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Api.Queue(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
request?.Cancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,22 +11,27 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections
|
namespace osu.Game.Overlays.Profile.Sections
|
||||||
{
|
{
|
||||||
public abstract class PaginatedContainer : FillFlowContainer
|
public abstract class PaginatedContainer<TModel> : FillFlowContainer
|
||||||
{
|
{
|
||||||
protected readonly FillFlowContainer ItemsContainer;
|
private readonly ShowMoreButton moreButton;
|
||||||
protected readonly ShowMoreButton MoreButton;
|
private readonly OsuSpriteText missingText;
|
||||||
protected readonly OsuSpriteText MissingText;
|
private APIRequest<List<TModel>> retrievalRequest;
|
||||||
|
private CancellationTokenSource loadCancellation;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
protected int VisiblePages;
|
protected int VisiblePages;
|
||||||
protected int ItemsPerPage;
|
protected int ItemsPerPage;
|
||||||
|
|
||||||
protected readonly Bindable<User> User = new Bindable<User>();
|
protected readonly Bindable<User> User = new Bindable<User>();
|
||||||
|
protected readonly FillFlowContainer ItemsContainer;
|
||||||
protected IAPIProvider Api;
|
|
||||||
protected APIRequest RetrievalRequest;
|
|
||||||
protected RulesetStore Rulesets;
|
protected RulesetStore Rulesets;
|
||||||
|
|
||||||
protected PaginatedContainer(Bindable<User> user, string header, string missing)
|
protected PaginatedContainer(Bindable<User> user, string header, string missing)
|
||||||
@ -51,15 +56,15 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Spacing = new Vector2(0, 2),
|
Spacing = new Vector2(0, 2),
|
||||||
},
|
},
|
||||||
MoreButton = new ShowMoreButton
|
moreButton = new ShowMoreButton
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Margin = new MarginPadding { Top = 10 },
|
Margin = new MarginPadding { Top = 10 },
|
||||||
Action = ShowMore,
|
Action = showMore,
|
||||||
},
|
},
|
||||||
MissingText = new OsuSpriteText
|
missingText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 15),
|
Font = OsuFont.GetFont(size: 15),
|
||||||
Text = missing,
|
Text = missing,
|
||||||
@ -69,9 +74,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api, RulesetStore rulesets)
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
Api = api;
|
|
||||||
Rulesets = rulesets;
|
Rulesets = rulesets;
|
||||||
|
|
||||||
User.ValueChanged += onUserChanged;
|
User.ValueChanged += onUserChanged;
|
||||||
@ -80,13 +84,54 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
private void onUserChanged(ValueChangedEvent<User> e)
|
private void onUserChanged(ValueChangedEvent<User> e)
|
||||||
{
|
{
|
||||||
|
loadCancellation?.Cancel();
|
||||||
|
retrievalRequest?.Cancel();
|
||||||
|
|
||||||
VisiblePages = 0;
|
VisiblePages = 0;
|
||||||
ItemsContainer.Clear();
|
ItemsContainer.Clear();
|
||||||
|
|
||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
ShowMore();
|
showMore();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void ShowMore();
|
private void showMore()
|
||||||
|
{
|
||||||
|
loadCancellation = new CancellationTokenSource();
|
||||||
|
|
||||||
|
retrievalRequest = CreateRequest();
|
||||||
|
retrievalRequest.Success += UpdateItems;
|
||||||
|
|
||||||
|
api.Queue(retrievalRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void UpdateItems(List<TModel> items) => Schedule(() =>
|
||||||
|
{
|
||||||
|
if (!items.Any() && VisiblePages == 1)
|
||||||
|
{
|
||||||
|
moreButton.Hide();
|
||||||
|
moreButton.IsLoading = false;
|
||||||
|
missingText.Show();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LoadComponentsAsync(items.Select(CreateDrawableItem).Where(d => d != null), drawables =>
|
||||||
|
{
|
||||||
|
missingText.Hide();
|
||||||
|
moreButton.FadeTo(items.Count == ItemsPerPage ? 1 : 0);
|
||||||
|
moreButton.IsLoading = false;
|
||||||
|
|
||||||
|
ItemsContainer.AddRange(drawables);
|
||||||
|
}, loadCancellation.Token);
|
||||||
|
});
|
||||||
|
|
||||||
|
protected abstract APIRequest<List<TModel>> CreateRequest();
|
||||||
|
|
||||||
|
protected abstract Drawable CreateDrawableItem(TModel model);
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
retrievalRequest?.Cancel();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,18 +5,18 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||||
{
|
{
|
||||||
public class PaginatedScoreContainer : PaginatedContainer
|
public class PaginatedScoreContainer : PaginatedContainer<APILegacyScoreInfo>
|
||||||
{
|
{
|
||||||
private readonly bool includeWeight;
|
private readonly bool includeWeight;
|
||||||
private readonly ScoreType type;
|
private readonly ScoreType type;
|
||||||
private GetUserScoresRequest request;
|
|
||||||
|
|
||||||
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing, bool includeWeight = false)
|
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string header, string missing, bool includeWeight = false)
|
||||||
: base(user, header, missing)
|
: base(user, header, missing)
|
||||||
@ -29,52 +29,27 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
ItemsContainer.Direction = FillDirection.Vertical;
|
ItemsContainer.Direction = FillDirection.Vertical;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ShowMore()
|
protected override void UpdateItems(List<APILegacyScoreInfo> items)
|
||||||
{
|
{
|
||||||
request = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
foreach (var item in items)
|
||||||
request.Success += scores => Schedule(() =>
|
item.Ruleset = Rulesets.GetRuleset(item.RulesetID);
|
||||||
{
|
|
||||||
foreach (var s in scores)
|
|
||||||
s.Ruleset = Rulesets.GetRuleset(s.RulesetID);
|
|
||||||
|
|
||||||
if (!scores.Any() && VisiblePages == 1)
|
base.UpdateItems(items);
|
||||||
{
|
|
||||||
MoreButton.Hide();
|
|
||||||
MoreButton.IsLoading = false;
|
|
||||||
MissingText.Show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
IEnumerable<DrawableProfileScore> drawableScores;
|
|
||||||
|
|
||||||
switch (type)
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
drawableScores = scores.Select(score => new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ScoreType.Recent:
|
|
||||||
drawableScores = scores.Select(score => new DrawableTotalScore(score));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
LoadComponentsAsync(drawableScores, s =>
|
|
||||||
{
|
|
||||||
MissingText.Hide();
|
|
||||||
MoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0);
|
|
||||||
MoreButton.IsLoading = false;
|
|
||||||
|
|
||||||
ItemsContainer.AddRange(s);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
Api.Queue(request);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override APIRequest<List<APILegacyScoreInfo>> CreateRequest() =>
|
||||||
|
new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
||||||
|
|
||||||
|
protected override Drawable CreateDrawableItem(APILegacyScoreInfo model)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
switch (type)
|
||||||
request?.Cancel();
|
{
|
||||||
|
default:
|
||||||
|
return new DrawablePerformanceScore(model, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null);
|
||||||
|
|
||||||
|
case ScoreType.Recent:
|
||||||
|
return new DrawableTotalScore(model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,51 +4,24 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Recent
|
namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||||
{
|
{
|
||||||
public class PaginatedRecentActivityContainer : PaginatedContainer
|
public class PaginatedRecentActivityContainer : PaginatedContainer<APIRecentActivity>
|
||||||
{
|
{
|
||||||
private GetUserRecentActivitiesRequest request;
|
|
||||||
|
|
||||||
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
public PaginatedRecentActivityContainer(Bindable<User> user, string header, string missing)
|
||||||
: base(user, header, missing)
|
: base(user, header, missing)
|
||||||
{
|
{
|
||||||
ItemsPerPage = 5;
|
ItemsPerPage = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void ShowMore()
|
protected override APIRequest<List<APIRecentActivity>> CreateRequest() =>
|
||||||
{
|
new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
|
||||||
request = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
|
|
||||||
request.Success += activities => Schedule(() =>
|
|
||||||
{
|
|
||||||
MoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0);
|
|
||||||
MoreButton.IsLoading = false;
|
|
||||||
|
|
||||||
if (!activities.Any() && VisiblePages == 1)
|
protected override Drawable CreateDrawableItem(APIRecentActivity model) => new DrawableRecentActivity(model);
|
||||||
{
|
|
||||||
MissingText.Show();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MissingText.Hide();
|
|
||||||
|
|
||||||
foreach (APIRecentActivity activity in activities)
|
|
||||||
{
|
|
||||||
ItemsContainer.Add(new DrawableRecentActivity(activity));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Api.Queue(request);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
request?.Cancel();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,14 +124,12 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
private class ChevronIcon : SpriteIcon
|
private class ChevronIcon : SpriteIcon
|
||||||
{
|
{
|
||||||
private const int bottom_margin = 2;
|
|
||||||
private const int icon_size = 8;
|
private const int icon_size = 8;
|
||||||
|
|
||||||
public ChevronIcon()
|
public ChevronIcon()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre;
|
Anchor = Anchor.Centre;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
Margin = new MarginPadding { Bottom = bottom_margin };
|
|
||||||
Size = new Vector2(icon_size);
|
Size = new Vector2(icon_size);
|
||||||
Icon = FontAwesome.Solid.ChevronDown;
|
Icon = FontAwesome.Solid.ChevronDown;
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Y = -15,
|
|
||||||
Size = new Vector2(15),
|
Size = new Vector2(15),
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
Icon = FontAwesome.Solid.ChevronLeft
|
Icon = FontAwesome.Solid.ChevronLeft
|
||||||
|
@ -65,16 +65,15 @@ namespace osu.Game.Overlays.Volume
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(20),
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Current.ValueChanged += muted =>
|
Current.BindValueChanged(muted =>
|
||||||
{
|
{
|
||||||
icon.Icon = muted.NewValue ? FontAwesome.Solid.VolumeMute : FontAwesome.Solid.VolumeUp;
|
icon.Icon = muted.NewValue ? FontAwesome.Solid.VolumeMute : FontAwesome.Solid.VolumeUp;
|
||||||
};
|
icon.Size = new Vector2(muted.NewValue ? 18 : 20);
|
||||||
|
icon.Margin = new MarginPadding { Right = muted.NewValue ? 2 : 0 };
|
||||||
Current.TriggerChange();
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
@ -9,7 +9,7 @@ using osu.Game.Input.Bindings;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Volume
|
namespace osu.Game.Overlays.Volume
|
||||||
{
|
{
|
||||||
public class VolumeControlReceptor : Container, IScrollBindingHandler<GlobalAction>, IHandleGlobalInput
|
public class VolumeControlReceptor : Container, IScrollBindingHandler<GlobalAction>, IHandleGlobalKeyboardInput
|
||||||
{
|
{
|
||||||
public Func<GlobalAction, bool> ActionRequested;
|
public Func<GlobalAction, bool> ActionRequested;
|
||||||
public Func<GlobalAction, float, bool, bool> ScrollActionRequested;
|
public Func<GlobalAction, float, bool, bool> ScrollActionRequested;
|
||||||
|
@ -1,116 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using System.Linq;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
|
||||||
{
|
|
||||||
public abstract class DrawableEditRuleset : CompositeDrawable
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// The <see cref="Playfield"/> contained by this <see cref="DrawableEditRuleset"/>.
|
|
||||||
/// </summary>
|
|
||||||
public abstract Playfield Playfield { get; }
|
|
||||||
|
|
||||||
public abstract PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer();
|
|
||||||
|
|
||||||
internal DrawableEditRuleset()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmap"/> and displays a visual representation of it.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
|
||||||
/// <returns>The visual representation of <paramref name="hitObject"/>.</returns>
|
|
||||||
internal abstract DrawableHitObject Add(HitObject hitObject);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Removes a <see cref="HitObject"/> from the <see cref="Beatmap"/> and the display.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to remove.</param>
|
|
||||||
/// <returns>The visual representation of the removed <paramref name="hitObject"/>.</returns>
|
|
||||||
internal abstract DrawableHitObject Remove(HitObject hitObject);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class DrawableEditRuleset<TObject> : DrawableEditRuleset
|
|
||||||
where TObject : HitObject
|
|
||||||
{
|
|
||||||
public override Playfield Playfield => drawableRuleset.Playfield;
|
|
||||||
|
|
||||||
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => drawableRuleset.CreatePlayfieldAdjustmentContainer();
|
|
||||||
|
|
||||||
private Ruleset ruleset => drawableRuleset.Ruleset;
|
|
||||||
private Beatmap<TObject> beatmap => drawableRuleset.Beatmap;
|
|
||||||
|
|
||||||
private readonly DrawableRuleset<TObject> drawableRuleset;
|
|
||||||
|
|
||||||
public DrawableEditRuleset(DrawableRuleset<TObject> drawableRuleset)
|
|
||||||
{
|
|
||||||
this.drawableRuleset = drawableRuleset;
|
|
||||||
|
|
||||||
InternalChild = drawableRuleset;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
drawableRuleset.FrameStablePlayback = false;
|
|
||||||
Playfield.DisplayJudgements.Value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override DrawableHitObject Add(HitObject hitObject)
|
|
||||||
{
|
|
||||||
var tObject = (TObject)hitObject;
|
|
||||||
|
|
||||||
// Add to beatmap, preserving sorting order
|
|
||||||
var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime);
|
|
||||||
beatmap.HitObjects.Insert(insertionIndex + 1, tObject);
|
|
||||||
|
|
||||||
// Process object
|
|
||||||
var processor = ruleset.CreateBeatmapProcessor(beatmap);
|
|
||||||
|
|
||||||
processor?.PreProcess();
|
|
||||||
tObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
|
|
||||||
processor?.PostProcess();
|
|
||||||
|
|
||||||
// Add visual representation
|
|
||||||
var drawableObject = drawableRuleset.CreateDrawableRepresentation(tObject);
|
|
||||||
|
|
||||||
drawableRuleset.Playfield.Add(drawableObject);
|
|
||||||
drawableRuleset.Playfield.PostProcess();
|
|
||||||
|
|
||||||
return drawableObject;
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override DrawableHitObject Remove(HitObject hitObject)
|
|
||||||
{
|
|
||||||
var tObject = (TObject)hitObject;
|
|
||||||
|
|
||||||
// Remove from beatmap
|
|
||||||
beatmap.HitObjects.Remove(tObject);
|
|
||||||
|
|
||||||
// Process the beatmap
|
|
||||||
var processor = ruleset.CreateBeatmapProcessor(beatmap);
|
|
||||||
|
|
||||||
processor?.PreProcess();
|
|
||||||
processor?.PostProcess();
|
|
||||||
|
|
||||||
// Remove visual representation
|
|
||||||
var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject);
|
|
||||||
|
|
||||||
drawableRuleset.Playfield.Remove(drawableObject);
|
|
||||||
drawableRuleset.Playfield.PostProcess();
|
|
||||||
|
|
||||||
return drawableObject;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
80
osu.Game/Rulesets/Edit/DrawableEditRulesetWrapper.cs
Normal file
80
osu.Game/Rulesets/Edit/DrawableEditRulesetWrapper.cs
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Edit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A wrapper for a <see cref="DrawableRuleset{TObject}"/>. Handles adding visual representations of <see cref="HitObject"/>s to the underlying <see cref="DrawableRuleset{TObject}"/>.
|
||||||
|
/// </summary>
|
||||||
|
internal class DrawableEditRulesetWrapper<TObject> : CompositeDrawable
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
public Playfield Playfield => drawableRuleset.Playfield;
|
||||||
|
|
||||||
|
private readonly DrawableRuleset<TObject> drawableRuleset;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IEditorBeatmap<TObject> beatmap { get; set; }
|
||||||
|
|
||||||
|
public DrawableEditRulesetWrapper(DrawableRuleset<TObject> drawableRuleset)
|
||||||
|
{
|
||||||
|
this.drawableRuleset = drawableRuleset;
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
InternalChild = drawableRuleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
drawableRuleset.FrameStablePlayback = false;
|
||||||
|
Playfield.DisplayJudgements.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
beatmap.HitObjectAdded += addHitObject;
|
||||||
|
beatmap.HitObjectRemoved += removeHitObject;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addHitObject(HitObject hitObject)
|
||||||
|
{
|
||||||
|
var drawableObject = drawableRuleset.CreateDrawableRepresentation((TObject)hitObject);
|
||||||
|
|
||||||
|
drawableRuleset.Playfield.Add(drawableObject);
|
||||||
|
drawableRuleset.Playfield.PostProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeHitObject(HitObject hitObject)
|
||||||
|
{
|
||||||
|
var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject);
|
||||||
|
|
||||||
|
drawableRuleset.Playfield.Remove(drawableObject);
|
||||||
|
drawableRuleset.Playfield.PostProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => drawableRuleset.CreatePlayfieldAdjustmentContainer();
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (beatmap != null)
|
||||||
|
{
|
||||||
|
beatmap.HitObjectAdded -= addHitObject;
|
||||||
|
beatmap.HitObjectRemoved -= removeHitObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -18,45 +18,47 @@ 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;
|
||||||
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Components.RadioButtons;
|
using osu.Game.Screens.Edit.Components.RadioButtons;
|
||||||
|
using osu.Game.Screens.Edit.Compose;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Edit
|
namespace osu.Game.Rulesets.Edit
|
||||||
{
|
{
|
||||||
public abstract class HitObjectComposer : CompositeDrawable
|
[Cached(Type = typeof(IPlacementHandler))]
|
||||||
|
public abstract class HitObjectComposer<TObject> : HitObjectComposer, IPlacementHandler
|
||||||
|
where TObject : HitObject
|
||||||
{
|
{
|
||||||
public IEnumerable<DrawableHitObject> HitObjects => DrawableRuleset.Playfield.AllHitObjects;
|
protected IRulesetConfigManager Config { get; private set; }
|
||||||
|
|
||||||
protected readonly Ruleset Ruleset;
|
protected readonly Ruleset Ruleset;
|
||||||
|
|
||||||
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
private IWorkingBeatmap workingBeatmap;
|
||||||
|
private Beatmap<TObject> playableBeatmap;
|
||||||
protected IRulesetConfigManager Config { get; private set; }
|
private EditorBeatmap<TObject> editorBeatmap;
|
||||||
|
private IBeatmapProcessor beatmapProcessor;
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
|
||||||
|
|
||||||
protected DrawableEditRuleset DrawableRuleset { get; private set; }
|
|
||||||
|
|
||||||
|
private DrawableEditRulesetWrapper<TObject> drawableRulesetWrapper;
|
||||||
private BlueprintContainer blueprintContainer;
|
private BlueprintContainer blueprintContainer;
|
||||||
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
|
|
||||||
private InputManager inputManager;
|
private InputManager inputManager;
|
||||||
|
|
||||||
internal HitObjectComposer(Ruleset ruleset)
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IBindable<WorkingBeatmap> beatmap, IFrameBasedClock framedClock)
|
private void load(IFrameBasedClock framedClock)
|
||||||
{
|
{
|
||||||
Beatmap.BindTo(beatmap);
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DrawableRuleset = CreateDrawableRuleset();
|
drawableRulesetWrapper = new DrawableEditRulesetWrapper<TObject>(CreateDrawableRuleset(Ruleset, workingBeatmap, Array.Empty<Mod>()))
|
||||||
DrawableRuleset.Clock = framedClock;
|
{
|
||||||
|
Clock = framedClock
|
||||||
|
};
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -64,10 +66,10 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var layerBelowRuleset = DrawableRuleset.CreatePlayfieldAdjustmentContainer();
|
var layerBelowRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer();
|
||||||
layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both };
|
layerBelowRuleset.Child = new EditorPlayfieldBorder { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
var layerAboveRuleset = DrawableRuleset.CreatePlayfieldAdjustmentContainer();
|
var layerAboveRuleset = drawableRulesetWrapper.CreatePlayfieldAdjustmentContainer();
|
||||||
layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer();
|
layerAboveRuleset.Child = blueprintContainer = new BlueprintContainer();
|
||||||
|
|
||||||
layerContainers.Add(layerBelowRuleset);
|
layerContainers.Add(layerBelowRuleset);
|
||||||
@ -98,7 +100,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
layerBelowRuleset,
|
layerBelowRuleset,
|
||||||
DrawableRuleset,
|
drawableRulesetWrapper,
|
||||||
layerAboveRuleset
|
layerAboveRuleset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -118,6 +120,28 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
toolboxCollection.Items[0].Select();
|
toolboxCollection.Items[0].Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
{
|
||||||
|
var parentWorkingBeatmap = parent.Get<IBindable<WorkingBeatmap>>().Value;
|
||||||
|
|
||||||
|
playableBeatmap = (Beatmap<TObject>)parentWorkingBeatmap.GetPlayableBeatmap(Ruleset.RulesetInfo, Array.Empty<Mod>());
|
||||||
|
workingBeatmap = new EditorWorkingBeatmap<TObject>(playableBeatmap, parentWorkingBeatmap);
|
||||||
|
|
||||||
|
beatmapProcessor = Ruleset.CreateBeatmapProcessor(playableBeatmap);
|
||||||
|
|
||||||
|
editorBeatmap = new EditorBeatmap<TObject>(playableBeatmap);
|
||||||
|
editorBeatmap.HitObjectAdded += addHitObject;
|
||||||
|
editorBeatmap.HitObjectRemoved += removeHitObject;
|
||||||
|
|
||||||
|
var dependencies = new DependencyContainer(parent);
|
||||||
|
dependencies.CacheAs<IEditorBeatmap>(editorBeatmap);
|
||||||
|
dependencies.CacheAs<IEditorBeatmap<TObject>>(editorBeatmap);
|
||||||
|
|
||||||
|
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
|
||||||
|
|
||||||
|
return base.CreateChildDependencies(dependencies);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -125,45 +149,76 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
|
||||||
{
|
|
||||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
|
||||||
|
|
||||||
dependencies.CacheAs(this);
|
|
||||||
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
|
|
||||||
|
|
||||||
return dependencies;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
{
|
{
|
||||||
base.UpdateAfterChildren();
|
base.UpdateAfterChildren();
|
||||||
|
|
||||||
layerContainers.ForEach(l =>
|
layerContainers.ForEach(l =>
|
||||||
{
|
{
|
||||||
l.Anchor = DrawableRuleset.Playfield.Anchor;
|
l.Anchor = drawableRulesetWrapper.Playfield.Anchor;
|
||||||
l.Origin = DrawableRuleset.Playfield.Origin;
|
l.Origin = drawableRulesetWrapper.Playfield.Origin;
|
||||||
l.Position = DrawableRuleset.Playfield.Position;
|
l.Position = drawableRulesetWrapper.Playfield.Position;
|
||||||
l.Size = DrawableRuleset.Playfield.Size;
|
l.Size = drawableRulesetWrapper.Playfield.Size;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addHitObject(HitObject hitObject)
|
||||||
|
{
|
||||||
|
beatmapProcessor?.PreProcess();
|
||||||
|
hitObject.ApplyDefaults(playableBeatmap.ControlPointInfo, playableBeatmap.BeatmapInfo.BaseDifficulty);
|
||||||
|
beatmapProcessor?.PostProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeHitObject(HitObject hitObject)
|
||||||
|
{
|
||||||
|
beatmapProcessor?.PreProcess();
|
||||||
|
beatmapProcessor?.PostProcess();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<DrawableHitObject> HitObjects => drawableRulesetWrapper.Playfield.AllHitObjects;
|
||||||
|
public override bool CursorInPlacementArea => drawableRulesetWrapper.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
|
||||||
|
|
||||||
|
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
||||||
|
|
||||||
|
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods);
|
||||||
|
|
||||||
|
public void BeginPlacement(HitObject hitObject)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndPlacement(HitObject hitObject) => editorBeatmap.Add(hitObject);
|
||||||
|
|
||||||
|
public void Delete(HitObject hitObject) => editorBeatmap.Remove(hitObject);
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (editorBeatmap != null)
|
||||||
|
{
|
||||||
|
editorBeatmap.HitObjectAdded -= addHitObject;
|
||||||
|
editorBeatmap.HitObjectRemoved -= removeHitObject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Cached(typeof(HitObjectComposer))]
|
||||||
|
public abstract class HitObjectComposer : CompositeDrawable
|
||||||
|
{
|
||||||
|
internal HitObjectComposer()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// All the <see cref="DrawableHitObject"/>s.
|
||||||
|
/// </summary>
|
||||||
|
public abstract IEnumerable<DrawableHitObject> HitObjects { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether the user's cursor is currently in an area of the <see cref="HitObjectComposer"/> that is valid for placement.
|
/// Whether the user's cursor is currently in an area of the <see cref="HitObjectComposer"/> that is valid for placement.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool CursorInPlacementArea => DrawableRuleset.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position);
|
public abstract bool CursorInPlacementArea { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Adds a <see cref="HitObject"/> to the <see cref="Beatmaps.Beatmap"/> and visualises it.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
|
||||||
public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(DrawableRuleset.Add(hitObject));
|
|
||||||
|
|
||||||
public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(DrawableRuleset.Remove(hitObject));
|
|
||||||
|
|
||||||
internal abstract DrawableEditRuleset CreateDrawableRuleset();
|
|
||||||
|
|
||||||
protected abstract IReadOnlyList<HitObjectCompositionTool> CompositionTools { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
|
/// Creates a <see cref="SelectionBlueprint"/> for a specific <see cref="DrawableHitObject"/>.
|
||||||
@ -176,18 +231,4 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual SelectionHandler CreateSelectionHandler() => new SelectionHandler();
|
public virtual SelectionHandler CreateSelectionHandler() => new SelectionHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class HitObjectComposer<TObject> : HitObjectComposer
|
|
||||||
where TObject : HitObject
|
|
||||||
{
|
|
||||||
protected HitObjectComposer(Ruleset ruleset)
|
|
||||||
: base(ruleset)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
internal override DrawableEditRuleset CreateDrawableRuleset()
|
|
||||||
=> new DrawableEditRuleset<TObject>(CreateDrawableRuleset(Ruleset, Beatmap.Value, Array.Empty<Mod>()));
|
|
||||||
|
|
||||||
protected abstract DrawableRuleset<TObject> CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap, IReadOnlyList<Mod> mods);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.TypeExtensions;
|
using osu.Framework.Extensions.TypeExtensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
@ -132,6 +133,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
|
public event Action<DrawableHitObject, ArmedState> ApplyCustomUpdateState;
|
||||||
|
|
||||||
|
#pragma warning disable 618 // (legacy state management) - can be removed 20200227
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enables automatic transform management of this hitobject. Implementation of transforms should be done in <see cref="UpdateInitialTransforms"/> and <see cref="UpdateStateTransforms"/> only. Rewinding and removing previous states is done automatically.
|
/// Enables automatic transform management of this hitobject. Implementation of transforms should be done in <see cref="UpdateInitialTransforms"/> and <see cref="UpdateStateTransforms"/> only. Rewinding and removing previous states is done automatically.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -139,6 +142,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// Going forward, this is the preferred way of implementing <see cref="DrawableHitObject"/>s. Previous functionality
|
/// Going forward, this is the preferred way of implementing <see cref="DrawableHitObject"/>s. Previous functionality
|
||||||
/// is offered as a compatibility layer until all rulesets have been migrated across.
|
/// is offered as a compatibility layer until all rulesets have been migrated across.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
|
[Obsolete("Use UpdateInitialTransforms()/UpdateStateTransforms() instead")] // can be removed 20200227
|
||||||
protected virtual bool UseTransformStateManagement => true;
|
protected virtual bool UseTransformStateManagement => true;
|
||||||
|
|
||||||
protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}");
|
protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}");
|
||||||
@ -183,6 +187,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
/// Apply (generally fade-in) transforms leading into the <see cref="HitObject"/> start time.
|
||||||
/// The local drawable hierarchy is recursively delayed to <see cref="LifetimeStart"/> for convenience.
|
/// The local drawable hierarchy is recursively delayed to <see cref="LifetimeStart"/> for convenience.
|
||||||
|
///
|
||||||
|
/// By default this will fade in the object from zero with no duration.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// This is called once before every <see cref="UpdateStateTransforms"/>. This is to ensure a good state in the case
|
/// This is called once before every <see cref="UpdateStateTransforms"/>. This is to ensure a good state in the case
|
||||||
@ -190,6 +196,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected virtual void UpdateInitialTransforms()
|
protected virtual void UpdateInitialTransforms()
|
||||||
{
|
{
|
||||||
|
this.FadeInFromZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -219,10 +226,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
/// Should generally not be used when <see cref="UseTransformStateManagement"/> is true; use <see cref="UpdateStateTransforms"/> instead.
|
/// Should generally not be used when <see cref="UseTransformStateManagement"/> is true; use <see cref="UpdateStateTransforms"/> instead.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="state">The new armed state.</param>
|
/// <param name="state">The new armed state.</param>
|
||||||
|
[Obsolete("Use UpdateInitialTransforms()/UpdateStateTransforms() instead")] // can be removed 20200227
|
||||||
protected virtual void UpdateState(ArmedState state)
|
protected virtual void UpdateState(ArmedState state)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma warning restore 618
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Replays
|
namespace osu.Game.Rulesets.Replays
|
||||||
{
|
{
|
||||||
@ -34,5 +35,13 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
protected const double KEY_UP_DELAY = 50;
|
protected const double KEY_UP_DELAY = 50;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
protected virtual HitObject GetNextObject(int currentIndex)
|
||||||
|
{
|
||||||
|
if (currentIndex >= Beatmap.HitObjects.Count - 1)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return Beatmap.HitObjects[currentIndex + 1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets
|
|||||||
/// <param name="mods">The <see cref="Mod"/>s to apply.</param>
|
/// <param name="mods">The <see cref="Mod"/>s to apply.</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, IReadOnlyList<Mod> mods);
|
public abstract DrawableRuleset CreateDrawableRulesetWith(IWorkingBeatmap 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"/>.
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Rulesets
|
|||||||
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
|
public IRulesetConfigManager GetConfigFor(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
if (ruleset.RulesetInfo.ID == null)
|
if (ruleset.RulesetInfo.ID == null)
|
||||||
throw new InvalidOperationException("The provided ruleset doesn't have a valid id.");
|
return null;
|
||||||
|
|
||||||
return configCache.GetOrAdd(ruleset.RulesetInfo.ID.Value, _ => ruleset.CreateConfig(settingsStore));
|
return configCache.GetOrAdd(ruleset.RulesetInfo.ID.Value, _ => ruleset.CreateConfig(settingsStore));
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,13 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The aggregate multiplier which this <see cref="MultiplierControlPoint"/> provides.
|
/// The aggregate multiplier which this <see cref="MultiplierControlPoint"/> provides.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double Multiplier => Velocity * DifficultyPoint.SpeedMultiplier * 1000 / TimingPoint.BeatLength;
|
public double Multiplier => Velocity * DifficultyPoint.SpeedMultiplier * BaseBeatLength / TimingPoint.BeatLength;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The base beat length to scale the <see cref="TimingPoint"/> provided multiplier relative to.
|
||||||
|
/// </summary>
|
||||||
|
/// <example>For a <see cref="BaseBeatLength"/> of 1000, a <see cref="TimingPoint"/> with a beat length of 500 will increase the multiplier by 2.</example>
|
||||||
|
public double BaseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The velocity multiplier.
|
/// The velocity multiplier.
|
||||||
|
@ -62,13 +62,20 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public override GameplayClock FrameStableClock => frameStabilityContainer.GameplayClock;
|
public override GameplayClock FrameStableClock => frameStabilityContainer.GameplayClock;
|
||||||
|
|
||||||
|
private bool frameStablePlayback = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to enable frame-stable playback.
|
/// Whether to enable frame-stable playback.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal bool FrameStablePlayback
|
internal bool FrameStablePlayback
|
||||||
{
|
{
|
||||||
get => frameStabilityContainer.FrameStablePlayback;
|
get => frameStablePlayback;
|
||||||
set => frameStabilityContainer.FrameStablePlayback = value;
|
set
|
||||||
|
{
|
||||||
|
frameStablePlayback = false;
|
||||||
|
if (frameStabilityContainer != null)
|
||||||
|
frameStabilityContainer.FrameStablePlayback = value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -106,7 +113,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <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>
|
||||||
/// <param name="mods">The <see cref="Mod"/>s to apply.</param>
|
/// <param name="mods">The <see cref="Mod"/>s to apply.</param>
|
||||||
protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap, IReadOnlyList<Mod> mods)
|
protected DrawableRuleset(Ruleset ruleset, IWorkingBeatmap workingBeatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset)
|
: base(ruleset)
|
||||||
{
|
{
|
||||||
if (workingBeatmap == null)
|
if (workingBeatmap == null)
|
||||||
@ -156,6 +163,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
|
frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
|
||||||
{
|
{
|
||||||
|
FrameStablePlayback = FrameStablePlayback,
|
||||||
Child = KeyBindingInputManager
|
Child = KeyBindingInputManager
|
||||||
.WithChild(CreatePlayfieldAdjustmentContainer()
|
.WithChild(CreatePlayfieldAdjustmentContainer()
|
||||||
.WithChild(Playfield)
|
.WithChild(Playfield)
|
||||||
|
@ -52,7 +52,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Size = new Vector2(size),
|
Size = new Vector2(size),
|
||||||
Icon = OsuIcon.ModBg,
|
Icon = OsuIcon.ModBg,
|
||||||
Y = -6.5f,
|
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
modIcon = new SpriteIcon
|
modIcon = new SpriteIcon
|
||||||
|
@ -69,6 +69,11 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool UserScrollSpeedAdjustment => true;
|
protected virtual bool UserScrollSpeedAdjustment => true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether <see cref="TimingControlPoint"/> beat lengths should scale relative to the most common beat length in the <see cref="Beatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool RelativeScaleBeatLengths => false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
|
/// Provides the default <see cref="MultiplierControlPoint"/>s that adjust the scrolling rate of <see cref="HitObject"/>s
|
||||||
/// inside this <see cref="DrawableRuleset{TObject}"/>.
|
/// inside this <see cref="DrawableRuleset{TObject}"/>.
|
||||||
@ -81,7 +86,7 @@ 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, IReadOnlyList<Mod> mods)
|
protected DrawableScrollingRuleset(Ruleset ruleset, IWorkingBeatmap beatmap, IReadOnlyList<Mod> mods)
|
||||||
: base(ruleset, beatmap, mods)
|
: base(ruleset, beatmap, mods)
|
||||||
{
|
{
|
||||||
scrollingInfo = new LocalScrollingInfo();
|
scrollingInfo = new LocalScrollingInfo();
|
||||||
@ -107,16 +112,38 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
// Calculate default multiplier control points
|
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
||||||
|
double baseBeatLength = TimingControlPoint.DEFAULT_BEAT_LENGTH;
|
||||||
|
|
||||||
|
if (RelativeScaleBeatLengths)
|
||||||
|
{
|
||||||
|
IReadOnlyList<TimingControlPoint> timingPoints = Beatmap.ControlPointInfo.TimingPoints;
|
||||||
|
double maxDuration = 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < timingPoints.Count; i++)
|
||||||
|
{
|
||||||
|
if (timingPoints[i].Time > lastObjectTime)
|
||||||
|
break;
|
||||||
|
|
||||||
|
double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time : lastObjectTime;
|
||||||
|
double duration = endTime - timingPoints[i].Time;
|
||||||
|
|
||||||
|
if (duration > maxDuration)
|
||||||
|
{
|
||||||
|
maxDuration = duration;
|
||||||
|
baseBeatLength = timingPoints[i].BeatLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Merge sequences of timing and difficulty control points to create the aggregate "multiplier" control point
|
||||||
var lastTimingPoint = new TimingControlPoint();
|
var lastTimingPoint = new TimingControlPoint();
|
||||||
var lastDifficultyPoint = new DifficultyControlPoint();
|
var lastDifficultyPoint = new DifficultyControlPoint();
|
||||||
|
|
||||||
// Merge timing + difficulty points
|
|
||||||
var allPoints = new SortedList<ControlPoint>(Comparer<ControlPoint>.Default);
|
var allPoints = new SortedList<ControlPoint>(Comparer<ControlPoint>.Default);
|
||||||
allPoints.AddRange(Beatmap.ControlPointInfo.TimingPoints);
|
allPoints.AddRange(Beatmap.ControlPointInfo.TimingPoints);
|
||||||
allPoints.AddRange(Beatmap.ControlPointInfo.DifficultyPoints);
|
allPoints.AddRange(Beatmap.ControlPointInfo.DifficultyPoints);
|
||||||
|
|
||||||
// Generate the timing points, making non-timing changes use the previous timing change
|
// Generate the timing points, making non-timing changes use the previous timing change and vice-versa
|
||||||
var timingChanges = allPoints.Select(c =>
|
var timingChanges = allPoints.Select(c =>
|
||||||
{
|
{
|
||||||
var timingPoint = c as TimingControlPoint;
|
var timingPoint = c as TimingControlPoint;
|
||||||
@ -131,14 +158,13 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
return new MultiplierControlPoint(c.Time)
|
return new MultiplierControlPoint(c.Time)
|
||||||
{
|
{
|
||||||
Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier,
|
Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier,
|
||||||
|
BaseBeatLength = baseBeatLength,
|
||||||
TimingPoint = lastTimingPoint,
|
TimingPoint = lastTimingPoint,
|
||||||
DifficultyPoint = lastDifficultyPoint
|
DifficultyPoint = lastDifficultyPoint
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
double lastObjectTime = (Objects.LastOrDefault() as IHasEndTime)?.EndTime ?? Objects.LastOrDefault()?.StartTime ?? double.MaxValue;
|
// Trim unwanted sequences of timing changes
|
||||||
|
|
||||||
// Perform some post processing of the timing changes
|
|
||||||
timingChanges = timingChanges
|
timingChanges = timingChanges
|
||||||
// Collapse sections after the last hit object
|
// Collapse sections after the last hit object
|
||||||
.Where(s => s.StartTime <= lastObjectTime)
|
.Where(s => s.StartTime <= lastObjectTime)
|
||||||
@ -147,7 +173,6 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
|
|
||||||
controlPoints.AddRange(timingChanges);
|
controlPoints.AddRange(timingChanges);
|
||||||
|
|
||||||
// If we have no control points, add a default one
|
|
||||||
if (controlPoints.Count == 0)
|
if (controlPoints.Count == 0)
|
||||||
controlPoints.Add(new MultiplierControlPoint { Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier });
|
controlPoints.Add(new MultiplierControlPoint { Velocity = Beatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier });
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,13 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
{
|
{
|
||||||
public class ScrollingHitObjectContainer : HitObjectContainer
|
public class ScrollingHitObjectContainer : HitObjectContainer
|
||||||
{
|
{
|
||||||
private readonly IBindable<double> timeRange = new BindableDouble();
|
/// <summary>
|
||||||
|
/// A multiplier applied to the length of the scrolling area to determine a safe default lifetime end for hitobjects.
|
||||||
|
/// This is only used to limit the lifetime end within reason, as proper lifetime management should be implemented on hitobjects themselves.
|
||||||
|
/// </summary>
|
||||||
|
private const float safe_lifetime_end_multiplier = 2;
|
||||||
|
|
||||||
|
private readonly IBindable<double> timeRange = new BindableDouble();
|
||||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
@ -88,24 +93,29 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
|||||||
|
|
||||||
private void computeInitialStateRecursive(DrawableHitObject hitObject)
|
private void computeInitialStateRecursive(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
hitObject.LifetimeStart = scrollingInfo.Algorithm.GetDisplayStartTime(hitObject.HitObject.StartTime, timeRange.Value);
|
double endTime = hitObject.HitObject.StartTime;
|
||||||
|
|
||||||
if (hitObject.HitObject is IHasEndTime endTime)
|
if (hitObject.HitObject is IHasEndTime e)
|
||||||
{
|
{
|
||||||
|
endTime = e.EndTime;
|
||||||
|
|
||||||
switch (direction.Value)
|
switch (direction.Value)
|
||||||
{
|
{
|
||||||
case ScrollingDirection.Up:
|
case ScrollingDirection.Up:
|
||||||
case ScrollingDirection.Down:
|
case ScrollingDirection.Down:
|
||||||
hitObject.Height = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, endTime.EndTime, timeRange.Value, scrollLength);
|
hitObject.Height = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, endTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ScrollingDirection.Left:
|
case ScrollingDirection.Left:
|
||||||
case ScrollingDirection.Right:
|
case ScrollingDirection.Right:
|
||||||
hitObject.Width = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, endTime.EndTime, timeRange.Value, scrollLength);
|
hitObject.Width = scrollingInfo.Algorithm.GetLength(hitObject.HitObject.StartTime, endTime, timeRange.Value, scrollLength);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hitObject.LifetimeStart = scrollingInfo.Algorithm.GetDisplayStartTime(hitObject.HitObject.StartTime, timeRange.Value);
|
||||||
|
hitObject.LifetimeEnd = scrollingInfo.Algorithm.TimeAt(scrollLength * safe_lifetime_end_multiplier, endTime, timeRange.Value, scrollLength);
|
||||||
|
|
||||||
foreach (var obj in hitObject.NestedHitObjects)
|
foreach (var obj in hitObject.NestedHitObjects)
|
||||||
{
|
{
|
||||||
computeInitialStateRecursive(obj);
|
computeInitialStateRecursive(obj);
|
||||||
|
@ -11,6 +11,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Input.States;
|
using osu.Framework.Input.States;
|
||||||
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.Objects;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
@ -29,6 +30,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private HitObjectComposer composer { get; set; }
|
private HitObjectComposer composer { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IEditorBeatmap beatmap { get; set; }
|
||||||
|
|
||||||
public BlueprintContainer()
|
public BlueprintContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -53,7 +57,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
};
|
};
|
||||||
|
|
||||||
foreach (var obj in composer.HitObjects)
|
foreach (var obj in composer.HitObjects)
|
||||||
AddBlueprintFor(obj);
|
addBlueprintFor(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
beatmap.HitObjectAdded += addBlueprintFor;
|
||||||
|
beatmap.HitObjectRemoved += removeBlueprintFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private HitObjectCompositionTool currentTool;
|
private HitObjectCompositionTool currentTool;
|
||||||
@ -75,11 +87,32 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private void addBlueprintFor(HitObject hitObject)
|
||||||
/// Adds a blueprint for a <see cref="DrawableHitObject"/> which adds movement support.
|
{
|
||||||
/// </summary>
|
var drawable = composer.HitObjects.FirstOrDefault(d => d.HitObject == hitObject);
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> to create a blueprint for.</param>
|
if (drawable == null)
|
||||||
public void AddBlueprintFor(DrawableHitObject hitObject)
|
return;
|
||||||
|
|
||||||
|
addBlueprintFor(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void removeBlueprintFor(HitObject hitObject)
|
||||||
|
{
|
||||||
|
var blueprint = selectionBlueprints.Single(m => m.HitObject.HitObject == hitObject);
|
||||||
|
if (blueprint == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
blueprint.Deselect();
|
||||||
|
|
||||||
|
blueprint.Selected -= onBlueprintSelected;
|
||||||
|
blueprint.Deselected -= onBlueprintDeselected;
|
||||||
|
blueprint.SelectionRequested -= onSelectionRequested;
|
||||||
|
blueprint.DragRequested -= onDragRequested;
|
||||||
|
|
||||||
|
selectionBlueprints.Remove(blueprint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addBlueprintFor(DrawableHitObject hitObject)
|
||||||
{
|
{
|
||||||
refreshTool();
|
refreshTool();
|
||||||
|
|
||||||
@ -95,25 +128,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
selectionBlueprints.Add(blueprint);
|
selectionBlueprints.Add(blueprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
private void removeBlueprintFor(DrawableHitObject hitObject) => removeBlueprintFor(hitObject.HitObject);
|
||||||
/// Removes a blueprint for a <see cref="DrawableHitObject"/>.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="hitObject">The <see cref="DrawableHitObject"/> for which to remove the blueprint.</param>
|
|
||||||
public void RemoveBlueprintFor(DrawableHitObject hitObject)
|
|
||||||
{
|
|
||||||
var blueprint = selectionBlueprints.Single(m => m.HitObject == hitObject);
|
|
||||||
if (blueprint == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
blueprint.Deselect();
|
|
||||||
|
|
||||||
blueprint.Selected -= onBlueprintSelected;
|
|
||||||
blueprint.Deselected -= onBlueprintDeselected;
|
|
||||||
blueprint.SelectionRequested -= onSelectionRequested;
|
|
||||||
blueprint.DragRequested -= onDragRequested;
|
|
||||||
|
|
||||||
selectionBlueprints.Remove(blueprint);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
{
|
{
|
||||||
@ -183,6 +198,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
|
|
||||||
private void onDragRequested(SelectionBlueprint blueprint, DragEvent dragEvent) => selectionHandler.HandleDrag(blueprint, dragEvent);
|
private void onDragRequested(SelectionBlueprint blueprint, DragEvent dragEvent) => selectionHandler.HandleDrag(blueprint, dragEvent);
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (beatmap != null)
|
||||||
|
{
|
||||||
|
beatmap.HitObjectAdded -= addBlueprintFor;
|
||||||
|
beatmap.HitObjectRemoved -= removeBlueprintFor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SelectionBlueprintContainer : Container<SelectionBlueprint>
|
private class SelectionBlueprintContainer : Container<SelectionBlueprint>
|
||||||
{
|
{
|
||||||
protected override int Compare(Drawable x, Drawable y)
|
protected override int Compare(Drawable x, Drawable y)
|
||||||
|
@ -9,15 +9,13 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Rulesets.Objects;
|
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose
|
namespace osu.Game.Screens.Edit.Compose
|
||||||
{
|
{
|
||||||
[Cached(Type = typeof(IPlacementHandler))]
|
public class ComposeScreen : EditorScreen
|
||||||
public class ComposeScreen : EditorScreen, IPlacementHandler
|
|
||||||
{
|
{
|
||||||
private const float vertical_margins = 10;
|
private const float vertical_margins = 10;
|
||||||
private const float horizontal_margins = 20;
|
private const float horizontal_margins = 20;
|
||||||
@ -119,13 +117,5 @@ namespace osu.Game.Screens.Edit.Compose
|
|||||||
|
|
||||||
composerContainer.Child = composer;
|
composerContainer.Child = composer;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginPlacement(HitObject hitObject)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void EndPlacement(HitObject hitObject) => composer.Add(hitObject);
|
|
||||||
|
|
||||||
public void Delete(HitObject hitObject) => composer.Remove(hitObject);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
83
osu.Game/Screens/Edit/EditorBeatmap.cs
Normal file
83
osu.Game/Screens/Edit/EditorBeatmap.cs
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Beatmaps.Timing;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit
|
||||||
|
{
|
||||||
|
public class EditorBeatmap<T> : IEditorBeatmap<T>
|
||||||
|
where T : HitObject
|
||||||
|
{
|
||||||
|
public event Action<HitObject> HitObjectAdded;
|
||||||
|
public event Action<HitObject> HitObjectRemoved;
|
||||||
|
|
||||||
|
private readonly Beatmap<T> beatmap;
|
||||||
|
|
||||||
|
public EditorBeatmap(Beatmap<T> beatmap)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapInfo BeatmapInfo
|
||||||
|
{
|
||||||
|
get => beatmap.BeatmapInfo;
|
||||||
|
set => beatmap.BeatmapInfo = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapMetadata Metadata => beatmap.Metadata;
|
||||||
|
|
||||||
|
public ControlPointInfo ControlPointInfo => beatmap.ControlPointInfo;
|
||||||
|
|
||||||
|
public List<BreakPeriod> Breaks => beatmap.Breaks;
|
||||||
|
|
||||||
|
public double TotalBreakTime => beatmap.TotalBreakTime;
|
||||||
|
|
||||||
|
IReadOnlyList<T> IBeatmap<T>.HitObjects => beatmap.HitObjects;
|
||||||
|
|
||||||
|
IReadOnlyList<HitObject> IBeatmap.HitObjects => beatmap.HitObjects;
|
||||||
|
|
||||||
|
public IEnumerable<BeatmapStatistic> GetStatistics() => beatmap.GetStatistics();
|
||||||
|
|
||||||
|
public IBeatmap Clone() => (EditorBeatmap<T>)MemberwiseClone();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a <see cref="HitObject"/> to this <see cref="EditorBeatmap{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
|
public void Add(T hitObject)
|
||||||
|
{
|
||||||
|
// Preserve existing sorting order in the beatmap
|
||||||
|
var insertionIndex = beatmap.HitObjects.FindLastIndex(h => h.StartTime <= hitObject.StartTime);
|
||||||
|
beatmap.HitObjects.Insert(insertionIndex + 1, hitObject);
|
||||||
|
|
||||||
|
HitObjectAdded?.Invoke(hitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
|
public void Remove(T hitObject)
|
||||||
|
{
|
||||||
|
if (beatmap.HitObjects.Remove(hitObject))
|
||||||
|
HitObjectRemoved?.Invoke(hitObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a <see cref="HitObject"/> to this <see cref="EditorBeatmap{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
|
public void Add(HitObject hitObject) => Add((T)hitObject);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Removes a <see cref="HitObject"/> from this <see cref="EditorBeatmap{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="hitObject">The <see cref="HitObject"/> to add.</param>
|
||||||
|
public void Remove(HitObject hitObject) => Remove((T)hitObject);
|
||||||
|
}
|
||||||
|
}
|
46
osu.Game/Screens/Edit/EditorWorkingBeatmap.cs
Normal file
46
osu.Game/Screens/Edit/EditorWorkingBeatmap.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
using osu.Game.Skinning;
|
||||||
|
using osu.Game.Storyboards;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Encapsulates a <see cref="WorkingBeatmap"/> while providing an overridden <see cref="Beatmap{TObject}"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <typeparam name="TObject"></typeparam>
|
||||||
|
public class EditorWorkingBeatmap<TObject> : IWorkingBeatmap
|
||||||
|
where TObject : HitObject
|
||||||
|
{
|
||||||
|
private readonly Beatmap<TObject> playableBeatmap;
|
||||||
|
private readonly WorkingBeatmap workingBeatmap;
|
||||||
|
|
||||||
|
public EditorWorkingBeatmap(Beatmap<TObject> playableBeatmap, WorkingBeatmap workingBeatmap)
|
||||||
|
{
|
||||||
|
this.playableBeatmap = playableBeatmap;
|
||||||
|
this.workingBeatmap = workingBeatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IBeatmap Beatmap => workingBeatmap.Beatmap;
|
||||||
|
|
||||||
|
public Texture Background => workingBeatmap.Background;
|
||||||
|
|
||||||
|
public Track Track => workingBeatmap.Track;
|
||||||
|
|
||||||
|
public Waveform Waveform => workingBeatmap.Waveform;
|
||||||
|
|
||||||
|
public Storyboard Storyboard => workingBeatmap.Storyboard;
|
||||||
|
|
||||||
|
public Skin Skin => workingBeatmap.Skin;
|
||||||
|
|
||||||
|
public IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods) => playableBeatmap;
|
||||||
|
}
|
||||||
|
}
|
36
osu.Game/Screens/Edit/IEditorBeatmap.cs
Normal file
36
osu.Game/Screens/Edit/IEditorBeatmap.cs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for the <see cref="IBeatmap"/> contained by the see <see cref="HitObjectComposer"/>.
|
||||||
|
/// Children of <see cref="HitObjectComposer"/> may resolve the beatmap via <see cref="IEditorBeatmap"/> or <see cref="IEditorBeatmap{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IEditorBeatmap : IBeatmap
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when a <see cref="HitObject"/> is added to this <see cref="IEditorBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
event Action<HitObject> HitObjectAdded;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when a <see cref="HitObject"/> is removed from this <see cref="IEditorBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
event Action<HitObject> HitObjectRemoved;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Interface for the <see cref="IBeatmap"/> contained by the see <see cref="HitObjectComposer"/>.
|
||||||
|
/// Children of <see cref="HitObjectComposer"/> may resolve the beatmap via <see cref="IEditorBeatmap"/> or <see cref="IEditorBeatmap{T}"/>.
|
||||||
|
/// </summary>
|
||||||
|
public interface IEditorBeatmap<out T> : IEditorBeatmap, IBeatmap<T>
|
||||||
|
where T : HitObject
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user