Privatise the OsuGame beatmap, add local beatmap to OsuTestCase

This commit is contained in:
smoogipoo
2018-05-23 17:37:39 +09:00
parent 6c0c932c48
commit 8004b8af4d
51 changed files with 279 additions and 277 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Components
private const float corner_radius = 5;
private const float contents_padding = 15;
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected Track Track => Beatmap.Value.Track;
private readonly Drawable background;
@ -42,8 +42,10 @@ namespace osu.Game.Screens.Edit.Components
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(IGameBeatmap beatmap, OsuColour colours)
{
Beatmap.BindTo(beatmap);
background.Colour = colours.Gray1;
}
}

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using OpenTK;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
@ -15,7 +16,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
/// </summary>
public abstract class TimelinePart : CompositeDrawable
{
public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
private readonly Container timeline;
@ -30,6 +31,12 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
};
}
[BackgroundDependencyLoader]
private void load(IGameBeatmap beatmap)
{
Beatmap.BindTo(beatmap);
}
private void updateRelativeChildSize()
{
// the track may not be loaded completely (only has a length once it is).

View File

@ -20,19 +20,17 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
[BackgroundDependencyLoader]
private void load(OsuColour colours, IAdjustableClock adjustableClock)
{
TimelinePart markerPart, controlPointPart, bookmarkPart, breakPart;
Children = new Drawable[]
{
markerPart = new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
controlPointPart = new ControlPointPart
new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
new ControlPointPart
{
Anchor = Anchor.Centre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
Height = 0.35f
},
bookmarkPart = new BookmarkPart
new BookmarkPart
{
Anchor = Anchor.Centre,
Origin = Anchor.TopCentre,
@ -67,7 +65,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
},
}
},
breakPart = new BreakPart
new BreakPart
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -75,11 +73,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
Height = 0.25f
}
};
markerPart.Beatmap.BindTo(Beatmap);
controlPointPart.Beatmap.BindTo(Beatmap);
bookmarkPart.Beatmap.BindTo(Beatmap);
breakPart.Beatmap.BindTo(Beatmap);
}
}
}