mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Privatise the OsuGame beatmap, add local beatmap to OsuTestCase
This commit is contained in:
Submodule osu-framework updated: eb076a3301...b36db536d9
@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
|
|
||||||
private Bindable<double> cursorScale;
|
private Bindable<double> cursorScale;
|
||||||
private Bindable<bool> autoCursorScale;
|
private Bindable<bool> autoCursorScale;
|
||||||
private Bindable<WorkingBeatmap> beatmap;
|
private IBindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
public OsuCursor()
|
public OsuCursor()
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config, OsuGameBase game)
|
private void load(OsuConfigManager config, IGameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
Child = cursorContainer = new SkinnableDrawable("cursor", _ => new CircularContainer
|
Child = cursorContainer = new SkinnableDrawable("cursor", _ => new CircularContainer
|
||||||
{
|
{
|
||||||
@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
};
|
};
|
||||||
|
|
||||||
beatmap = game.Beatmap.GetBoundCopy();
|
this.beatmap = beatmap.GetBoundCopy();
|
||||||
beatmap.ValueChanged += v => calculateScale();
|
beatmap.ValueChanged += v => calculateScale();
|
||||||
|
|
||||||
cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
|
cursorScale = config.GetBindable<double>(OsuSetting.GameplayCursorSize);
|
||||||
|
@ -6,7 +6,6 @@ using System.Linq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -29,14 +28,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
private TestBeatmapInfoWedge infoWedge;
|
private TestBeatmapInfoWedge infoWedge;
|
||||||
private readonly List<IBeatmap> beatmaps = new List<IBeatmap>();
|
private readonly List<IBeatmap> beatmaps = new List<IBeatmap>();
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, RulesetStore rulesets)
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
|
|
||||||
beatmap.BindTo(game.Beatmap);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -53,11 +49,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep("show", () =>
|
AddStep("show", () =>
|
||||||
{
|
{
|
||||||
infoWedge.State = Visibility.Visible;
|
infoWedge.State = Visibility.Visible;
|
||||||
infoWedge.UpdateBeatmap(beatmap);
|
infoWedge.UpdateBeatmap(Beatmap);
|
||||||
});
|
});
|
||||||
|
|
||||||
// select part is redundant, but wait for load isn't
|
// select part is redundant, but wait for load isn't
|
||||||
selectBeatmap(beatmap.Value.Beatmap);
|
selectBeatmap(Beatmap.Value.Beatmap);
|
||||||
|
|
||||||
AddWaitStep(3);
|
AddWaitStep(3);
|
||||||
|
|
||||||
@ -120,8 +116,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
selectNullBeatmap();
|
selectNullBeatmap();
|
||||||
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text));
|
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Text));
|
||||||
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Title);
|
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Title);
|
||||||
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == beatmap.Default.BeatmapInfo.Metadata.Artist);
|
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Artist);
|
||||||
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any());
|
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any());
|
||||||
AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any());
|
AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any());
|
||||||
}
|
}
|
||||||
@ -133,7 +129,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep($"select {b.Metadata.Title} beatmap", () =>
|
AddStep($"select {b.Metadata.Title} beatmap", () =>
|
||||||
{
|
{
|
||||||
infoBefore = infoWedge.Info;
|
infoBefore = infoWedge.Info;
|
||||||
infoWedge.UpdateBeatmap(beatmap.Value = new TestWorkingBeatmap(b));
|
infoWedge.UpdateBeatmap(Beatmap.Value = new TestWorkingBeatmap(b));
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load");
|
AddUntilStep(() => infoWedge.Info != infoBefore, "wait for async load");
|
||||||
@ -143,8 +139,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
AddStep("select null beatmap", () =>
|
AddStep("select null beatmap", () =>
|
||||||
{
|
{
|
||||||
beatmap.Value = beatmap.Default;
|
Beatmap.Value = Beatmap.Default;
|
||||||
infoWedge.UpdateBeatmap(beatmap);
|
infoWedge.UpdateBeatmap(Beatmap);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,14 +17,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Compose) };
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(Compose) };
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load()
|
||||||
{
|
{
|
||||||
osuGame.Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
Child = new Compose();
|
||||||
var compose = new Compose();
|
|
||||||
compose.Beatmap.BindTo(osuGame.Beatmap);
|
|
||||||
|
|
||||||
Child = compose;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -18,8 +17,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ScrollableTimeline), typeof(ScrollingTimelineContainer), typeof(BeatmapWaveformGraph), typeof(TimelineButton) };
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(ScrollableTimeline), typeof(ScrollingTimelineContainer), typeof(BeatmapWaveformGraph), typeof(TimelineButton) };
|
||||||
|
|
||||||
private readonly ScrollableTimeline timeline;
|
|
||||||
|
|
||||||
public TestCaseEditorComposeTimeline()
|
public TestCaseEditorComposeTimeline()
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -30,7 +27,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
State = Visibility.Visible
|
State = Visibility.Visible
|
||||||
},
|
},
|
||||||
timeline = new ScrollableTimeline
|
new ScrollableTimeline
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -38,11 +35,5 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuGameBase osuGame)
|
|
||||||
{
|
|
||||||
timeline.Beatmap.BindTo(osuGame.Beatmap);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load()
|
||||||
{
|
{
|
||||||
var testBeatmap = new Beatmap
|
var testBeatmap = new Beatmap
|
||||||
{
|
{
|
||||||
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
osuGame.Beatmap.Value = new TestWorkingBeatmap(testBeatmap);
|
Beatmap.Value = new TestWorkingBeatmap(testBeatmap);
|
||||||
|
|
||||||
Child = new TimingPointVisualiser(testBeatmap, 5000) { Clock = Clock };
|
Child = new TimingPointVisualiser(testBeatmap, 5000) { Clock = Clock };
|
||||||
|
|
||||||
|
@ -19,19 +19,16 @@ namespace osu.Game.Tests.Visual
|
|||||||
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(SummaryTimeline) };
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(SummaryTimeline) };
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load()
|
||||||
{
|
{
|
||||||
osuGame.Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
|
||||||
SummaryTimeline summaryTimeline;
|
Add(new SummaryTimeline
|
||||||
Add(summaryTimeline = new SummaryTimeline
|
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(500, 50)
|
Size = new Vector2(500, 50)
|
||||||
});
|
});
|
||||||
|
|
||||||
summaryTimeline.Beatmap.BindTo(osuGame.Beatmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,9 +38,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
=> dependencies = new DependencyContainer(parent);
|
=> dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load()
|
||||||
{
|
{
|
||||||
osuGame.Beatmap.Value = new TestWorkingBeatmap(new Beatmap
|
Beatmap.Value = new TestWorkingBeatmap(new Beatmap
|
||||||
{
|
{
|
||||||
HitObjects = new List<HitObject>
|
HitObjects = new List<HitObject>
|
||||||
{
|
{
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
@ -15,8 +12,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseMusicController : OsuTestCase
|
public class TestCaseMusicController : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
public TestCaseMusicController()
|
public TestCaseMusicController()
|
||||||
{
|
{
|
||||||
Clock = new FramedClock();
|
Clock = new FramedClock();
|
||||||
@ -30,13 +25,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
|
AddToggleStep(@"toggle visibility", state => mc.State = state ? Visibility.Visible : Visibility.Hidden);
|
||||||
AddStep(@"show", () => mc.State = Visibility.Visible);
|
AddStep(@"show", () => mc.State = Visibility.Visible);
|
||||||
AddToggleStep(@"toggle beatmap lock", state => beatmapBacking.Disabled = state);
|
AddToggleStep(@"toggle beatmap lock", state => Beatmap.Disabled = state);
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuGameBase game)
|
|
||||||
{
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game)
|
private void load()
|
||||||
{
|
{
|
||||||
TestSongSelect songSelect = null;
|
TestSongSelect songSelect = null;
|
||||||
|
|
||||||
@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
dependencies.Cache(rulesets = new RulesetStore(factory));
|
dependencies.Cache(rulesets = new RulesetStore(factory));
|
||||||
dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null)
|
dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null)
|
||||||
{
|
{
|
||||||
DefaultBeatmap = defaultBeatmap = game.Beatmap.Default
|
DefaultBeatmap = defaultBeatmap = Beatmap.Default
|
||||||
});
|
});
|
||||||
|
|
||||||
void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () =>
|
void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () =>
|
||||||
@ -78,7 +78,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
if (deleteMaps)
|
if (deleteMaps)
|
||||||
{
|
{
|
||||||
manager.Delete(manager.GetAllUsableBeatmapSets());
|
manager.Delete(manager.GetAllUsableBeatmapSets());
|
||||||
game.Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (songSelect != null)
|
if (songSelect != null)
|
||||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Size = new Vector2(200,100)
|
Size = new Vector2(200,100)
|
||||||
};
|
};
|
||||||
|
|
||||||
playback.Beatmap.Value = new TestWorkingBeatmap(new Beatmap());
|
Beatmap.Value = new TestWorkingBeatmap(new Beatmap());
|
||||||
|
|
||||||
Child = playback;
|
Child = playback;
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game)
|
private void load(OsuGameBase game)
|
||||||
{
|
{
|
||||||
|
Beatmap.Value = new DummyWorkingBeatmap(game);
|
||||||
|
|
||||||
AddStep("load dummy beatmap", () => Add(new PlayerLoader(new Player
|
AddStep("load dummy beatmap", () => Add(new PlayerLoader(new Player
|
||||||
{
|
{
|
||||||
InitialBeatmap = new DummyWorkingBeatmap(game),
|
|
||||||
AllowPause = false,
|
AllowPause = false,
|
||||||
AllowLeadIn = false,
|
AllowLeadIn = false,
|
||||||
AllowResults = false,
|
AllowResults = false,
|
||||||
|
@ -26,10 +26,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
// Reset the mods
|
// Reset the mods
|
||||||
beatmap.Mods.Value = beatmap.Mods.Value.Where(m => !(m is ModAutoplay));
|
beatmap.Mods.Value = beatmap.Mods.Value.Where(m => !(m is ModAutoplay));
|
||||||
|
|
||||||
return new ReplayPlayer(replay)
|
return new ReplayPlayer(replay);
|
||||||
{
|
|
||||||
InitialBeatmap = beatmap
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,18 +32,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkingBeatmap beatmap;
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
if (beatmap == null)
|
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
|
||||||
{
|
if (beatmapInfo != null)
|
||||||
var beatmapInfo = beatmaps.QueryBeatmap(b => b.RulesetID == 0);
|
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||||
if (beatmapInfo != null)
|
|
||||||
beatmap = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
Add(new Results(new Score
|
Add(new Results(new Score
|
||||||
{
|
{
|
||||||
@ -63,10 +58,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Username = "peppy",
|
Username = "peppy",
|
||||||
}
|
}
|
||||||
})
|
}));
|
||||||
{
|
|
||||||
InitialBeatmap = beatmap
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -18,8 +17,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseStoryboard : OsuTestCase
|
public class TestCaseStoryboard : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
private readonly Container<DrawableStoryboard> storyboardContainer;
|
private readonly Container<DrawableStoryboard> storyboardContainer;
|
||||||
private DrawableStoryboard storyboard;
|
private DrawableStoryboard storyboard;
|
||||||
|
|
||||||
@ -43,6 +40,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
Add(new MusicController
|
Add(new MusicController
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
@ -55,10 +53,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game)
|
private void load()
|
||||||
{
|
{
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
Beatmap.ValueChanged += beatmapChanged;
|
||||||
beatmapBacking.ValueChanged += beatmapChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapChanged(WorkingBeatmap working)
|
private void beatmapChanged(WorkingBeatmap working)
|
||||||
@ -66,10 +63,10 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
private void restart()
|
private void restart()
|
||||||
{
|
{
|
||||||
var track = beatmapBacking.Value.Track;
|
var track = Beatmap.Value.Track;
|
||||||
|
|
||||||
track.Reset();
|
track.Reset();
|
||||||
loadStoryboard(beatmapBacking.Value);
|
loadStoryboard(Beatmap);
|
||||||
track.Start();
|
track.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,7 +78,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true };
|
||||||
storyboardContainer.Clock = decoupledClock;
|
storyboardContainer.Clock = decoupledClock;
|
||||||
|
|
||||||
storyboard = working.Storyboard.CreateDrawable(beatmapBacking);
|
storyboard = working.Storyboard.CreateDrawable(Beatmap);
|
||||||
storyboard.Passing = false;
|
storyboard.Passing = false;
|
||||||
|
|
||||||
storyboardContainer.Add(storyboard);
|
storyboardContainer.Add(storyboard);
|
||||||
|
@ -5,11 +5,9 @@ using NUnit.Framework;
|
|||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
using osu.Game.Screens.Edit.Screens.Compose.Timeline;
|
||||||
@ -19,9 +17,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseWaveform : OsuTestCase
|
public class TestCaseWaveform : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
public TestCaseWaveform()
|
|
||||||
{
|
{
|
||||||
FillFlowContainer flow;
|
FillFlowContainer flow;
|
||||||
Child = flow = new FillFlowContainer
|
Child = flow = new FillFlowContainer
|
||||||
@ -46,10 +43,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
var newDisplay = new BeatmapWaveformGraph
|
var newDisplay = new BeatmapWaveformGraph
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Resolution = 1f / i
|
Resolution = 1f / i,
|
||||||
|
Beatmap = Beatmap
|
||||||
};
|
};
|
||||||
|
|
||||||
newDisplay.Beatmap.BindTo(beatmapBacking);
|
Beatmap.ValueChanged += b => newDisplay.Beatmap = b;
|
||||||
|
|
||||||
flow.Add(new Container
|
flow.Add(new Container
|
||||||
{
|
{
|
||||||
@ -83,8 +81,5 @@ namespace osu.Game.Tests.Visual
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuGameBase osuGame) => beatmapBacking.BindTo(osuGame.Beatmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
private readonly OsuGameBase game;
|
private readonly OsuGameBase game;
|
||||||
|
|
||||||
public DummyWorkingBeatmap(OsuGameBase game)
|
public DummyWorkingBeatmap(OsuGameBase game = null)
|
||||||
: base(new BeatmapInfo
|
: base(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
@ -43,7 +43,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override IBeatmap GetBeatmap() => new Beatmap();
|
protected override IBeatmap GetBeatmap() => new Beatmap();
|
||||||
|
|
||||||
protected override Texture GetBackground() => game.Textures.Get(@"Backgrounds/bg4");
|
protected override Texture GetBackground() => game?.Textures.Get(@"Backgrounds/bg4");
|
||||||
|
|
||||||
protected override Track GetTrack() => new TrackVirtual();
|
protected override Track GetTrack() => new TrackVirtual();
|
||||||
|
|
||||||
|
26
osu.Game/Beatmaps/GameBeatmap.cs
Normal file
26
osu.Game/Beatmaps/GameBeatmap.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="Bindable{WorkingBeatmap}"/> for the <see cref="OsuGame"/> beatmap.
|
||||||
|
/// This should be used sparingly in-favour of <see cref="IGameBeatmap"/>.
|
||||||
|
/// </summary>
|
||||||
|
public class GameBeatmap : NonNullableBindable<WorkingBeatmap>, IGameBeatmap
|
||||||
|
{
|
||||||
|
public GameBeatmap(WorkingBeatmap defaultValue)
|
||||||
|
: base(defaultValue)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameBeatmap GetBoundCopy()
|
||||||
|
{
|
||||||
|
var copy = new GameBeatmap(Default);
|
||||||
|
copy.BindTo(this);
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
osu.Game/Beatmaps/IGameBeatmap.cs
Normal file
14
osu.Game/Beatmaps/IGameBeatmap.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Read-only interface for the <see cref="OsuGame"/> beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public interface IGameBeatmap : IBindable<WorkingBeatmap>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
@ -12,7 +12,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
public class BeatSyncedContainer : Container
|
public class BeatSyncedContainer : Container
|
||||||
{
|
{
|
||||||
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private int lastBeat;
|
private int lastBeat;
|
||||||
private TimingControlPoint lastTimingPoint;
|
private TimingControlPoint lastTimingPoint;
|
||||||
@ -74,9 +74,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game)
|
private void load(IGameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
Beatmap.BindTo(game.Beatmap);
|
Beatmap.BindTo(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
protected virtual void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
|
@ -65,7 +65,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
public IBindable<WorkingBeatmap> Beatmap { get; private set; }
|
protected GameBeatmap Beatmap;
|
||||||
private WorkingBeatmap lastBeatmap;
|
private WorkingBeatmap lastBeatmap;
|
||||||
|
|
||||||
private Bindable<bool> fpsDisplayVisible;
|
private Bindable<bool> fpsDisplayVisible;
|
||||||
@ -158,7 +158,7 @@ namespace osu.Game
|
|||||||
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));
|
Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light"));
|
||||||
|
|
||||||
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
||||||
Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
Beatmap = new GameBeatmap(defaultBeatmap);
|
||||||
BeatmapManager.DefaultBeatmap = defaultBeatmap;
|
BeatmapManager.DefaultBeatmap = defaultBeatmap;
|
||||||
|
|
||||||
// tracks play so loud our samples can't keep up.
|
// tracks play so loud our samples can't keep up.
|
||||||
@ -186,6 +186,9 @@ namespace osu.Game
|
|||||||
lastBeatmap = b;
|
lastBeatmap = b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
dependencies.Cache(Beatmap);
|
||||||
|
dependencies.CacheAs<IGameBeatmap>(Beatmap);
|
||||||
|
|
||||||
FileStore.Cleanup();
|
FileStore.Cleanup();
|
||||||
|
|
||||||
AddInternal(api);
|
AddInternal(api);
|
||||||
|
@ -73,13 +73,13 @@ namespace osu.Game.Overlays.Music
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(BeatmapManager beatmaps, OsuGameBase osuGame)
|
private void load(BeatmapManager beatmaps, IGameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
beatmaps.GetAllUsableBeatmapSets().ForEach(addBeatmapSet);
|
beatmaps.GetAllUsableBeatmapSets().ForEach(addBeatmapSet);
|
||||||
beatmaps.ItemAdded += addBeatmapSet;
|
beatmaps.ItemAdded += addBeatmapSet;
|
||||||
beatmaps.ItemRemoved += removeBeatmapSet;
|
beatmaps.ItemRemoved += removeBeatmapSet;
|
||||||
|
|
||||||
beatmapBacking.BindTo(osuGame.Beatmap);
|
beatmapBacking.BindTo(beatmap);
|
||||||
beatmapBacking.ValueChanged += _ => updateSelectedSet();
|
beatmapBacking.ValueChanged += _ => updateSelectedSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -21,17 +20,22 @@ namespace osu.Game.Overlays.Music
|
|||||||
private const float transition_duration = 600;
|
private const float transition_duration = 600;
|
||||||
private const float playlist_height = 510;
|
private const float playlist_height = 510;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Invoked when the order of an item in the list has changed.
|
||||||
|
/// The second parameter indicates the new index of the item.
|
||||||
|
/// </summary>
|
||||||
public Action<BeatmapSetInfo, int> OrderChanged;
|
public Action<BeatmapSetInfo, int> OrderChanged;
|
||||||
|
|
||||||
|
private GameBeatmap beatmap;
|
||||||
private BeatmapManager beatmaps;
|
private BeatmapManager beatmaps;
|
||||||
|
|
||||||
private FilterControl filter;
|
private FilterControl filter;
|
||||||
private PlaylistList list;
|
private PlaylistList list;
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours)
|
private void load(OsuColour colours, GameBeatmap beatmap, BeatmapManager beatmaps)
|
||||||
{
|
{
|
||||||
|
this.beatmap = beatmap.GetBoundCopy();
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -73,13 +77,11 @@ namespace osu.Game.Overlays.Music
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
|
||||||
|
|
||||||
filter.Search.OnCommit = (sender, newText) =>
|
filter.Search.OnCommit = (sender, newText) =>
|
||||||
{
|
{
|
||||||
BeatmapInfo beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
|
||||||
if (beatmap != null)
|
if (toSelect != null)
|
||||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
beatmap.Value = beatmaps.GetWorkingBeatmap(toSelect);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,13 +104,13 @@ namespace osu.Game.Overlays.Music
|
|||||||
|
|
||||||
private void itemSelected(BeatmapSetInfo set)
|
private void itemSelected(BeatmapSetInfo set)
|
||||||
{
|
{
|
||||||
if (set.ID == (beatmapBacking.Value?.BeatmapSetInfo?.ID ?? -1))
|
if (set.ID == (beatmap.Value?.BeatmapSetInfo?.ID ?? -1))
|
||||||
{
|
{
|
||||||
beatmapBacking.Value?.Track?.Seek(0);
|
beatmap.Value?.Track?.Seek(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(set.Beatmaps.First());
|
beatmap.Value = beatmaps.GetWorkingBeatmap(set.Beatmaps.First());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -30,11 +29,8 @@ namespace osu.Game.Overlays
|
|||||||
public class MusicController : OsuFocusedOverlayContainer
|
public class MusicController : OsuFocusedOverlayContainer
|
||||||
{
|
{
|
||||||
private const float player_height = 130;
|
private const float player_height = 130;
|
||||||
|
|
||||||
private const float transition_length = 800;
|
private const float transition_length = 800;
|
||||||
|
|
||||||
private const float progress_height = 10;
|
private const float progress_height = 10;
|
||||||
|
|
||||||
private const float bottom_black_area_height = 55;
|
private const float bottom_black_area_height = 55;
|
||||||
|
|
||||||
private Drawable background;
|
private Drawable background;
|
||||||
@ -49,16 +45,17 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private PlaylistOverlay playlist;
|
private PlaylistOverlay playlist;
|
||||||
|
|
||||||
|
private BeatmapManager beatmaps;
|
||||||
private LocalisationEngine localisation;
|
private LocalisationEngine localisation;
|
||||||
|
|
||||||
private BeatmapManager beatmaps;
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmapBacking = new Bindable<WorkingBeatmap>();
|
|
||||||
private List<BeatmapSetInfo> beatmapSets;
|
private List<BeatmapSetInfo> beatmapSets;
|
||||||
private BeatmapSetInfo currentSet;
|
private BeatmapSetInfo currentSet;
|
||||||
|
|
||||||
private Container dragContainer;
|
private Container dragContainer;
|
||||||
private Container playerContainer;
|
private Container playerContainer;
|
||||||
|
|
||||||
|
private GameBeatmap beatmap;
|
||||||
|
|
||||||
public MusicController()
|
public MusicController()
|
||||||
{
|
{
|
||||||
Width = 400;
|
Width = 400;
|
||||||
@ -97,8 +94,9 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation)
|
private void load(GameBeatmap beatmap, BeatmapManager beatmaps, OsuColour colours, LocalisationEngine localisation)
|
||||||
{
|
{
|
||||||
|
this.beatmap = beatmap.GetBoundCopy();
|
||||||
this.beatmaps = beatmaps;
|
this.beatmaps = beatmaps;
|
||||||
this.localisation = localisation;
|
this.localisation = localisation;
|
||||||
|
|
||||||
@ -224,8 +222,6 @@ namespace osu.Game.Overlays
|
|||||||
beatmaps.ItemAdded += handleBeatmapAdded;
|
beatmaps.ItemAdded += handleBeatmapAdded;
|
||||||
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
beatmaps.ItemRemoved += handleBeatmapRemoved;
|
||||||
|
|
||||||
beatmapBacking.BindTo(game.Beatmap);
|
|
||||||
|
|
||||||
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
playlist.StateChanged += s => playlistButton.FadeColour(s == Visibility.Visible ? colours.Yellow : Color4.White, 200, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -240,9 +236,10 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
beatmapBacking.ValueChanged += beatmapChanged;
|
beatmap.ValueChanged += beatmapChanged;
|
||||||
beatmapBacking.DisabledChanged += beatmapDisabledChanged;
|
beatmap.DisabledChanged += beatmapDisabledChanged;
|
||||||
beatmapBacking.TriggerChange();
|
|
||||||
|
beatmapChanged(beatmap.Value);
|
||||||
|
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
}
|
}
|
||||||
@ -276,7 +273,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o;
|
||||||
|
|
||||||
if (track.HasCompleted && !track.Looping && !beatmapBacking.Disabled && beatmapSets.Any())
|
if (track.HasCompleted && !track.Looping && !beatmap.Disabled && beatmapSets.Any())
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -289,7 +286,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (track == null)
|
if (track == null)
|
||||||
{
|
{
|
||||||
if (!beatmapBacking.Disabled)
|
if (!beatmap.Disabled)
|
||||||
next(true);
|
next(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -307,8 +304,8 @@ namespace osu.Game.Overlays
|
|||||||
var playable = beatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? beatmapSets.LastOrDefault();
|
var playable = beatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? beatmapSets.LastOrDefault();
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmapBacking);
|
beatmap.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
|
||||||
beatmapBacking.Value.Track.Restart();
|
beatmap.Value.Track.Restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,8 +317,8 @@ namespace osu.Game.Overlays
|
|||||||
var playable = beatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? beatmapSets.FirstOrDefault();
|
var playable = beatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? beatmapSets.FirstOrDefault();
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
beatmapBacking.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmapBacking);
|
beatmap.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
|
||||||
beatmapBacking.Value.Track.Restart();
|
beatmap.Value.Track.Restart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
private RulesetContainer rulesetContainer;
|
private RulesetContainer rulesetContainer;
|
||||||
private readonly List<Container> layerContainers = new List<Container>();
|
private readonly List<Container> layerContainers = new List<Container>();
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
protected HitObjectComposer(Ruleset ruleset)
|
protected HitObjectComposer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
@ -38,9 +38,9 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame, IFrameBasedClock framedClock)
|
private void load(IGameBeatmap beatmap, IFrameBasedClock framedClock)
|
||||||
{
|
{
|
||||||
beatmap.BindTo(osuGame.Beatmap);
|
this.beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
private const float corner_radius = 5;
|
private const float corner_radius = 5;
|
||||||
private const float contents_padding = 15;
|
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;
|
protected Track Track => Beatmap.Value.Track;
|
||||||
|
|
||||||
private readonly Drawable background;
|
private readonly Drawable background;
|
||||||
@ -42,8 +42,10 @@ namespace osu.Game.Screens.Edit.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(IGameBeatmap beatmap, OsuColour colours)
|
||||||
{
|
{
|
||||||
|
Beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
background.Colour = colours.Gray1;
|
background.Colour = colours.Gray1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -15,7 +16,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class TimelinePart : CompositeDrawable
|
public abstract class TimelinePart : CompositeDrawable
|
||||||
{
|
{
|
||||||
public Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly Container timeline;
|
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()
|
private void updateRelativeChildSize()
|
||||||
{
|
{
|
||||||
// the track may not be loaded completely (only has a length once it is).
|
// the track may not be loaded completely (only has a length once it is).
|
||||||
|
@ -20,19 +20,17 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, IAdjustableClock adjustableClock)
|
private void load(OsuColour colours, IAdjustableClock adjustableClock)
|
||||||
{
|
{
|
||||||
TimelinePart markerPart, controlPointPart, bookmarkPart, breakPart;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
markerPart = new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
|
new MarkerPart(adjustableClock) { RelativeSizeAxes = Axes.Both },
|
||||||
controlPointPart = new ControlPointPart
|
new ControlPointPart
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Height = 0.35f
|
Height = 0.35f
|
||||||
},
|
},
|
||||||
bookmarkPart = new BookmarkPart
|
new BookmarkPart
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
@ -67,7 +65,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
breakPart = new BreakPart
|
new BreakPart
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
@ -75,11 +73,6 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary
|
|||||||
Height = 0.25f
|
Height = 0.25f
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
markerPart.Beatmap.BindTo(Beatmap);
|
|
||||||
controlPointPart.Beatmap.BindTo(Beatmap);
|
|
||||||
bookmarkPart.Beatmap.BindTo(Beatmap);
|
|
||||||
breakPart.Beatmap.BindTo(Beatmap);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,9 +128,9 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Right = 10 },
|
Padding = new MarginPadding { Right = 10 },
|
||||||
Child = timeInfo = new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
|
Child = new TimeInfoContainer { RelativeSizeAxes = Axes.Both },
|
||||||
},
|
},
|
||||||
timeline = new SummaryTimeline
|
new SummaryTimeline
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Left = 10 },
|
Padding = new MarginPadding { Left = 10 },
|
||||||
Child = playback = new PlaybackControl { RelativeSizeAxes = Axes.Both },
|
Child = new PlaybackControl { RelativeSizeAxes = Axes.Both },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -148,9 +148,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
timeInfo.Beatmap.BindTo(Beatmap);
|
|
||||||
timeline.Beatmap.BindTo(Beatmap);
|
|
||||||
playback.Beatmap.BindTo(Beatmap);
|
|
||||||
menuBar.Mode.ValueChanged += onModeChanged;
|
menuBar.Mode.ValueChanged += onModeChanged;
|
||||||
|
|
||||||
bottomBackground.Colour = colours.Gray2;
|
bottomBackground.Colour = colours.Gray2;
|
||||||
@ -178,7 +175,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentScreen.Beatmap.BindTo(Beatmap);
|
|
||||||
LoadComponentAsync(currentScreen, screenContainer.Add);
|
LoadComponentAsync(currentScreen, screenContainer.Add);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
|||||||
if (beatDivisor != null)
|
if (beatDivisor != null)
|
||||||
this.beatDivisor.BindTo(beatDivisor);
|
this.beatDivisor.BindTo(beatDivisor);
|
||||||
|
|
||||||
ScrollableTimeline timeline;
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new GridContainer
|
new GridContainer
|
||||||
@ -65,7 +64,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding { Right = 5 },
|
Padding = new MarginPadding { Right = 5 },
|
||||||
Child = timeline = new ScrollableTimeline { RelativeSizeAxes = Axes.Both }
|
Child = new ScrollableTimeline { RelativeSizeAxes = Axes.Both }
|
||||||
},
|
},
|
||||||
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
|
new BeatDivisorControl(beatDivisor) { RelativeSizeAxes = Axes.Both }
|
||||||
},
|
},
|
||||||
@ -94,8 +93,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
timeline.Beatmap.BindTo(Beatmap);
|
|
||||||
|
|
||||||
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
|
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
|
||||||
if (ruleset == null)
|
if (ruleset == null)
|
||||||
{
|
{
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Audio;
|
using osu.Framework.Graphics.Audio;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -11,14 +10,13 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
{
|
{
|
||||||
public class BeatmapWaveformGraph : CompositeDrawable
|
public class BeatmapWaveformGraph : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
public WorkingBeatmap Beatmap { set => graph.Waveform = value.Waveform; }
|
||||||
|
|
||||||
private readonly WaveformGraph graph;
|
private readonly WaveformGraph graph;
|
||||||
|
|
||||||
public BeatmapWaveformGraph()
|
public BeatmapWaveformGraph()
|
||||||
{
|
{
|
||||||
InternalChild = graph = new WaveformGraph { RelativeSizeAxes = Axes.Both };
|
InternalChild = graph = new WaveformGraph { RelativeSizeAxes = Axes.Both };
|
||||||
Beatmap.ValueChanged += b => graph.Waveform = b.Waveform;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Configuration;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
@ -14,8 +12,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
{
|
{
|
||||||
public class ScrollableTimeline : CompositeDrawable
|
public class ScrollableTimeline : CompositeDrawable
|
||||||
{
|
{
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
|
||||||
|
|
||||||
private readonly ScrollingTimelineContainer timelineContainer;
|
private readonly ScrollingTimelineContainer timelineContainer;
|
||||||
|
|
||||||
public ScrollableTimeline()
|
public ScrollableTimeline()
|
||||||
@ -117,7 +113,6 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
hitSoundsCheckbox.Current.Value = true;
|
hitSoundsCheckbox.Current.Value = true;
|
||||||
waveformCheckbox.Current.Value = true;
|
waveformCheckbox.Current.Value = true;
|
||||||
|
|
||||||
timelineContainer.Beatmap.BindTo(Beatmap);
|
|
||||||
timelineContainer.WaveformVisible.BindTo(waveformCheckbox.Current);
|
timelineContainer.WaveformVisible.BindTo(waveformCheckbox.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -17,7 +18,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
public readonly Bindable<bool> HitObjectsVisible = new Bindable<bool>();
|
public readonly Bindable<bool> HitObjectsVisible = new Bindable<bool>();
|
||||||
public readonly Bindable<bool> HitSoundsVisible = new Bindable<bool>();
|
public readonly Bindable<bool> HitSoundsVisible = new Bindable<bool>();
|
||||||
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
public readonly Bindable<bool> WaveformVisible = new Bindable<bool>();
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
|
||||||
|
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly BeatmapWaveformGraph waveform;
|
private readonly BeatmapWaveformGraph waveform;
|
||||||
|
|
||||||
@ -36,12 +38,22 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
|
|||||||
Content.AutoSizeAxes = Axes.None;
|
Content.AutoSizeAxes = Axes.None;
|
||||||
Content.RelativeSizeAxes = Axes.Both;
|
Content.RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
waveform.Beatmap.BindTo(Beatmap);
|
|
||||||
WaveformVisible.ValueChanged += waveformVisibilityChanged;
|
WaveformVisible.ValueChanged += waveformVisibilityChanged;
|
||||||
|
|
||||||
Zoom = 10;
|
Zoom = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(IGameBeatmap beatmap)
|
||||||
|
{
|
||||||
|
this.beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
|
beatmap.ValueChanged += beatmapChanged;
|
||||||
|
beatmapChanged(beatmap.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void beatmapChanged(WorkingBeatmap beatmap) => waveform.Beatmap = beatmap;
|
||||||
|
|
||||||
private float minZoom = 1;
|
private float minZoom = 1;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The minimum zoom level allowed.
|
/// The minimum zoom level allowed.
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -13,7 +14,7 @@ namespace osu.Game.Screens.Edit.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class EditorScreen : Container
|
public class EditorScreen : Container
|
||||||
{
|
{
|
||||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
@ -27,6 +28,12 @@ namespace osu.Game.Screens.Edit.Screens
|
|||||||
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
|
InternalChild = content = new Container { RelativeSizeAxes = Axes.Both };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(IGameBeatmap beatmap)
|
||||||
|
{
|
||||||
|
Beatmap.BindTo(beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -27,6 +27,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool DidLoadMenu;
|
public bool DidLoadMenu;
|
||||||
|
|
||||||
|
private GameBeatmap beatmapBacking;
|
||||||
|
|
||||||
private MainMenu mainMenu;
|
private MainMenu mainMenu;
|
||||||
private SampleChannel welcome;
|
private SampleChannel welcome;
|
||||||
private SampleChannel seeya;
|
private SampleChannel seeya;
|
||||||
@ -44,8 +46,10 @@ namespace osu.Game.Screens.Menu
|
|||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
|
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, GameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
beatmapBacking = beatmap.GetBoundCopy();
|
||||||
|
|
||||||
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
|
||||||
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
|
||||||
|
|
||||||
@ -72,8 +76,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
this.beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
|
||||||
track = beatmap.Track;
|
track = this.beatmap.Track;
|
||||||
|
|
||||||
welcome = audio.Sample.Get(@"welcome");
|
welcome = audio.Sample.Get(@"welcome");
|
||||||
seeya = audio.Sample.Get(@"seeya");
|
seeya = audio.Sample.Get(@"seeya");
|
||||||
@ -83,7 +87,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
Game.Beatmap.Value = beatmap;
|
beatmapBacking.Value = beatmap;
|
||||||
|
|
||||||
if (menuVoice)
|
if (menuVoice)
|
||||||
welcome.Play();
|
welcome.Play();
|
||||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public class LogoVisualisation : Drawable, IHasAccentColour
|
public class LogoVisualisation : Drawable, IHasAccentColour
|
||||||
{
|
{
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The number of bars to jump each update iteration.
|
/// The number of bars to jump each update iteration.
|
||||||
@ -78,9 +78,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(ShaderManager shaders, OsuGameBase game)
|
private void load(ShaderManager shaders, IGameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
beatmap.BindTo(game.Beatmap);
|
this.beatmap.BindTo(beatmap);
|
||||||
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
public override bool HandleKeyboardInput => false;
|
public override bool HandleKeyboardInput => false;
|
||||||
public override bool HandleMouseInput => false;
|
public override bool HandleMouseInput => false;
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
private readonly Box leftBox;
|
private readonly Box leftBox;
|
||||||
private readonly Box rightBox;
|
private readonly Box rightBox;
|
||||||
@ -66,9 +66,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, OsuColour colours)
|
private void load(IGameBeatmap beatmap, OsuColour colours)
|
||||||
{
|
{
|
||||||
beatmap.BindTo(game.Beatmap);
|
this.beatmap.BindTo(beatmap);
|
||||||
|
|
||||||
// linear colour looks better in this case, so let's use it for now.
|
// linear colour looks better in this case, so let's use it for now.
|
||||||
Color4 gradientDark = colours.Blue.Opacity(0).ToLinear();
|
Color4 gradientDark = colours.Blue.Opacity(0).ToLinear();
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
@ -61,36 +60,21 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool AllowBeatmapRulesetChange => true;
|
public virtual bool AllowBeatmapRulesetChange => true;
|
||||||
|
|
||||||
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
protected readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
protected virtual float BackgroundParallaxAmount => 1;
|
protected virtual float BackgroundParallaxAmount => 1;
|
||||||
|
|
||||||
private ParallaxContainer backgroundParallaxContainer;
|
private ParallaxContainer backgroundParallaxContainer;
|
||||||
|
|
||||||
public WorkingBeatmap InitialBeatmap
|
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (IsLoaded) throw new InvalidOperationException($"Cannot set {nameof(InitialBeatmap)} post-load.");
|
|
||||||
Beatmap.Value = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
protected readonly Bindable<RulesetInfo> Ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
private SampleChannel sampleExit;
|
private SampleChannel sampleExit;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuGameBase game, OsuGame osuGame, AudioManager audio)
|
private void load(IGameBeatmap beatmap, OsuGame osuGame, AudioManager audio)
|
||||||
{
|
{
|
||||||
if (game != null)
|
if (beatmap != null)
|
||||||
{
|
Beatmap.BindTo(beatmap);
|
||||||
//if we were given a beatmap at ctor time, we want to pass this on to the game-wide beatmap.
|
|
||||||
var localMap = Beatmap.Value;
|
|
||||||
Beatmap.BindTo(game.Beatmap);
|
|
||||||
if (localMap != null)
|
|
||||||
Beatmap.Value = localMap;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
{
|
{
|
||||||
|
@ -117,7 +117,7 @@ namespace osu.Game.Screens.Play
|
|||||||
// let's try again forcing the beatmap's ruleset.
|
// let's try again forcing the beatmap's ruleset.
|
||||||
ruleset = beatmap.BeatmapInfo.Ruleset;
|
ruleset = beatmap.BeatmapInfo.Ruleset;
|
||||||
rulesetInstance = ruleset.CreateInstance();
|
rulesetInstance = ruleset.CreateInstance();
|
||||||
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap);
|
RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!RulesetContainer.Objects.Any())
|
if (!RulesetContainer.Objects.Any())
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Screens.Play
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
Add(info = new BeatmapMetadataDisplay(Beatmap)
|
Add(info = new BeatmapMetadataDisplay(Beatmap.Value)
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public abstract class ScreenWithBeatmapBackground : OsuScreen
|
public abstract class ScreenWithBeatmapBackground : OsuScreen
|
||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
private static readonly Vector2 background_blur = new Vector2(20);
|
private static readonly Vector2 background_blur = new Vector2(20);
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
private const float overscan = 1.3f;
|
private const float overscan = 1.3f;
|
||||||
|
|
||||||
@ -272,10 +272,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
switch (mode)
|
switch (mode)
|
||||||
{
|
{
|
||||||
case ResultMode.Summary:
|
case ResultMode.Summary:
|
||||||
currentPage = new ResultsPageScore(score, Beatmap);
|
currentPage = new ResultsPageScore(score, Beatmap.Value);
|
||||||
break;
|
break;
|
||||||
case ResultMode.Ranking:
|
case ResultMode.Ranking:
|
||||||
currentPage = new ResultsPageRanking(score, Beatmap);
|
currentPage = new ResultsPageRanking(score, Beatmap.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Screens.Select
|
|||||||
protected readonly BeatmapDetailArea BeatmapDetails;
|
protected readonly BeatmapDetailArea BeatmapDetails;
|
||||||
private bool removeAutoModOnResume;
|
private bool removeAutoModOnResume;
|
||||||
|
|
||||||
|
private GameBeatmap beatmap;
|
||||||
|
|
||||||
public PlaySongSelect()
|
public PlaySongSelect()
|
||||||
{
|
{
|
||||||
FooterPanels.Add(modSelect = new ModSelectOverlay
|
FooterPanels.Add(modSelect = new ModSelectOverlay
|
||||||
@ -53,8 +55,10 @@ namespace osu.Game.Screens.Select
|
|||||||
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu)
|
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu, GameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
this.beatmap = beatmap.GetBoundCopy();
|
||||||
|
|
||||||
if (osu != null) SelectedMods.BindTo(osu.SelectedMods);
|
if (osu != null) SelectedMods.BindTo(osu.SelectedMods);
|
||||||
modSelect.SelectedMods.BindTo(SelectedMods);
|
modSelect.SelectedMods.BindTo(SelectedMods);
|
||||||
|
|
||||||
@ -156,7 +160,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
Beatmap.Value.Track.Looping = false;
|
Beatmap.Value.Track.Looping = false;
|
||||||
Beatmap.Disabled = true;
|
beatmap.Disabled = true;
|
||||||
|
|
||||||
sampleConfirm?.Play();
|
sampleConfirm?.Play();
|
||||||
|
|
||||||
|
@ -65,6 +65,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private CancellationTokenSource initialAddSetsTask;
|
private CancellationTokenSource initialAddSetsTask;
|
||||||
|
|
||||||
|
private GameBeatmap beatmap;
|
||||||
|
|
||||||
private DependencyContainer dependencies;
|
private DependencyContainer dependencies;
|
||||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
@ -179,8 +181,10 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
|
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, GameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
this.beatmap = beatmap.GetBoundCopy();
|
||||||
|
|
||||||
dependencies.CacheAs(this);
|
dependencies.CacheAs(this);
|
||||||
|
|
||||||
if (Footer != null)
|
if (Footer != null)
|
||||||
@ -212,14 +216,14 @@ namespace osu.Game.Screens.Select
|
|||||||
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets();
|
Carousel.BeatmapSets = this.beatmaps.GetAllUsableBeatmapSets();
|
||||||
|
|
||||||
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
Beatmap.DisabledChanged += disabled => Carousel.AllowSelection = !disabled;
|
||||||
Beatmap.TriggerChange();
|
|
||||||
|
|
||||||
Beatmap.ValueChanged += workingBeatmapChanged;
|
Beatmap.ValueChanged += workingBeatmapChanged;
|
||||||
|
|
||||||
|
workingBeatmapChanged(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Edit(BeatmapInfo beatmap)
|
public void Edit(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
this.beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||||
Push(new Editor());
|
Push(new Editor());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,7 +287,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID;
|
||||||
|
|
||||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap);
|
this.beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
|
||||||
ensurePlayingSelected(preview);
|
ensurePlayingSelected(preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -370,7 +374,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
|
||||||
{
|
{
|
||||||
UpdateBeatmap(Beatmap);
|
UpdateBeatmap(Beatmap.Value);
|
||||||
ensurePlayingSelected();
|
ensurePlayingSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Animations;
|
using osu.Framework.Graphics.Animations;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Storyboards.Drawables
|
namespace osu.Game.Storyboards.Drawables
|
||||||
{
|
{
|
||||||
@ -63,14 +64,14 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, TextureStore textureStore)
|
private void load(IGameBeatmap beatmap, TextureStore textureStore)
|
||||||
{
|
{
|
||||||
var basePath = Animation.Path.ToLowerInvariant();
|
var basePath = Animation.Path.ToLowerInvariant();
|
||||||
for (var frame = 0; frame < Animation.FrameCount; frame++)
|
for (var frame = 0; frame < Animation.FrameCount; frame++)
|
||||||
{
|
{
|
||||||
var framePath = basePath.Replace(".", frame + ".");
|
var framePath = basePath.Replace(".", frame + ".");
|
||||||
|
|
||||||
var path = game.Beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == framePath)?.FileInfo.StoragePath;
|
var path = beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == framePath)?.FileInfo.StoragePath;
|
||||||
if (path == null)
|
if (path == null)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Storyboards.Drawables
|
namespace osu.Game.Storyboards.Drawables
|
||||||
{
|
{
|
||||||
@ -62,10 +63,10 @@ namespace osu.Game.Storyboards.Drawables
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase game, TextureStore textureStore)
|
private void load(IGameBeatmap beatmap, TextureStore textureStore)
|
||||||
{
|
{
|
||||||
var spritePath = Sprite.Path.ToLowerInvariant();
|
var spritePath = Sprite.Path.ToLowerInvariant();
|
||||||
var path = game.Beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
var path = beatmap.Value.BeatmapSetInfo.Files.FirstOrDefault(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
|
||||||
if (path == null)
|
if (path == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -25,24 +25,20 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||||
=> dependencies = new DependencyContainer(parent);
|
=> dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
private OsuGameBase osuGame;
|
|
||||||
|
|
||||||
protected EditorClockTestCase()
|
protected EditorClockTestCase()
|
||||||
{
|
{
|
||||||
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
|
Clock = new EditorClock(new ControlPointInfo(), BeatDivisor) { IsCoupled = false };
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load()
|
||||||
{
|
{
|
||||||
this.osuGame = osuGame;
|
|
||||||
|
|
||||||
dependencies.Cache(BeatDivisor);
|
dependencies.Cache(BeatDivisor);
|
||||||
dependencies.CacheAs<IFrameBasedClock>(Clock);
|
dependencies.CacheAs<IFrameBasedClock>(Clock);
|
||||||
dependencies.CacheAs<IAdjustableClock>(Clock);
|
dependencies.CacheAs<IAdjustableClock>(Clock);
|
||||||
|
|
||||||
osuGame.Beatmap.ValueChanged += beatmapChanged;
|
Beatmap.ValueChanged += beatmapChanged;
|
||||||
beatmapChanged(osuGame.Beatmap.Value);
|
beatmapChanged(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void beatmapChanged(WorkingBeatmap working)
|
private void beatmapChanged(WorkingBeatmap working)
|
||||||
@ -68,12 +64,5 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
osuGame.Beatmap.ValueChanged -= beatmapChanged;
|
|
||||||
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load()
|
||||||
{
|
{
|
||||||
osuGame.Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo);
|
Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo);
|
||||||
|
|
||||||
LoadComponentAsync(new Editor(), LoadScreen);
|
LoadComponentAsync(new Editor(), LoadScreen);
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,28 @@
|
|||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual
|
namespace osu.Game.Tests.Visual
|
||||||
{
|
{
|
||||||
public abstract class OsuTestCase : TestCase
|
public abstract class OsuTestCase : TestCase
|
||||||
{
|
{
|
||||||
|
protected readonly GameBeatmap Beatmap = new GameBeatmap(new DummyWorkingBeatmap());
|
||||||
|
|
||||||
|
private DependencyContainer dependencies;
|
||||||
|
|
||||||
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
||||||
|
=> dependencies = new DependencyContainer(parent);
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
dependencies.CacheAs<IGameBeatmap>(Beatmap);
|
||||||
|
dependencies.Cache(Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner();
|
protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner();
|
||||||
|
|
||||||
public class OsuTestCaseTestRunner : OsuGameBase, ITestCaseTestRunner
|
public class OsuTestCaseTestRunner : OsuGameBase, ITestCaseTestRunner
|
||||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
new ScrollContainer
|
new ScrollContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Child = new BeatmapList(ruleset)
|
Child = new BeatmapList(ruleset, Beatmap)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -108,10 +108,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
private readonly Container<BeatmapDisplay> beatmapDisplays;
|
private readonly Container<BeatmapDisplay> beatmapDisplays;
|
||||||
private readonly Ruleset ruleset;
|
private readonly Ruleset ruleset;
|
||||||
|
private readonly GameBeatmap beatmapBindable;
|
||||||
|
|
||||||
public BeatmapList(Ruleset ruleset)
|
public BeatmapList(Ruleset ruleset, GameBeatmap beatmapBindable)
|
||||||
{
|
{
|
||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset;
|
||||||
|
this.beatmapBindable = beatmapBindable;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
@ -130,7 +132,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
var sets = beatmaps.GetAllUsableBeatmapSets();
|
var sets = beatmaps.GetAllUsableBeatmapSets();
|
||||||
var allBeatmaps = sets.SelectMany(s => s.Beatmaps).Where(b => ruleset.LegacyID == null || b.RulesetID == ruleset.LegacyID);
|
var allBeatmaps = sets.SelectMany(s => s.Beatmaps).Where(b => ruleset.LegacyID == null || b.RulesetID == ruleset.LegacyID);
|
||||||
|
|
||||||
allBeatmaps.ForEach(b => beatmapDisplays.Add(new BeatmapDisplay(b)));
|
allBeatmaps.ForEach(b => beatmapDisplays.Add(new BeatmapDisplay(b, beatmapBindable)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class BeatmapDisplay : CompositeDrawable, IHasTooltip
|
private class BeatmapDisplay : CompositeDrawable, IHasTooltip
|
||||||
@ -138,27 +140,47 @@ namespace osu.Game.Tests.Visual
|
|||||||
private readonly OsuSpriteText text;
|
private readonly OsuSpriteText text;
|
||||||
private readonly BeatmapInfo beatmap;
|
private readonly BeatmapInfo beatmap;
|
||||||
|
|
||||||
|
private readonly GameBeatmap beatmapBindable;
|
||||||
|
|
||||||
private BeatmapManager beatmaps;
|
private BeatmapManager beatmaps;
|
||||||
private OsuGameBase osuGame;
|
|
||||||
|
|
||||||
private bool isSelected;
|
private bool isSelected;
|
||||||
|
|
||||||
public string TooltipText => text.Text;
|
public string TooltipText => text.Text;
|
||||||
|
|
||||||
public BeatmapDisplay(BeatmapInfo beatmap)
|
public BeatmapDisplay(BeatmapInfo beatmap, GameBeatmap beatmapBindable)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
|
this.beatmapBindable = beatmapBindable;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
InternalChild = text = new OsuSpriteText();
|
InternalChild = text = new OsuSpriteText();
|
||||||
|
|
||||||
|
this.beatmapBindable.ValueChanged += beatmapChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(BeatmapManager beatmaps)
|
||||||
|
{
|
||||||
|
this.beatmaps = beatmaps;
|
||||||
|
|
||||||
|
var working = beatmaps.GetWorkingBeatmap(beatmap);
|
||||||
|
text.Text = $"{working.Metadata.Artist} - {working.Metadata.Title} ({working.Metadata.AuthorString}) [{working.BeatmapInfo.Version}]";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void beatmapChanged(WorkingBeatmap newBeatmap)
|
||||||
|
{
|
||||||
|
if (isSelected)
|
||||||
|
this.FadeColour(Color4.White, 100);
|
||||||
|
isSelected = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(InputState state)
|
protected override bool OnClick(InputState state)
|
||||||
{
|
{
|
||||||
if (osuGame.Beatmap.Value.BeatmapInfo.ID == beatmap.ID)
|
if (beatmapBindable.Value.BeatmapInfo.ID == beatmap.ID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
osuGame.Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
beatmapBindable.Value = beatmaps.GetWorkingBeatmap(beatmap);
|
||||||
isSelected = true;
|
isSelected = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -177,25 +199,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
return;
|
return;
|
||||||
this.FadeColour(Color4.White, 100);
|
this.FadeColour(Color4.White, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuGameBase osuGame, BeatmapManager beatmaps)
|
|
||||||
{
|
|
||||||
this.osuGame = osuGame;
|
|
||||||
this.beatmaps = beatmaps;
|
|
||||||
|
|
||||||
var working = beatmaps.GetWorkingBeatmap(beatmap);
|
|
||||||
text.Text = $"{working.Metadata.Artist} - {working.Metadata.Title} ({working.Metadata.AuthorString}) [{working.BeatmapInfo.Version}]";
|
|
||||||
|
|
||||||
osuGame.Beatmap.ValueChanged += beatmapChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void beatmapChanged(WorkingBeatmap newBeatmap)
|
|
||||||
{
|
|
||||||
if (isSelected)
|
|
||||||
this.FadeColour(Color4.White, 100);
|
|
||||||
isSelected = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -204,7 +207,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
private readonly FillFlowContainer<PerformanceDisplay> scores;
|
private readonly FillFlowContainer<PerformanceDisplay> scores;
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
|
|
||||||
private readonly Bindable<WorkingBeatmap> currentBeatmap = new Bindable<WorkingBeatmap>();
|
private readonly IBindable<WorkingBeatmap> currentBeatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public PerformanceList()
|
public PerformanceList()
|
||||||
{
|
{
|
||||||
@ -220,7 +223,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame, APIAccess api)
|
private void load(IGameBeatmap beatmap, APIAccess api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
@ -235,7 +238,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentBeatmap.ValueChanged += beatmapChanged;
|
currentBeatmap.ValueChanged += beatmapChanged;
|
||||||
currentBeatmap.BindTo(osuGame.Beatmap);
|
currentBeatmap.BindTo(beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private GetScoresRequest lastRequest;
|
private GetScoresRequest lastRequest;
|
||||||
@ -333,9 +336,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osuGame)
|
private void load(IGameBeatmap beatmap)
|
||||||
{
|
{
|
||||||
osuGame.Beatmap.ValueChanged += beatmapChanged;
|
beatmap.ValueChanged += beatmapChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Cached informationCache = new Cached();
|
private Cached informationCache = new Cached();
|
||||||
|
@ -19,8 +19,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected Player Player;
|
protected Player Player;
|
||||||
|
|
||||||
private TestWorkingBeatmap working;
|
|
||||||
|
|
||||||
protected TestCasePlayer(Ruleset ruleset)
|
protected TestCasePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset;
|
||||||
@ -65,13 +63,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
var beatmap = CreateBeatmap(r);
|
var beatmap = CreateBeatmap(r);
|
||||||
|
|
||||||
working = new TestWorkingBeatmap(beatmap);
|
Beatmap.Value = new TestWorkingBeatmap(beatmap);
|
||||||
working.Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) };
|
Beatmap.Value.Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) };
|
||||||
|
|
||||||
if (Player != null)
|
if (Player != null)
|
||||||
Remove(Player);
|
Remove(Player);
|
||||||
|
|
||||||
var player = CreatePlayer(working, r);
|
var player = CreatePlayer(Beatmap, r);
|
||||||
|
|
||||||
LoadComponentAsync(player, LoadScreen);
|
LoadComponentAsync(player, LoadScreen);
|
||||||
|
|
||||||
@ -82,14 +80,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (working != null)
|
// note that this will override any mod rate application
|
||||||
// note that this will override any mod rate application
|
Beatmap.Value.Track.Rate = Clock.Rate;
|
||||||
working.Track.Rate = Clock.Rate;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player
|
protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player
|
||||||
{
|
{
|
||||||
InitialBeatmap = beatmap,
|
|
||||||
AllowPause = false,
|
AllowPause = false,
|
||||||
AllowLeadIn = false,
|
AllowLeadIn = false,
|
||||||
AllowResults = false,
|
AllowResults = false,
|
||||||
|
Reference in New Issue
Block a user