mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Merge branch 'spectator-replay-watcher' into spectator-listing
This commit is contained in:
commit
a088151e58
@ -34,6 +34,8 @@ If you are looking to install or test osu! without setting up a development envi
|
|||||||
| [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS(iOS 10+)](https://osu.ppy.sh/home/testflight) | [Android (5+)](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk)
|
| [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS(iOS 10+)](https://osu.ppy.sh/home/testflight) | [Android (5+)](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk)
|
||||||
| ------------- | ------------- | ------------- | ------------- | ------------- |
|
| ------------- | ------------- | ------------- | ------------- | ------------- |
|
||||||
|
|
||||||
|
- The iOS testflight link may fill up (Apple has a hard limit of 10,000 users). We reset it occasionally when this happens. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements of link resets.
|
||||||
|
|
||||||
- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?tabs=netcore31&pivots=os-windows)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs.
|
- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?tabs=netcore31&pivots=os-windows)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs.
|
||||||
|
|
||||||
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
|
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.
|
||||||
|
@ -52,6 +52,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1019.0" />
|
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1029.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -35,6 +35,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
|||||||
|
|
||||||
objects.Add(new Note { StartTime = time });
|
objects.Add(new Note { StartTime = time });
|
||||||
|
|
||||||
|
// don't hit the first note
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
{
|
{
|
||||||
frames.Add(new ManiaReplayFrame(time + 10, ManiaAction.Key1));
|
frames.Add(new ManiaReplayFrame(time + 10, ManiaAction.Key1));
|
||||||
|
@ -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 osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Performance;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.UI.Scrolling;
|
using osu.Game.Rulesets.UI.Scrolling;
|
||||||
|
@ -0,0 +1,296 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.NonVisual
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class StreamingFramedReplayInputHandlerTest
|
||||||
|
{
|
||||||
|
private Replay replay;
|
||||||
|
private TestInputHandler handler;
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp()
|
||||||
|
{
|
||||||
|
handler = new TestInputHandler(replay = new Replay
|
||||||
|
{
|
||||||
|
HasReceivedAllFrames = false,
|
||||||
|
Frames = new List<ReplayFrame>
|
||||||
|
{
|
||||||
|
new TestReplayFrame(0),
|
||||||
|
new TestReplayFrame(1000),
|
||||||
|
new TestReplayFrame(2000),
|
||||||
|
new TestReplayFrame(3000, true),
|
||||||
|
new TestReplayFrame(4000, true),
|
||||||
|
new TestReplayFrame(5000, true),
|
||||||
|
new TestReplayFrame(7000, true),
|
||||||
|
new TestReplayFrame(8000),
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestNormalPlayback()
|
||||||
|
{
|
||||||
|
Assert.IsNull(handler.CurrentFrame);
|
||||||
|
|
||||||
|
confirmCurrentFrame(null);
|
||||||
|
confirmNextFrame(0);
|
||||||
|
|
||||||
|
setTime(0, 0);
|
||||||
|
confirmCurrentFrame(0);
|
||||||
|
confirmNextFrame(1);
|
||||||
|
|
||||||
|
// if we hit the first frame perfectly, time should progress to it.
|
||||||
|
setTime(1000, 1000);
|
||||||
|
confirmCurrentFrame(1);
|
||||||
|
confirmNextFrame(2);
|
||||||
|
|
||||||
|
// in between non-important frames should progress based on input.
|
||||||
|
setTime(1200, 1200);
|
||||||
|
confirmCurrentFrame(1);
|
||||||
|
|
||||||
|
setTime(1400, 1400);
|
||||||
|
confirmCurrentFrame(1);
|
||||||
|
|
||||||
|
// progressing beyond the next frame should force time to that frame once.
|
||||||
|
setTime(2200, 2000);
|
||||||
|
confirmCurrentFrame(2);
|
||||||
|
|
||||||
|
// second attempt should progress to input time
|
||||||
|
setTime(2200, 2200);
|
||||||
|
confirmCurrentFrame(2);
|
||||||
|
|
||||||
|
// entering important section
|
||||||
|
setTime(3000, 3000);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
|
||||||
|
// cannot progress within
|
||||||
|
setTime(3500, null);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
|
||||||
|
setTime(4000, 4000);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
|
||||||
|
// still cannot progress
|
||||||
|
setTime(4500, null);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
|
||||||
|
setTime(5200, 5000);
|
||||||
|
confirmCurrentFrame(5);
|
||||||
|
|
||||||
|
// important section AllowedImportantTimeSpan allowance
|
||||||
|
setTime(5200, 5200);
|
||||||
|
confirmCurrentFrame(5);
|
||||||
|
|
||||||
|
setTime(7200, 7000);
|
||||||
|
confirmCurrentFrame(6);
|
||||||
|
|
||||||
|
setTime(7200, null);
|
||||||
|
confirmCurrentFrame(6);
|
||||||
|
|
||||||
|
// exited important section
|
||||||
|
setTime(8200, 8000);
|
||||||
|
confirmCurrentFrame(7);
|
||||||
|
confirmNextFrame(null);
|
||||||
|
|
||||||
|
setTime(8200, null);
|
||||||
|
confirmCurrentFrame(7);
|
||||||
|
confirmNextFrame(null);
|
||||||
|
|
||||||
|
setTime(8400, null);
|
||||||
|
confirmCurrentFrame(7);
|
||||||
|
confirmNextFrame(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestIntroTime()
|
||||||
|
{
|
||||||
|
setTime(-1000, -1000);
|
||||||
|
confirmCurrentFrame(null);
|
||||||
|
confirmNextFrame(0);
|
||||||
|
|
||||||
|
setTime(-500, -500);
|
||||||
|
confirmCurrentFrame(null);
|
||||||
|
confirmNextFrame(0);
|
||||||
|
|
||||||
|
setTime(0, 0);
|
||||||
|
confirmCurrentFrame(0);
|
||||||
|
confirmNextFrame(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBasicRewind()
|
||||||
|
{
|
||||||
|
setTime(2800, 0);
|
||||||
|
setTime(2800, 1000);
|
||||||
|
setTime(2800, 2000);
|
||||||
|
setTime(2800, 2800);
|
||||||
|
confirmCurrentFrame(2);
|
||||||
|
confirmNextFrame(3);
|
||||||
|
|
||||||
|
// pivot without crossing a frame boundary
|
||||||
|
setTime(2700, 2700);
|
||||||
|
confirmCurrentFrame(2);
|
||||||
|
confirmNextFrame(1);
|
||||||
|
|
||||||
|
// cross current frame boundary; should not yet update frame
|
||||||
|
setTime(1980, 1980);
|
||||||
|
confirmCurrentFrame(2);
|
||||||
|
confirmNextFrame(1);
|
||||||
|
|
||||||
|
setTime(1200, 1200);
|
||||||
|
confirmCurrentFrame(2);
|
||||||
|
confirmNextFrame(1);
|
||||||
|
|
||||||
|
// ensure each frame plays out until start
|
||||||
|
setTime(-500, 1000);
|
||||||
|
confirmCurrentFrame(1);
|
||||||
|
confirmNextFrame(0);
|
||||||
|
|
||||||
|
setTime(-500, 0);
|
||||||
|
confirmCurrentFrame(0);
|
||||||
|
confirmNextFrame(null);
|
||||||
|
|
||||||
|
setTime(-500, -500);
|
||||||
|
confirmCurrentFrame(0);
|
||||||
|
confirmNextFrame(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRewindInsideImportantSection()
|
||||||
|
{
|
||||||
|
fastForwardToPoint(3000);
|
||||||
|
|
||||||
|
setTime(4000, 4000);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
confirmNextFrame(5);
|
||||||
|
|
||||||
|
setTime(3500, null);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
confirmNextFrame(3);
|
||||||
|
|
||||||
|
setTime(3000, 3000);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(2);
|
||||||
|
|
||||||
|
setTime(3500, null);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(4);
|
||||||
|
|
||||||
|
setTime(4000, 4000);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
confirmNextFrame(5);
|
||||||
|
|
||||||
|
setTime(4500, null);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
confirmNextFrame(5);
|
||||||
|
|
||||||
|
setTime(4000, null);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
confirmNextFrame(5);
|
||||||
|
|
||||||
|
setTime(3500, null);
|
||||||
|
confirmCurrentFrame(4);
|
||||||
|
confirmNextFrame(3);
|
||||||
|
|
||||||
|
setTime(3000, 3000);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestRewindOutOfImportantSection()
|
||||||
|
{
|
||||||
|
fastForwardToPoint(3500);
|
||||||
|
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(4);
|
||||||
|
|
||||||
|
setTime(3200, null);
|
||||||
|
// next frame doesn't change even though direction reversed, because of important section.
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(4);
|
||||||
|
|
||||||
|
setTime(3000, null);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(4);
|
||||||
|
|
||||||
|
setTime(2800, 2800);
|
||||||
|
confirmCurrentFrame(3);
|
||||||
|
confirmNextFrame(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fastForwardToPoint(double destination)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1000; i++)
|
||||||
|
{
|
||||||
|
if (handler.SetFrameFromTime(destination) == null)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new TimeoutException("Seek was never fulfilled");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setTime(double set, double? expect)
|
||||||
|
{
|
||||||
|
Assert.AreEqual(expect, handler.SetFrameFromTime(set));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void confirmCurrentFrame(int? frame)
|
||||||
|
{
|
||||||
|
if (frame.HasValue)
|
||||||
|
{
|
||||||
|
Assert.IsNotNull(handler.CurrentFrame);
|
||||||
|
Assert.AreEqual(replay.Frames[frame.Value].Time, handler.CurrentFrame.Time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.IsNull(handler.CurrentFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void confirmNextFrame(int? frame)
|
||||||
|
{
|
||||||
|
if (frame.HasValue)
|
||||||
|
{
|
||||||
|
Assert.IsNotNull(handler.NextFrame);
|
||||||
|
Assert.AreEqual(replay.Frames[frame.Value].Time, handler.NextFrame.Time);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.IsNull(handler.NextFrame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestReplayFrame : ReplayFrame
|
||||||
|
{
|
||||||
|
public readonly bool IsImportant;
|
||||||
|
|
||||||
|
public TestReplayFrame(double time, bool isImportant = false)
|
||||||
|
: base(time)
|
||||||
|
{
|
||||||
|
IsImportant = isImportant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestInputHandler : FramedReplayInputHandler<TestReplayFrame>
|
||||||
|
{
|
||||||
|
public TestInputHandler(Replay replay)
|
||||||
|
: base(replay)
|
||||||
|
{
|
||||||
|
FrameAccuratePlayback = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override double AllowedImportantTimeSpan => 1000;
|
||||||
|
|
||||||
|
protected override bool IsImportant(TestReplayFrame frame) => frame.IsImportant;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,29 +2,23 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets;
|
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Tests.Visual.Gameplay
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
{
|
{
|
||||||
public class TestSceneHUDOverlay : SkinnableTestScene
|
public class TestSceneHUDOverlay : OsuManualInputManagerTestScene
|
||||||
{
|
{
|
||||||
private HUDOverlay hudOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
|
|
||||||
private IEnumerable<HUDOverlay> hudOverlays => CreatedDrawables.OfType<HUDOverlay>();
|
|
||||||
|
|
||||||
// best way to check without exposing.
|
// best way to check without exposing.
|
||||||
private Drawable hideTarget => hudOverlay.KeyCounter;
|
private Drawable hideTarget => hudOverlay.KeyCounter;
|
||||||
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();
|
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();
|
||||||
@ -37,17 +31,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
createNew();
|
createNew();
|
||||||
|
|
||||||
AddRepeatStep("increase combo", () =>
|
AddRepeatStep("increase combo", () => { hudOverlay.ComboCounter.Current.Value++; }, 10);
|
||||||
{
|
|
||||||
foreach (var hud in hudOverlays)
|
|
||||||
hud.ComboCounter.Current.Value++;
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
AddStep("reset combo", () =>
|
AddStep("reset combo", () => { hudOverlay.ComboCounter.Current.Value = 0; });
|
||||||
{
|
|
||||||
foreach (var hud in hudOverlays)
|
|
||||||
hud.ComboCounter.Current.Value = 0;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
@ -77,7 +63,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
createNew();
|
createNew();
|
||||||
|
|
||||||
AddStep("set showhud false", () => hudOverlays.ForEach(h => h.ShowHud.Value = false));
|
AddStep("set showhud false", () => hudOverlay.ShowHud.Value = false);
|
||||||
|
|
||||||
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
||||||
AddAssert("pause button is still visible", () => hudOverlay.HoldToQuit.IsPresent);
|
AddAssert("pause button is still visible", () => hudOverlay.HoldToQuit.IsPresent);
|
||||||
@ -86,10 +72,32 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddAssert("key counter flow not affected", () => keyCounterFlow.IsPresent);
|
AddAssert("key counter flow not affected", () => keyCounterFlow.IsPresent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMomentaryShowHUD()
|
||||||
|
{
|
||||||
|
createNew();
|
||||||
|
|
||||||
|
HUDVisibilityMode originalConfigValue = HUDVisibilityMode.HideDuringGameplay;
|
||||||
|
|
||||||
|
AddStep("get original config value", () => originalConfigValue = config.Get<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode));
|
||||||
|
|
||||||
|
AddStep("set hud to never show", () => config.Set(OsuSetting.HUDVisibilityMode, HUDVisibilityMode.Never));
|
||||||
|
|
||||||
|
AddUntilStep("wait for fade", () => !hideTarget.IsPresent);
|
||||||
|
|
||||||
|
AddStep("trigger momentary show", () => InputManager.PressKey(Key.ControlLeft));
|
||||||
|
AddUntilStep("wait for visible", () => hideTarget.IsPresent);
|
||||||
|
|
||||||
|
AddStep("stop trigering", () => InputManager.ReleaseKey(Key.ControlLeft));
|
||||||
|
AddUntilStep("wait for fade", () => !hideTarget.IsPresent);
|
||||||
|
|
||||||
|
AddStep("set original config value", () => config.Set(OsuSetting.HUDVisibilityMode, originalConfigValue));
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestExternalHideDoesntAffectConfig()
|
public void TestExternalHideDoesntAffectConfig()
|
||||||
{
|
{
|
||||||
HUDVisibilityMode originalConfigValue = HUDVisibilityMode.HideDuringBreaks;
|
HUDVisibilityMode originalConfigValue = HUDVisibilityMode.HideDuringGameplay;
|
||||||
|
|
||||||
createNew();
|
createNew();
|
||||||
|
|
||||||
@ -113,14 +121,14 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddStep("set keycounter visible false", () =>
|
AddStep("set keycounter visible false", () =>
|
||||||
{
|
{
|
||||||
config.Set<bool>(OsuSetting.KeyOverlay, false);
|
config.Set<bool>(OsuSetting.KeyOverlay, false);
|
||||||
hudOverlays.ForEach(h => h.KeyCounter.AlwaysVisible.Value = false);
|
hudOverlay.KeyCounter.AlwaysVisible.Value = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep("set showhud false", () => hudOverlays.ForEach(h => h.ShowHud.Value = false));
|
AddStep("set showhud false", () => hudOverlay.ShowHud.Value = false);
|
||||||
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
||||||
AddAssert("key counters hidden", () => !keyCounterFlow.IsPresent);
|
AddAssert("key counters hidden", () => !keyCounterFlow.IsPresent);
|
||||||
|
|
||||||
AddStep("set showhud true", () => hudOverlays.ForEach(h => h.ShowHud.Value = true));
|
AddStep("set showhud true", () => hudOverlay.ShowHud.Value = true);
|
||||||
AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent);
|
AddUntilStep("hidetarget is visible", () => hideTarget.IsPresent);
|
||||||
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);
|
AddAssert("key counters still hidden", () => !keyCounterFlow.IsPresent);
|
||||||
|
|
||||||
@ -131,22 +139,17 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
AddStep("create overlay", () =>
|
AddStep("create overlay", () =>
|
||||||
{
|
{
|
||||||
SetContents(() =>
|
hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());
|
||||||
{
|
|
||||||
hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());
|
|
||||||
|
|
||||||
// Add any key just to display the key counter visually.
|
// Add any key just to display the key counter visually.
|
||||||
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));
|
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));
|
||||||
|
|
||||||
hudOverlay.ComboCounter.Current.Value = 1;
|
hudOverlay.ComboCounter.Current.Value = 1;
|
||||||
|
|
||||||
action?.Invoke(hudOverlay);
|
action?.Invoke(hudOverlay);
|
||||||
|
|
||||||
return hudOverlay;
|
Child = hudOverlay;
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,99 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSkinnableHUDOverlay : SkinnableTestScene
|
||||||
|
{
|
||||||
|
private HUDOverlay hudOverlay;
|
||||||
|
|
||||||
|
private IEnumerable<HUDOverlay> hudOverlays => CreatedDrawables.OfType<HUDOverlay>();
|
||||||
|
|
||||||
|
// best way to check without exposing.
|
||||||
|
private Drawable hideTarget => hudOverlay.KeyCounter;
|
||||||
|
private FillFlowContainer<KeyCounter> keyCounterFlow => hudOverlay.KeyCounter.ChildrenOfType<FillFlowContainer<KeyCounter>>().First();
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuConfigManager config { get; set; }
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestComboCounterIncrementing()
|
||||||
|
{
|
||||||
|
createNew();
|
||||||
|
|
||||||
|
AddRepeatStep("increase combo", () =>
|
||||||
|
{
|
||||||
|
foreach (var hud in hudOverlays)
|
||||||
|
hud.ComboCounter.Current.Value++;
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
AddStep("reset combo", () =>
|
||||||
|
{
|
||||||
|
foreach (var hud in hudOverlays)
|
||||||
|
hud.ComboCounter.Current.Value = 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestFadesInOnLoadComplete()
|
||||||
|
{
|
||||||
|
float? initialAlpha = null;
|
||||||
|
|
||||||
|
createNew(h => h.OnLoadComplete += _ => initialAlpha = hideTarget.Alpha);
|
||||||
|
AddUntilStep("wait for load", () => hudOverlay.IsAlive);
|
||||||
|
AddAssert("initial alpha was less than 1", () => initialAlpha < 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestHideExternally()
|
||||||
|
{
|
||||||
|
createNew();
|
||||||
|
|
||||||
|
AddStep("set showhud false", () => hudOverlays.ForEach(h => h.ShowHud.Value = false));
|
||||||
|
|
||||||
|
AddUntilStep("hidetarget is hidden", () => !hideTarget.IsPresent);
|
||||||
|
AddAssert("pause button is still visible", () => hudOverlay.HoldToQuit.IsPresent);
|
||||||
|
|
||||||
|
// Key counter flow container should not be affected by this, only the key counter display will be hidden as checked above.
|
||||||
|
AddAssert("key counter flow not affected", () => keyCounterFlow.IsPresent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createNew(Action<HUDOverlay> action = null)
|
||||||
|
{
|
||||||
|
AddStep("create overlay", () =>
|
||||||
|
{
|
||||||
|
SetContents(() =>
|
||||||
|
{
|
||||||
|
hudOverlay = new HUDOverlay(null, null, null, Array.Empty<Mod>());
|
||||||
|
|
||||||
|
// Add any key just to display the key counter visually.
|
||||||
|
hudOverlay.KeyCounter.Add(new KeyCounterKeyboard(Key.Space));
|
||||||
|
|
||||||
|
hudOverlay.ComboCounter.Current.Value = 1;
|
||||||
|
|
||||||
|
action?.Invoke(hudOverlay);
|
||||||
|
|
||||||
|
return hudOverlay;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||||
|
}
|
||||||
|
}
|
@ -103,7 +103,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () =>
|
private void addPanelStep(ScoreInfo score, PanelState state = PanelState.Expanded) => AddStep("add panel", () =>
|
||||||
{
|
{
|
||||||
Child = panel = new ScorePanel(score)
|
Child = panel = new ScorePanel(score, true)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -27,6 +28,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
OsuSpriteText category;
|
OsuSpriteText category;
|
||||||
OsuSpriteText genre;
|
OsuSpriteText genre;
|
||||||
OsuSpriteText language;
|
OsuSpriteText language;
|
||||||
|
OsuSpriteText extra;
|
||||||
|
OsuSpriteText ranks;
|
||||||
|
OsuSpriteText played;
|
||||||
|
|
||||||
Add(control = new BeatmapListingSearchControl
|
Add(control = new BeatmapListingSearchControl
|
||||||
{
|
{
|
||||||
@ -46,6 +50,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
category = new OsuSpriteText(),
|
category = new OsuSpriteText(),
|
||||||
genre = new OsuSpriteText(),
|
genre = new OsuSpriteText(),
|
||||||
language = new OsuSpriteText(),
|
language = new OsuSpriteText(),
|
||||||
|
extra = new OsuSpriteText(),
|
||||||
|
ranks = new OsuSpriteText(),
|
||||||
|
played = new OsuSpriteText()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -54,6 +61,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
|
control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
|
||||||
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
|
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
|
||||||
control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true);
|
control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true);
|
||||||
|
control.Extra.BindCollectionChanged((u, v) => extra.Text = $"Extra: {(control.Extra.Any() ? string.Join('.', control.Extra.Select(i => i.ToString().ToLowerInvariant())) : "")}", true);
|
||||||
|
control.Ranks.BindCollectionChanged((u, v) => ranks.Text = $"Ranks: {(control.Ranks.Any() ? string.Join('.', control.Ranks.Select(i => i.ToString())) : "")}", true);
|
||||||
|
control.Played.BindValueChanged(p => played.Text = $"Played: {p.NewValue}", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -12,9 +12,6 @@ namespace osu.Game.Configuration
|
|||||||
[Description("Hide during gameplay")]
|
[Description("Hide during gameplay")]
|
||||||
HideDuringGameplay,
|
HideDuringGameplay,
|
||||||
|
|
||||||
[Description("Hide during breaks")]
|
|
||||||
HideDuringBreaks,
|
|
||||||
|
|
||||||
Always
|
Always
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,6 +172,7 @@ namespace osu.Game.Configuration
|
|||||||
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
|
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
|
||||||
{
|
{
|
||||||
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled")),
|
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled")),
|
||||||
|
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, m => new SettingDescription(m, "HUD Visibility", m.GetDescription())),
|
||||||
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())),
|
new TrackedSetting<ScalingMode>(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
new KeyBinding(new[] { InputKey.Control, InputKey.Plus }, GlobalAction.IncreaseScrollSpeed),
|
||||||
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
||||||
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
|
||||||
|
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
|
||||||
};
|
};
|
||||||
|
|
||||||
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
||||||
@ -187,5 +188,8 @@ namespace osu.Game.Input.Bindings
|
|||||||
|
|
||||||
[Description("Timing Mode")]
|
[Description("Timing Mode")]
|
||||||
EditorTimingMode,
|
EditorTimingMode,
|
||||||
|
|
||||||
|
[Description("Hold for HUD")]
|
||||||
|
HoldForHUD,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +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 System.Linq;
|
||||||
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.BeatmapListing;
|
using osu.Game.Overlays.BeatmapListing;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Online.API.Requests
|
namespace osu.Game.Online.API.Requests
|
||||||
{
|
{
|
||||||
@ -21,6 +25,14 @@ namespace osu.Game.Online.API.Requests
|
|||||||
|
|
||||||
public SearchLanguage Language { get; }
|
public SearchLanguage Language { get; }
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
|
public IReadOnlyCollection<SearchExtra> Extra { get; }
|
||||||
|
|
||||||
|
public SearchPlayed Played { get; }
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
|
public IReadOnlyCollection<ScoreRank> Ranks { get; }
|
||||||
|
|
||||||
private readonly string query;
|
private readonly string query;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
private readonly Cursor cursor;
|
private readonly Cursor cursor;
|
||||||
@ -35,7 +47,10 @@ namespace osu.Game.Online.API.Requests
|
|||||||
SortCriteria sortCriteria = SortCriteria.Ranked,
|
SortCriteria sortCriteria = SortCriteria.Ranked,
|
||||||
SortDirection sortDirection = SortDirection.Descending,
|
SortDirection sortDirection = SortDirection.Descending,
|
||||||
SearchGenre genre = SearchGenre.Any,
|
SearchGenre genre = SearchGenre.Any,
|
||||||
SearchLanguage language = SearchLanguage.Any)
|
SearchLanguage language = SearchLanguage.Any,
|
||||||
|
IReadOnlyCollection<SearchExtra> extra = null,
|
||||||
|
IReadOnlyCollection<ScoreRank> ranks = null,
|
||||||
|
SearchPlayed played = SearchPlayed.Any)
|
||||||
{
|
{
|
||||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset;
|
||||||
@ -46,6 +61,9 @@ namespace osu.Game.Online.API.Requests
|
|||||||
SortDirection = sortDirection;
|
SortDirection = sortDirection;
|
||||||
Genre = genre;
|
Genre = genre;
|
||||||
Language = language;
|
Language = language;
|
||||||
|
Extra = extra;
|
||||||
|
Ranks = ranks;
|
||||||
|
Played = played;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override WebRequest CreateWebRequest()
|
protected override WebRequest CreateWebRequest()
|
||||||
@ -66,6 +84,15 @@ namespace osu.Game.Online.API.Requests
|
|||||||
|
|
||||||
req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");
|
req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");
|
||||||
|
|
||||||
|
if (Extra != null && Extra.Any())
|
||||||
|
req.AddParameter("e", string.Join('.', Extra.Select(e => e.ToString().ToLowerInvariant())));
|
||||||
|
|
||||||
|
if (Ranks != null && Ranks.Any())
|
||||||
|
req.AddParameter("r", string.Join('.', Ranks.Select(r => r.ToString())));
|
||||||
|
|
||||||
|
if (Played != SearchPlayed.Any)
|
||||||
|
req.AddParameter("played", Played.ToString().ToLowerInvariant());
|
||||||
|
|
||||||
req.AddCursor(cursor);
|
req.AddCursor(cursor);
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
|
@ -130,6 +130,9 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
searchControl.Category.BindValueChanged(_ => queueUpdateSearch());
|
searchControl.Category.BindValueChanged(_ => queueUpdateSearch());
|
||||||
searchControl.Genre.BindValueChanged(_ => queueUpdateSearch());
|
searchControl.Genre.BindValueChanged(_ => queueUpdateSearch());
|
||||||
searchControl.Language.BindValueChanged(_ => queueUpdateSearch());
|
searchControl.Language.BindValueChanged(_ => queueUpdateSearch());
|
||||||
|
searchControl.Extra.CollectionChanged += (_, __) => queueUpdateSearch();
|
||||||
|
searchControl.Ranks.CollectionChanged += (_, __) => queueUpdateSearch();
|
||||||
|
searchControl.Played.BindValueChanged(_ => queueUpdateSearch());
|
||||||
|
|
||||||
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
|
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
|
||||||
sortDirection.BindValueChanged(_ => queueUpdateSearch());
|
sortDirection.BindValueChanged(_ => queueUpdateSearch());
|
||||||
@ -179,7 +182,10 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
sortControl.Current.Value,
|
sortControl.Current.Value,
|
||||||
sortControl.SortDirection.Value,
|
sortControl.SortDirection.Value,
|
||||||
searchControl.Genre.Value,
|
searchControl.Genre.Value,
|
||||||
searchControl.Language.Value);
|
searchControl.Language.Value,
|
||||||
|
searchControl.Extra,
|
||||||
|
searchControl.Ranks,
|
||||||
|
searchControl.Played.Value);
|
||||||
|
|
||||||
getSetsRequest.Success += response =>
|
getSetsRequest.Success += response =>
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
{
|
{
|
||||||
@ -28,6 +29,12 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
public Bindable<SearchLanguage> Language => languageFilter.Current;
|
public Bindable<SearchLanguage> Language => languageFilter.Current;
|
||||||
|
|
||||||
|
public BindableList<SearchExtra> Extra => extraFilter.Current;
|
||||||
|
|
||||||
|
public BindableList<ScoreRank> Ranks => ranksFilter.Current;
|
||||||
|
|
||||||
|
public Bindable<SearchPlayed> Played => playedFilter.Current;
|
||||||
|
|
||||||
public BeatmapSetInfo BeatmapSet
|
public BeatmapSetInfo BeatmapSet
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -48,6 +55,9 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter;
|
private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter;
|
||||||
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
|
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
|
||||||
private readonly BeatmapSearchFilterRow<SearchLanguage> languageFilter;
|
private readonly BeatmapSearchFilterRow<SearchLanguage> languageFilter;
|
||||||
|
private readonly BeatmapSearchMultipleSelectionFilterRow<SearchExtra> extraFilter;
|
||||||
|
private readonly BeatmapSearchScoreFilterRow ranksFilter;
|
||||||
|
private readonly BeatmapSearchFilterRow<SearchPlayed> playedFilter;
|
||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly UpdateableBeatmapSetCover beatmapCover;
|
private readonly UpdateableBeatmapSetCover beatmapCover;
|
||||||
@ -105,6 +115,9 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
|
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
|
||||||
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
|
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
|
||||||
languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"),
|
languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"),
|
||||||
|
extraFilter = new BeatmapSearchMultipleSelectionFilterRow<SearchExtra>(@"Extra"),
|
||||||
|
ranksFilter = new BeatmapSearchScoreFilterRow(),
|
||||||
|
playedFilter = new BeatmapSearchFilterRow<SearchPlayed>(@"Played")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
// 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 JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Input.Events;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
using Humanizer;
|
using Humanizer;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
|
|
||||||
@ -32,6 +28,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
public BeatmapSearchFilterRow(string headerName)
|
public BeatmapSearchFilterRow(string headerName)
|
||||||
{
|
{
|
||||||
|
Drawable filter;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AddInternal(new GridContainer
|
AddInternal(new GridContainer
|
||||||
@ -49,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
},
|
},
|
||||||
Content = new[]
|
Content = new[]
|
||||||
{
|
{
|
||||||
new Drawable[]
|
new[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
@ -58,17 +55,17 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
Font = OsuFont.GetFont(size: 13),
|
Font = OsuFont.GetFont(size: 13),
|
||||||
Text = headerName.Titleize()
|
Text = headerName.Titleize()
|
||||||
},
|
},
|
||||||
CreateFilter().With(f =>
|
filter = CreateFilter()
|
||||||
{
|
|
||||||
f.Current = current;
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (filter is IHasCurrentValue<T> filterWithValue)
|
||||||
|
Current = filterWithValue.Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
[NotNull]
|
[NotNull]
|
||||||
protected virtual BeatmapSearchFilter CreateFilter() => new BeatmapSearchFilter();
|
protected virtual Drawable CreateFilter() => new BeatmapSearchFilter();
|
||||||
|
|
||||||
protected class BeatmapSearchFilter : TabControl<T>
|
protected class BeatmapSearchFilter : TabControl<T>
|
||||||
{
|
{
|
||||||
@ -97,63 +94,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
protected override Dropdown<T> CreateDropdown() => new FilterDropdown();
|
protected override Dropdown<T> CreateDropdown() => new FilterDropdown();
|
||||||
|
|
||||||
protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem(value);
|
protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem<T>(value);
|
||||||
|
|
||||||
protected class FilterTabItem : TabItem<T>
|
|
||||||
{
|
|
||||||
protected virtual float TextSize => 13;
|
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private OverlayColourProvider colourProvider { get; set; }
|
|
||||||
|
|
||||||
private readonly OsuSpriteText text;
|
|
||||||
|
|
||||||
public FilterTabItem(T value)
|
|
||||||
: base(value)
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both;
|
|
||||||
Anchor = Anchor.BottomLeft;
|
|
||||||
Origin = Anchor.BottomLeft;
|
|
||||||
AddRangeInternal(new Drawable[]
|
|
||||||
{
|
|
||||||
text = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Regular),
|
|
||||||
Text = (value as Enum)?.GetDescription() ?? value.ToString()
|
|
||||||
},
|
|
||||||
new HoverClickSounds()
|
|
||||||
});
|
|
||||||
|
|
||||||
Enabled.Value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
updateState();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
|
||||||
{
|
|
||||||
base.OnHover(e);
|
|
||||||
updateState();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
|
||||||
{
|
|
||||||
base.OnHoverLost(e);
|
|
||||||
updateState();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnActivated() => updateState();
|
|
||||||
|
|
||||||
protected override void OnDeactivated() => updateState();
|
|
||||||
|
|
||||||
private void updateState() => text.FadeColour(Active.Value ? Color4.White : getStateColour(), 200, Easing.OutQuint);
|
|
||||||
|
|
||||||
private Color4 getStateColour() => IsHovered ? colourProvider.Light1 : colourProvider.Light3;
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FilterDropdown : OsuTabDropdown<T>
|
private class FilterDropdown : OsuTabDropdown<T>
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,93 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
|
{
|
||||||
|
public class BeatmapSearchMultipleSelectionFilterRow<T> : BeatmapSearchFilterRow<List<T>>
|
||||||
|
{
|
||||||
|
public new readonly BindableList<T> Current = new BindableList<T>();
|
||||||
|
|
||||||
|
private MultipleSelectionFilter filter;
|
||||||
|
|
||||||
|
public BeatmapSearchMultipleSelectionFilterRow(string headerName)
|
||||||
|
: base(headerName)
|
||||||
|
{
|
||||||
|
Current.BindTo(filter.Current);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected sealed override Drawable CreateFilter() => filter = CreateMultipleSelectionFilter();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a filter control that can be used to simultaneously select multiple values of type <typeparamref name="T"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual MultipleSelectionFilter CreateMultipleSelectionFilter() => new MultipleSelectionFilter();
|
||||||
|
|
||||||
|
protected class MultipleSelectionFilter : FillFlowContainer<MultipleSelectionFilterTabItem>
|
||||||
|
{
|
||||||
|
public readonly BindableList<T> Current = new BindableList<T>();
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft;
|
||||||
|
Origin = Anchor.BottomLeft;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = 15;
|
||||||
|
Spacing = new Vector2(10, 0);
|
||||||
|
|
||||||
|
AddRange(GetValues().Select(CreateTabItem));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
foreach (var item in Children)
|
||||||
|
item.Active.BindValueChanged(active => toggleItem(item.Value, active.NewValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns all values to be displayed in this filter row.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual IEnumerable<T> GetValues() => Enum.GetValues(typeof(T)).Cast<T>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a <see cref="MultipleSelectionFilterTabItem"/> representing the supplied <paramref name="value"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual MultipleSelectionFilterTabItem CreateTabItem(T value) => new MultipleSelectionFilterTabItem(value);
|
||||||
|
|
||||||
|
private void toggleItem(T value, bool active)
|
||||||
|
{
|
||||||
|
if (active)
|
||||||
|
Current.Add(value);
|
||||||
|
else
|
||||||
|
Current.Remove(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected class MultipleSelectionFilterTabItem : FilterTabItem<T>
|
||||||
|
{
|
||||||
|
public MultipleSelectionFilterTabItem(T value)
|
||||||
|
: base(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnClick(ClickEvent e)
|
||||||
|
{
|
||||||
|
base.OnClick(e);
|
||||||
|
Active.Toggle();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.BeatmapListing
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
@ -13,7 +14,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override BeatmapSearchFilter CreateFilter() => new RulesetFilter();
|
protected override Drawable CreateFilter() => new RulesetFilter();
|
||||||
|
|
||||||
private class RulesetFilter : BeatmapSearchFilter
|
private class RulesetFilter : BeatmapSearchFilter
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,50 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Game.Scoring;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
|
{
|
||||||
|
public class BeatmapSearchScoreFilterRow : BeatmapSearchMultipleSelectionFilterRow<ScoreRank>
|
||||||
|
{
|
||||||
|
public BeatmapSearchScoreFilterRow()
|
||||||
|
: base(@"Rank Achieved")
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override MultipleSelectionFilter CreateMultipleSelectionFilter() => new RankFilter();
|
||||||
|
|
||||||
|
private class RankFilter : MultipleSelectionFilter
|
||||||
|
{
|
||||||
|
protected override MultipleSelectionFilterTabItem CreateTabItem(ScoreRank value) => new RankItem(value);
|
||||||
|
|
||||||
|
protected override IEnumerable<ScoreRank> GetValues() => base.GetValues().Reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
private class RankItem : MultipleSelectionFilterTabItem
|
||||||
|
{
|
||||||
|
public RankItem(ScoreRank value)
|
||||||
|
: base(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string LabelFor(ScoreRank value)
|
||||||
|
{
|
||||||
|
switch (value)
|
||||||
|
{
|
||||||
|
case ScoreRank.XH:
|
||||||
|
return @"Silver SS";
|
||||||
|
|
||||||
|
case ScoreRank.SH:
|
||||||
|
return @"Silver S";
|
||||||
|
|
||||||
|
default:
|
||||||
|
return value.GetDescription();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
79
osu.Game/Overlays/BeatmapListing/FilterTabItem.cs
Normal file
79
osu.Game/Overlays/BeatmapListing/FilterTabItem.cs
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
|
{
|
||||||
|
public class FilterTabItem<T> : TabItem<T>
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
private OverlayColourProvider colourProvider { get; set; }
|
||||||
|
|
||||||
|
private OsuSpriteText text;
|
||||||
|
|
||||||
|
public FilterTabItem(T value)
|
||||||
|
: base(value)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Anchor = Anchor.BottomLeft;
|
||||||
|
Origin = Anchor.BottomLeft;
|
||||||
|
AddRangeInternal(new Drawable[]
|
||||||
|
{
|
||||||
|
text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular),
|
||||||
|
Text = LabelFor(Value)
|
||||||
|
},
|
||||||
|
new HoverClickSounds()
|
||||||
|
});
|
||||||
|
|
||||||
|
Enabled.Value = true;
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(HoverEvent e)
|
||||||
|
{
|
||||||
|
base.OnHover(e);
|
||||||
|
updateState();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
|
{
|
||||||
|
base.OnHoverLost(e);
|
||||||
|
updateState();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnActivated() => updateState();
|
||||||
|
|
||||||
|
protected override void OnDeactivated() => updateState();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the label text to be used for the supplied <paramref name="value"/>.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual string LabelFor(T value) => (value as Enum)?.GetDescription() ?? value.ToString();
|
||||||
|
|
||||||
|
private void updateState()
|
||||||
|
{
|
||||||
|
text.FadeColour(IsHovered ? colourProvider.Light1 : getStateColour(), 200, Easing.OutQuint);
|
||||||
|
text.Font = text.Font.With(weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 getStateColour() => Active.Value ? colourProvider.Content1 : colourProvider.Light2;
|
||||||
|
}
|
||||||
|
}
|
16
osu.Game/Overlays/BeatmapListing/SearchExtra.cs
Normal file
16
osu.Game/Overlays/BeatmapListing/SearchExtra.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
// 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.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
|
{
|
||||||
|
public enum SearchExtra
|
||||||
|
{
|
||||||
|
[Description("Has Video")]
|
||||||
|
Video,
|
||||||
|
|
||||||
|
[Description("Has Storyboard")]
|
||||||
|
Storyboard
|
||||||
|
}
|
||||||
|
}
|
12
osu.Game/Overlays/BeatmapListing/SearchPlayed.cs
Normal file
12
osu.Game/Overlays/BeatmapListing/SearchPlayed.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
// 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.BeatmapListing
|
||||||
|
{
|
||||||
|
public enum SearchPlayed
|
||||||
|
{
|
||||||
|
Any,
|
||||||
|
Played,
|
||||||
|
Unplayed
|
||||||
|
}
|
||||||
|
}
|
@ -120,6 +120,11 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Deselect() => State = SelectionState.NotSelected;
|
public void Deselect() => State = SelectionState.NotSelected;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Toggles the selection state of this <see cref="OverlaySelectionBlueprint"/>.
|
||||||
|
/// </summary>
|
||||||
|
public void ToggleSelection() => State = IsSelected ? SelectionState.NotSelected : SelectionState.Selected;
|
||||||
|
|
||||||
public bool IsSelected => State == SelectionState.Selected;
|
public bool IsSelected => State == SelectionState.Selected;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (!currentFrameIndex.HasValue)
|
if (!currentFrameIndex.HasValue)
|
||||||
return (TFrame)Frames[0];
|
return currentDirection > 0 ? (TFrame)Frames[0] : null;
|
||||||
|
|
||||||
int nextFrame = clampedNextFrameIndex;
|
int nextFrame = clampedNextFrameIndex;
|
||||||
|
|
||||||
@ -109,30 +109,54 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
|
|
||||||
Debug.Assert(currentDirection != 0);
|
Debug.Assert(currentDirection != 0);
|
||||||
|
|
||||||
TFrame next = NextFrame;
|
if (!HasFrames)
|
||||||
|
|
||||||
// check if the next frame is valid for the current playback direction.
|
|
||||||
// validity is if the next frame is equal or "earlier" than the current point in time (so we can change to it)
|
|
||||||
int compare = time.CompareTo(next?.Time);
|
|
||||||
|
|
||||||
if (next != null && (compare == 0 || compare == currentDirection))
|
|
||||||
{
|
{
|
||||||
currentFrameIndex = clampedNextFrameIndex;
|
// in the case all frames are received, allow time to progress regardless.
|
||||||
return CurrentTime = CurrentFrame.Time;
|
if (replay.HasReceivedAllFrames)
|
||||||
|
return CurrentTime = time;
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// at this point, the frame can't be advanced (in the replay).
|
TFrame next = NextFrame;
|
||||||
// even so, we may be able to move the clock forward due to being at the end of the replay or
|
|
||||||
// moving towards the next valid frame.
|
// if we have a next frame, check if it is before or at the current time in playback, and advance time to it if so.
|
||||||
|
if (next != null)
|
||||||
|
{
|
||||||
|
int compare = time.CompareTo(next.Time);
|
||||||
|
|
||||||
|
if (compare == 0 || compare == currentDirection)
|
||||||
|
{
|
||||||
|
currentFrameIndex = clampedNextFrameIndex;
|
||||||
|
return CurrentTime = CurrentFrame.Time;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// at this point, the frame index can't be advanced.
|
||||||
|
// even so, we may be able to propose the clock progresses forward due to being at an extent of the replay,
|
||||||
|
// or moving towards the next valid frame (ie. interpolating in a non-important section).
|
||||||
|
|
||||||
// the exception is if currently in an important section, which is respected above all.
|
// the exception is if currently in an important section, which is respected above all.
|
||||||
if (inImportantSection)
|
if (inImportantSection)
|
||||||
|
{
|
||||||
|
Debug.Assert(next != null || !replay.HasReceivedAllFrames);
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// in the case we have no next frames and haven't received the full replay, block.
|
// if a next frame does exist, allow interpolation.
|
||||||
if (next == null && !replay.HasReceivedAllFrames) return null;
|
if (next != null)
|
||||||
|
return CurrentTime = time;
|
||||||
|
|
||||||
return CurrentTime = time;
|
// if all frames have been received, allow playing beyond extents.
|
||||||
|
if (replay.HasReceivedAllFrames)
|
||||||
|
return CurrentTime = time;
|
||||||
|
|
||||||
|
// if not all frames are received but we are before the first frame, allow playing.
|
||||||
|
if (time < Frames[0].Time)
|
||||||
|
return CurrentTime = time;
|
||||||
|
|
||||||
|
// in the case we have no next frames and haven't received enough frame data, block.
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDirection(double time)
|
private void updateDirection(double time)
|
||||||
|
@ -85,50 +85,46 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public override bool UpdateSubTree()
|
public override bool UpdateSubTree()
|
||||||
{
|
{
|
||||||
double proposedTime = manualClock.CurrentTime;
|
|
||||||
|
|
||||||
if (frameStableClock.WaitingOnFrames.Value)
|
|
||||||
{
|
|
||||||
// when waiting on frames, the update loop still needs to be run (at least once) to check for newly arrived frames.
|
|
||||||
// time should not be sourced from the parent clock in this case.
|
|
||||||
state = PlaybackState.Valid;
|
|
||||||
}
|
|
||||||
else if (!frameStableClock.IsPaused.Value)
|
|
||||||
{
|
|
||||||
state = PlaybackState.Valid;
|
|
||||||
|
|
||||||
if (parentGameplayClock == null)
|
|
||||||
setClock(); // LoadComplete may not be run yet, but we still want the clock.
|
|
||||||
|
|
||||||
proposedTime = parentGameplayClock.CurrentTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// time should not advance while paused, not should anything run.
|
|
||||||
state = PlaybackState.NotValid;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int loops = MaxCatchUpFrames;
|
int loops = MaxCatchUpFrames;
|
||||||
|
|
||||||
while (loops-- > 0)
|
do
|
||||||
{
|
{
|
||||||
updateClock(ref proposedTime);
|
// update clock is always trying to approach the aim time.
|
||||||
|
// it should be provided as the original value each loop.
|
||||||
|
updateClock();
|
||||||
|
|
||||||
if (state == PlaybackState.NotValid)
|
if (state == PlaybackState.NotValid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
base.UpdateSubTree();
|
base.UpdateSubTree();
|
||||||
UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat);
|
UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat);
|
||||||
}
|
} while (state == PlaybackState.RequiresCatchUp && loops-- > 0);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateClock(ref double proposedTime)
|
private void updateClock()
|
||||||
{
|
{
|
||||||
// each update start with considering things in valid state.
|
if (frameStableClock.WaitingOnFrames.Value)
|
||||||
state = PlaybackState.Valid;
|
{
|
||||||
|
// if waiting on frames, run one update loop to determine if frames have arrived.
|
||||||
|
state = PlaybackState.Valid;
|
||||||
|
}
|
||||||
|
else if (frameStableClock.IsPaused.Value)
|
||||||
|
{
|
||||||
|
// time should not advance while paused, nor should anything run.
|
||||||
|
state = PlaybackState.NotValid;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state = PlaybackState.Valid;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parentGameplayClock == null)
|
||||||
|
setClock(); // LoadComplete may not be run yet, but we still want the clock.
|
||||||
|
|
||||||
|
double proposedTime = parentGameplayClock.CurrentTime;
|
||||||
|
|
||||||
if (FrameStablePlayback)
|
if (FrameStablePlayback)
|
||||||
// if we require frame stability, the proposed time will be adjusted to move at most one known
|
// if we require frame stability, the proposed time will be adjusted to move at most one known
|
||||||
@ -143,22 +139,22 @@ namespace osu.Game.Rulesets.UI
|
|||||||
state = PlaybackState.NotValid;
|
state = PlaybackState.NotValid;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (proposedTime != manualClock.CurrentTime)
|
if (state == PlaybackState.Valid)
|
||||||
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
|
direction = proposedTime >= manualClock.CurrentTime ? 1 : -1;
|
||||||
|
|
||||||
|
double timeBehind = Math.Abs(proposedTime - parentGameplayClock.CurrentTime);
|
||||||
|
|
||||||
|
frameStableClock.IsCatchingUp.Value = timeBehind > 200;
|
||||||
|
frameStableClock.WaitingOnFrames.Value = state == PlaybackState.NotValid;
|
||||||
|
|
||||||
manualClock.CurrentTime = proposedTime;
|
manualClock.CurrentTime = proposedTime;
|
||||||
manualClock.Rate = Math.Abs(parentGameplayClock.Rate) * direction;
|
manualClock.Rate = Math.Abs(parentGameplayClock.Rate) * direction;
|
||||||
manualClock.IsRunning = parentGameplayClock.IsRunning;
|
manualClock.IsRunning = parentGameplayClock.IsRunning;
|
||||||
|
|
||||||
double timeBehind = Math.Abs(manualClock.CurrentTime - parentGameplayClock.CurrentTime);
|
|
||||||
|
|
||||||
// determine whether catch-up is required.
|
// determine whether catch-up is required.
|
||||||
if (state == PlaybackState.Valid && timeBehind > 0)
|
if (state == PlaybackState.Valid && timeBehind > 0)
|
||||||
state = PlaybackState.RequiresCatchUp;
|
state = PlaybackState.RequiresCatchUp;
|
||||||
|
|
||||||
frameStableClock.IsCatchingUp.Value = timeBehind > 200;
|
|
||||||
frameStableClock.WaitingOnFrames.Value = state == PlaybackState.NotValid;
|
|
||||||
|
|
||||||
// The manual clock time has changed in the above code. The framed clock now needs to be updated
|
// The manual clock time has changed in the above code. The framed clock now needs to be updated
|
||||||
// to ensure that the its time is valid for our children before input is processed
|
// to ensure that the its time is valid for our children before input is processed
|
||||||
framedClock.ProcessFrame();
|
framedClock.ProcessFrame();
|
||||||
@ -253,14 +249,13 @@ namespace osu.Game.Rulesets.UI
|
|||||||
NotValid,
|
NotValid,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether we are running up-to-date with our parent clock.
|
/// Playback is running behind real-time. Catch-up will be attempted by processing more than once per
|
||||||
/// If not, we will need to keep processing children until we catch up.
|
/// game loop (limited to a sane maximum to avoid frame drops).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
RequiresCatchUp,
|
RequiresCatchUp,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether we are in a valid state (ie. should we keep processing children frames).
|
/// In a valid state, progressing one child hierarchy loop per game loop.
|
||||||
/// This should be set to false when the replay is, for instance, waiting for future frames to arrive.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Valid
|
Valid
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Performance;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Rulesets.UI
|
||||||
|
@ -298,13 +298,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
{
|
{
|
||||||
Debug.Assert(!clickSelectionBegan);
|
Debug.Assert(!clickSelectionBegan);
|
||||||
|
|
||||||
// Deselections are only allowed for control + left clicks
|
|
||||||
bool allowDeselection = e.ControlPressed && e.Button == MouseButton.Left;
|
|
||||||
|
|
||||||
// Todo: This is probably incorrectly disallowing multiple selections on stacked objects
|
|
||||||
if (!allowDeselection && SelectionHandler.SelectedBlueprints.Any(s => s.IsHovered))
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
|
foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
|
||||||
{
|
{
|
||||||
if (blueprint.IsHovered)
|
if (blueprint.IsHovered)
|
||||||
|
@ -24,6 +24,7 @@ using osu.Game.Rulesets.Objects;
|
|||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osuTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose.Components
|
namespace osu.Game.Screens.Edit.Compose.Components
|
||||||
{
|
{
|
||||||
@ -224,21 +225,21 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// <param name="state">The input state at the point of selection.</param>
|
/// <param name="state">The input state at the point of selection.</param>
|
||||||
internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
|
internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
|
||||||
{
|
{
|
||||||
if (state.Keyboard.ControlPressed)
|
if (state.Keyboard.ShiftPressed && state.Mouse.IsPressed(MouseButton.Right))
|
||||||
{
|
EditorBeatmap.Remove(blueprint.HitObject);
|
||||||
if (blueprint.IsSelected)
|
else if (state.Keyboard.ControlPressed && state.Mouse.IsPressed(MouseButton.Left))
|
||||||
blueprint.Deselect();
|
blueprint.ToggleSelection();
|
||||||
else
|
|
||||||
blueprint.Select();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
ensureSelected(blueprint);
|
||||||
if (blueprint.IsSelected)
|
}
|
||||||
return;
|
|
||||||
|
|
||||||
DeselectAll?.Invoke();
|
private void ensureSelected(SelectionBlueprint blueprint)
|
||||||
blueprint.Select();
|
{
|
||||||
}
|
if (blueprint.IsSelected)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DeselectAll?.Invoke();
|
||||||
|
blueprint.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void deleteSelected()
|
private void deleteSelected()
|
||||||
|
@ -450,12 +450,21 @@ namespace osu.Game.Screens.Edit
|
|||||||
if (dialogOverlay == null || dialogOverlay.CurrentDialog is PromptForSaveDialog)
|
if (dialogOverlay == null || dialogOverlay.CurrentDialog is PromptForSaveDialog)
|
||||||
{
|
{
|
||||||
confirmExit();
|
confirmExit();
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNewBeatmap || HasUnsavedChanges)
|
if (isNewBeatmap || HasUnsavedChanges)
|
||||||
{
|
{
|
||||||
dialogOverlay?.Push(new PromptForSaveDialog(confirmExit, confirmExitWithSave));
|
dialogOverlay?.Push(new PromptForSaveDialog(() =>
|
||||||
|
{
|
||||||
|
confirmExit();
|
||||||
|
this.Exit();
|
||||||
|
}, () =>
|
||||||
|
{
|
||||||
|
confirmExitWithSave();
|
||||||
|
this.Exit();
|
||||||
|
}));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -470,7 +479,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
exitConfirmed = true;
|
exitConfirmed = true;
|
||||||
Save();
|
Save();
|
||||||
this.Exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void confirmExit()
|
private void confirmExit()
|
||||||
@ -489,7 +497,6 @@ namespace osu.Game.Screens.Edit
|
|||||||
}
|
}
|
||||||
|
|
||||||
exitConfirmed = true;
|
exitConfirmed = true;
|
||||||
this.Exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly Bindable<string> clipboard = new Bindable<string>();
|
private readonly Bindable<string> clipboard = new Bindable<string>();
|
||||||
|
@ -8,8 +8,10 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -22,7 +24,7 @@ using osuTK.Input;
|
|||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
public class HUDOverlay : Container
|
public class HUDOverlay : Container, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
public const float FADE_DURATION = 400;
|
public const float FADE_DURATION = 400;
|
||||||
|
|
||||||
@ -67,6 +69,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
internal readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
internal readonly IBindable<bool> IsBreakTime = new Bindable<bool>();
|
||||||
|
|
||||||
|
private bool holdingForHUD;
|
||||||
|
|
||||||
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
|
private IEnumerable<Drawable> hideTargets => new Drawable[] { visibilityContainer, KeyCounter };
|
||||||
|
|
||||||
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
public HUDOverlay(ScoreProcessor scoreProcessor, HealthProcessor healthProcessor, DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
|
||||||
@ -217,17 +221,18 @@ namespace osu.Game.Screens.Play
|
|||||||
if (ShowHud.Disabled)
|
if (ShowHud.Disabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (holdingForHUD)
|
||||||
|
{
|
||||||
|
ShowHud.Value = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch (configVisibilityMode.Value)
|
switch (configVisibilityMode.Value)
|
||||||
{
|
{
|
||||||
case HUDVisibilityMode.Never:
|
case HUDVisibilityMode.Never:
|
||||||
ShowHud.Value = false;
|
ShowHud.Value = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HUDVisibilityMode.HideDuringBreaks:
|
|
||||||
// always show during replay as we want the seek bar to be visible.
|
|
||||||
ShowHud.Value = replayLoaded.Value || !IsBreakTime.Value;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case HUDVisibilityMode.HideDuringGameplay:
|
case HUDVisibilityMode.HideDuringGameplay:
|
||||||
// always show during replay as we want the seek bar to be visible.
|
// always show during replay as we want the seek bar to be visible.
|
||||||
ShowHud.Value = replayLoaded.Value || IsBreakTime.Value;
|
ShowHud.Value = replayLoaded.Value || IsBreakTime.Value;
|
||||||
@ -277,9 +282,21 @@ namespace osu.Game.Screens.Play
|
|||||||
switch (e.Key)
|
switch (e.Key)
|
||||||
{
|
{
|
||||||
case Key.Tab:
|
case Key.Tab:
|
||||||
configVisibilityMode.Value = configVisibilityMode.Value != HUDVisibilityMode.Never
|
switch (configVisibilityMode.Value)
|
||||||
? HUDVisibilityMode.Never
|
{
|
||||||
: HUDVisibilityMode.HideDuringGameplay;
|
case HUDVisibilityMode.Never:
|
||||||
|
configVisibilityMode.Value = HUDVisibilityMode.HideDuringGameplay;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HUDVisibilityMode.HideDuringGameplay:
|
||||||
|
configVisibilityMode.Value = HUDVisibilityMode.Always;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case HUDVisibilityMode.Always:
|
||||||
|
configVisibilityMode.Value = HUDVisibilityMode.Never;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -351,5 +368,29 @@ namespace osu.Game.Screens.Play
|
|||||||
HealthDisplay?.BindHealthProcessor(processor);
|
HealthDisplay?.BindHealthProcessor(processor);
|
||||||
FailingLayer?.BindHealthProcessor(processor);
|
FailingLayer?.BindHealthProcessor(processor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(GlobalAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case GlobalAction.HoldForHUD:
|
||||||
|
holdingForHUD = true;
|
||||||
|
updateVisibility();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(GlobalAction action)
|
||||||
|
{
|
||||||
|
switch (action)
|
||||||
|
{
|
||||||
|
case GlobalAction.HoldForHUD:
|
||||||
|
holdingForHUD = false;
|
||||||
|
updateVisibility();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
private const float padding = 10;
|
private const float padding = 10;
|
||||||
|
|
||||||
private readonly ScoreInfo score;
|
private readonly ScoreInfo score;
|
||||||
|
private readonly bool withFlair;
|
||||||
|
|
||||||
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
|
private readonly List<StatisticDisplay> statisticDisplays = new List<StatisticDisplay>();
|
||||||
|
|
||||||
private FillFlowContainer starAndModDisplay;
|
private FillFlowContainer starAndModDisplay;
|
||||||
@ -41,9 +43,11 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
/// Creates a new <see cref="ExpandedPanelMiddleContent"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The score to display.</param>
|
/// <param name="score">The score to display.</param>
|
||||||
public ExpandedPanelMiddleContent(ScoreInfo score)
|
/// <param name="withFlair">Whether to add flair for a new score being set.</param>
|
||||||
|
public ExpandedPanelMiddleContent(ScoreInfo score, bool withFlair = false)
|
||||||
{
|
{
|
||||||
this.score = score;
|
this.score = score;
|
||||||
|
this.withFlair = withFlair;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
@ -266,6 +270,9 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
delay += 200;
|
delay += 200;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!withFlair)
|
||||||
|
FinishTransforms(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -149,7 +149,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (Score != null)
|
if (Score != null)
|
||||||
ScorePanelList.AddScore(Score);
|
ScorePanelList.AddScore(Score, true);
|
||||||
|
|
||||||
if (player != null && allowRetry)
|
if (player != null && allowRetry)
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,8 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
public readonly ScoreInfo Score;
|
public readonly ScoreInfo Score;
|
||||||
|
|
||||||
|
private bool displayWithFlair;
|
||||||
|
|
||||||
private Container content;
|
private Container content;
|
||||||
|
|
||||||
private Container topLayerContainer;
|
private Container topLayerContainer;
|
||||||
@ -97,9 +99,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
private Container middleLayerContentContainer;
|
private Container middleLayerContentContainer;
|
||||||
private Drawable middleLayerContent;
|
private Drawable middleLayerContent;
|
||||||
|
|
||||||
public ScorePanel(ScoreInfo score)
|
public ScorePanel(ScoreInfo score, bool isNewLocalScore = false)
|
||||||
{
|
{
|
||||||
Score = score;
|
Score = score;
|
||||||
|
displayWithFlair = isNewLocalScore;
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -188,7 +191,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
if (LoadState >= LoadState.Ready)
|
if (IsLoaded)
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
StateChanged?.Invoke(value);
|
StateChanged?.Invoke(value);
|
||||||
@ -209,7 +212,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
|
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);
|
||||||
|
|
||||||
topLayerContentContainer.Add(topLayerContent = new ExpandedPanelTopContent(Score.User).With(d => d.Alpha = 0));
|
topLayerContentContainer.Add(topLayerContent = new ExpandedPanelTopContent(Score.User).With(d => d.Alpha = 0));
|
||||||
middleLayerContentContainer.Add(middleLayerContent = new ExpandedPanelMiddleContent(Score).With(d => d.Alpha = 0));
|
middleLayerContentContainer.Add(middleLayerContent = new ExpandedPanelMiddleContent(Score, displayWithFlair).With(d => d.Alpha = 0));
|
||||||
|
|
||||||
|
// only the first expanded display should happen with flair.
|
||||||
|
displayWithFlair = false;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PanelState.Contracted:
|
case PanelState.Contracted:
|
||||||
|
@ -95,9 +95,10 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// Adds a <see cref="ScoreInfo"/> to this list.
|
/// Adds a <see cref="ScoreInfo"/> to this list.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="score">The <see cref="ScoreInfo"/> to add.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to add.</param>
|
||||||
public ScorePanel AddScore(ScoreInfo score)
|
/// <param name="isNewLocalScore">Whether this is a score that has just been achieved locally. Controls whether flair is added to the display or not.</param>
|
||||||
|
public ScorePanel AddScore(ScoreInfo score, bool isNewLocalScore = false)
|
||||||
{
|
{
|
||||||
var panel = new ScorePanel(score)
|
var panel = new ScorePanel(score, isNewLocalScore)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
@ -117,19 +118,24 @@ namespace osu.Game.Screens.Ranking
|
|||||||
d.Origin = Anchor.Centre;
|
d.Origin = Anchor.Centre;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (SelectedScore.Value == score)
|
if (IsLoaded)
|
||||||
selectedScoreChanged(new ValueChangedEvent<ScoreInfo>(SelectedScore.Value, SelectedScore.Value));
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done.
|
if (SelectedScore.Value == score)
|
||||||
// But when a panel is added before the expanded panel, we need to offset the scroll position by the width of the new panel.
|
|
||||||
if (expandedPanel != null && flow.GetPanelIndex(score) < flow.GetPanelIndex(expandedPanel.Score))
|
|
||||||
{
|
{
|
||||||
// A somewhat hacky property is used here because we need to:
|
SelectedScore.TriggerChange();
|
||||||
// 1) Scroll after the scroll container's visible range is updated.
|
}
|
||||||
// 2) Scroll before the scroll container's scroll position is updated.
|
else
|
||||||
// Without this, we would have a 1-frame positioning error which looks very jarring.
|
{
|
||||||
scroll.InstantScrollTarget = (scroll.InstantScrollTarget ?? scroll.Target) + ScorePanel.CONTRACTED_WIDTH + panel_spacing;
|
// We want the scroll position to remain relative to the expanded panel. When a new panel is added after the expanded panel, nothing needs to be done.
|
||||||
|
// But when a panel is added before the expanded panel, we need to offset the scroll position by the width of the new panel.
|
||||||
|
if (expandedPanel != null && flow.GetPanelIndex(score) < flow.GetPanelIndex(expandedPanel.Score))
|
||||||
|
{
|
||||||
|
// A somewhat hacky property is used here because we need to:
|
||||||
|
// 1) Scroll after the scroll container's visible range is updated.
|
||||||
|
// 2) Scroll before the scroll container's scroll position is updated.
|
||||||
|
// Without this, we would have a 1-frame positioning error which looks very jarring.
|
||||||
|
scroll.InstantScrollTarget = (scroll.InstantScrollTarget ?? scroll.Target) + ScorePanel.CONTRACTED_WIDTH + panel_spacing;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -142,11 +148,15 @@ namespace osu.Game.Screens.Ranking
|
|||||||
/// <param name="score">The <see cref="ScoreInfo"/> to present.</param>
|
/// <param name="score">The <see cref="ScoreInfo"/> to present.</param>
|
||||||
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
private void selectedScoreChanged(ValueChangedEvent<ScoreInfo> score)
|
||||||
{
|
{
|
||||||
// Contract the old panel.
|
// avoid contracting panels unnecessarily when TriggerChange is fired manually.
|
||||||
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
if (score.OldValue != score.NewValue)
|
||||||
{
|
{
|
||||||
t.Panel.State = PanelState.Contracted;
|
// Contract the old panel.
|
||||||
t.Margin = new MarginPadding();
|
foreach (var t in flow.Where(t => t.Panel.Score == score.OldValue))
|
||||||
|
{
|
||||||
|
t.Panel.State = PanelState.Contracted;
|
||||||
|
t.Margin = new MarginPadding();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the panel corresponding to the new score.
|
// Find the panel corresponding to the new score.
|
||||||
@ -162,12 +172,16 @@ namespace osu.Game.Screens.Ranking
|
|||||||
expandedTrackingComponent.Margin = new MarginPadding { Horizontal = expanded_panel_spacing };
|
expandedTrackingComponent.Margin = new MarginPadding { Horizontal = expanded_panel_spacing };
|
||||||
expandedPanel.State = PanelState.Expanded;
|
expandedPanel.State = PanelState.Expanded;
|
||||||
|
|
||||||
// Scroll to the new panel. This is done manually since we need:
|
// requires schedule after children to ensure the flow (and thus ScrollContainer's ScrollableExtent) has been updated.
|
||||||
// 1) To scroll after the scroll container's visible range is updated.
|
ScheduleAfterChildren(() =>
|
||||||
// 2) To account for the centre anchor/origins of panels.
|
{
|
||||||
// In the end, it's easier to compute the scroll position manually.
|
// Scroll to the new panel. This is done manually since we need:
|
||||||
float scrollOffset = flow.GetPanelIndex(expandedPanel.Score) * (ScorePanel.CONTRACTED_WIDTH + panel_spacing);
|
// 1) To scroll after the scroll container's visible range is updated.
|
||||||
scroll.ScrollTo(scrollOffset);
|
// 2) To account for the centre anchor/origins of panels.
|
||||||
|
// In the end, it's easier to compute the scroll position manually.
|
||||||
|
float scrollOffset = flow.GetPanelIndex(expandedPanel.Score) * (ScorePanel.CONTRACTED_WIDTH + panel_spacing);
|
||||||
|
scroll.ScrollTo(scrollOffset);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -180,9 +180,8 @@ namespace osu.Game.Tests.Beatmaps
|
|||||||
private readonly BeatmapInfo skinBeatmapInfo;
|
private readonly BeatmapInfo skinBeatmapInfo;
|
||||||
private readonly IResourceStore<byte[]> resourceStore;
|
private readonly IResourceStore<byte[]> resourceStore;
|
||||||
|
|
||||||
public TestWorkingBeatmap(BeatmapInfo skinBeatmapInfo, IResourceStore<byte[]> resourceStore, IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio,
|
public TestWorkingBeatmap(BeatmapInfo skinBeatmapInfo, IResourceStore<byte[]> resourceStore, IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio)
|
||||||
double length = 60000)
|
: base(beatmap, storyboard, referenceClock, audio)
|
||||||
: base(beatmap, storyboard, referenceClock, audio, length)
|
|
||||||
{
|
{
|
||||||
this.skinBeatmapInfo = skinBeatmapInfo;
|
this.skinBeatmapInfo = skinBeatmapInfo;
|
||||||
this.resourceStore = resourceStore;
|
this.resourceStore = resourceStore;
|
||||||
|
@ -23,6 +23,7 @@ using osu.Game.Online.API;
|
|||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Objects;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Screens;
|
using osu.Game.Screens;
|
||||||
using osu.Game.Storyboards;
|
using osu.Game.Storyboards;
|
||||||
@ -222,18 +223,23 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// <param name="storyboard">The storyboard.</param>
|
/// <param name="storyboard">The storyboard.</param>
|
||||||
/// <param name="referenceClock">An optional clock which should be used instead of a stopwatch for virtual time progression.</param>
|
/// <param name="referenceClock">An optional clock which should be used instead of a stopwatch for virtual time progression.</param>
|
||||||
/// <param name="audio">Audio manager. Required if a reference clock isn't provided.</param>
|
/// <param name="audio">Audio manager. Required if a reference clock isn't provided.</param>
|
||||||
/// <param name="length">The length of the returned virtual track.</param>
|
public ClockBackedTestWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio)
|
||||||
public ClockBackedTestWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard, IFrameBasedClock referenceClock, AudioManager audio, double length = 60000)
|
|
||||||
: base(beatmap, storyboard, audio)
|
: base(beatmap, storyboard, audio)
|
||||||
{
|
{
|
||||||
|
double trackLength = 60000;
|
||||||
|
|
||||||
|
if (beatmap.HitObjects.Count > 0)
|
||||||
|
// add buffer after last hitobject to allow for final replay frames etc.
|
||||||
|
trackLength = Math.Max(trackLength, beatmap.HitObjects.Max(h => h.GetEndTime()) + 2000);
|
||||||
|
|
||||||
if (referenceClock != null)
|
if (referenceClock != null)
|
||||||
{
|
{
|
||||||
store = new TrackVirtualStore(referenceClock);
|
store = new TrackVirtualStore(referenceClock);
|
||||||
audio.AddItem(store);
|
audio.AddItem(store);
|
||||||
track = store.GetVirtual(length);
|
track = store.GetVirtual(trackLength);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
track = audio?.Tracks.GetVirtual(length);
|
track = audio?.Tracks.GetVirtual(trackLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
~ClockBackedTestWorkingBeatmap()
|
~ClockBackedTestWorkingBeatmap()
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1019.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.1029.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||||
<PackageReference Include="Sentry" Version="2.1.6" />
|
<PackageReference Include="Sentry" Version="2.1.6" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
<Reference Include="System.Net.Http" />
|
<Reference Include="System.Net.Http" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1019.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1029.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
|
||||||
@ -80,7 +80,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2020.1019.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2020.1029.1" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
<PackageReference Include="SharpCompress" Version="0.26.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user