mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Merge branch 'master' into right-click-circle-delete
This commit is contained in:
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
@ -38,20 +39,25 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
|
|
||||||
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
|
protected void ApplyTraceableState(DrawableHitObject drawable, ArmedState state)
|
||||||
{
|
{
|
||||||
if (!(drawable is DrawableOsuHitObject drawableOsu))
|
if (!(drawable is DrawableOsuHitObject))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var h = drawableOsu.HitObject;
|
|
||||||
|
|
||||||
//todo: expose and hide spinner background somehow
|
//todo: expose and hide spinner background somehow
|
||||||
|
|
||||||
switch (drawable)
|
switch (drawable)
|
||||||
{
|
{
|
||||||
case DrawableHitCircle circle:
|
case DrawableHitCircle circle:
|
||||||
// we only want to see the approach circle
|
// we only want to see the approach circle
|
||||||
using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
applyCirclePieceState(circle, circle.CirclePiece);
|
||||||
circle.CirclePiece.Hide();
|
break;
|
||||||
|
|
||||||
|
case DrawableSliderTail sliderTail:
|
||||||
|
applyCirclePieceState(sliderTail);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DrawableSliderRepeat sliderRepeat:
|
||||||
|
// show only the repeat arrow
|
||||||
|
applyCirclePieceState(sliderRepeat, sliderRepeat.CirclePiece);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case DrawableSlider slider:
|
case DrawableSlider slider:
|
||||||
@ -61,6 +67,13 @@ namespace osu.Game.Rulesets.Osu.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyCirclePieceState(DrawableOsuHitObject hitObject, IDrawable hitCircle = null)
|
||||||
|
{
|
||||||
|
var h = hitObject.HitObject;
|
||||||
|
using (hitObject.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true))
|
||||||
|
(hitCircle ?? hitObject).Hide();
|
||||||
|
}
|
||||||
|
|
||||||
private void applySliderState(DrawableSlider slider)
|
private void applySliderState(DrawableSlider slider)
|
||||||
{
|
{
|
||||||
((PlaySliderBody)slider.Body.Drawable).AccentColour = slider.AccentColour.Value.Opacity(0);
|
((PlaySliderBody)slider.Body.Drawable).AccentColour = slider.AccentColour.Value.Opacity(0);
|
||||||
|
@ -265,6 +265,26 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<EpilepsyWarning>().Any() == warning);
|
AddAssert($"epilepsy warning {(warning ? "present" : "absent")}", () => this.ChildrenOfType<EpilepsyWarning>().Any() == warning);
|
||||||
|
|
||||||
|
if (warning)
|
||||||
|
{
|
||||||
|
AddUntilStep("sound volume decreased", () => Beatmap.Value.Track.AggregateVolume.Value == 0.25);
|
||||||
|
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestEpilepsyWarningEarlyExit()
|
||||||
|
{
|
||||||
|
AddStep("set epilepsy warning", () => epilepsyWarning = true);
|
||||||
|
AddStep("load dummy beatmap", () => ResetPlayer(false));
|
||||||
|
|
||||||
|
AddUntilStep("wait for current", () => loader.IsCurrentScreen());
|
||||||
|
|
||||||
|
AddUntilStep("wait for epilepsy warning", () => loader.ChildrenOfType<EpilepsyWarning>().Single().Alpha > 0);
|
||||||
|
AddStep("exit early", () => loader.Exit());
|
||||||
|
|
||||||
|
AddUntilStep("sound volume restored", () => Beatmap.Value.Track.AggregateVolume.Value == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestPlayerLoaderContainer : Container
|
private class TestPlayerLoaderContainer : Container
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
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;
|
||||||
@ -12,11 +13,13 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Framework.Input.StateChanges;
|
using osu.Framework.Input.StateChanges;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Visual.UserInterface;
|
using osu.Game.Tests.Visual.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -33,6 +36,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private TestReplayRecorder recorder;
|
private TestReplayRecorder recorder;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private GameplayBeatmap gameplayBeatmap = new GameplayBeatmap(new Beatmap());
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public void SetUp() => Schedule(() =>
|
public void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
@ -166,6 +172,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
playbackManager?.ReplayInputHandler.SetFrameFromTime(Time.Current - 100);
|
playbackManager?.ReplayInputHandler.SetFrameFromTime(Time.Current - 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TearDownSteps]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
AddStep("stop recorder", () => recorder.Expire());
|
||||||
|
}
|
||||||
|
|
||||||
public class TestFramedReplayInputHandler : FramedReplayInputHandler<TestReplayFrame>
|
public class TestFramedReplayInputHandler : FramedReplayInputHandler<TestReplayFrame>
|
||||||
{
|
{
|
||||||
public TestFramedReplayInputHandler(Replay replay)
|
public TestFramedReplayInputHandler(Replay replay)
|
||||||
|
@ -2,17 +2,20 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
||||||
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.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Input.StateChanges;
|
using osu.Framework.Input.StateChanges;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osu.Game.Tests.Visual.UserInterface;
|
using osu.Game.Tests.Visual.UserInterface;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -25,6 +28,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private readonly TestRulesetInputManager recordingManager;
|
private readonly TestRulesetInputManager recordingManager;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private GameplayBeatmap gameplayBeatmap = new GameplayBeatmap(new Beatmap());
|
||||||
|
|
||||||
public TestSceneReplayRecording()
|
public TestSceneReplayRecording()
|
||||||
{
|
{
|
||||||
Replay replay = new Replay();
|
Replay replay = new Replay();
|
||||||
|
361
osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs
Normal file
361
osu.Game.Tests/Visual/Gameplay/TestSceneSpectatorPlayback.cs
Normal file
@ -0,0 +1,361 @@
|
|||||||
|
// 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.Collections.Specialized;
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Framework.Input.StateChanges;
|
||||||
|
using osu.Framework.Logging;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Online.Spectator;
|
||||||
|
using osu.Game.Replays;
|
||||||
|
using osu.Game.Replays.Legacy;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
using osu.Game.Tests.Visual.UserInterface;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
public class TestSceneSpectatorPlayback : OsuManualInputManagerTestScene
|
||||||
|
{
|
||||||
|
protected override bool UseOnlineAPI => true;
|
||||||
|
|
||||||
|
private TestRulesetInputManager playbackManager;
|
||||||
|
private TestRulesetInputManager recordingManager;
|
||||||
|
|
||||||
|
private Replay replay;
|
||||||
|
|
||||||
|
private IBindableList<int> users;
|
||||||
|
|
||||||
|
private TestReplayRecorder recorder;
|
||||||
|
|
||||||
|
private readonly ManualClock manualClock = new ManualClock();
|
||||||
|
|
||||||
|
private OsuSpriteText latencyDisplay;
|
||||||
|
|
||||||
|
private TestFramedReplayInputHandler replayHandler;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private SpectatorStreamingClient streamingClient { get; set; }
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private GameplayBeatmap gameplayBeatmap = new GameplayBeatmap(new Beatmap());
|
||||||
|
|
||||||
|
[SetUp]
|
||||||
|
public void SetUp() => Schedule(() =>
|
||||||
|
{
|
||||||
|
replay = new Replay();
|
||||||
|
|
||||||
|
users = streamingClient.PlayingUsers.GetBoundCopy();
|
||||||
|
users.BindCollectionChanged((obj, args) =>
|
||||||
|
{
|
||||||
|
switch (args.Action)
|
||||||
|
{
|
||||||
|
case NotifyCollectionChangedAction.Add:
|
||||||
|
foreach (int user in args.NewItems)
|
||||||
|
{
|
||||||
|
if (user == api.LocalUser.Value.Id)
|
||||||
|
streamingClient.WatchUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
case NotifyCollectionChangedAction.Remove:
|
||||||
|
foreach (int user in args.OldItems)
|
||||||
|
{
|
||||||
|
if (user == api.LocalUser.Value.Id)
|
||||||
|
streamingClient.StopWatchingUser(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, true);
|
||||||
|
|
||||||
|
streamingClient.OnNewFrames += onNewFrames;
|
||||||
|
|
||||||
|
Add(new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
recordingManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
|
||||||
|
{
|
||||||
|
Recorder = recorder = new TestReplayRecorder
|
||||||
|
{
|
||||||
|
ScreenSpaceToGamefield = pos => recordingManager.ToLocalSpace(pos),
|
||||||
|
},
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Brown,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "Sending",
|
||||||
|
Scale = new Vector2(3),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new TestInputConsumer()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
playbackManager = new TestRulesetInputManager(new TestSceneModSettings.TestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
|
||||||
|
{
|
||||||
|
Clock = new FramedClock(manualClock),
|
||||||
|
ReplayInputHandler = replayHandler = new TestFramedReplayInputHandler(replay)
|
||||||
|
{
|
||||||
|
GamefieldToScreenSpace = pos => playbackManager.ToScreenSpace(pos),
|
||||||
|
},
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.DarkBlue,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "Receiving",
|
||||||
|
Scale = new Vector2(3),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new TestInputConsumer()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
Add(latencyDisplay = new OsuSpriteText());
|
||||||
|
});
|
||||||
|
|
||||||
|
private void onNewFrames(int userId, FrameDataBundle frames)
|
||||||
|
{
|
||||||
|
Logger.Log($"Received {frames.Frames.Count()} new frames ({string.Join(',', frames.Frames.Select(f => ((int)f.Time).ToString()))})");
|
||||||
|
|
||||||
|
foreach (var legacyFrame in frames.Frames)
|
||||||
|
{
|
||||||
|
var frame = new TestReplayFrame();
|
||||||
|
frame.FromLegacy(legacyFrame, null, null);
|
||||||
|
replay.Frames.Add(frame);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBasic()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private double latency = SpectatorStreamingClient.TIME_BETWEEN_SENDS;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (latencyDisplay == null) return;
|
||||||
|
|
||||||
|
// propagate initial time value
|
||||||
|
if (manualClock.CurrentTime == 0)
|
||||||
|
{
|
||||||
|
manualClock.CurrentTime = Time.Current;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (replayHandler.NextFrame != null)
|
||||||
|
{
|
||||||
|
var lastFrame = replay.Frames.LastOrDefault();
|
||||||
|
|
||||||
|
// this isn't perfect as we basically can't be aware of the rate-of-send here (the streamer is not sending data when not being moved).
|
||||||
|
// in gameplay playback, the case where NextFrame is null would pause gameplay and handle this correctly; it's strictly a test limitation / best effort implementation.
|
||||||
|
if (lastFrame != null)
|
||||||
|
latency = Math.Max(latency, Time.Current - lastFrame.Time);
|
||||||
|
|
||||||
|
latencyDisplay.Text = $"latency: {latency:N1}";
|
||||||
|
|
||||||
|
double proposedTime = Time.Current - latency + Time.Elapsed;
|
||||||
|
|
||||||
|
// this will either advance by one or zero frames.
|
||||||
|
double? time = replayHandler.SetFrameFromTime(proposedTime);
|
||||||
|
|
||||||
|
if (time == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
manualClock.CurrentTime = time.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[TearDownSteps]
|
||||||
|
public void TearDown()
|
||||||
|
{
|
||||||
|
AddStep("stop recorder", () =>
|
||||||
|
{
|
||||||
|
recorder.Expire();
|
||||||
|
streamingClient.OnNewFrames -= onNewFrames;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestFramedReplayInputHandler : FramedReplayInputHandler<TestReplayFrame>
|
||||||
|
{
|
||||||
|
public TestFramedReplayInputHandler(Replay replay)
|
||||||
|
: base(replay)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void CollectPendingInputs(List<IInput> inputs)
|
||||||
|
{
|
||||||
|
inputs.Add(new MousePositionAbsoluteInput { Position = GamefieldToScreenSpace(CurrentFrame?.Position ?? Vector2.Zero) });
|
||||||
|
inputs.Add(new ReplayState<TestAction> { PressedActions = CurrentFrame?.Actions ?? new List<TestAction>() });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestInputConsumer : CompositeDrawable, IKeyBindingHandler<TestAction>
|
||||||
|
{
|
||||||
|
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent.ReceivePositionalInputAt(screenSpacePos);
|
||||||
|
|
||||||
|
private readonly Box box;
|
||||||
|
|
||||||
|
public TestInputConsumer()
|
||||||
|
{
|
||||||
|
Size = new Vector2(30);
|
||||||
|
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
box = new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Black,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
|
{
|
||||||
|
Position = e.MousePosition;
|
||||||
|
return base.OnMouseMove(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool OnPressed(TestAction action)
|
||||||
|
{
|
||||||
|
box.Colour = Color4.White;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(TestAction action)
|
||||||
|
{
|
||||||
|
box.Colour = Color4.Black;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestRulesetInputManager : RulesetInputManager<TestAction>
|
||||||
|
{
|
||||||
|
public TestRulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
|
: base(ruleset, variant, unique)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override KeyBindingContainer<TestAction> CreateKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
|
=> new TestKeyBindingContainer();
|
||||||
|
|
||||||
|
internal class TestKeyBindingContainer : KeyBindingContainer<TestAction>
|
||||||
|
{
|
||||||
|
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
|
||||||
|
{
|
||||||
|
new KeyBinding(InputKey.MouseLeft, TestAction.Down),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class TestReplayFrame : ReplayFrame, IConvertibleReplayFrame
|
||||||
|
{
|
||||||
|
public Vector2 Position;
|
||||||
|
|
||||||
|
public List<TestAction> Actions = new List<TestAction>();
|
||||||
|
|
||||||
|
public TestReplayFrame(double time, Vector2 position, params TestAction[] actions)
|
||||||
|
: base(time)
|
||||||
|
{
|
||||||
|
Position = position;
|
||||||
|
Actions.AddRange(actions);
|
||||||
|
}
|
||||||
|
|
||||||
|
public TestReplayFrame()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame lastFrame = null)
|
||||||
|
{
|
||||||
|
Position = currentFrame.Position;
|
||||||
|
Time = currentFrame.Time;
|
||||||
|
if (currentFrame.MouseLeft)
|
||||||
|
Actions.Add(TestAction.Down);
|
||||||
|
}
|
||||||
|
|
||||||
|
public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
|
||||||
|
{
|
||||||
|
ReplayButtonState state = ReplayButtonState.None;
|
||||||
|
|
||||||
|
if (Actions.Contains(TestAction.Down))
|
||||||
|
state |= ReplayButtonState.Left1;
|
||||||
|
|
||||||
|
return new LegacyReplayFrame(Time, Position.X, Position.Y, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TestAction
|
||||||
|
{
|
||||||
|
Down,
|
||||||
|
}
|
||||||
|
|
||||||
|
internal class TestReplayRecorder : ReplayRecorder<TestAction>
|
||||||
|
{
|
||||||
|
public TestReplayRecorder()
|
||||||
|
: base(new Replay())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ReplayFrame HandleFrame(Vector2 mousePosition, List<TestAction> actions, ReplayFrame previousFrame)
|
||||||
|
{
|
||||||
|
return new TestReplayFrame(Time.Current, mousePosition, actions.ToArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,19 +4,24 @@
|
|||||||
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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Components
|
namespace osu.Game.Tournament.Components
|
||||||
{
|
{
|
||||||
public class DrawableTeamFlag : Sprite
|
public class DrawableTeamFlag : Container
|
||||||
{
|
{
|
||||||
private readonly TournamentTeam team;
|
private readonly TournamentTeam team;
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
private Bindable<string> flag;
|
private Bindable<string> flag;
|
||||||
|
|
||||||
|
private Sprite flagSprite;
|
||||||
|
|
||||||
public DrawableTeamFlag(TournamentTeam team)
|
public DrawableTeamFlag(TournamentTeam team)
|
||||||
{
|
{
|
||||||
this.team = team;
|
this.team = team;
|
||||||
@ -27,7 +32,18 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
if (team == null) return;
|
if (team == null) return;
|
||||||
|
|
||||||
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => Texture = textures.Get($@"Flags/{team.FlagName}"), true);
|
Size = new Vector2(75, 50);
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 5;
|
||||||
|
Child = flagSprite = new Sprite
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
FillMode = FillMode.Fill
|
||||||
|
};
|
||||||
|
|
||||||
|
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,9 +4,7 @@
|
|||||||
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.Graphics;
|
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
@ -17,7 +15,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
public readonly TournamentTeam Team;
|
public readonly TournamentTeam Team;
|
||||||
|
|
||||||
protected readonly Sprite Flag;
|
protected readonly Container Flag;
|
||||||
protected readonly TournamentSpriteText AcronymText;
|
protected readonly TournamentSpriteText AcronymText;
|
||||||
|
|
||||||
[UsedImplicitly]
|
[UsedImplicitly]
|
||||||
@ -27,12 +25,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
Team = team;
|
Team = team;
|
||||||
|
|
||||||
Flag = new DrawableTeamFlag(team)
|
Flag = new DrawableTeamFlag(team);
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
FillMode = FillMode.Fit
|
|
||||||
};
|
|
||||||
|
|
||||||
AcronymText = new TournamentSpriteText
|
AcronymText = new TournamentSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.Torus.With(weight: FontWeight.Regular),
|
Font = OsuFont.Torus.With(weight: FontWeight.Regular),
|
||||||
|
@ -27,6 +27,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
AcronymText.Origin = Anchor.TopCentre;
|
AcronymText.Origin = Anchor.TopCentre;
|
||||||
AcronymText.Text = team.Acronym.Value.ToUpperInvariant();
|
AcronymText.Text = team.Acronym.Value.ToUpperInvariant();
|
||||||
AcronymText.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 10);
|
AcronymText.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 10);
|
||||||
|
Flag.Scale = new Vector2(0.48f);
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
var anchor = flip ? Anchor.TopLeft : Anchor.TopRight;
|
var anchor = flip ? Anchor.TopLeft : Anchor.TopRight;
|
||||||
|
|
||||||
Flag.RelativeSizeAxes = Axes.None;
|
Flag.RelativeSizeAxes = Axes.None;
|
||||||
Flag.Size = new Vector2(60, 40);
|
Flag.Scale = new Vector2(0.8f);
|
||||||
Flag.Origin = anchor;
|
Flag.Origin = anchor;
|
||||||
Flag.Anchor = anchor;
|
Flag.Anchor = anchor;
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
|||||||
this.losers = losers;
|
this.losers = losers;
|
||||||
Size = new Vector2(150, 40);
|
Size = new Vector2(150, 40);
|
||||||
|
|
||||||
Flag.Scale = new Vector2(0.9f);
|
Flag.Scale = new Vector2(0.54f);
|
||||||
Flag.Anchor = Flag.Origin = Anchor.CentreLeft;
|
Flag.Anchor = Flag.Origin = Anchor.CentreLeft;
|
||||||
|
|
||||||
AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
|
AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
|
||||||
|
@ -288,8 +288,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
|||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Flag.RelativeSizeAxes = Axes.None;
|
Flag.RelativeSizeAxes = Axes.None;
|
||||||
Flag.Size = new Vector2(300, 200);
|
Flag.Scale = new Vector2(1.2f);
|
||||||
Flag.Scale = new Vector2(0.3f);
|
|
||||||
|
|
||||||
InternalChild = new FillFlowContainer
|
InternalChild = new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
@ -90,11 +90,10 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
|||||||
{
|
{
|
||||||
new DrawableTeamFlag(match.Winner)
|
new DrawableTeamFlag(match.Winner)
|
||||||
{
|
{
|
||||||
Size = new Vector2(300, 200),
|
|
||||||
Scale = new Vector2(0.5f),
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Position = new Vector2(-300, 10),
|
Position = new Vector2(-300, 10),
|
||||||
|
Scale = new Vector2(2f)
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
@ -53,5 +53,13 @@ namespace osu.Game.Online.API
|
|||||||
}
|
}
|
||||||
|
|
||||||
public bool Equals(IMod other) => Acronym == other?.Acronym;
|
public bool Equals(IMod other) => Acronym == other?.Acronym;
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
if (Settings.Count > 0)
|
||||||
|
return $"{Acronym} ({string.Join(',', Settings.Select(kvp => $"{kvp.Key}:{kvp.Value}"))})";
|
||||||
|
|
||||||
|
return $"{Acronym}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
public Bindable<UserActivity> Activity { get; } = new Bindable<UserActivity>();
|
public Bindable<UserActivity> Activity { get; } = new Bindable<UserActivity>();
|
||||||
|
|
||||||
|
public string AccessToken => "token";
|
||||||
|
|
||||||
public bool IsLoggedIn => State.Value == APIState.Online;
|
public bool IsLoggedIn => State.Value == APIState.Online;
|
||||||
|
|
||||||
public string ProvidedUsername => LocalUser.Value.Username;
|
public string ProvidedUsername => LocalUser.Value.Username;
|
||||||
|
@ -21,6 +21,11 @@ namespace osu.Game.Online.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
Bindable<UserActivity> Activity { get; }
|
Bindable<UserActivity> Activity { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieve the OAuth access token.
|
||||||
|
/// </summary>
|
||||||
|
string AccessToken { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns whether the local user is logged in.
|
/// Returns whether the local user is logged in.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
20
osu.Game/Online/Spectator/FrameDataBundle.cs
Normal file
20
osu.Game/Online/Spectator/FrameDataBundle.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Replays.Legacy;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Spectator
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class FrameDataBundle
|
||||||
|
{
|
||||||
|
public IEnumerable<LegacyReplayFrame> Frames { get; set; }
|
||||||
|
|
||||||
|
public FrameDataBundle(IEnumerable<LegacyReplayFrame> frames)
|
||||||
|
{
|
||||||
|
Frames = frames;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
34
osu.Game/Online/Spectator/ISpectatorClient.cs
Normal file
34
osu.Game/Online/Spectator/ISpectatorClient.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
// 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.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Spectator
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface defining a spectator client instance.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISpectatorClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Signals that a user has begun a new play session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user.</param>
|
||||||
|
/// <param name="state">The state of gameplay.</param>
|
||||||
|
Task UserBeganPlaying(int userId, SpectatorState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signals that a user has finished a play session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user.</param>
|
||||||
|
/// <param name="state">The state of gameplay.</param>
|
||||||
|
Task UserFinishedPlaying(int userId, SpectatorState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called when new frames are available for a subscribed user's play session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user.</param>
|
||||||
|
/// <param name="data">The frame data.</param>
|
||||||
|
Task UserSentFrames(int userId, FrameDataBundle data);
|
||||||
|
}
|
||||||
|
}
|
44
osu.Game/Online/Spectator/ISpectatorServer.cs
Normal file
44
osu.Game/Online/Spectator/ISpectatorServer.cs
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// 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.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Spectator
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An interface defining the spectator server instance.
|
||||||
|
/// </summary>
|
||||||
|
public interface ISpectatorServer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Signal the start of a new play session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">The state of gameplay.</param>
|
||||||
|
Task BeginPlaySession(SpectatorState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Send a bundle of frame data for the current play session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data">The frame data.</param>
|
||||||
|
Task SendFrameData(FrameDataBundle data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Signal the end of a play session.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="state">The state of gameplay.</param>
|
||||||
|
Task EndPlaySession(SpectatorState state);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Request spectating data for the specified user. May be called on multiple users and offline users.
|
||||||
|
/// For offline users, a subscription will be created and data will begin streaming on next play.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user to subscribe to.</param>
|
||||||
|
Task StartWatchingUser(int userId);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Stop requesting spectating data for the specified user. Unsubscribes from receiving further data.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user to unsubscribe from.</param>
|
||||||
|
Task EndWatchingUser(int userId);
|
||||||
|
}
|
||||||
|
}
|
26
osu.Game/Online/Spectator/SpectatorState.cs
Normal file
26
osu.Game/Online/Spectator/SpectatorState.cs
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
// 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.Diagnostics.CodeAnalysis;
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Spectator
|
||||||
|
{
|
||||||
|
[Serializable]
|
||||||
|
public class SpectatorState : IEquatable<SpectatorState>
|
||||||
|
{
|
||||||
|
public int? BeatmapID { get; set; }
|
||||||
|
|
||||||
|
public int? RulesetID { get; set; }
|
||||||
|
|
||||||
|
[NotNull]
|
||||||
|
public IEnumerable<APIMod> Mods { get; set; } = Enumerable.Empty<APIMod>();
|
||||||
|
|
||||||
|
public bool Equals(SpectatorState other) => BeatmapID == other?.BeatmapID && Mods.SequenceEqual(other?.Mods) && RulesetID == other?.RulesetID;
|
||||||
|
|
||||||
|
public override string ToString() => $"Beatmap:{BeatmapID} Mods:{string.Join(',', Mods)} Ruleset:{RulesetID}";
|
||||||
|
}
|
||||||
|
}
|
274
osu.Game/Online/Spectator/SpectatorStreamingClient.cs
Normal file
274
osu.Game/Online/Spectator/SpectatorStreamingClient.cs
Normal file
@ -0,0 +1,274 @@
|
|||||||
|
// 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.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using JetBrains.Annotations;
|
||||||
|
using Microsoft.AspNetCore.SignalR.Client;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osu.Game.Replays.Legacy;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Rulesets.Replays.Types;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Online.Spectator
|
||||||
|
{
|
||||||
|
public class SpectatorStreamingClient : Component, ISpectatorClient
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The maximum milliseconds between frame bundle sends.
|
||||||
|
/// </summary>
|
||||||
|
public const double TIME_BETWEEN_SENDS = 200;
|
||||||
|
|
||||||
|
private HubConnection connection;
|
||||||
|
|
||||||
|
private readonly List<int> watchingUsers = new List<int>();
|
||||||
|
|
||||||
|
public IBindableList<int> PlayingUsers => playingUsers;
|
||||||
|
|
||||||
|
private readonly BindableList<int> playingUsers = new BindableList<int>();
|
||||||
|
|
||||||
|
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
|
||||||
|
|
||||||
|
private bool isConnected;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
|
[CanBeNull]
|
||||||
|
private IBeatmap currentBeatmap;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<RulesetInfo> currentRuleset { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IBindable<IReadOnlyList<Mod>> currentMods { get; set; }
|
||||||
|
|
||||||
|
private readonly SpectatorState currentState = new SpectatorState();
|
||||||
|
|
||||||
|
private bool isPlaying;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Called whenever new frames arrive from the server.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<int, FrameDataBundle> OnNewFrames;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
apiState.BindTo(api.State);
|
||||||
|
apiState.BindValueChanged(apiStateChanged, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void apiStateChanged(ValueChangedEvent<APIState> state)
|
||||||
|
{
|
||||||
|
switch (state.NewValue)
|
||||||
|
{
|
||||||
|
case APIState.Failing:
|
||||||
|
case APIState.Offline:
|
||||||
|
connection?.StopAsync();
|
||||||
|
connection = null;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case APIState.Online:
|
||||||
|
Task.Run(connect);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private const string endpoint = "https://spectator.ppy.sh/spectator";
|
||||||
|
|
||||||
|
private async Task connect()
|
||||||
|
{
|
||||||
|
if (connection != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
connection = new HubConnectionBuilder()
|
||||||
|
.WithUrl(endpoint, options =>
|
||||||
|
{
|
||||||
|
options.Headers.Add("Authorization", $"Bearer {api.AccessToken}");
|
||||||
|
})
|
||||||
|
.AddNewtonsoftJsonProtocol(options => { options.PayloadSerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; })
|
||||||
|
.Build();
|
||||||
|
|
||||||
|
// until strong typed client support is added, each method must be manually bound (see https://github.com/dotnet/aspnetcore/issues/15198)
|
||||||
|
connection.On<int, SpectatorState>(nameof(ISpectatorClient.UserBeganPlaying), ((ISpectatorClient)this).UserBeganPlaying);
|
||||||
|
connection.On<int, FrameDataBundle>(nameof(ISpectatorClient.UserSentFrames), ((ISpectatorClient)this).UserSentFrames);
|
||||||
|
connection.On<int, SpectatorState>(nameof(ISpectatorClient.UserFinishedPlaying), ((ISpectatorClient)this).UserFinishedPlaying);
|
||||||
|
|
||||||
|
connection.Closed += async ex =>
|
||||||
|
{
|
||||||
|
isConnected = false;
|
||||||
|
playingUsers.Clear();
|
||||||
|
|
||||||
|
if (ex != null) await tryUntilConnected();
|
||||||
|
};
|
||||||
|
|
||||||
|
await tryUntilConnected();
|
||||||
|
|
||||||
|
async Task tryUntilConnected()
|
||||||
|
{
|
||||||
|
while (api.State.Value == APIState.Online)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// reconnect on any failure
|
||||||
|
await connection.StartAsync();
|
||||||
|
|
||||||
|
// success
|
||||||
|
isConnected = true;
|
||||||
|
|
||||||
|
// resubscribe to watched users
|
||||||
|
var users = watchingUsers.ToArray();
|
||||||
|
watchingUsers.Clear();
|
||||||
|
foreach (var userId in users)
|
||||||
|
WatchUser(userId);
|
||||||
|
|
||||||
|
// re-send state in case it wasn't received
|
||||||
|
if (isPlaying)
|
||||||
|
beginPlaying();
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
await Task.Delay(5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Task ISpectatorClient.UserBeganPlaying(int userId, SpectatorState state)
|
||||||
|
{
|
||||||
|
if (!playingUsers.Contains(userId))
|
||||||
|
playingUsers.Add(userId);
|
||||||
|
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
Task ISpectatorClient.UserFinishedPlaying(int userId, SpectatorState state)
|
||||||
|
{
|
||||||
|
playingUsers.Remove(userId);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
Task ISpectatorClient.UserSentFrames(int userId, FrameDataBundle data)
|
||||||
|
{
|
||||||
|
OnNewFrames?.Invoke(userId, data);
|
||||||
|
return Task.CompletedTask;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void BeginPlaying(GameplayBeatmap beatmap)
|
||||||
|
{
|
||||||
|
if (isPlaying)
|
||||||
|
throw new InvalidOperationException($"Cannot invoke {nameof(BeginPlaying)} when already playing");
|
||||||
|
|
||||||
|
isPlaying = true;
|
||||||
|
|
||||||
|
// transfer state at point of beginning play
|
||||||
|
currentState.BeatmapID = beatmap.BeatmapInfo.OnlineBeatmapID;
|
||||||
|
currentState.RulesetID = currentRuleset.Value.ID;
|
||||||
|
currentState.Mods = currentMods.Value.Select(m => new APIMod(m));
|
||||||
|
|
||||||
|
currentBeatmap = beatmap.PlayableBeatmap;
|
||||||
|
beginPlaying();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void beginPlaying()
|
||||||
|
{
|
||||||
|
Debug.Assert(isPlaying);
|
||||||
|
|
||||||
|
if (!isConnected) return;
|
||||||
|
|
||||||
|
connection.SendAsync(nameof(ISpectatorServer.BeginPlaySession), currentState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SendFrames(FrameDataBundle data)
|
||||||
|
{
|
||||||
|
if (!isConnected) return;
|
||||||
|
|
||||||
|
lastSend = connection.SendAsync(nameof(ISpectatorServer.SendFrameData), data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EndPlaying()
|
||||||
|
{
|
||||||
|
isPlaying = false;
|
||||||
|
currentBeatmap = null;
|
||||||
|
|
||||||
|
if (!isConnected) return;
|
||||||
|
|
||||||
|
connection.SendAsync(nameof(ISpectatorServer.EndPlaySession), currentState);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void WatchUser(int userId)
|
||||||
|
{
|
||||||
|
if (watchingUsers.Contains(userId))
|
||||||
|
return;
|
||||||
|
|
||||||
|
watchingUsers.Add(userId);
|
||||||
|
|
||||||
|
if (!isConnected) return;
|
||||||
|
|
||||||
|
connection.SendAsync(nameof(ISpectatorServer.StartWatchingUser), userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopWatchingUser(int userId)
|
||||||
|
{
|
||||||
|
watchingUsers.Remove(userId);
|
||||||
|
|
||||||
|
if (!isConnected) return;
|
||||||
|
|
||||||
|
connection.SendAsync(nameof(ISpectatorServer.EndWatchingUser), userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly Queue<LegacyReplayFrame> pendingFrames = new Queue<LegacyReplayFrame>();
|
||||||
|
|
||||||
|
private double lastSendTime;
|
||||||
|
|
||||||
|
private Task lastSend;
|
||||||
|
|
||||||
|
private const int max_pending_frames = 30;
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (pendingFrames.Count > 0 && Time.Current - lastSendTime > TIME_BETWEEN_SENDS)
|
||||||
|
purgePendingFrames();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void HandleFrame(ReplayFrame frame)
|
||||||
|
{
|
||||||
|
if (frame is IConvertibleReplayFrame convertible)
|
||||||
|
pendingFrames.Enqueue(convertible.ToLegacy(currentBeatmap));
|
||||||
|
|
||||||
|
if (pendingFrames.Count > max_pending_frames)
|
||||||
|
purgePendingFrames();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void purgePendingFrames()
|
||||||
|
{
|
||||||
|
if (lastSend?.IsCompleted == false)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var frames = pendingFrames.ToArray();
|
||||||
|
|
||||||
|
pendingFrames.Clear();
|
||||||
|
|
||||||
|
SendFrames(new FrameDataBundle(frames));
|
||||||
|
|
||||||
|
lastSendTime = Time.Current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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.Online.Spectator;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Resources;
|
using osu.Game.Resources;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -74,6 +75,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
protected IAPIProvider API;
|
protected IAPIProvider API;
|
||||||
|
|
||||||
|
private SpectatorStreamingClient spectatorStreaming;
|
||||||
|
|
||||||
protected MenuCursorContainer MenuCursorContainer;
|
protected MenuCursorContainer MenuCursorContainer;
|
||||||
|
|
||||||
protected MusicController MusicController;
|
protected MusicController MusicController;
|
||||||
@ -189,9 +192,9 @@ namespace osu.Game
|
|||||||
dependencies.Cache(SkinManager = new SkinManager(Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy")));
|
dependencies.Cache(SkinManager = new SkinManager(Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy")));
|
||||||
dependencies.CacheAs<ISkinSource>(SkinManager);
|
dependencies.CacheAs<ISkinSource>(SkinManager);
|
||||||
|
|
||||||
API ??= new APIAccess(LocalConfig);
|
dependencies.CacheAs(API ??= new APIAccess(LocalConfig));
|
||||||
|
|
||||||
dependencies.CacheAs(API);
|
dependencies.CacheAs(spectatorStreaming = new SpectatorStreamingClient());
|
||||||
|
|
||||||
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
||||||
|
|
||||||
@ -247,8 +250,11 @@ namespace osu.Game
|
|||||||
|
|
||||||
FileStore.Cleanup();
|
FileStore.Cleanup();
|
||||||
|
|
||||||
|
// add api components to hierarchy.
|
||||||
if (API is APIAccess apiAccess)
|
if (API is APIAccess apiAccess)
|
||||||
AddInternal(apiAccess);
|
AddInternal(apiAccess);
|
||||||
|
AddInternal(spectatorStreaming);
|
||||||
|
|
||||||
AddInternal(RulesetConfigCache);
|
AddInternal(RulesetConfigCache);
|
||||||
|
|
||||||
MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both };
|
MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
@ -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 Newtonsoft.Json;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -8,17 +9,28 @@ namespace osu.Game.Replays.Legacy
|
|||||||
{
|
{
|
||||||
public class LegacyReplayFrame : ReplayFrame
|
public class LegacyReplayFrame : ReplayFrame
|
||||||
{
|
{
|
||||||
|
[JsonIgnore]
|
||||||
public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0);
|
public Vector2 Position => new Vector2(MouseX ?? 0, MouseY ?? 0);
|
||||||
|
|
||||||
public float? MouseX;
|
public float? MouseX;
|
||||||
public float? MouseY;
|
public float? MouseY;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool MouseLeft => MouseLeft1 || MouseLeft2;
|
public bool MouseLeft => MouseLeft1 || MouseLeft2;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool MouseRight => MouseRight1 || MouseRight2;
|
public bool MouseRight => MouseRight1 || MouseRight2;
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool MouseLeft1 => ButtonState.HasFlag(ReplayButtonState.Left1);
|
public bool MouseLeft1 => ButtonState.HasFlag(ReplayButtonState.Left1);
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool MouseRight1 => ButtonState.HasFlag(ReplayButtonState.Right1);
|
public bool MouseRight1 => ButtonState.HasFlag(ReplayButtonState.Right1);
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool MouseLeft2 => ButtonState.HasFlag(ReplayButtonState.Left2);
|
public bool MouseLeft2 => ButtonState.HasFlag(ReplayButtonState.Left2);
|
||||||
|
|
||||||
|
[JsonIgnore]
|
||||||
public bool MouseRight2 => ButtonState.HasFlag(ReplayButtonState.Right2);
|
public bool MouseRight2 => ButtonState.HasFlag(ReplayButtonState.Right2);
|
||||||
|
|
||||||
public ReplayButtonState ButtonState;
|
public ReplayButtonState ButtonState;
|
||||||
|
@ -4,12 +4,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Rulesets.UI
|
||||||
@ -25,6 +28,12 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public int RecordFrameRate = 60;
|
public int RecordFrameRate = 60;
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private SpectatorStreamingClient spectatorStreaming { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameplayBeatmap gameplayBeatmap { get; set; }
|
||||||
|
|
||||||
protected ReplayRecorder(Replay target)
|
protected ReplayRecorder(Replay target)
|
||||||
{
|
{
|
||||||
this.target = target;
|
this.target = target;
|
||||||
@ -39,6 +48,14 @@ namespace osu.Game.Rulesets.UI
|
|||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
inputManager = GetContainingInputManager();
|
inputManager = GetContainingInputManager();
|
||||||
|
|
||||||
|
spectatorStreaming?.BeginPlaying(gameplayBeatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
spectatorStreaming?.EndPlaying();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||||
@ -72,7 +89,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
var frame = HandleFrame(position, pressedActions, last);
|
var frame = HandleFrame(position, pressedActions, last);
|
||||||
|
|
||||||
if (frame != null)
|
if (frame != null)
|
||||||
|
{
|
||||||
target.Frames.Add(frame);
|
target.Frames.Add(frame);
|
||||||
|
|
||||||
|
spectatorStreaming?.HandleFrame(frame);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract ReplayFrame HandleFrame(Vector2 mousePosition, List<T> actions, ReplayFrame previousFrame);
|
protected abstract ReplayFrame HandleFrame(Vector2 mousePosition, List<T> actions, ReplayFrame previousFrame);
|
||||||
|
@ -2,8 +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.Audio;
|
|
||||||
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.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -18,11 +16,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public class EpilepsyWarning : VisibilityContainer
|
public class EpilepsyWarning : VisibilityContainer
|
||||||
{
|
{
|
||||||
public const double FADE_DURATION = 500;
|
public const double FADE_DURATION = 250;
|
||||||
|
|
||||||
private readonly BindableDouble trackVolumeOnEpilepsyWarning = new BindableDouble(1f);
|
|
||||||
|
|
||||||
private Track track;
|
|
||||||
|
|
||||||
public EpilepsyWarning()
|
public EpilepsyWarning()
|
||||||
{
|
{
|
||||||
@ -77,26 +71,15 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
track = beatmap.Value.Track;
|
|
||||||
track.AddAdjustment(AdjustableProperty.Volume, trackVolumeOnEpilepsyWarning);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
this.TransformBindableTo(trackVolumeOnEpilepsyWarning, 0.25, FADE_DURATION);
|
|
||||||
|
|
||||||
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
DimmableBackground?.FadeColour(OsuColour.Gray(0.5f), FADE_DURATION, Easing.OutQuint);
|
||||||
|
|
||||||
this.FadeIn(FADE_DURATION, Easing.OutQuint);
|
this.FadeIn(FADE_DURATION, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut() => this.FadeOut(FADE_DURATION);
|
protected override void PopOut() => this.FadeOut(FADE_DURATION);
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
track?.RemoveAdjustment(AdjustableProperty.Volume, trackVolumeOnEpilepsyWarning);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,9 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
PrepareReplay();
|
// replays should never be recorded or played back when autoplay is enabled
|
||||||
|
if (!Mods.Value.Any(m => m is ModAutoplay))
|
||||||
|
PrepareReplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Replay recordingReplay;
|
private Replay recordingReplay;
|
||||||
|
@ -55,6 +55,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private bool backgroundBrightnessReduction;
|
private bool backgroundBrightnessReduction;
|
||||||
|
|
||||||
|
private readonly BindableDouble volumeAdjustment = new BindableDouble(1);
|
||||||
|
|
||||||
protected bool BackgroundBrightnessReduction
|
protected bool BackgroundBrightnessReduction
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -169,6 +171,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (epilepsyWarning != null)
|
if (epilepsyWarning != null)
|
||||||
epilepsyWarning.DimmableBackground = Background;
|
epilepsyWarning.DimmableBackground = Background;
|
||||||
|
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||||
@ -197,6 +200,11 @@ namespace osu.Game.Screens.Play
|
|||||||
cancelLoad();
|
cancelLoad();
|
||||||
|
|
||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
|
|
||||||
|
// we're moving to player, so a period of silence is upcoming.
|
||||||
|
// stop the track before removing adjustment to avoid a volume spike.
|
||||||
|
Beatmap.Value.Track.Stop();
|
||||||
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
@ -208,6 +216,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Background.EnableUserDim.Value = false;
|
Background.EnableUserDim.Value = false;
|
||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
@ -331,18 +340,16 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
const double epilepsy_display_length = 3000;
|
const double epilepsy_display_length = 3000;
|
||||||
|
|
||||||
pushSequence.Schedule(() =>
|
pushSequence
|
||||||
{
|
.Schedule(() => epilepsyWarning.State.Value = Visibility.Visible)
|
||||||
epilepsyWarning.State.Value = Visibility.Visible;
|
.TransformBindableTo(volumeAdjustment, 0.25, EpilepsyWarning.FADE_DURATION, Easing.OutQuint)
|
||||||
|
.Delay(epilepsy_display_length)
|
||||||
this.Delay(epilepsy_display_length).Schedule(() =>
|
.Schedule(() =>
|
||||||
{
|
{
|
||||||
epilepsyWarning.Hide();
|
epilepsyWarning.Hide();
|
||||||
epilepsyWarning.Expire();
|
epilepsyWarning.Expire();
|
||||||
});
|
})
|
||||||
});
|
.Delay(EpilepsyWarning.FADE_DURATION);
|
||||||
|
|
||||||
pushSequence.Delay(epilepsy_display_length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pushSequence.Schedule(() =>
|
pushSequence.Schedule(() =>
|
||||||
|
@ -140,7 +140,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
LoadComponentAsync(beatmapContainer, loaded =>
|
LoadComponentAsync(beatmapContainer, loaded =>
|
||||||
{
|
{
|
||||||
// make sure the pooled target hasn't changed.
|
// make sure the pooled target hasn't changed.
|
||||||
if (carouselBeatmapSet != Item)
|
if (beatmapContainer != loaded)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Content.Child = loaded;
|
Content.Child = loaded;
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
<PackageReference Include="Dapper" Version="2.0.35" />
|
<PackageReference Include="Dapper" Version="2.0.35" />
|
||||||
<PackageReference Include="DiffPlex" Version="1.6.3" />
|
<PackageReference Include="DiffPlex" Version="1.6.3" />
|
||||||
<PackageReference Include="Humanizer" Version="2.8.26" />
|
<PackageReference Include="Humanizer" Version="2.8.26" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="3.1.9" />
|
||||||
|
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="3.1.9" />
|
||||||
<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" />
|
||||||
|
Reference in New Issue
Block a user