mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Merge branch 'master' into combo-colors
This commit is contained in:
@ -5,6 +5,6 @@
|
|||||||
"version": "3.1.100"
|
"version": "3.1.100"
|
||||||
},
|
},
|
||||||
"msbuild-sdks": {
|
"msbuild-sdks": {
|
||||||
"Microsoft.Build.Traversal": "2.0.52"
|
"Microsoft.Build.Traversal": "2.1.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -51,7 +51,7 @@
|
|||||||
<Reference Include="Java.Interop" />
|
<Reference Include="Java.Interop" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.812.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.904.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.819.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.904.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
|
|
||||||
@ -23,19 +22,19 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
|||||||
{
|
{
|
||||||
Name = @"Fruit Count",
|
Name = @"Fruit Count",
|
||||||
Content = fruits.ToString(),
|
Content = fruits.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Juice Stream Count",
|
Name = @"Juice Stream Count",
|
||||||
Content = juiceStreams.ToString(),
|
Content = juiceStreams.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Banana Shower Count",
|
Name = @"Banana Shower Count",
|
||||||
Content = bananaShowers.ToString(),
|
Content = bananaShowers.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Spinners),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mania.UI;
|
using osu.Game.Rulesets.Mania.UI;
|
||||||
@ -41,14 +40,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Note Count",
|
Name = @"Note Count",
|
||||||
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
|
||||||
Content = notes.ToString(),
|
Content = notes.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Hold Note Count",
|
Name = @"Hold Note Count",
|
||||||
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
|
||||||
Content = holdnotes.ToString(),
|
Content = holdnotes.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables;
|
|||||||
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
@ -32,8 +31,6 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audioManager { get; set; }
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
private TrackVirtualManual track;
|
|
||||||
|
|
||||||
protected override bool Autoplay => autoplay;
|
protected override bool Autoplay => autoplay;
|
||||||
private bool autoplay;
|
private bool autoplay;
|
||||||
|
|
||||||
@ -44,11 +41,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
private const double fade_in_modifier = -1200;
|
private const double fade_in_modifier = -1200;
|
||||||
|
|
||||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
||||||
{
|
=> new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
||||||
var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
|
||||||
track = (TrackVirtualManual)working.Track;
|
|
||||||
return working;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RulesetConfigCache configCache)
|
private void load(RulesetConfigCache configCache)
|
||||||
@ -72,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
AddStep("enable autoplay", () => autoplay = true);
|
AddStep("enable autoplay", () => autoplay = true);
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||||
|
|
||||||
double startTime = hitObjects[sliderIndex].StartTime;
|
double startTime = hitObjects[sliderIndex].StartTime;
|
||||||
retrieveDrawableSlider(sliderIndex);
|
retrieveDrawableSlider(sliderIndex);
|
||||||
@ -97,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
AddStep("have autoplay", () => autoplay = true);
|
AddStep("have autoplay", () => autoplay = true);
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||||
|
|
||||||
double startTime = hitObjects[sliderIndex].StartTime;
|
double startTime = hitObjects[sliderIndex].StartTime;
|
||||||
retrieveDrawableSlider(sliderIndex);
|
retrieveDrawableSlider(sliderIndex);
|
||||||
@ -201,7 +194,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private void addSeekStep(double time)
|
private void addSeekStep(double time)
|
||||||
{
|
{
|
||||||
AddStep($"seek to {time}", () => track.Seek(time));
|
AddStep($"seek to {time}", () => MusicController.SeekTo(time));
|
||||||
|
|
||||||
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,6 @@ using osu.Game.Scoring;
|
|||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using static osu.Game.Tests.Visual.OsuTestScene.ClockBackedTestWorkingBeatmap;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Tests
|
namespace osu.Game.Rulesets.Osu.Tests
|
||||||
{
|
{
|
||||||
@ -34,18 +33,12 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audioManager { get; set; }
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
private TrackVirtualManual track;
|
|
||||||
|
|
||||||
protected override bool Autoplay => true;
|
protected override bool Autoplay => true;
|
||||||
|
|
||||||
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new ScoreExposedPlayer();
|
protected override TestPlayer CreatePlayer(Ruleset ruleset) => new ScoreExposedPlayer();
|
||||||
|
|
||||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
||||||
{
|
=> new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
||||||
var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
|
||||||
track = (TrackVirtualManual)working.Track;
|
|
||||||
return working;
|
|
||||||
}
|
|
||||||
|
|
||||||
private DrawableSpinner drawableSpinner;
|
private DrawableSpinner drawableSpinner;
|
||||||
private SpriteIcon spinnerSymbol => drawableSpinner.ChildrenOfType<SpriteIcon>().Single();
|
private SpriteIcon spinnerSymbol => drawableSpinner.ChildrenOfType<SpriteIcon>().Single();
|
||||||
@ -55,7 +48,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
{
|
{
|
||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
|
|
||||||
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||||
AddStep("retrieve spinner", () => drawableSpinner = (DrawableSpinner)Player.DrawableRuleset.Playfield.AllHitObjects.First());
|
AddStep("retrieve spinner", () => drawableSpinner = (DrawableSpinner)Player.DrawableRuleset.Playfield.AllHitObjects.First());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,7 +194,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
addSeekStep(0);
|
addSeekStep(0);
|
||||||
|
|
||||||
AddStep("adjust track rate", () => track.AddAdjustment(AdjustableProperty.Tempo, new BindableDouble(rate)));
|
AddStep("adjust track rate", () => MusicController.CurrentTrack.AddAdjustment(AdjustableProperty.Tempo, new BindableDouble(rate)));
|
||||||
// autoplay replay frames use track time;
|
// autoplay replay frames use track time;
|
||||||
// if a spin takes 1000ms in track time and we're playing with a 2x rate adjustment, the spin will take 500ms of *real* time.
|
// if a spin takes 1000ms in track time and we're playing with a 2x rate adjustment, the spin will take 500ms of *real* time.
|
||||||
// therefore we need to apply the rate adjustment to the replay itself to change from track time to real time,
|
// therefore we need to apply the rate adjustment to the replay itself to change from track time to real time,
|
||||||
@ -230,7 +223,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
|||||||
|
|
||||||
private void addSeekStep(double time)
|
private void addSeekStep(double time)
|
||||||
{
|
{
|
||||||
AddStep($"seek to {time}", () => track.Seek(time));
|
AddStep($"seek to {time}", () => MusicController.SeekTo(time));
|
||||||
|
|
||||||
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
@ -23,19 +22,19 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
|||||||
{
|
{
|
||||||
Name = @"Circle Count",
|
Name = @"Circle Count",
|
||||||
Content = circles.ToString(),
|
Content = circles.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Slider Count",
|
Name = @"Slider Count",
|
||||||
Content = sliders.ToString(),
|
Content = sliders.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Spinner Count",
|
Name = @"Spinner Count",
|
||||||
Content = spinners.ToString(),
|
Content = spinners.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Spinners),
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<Import Project="..\osu.TestProject.props" />
|
<Import Project="..\osu.TestProject.props" />
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
@ -22,20 +21,20 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
|||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Hit Count",
|
Name = @"Hit Count",
|
||||||
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Circles),
|
||||||
Content = hits.ToString(),
|
Content = hits.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Drumroll Count",
|
Name = @"Drumroll Count",
|
||||||
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Sliders),
|
||||||
Content = drumrolls.ToString(),
|
Content = drumrolls.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
|
||||||
},
|
},
|
||||||
new BeatmapStatistic
|
new BeatmapStatistic
|
||||||
{
|
{
|
||||||
Name = @"Swell Count",
|
Name = @"Swell Count",
|
||||||
|
CreateIcon = () => new BeatmapStatisticIcon(BeatmapStatisticsIconType.Spinners),
|
||||||
Content = swells.ToString(),
|
Content = swells.ToString(),
|
||||||
Icon = FontAwesome.Regular.Circle
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
|
|
||||||
protected override Texture GetBackground() => throw new NotImplementedException();
|
protected override Texture GetBackground() => throw new NotImplementedException();
|
||||||
|
|
||||||
protected override Track GetTrack() => throw new NotImplementedException();
|
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Visual;
|
using osu.Game.Tests.Visual;
|
||||||
@ -19,7 +17,14 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
{
|
{
|
||||||
GameplayClockContainer gcc = null;
|
GameplayClockContainer gcc = null;
|
||||||
|
|
||||||
AddStep("create container", () => Add(gcc = new GameplayClockContainer(CreateWorkingBeatmap(new OsuRuleset().RulesetInfo), Array.Empty<Mod>(), 0)));
|
AddStep("create container", () =>
|
||||||
|
{
|
||||||
|
var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
working.LoadTrack();
|
||||||
|
|
||||||
|
Add(gcc = new GameplayClockContainer(working, 0));
|
||||||
|
});
|
||||||
|
|
||||||
AddStep("start track", () => gcc.Start());
|
AddStep("start track", () => gcc.Start());
|
||||||
AddUntilStep("elapsed greater than zero", () => gcc.GameplayClock.ElapsedFrameTime > 0);
|
AddUntilStep("elapsed greater than zero", () => gcc.GameplayClock.ElapsedFrameTime > 0);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,10 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
|
|
||||||
AddStep("create container", () =>
|
AddStep("create container", () =>
|
||||||
{
|
{
|
||||||
Add(gameplayContainer = new GameplayClockContainer(CreateWorkingBeatmap(new OsuRuleset().RulesetInfo), Array.Empty<Mod>(), 0));
|
var working = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);
|
||||||
|
working.LoadTrack();
|
||||||
|
|
||||||
|
Add(gameplayContainer = new GameplayClockContainer(working, 0));
|
||||||
|
|
||||||
gameplayContainer.Add(sample = new DrawableStoryboardSample(new StoryboardSampleInfo(string.Empty, 0, 1))
|
gameplayContainer.Add(sample = new DrawableStoryboardSample(new StoryboardSampleInfo(string.Empty, 0, 1))
|
||||||
{
|
{
|
||||||
@ -103,7 +106,7 @@ namespace osu.Game.Tests.Gameplay
|
|||||||
Beatmap.Value = new TestCustomSkinWorkingBeatmap(new OsuRuleset().RulesetInfo, Audio);
|
Beatmap.Value = new TestCustomSkinWorkingBeatmap(new OsuRuleset().RulesetInfo, Audio);
|
||||||
SelectedMods.Value = new[] { testedMod };
|
SelectedMods.Value = new[] { testedMod };
|
||||||
|
|
||||||
Add(gameplayContainer = new GameplayClockContainer(Beatmap.Value, SelectedMods.Value, 0));
|
Add(gameplayContainer = new GameplayClockContainer(Beatmap.Value, 0));
|
||||||
|
|
||||||
gameplayContainer.Add(sample = new TestDrawableStoryboardSample(new StoryboardSampleInfo("test-sample", 1, 1))
|
gameplayContainer.Add(sample = new TestDrawableStoryboardSample(new StoryboardSampleInfo("test-sample", 1, 1))
|
||||||
{
|
{
|
||||||
|
@ -26,6 +26,7 @@ namespace osu.Game.Tests.Skins
|
|||||||
{
|
{
|
||||||
var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result;
|
var imported = beatmaps.Import(new ZipArchiveReader(TestResources.OpenResource("Archives/ogg-beatmap.osz"))).Result;
|
||||||
beatmap = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]);
|
beatmap = beatmaps.GetWorkingBeatmap(imported.Beatmaps[0]);
|
||||||
|
beatmap.LoadTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
@ -18,8 +17,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
public class TestSceneCompletionCancellation : OsuPlayerTestScene
|
public class TestSceneCompletionCancellation : OsuPlayerTestScene
|
||||||
{
|
{
|
||||||
private Track track;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audio { get; set; }
|
private AudioManager audio { get; set; }
|
||||||
|
|
||||||
@ -34,7 +31,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
base.SetUpSteps();
|
base.SetUpSteps();
|
||||||
|
|
||||||
// Ensure track has actually running before attempting to seek
|
// Ensure track has actually running before attempting to seek
|
||||||
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -73,13 +70,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private void complete()
|
private void complete()
|
||||||
{
|
{
|
||||||
AddStep("seek to completion", () => track.Seek(5000));
|
AddStep("seek to completion", () => Beatmap.Value.Track.Seek(5000));
|
||||||
AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value);
|
AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancel()
|
private void cancel()
|
||||||
{
|
{
|
||||||
AddStep("rewind to cancel", () => track.Seek(4000));
|
AddStep("rewind to cancel", () => Beatmap.Value.Track.Seek(4000));
|
||||||
AddUntilStep("completion cleared by processor", () => !Player.ScoreProcessor.HasCompleted.Value);
|
AddUntilStep("completion cleared by processor", () => !Player.ScoreProcessor.HasCompleted.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,11 +88,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
||||||
{
|
=> new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audio);
|
||||||
var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audio);
|
|
||||||
track = working.Track;
|
|
||||||
return working;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,6 @@ using System.Linq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -21,19 +20,13 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audioManager { get; set; }
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
private Track track;
|
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null) =>
|
||||||
|
new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
||||||
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
|
|
||||||
{
|
|
||||||
var working = new ClockBackedTestWorkingBeatmap(beatmap, storyboard, new FramedClock(new ManualClock { Rate = 1 }), audioManager);
|
|
||||||
track = working.Track;
|
|
||||||
return working;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestNoJudgementsOnRewind()
|
public void TestNoJudgementsOnRewind()
|
||||||
{
|
{
|
||||||
AddUntilStep("wait for track to start running", () => track.IsRunning);
|
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||||
addSeekStep(3000);
|
addSeekStep(3000);
|
||||||
AddAssert("all judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged));
|
AddAssert("all judged", () => Player.DrawableRuleset.Playfield.AllHitObjects.All(h => h.Judged));
|
||||||
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses >= 7));
|
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses >= 7));
|
||||||
@ -46,7 +39,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private void addSeekStep(double time)
|
private void addSeekStep(double time)
|
||||||
{
|
{
|
||||||
AddStep($"seek to {time}", () => track.Seek(time));
|
AddStep($"seek to {time}", () => Beatmap.Value.Track.Seek(time));
|
||||||
|
|
||||||
// Allow a few frames of lenience
|
// Allow a few frames of lenience
|
||||||
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
AddUntilStep("wait for seek to finish", () => Precision.AlmostEquals(time, Player.DrawableRuleset.FrameStableClock.CurrentTime, 100));
|
||||||
|
@ -1,11 +1,9 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Rulesets.Mods;
|
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -32,7 +30,10 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
increment = skip_time;
|
increment = skip_time;
|
||||||
|
|
||||||
Child = gameplayClockContainer = new GameplayClockContainer(CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo)), Array.Empty<Mod>(), 0)
|
var working = CreateWorkingBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
|
||||||
|
working.LoadTrack();
|
||||||
|
|
||||||
|
Child = gameplayClockContainer = new GameplayClockContainer(working, 0)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -22,19 +22,32 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneStoryboard : OsuTestScene
|
public class TestSceneStoryboard : OsuTestScene
|
||||||
{
|
{
|
||||||
private readonly Container<DrawableStoryboard> storyboardContainer;
|
private Container<DrawableStoryboard> storyboardContainer;
|
||||||
private DrawableStoryboard storyboard;
|
private DrawableStoryboard storyboard;
|
||||||
|
|
||||||
[Cached]
|
[Test]
|
||||||
private MusicController musicController = new MusicController();
|
public void TestStoryboard()
|
||||||
|
{
|
||||||
|
AddStep("Restart", restart);
|
||||||
|
AddToggleStep("Passing", passing =>
|
||||||
|
{
|
||||||
|
if (storyboard != null) storyboard.Passing = passing;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public TestSceneStoryboard()
|
[Test]
|
||||||
|
public void TestStoryboardMissingVideo()
|
||||||
|
{
|
||||||
|
AddStep("Load storyboard with missing video", loadStoryboardNoVideo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
Clock = new FramedClock();
|
Clock = new FramedClock();
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
musicController,
|
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -58,32 +71,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
State = { Value = Visibility.Visible },
|
State = { Value = Visibility.Visible },
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e) => loadStoryboard(e.NewValue);
|
||||||
public void TestStoryboard()
|
|
||||||
{
|
|
||||||
AddStep("Restart", restart);
|
|
||||||
AddToggleStep("Passing", passing =>
|
|
||||||
{
|
|
||||||
if (storyboard != null) storyboard.Passing = passing;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestStoryboardMissingVideo()
|
|
||||||
{
|
|
||||||
AddStep("Load storyboard with missing video", loadStoryboardNoVideo);
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
Beatmap.ValueChanged += beatmapChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
|
||||||
=> loadStoryboard(e.NewValue);
|
|
||||||
|
|
||||||
private void restart()
|
private void restart()
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
// 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 NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Screens.Menu;
|
using osu.Game.Screens.Menu;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Menus
|
namespace osu.Game.Tests.Visual.Menus
|
||||||
@ -15,11 +15,9 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
|
|
||||||
public TestSceneIntroWelcome()
|
public TestSceneIntroWelcome()
|
||||||
{
|
{
|
||||||
AddUntilStep("wait for load", () => getTrack() != null);
|
AddUntilStep("wait for load", () => MusicController.TrackLoaded);
|
||||||
|
AddAssert("correct track", () => Precision.AlmostEquals(MusicController.CurrentTrack.Length, 48000, 1));
|
||||||
AddAssert("check if menu music loops", () => getTrack().Looping);
|
AddAssert("check if menu music loops", () => MusicController.CurrentTrack.Looping);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Track getTrack() => (IntroStack?.CurrentScreen as MainMenu)?.Track;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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.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;
|
||||||
@ -11,14 +10,10 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
{
|
{
|
||||||
public class TestSceneSongTicker : OsuTestScene
|
public class TestSceneSongTicker : OsuTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
|
||||||
private MusicController musicController = new MusicController();
|
|
||||||
|
|
||||||
public TestSceneSongTicker()
|
public TestSceneSongTicker()
|
||||||
{
|
{
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
musicController,
|
|
||||||
new SongTicker
|
new SongTicker
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual.Menus
|
|||||||
|
|
||||||
public class TestToolbar : Toolbar
|
public class TestToolbar : Toolbar
|
||||||
{
|
{
|
||||||
public new Bindable<OverlayActivation> OverlayActivationMode => base.OverlayActivationMode;
|
public new Bindable<OverlayActivation> OverlayActivationMode => base.OverlayActivationMode as Bindable<OverlayActivation>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -162,6 +162,28 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
AddAssert("item 2 has rate 2", () => Precision.AlmostEquals(2, ((OsuModDoubleTime)Room.Playlist.Last().RequiredMods[0]).SpeedChange.Value));
|
AddAssert("item 2 has rate 2", () => Precision.AlmostEquals(2, ((OsuModDoubleTime)Room.Playlist.Last().RequiredMods[0]).SpeedChange.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Tests that the global mod instances are not retained by the rooms, as global mod instances are retained and re-used by the mod select overlay.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void TestGlobalModInstancesNotRetained()
|
||||||
|
{
|
||||||
|
OsuModDoubleTime mod = null;
|
||||||
|
|
||||||
|
AddStep("set dt mod and store", () =>
|
||||||
|
{
|
||||||
|
SelectedMods.Value = new[] { new OsuModDoubleTime() };
|
||||||
|
|
||||||
|
// Mod select overlay replaces our mod.
|
||||||
|
mod = (OsuModDoubleTime)SelectedMods.Value[0];
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("create item", () => songSelect.BeatmapDetails.CreateNewItem());
|
||||||
|
|
||||||
|
AddStep("change stored mod rate", () => mod.SpeedChange.Value = 2);
|
||||||
|
AddAssert("item has rate 1.5", () => Precision.AlmostEquals(1.5, ((OsuModDoubleTime)Room.Playlist.First().RequiredMods[0]).SpeedChange.Value));
|
||||||
|
}
|
||||||
|
|
||||||
private class TestMatchSongSelect : MatchSongSelect
|
private class TestMatchSongSelect : MatchSongSelect
|
||||||
{
|
{
|
||||||
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
public new MatchBeatmapDetailArea BeatmapDetails => (MatchBeatmapDetailArea)base.BeatmapDetails;
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio.Track;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -46,7 +45,6 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
Player player = null;
|
Player player = null;
|
||||||
|
|
||||||
WorkingBeatmap beatmap() => Game.Beatmap.Value;
|
WorkingBeatmap beatmap() => Game.Beatmap.Value;
|
||||||
Track track() => beatmap().Track;
|
|
||||||
|
|
||||||
PushAndConfirm(() => new TestSongSelect());
|
PushAndConfirm(() => new TestSongSelect());
|
||||||
|
|
||||||
@ -62,30 +60,27 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
|
AddUntilStep("wait for player", () => (player = Game.ScreenStack.CurrentScreen as Player) != null);
|
||||||
AddUntilStep("wait for fail", () => player.HasFailed);
|
AddUntilStep("wait for fail", () => player.HasFailed);
|
||||||
|
|
||||||
AddUntilStep("wait for track stop", () => !track().IsRunning);
|
AddUntilStep("wait for track stop", () => !Game.MusicController.IsPlaying);
|
||||||
AddAssert("Ensure time before preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
|
AddAssert("Ensure time before preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().Metadata.PreviewTime);
|
||||||
|
|
||||||
pushEscape();
|
pushEscape();
|
||||||
|
|
||||||
AddUntilStep("wait for track playing", () => track().IsRunning);
|
AddUntilStep("wait for track playing", () => Game.MusicController.IsPlaying);
|
||||||
AddAssert("Ensure time wasn't reset to preview point", () => track().CurrentTime < beatmap().Metadata.PreviewTime);
|
AddAssert("Ensure time wasn't reset to preview point", () => Game.MusicController.CurrentTrack.CurrentTime < beatmap().Metadata.PreviewTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestMenuMakesMusic()
|
public void TestMenuMakesMusic()
|
||||||
{
|
{
|
||||||
WorkingBeatmap beatmap() => Game.Beatmap.Value;
|
|
||||||
Track track() => beatmap().Track;
|
|
||||||
|
|
||||||
TestSongSelect songSelect = null;
|
TestSongSelect songSelect = null;
|
||||||
|
|
||||||
PushAndConfirm(() => songSelect = new TestSongSelect());
|
PushAndConfirm(() => songSelect = new TestSongSelect());
|
||||||
|
|
||||||
AddUntilStep("wait for no track", () => track() is TrackVirtual);
|
AddUntilStep("wait for no track", () => Game.MusicController.CurrentTrack.IsDummyDevice);
|
||||||
|
|
||||||
AddStep("return to menu", () => songSelect.Exit());
|
AddStep("return to menu", () => songSelect.Exit());
|
||||||
|
|
||||||
AddUntilStep("wait for track", () => !(track() is TrackVirtual) && track().IsRunning);
|
AddUntilStep("wait for track", () => !Game.MusicController.CurrentTrack.IsDummyDevice && Game.MusicController.IsPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -140,12 +135,12 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
AddUntilStep("Wait for music controller", () => Game.MusicController.IsLoaded);
|
AddUntilStep("Wait for music controller", () => Game.MusicController.IsLoaded);
|
||||||
AddStep("Seek close to end", () =>
|
AddStep("Seek close to end", () =>
|
||||||
{
|
{
|
||||||
Game.MusicController.SeekTo(Game.Beatmap.Value.Track.Length - 1000);
|
Game.MusicController.SeekTo(Game.MusicController.CurrentTrack.Length - 1000);
|
||||||
Game.Beatmap.Value.Track.Completed += () => trackCompleted = true;
|
Game.MusicController.CurrentTrack.Completed += () => trackCompleted = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddUntilStep("Track was completed", () => trackCompleted);
|
AddUntilStep("Track was completed", () => trackCompleted);
|
||||||
AddUntilStep("Track was restarted", () => Game.Beatmap.Value.Track.IsRunning);
|
AddUntilStep("Track was restarted", () => Game.MusicController.IsPlaying);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushEscape() =>
|
private void pushEscape() =>
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestSceneFullscreenOverlay : OsuTestScene
|
public class TestSceneFullscreenOverlay : OsuTestScene
|
||||||
{
|
{
|
||||||
private FullscreenOverlay overlay;
|
private FullscreenOverlay<OverlayHeader> overlay;
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
@ -38,10 +38,10 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddAssert("fire count 3", () => fireCount == 3);
|
AddAssert("fire count 3", () => fireCount == 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestFullscreenOverlay : FullscreenOverlay
|
private class TestFullscreenOverlay : FullscreenOverlay<OverlayHeader>
|
||||||
{
|
{
|
||||||
public TestFullscreenOverlay()
|
public TestFullscreenOverlay()
|
||||||
: base(OverlayColourScheme.Pink)
|
: base(OverlayColourScheme.Pink, null)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
AddStep("Set activity", () => API.Activity.Value = new UserActivity.InLobby());
|
AddStep("Set activity", () => API.Activity.Value = new UserActivity.InLobby());
|
||||||
|
|
||||||
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(null, null)
|
AddStep("Set beatmap", () => Beatmap.Value = new DummyWorkingBeatmap(Audio, null)
|
||||||
{
|
{
|
||||||
BeatmapInfo = { OnlineBeatmapID = hasOnlineId ? 1234 : (int?)null }
|
BeatmapInfo = { OnlineBeatmapID = hasOnlineId ? 1234 : (int?)null }
|
||||||
});
|
});
|
||||||
|
@ -5,9 +5,9 @@ using System;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
@ -53,16 +53,13 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
private void showPersonalBestWithNullPosition()
|
private void showPersonalBestWithNullPosition()
|
||||||
{
|
{
|
||||||
leaderboard.TopScore = new APILegacyUserTopScoreInfo
|
leaderboard.TopScore = new ScoreInfo
|
||||||
{
|
|
||||||
Position = null,
|
|
||||||
Score = new APILegacyScoreInfo
|
|
||||||
{
|
{
|
||||||
Rank = ScoreRank.XH,
|
Rank = ScoreRank.XH,
|
||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock() },
|
||||||
User = new User
|
User = new User
|
||||||
{
|
{
|
||||||
Id = 6602580,
|
Id = 6602580,
|
||||||
@ -73,22 +70,19 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
FlagName = @"ES",
|
FlagName = @"ES",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPersonalBest()
|
private void showPersonalBest()
|
||||||
{
|
{
|
||||||
leaderboard.TopScore = new APILegacyUserTopScoreInfo
|
leaderboard.TopScore = new ScoreInfo
|
||||||
{
|
{
|
||||||
Position = 999,
|
Position = 999,
|
||||||
Score = new APILegacyScoreInfo
|
|
||||||
{
|
|
||||||
Rank = ScoreRank.XH,
|
Rank = ScoreRank.XH,
|
||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
User = new User
|
User = new User
|
||||||
{
|
{
|
||||||
Id = 6602580,
|
Id = 6602580,
|
||||||
@ -99,7 +93,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
FlagName = @"ES",
|
FlagName = @"ES",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,11 +6,11 @@ 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 osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.SongSelect
|
namespace osu.Game.Tests.Visual.SongSelect
|
||||||
@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
public TestSceneUserTopScoreContainer()
|
public TestSceneUserTopScoreContainer()
|
||||||
{
|
{
|
||||||
UserTopScoreContainer topScoreContainer;
|
UserTopScoreContainer<ScoreInfo> topScoreContainer;
|
||||||
|
|
||||||
Add(dialogOverlay = new DialogOverlay
|
Add(dialogOverlay = new DialogOverlay
|
||||||
{
|
{
|
||||||
@ -42,7 +42,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.DarkGreen,
|
Colour = Color4.DarkGreen,
|
||||||
},
|
},
|
||||||
topScoreContainer = new UserTopScoreContainer
|
topScoreContainer = new UserTopScoreContainer<ScoreInfo>(s => new LeaderboardScore(s, s.Position, false))
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
@ -52,16 +52,14 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
|
|
||||||
var scores = new[]
|
var scores = new[]
|
||||||
{
|
{
|
||||||
new APILegacyUserTopScoreInfo
|
new ScoreInfo
|
||||||
{
|
{
|
||||||
Position = 999,
|
Position = 999,
|
||||||
Score = new APILegacyScoreInfo
|
|
||||||
{
|
|
||||||
Rank = ScoreRank.XH,
|
Rank = ScoreRank.XH,
|
||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
TotalScore = 1707827,
|
TotalScore = 1707827,
|
||||||
Mods = new[] { new OsuModHidden().Acronym, new OsuModHardRock().Acronym, },
|
Mods = new Mod[] { new OsuModHidden(), new OsuModHardRock(), },
|
||||||
User = new User
|
User = new User
|
||||||
{
|
{
|
||||||
Id = 6602580,
|
Id = 6602580,
|
||||||
@ -72,13 +70,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
FlagName = @"ES",
|
FlagName = @"ES",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
new APILegacyUserTopScoreInfo
|
new ScoreInfo
|
||||||
{
|
{
|
||||||
Position = 110000,
|
Position = 110000,
|
||||||
Score = new APILegacyScoreInfo
|
|
||||||
{
|
|
||||||
Rank = ScoreRank.X,
|
Rank = ScoreRank.X,
|
||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
@ -93,13 +88,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
FlagName = @"BR",
|
FlagName = @"BR",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
new APILegacyUserTopScoreInfo
|
new ScoreInfo
|
||||||
{
|
{
|
||||||
Position = 22333,
|
Position = 22333,
|
||||||
Score = new APILegacyScoreInfo
|
|
||||||
{
|
|
||||||
Rank = ScoreRank.S,
|
Rank = ScoreRank.S,
|
||||||
Accuracy = 1,
|
Accuracy = 1,
|
||||||
MaxCombo = 244,
|
MaxCombo = 244,
|
||||||
@ -115,7 +107,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
||||||
|
@ -26,9 +26,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
private readonly NowPlayingOverlay np;
|
private readonly NowPlayingOverlay np;
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private MusicController musicController = new MusicController();
|
|
||||||
|
|
||||||
public TestSceneBeatSyncedContainer()
|
public TestSceneBeatSyncedContainer()
|
||||||
{
|
{
|
||||||
Clock = new FramedClock();
|
Clock = new FramedClock();
|
||||||
@ -36,7 +33,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
musicController,
|
|
||||||
new BeatContainer
|
new BeatContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
@ -71,6 +67,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private readonly Box flashLayer;
|
private readonly Box flashLayer;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
public BeatContainer()
|
public BeatContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
@ -165,7 +164,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
if (timingPoints.Count == 0) return 0;
|
if (timingPoints.Count == 0) return 0;
|
||||||
|
|
||||||
if (timingPoints[^1] == current)
|
if (timingPoints[^1] == current)
|
||||||
return (int)Math.Ceiling((Beatmap.Value.Track.Length - current.Time) / current.BeatLength);
|
return (int)Math.Ceiling((musicController.CurrentTrack.Length - current.Time) / current.BeatLength);
|
||||||
|
|
||||||
return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength);
|
return (int)Math.Ceiling((getNextTimingPoint(current).Time - current.Time) / current.BeatLength);
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
@ -79,7 +80,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
|
||||||
|
|
||||||
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
|
dependencies.Cache(rulesetStore = new RulesetStore(ContextFactory));
|
||||||
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, Audio, dependencies.Get<GameHost>(), Beatmap.Default));
|
dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesetStore, null, dependencies.Get<AudioManager>(), dependencies.Get<GameHost>(), Beatmap.Default));
|
||||||
dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, null, ContextFactory));
|
dependencies.Cache(scoreManager = new ScoreManager(rulesetStore, () => beatmapManager, LocalStorage, null, ContextFactory));
|
||||||
|
|
||||||
beatmap = beatmapManager.Import(TestResources.GetTestBeatmapForImport()).Result.Beatmaps[0];
|
beatmap = beatmapManager.Import(TestResources.GetTestBeatmapForImport()).Result.Beatmaps[0];
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -11,6 +12,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Tests.Resources;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.UserInterface
|
namespace osu.Game.Tests.Visual.UserInterface
|
||||||
{
|
{
|
||||||
@ -20,8 +22,6 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Cached]
|
[Cached]
|
||||||
private MusicController musicController = new MusicController();
|
private MusicController musicController = new MusicController();
|
||||||
|
|
||||||
private WorkingBeatmap currentBeatmap;
|
|
||||||
|
|
||||||
private NowPlayingOverlay nowPlayingOverlay;
|
private NowPlayingOverlay nowPlayingOverlay;
|
||||||
|
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
@ -76,16 +76,21 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
}
|
}
|
||||||
}).Wait(), 5);
|
}).Wait(), 5);
|
||||||
|
|
||||||
AddStep(@"Next track", () => musicController.NextTrack());
|
WorkingBeatmap currentBeatmap = null;
|
||||||
AddStep("Store track", () => currentBeatmap = Beatmap.Value);
|
|
||||||
|
AddStep("import beatmap with track", () =>
|
||||||
|
{
|
||||||
|
var setWithTrack = manager.Import(TestResources.GetTestBeatmapForImport()).Result;
|
||||||
|
Beatmap.Value = currentBeatmap = manager.GetWorkingBeatmap(setWithTrack.Beatmaps.First());
|
||||||
|
});
|
||||||
|
|
||||||
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
|
AddStep(@"Seek track to 6 second", () => musicController.SeekTo(6000));
|
||||||
AddUntilStep(@"Wait for current time to update", () => currentBeatmap.Track.CurrentTime > 5000);
|
AddUntilStep(@"Wait for current time to update", () => musicController.CurrentTrack.CurrentTime > 5000);
|
||||||
|
|
||||||
AddStep(@"Set previous", () => musicController.PreviousTrack());
|
AddStep(@"Set previous", () => musicController.PreviousTrack());
|
||||||
|
|
||||||
AddAssert(@"Check beatmap didn't change", () => currentBeatmap == Beatmap.Value);
|
AddAssert(@"Check beatmap didn't change", () => currentBeatmap == Beatmap.Value);
|
||||||
AddUntilStep("Wait for current time to update", () => currentBeatmap.Track.CurrentTime < 5000);
|
AddUntilStep("Wait for current time to update", () => musicController.CurrentTrack.CurrentTime < 5000);
|
||||||
|
|
||||||
AddStep(@"Set previous", () => musicController.PreviousTrack());
|
AddStep(@"Set previous", () => musicController.PreviousTrack());
|
||||||
AddAssert(@"Check beatmap did change", () => currentBeatmap != Beatmap.Value);
|
AddAssert(@"Check beatmap did change", () => currentBeatmap != Beatmap.Value);
|
||||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Tests
|
|||||||
|
|
||||||
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
|
protected override Waveform GetWaveform() => new Waveform(trackStore.GetStream(firstAudioFile));
|
||||||
|
|
||||||
protected override Track GetTrack() => trackStore.Get(firstAudioFile);
|
protected override Track GetBeatmapTrack() => trackStore.Get(firstAudioFile);
|
||||||
|
|
||||||
private string firstAudioFile
|
private string firstAudioFile
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
<PackageReference Include="DeepEqual" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
<PackageReference Update="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.4" />
|
||||||
|
41
osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs
Normal file
41
osu.Game.Tournament.Tests/Components/TestSceneDateTextBox.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Game.Tests.Visual;
|
||||||
|
using osu.Game.Tournament.Components;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Tests.Components
|
||||||
|
{
|
||||||
|
public class TestSceneDateTextBox : OsuManualInputManagerTestScene
|
||||||
|
{
|
||||||
|
private DateTextBox textBox;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void Setup() => Schedule(() =>
|
||||||
|
{
|
||||||
|
Child = textBox = new DateTextBox
|
||||||
|
{
|
||||||
|
Width = 0.3f
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCommitWithoutSettingBindable()
|
||||||
|
{
|
||||||
|
AddStep("click textbox", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(textBox);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("unfocus", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(Vector2.Zero);
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,7 +5,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
<PackageReference Include="Appveyor.TestLogger" Version="2.0.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -22,11 +22,12 @@ namespace osu.Game.Tournament.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hold a reference to the provided bindable so we don't have to in every settings section.
|
// hold a reference to the provided bindable so we don't have to in every settings section.
|
||||||
private Bindable<DateTimeOffset> bindable;
|
private Bindable<DateTimeOffset> bindable = new Bindable<DateTimeOffset>();
|
||||||
|
|
||||||
public DateTextBox()
|
public DateTextBox()
|
||||||
{
|
{
|
||||||
base.Bindable = new Bindable<string>();
|
base.Bindable = new Bindable<string>();
|
||||||
|
|
||||||
((OsuTextBox)Control).OnCommit = (sender, newText) =>
|
((OsuTextBox)Control).OnCommit = (sender, newText) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -26,6 +26,8 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
[Cached]
|
[Cached]
|
||||||
private LadderEditorInfo editorInfo = new LadderEditorInfo();
|
private LadderEditorInfo editorInfo = new LadderEditorInfo();
|
||||||
|
|
||||||
|
private WarningBox rightClickMessage;
|
||||||
|
|
||||||
protected override bool DrawLoserPaths => true;
|
protected override bool DrawLoserPaths => true;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -37,6 +39,16 @@ namespace osu.Game.Tournament.Screens.Editors
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Margin = new MarginPadding(5)
|
Margin = new MarginPadding(5)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddInternal(rightClickMessage = new WarningBox("Right click to place and link matches"));
|
||||||
|
|
||||||
|
LadderInfo.Matches.CollectionChanged += (_, __) => updateMessage();
|
||||||
|
updateMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateMessage()
|
||||||
|
{
|
||||||
|
rightClickMessage.Alpha = LadderInfo.Matches.Count > 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void BeginJoin(TournamentMatch match, bool losers)
|
public void BeginJoin(TournamentMatch match, bool losers)
|
||||||
|
@ -87,30 +87,7 @@ namespace osu.Game.Tournament
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
heightWarning = new Container
|
heightWarning = new WarningBox("Please make the window wider"),
|
||||||
{
|
|
||||||
Masking = true,
|
|
||||||
CornerRadius = 5,
|
|
||||||
Depth = float.MinValue,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = Color4.Red,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new TournamentSpriteText
|
|
||||||
{
|
|
||||||
Text = "Please make the window wider",
|
|
||||||
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
|
|
||||||
Colour = Color4.White,
|
|
||||||
Padding = new MarginPadding(20)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new OsuContextMenuContainer
|
new OsuContextMenuContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
40
osu.Game.Tournament/WarningBox.cs
Normal file
40
osu.Game.Tournament/WarningBox.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// 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 osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament
|
||||||
|
{
|
||||||
|
internal class WarningBox : Container
|
||||||
|
{
|
||||||
|
public WarningBox(string text)
|
||||||
|
{
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 5;
|
||||||
|
Depth = float.MinValue;
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Red,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new TournamentSpriteText
|
||||||
|
{
|
||||||
|
Text = text,
|
||||||
|
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
|
||||||
|
Colour = Color4.White,
|
||||||
|
Padding = new MarginPadding(20)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,6 +9,7 @@ using System.Linq.Expressions;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
@ -64,16 +65,16 @@ namespace osu.Game.Beatmaps
|
|||||||
private readonly RulesetStore rulesets;
|
private readonly RulesetStore rulesets;
|
||||||
private readonly BeatmapStore beatmaps;
|
private readonly BeatmapStore beatmaps;
|
||||||
private readonly AudioManager audioManager;
|
private readonly AudioManager audioManager;
|
||||||
private readonly GameHost host;
|
|
||||||
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
|
private readonly BeatmapOnlineLookupQueue onlineLookupQueue;
|
||||||
|
private readonly TextureStore textureStore;
|
||||||
|
private readonly ITrackStore trackStore;
|
||||||
|
|
||||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null,
|
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, [NotNull] AudioManager audioManager, GameHost host = null,
|
||||||
WorkingBeatmap defaultBeatmap = null)
|
WorkingBeatmap defaultBeatmap = null)
|
||||||
: base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
|
: base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
|
||||||
{
|
{
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
this.audioManager = audioManager;
|
this.audioManager = audioManager;
|
||||||
this.host = host;
|
|
||||||
|
|
||||||
DefaultBeatmap = defaultBeatmap;
|
DefaultBeatmap = defaultBeatmap;
|
||||||
|
|
||||||
@ -84,6 +85,9 @@ namespace osu.Game.Beatmaps
|
|||||||
beatmaps.ItemUpdated += removeWorkingCache;
|
beatmaps.ItemUpdated += removeWorkingCache;
|
||||||
|
|
||||||
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
onlineLookupQueue = new BeatmapOnlineLookupQueue(api, storage);
|
||||||
|
|
||||||
|
textureStore = new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store));
|
||||||
|
trackStore = audioManager.GetTrackStore(Files.Store);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ArchiveDownloadRequest<BeatmapSetInfo> CreateDownloadRequest(BeatmapSetInfo set, bool minimiseDownloadSize) =>
|
protected override ArchiveDownloadRequest<BeatmapSetInfo> CreateDownloadRequest(BeatmapSetInfo set, bool minimiseDownloadSize) =>
|
||||||
@ -220,7 +224,7 @@ namespace osu.Game.Beatmaps
|
|||||||
removeWorkingCache(info);
|
removeWorkingCache(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly WeakList<WorkingBeatmap> workingCache = new WeakList<WorkingBeatmap>();
|
private readonly WeakList<BeatmapManagerWorkingBeatmap> workingCache = new WeakList<BeatmapManagerWorkingBeatmap>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve a <see cref="WorkingBeatmap"/> instance for the provided <see cref="BeatmapInfo"/>
|
/// Retrieve a <see cref="WorkingBeatmap"/> instance for the provided <see cref="BeatmapInfo"/>
|
||||||
@ -248,16 +252,13 @@ namespace osu.Game.Beatmaps
|
|||||||
lock (workingCache)
|
lock (workingCache)
|
||||||
{
|
{
|
||||||
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
var working = workingCache.FirstOrDefault(w => w.BeatmapInfo?.ID == beatmapInfo.ID);
|
||||||
|
if (working != null)
|
||||||
|
return working;
|
||||||
|
|
||||||
if (working == null)
|
|
||||||
{
|
|
||||||
beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;
|
beatmapInfo.Metadata ??= beatmapInfo.BeatmapSet.Metadata;
|
||||||
|
|
||||||
workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store,
|
workingCache.Add(working = new BeatmapManagerWorkingBeatmap(Files.Store, textureStore, trackStore, beatmapInfo, audioManager));
|
||||||
new LargeTextureStore(host?.CreateTextureLoaderStore(Files.Store)), beatmapInfo, audioManager));
|
|
||||||
}
|
|
||||||
|
|
||||||
previous?.TransferTo(working);
|
|
||||||
return working;
|
return working;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -461,7 +462,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override IBeatmap GetBeatmap() => beatmap;
|
protected override IBeatmap GetBeatmap() => beatmap;
|
||||||
protected override Texture GetBackground() => null;
|
protected override Texture GetBackground() => null;
|
||||||
protected override Track GetTrack() => null;
|
protected override Track GetBeatmapTrack() => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,15 +17,18 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
public partial class BeatmapManager
|
public partial class BeatmapManager
|
||||||
{
|
{
|
||||||
protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
private class BeatmapManagerWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
private readonly IResourceStore<byte[]> store;
|
private readonly IResourceStore<byte[]> store;
|
||||||
|
private readonly TextureStore textureStore;
|
||||||
|
private readonly ITrackStore trackStore;
|
||||||
|
|
||||||
public BeatmapManagerWorkingBeatmap(IResourceStore<byte[]> store, TextureStore textureStore, BeatmapInfo beatmapInfo, AudioManager audioManager)
|
public BeatmapManagerWorkingBeatmap(IResourceStore<byte[]> store, TextureStore textureStore, ITrackStore trackStore, BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||||
: base(beatmapInfo, audioManager)
|
: base(beatmapInfo, audioManager)
|
||||||
{
|
{
|
||||||
this.store = store;
|
this.store = store;
|
||||||
this.textureStore = textureStore;
|
this.textureStore = textureStore;
|
||||||
|
this.trackStore = trackStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IBeatmap GetBeatmap()
|
protected override IBeatmap GetBeatmap()
|
||||||
@ -44,10 +47,6 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private string getPathForFile(string filename) => BeatmapSetInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, filename, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
|
private string getPathForFile(string filename) => BeatmapSetInfo.Files.SingleOrDefault(f => string.Equals(f.Filename, filename, StringComparison.OrdinalIgnoreCase))?.FileInfo.StoragePath;
|
||||||
|
|
||||||
private TextureStore textureStore;
|
|
||||||
|
|
||||||
private ITrackStore trackStore;
|
|
||||||
|
|
||||||
protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes.
|
protected override bool BackgroundStillValid(Texture b) => false; // bypass lazy logic. we want to return a new background each time for refcounting purposes.
|
||||||
|
|
||||||
protected override Texture GetBackground()
|
protected override Texture GetBackground()
|
||||||
@ -66,11 +65,11 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Track GetTrack()
|
protected override Track GetBeatmapTrack()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (trackStore ??= AudioManager.GetTrackStore(store)).Get(getPathForFile(Metadata.AudioFile));
|
return trackStore.Get(getPathForFile(Metadata.AudioFile));
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -79,22 +78,6 @@ namespace osu.Game.Beatmaps
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void RecycleTrack()
|
|
||||||
{
|
|
||||||
base.RecycleTrack();
|
|
||||||
|
|
||||||
trackStore?.Dispose();
|
|
||||||
trackStore = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void TransferTo(WorkingBeatmap other)
|
|
||||||
{
|
|
||||||
base.TransferTo(other);
|
|
||||||
|
|
||||||
if (other is BeatmapManagerWorkingBeatmap owb && textureStore != null && BeatmapInfo.BackgroundEquals(other.BeatmapInfo))
|
|
||||||
owb.textureStore = textureStore;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Waveform GetWaveform()
|
protected override Waveform GetWaveform()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1,14 +1,31 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public class BeatmapStatistic
|
public class BeatmapStatistic
|
||||||
{
|
{
|
||||||
public IconUsage Icon;
|
[Obsolete("Use CreateIcon instead")] // can be removed 20210203
|
||||||
|
public IconUsage Icon = FontAwesome.Regular.QuestionCircle;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A function to create the icon for display purposes. Use default icons available via <see cref="BeatmapStatisticIcon"/> whenever possible for conformity.
|
||||||
|
/// </summary>
|
||||||
|
public Func<Drawable> CreateIcon;
|
||||||
|
|
||||||
public string Content;
|
public string Content;
|
||||||
public string Name;
|
public string Name;
|
||||||
|
|
||||||
|
public BeatmapStatistic()
|
||||||
|
{
|
||||||
|
#pragma warning disable 618
|
||||||
|
CreateIcon = () => new SpriteIcon { Icon = Icon, Scale = new Vector2(0.7f) };
|
||||||
|
#pragma warning restore 618
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
43
osu.Game/Beatmaps/BeatmapStatisticIcon.cs
Normal file
43
osu.Game/Beatmaps/BeatmapStatisticIcon.cs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
// 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 Humanizer;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A default implementation of an icon used to represent beatmap statistics.
|
||||||
|
/// </summary>
|
||||||
|
public class BeatmapStatisticIcon : Sprite
|
||||||
|
{
|
||||||
|
private readonly BeatmapStatisticsIconType iconType;
|
||||||
|
|
||||||
|
public BeatmapStatisticIcon(BeatmapStatisticsIconType iconType)
|
||||||
|
{
|
||||||
|
this.iconType = iconType;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(TextureStore textures)
|
||||||
|
{
|
||||||
|
Texture = textures.Get($"Icons/BeatmapDetails/{iconType.ToString().Kebaberize()}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum BeatmapStatisticsIconType
|
||||||
|
{
|
||||||
|
Accuracy,
|
||||||
|
ApproachRate,
|
||||||
|
Bpm,
|
||||||
|
Circles,
|
||||||
|
HpDrain,
|
||||||
|
Length,
|
||||||
|
OverallDifficulty,
|
||||||
|
Size,
|
||||||
|
Sliders,
|
||||||
|
Spinners,
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
@ -19,7 +20,7 @@ namespace osu.Game.Beatmaps
|
|||||||
{
|
{
|
||||||
private readonly TextureStore textures;
|
private readonly TextureStore textures;
|
||||||
|
|
||||||
public DummyWorkingBeatmap(AudioManager audio, TextureStore textures)
|
public DummyWorkingBeatmap([NotNull] AudioManager audio, TextureStore textures)
|
||||||
: base(new BeatmapInfo
|
: base(new BeatmapInfo
|
||||||
{
|
{
|
||||||
Metadata = new BeatmapMetadata
|
Metadata = new BeatmapMetadata
|
||||||
@ -44,7 +45,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
protected override Texture GetBackground() => textures?.Get(@"Backgrounds/bg4");
|
||||||
|
|
||||||
protected override Track GetTrack() => GetVirtualTrack();
|
protected override Track GetBeatmapTrack() => GetVirtualTrack();
|
||||||
|
|
||||||
private class DummyRulesetInfo : RulesetInfo
|
private class DummyRulesetInfo : RulesetInfo
|
||||||
{
|
{
|
||||||
|
@ -26,11 +26,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Texture Background { get; }
|
Texture Background { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Retrieves the audio track for this <see cref="WorkingBeatmap"/>.
|
|
||||||
/// </summary>
|
|
||||||
Track Track { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves the <see cref="Waveform"/> for the <see cref="Track"/> of this <see cref="WorkingBeatmap"/>.
|
/// Retrieves the <see cref="Waveform"/> for the <see cref="Track"/> of this <see cref="WorkingBeatmap"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -59,5 +54,18 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
/// <returns>The converted <see cref="IBeatmap"/>.</returns>
|
||||||
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
/// <exception cref="BeatmapInvalidForRulesetException">If <see cref="Beatmap"/> could not be converted to <paramref name="ruleset"/>.</exception>
|
||||||
IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null);
|
IBeatmap GetPlayableBeatmap(RulesetInfo ruleset, IReadOnlyList<Mod> mods = null, TimeSpan? timeout = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load a new audio track instance for this beatmap. This should be called once before accessing <see cref="Track"/>.
|
||||||
|
/// The caller of this method is responsible for the lifetime of the track.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// In a standard game context, the loading of the track is managed solely by MusicController, which will
|
||||||
|
/// automatically load the track of the current global IBindable WorkingBeatmap.
|
||||||
|
/// As such, this method should only be called in very special scenarios, such as external tests or apps which are
|
||||||
|
/// outside of the game context.
|
||||||
|
/// </remarks>
|
||||||
|
/// <returns>A fresh track instance, which will also be available via <see cref="Track"/>.</returns>
|
||||||
|
Track LoadTrack();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
@ -40,7 +41,6 @@ namespace osu.Game.Beatmaps
|
|||||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack(1000));
|
|
||||||
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
||||||
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
||||||
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
||||||
@ -259,10 +259,39 @@ namespace osu.Game.Beatmaps
|
|||||||
protected abstract Texture GetBackground();
|
protected abstract Texture GetBackground();
|
||||||
private readonly RecyclableLazy<Texture> background;
|
private readonly RecyclableLazy<Texture> background;
|
||||||
|
|
||||||
public virtual bool TrackLoaded => track.IsResultAvailable;
|
private Track loadedTrack;
|
||||||
public Track Track => track.Value;
|
|
||||||
protected abstract Track GetTrack();
|
[NotNull]
|
||||||
private RecyclableLazy<Track> track;
|
public Track LoadTrack() => loadedTrack = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Transfer a valid audio track into this working beatmap. Used as an optimisation to avoid reload / track swap
|
||||||
|
/// across difficulties in the same beatmap set.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="track">The track to transfer.</param>
|
||||||
|
public void TransferTrack([NotNull] Track track) => loadedTrack = track ?? throw new ArgumentNullException(nameof(track));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether this beatmap's track has been loaded via <see cref="LoadTrack"/>.
|
||||||
|
/// </summary>
|
||||||
|
public virtual bool TrackLoaded => loadedTrack != null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the loaded audio track instance. <see cref="LoadTrack"/> must have first been called.
|
||||||
|
/// This generally happens via MusicController when changing the global beatmap.
|
||||||
|
/// </summary>
|
||||||
|
public Track Track
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!TrackLoaded)
|
||||||
|
throw new InvalidOperationException($"Cannot access {nameof(Track)} without first calling {nameof(LoadTrack)}.");
|
||||||
|
|
||||||
|
return loadedTrack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Track GetBeatmapTrack();
|
||||||
|
|
||||||
public bool WaveformLoaded => waveform.IsResultAvailable;
|
public bool WaveformLoaded => waveform.IsResultAvailable;
|
||||||
public Waveform Waveform => waveform.Value;
|
public Waveform Waveform => waveform.Value;
|
||||||
@ -280,22 +309,6 @@ namespace osu.Game.Beatmaps
|
|||||||
protected virtual ISkin GetSkin() => new DefaultSkin();
|
protected virtual ISkin GetSkin() => new DefaultSkin();
|
||||||
private readonly RecyclableLazy<ISkin> skin;
|
private readonly RecyclableLazy<ISkin> skin;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Transfer pieces of a beatmap to a new one, where possible, to save on loading.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="other">The new beatmap which is being switched to.</param>
|
|
||||||
public virtual void TransferTo(WorkingBeatmap other)
|
|
||||||
{
|
|
||||||
if (track.IsResultAvailable && Track != null && BeatmapInfo.AudioEquals(other.BeatmapInfo))
|
|
||||||
other.track = track;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Eagerly dispose of the audio track associated with this <see cref="WorkingBeatmap"/> (if any).
|
|
||||||
/// Accessing track again will load a fresh instance.
|
|
||||||
/// </summary>
|
|
||||||
public virtual void RecycleTrack() => track.Recycle();
|
|
||||||
|
|
||||||
~WorkingBeatmap()
|
~WorkingBeatmap()
|
||||||
{
|
{
|
||||||
total_count.Value--;
|
total_count.Value--;
|
||||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
Track track = null;
|
ITrack track = null;
|
||||||
IBeatmap beatmap = null;
|
IBeatmap beatmap = null;
|
||||||
|
|
||||||
double currentTrackTime = 0;
|
double currentTrackTime = 0;
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private PreviewTrackManager previewTrackManager { get; set; }
|
private PreviewTrackManager previewTrackManager { get; set; }
|
||||||
|
|
||||||
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
protected readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
|
@ -26,8 +26,11 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
if (value == expandableHeader) return;
|
if (value == expandableHeader) return;
|
||||||
|
|
||||||
expandableHeader?.Expire();
|
if (expandableHeader != null)
|
||||||
|
RemoveInternal(expandableHeader);
|
||||||
|
|
||||||
expandableHeader = value;
|
expandableHeader = value;
|
||||||
|
|
||||||
if (value == null) return;
|
if (value == null) return;
|
||||||
|
|
||||||
AddInternal(expandableHeader);
|
AddInternal(expandableHeader);
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests.Responses
|
namespace osu.Game.Online.API.Requests.Responses
|
||||||
{
|
{
|
||||||
@ -22,5 +24,12 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
|
|
||||||
[JsonProperty(@"score")]
|
[JsonProperty(@"score")]
|
||||||
public APILegacyScoreInfo Score;
|
public APILegacyScoreInfo Score;
|
||||||
|
|
||||||
|
public ScoreInfo CreateScoreInfo(RulesetStore rulesets)
|
||||||
|
{
|
||||||
|
var score = Score.CreateScoreInfo(rulesets);
|
||||||
|
score.Position = Position;
|
||||||
|
return score;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
[JsonProperty("user")]
|
[JsonProperty("user")]
|
||||||
public User User { get; set; }
|
public User User { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("position")]
|
||||||
|
public int? Position { get; set; }
|
||||||
|
|
||||||
public ScoreInfo CreateScoreInfo() =>
|
public ScoreInfo CreateScoreInfo() =>
|
||||||
new ScoreInfo
|
new ScoreInfo
|
||||||
{
|
{
|
||||||
@ -40,6 +43,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
PP = PP,
|
PP = PP,
|
||||||
TotalScore = TotalScore,
|
TotalScore = TotalScore,
|
||||||
User = User,
|
User = User,
|
||||||
|
Position = Position
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
private readonly OsuScrollContainer scrollContainer;
|
private readonly OsuScrollContainer scrollContainer;
|
||||||
private readonly Container placeholderContainer;
|
private readonly Container placeholderContainer;
|
||||||
|
private readonly UserTopScoreContainer<TScoreInfo> topScoreContainer;
|
||||||
|
|
||||||
private FillFlowContainer<LeaderboardScore> scrollFlow;
|
private FillFlowContainer<LeaderboardScore> scrollFlow;
|
||||||
|
|
||||||
@ -87,6 +88,20 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public TScoreInfo TopScore
|
||||||
|
{
|
||||||
|
get => topScoreContainer.Score.Value;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
topScoreContainer.Score.Value = value;
|
||||||
|
|
||||||
|
if (value == null)
|
||||||
|
topScoreContainer.Hide();
|
||||||
|
else
|
||||||
|
topScoreContainer.Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected virtual FillFlowContainer<LeaderboardScore> CreateScoreFlow()
|
protected virtual FillFlowContainer<LeaderboardScore> CreateScoreFlow()
|
||||||
=> new FillFlowContainer<LeaderboardScore>
|
=> new FillFlowContainer<LeaderboardScore>
|
||||||
{
|
{
|
||||||
@ -198,8 +213,9 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
|
Child = topScoreContainer = new UserTopScoreContainer<TScoreInfo>(CreateDrawableTopScore)
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -367,5 +383,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected abstract LeaderboardScore CreateDrawableScore(TScoreInfo model, int index);
|
protected abstract LeaderboardScore CreateDrawableScore(TScoreInfo model, int index);
|
||||||
|
|
||||||
|
protected abstract LeaderboardScore CreateDrawableTopScore(TScoreInfo model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,31 +9,29 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
using osu.Game.Online.Leaderboards;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Scoring;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select.Leaderboards
|
namespace osu.Game.Online.Leaderboards
|
||||||
{
|
{
|
||||||
public class UserTopScoreContainer : VisibilityContainer
|
public class UserTopScoreContainer<TScoreInfo> : VisibilityContainer
|
||||||
{
|
{
|
||||||
private const int duration = 500;
|
private const int duration = 500;
|
||||||
|
|
||||||
|
public Bindable<TScoreInfo> Score = new Bindable<TScoreInfo>();
|
||||||
|
|
||||||
private readonly Container scoreContainer;
|
private readonly Container scoreContainer;
|
||||||
|
private readonly Func<TScoreInfo, LeaderboardScore> createScoreDelegate;
|
||||||
public Bindable<APILegacyUserTopScoreInfo> Score = new Bindable<APILegacyUserTopScoreInfo>();
|
|
||||||
|
|
||||||
public Action<ScoreInfo> ScoreSelected;
|
|
||||||
|
|
||||||
protected override bool StartHidden => true;
|
protected override bool StartHidden => true;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
|
||||||
public UserTopScoreContainer()
|
public UserTopScoreContainer(Func<TScoreInfo, LeaderboardScore> createScoreDelegate)
|
||||||
{
|
{
|
||||||
|
this.createScoreDelegate = createScoreDelegate;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
@ -72,7 +70,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
private CancellationTokenSource loadScoreCancellation;
|
private CancellationTokenSource loadScoreCancellation;
|
||||||
|
|
||||||
private void onScoreChanged(ValueChangedEvent<APILegacyUserTopScoreInfo> score)
|
private void onScoreChanged(ValueChangedEvent<TScoreInfo> score)
|
||||||
{
|
{
|
||||||
var newScore = score.NewValue;
|
var newScore = score.NewValue;
|
||||||
|
|
||||||
@ -82,12 +80,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
if (newScore == null)
|
if (newScore == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var scoreInfo = newScore.Score.CreateScoreInfo(rulesets);
|
LoadComponentAsync(createScoreDelegate(newScore), drawableScore =>
|
||||||
|
|
||||||
LoadComponentAsync(new LeaderboardScore(scoreInfo, newScore.Position, false)
|
|
||||||
{
|
|
||||||
Action = () => ScoreSelected?.Invoke(scoreInfo)
|
|
||||||
}, drawableScore =>
|
|
||||||
{
|
{
|
||||||
scoreContainer.Child = drawableScore;
|
scoreContainer.Child = drawableScore;
|
||||||
drawableScore.FadeInFromZero(duration, Easing.OutQuint);
|
drawableScore.FadeInFromZero(duration, Easing.OutQuint);
|
18
osu.Game/Online/Multiplayer/APILeaderboard.cs
Normal file
18
osu.Game/Online/Multiplayer/APILeaderboard.cs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
// 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 Newtonsoft.Json;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Multiplayer
|
||||||
|
{
|
||||||
|
public class APILeaderboard
|
||||||
|
{
|
||||||
|
[JsonProperty("leaderboard")]
|
||||||
|
public List<APIUserScoreAggregate> Leaderboard;
|
||||||
|
|
||||||
|
[JsonProperty("user_score")]
|
||||||
|
public APIUserScoreAggregate UserScore;
|
||||||
|
}
|
||||||
|
}
|
@ -1,17 +1,15 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
|
|
||||||
namespace osu.Game.Online.Multiplayer
|
namespace osu.Game.Online.Multiplayer
|
||||||
{
|
{
|
||||||
public class GetRoomScoresRequest : APIRequest<List<APIUserScoreAggregate>>
|
public class GetRoomLeaderboardRequest : APIRequest<APILeaderboard>
|
||||||
{
|
{
|
||||||
private readonly int roomId;
|
private readonly int roomId;
|
||||||
|
|
||||||
public GetRoomScoresRequest(int roomId)
|
public GetRoomLeaderboardRequest(int roomId)
|
||||||
{
|
{
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
}
|
}
|
@ -88,7 +88,10 @@ namespace osu.Game
|
|||||||
|
|
||||||
private IdleTracker idleTracker;
|
private IdleTracker idleTracker;
|
||||||
|
|
||||||
public readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
/// <summary>
|
||||||
|
/// Whether overlays should be able to be opened game-wide. Value is sourced from the current active screen.
|
||||||
|
/// </summary>
|
||||||
|
public readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
|
||||||
|
|
||||||
protected OsuScreenStack ScreenStack;
|
protected OsuScreenStack ScreenStack;
|
||||||
|
|
||||||
@ -425,23 +428,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
updateModDefaults();
|
updateModDefaults();
|
||||||
|
|
||||||
var newBeatmap = beatmap.NewValue;
|
beatmap.NewValue?.BeginAsyncLoad();
|
||||||
|
|
||||||
if (newBeatmap != null)
|
|
||||||
{
|
|
||||||
newBeatmap.Track.Completed += () => Scheduler.AddOnce(() => trackCompleted(newBeatmap));
|
|
||||||
newBeatmap.BeginAsyncLoad();
|
|
||||||
}
|
|
||||||
|
|
||||||
void trackCompleted(WorkingBeatmap b)
|
|
||||||
{
|
|
||||||
// the source of track completion is the audio thread, so the beatmap may have changed before firing.
|
|
||||||
if (Beatmap.Value != b)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
|
||||||
MusicController.NextTrack();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
|
||||||
@ -615,8 +602,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
|
loadComponentSingleFile(new OnScreenDisplay(), Add, true);
|
||||||
|
|
||||||
loadComponentSingleFile(MusicController = new MusicController(), Add, true);
|
|
||||||
|
|
||||||
loadComponentSingleFile(notifications.With(d =>
|
loadComponentSingleFile(notifications.With(d =>
|
||||||
{
|
{
|
||||||
d.GetToolbarHeight = () => ToolbarOffset;
|
d.GetToolbarHeight = () => ToolbarOffset;
|
||||||
@ -713,9 +698,9 @@ namespace osu.Game
|
|||||||
float offset = 0;
|
float offset = 0;
|
||||||
|
|
||||||
if (Settings.State.Value == Visibility.Visible)
|
if (Settings.State.Value == Visibility.Visible)
|
||||||
offset += ToolbarButton.WIDTH / 2;
|
offset += Toolbar.HEIGHT / 2;
|
||||||
if (notifications.State.Value == Visibility.Visible)
|
if (notifications.State.Value == Visibility.Visible)
|
||||||
offset -= ToolbarButton.WIDTH / 2;
|
offset -= Toolbar.HEIGHT / 2;
|
||||||
|
|
||||||
screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint);
|
screenContainer.MoveToX(offset, SettingsPanel.TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -921,8 +906,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
private ScalingContainer screenContainer;
|
private ScalingContainer screenContainer;
|
||||||
|
|
||||||
protected MusicController MusicController { get; private set; }
|
|
||||||
|
|
||||||
protected override bool OnExiting()
|
protected override bool OnExiting()
|
||||||
{
|
{
|
||||||
if (ScreenStack.CurrentScreen is Loader)
|
if (ScreenStack.CurrentScreen is Loader)
|
||||||
@ -972,9 +955,12 @@ namespace osu.Game
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (current is IOsuScreen currentOsuScreen)
|
||||||
|
OverlayActivationMode.UnbindFrom(currentOsuScreen.OverlayActivationMode);
|
||||||
|
|
||||||
if (newScreen is IOsuScreen newOsuScreen)
|
if (newScreen is IOsuScreen newOsuScreen)
|
||||||
{
|
{
|
||||||
OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode;
|
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
|
||||||
|
|
||||||
MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;
|
MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Resources;
|
using osu.Game.Resources;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -73,6 +74,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected MenuCursorContainer MenuCursorContainer;
|
protected MenuCursorContainer MenuCursorContainer;
|
||||||
|
|
||||||
|
protected MusicController MusicController;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
@ -238,16 +241,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap);
|
||||||
|
|
||||||
// ScheduleAfterChildren is safety against something in the current frame accessing the previous beatmap's track
|
|
||||||
// and potentially causing a reload of it after just unloading.
|
|
||||||
// Note that the reason for this being added *has* been resolved, so it may be feasible to removed this if required.
|
|
||||||
Beatmap.BindValueChanged(b => ScheduleAfterChildren(() =>
|
|
||||||
{
|
|
||||||
// compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo)
|
|
||||||
if (b.OldValue?.TrackLoaded == true && b.OldValue?.Track != b.NewValue?.Track)
|
|
||||||
b.OldValue.RecycleTrack();
|
|
||||||
}));
|
|
||||||
|
|
||||||
dependencies.CacheAs<IBindable<WorkingBeatmap>>(Beatmap);
|
dependencies.CacheAs<IBindable<WorkingBeatmap>>(Beatmap);
|
||||||
dependencies.CacheAs(Beatmap);
|
dependencies.CacheAs(Beatmap);
|
||||||
|
|
||||||
@ -275,6 +268,9 @@ namespace osu.Game
|
|||||||
dependencies.Cache(previewTrackManager = new PreviewTrackManager());
|
dependencies.Cache(previewTrackManager = new PreviewTrackManager());
|
||||||
Add(previewTrackManager);
|
Add(previewTrackManager);
|
||||||
|
|
||||||
|
AddInternal(MusicController = new MusicController());
|
||||||
|
dependencies.CacheAs(MusicController);
|
||||||
|
|
||||||
Ruleset.BindValueChanged(onRulesetChanged);
|
Ruleset.BindValueChanged(onRulesetChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
public BeatmapListingTitle()
|
public BeatmapListingTitle()
|
||||||
{
|
{
|
||||||
Title = "beatmap listing";
|
Title = "beatmap listing";
|
||||||
IconTexture = "Icons/changelog";
|
Description = "browse for new beatmaps";
|
||||||
|
IconTexture = "Icons/Hexacons/beatmap";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class BeatmapListingOverlay : FullscreenOverlay
|
public class BeatmapListingOverlay : FullscreenOverlay<BeatmapListingHeader>
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private PreviewTrackManager previewTrackManager { get; set; }
|
private PreviewTrackManager previewTrackManager { get; set; }
|
||||||
@ -38,7 +38,7 @@ namespace osu.Game.Overlays
|
|||||||
private OverlayScrollContainer resultScrollContainer;
|
private OverlayScrollContainer resultScrollContainer;
|
||||||
|
|
||||||
public BeatmapListingOverlay()
|
public BeatmapListingOverlay()
|
||||||
: base(OverlayColourScheme.Blue)
|
: base(OverlayColourScheme.Blue, new BeatmapListingHeader())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new BeatmapListingHeader(),
|
Header,
|
||||||
filterControl = new BeatmapListingFilterControl
|
filterControl = new BeatmapListingFilterControl
|
||||||
{
|
{
|
||||||
SearchStarted = onSearchStarted,
|
SearchStarted = onSearchStarted,
|
||||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
public BeatmapHeaderTitle()
|
public BeatmapHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "beatmap info";
|
Title = "beatmap info";
|
||||||
IconTexture = "Icons/changelog";
|
IconTexture = "Icons/Hexacons/beatmap";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,14 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class BeatmapSetOverlay : FullscreenOverlay
|
public class BeatmapSetOverlay : FullscreenOverlay<OverlayHeader> // we don't provide a standard header for now.
|
||||||
{
|
{
|
||||||
public const float X_PADDING = 40;
|
public const float X_PADDING = 40;
|
||||||
public const float Y_PADDING = 25;
|
public const float Y_PADDING = 25;
|
||||||
public const float RIGHT_WIDTH = 275;
|
public const float RIGHT_WIDTH = 275;
|
||||||
protected readonly Header Header;
|
|
||||||
|
//todo: should be an OverlayHeader? or maybe not?
|
||||||
|
protected new readonly Header Header;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
@ -37,7 +39,7 @@ namespace osu.Game.Overlays
|
|||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
|
|
||||||
public BeatmapSetOverlay()
|
public BeatmapSetOverlay()
|
||||||
: base(OverlayColourScheme.Blue)
|
: base(OverlayColourScheme.Blue, null)
|
||||||
{
|
{
|
||||||
OverlayScrollContainer scroll;
|
OverlayScrollContainer scroll;
|
||||||
Info info;
|
Info info;
|
||||||
|
@ -115,7 +115,8 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
public ChangelogHeaderTitle()
|
public ChangelogHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "changelog";
|
Title = "changelog";
|
||||||
IconTexture = "Icons/changelog";
|
Description = "track recent dev updates in the osu! ecosystem";
|
||||||
|
IconTexture = "Icons/Hexacons/devtools";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,12 +21,10 @@ using osu.Game.Overlays.Changelog;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class ChangelogOverlay : FullscreenOverlay
|
public class ChangelogOverlay : FullscreenOverlay<ChangelogHeader>
|
||||||
{
|
{
|
||||||
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
public readonly Bindable<APIChangelogBuild> Current = new Bindable<APIChangelogBuild>();
|
||||||
|
|
||||||
protected ChangelogHeader Header;
|
|
||||||
|
|
||||||
private Container<ChangelogContent> content;
|
private Container<ChangelogContent> content;
|
||||||
|
|
||||||
private SampleChannel sampleBack;
|
private SampleChannel sampleBack;
|
||||||
@ -36,7 +34,7 @@ namespace osu.Game.Overlays
|
|||||||
protected List<APIUpdateStream> Streams;
|
protected List<APIUpdateStream> Streams;
|
||||||
|
|
||||||
public ChangelogOverlay()
|
public ChangelogOverlay()
|
||||||
: base(OverlayColourScheme.Purple)
|
: base(OverlayColourScheme.Purple, new ChangelogHeader())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,10 +59,11 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
Header = new ChangelogHeader
|
Header.With(h =>
|
||||||
{
|
{
|
||||||
ListingSelected = ShowListing,
|
h.ListingSelected = ShowListing;
|
||||||
},
|
h.Build.BindTarget = Current;
|
||||||
|
}),
|
||||||
content = new Container<ChangelogContent>
|
content = new Container<ChangelogContent>
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -77,8 +76,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
|
sampleBack = audio.Samples.Get(@"UI/generic-select-soft");
|
||||||
|
|
||||||
Header.Build.BindTo(Current);
|
|
||||||
|
|
||||||
Current.BindValueChanged(e =>
|
Current.BindValueChanged(e =>
|
||||||
{
|
{
|
||||||
if (e.NewValue != null)
|
if (e.NewValue != null)
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Chat.Selection
|
|||||||
{
|
{
|
||||||
public class ChannelSelectionOverlay : WaveOverlayContainer
|
public class ChannelSelectionOverlay : WaveOverlayContainer
|
||||||
{
|
{
|
||||||
public const float WIDTH_PADDING = 170;
|
public new const float WIDTH_PADDING = 170;
|
||||||
|
|
||||||
private const float transition_duration = 500;
|
private const float transition_duration = 500;
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -25,8 +26,12 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class ChatOverlay : OsuFocusedOverlayContainer
|
public class ChatOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
|
public string IconTexture => "Icons/Hexacons/messaging";
|
||||||
|
public string Title => "chat";
|
||||||
|
public string Description => "Join the real-time discussion";
|
||||||
|
|
||||||
private const float textbox_height = 60;
|
private const float textbox_height = 60;
|
||||||
private const float channel_selection_min_height = 0.3f;
|
private const float channel_selection_min_height = 0.3f;
|
||||||
|
|
||||||
@ -218,14 +223,13 @@ namespace osu.Game.Overlays
|
|||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
// TODO: consider scheduling bindable callbacks to not perform when overlay is not present.
|
||||||
channelManager.JoinedChannels.ItemsAdded += onChannelAddedToJoinedChannels;
|
channelManager.JoinedChannels.CollectionChanged += joinedChannelsChanged;
|
||||||
channelManager.JoinedChannels.ItemsRemoved += onChannelRemovedFromJoinedChannels;
|
|
||||||
foreach (Channel channel in channelManager.JoinedChannels)
|
foreach (Channel channel in channelManager.JoinedChannels)
|
||||||
ChannelTabControl.AddChannel(channel);
|
ChannelTabControl.AddChannel(channel);
|
||||||
|
|
||||||
channelManager.AvailableChannels.ItemsAdded += availableChannelsChanged;
|
channelManager.AvailableChannels.CollectionChanged += availableChannelsChanged;
|
||||||
channelManager.AvailableChannels.ItemsRemoved += availableChannelsChanged;
|
availableChannelsChanged(null, null);
|
||||||
ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
|
||||||
|
|
||||||
currentChannel = channelManager.CurrentChannel.GetBoundCopy();
|
currentChannel = channelManager.CurrentChannel.GetBoundCopy();
|
||||||
currentChannel.BindValueChanged(currentChannelChanged, true);
|
currentChannel.BindValueChanged(currentChannelChanged, true);
|
||||||
@ -384,15 +388,17 @@ namespace osu.Game.Overlays
|
|||||||
base.PopOut();
|
base.PopOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onChannelAddedToJoinedChannels(IEnumerable<Channel> channels)
|
private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||||
{
|
{
|
||||||
foreach (Channel channel in channels)
|
switch (args.Action)
|
||||||
|
{
|
||||||
|
case NotifyCollectionChangedAction.Add:
|
||||||
|
foreach (Channel channel in args.NewItems.Cast<Channel>())
|
||||||
ChannelTabControl.AddChannel(channel);
|
ChannelTabControl.AddChannel(channel);
|
||||||
}
|
break;
|
||||||
|
|
||||||
private void onChannelRemovedFromJoinedChannels(IEnumerable<Channel> channels)
|
case NotifyCollectionChangedAction.Remove:
|
||||||
{
|
foreach (Channel channel in args.OldItems.Cast<Channel>())
|
||||||
foreach (Channel channel in channels)
|
|
||||||
{
|
{
|
||||||
ChannelTabControl.RemoveChannel(channel);
|
ChannelTabControl.RemoveChannel(channel);
|
||||||
|
|
||||||
@ -408,10 +414,15 @@ namespace osu.Game.Overlays
|
|||||||
loaded.Dispose();
|
loaded.Dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void availableChannelsChanged(IEnumerable<Channel> channels)
|
private void availableChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
|
||||||
=> ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
{
|
||||||
|
ChannelSelectionOverlay.UpdateAvailableChannels(channelManager.AvailableChannels);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
@ -420,10 +431,8 @@ namespace osu.Game.Overlays
|
|||||||
if (channelManager != null)
|
if (channelManager != null)
|
||||||
{
|
{
|
||||||
channelManager.CurrentChannel.ValueChanged -= currentChannelChanged;
|
channelManager.CurrentChannel.ValueChanged -= currentChannelChanged;
|
||||||
channelManager.JoinedChannels.ItemsAdded -= onChannelAddedToJoinedChannels;
|
channelManager.JoinedChannels.CollectionChanged -= joinedChannelsChanged;
|
||||||
channelManager.JoinedChannels.ItemsRemoved -= onChannelRemovedFromJoinedChannels;
|
channelManager.AvailableChannels.CollectionChanged -= availableChannelsChanged;
|
||||||
channelManager.AvailableChannels.ItemsAdded -= availableChannelsChanged;
|
|
||||||
channelManager.AvailableChannels.ItemsRemoved -= availableChannelsChanged;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,8 @@ namespace osu.Game.Overlays.Dashboard
|
|||||||
public DashboardTitle()
|
public DashboardTitle()
|
||||||
{
|
{
|
||||||
Title = "dashboard";
|
Title = "dashboard";
|
||||||
IconTexture = "Icons/changelog";
|
Description = "view your friends and other information";
|
||||||
|
IconTexture = "Icons/Hexacons/social";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,17 +15,21 @@ using osu.Game.Overlays.Dashboard.Friends;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class DashboardOverlay : FullscreenOverlay
|
public class DashboardOverlay : FullscreenOverlay<DashboardOverlayHeader>
|
||||||
{
|
{
|
||||||
private CancellationTokenSource cancellationToken;
|
private CancellationTokenSource cancellationToken;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
private DashboardOverlayHeader header;
|
|
||||||
private LoadingLayer loading;
|
private LoadingLayer loading;
|
||||||
private OverlayScrollContainer scrollFlow;
|
private OverlayScrollContainer scrollFlow;
|
||||||
|
|
||||||
public DashboardOverlay()
|
public DashboardOverlay()
|
||||||
: base(OverlayColourScheme.Purple)
|
: base(OverlayColourScheme.Purple, new DashboardOverlayHeader
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Depth = -float.MaxValue
|
||||||
|
})
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,12 +54,7 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
header = new DashboardOverlayHeader
|
Header,
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
Depth = -float.MaxValue
|
|
||||||
},
|
|
||||||
content = new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -72,7 +71,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
header.Current.BindValueChanged(onTabChanged);
|
Header.Current.BindValueChanged(onTabChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool displayUpdateRequired = true;
|
private bool displayUpdateRequired = true;
|
||||||
@ -84,7 +83,7 @@ namespace osu.Game.Overlays
|
|||||||
// We don't want to create a new display on every call, only when exiting from fully closed state.
|
// We don't want to create a new display on every call, only when exiting from fully closed state.
|
||||||
if (displayUpdateRequired)
|
if (displayUpdateRequired)
|
||||||
{
|
{
|
||||||
header.Current.TriggerChange();
|
Header.Current.TriggerChange();
|
||||||
displayUpdateRequired = false;
|
displayUpdateRequired = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +135,7 @@ namespace osu.Game.Overlays
|
|||||||
if (State.Value == Visibility.Hidden)
|
if (State.Value == Visibility.Hidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
header.Current.TriggerChange();
|
Header.Current.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -12,16 +12,25 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public abstract class FullscreenOverlay : WaveOverlayContainer, IOnlineComponent
|
public abstract class FullscreenOverlay<T> : WaveOverlayContainer, IOnlineComponent, INamedOverlayComponent
|
||||||
|
where T : OverlayHeader
|
||||||
{
|
{
|
||||||
|
public virtual string IconTexture => Header?.Title.IconTexture ?? string.Empty;
|
||||||
|
public virtual string Title => Header?.Title.Title ?? string.Empty;
|
||||||
|
public virtual string Description => Header?.Title.Description ?? string.Empty;
|
||||||
|
|
||||||
|
public T Header { get; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
protected IAPIProvider API { get; private set; }
|
protected IAPIProvider API { get; private set; }
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
protected readonly OverlayColourProvider ColourProvider;
|
protected readonly OverlayColourProvider ColourProvider;
|
||||||
|
|
||||||
protected FullscreenOverlay(OverlayColourScheme colourScheme)
|
protected FullscreenOverlay(OverlayColourScheme colourScheme, T header)
|
||||||
{
|
{
|
||||||
|
Header = header;
|
||||||
|
|
||||||
ColourProvider = new OverlayColourProvider(colourScheme);
|
ColourProvider = new OverlayColourProvider(colourScheme);
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
14
osu.Game/Overlays/INamedOverlayComponent.cs
Normal file
14
osu.Game/Overlays/INamedOverlayComponent.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays
|
||||||
|
{
|
||||||
|
public interface INamedOverlayComponent
|
||||||
|
{
|
||||||
|
string IconTexture { get; }
|
||||||
|
|
||||||
|
string Title { get; }
|
||||||
|
|
||||||
|
string Description { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -116,7 +116,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
{
|
{
|
||||||
if (set.ID == (beatmap.Value?.BeatmapSetInfo?.ID ?? -1))
|
if (set.ID == (beatmap.Value?.BeatmapSetInfo?.ID ?? -1))
|
||||||
{
|
{
|
||||||
beatmap.Value?.Track?.Seek(0);
|
beatmap.Value?.Track.Seek(0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,10 +4,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Audio;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
@ -21,7 +25,7 @@ namespace osu.Game.Overlays
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Handles playback of the global music track.
|
/// Handles playback of the global music track.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MusicController : Component, IKeyBindingHandler<GlobalAction>
|
public class MusicController : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
@ -61,6 +65,9 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved(canBeNull: true)]
|
[Resolved(canBeNull: true)]
|
||||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||||
|
|
||||||
|
[NotNull]
|
||||||
|
public DrawableTrack CurrentTrack { get; private set; } = new DrawableTrack(new TrackVirtual(1000));
|
||||||
|
|
||||||
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
private IBindable<WeakReference<BeatmapSetInfo>> managerUpdated;
|
||||||
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
|
private IBindable<WeakReference<BeatmapSetInfo>> managerRemoved;
|
||||||
|
|
||||||
@ -73,12 +80,9 @@ namespace osu.Game.Overlays
|
|||||||
managerRemoved.BindValueChanged(beatmapRemoved);
|
managerRemoved.BindValueChanged(beatmapRemoved);
|
||||||
|
|
||||||
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal, true).OrderBy(_ => RNG.Next()));
|
beatmapSets.AddRange(beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal, true).OrderBy(_ => RNG.Next()));
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
|
// Todo: These binds really shouldn't be here, but are unlikely to cause any issues for now.
|
||||||
|
// They are placed here for now since some tests rely on setting the beatmap _and_ their hierarchies inside their load(), which runs before the MusicController's load().
|
||||||
beatmap.BindValueChanged(beatmapChanged, true);
|
beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
|
||||||
}
|
}
|
||||||
@ -95,9 +99,14 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the current beatmap track is playing.
|
/// Returns whether the beatmap track is playing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsPlaying => current?.Track.IsRunning ?? false;
|
public bool IsPlaying => CurrentTrack.IsRunning;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns whether the beatmap track is loaded.
|
||||||
|
/// </summary>
|
||||||
|
public bool TrackLoaded => CurrentTrack.TrackLoaded;
|
||||||
|
|
||||||
private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
private void beatmapUpdated(ValueChangedEvent<WeakReference<BeatmapSetInfo>> weakSet)
|
||||||
{
|
{
|
||||||
@ -130,7 +139,7 @@ namespace osu.Game.Overlays
|
|||||||
seekDelegate = Schedule(() =>
|
seekDelegate = Schedule(() =>
|
||||||
{
|
{
|
||||||
if (!beatmap.Disabled)
|
if (!beatmap.Disabled)
|
||||||
current?.Track.Seek(position);
|
CurrentTrack.Seek(position);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,9 +151,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
if (IsUserPaused) return;
|
if (IsUserPaused) return;
|
||||||
|
|
||||||
var track = current?.Track;
|
if (CurrentTrack.IsDummyDevice)
|
||||||
|
|
||||||
if (track == null || track is TrackVirtual)
|
|
||||||
{
|
{
|
||||||
if (beatmap.Disabled)
|
if (beatmap.Disabled)
|
||||||
return;
|
return;
|
||||||
@ -163,17 +170,12 @@ namespace osu.Game.Overlays
|
|||||||
/// <returns>Whether the operation was successful.</returns>
|
/// <returns>Whether the operation was successful.</returns>
|
||||||
public bool Play(bool restart = false)
|
public bool Play(bool restart = false)
|
||||||
{
|
{
|
||||||
var track = current?.Track;
|
|
||||||
|
|
||||||
IsUserPaused = false;
|
IsUserPaused = false;
|
||||||
|
|
||||||
if (track == null)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (restart)
|
if (restart)
|
||||||
track.Restart();
|
CurrentTrack.Restart();
|
||||||
else if (!IsPlaying)
|
else if (!IsPlaying)
|
||||||
track.Start();
|
CurrentTrack.Start();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -183,11 +185,9 @@ namespace osu.Game.Overlays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
var track = current?.Track;
|
|
||||||
|
|
||||||
IsUserPaused = true;
|
IsUserPaused = true;
|
||||||
if (track?.IsRunning == true)
|
if (CurrentTrack.IsRunning)
|
||||||
track.Stop();
|
CurrentTrack.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -196,9 +196,7 @@ namespace osu.Game.Overlays
|
|||||||
/// <returns>Whether the operation was successful.</returns>
|
/// <returns>Whether the operation was successful.</returns>
|
||||||
public bool TogglePause()
|
public bool TogglePause()
|
||||||
{
|
{
|
||||||
var track = current?.Track;
|
if (CurrentTrack.IsRunning)
|
||||||
|
|
||||||
if (track?.IsRunning == true)
|
|
||||||
Stop();
|
Stop();
|
||||||
else
|
else
|
||||||
Play();
|
Play();
|
||||||
@ -220,7 +218,7 @@ namespace osu.Game.Overlays
|
|||||||
if (beatmap.Disabled)
|
if (beatmap.Disabled)
|
||||||
return PreviousTrackResult.None;
|
return PreviousTrackResult.None;
|
||||||
|
|
||||||
var currentTrackPosition = current?.Track.CurrentTime;
|
var currentTrackPosition = CurrentTrack.CurrentTime;
|
||||||
|
|
||||||
if (currentTrackPosition >= restart_cutoff_point)
|
if (currentTrackPosition >= restart_cutoff_point)
|
||||||
{
|
{
|
||||||
@ -234,9 +232,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
if (beatmap is Bindable<WorkingBeatmap> working)
|
changeBeatmap(beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value));
|
||||||
working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
|
|
||||||
|
|
||||||
restartTrack();
|
restartTrack();
|
||||||
return PreviousTrackResult.Previous;
|
return PreviousTrackResult.Previous;
|
||||||
}
|
}
|
||||||
@ -260,9 +256,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (playable != null)
|
if (playable != null)
|
||||||
{
|
{
|
||||||
if (beatmap is Bindable<WorkingBeatmap> working)
|
changeBeatmap(beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value));
|
||||||
working.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
|
|
||||||
|
|
||||||
restartTrack();
|
restartTrack();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -274,21 +268,30 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
// if not scheduled, the previously track will be stopped one frame later (see ScheduleAfterChildren logic in GameBase).
|
// if not scheduled, the previously track will be stopped one frame later (see ScheduleAfterChildren logic in GameBase).
|
||||||
// we probably want to move this to a central method for switching to a new working beatmap in the future.
|
// we probably want to move this to a central method for switching to a new working beatmap in the future.
|
||||||
Schedule(() => beatmap.Value.Track.Restart());
|
Schedule(() => CurrentTrack.Restart());
|
||||||
}
|
}
|
||||||
|
|
||||||
private WorkingBeatmap current;
|
private WorkingBeatmap current;
|
||||||
|
|
||||||
private TrackChangeDirection? queuedDirection;
|
private TrackChangeDirection? queuedDirection;
|
||||||
|
|
||||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap) => changeBeatmap(beatmap.NewValue);
|
||||||
|
|
||||||
|
private void changeBeatmap(WorkingBeatmap newWorking)
|
||||||
{
|
{
|
||||||
|
// This method can potentially be triggered multiple times as it is eagerly fired in next() / prev() to ensure correct execution order
|
||||||
|
// (changeBeatmap must be called before consumers receive the bindable changed event, which is not the case when the local beatmap bindable is updated directly).
|
||||||
|
if (newWorking == current)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var lastWorking = current;
|
||||||
|
|
||||||
TrackChangeDirection direction = TrackChangeDirection.None;
|
TrackChangeDirection direction = TrackChangeDirection.None;
|
||||||
|
|
||||||
|
bool audioEquals = newWorking?.BeatmapInfo?.AudioEquals(current?.BeatmapInfo) ?? false;
|
||||||
|
|
||||||
if (current != null)
|
if (current != null)
|
||||||
{
|
{
|
||||||
bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false;
|
|
||||||
|
|
||||||
if (audioEquals)
|
if (audioEquals)
|
||||||
direction = TrackChangeDirection.None;
|
direction = TrackChangeDirection.None;
|
||||||
else if (queuedDirection.HasValue)
|
else if (queuedDirection.HasValue)
|
||||||
@ -300,18 +303,74 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
// figure out the best direction based on order in playlist.
|
// figure out the best direction based on order in playlist.
|
||||||
var last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
var last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
||||||
var next = beatmap.NewValue == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count();
|
var next = newWorking == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != newWorking.BeatmapSetInfo?.ID).Count();
|
||||||
|
|
||||||
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
direction = last > next ? TrackChangeDirection.Prev : TrackChangeDirection.Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
current = beatmap.NewValue;
|
current = newWorking;
|
||||||
|
|
||||||
|
if (!audioEquals || CurrentTrack.IsDummyDevice)
|
||||||
|
{
|
||||||
|
changeTrack();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// transfer still valid track to new working beatmap
|
||||||
|
current.TransferTrack(lastWorking.Track);
|
||||||
|
}
|
||||||
|
|
||||||
TrackChanged?.Invoke(current, direction);
|
TrackChanged?.Invoke(current, direction);
|
||||||
|
|
||||||
ResetTrackAdjustments();
|
ResetTrackAdjustments();
|
||||||
|
|
||||||
queuedDirection = null;
|
queuedDirection = null;
|
||||||
|
|
||||||
|
// this will be a noop if coming from the beatmapChanged event.
|
||||||
|
// the exception is local operations like next/prev, where we want to complete loading the track before sending out a change.
|
||||||
|
if (beatmap.Value != current && beatmap is Bindable<WorkingBeatmap> working)
|
||||||
|
working.Value = current;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeTrack()
|
||||||
|
{
|
||||||
|
var lastTrack = CurrentTrack;
|
||||||
|
|
||||||
|
var queuedTrack = new DrawableTrack(current.LoadTrack());
|
||||||
|
queuedTrack.Completed += () => onTrackCompleted(current);
|
||||||
|
|
||||||
|
CurrentTrack = queuedTrack;
|
||||||
|
|
||||||
|
// At this point we may potentially be in an async context from tests. This is extremely dangerous but we have to make do for now.
|
||||||
|
// CurrentTrack is immediately updated above for situations where a immediate knowledge about the new track is required,
|
||||||
|
// but the mutation of the hierarchy is scheduled to avoid exceptions.
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
lastTrack.VolumeTo(0, 500, Easing.Out).Expire();
|
||||||
|
|
||||||
|
if (queuedTrack == CurrentTrack)
|
||||||
|
{
|
||||||
|
AddInternal(queuedTrack);
|
||||||
|
queuedTrack.VolumeTo(0).Then().VolumeTo(1, 300, Easing.Out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// If the track has changed since the call to changeTrack, it is safe to dispose the
|
||||||
|
// queued track rather than consume it.
|
||||||
|
queuedTrack.Dispose();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onTrackCompleted(WorkingBeatmap workingBeatmap)
|
||||||
|
{
|
||||||
|
// the source of track completion is the audio thread, so the beatmap may have changed before firing.
|
||||||
|
if (current != workingBeatmap)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!CurrentTrack.Looping && !beatmap.Disabled)
|
||||||
|
NextTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool allowRateAdjustments;
|
private bool allowRateAdjustments;
|
||||||
@ -332,18 +391,20 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the speed adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowRateAdjustments"/> is <c>true</c>.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Does not reset speed adjustments applied directly to the beatmap track.
|
||||||
|
/// </remarks>
|
||||||
public void ResetTrackAdjustments()
|
public void ResetTrackAdjustments()
|
||||||
{
|
{
|
||||||
var track = current?.Track;
|
CurrentTrack.ResetSpeedAdjustments();
|
||||||
if (track == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
track.ResetSpeedAdjustments();
|
|
||||||
|
|
||||||
if (allowRateAdjustments)
|
if (allowRateAdjustments)
|
||||||
{
|
{
|
||||||
foreach (var mod in mods.Value.OfType<IApplicableToTrack>())
|
foreach (var mod in mods.Value.OfType<IApplicableToTrack>())
|
||||||
mod.ApplyToTrack(track);
|
mod.ApplyToTrack(CurrentTrack);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,8 @@ namespace osu.Game.Overlays.News
|
|||||||
public NewsHeaderTitle()
|
public NewsHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "news";
|
Title = "news";
|
||||||
IconTexture = "Icons/news";
|
Description = "get up-to-date on community happenings";
|
||||||
|
IconTexture = "Icons/Hexacons/news";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,17 +13,16 @@ using osu.Game.Overlays.News.Displays;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class NewsOverlay : FullscreenOverlay
|
public class NewsOverlay : FullscreenOverlay<NewsHeader>
|
||||||
{
|
{
|
||||||
private readonly Bindable<string> article = new Bindable<string>(null);
|
private readonly Bindable<string> article = new Bindable<string>(null);
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
private LoadingLayer loading;
|
private LoadingLayer loading;
|
||||||
private NewsHeader header;
|
|
||||||
private OverlayScrollContainer scrollFlow;
|
private OverlayScrollContainer scrollFlow;
|
||||||
|
|
||||||
public NewsOverlay()
|
public NewsOverlay()
|
||||||
: base(OverlayColourScheme.Purple)
|
: base(OverlayColourScheme.Purple, new NewsHeader())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,10 +47,10 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
header = new NewsHeader
|
Header.With(h =>
|
||||||
{
|
{
|
||||||
ShowFrontPage = ShowFrontPage
|
h.ShowFrontPage = ShowFrontPage;
|
||||||
},
|
}),
|
||||||
content = new Container
|
content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -112,12 +111,12 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (e.NewValue == null)
|
if (e.NewValue == null)
|
||||||
{
|
{
|
||||||
header.SetFrontPage();
|
Header.SetFrontPage();
|
||||||
LoadDisplay(new FrontPageDisplay());
|
LoadDisplay(new FrontPageDisplay());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
header.SetArticle(e.NewValue);
|
Header.SetArticle(e.NewValue);
|
||||||
LoadDisplay(Empty());
|
LoadDisplay(Empty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,8 +16,12 @@ using osu.Framework.Threading;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class NotificationOverlay : OsuFocusedOverlayContainer
|
public class NotificationOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
|
public string IconTexture => "Icons/Hexacons/notification";
|
||||||
|
public string Title => "notifications";
|
||||||
|
public string Description => "waiting for 'ya";
|
||||||
|
|
||||||
private const float width = 320;
|
private const float width = 320;
|
||||||
|
|
||||||
public const float TRANSITION_LENGTH = 600;
|
public const float TRANSITION_LENGTH = 600;
|
||||||
|
@ -25,8 +25,12 @@ using osuTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class NowPlayingOverlay : OsuFocusedOverlayContainer
|
public class NowPlayingOverlay : OsuFocusedOverlayContainer, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
|
public string IconTexture => "Icons/Hexacons/music";
|
||||||
|
public string Title => "now playing";
|
||||||
|
public string Description => "manage the currently playing track";
|
||||||
|
|
||||||
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;
|
||||||
@ -234,9 +238,9 @@ namespace osu.Game.Overlays
|
|||||||
pendingBeatmapSwitch = null;
|
pendingBeatmapSwitch = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var track = beatmap.Value?.TrackLoaded ?? false ? beatmap.Value.Track : null;
|
var track = musicController.CurrentTrack;
|
||||||
|
|
||||||
if (track?.IsDummyDevice == false)
|
if (!track.IsDummyDevice)
|
||||||
{
|
{
|
||||||
progressBar.EndTime = track.Length;
|
progressBar.EndTime = track.Length;
|
||||||
progressBar.CurrentTime = track.CurrentTime;
|
progressBar.CurrentTime = track.CurrentTime;
|
||||||
|
@ -12,6 +12,8 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public abstract class OverlayHeader : Container
|
public abstract class OverlayHeader : Container
|
||||||
{
|
{
|
||||||
|
public OverlayTitle Title { get; }
|
||||||
|
|
||||||
private float contentSidePadding;
|
private float contentSidePadding;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -73,7 +75,7 @@ namespace osu.Game.Overlays
|
|||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
CreateTitle().With(title =>
|
Title = CreateTitle().With(title =>
|
||||||
{
|
{
|
||||||
title.Anchor = Anchor.CentreLeft;
|
title.Anchor = Anchor.CentreLeft;
|
||||||
title.Origin = Anchor.CentreLeft;
|
title.Origin = Anchor.CentreLeft;
|
||||||
|
@ -17,7 +17,7 @@ using osuTK.Graphics;
|
|||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <see cref="OsuScrollContainer"/> which provides <see cref="ScrollToTopButton"/>. Mostly used in <see cref="FullscreenOverlay"/>.
|
/// <see cref="OsuScrollContainer"/> which provides <see cref="ScrollToTopButton"/>. Mostly used in <see cref="FullscreenOverlay{T}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class OverlayScrollContainer : OsuScrollContainer
|
public class OverlayScrollContainer : OsuScrollContainer
|
||||||
{
|
{
|
||||||
|
@ -12,19 +12,27 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public abstract class OverlayTitle : CompositeDrawable
|
public abstract class OverlayTitle : CompositeDrawable, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
private readonly OsuSpriteText title;
|
private readonly OsuSpriteText titleText;
|
||||||
private readonly Container icon;
|
private readonly Container icon;
|
||||||
|
|
||||||
protected string Title
|
private string title;
|
||||||
|
|
||||||
|
public string Title
|
||||||
{
|
{
|
||||||
set => title.Text = value;
|
get => title;
|
||||||
|
protected set => titleText.Text = title = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected string IconTexture
|
public string Description { get; protected set; }
|
||||||
|
|
||||||
|
private string iconTexture;
|
||||||
|
|
||||||
|
public string IconTexture
|
||||||
{
|
{
|
||||||
set => icon.Child = new OverlayTitleIcon(value);
|
get => iconTexture;
|
||||||
|
protected set => icon.Child = new OverlayTitleIcon(iconTexture = value);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected OverlayTitle()
|
protected OverlayTitle()
|
||||||
@ -45,7 +53,7 @@ namespace osu.Game.Overlays
|
|||||||
Margin = new MarginPadding { Horizontal = 5 }, // compensates for osu-web sprites having around 5px of whitespace on each side
|
Margin = new MarginPadding { Horizontal = 5 }, // compensates for osu-web sprites having around 5px of whitespace on each side
|
||||||
Size = new Vector2(30)
|
Size = new Vector2(30)
|
||||||
},
|
},
|
||||||
title = new OsuSpriteText
|
titleText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -9,7 +9,7 @@ using osu.Game.Online.API;
|
|||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A subview containing online content, to be displayed inside a <see cref="FullscreenOverlay"/>.
|
/// A subview containing online content, to be displayed inside a <see cref="FullscreenOverlay{T}"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>
|
/// <remarks>
|
||||||
/// Automatically performs a data fetch on load.
|
/// Automatically performs a data fetch on load.
|
||||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Profile
|
|||||||
public ProfileHeaderTitle()
|
public ProfileHeaderTitle()
|
||||||
{
|
{
|
||||||
Title = "player info";
|
Title = "player info";
|
||||||
IconTexture = "Icons/profile";
|
IconTexture = "Icons/Hexacons/profile";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@ namespace osu.Game.Overlays.Rankings
|
|||||||
public RankingsTitle()
|
public RankingsTitle()
|
||||||
{
|
{
|
||||||
Title = "ranking";
|
Title = "ranking";
|
||||||
IconTexture = "Icons/rankings";
|
Description = "find out who's the best right now";
|
||||||
|
IconTexture = "Icons/Hexacons/rankings";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,17 +17,16 @@ using osu.Game.Overlays.Rankings.Tables;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class RankingsOverlay : FullscreenOverlay
|
public class RankingsOverlay : FullscreenOverlay<RankingsOverlayHeader>
|
||||||
{
|
{
|
||||||
protected Bindable<Country> Country => header.Country;
|
protected Bindable<Country> Country => Header.Country;
|
||||||
|
|
||||||
protected Bindable<RankingsScope> Scope => header.Current;
|
protected Bindable<RankingsScope> Scope => Header.Current;
|
||||||
|
|
||||||
private readonly OverlayScrollContainer scrollFlow;
|
private readonly OverlayScrollContainer scrollFlow;
|
||||||
private readonly Container contentContainer;
|
private readonly Container contentContainer;
|
||||||
private readonly LoadingLayer loading;
|
private readonly LoadingLayer loading;
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly RankingsOverlayHeader header;
|
|
||||||
|
|
||||||
private APIRequest lastRequest;
|
private APIRequest lastRequest;
|
||||||
private CancellationTokenSource cancellationToken;
|
private CancellationTokenSource cancellationToken;
|
||||||
@ -36,7 +35,12 @@ namespace osu.Game.Overlays
|
|||||||
private IAPIProvider api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
public RankingsOverlay()
|
public RankingsOverlay()
|
||||||
: base(OverlayColourScheme.Green)
|
: base(OverlayColourScheme.Green, new RankingsOverlayHeader
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Depth = -float.MaxValue
|
||||||
|
})
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -55,12 +59,7 @@ namespace osu.Game.Overlays
|
|||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
header = new RankingsOverlayHeader
|
Header,
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
Depth = -float.MaxValue
|
|
||||||
},
|
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -97,7 +96,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
header.Ruleset.BindTo(ruleset);
|
Header.Ruleset.BindTo(ruleset);
|
||||||
|
|
||||||
Country.BindValueChanged(_ =>
|
Country.BindValueChanged(_ =>
|
||||||
{
|
{
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Overlays.SearchableList
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The amount of padding added to content (does not affect background or tab control strip).
|
/// The amount of padding added to content (does not affect background or tab control strip).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual float ContentHorizontalPadding => SearchableListOverlay.WIDTH_PADDING;
|
protected virtual float ContentHorizontalPadding => WaveOverlayContainer.WIDTH_PADDING;
|
||||||
|
|
||||||
protected SearchableListFilterControl()
|
protected SearchableListFilterControl()
|
||||||
{
|
{
|
||||||
|
@ -1,82 +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;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.SearchableList
|
|
||||||
{
|
|
||||||
public abstract class SearchableListHeader<T> : Container
|
|
||||||
where T : struct, Enum
|
|
||||||
{
|
|
||||||
public readonly HeaderTabControl<T> Tabs;
|
|
||||||
|
|
||||||
protected abstract Color4 BackgroundColour { get; }
|
|
||||||
protected abstract T DefaultTab { get; }
|
|
||||||
protected abstract Drawable CreateHeaderText();
|
|
||||||
protected abstract IconUsage Icon { get; }
|
|
||||||
|
|
||||||
protected SearchableListHeader()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X;
|
|
||||||
Height = 90;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = BackgroundColour,
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Padding = new MarginPadding { Left = SearchableListOverlay.WIDTH_PADDING, Right = SearchableListOverlay.WIDTH_PADDING },
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Position = new Vector2(-35f, 5f),
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Spacing = new Vector2(10f, 0f),
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new SpriteIcon
|
|
||||||
{
|
|
||||||
Size = new Vector2(25),
|
|
||||||
Icon = Icon,
|
|
||||||
},
|
|
||||||
CreateHeaderText(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
Tabs = new HeaderTabControl<T>
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
Tabs.Current.Value = DefaultTab;
|
|
||||||
Tabs.Current.TriggerChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours)
|
|
||||||
{
|
|
||||||
Tabs.StripColour = colours.Green;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +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;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Game.Graphics.Backgrounds;
|
|
||||||
using osu.Game.Graphics.Cursor;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.SearchableList
|
|
||||||
{
|
|
||||||
public abstract class SearchableListOverlay : FullscreenOverlay
|
|
||||||
{
|
|
||||||
public const float WIDTH_PADDING = 80;
|
|
||||||
|
|
||||||
protected SearchableListOverlay(OverlayColourScheme colourScheme)
|
|
||||||
: base(colourScheme)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract class SearchableListOverlay<THeader, TTab, TCategory> : SearchableListOverlay
|
|
||||||
where THeader : struct, Enum
|
|
||||||
where TTab : struct, Enum
|
|
||||||
where TCategory : struct, Enum
|
|
||||||
{
|
|
||||||
private readonly Container scrollContainer;
|
|
||||||
|
|
||||||
protected readonly SearchableListHeader<THeader> Header;
|
|
||||||
protected readonly SearchableListFilterControl<TTab, TCategory> Filter;
|
|
||||||
protected readonly FillFlowContainer ScrollFlow;
|
|
||||||
|
|
||||||
protected abstract Color4 BackgroundColour { get; }
|
|
||||||
protected abstract Color4 TrianglesColourLight { get; }
|
|
||||||
protected abstract Color4 TrianglesColourDark { get; }
|
|
||||||
protected abstract SearchableListHeader<THeader> CreateHeader();
|
|
||||||
protected abstract SearchableListFilterControl<TTab, TCategory> CreateFilterControl();
|
|
||||||
|
|
||||||
protected SearchableListOverlay(OverlayColourScheme colourScheme)
|
|
||||||
: base(colourScheme)
|
|
||||||
{
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = BackgroundColour,
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new Triangles
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
TriangleScale = 5,
|
|
||||||
ColourLight = TrianglesColourLight,
|
|
||||||
ColourDark = TrianglesColourDark,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
scrollContainer = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Child = new OsuContextMenuContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Masking = true,
|
|
||||||
Child = new OverlayScrollContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
ScrollbarVisible = false,
|
|
||||||
Child = ScrollFlow = new FillFlowContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Padding = new MarginPadding { Horizontal = 10, Bottom = 50 },
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
Header = CreateHeader(),
|
|
||||||
Filter = CreateFilterControl(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
scrollContainer.Padding = new MarginPadding { Top = Header.Height + Filter.Height };
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnFocus(FocusEvent e)
|
|
||||||
{
|
|
||||||
Filter.Search.TakeFocus();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
|
||||||
{
|
|
||||||
base.PopIn();
|
|
||||||
|
|
||||||
Filter.Search.HoldFocus = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopOut()
|
|
||||||
{
|
|
||||||
base.PopOut();
|
|
||||||
|
|
||||||
Filter.Search.HoldFocus = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +1,14 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Overlays.Settings.Sections.Gameplay;
|
using osu.Game.Overlays.Settings.Sections.Gameplay;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections
|
namespace osu.Game.Overlays.Settings.Sections
|
||||||
{
|
{
|
||||||
@ -33,11 +35,19 @@ namespace osu.Game.Overlays.Settings.Sections
|
|||||||
private void load(RulesetStore rulesets)
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
|
foreach (Ruleset ruleset in rulesets.AvailableRulesets.Select(info => info.CreateInstance()))
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
SettingsSubsection section = ruleset.CreateSettings();
|
SettingsSubsection section = ruleset.CreateSettings();
|
||||||
|
|
||||||
if (section != null)
|
if (section != null)
|
||||||
Add(section);
|
Add(section);
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Logger.Error(e, "Failed to load ruleset settings");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,8 +163,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything);
|
scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything);
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
windowModes.ItemsAdded += _ => windowModesChanged();
|
windowModes.CollectionChanged += (sender, args) => windowModesChanged();
|
||||||
windowModes.ItemsRemoved += _ => windowModesChanged();
|
|
||||||
|
|
||||||
windowModesChanged();
|
windowModesChanged();
|
||||||
}
|
}
|
||||||
|
@ -4,22 +4,21 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
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.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Overlays.Toolbar;
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
public class Sidebar : Container<SidebarButton>, IStateful<ExpandedState>
|
public class Sidebar : Container<SidebarButton>, IStateful<ExpandedState>
|
||||||
{
|
{
|
||||||
private readonly FillFlowContainer<SidebarButton> content;
|
private readonly FillFlowContainer<SidebarButton> content;
|
||||||
public const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
|
public const float DEFAULT_WIDTH = Toolbar.Toolbar.HEIGHT * 1.4f;
|
||||||
public const int EXPANDED_WIDTH = 200;
|
public const int EXPANDED_WIDTH = 200;
|
||||||
|
|
||||||
public event Action<ExpandedState> StateChanged;
|
public event Action<ExpandedState> StateChanged;
|
||||||
|
@ -13,8 +13,12 @@ using osu.Framework.Bindables;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class SettingsOverlay : SettingsPanel
|
public class SettingsOverlay : SettingsPanel, INamedOverlayComponent
|
||||||
{
|
{
|
||||||
|
public string IconTexture => "Icons/Hexacons/settings";
|
||||||
|
public string Title => "settings";
|
||||||
|
public string Description => "change the way osu! behaves";
|
||||||
|
|
||||||
protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[]
|
protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[]
|
||||||
{
|
{
|
||||||
new GeneralSection(),
|
new GeneralSection(),
|
||||||
@ -30,7 +34,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private readonly List<SettingsSubPanel> subPanels = new List<SettingsSubPanel>();
|
private readonly List<SettingsSubPanel> subPanels = new List<SettingsSubPanel>();
|
||||||
|
|
||||||
protected override Drawable CreateHeader() => new SettingsHeader("settings", "Change the way osu! behaves");
|
protected override Drawable CreateHeader() => new SettingsHeader(Title, Description);
|
||||||
protected override Drawable CreateFooter() => new SettingsFooter();
|
protected override Drawable CreateFooter() => new SettingsFooter();
|
||||||
|
|
||||||
public SettingsOverlay()
|
public SettingsOverlay()
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
private const double transition_time = 500;
|
private const double transition_time = 500;
|
||||||
|
|
||||||
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
protected readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
|
||||||
|
|
||||||
// Toolbar components like RulesetSelector should receive keyboard input events even when the toolbar is hidden.
|
// Toolbar components like RulesetSelector should receive keyboard input events even when the toolbar is hidden.
|
||||||
public override bool PropagateNonPositionalInputSubTree => true;
|
public override bool PropagateNonPositionalInputSubTree => true;
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
public ToolbarBeatmapListingButton()
|
public ToolbarBeatmapListingButton()
|
||||||
{
|
{
|
||||||
SetIcon(OsuIcon.ChevronDownCircle);
|
|
||||||
TooltipMain = "Beatmap listing";
|
|
||||||
TooltipSub = "Browse for new beatmaps";
|
|
||||||
|
|
||||||
Hotkey = GlobalAction.ToggleDirect;
|
Hotkey = GlobalAction.ToggleDirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -25,8 +26,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
public abstract class ToolbarButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
|
public abstract class ToolbarButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public const float WIDTH = Toolbar.HEIGHT * 1.4f;
|
|
||||||
|
|
||||||
protected GlobalAction? Hotkey { get; set; }
|
protected GlobalAction? Hotkey { get; set; }
|
||||||
|
|
||||||
public void SetIcon(Drawable icon)
|
public void SetIcon(Drawable icon)
|
||||||
@ -35,16 +34,14 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
IconContainer.Show();
|
IconContainer.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIcon(IconUsage icon) => SetIcon(new SpriteIcon
|
[Resolved]
|
||||||
{
|
private TextureStore textures { get; set; }
|
||||||
Size = new Vector2(20),
|
|
||||||
Icon = icon
|
|
||||||
});
|
|
||||||
|
|
||||||
public IconUsage Icon
|
public void SetIcon(string texture) =>
|
||||||
|
SetIcon(new Sprite
|
||||||
{
|
{
|
||||||
set => SetIcon(value);
|
Texture = textures.Get(texture),
|
||||||
}
|
});
|
||||||
|
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
@ -82,7 +79,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
protected ToolbarButton()
|
protected ToolbarButton()
|
||||||
: base(HoverSampleSet.Loud)
|
: base(HoverSampleSet.Loud)
|
||||||
{
|
{
|
||||||
Width = WIDTH;
|
Width = Toolbar.HEIGHT;
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -116,7 +113,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Size = new Vector2(20),
|
Size = new Vector2(26),
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
DrawableText = new OsuSpriteText
|
DrawableText = new OsuSpriteText
|
||||||
|
@ -2,19 +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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
public class ToolbarChangelogButton : ToolbarOverlayToggleButton
|
public class ToolbarChangelogButton : ToolbarOverlayToggleButton
|
||||||
{
|
{
|
||||||
public ToolbarChangelogButton()
|
|
||||||
{
|
|
||||||
SetIcon(FontAwesome.Solid.Bullhorn);
|
|
||||||
TooltipMain = "Changelog";
|
|
||||||
TooltipSub = "Track recent dev updates in the osu! ecosystem";
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(ChangelogOverlay changelog)
|
private void load(ChangelogOverlay changelog)
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
@ -11,10 +10,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
public ToolbarChatButton()
|
public ToolbarChatButton()
|
||||||
{
|
{
|
||||||
SetIcon(FontAwesome.Solid.Comments);
|
|
||||||
TooltipMain = "Chat";
|
|
||||||
TooltipSub = "Join the real-time discussion";
|
|
||||||
|
|
||||||
Hotkey = GlobalAction.ToggleChat;
|
Hotkey = GlobalAction.ToggleChat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
@ -10,11 +10,16 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
{
|
{
|
||||||
public ToolbarHomeButton()
|
public ToolbarHomeButton()
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.Home;
|
Width *= 1.4f;
|
||||||
TooltipMain = "Home";
|
|
||||||
TooltipSub = "Return to the main menu";
|
|
||||||
|
|
||||||
Hotkey = GlobalAction.Home;
|
Hotkey = GlobalAction.Home;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
TooltipMain = "home";
|
||||||
|
TooltipSub = "return to the main menu";
|
||||||
|
SetIcon("Icons/Hexacons/home");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
@ -14,10 +13,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
public ToolbarMusicButton()
|
public ToolbarMusicButton()
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.Music;
|
|
||||||
TooltipMain = "Now playing";
|
|
||||||
TooltipSub = "Manage the currently playing track";
|
|
||||||
|
|
||||||
Hotkey = GlobalAction.ToggleNowPlaying;
|
Hotkey = GlobalAction.ToggleNowPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,19 +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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Toolbar
|
namespace osu.Game.Overlays.Toolbar
|
||||||
{
|
{
|
||||||
public class ToolbarNewsButton : ToolbarOverlayToggleButton
|
public class ToolbarNewsButton : ToolbarOverlayToggleButton
|
||||||
{
|
{
|
||||||
public ToolbarNewsButton()
|
|
||||||
{
|
|
||||||
Icon = FontAwesome.Solid.Newspaper;
|
|
||||||
TooltipMain = "News";
|
|
||||||
TooltipSub = "Get up-to-date on community happenings";
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(NewsOverlay news)
|
private void load(NewsOverlay news)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
@ -25,10 +24,6 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
public ToolbarNotificationButton()
|
public ToolbarNotificationButton()
|
||||||
{
|
{
|
||||||
Icon = FontAwesome.Solid.Bars;
|
|
||||||
TooltipMain = "Notifications";
|
|
||||||
TooltipSub = "Waiting for 'ya";
|
|
||||||
|
|
||||||
Hotkey = GlobalAction.ToggleNotifications;
|
Hotkey = GlobalAction.ToggleNotifications;
|
||||||
|
|
||||||
Add(countDisplay = new CountCircle
|
Add(countDisplay = new CountCircle
|
||||||
|
@ -32,6 +32,13 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
Action = stateContainer.ToggleVisibility;
|
Action = stateContainer.ToggleVisibility;
|
||||||
overlayState.BindTo(stateContainer.State);
|
overlayState.BindTo(stateContainer.State);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stateContainer is INamedOverlayComponent named)
|
||||||
|
{
|
||||||
|
TooltipMain = named.Title;
|
||||||
|
TooltipSub = named.Description;
|
||||||
|
SetIcon(named.IconTexture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user