mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 14:22:55 +08:00
Merge remote-tracking branch 'upstream/master' into difficulty-icon-tooltip
This commit is contained in:
commit
816bac9874
@ -214,37 +214,6 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
AddAssert("start not requested", () => !startRequested);
|
AddAssert("start not requested", () => !startRequested);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void TestAddNewBeatmapWhileSelectingRandom()
|
|
||||||
{
|
|
||||||
const int test_count = 10;
|
|
||||||
int beatmapChangedCount = 0;
|
|
||||||
int debounceCount = 0;
|
|
||||||
createSongSelect();
|
|
||||||
AddStep("Setup counters", () =>
|
|
||||||
{
|
|
||||||
beatmapChangedCount = 0;
|
|
||||||
debounceCount = 0;
|
|
||||||
songSelect.Carousel.SelectionChanged += _ => beatmapChangedCount++;
|
|
||||||
});
|
|
||||||
AddRepeatStep($"Create beatmaps {test_count} times", () =>
|
|
||||||
{
|
|
||||||
importForRuleset(0);
|
|
||||||
|
|
||||||
Scheduler.AddDelayed(() =>
|
|
||||||
{
|
|
||||||
// Wait for debounce
|
|
||||||
songSelect.Carousel.SelectNextRandom();
|
|
||||||
++debounceCount;
|
|
||||||
}, 400);
|
|
||||||
}, test_count);
|
|
||||||
|
|
||||||
AddUntilStep("Debounce limit reached", () => debounceCount == test_count);
|
|
||||||
|
|
||||||
// The selected beatmap should have changed an additional 2 times since both initially loading songselect and the first import also triggers selectionChanged
|
|
||||||
AddAssert($"Beatmap changed {test_count + 2} times", () => beatmapChangedCount == test_count + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestHideSetSelectsCorrectBeatmap()
|
public void TestHideSetSelectsCorrectBeatmap()
|
||||||
{
|
{
|
||||||
|
@ -17,11 +17,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A button with added default sound effects.
|
/// A button with added default sound effects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class OsuButton : Button
|
public class OsuButton : Button
|
||||||
{
|
{
|
||||||
private Box hover;
|
private Box hover;
|
||||||
|
|
||||||
protected OsuButton()
|
public OsuButton()
|
||||||
{
|
{
|
||||||
Height = 40;
|
Height = 40;
|
||||||
|
|
||||||
|
@ -13,10 +13,6 @@ namespace osu.Game.Online.Chat
|
|||||||
[JsonProperty(@"message_id")]
|
[JsonProperty(@"message_id")]
|
||||||
public readonly long? Id;
|
public readonly long? Id;
|
||||||
|
|
||||||
//todo: this should be inside sender.
|
|
||||||
[JsonProperty(@"sender_id")]
|
|
||||||
public long UserId;
|
|
||||||
|
|
||||||
[JsonProperty(@"channel_id")]
|
[JsonProperty(@"channel_id")]
|
||||||
public long ChannelId;
|
public long ChannelId;
|
||||||
|
|
||||||
|
@ -63,6 +63,9 @@ namespace osu.Game.Overlays.Settings
|
|||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (bindable != null)
|
||||||
|
controlWithCurrent?.Current.UnbindFrom(bindable);
|
||||||
|
|
||||||
bindable = value;
|
bindable = value;
|
||||||
controlWithCurrent?.Current.BindTo(bindable);
|
controlWithCurrent?.Current.BindTo(bindable);
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
private ButtonSystem buttons;
|
private ButtonSystem buttons;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial;
|
public override bool HideOverlaysOnEnter => buttons == null || buttons.State == ButtonSystemState.Initial;
|
||||||
|
|
||||||
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
|
protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -185,6 +186,28 @@ namespace osu.Game.Screens.Multi
|
|||||||
{
|
{
|
||||||
this.FadeIn();
|
this.FadeIn();
|
||||||
waves.Show();
|
waves.Show();
|
||||||
|
|
||||||
|
beginHandlingTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResuming(IScreen last)
|
||||||
|
{
|
||||||
|
this.FadeIn(250);
|
||||||
|
this.ScaleTo(1, 250, Easing.OutSine);
|
||||||
|
|
||||||
|
base.OnResuming(last);
|
||||||
|
|
||||||
|
beginHandlingTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnSuspending(IScreen next)
|
||||||
|
{
|
||||||
|
this.ScaleTo(1.1f, 250, Easing.InSine);
|
||||||
|
this.FadeOut(250);
|
||||||
|
|
||||||
|
endHandlingTrack();
|
||||||
|
|
||||||
|
roomManager.TimeBetweenPolls = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
@ -193,12 +216,10 @@ namespace osu.Game.Screens.Multi
|
|||||||
|
|
||||||
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
this.Delay(WaveContainer.DISAPPEAR_DURATION).FadeOut();
|
||||||
|
|
||||||
cancelLooping();
|
|
||||||
|
|
||||||
if (screenStack.CurrentScreen != null)
|
if (screenStack.CurrentScreen != null)
|
||||||
loungeSubScreen.MakeCurrent();
|
loungeSubScreen.MakeCurrent();
|
||||||
|
|
||||||
updatePollingRate(isIdle.Value);
|
endHandlingTrack();
|
||||||
|
|
||||||
base.OnExiting(next);
|
base.OnExiting(next);
|
||||||
return false;
|
return false;
|
||||||
@ -212,23 +233,58 @@ namespace osu.Game.Screens.Multi
|
|||||||
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
|
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResuming(IScreen last)
|
private void beginHandlingTrack()
|
||||||
{
|
{
|
||||||
this.FadeIn(250);
|
Beatmap.BindValueChanged(updateTrack, true);
|
||||||
this.ScaleTo(1, 250, Easing.OutSine);
|
|
||||||
|
|
||||||
base.OnResuming(last);
|
|
||||||
|
|
||||||
updatePollingRate(isIdle.Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnSuspending(IScreen next)
|
private void endHandlingTrack()
|
||||||
{
|
{
|
||||||
this.ScaleTo(1.1f, 250, Easing.InSine);
|
|
||||||
this.FadeOut(250);
|
|
||||||
|
|
||||||
cancelLooping();
|
cancelLooping();
|
||||||
roomManager.TimeBetweenPolls = 0;
|
Beatmap.ValueChanged -= updateTrack;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void screenPushed(IScreen lastScreen, IScreen newScreen) => subScreenChanged(newScreen);
|
||||||
|
|
||||||
|
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
||||||
|
{
|
||||||
|
subScreenChanged(newScreen);
|
||||||
|
|
||||||
|
if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
|
||||||
|
this.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void subScreenChanged(IScreen newScreen)
|
||||||
|
{
|
||||||
|
updatePollingRate(isIdle.Value);
|
||||||
|
createButton.FadeTo(newScreen is MatchSubScreen ? 0 : 1, 200);
|
||||||
|
|
||||||
|
updateTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateTrack(ValueChangedEvent<WorkingBeatmap> _ = null)
|
||||||
|
{
|
||||||
|
bool isMatch = screenStack.CurrentScreen is MatchSubScreen;
|
||||||
|
|
||||||
|
Beatmap.Disabled = isMatch;
|
||||||
|
|
||||||
|
if (isMatch)
|
||||||
|
{
|
||||||
|
var track = Beatmap.Value?.Track;
|
||||||
|
|
||||||
|
if (track != null)
|
||||||
|
{
|
||||||
|
track.RestartPoint = Beatmap.Value.Metadata.PreviewTime;
|
||||||
|
track.Looping = true;
|
||||||
|
|
||||||
|
if (!track.IsRunning)
|
||||||
|
track.Restart();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cancelLooping();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelLooping()
|
private void cancelLooping()
|
||||||
@ -236,49 +292,10 @@ namespace osu.Game.Screens.Multi
|
|||||||
var track = Beatmap?.Value?.Track;
|
var track = Beatmap?.Value?.Track;
|
||||||
|
|
||||||
if (track != null)
|
if (track != null)
|
||||||
|
{
|
||||||
track.Looping = false;
|
track.Looping = false;
|
||||||
|
track.RestartPoint = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
if (!this.IsCurrentScreen()) return;
|
|
||||||
|
|
||||||
if (screenStack.CurrentScreen is MatchSubScreen)
|
|
||||||
{
|
|
||||||
var track = Beatmap.Value.Track;
|
|
||||||
|
|
||||||
if (track != null)
|
|
||||||
{
|
|
||||||
track.Looping = true;
|
|
||||||
|
|
||||||
if (!track.IsRunning)
|
|
||||||
{
|
|
||||||
game.Audio.AddItem(track);
|
|
||||||
track.Seek(Beatmap.Value.Metadata.PreviewTime);
|
|
||||||
track.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
createButton.Hide();
|
|
||||||
}
|
|
||||||
else if (screenStack.CurrentScreen is LoungeSubScreen)
|
|
||||||
createButton.Show();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void screenPushed(IScreen lastScreen, IScreen newScreen)
|
|
||||||
=> updatePollingRate(isIdle.Value);
|
|
||||||
|
|
||||||
private void screenExited(IScreen lastScreen, IScreen newScreen)
|
|
||||||
{
|
|
||||||
if (lastScreen is MatchSubScreen)
|
|
||||||
cancelLooping();
|
|
||||||
|
|
||||||
updatePollingRate(isIdle.Value);
|
|
||||||
|
|
||||||
if (screenStack.CurrentScreen == null && this.IsCurrentScreen())
|
|
||||||
this.Exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.615.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.618.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
<PackageReference Include="SharpCompress" Version="0.23.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" />
|
||||||
|
@ -105,8 +105,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.609.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.615.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.618.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.615.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.618.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user