mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 02:32:55 +08:00
Merge branch 'master' into tablet-area-validity-fix
This commit is contained in:
commit
73f742509a
46
osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs
Normal file
46
osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Screens.Edit.Setup;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mania.Edit.Setup
|
||||||
|
{
|
||||||
|
public class ManiaSetupSection : RulesetSetupSection
|
||||||
|
{
|
||||||
|
private LabelledSwitchButton specialStyle;
|
||||||
|
|
||||||
|
public ManiaSetupSection()
|
||||||
|
: base(new ManiaRuleset().RulesetInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
specialStyle = new LabelledSwitchButton
|
||||||
|
{
|
||||||
|
Label = "Use special (N+1) style",
|
||||||
|
Description = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 5k (4+1) or 8key (7+1) configurations.",
|
||||||
|
Current = { Value = Beatmap.BeatmapInfo.SpecialStyle }
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
specialStyle.Current.BindValueChanged(_ => updateBeatmap());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBeatmap()
|
||||||
|
{
|
||||||
|
Beatmap.BeatmapInfo.SpecialStyle = specialStyle.Current.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -27,11 +27,13 @@ using osu.Game.Rulesets.Mania.Beatmaps;
|
|||||||
using osu.Game.Rulesets.Mania.Configuration;
|
using osu.Game.Rulesets.Mania.Configuration;
|
||||||
using osu.Game.Rulesets.Mania.Difficulty;
|
using osu.Game.Rulesets.Mania.Difficulty;
|
||||||
using osu.Game.Rulesets.Mania.Edit;
|
using osu.Game.Rulesets.Mania.Edit;
|
||||||
|
using osu.Game.Rulesets.Mania.Edit.Setup;
|
||||||
using osu.Game.Rulesets.Mania.Scoring;
|
using osu.Game.Rulesets.Mania.Scoring;
|
||||||
using osu.Game.Rulesets.Mania.Skinning.Legacy;
|
using osu.Game.Rulesets.Mania.Skinning.Legacy;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
|
using osu.Game.Screens.Edit.Setup;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania
|
namespace osu.Game.Rulesets.Mania
|
||||||
@ -390,6 +392,8 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
{
|
{
|
||||||
return new ManiaFilterCriteria();
|
return new ManiaFilterCriteria();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PlayfieldType
|
public enum PlayfieldType
|
||||||
|
52
osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs
Normal file
52
osu.Game.Rulesets.Osu/Edit/Setup/OsuSetupSection.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Game.Graphics.UserInterfaceV2;
|
||||||
|
using osu.Game.Screens.Edit.Setup;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Osu.Edit.Setup
|
||||||
|
{
|
||||||
|
public class OsuSetupSection : RulesetSetupSection
|
||||||
|
{
|
||||||
|
private LabelledSliderBar<float> stackLeniency;
|
||||||
|
|
||||||
|
public OsuSetupSection()
|
||||||
|
: base(new OsuRuleset().RulesetInfo)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
stackLeniency = new LabelledSliderBar<float>
|
||||||
|
{
|
||||||
|
Label = "Stack Leniency",
|
||||||
|
Description = "In play mode, osu! automatically stacks notes which occur at the same location. Increasing this value means it is more likely to snap notes of further time-distance.",
|
||||||
|
Current = new BindableFloat(Beatmap.BeatmapInfo.StackLeniency)
|
||||||
|
{
|
||||||
|
Default = 0.7f,
|
||||||
|
MinValue = 0,
|
||||||
|
MaxValue = 1,
|
||||||
|
Precision = 0.1f
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
stackLeniency.Current.BindValueChanged(_ => updateBeatmap());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateBeatmap()
|
||||||
|
{
|
||||||
|
Beatmap.BeatmapInfo.StackLeniency = stackLeniency.Current.Value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -30,9 +30,11 @@ using osu.Game.Skinning;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.EnumExtensions;
|
using osu.Framework.Extensions.EnumExtensions;
|
||||||
|
using osu.Game.Rulesets.Osu.Edit.Setup;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Rulesets.Osu.Skinning.Legacy;
|
using osu.Game.Rulesets.Osu.Skinning.Legacy;
|
||||||
using osu.Game.Rulesets.Osu.Statistics;
|
using osu.Game.Rulesets.Osu.Statistics;
|
||||||
|
using osu.Game.Screens.Edit.Setup;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu
|
namespace osu.Game.Rulesets.Osu
|
||||||
@ -305,5 +307,7 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override RulesetSetupSection CreateEditorSetupSection() => new OsuSetupSection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Catch;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
|
using osu.Game.Rulesets.Mania;
|
||||||
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Taiko;
|
||||||
using osu.Game.Screens.Edit;
|
using osu.Game.Screens.Edit;
|
||||||
using osu.Game.Screens.Edit.Setup;
|
using osu.Game.Screens.Edit.Setup;
|
||||||
|
|
||||||
@ -23,15 +28,31 @@ namespace osu.Game.Tests.Visual.Editing
|
|||||||
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
editorBeatmap = new EditorBeatmap(new OsuBeatmap());
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[Test]
|
||||||
private void load()
|
public void TestOsu() => runForRuleset(new OsuRuleset().RulesetInfo);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestTaiko() => runForRuleset(new TaikoRuleset().RulesetInfo);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCatch() => runForRuleset(new CatchRuleset().RulesetInfo);
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestMania() => runForRuleset(new ManiaRuleset().RulesetInfo);
|
||||||
|
|
||||||
|
private void runForRuleset(RulesetInfo rulesetInfo)
|
||||||
{
|
{
|
||||||
|
AddStep("create screen", () =>
|
||||||
|
{
|
||||||
|
editorBeatmap.BeatmapInfo.Ruleset = rulesetInfo;
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap);
|
||||||
|
|
||||||
Child = new SetupScreen
|
Child = new SetupScreen
|
||||||
{
|
{
|
||||||
State = { Value = Visibility.Visible },
|
State = { Value = Visibility.Visible },
|
||||||
};
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,9 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg"
|
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c4.jpg"
|
||||||
}, api.IsLoggedIn));
|
}, api.IsLoggedIn));
|
||||||
|
|
||||||
|
AddStep("Show ppy from username", () => profile.ShowUser(@"peppy"));
|
||||||
|
AddStep("Show flyte from username", () => profile.ShowUser(@"flyte"));
|
||||||
|
|
||||||
AddStep("Hide", profile.Hide);
|
AddStep("Hide", profile.Hide);
|
||||||
AddStep("Show without reload", profile.Show);
|
AddStep("Show without reload", profile.Show);
|
||||||
}
|
}
|
||||||
|
@ -15,11 +15,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class HoverSampleDebounceComponent : CompositeDrawable
|
public abstract class HoverSampleDebounceComponent : CompositeDrawable
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// Length of debounce for hover sound playback, in milliseconds.
|
|
||||||
/// </summary>
|
|
||||||
public double HoverDebounceTime { get; } = 20;
|
|
||||||
|
|
||||||
private Bindable<double?> lastPlaybackTime;
|
private Bindable<double?> lastPlaybackTime;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -34,7 +29,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
if (e.HasAnyButtonPressed)
|
if (e.HasAnyButtonPressed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= OsuGameBase.SAMPLE_DEBOUNCE_TIME;
|
||||||
|
|
||||||
if (enoughTimePassedSinceLastPlayback)
|
if (enoughTimePassedSinceLastPlayback)
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ using osu.Framework.Audio;
|
|||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
@ -28,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, SessionStatics statics)
|
private void load(AudioManager audio)
|
||||||
{
|
{
|
||||||
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
|
sampleHover = audio.Samples.Get($@"UI/{SampleSet.GetDescription()}-hover")
|
||||||
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");
|
?? audio.Samples.Get($@"UI/{HoverSampleSet.Default.GetDescription()}-hover");
|
||||||
|
@ -8,15 +8,47 @@ namespace osu.Game.Online.API.Requests
|
|||||||
{
|
{
|
||||||
public class GetUserRequest : APIRequest<User>
|
public class GetUserRequest : APIRequest<User>
|
||||||
{
|
{
|
||||||
private readonly long? userId;
|
private readonly string lookup;
|
||||||
public readonly RulesetInfo Ruleset;
|
public readonly RulesetInfo Ruleset;
|
||||||
|
private readonly LookupType lookupType;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the currently logged-in user.
|
||||||
|
/// </summary>
|
||||||
|
public GetUserRequest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets a user from their ID.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user to get.</param>
|
||||||
|
/// <param name="ruleset">The ruleset to get the user's info for.</param>
|
||||||
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
|
public GetUserRequest(long? userId = null, RulesetInfo ruleset = null)
|
||||||
{
|
{
|
||||||
this.userId = userId;
|
lookup = userId.ToString();
|
||||||
|
lookupType = LookupType.Id;
|
||||||
Ruleset = ruleset;
|
Ruleset = ruleset;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Target => userId.HasValue ? $@"users/{userId}/{Ruleset?.ShortName}" : $@"me/{Ruleset?.ShortName}";
|
/// <summary>
|
||||||
|
/// Gets a user from their username.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">The user to get.</param>
|
||||||
|
/// <param name="ruleset">The ruleset to get the user's info for.</param>
|
||||||
|
public GetUserRequest(string username = null, RulesetInfo ruleset = null)
|
||||||
|
{
|
||||||
|
lookup = username;
|
||||||
|
lookupType = LookupType.Username;
|
||||||
|
Ruleset = ruleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override string Target => lookup != null ? $@"users/{lookup}/{Ruleset?.ShortName}?k={lookupType.ToString().ToLower()}" : $@"me/{Ruleset?.ShortName}";
|
||||||
|
|
||||||
|
private enum LookupType
|
||||||
|
{
|
||||||
|
Id,
|
||||||
|
Username
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,6 +333,9 @@ namespace osu.Game
|
|||||||
case LinkAction.OpenUserProfile:
|
case LinkAction.OpenUserProfile:
|
||||||
if (int.TryParse(link.Argument, out int userId))
|
if (int.TryParse(link.Argument, out int userId))
|
||||||
ShowUser(userId);
|
ShowUser(userId);
|
||||||
|
else
|
||||||
|
ShowUser(link.Argument);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LinkAction.OpenWiki:
|
case LinkAction.OpenWiki:
|
||||||
@ -380,6 +383,12 @@ namespace osu.Game
|
|||||||
/// <param name="userId">The user to display.</param>
|
/// <param name="userId">The user to display.</param>
|
||||||
public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
|
public void ShowUser(int userId) => waitForReady(() => userProfile, _ => userProfile.ShowUser(userId));
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Show a user's profile as an overlay.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">The user to display.</param>
|
||||||
|
public void ShowUser(string username) => waitForReady(() => userProfile, _ => userProfile.ShowUser(username));
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Show a beatmap's set as an overlay, displaying the given beatmap.
|
/// Show a beatmap's set as an overlay, displaying the given beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -56,6 +56,11 @@ namespace osu.Game
|
|||||||
|
|
||||||
public const int SAMPLE_CONCURRENCY = 6;
|
public const int SAMPLE_CONCURRENCY = 6;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Length of debounce (in milliseconds) for commonly occuring sample playbacks that could stack.
|
||||||
|
/// </summary>
|
||||||
|
public const int SAMPLE_DEBOUNCE_TIME = 20;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects.
|
/// The maximum volume at which audio tracks should playback. This can be set lower than 1 to create some head-room for sound effects.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -9,6 +9,7 @@ using osu.Game.Overlays.Notifications;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
@ -29,6 +30,9 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private FlowContainer<NotificationSection> sections;
|
private FlowContainer<NotificationSection> sections;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private AudioManager audio { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -98,14 +102,18 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private int runningDepth;
|
private int runningDepth;
|
||||||
|
|
||||||
private void notificationClosed() => updateCounts();
|
|
||||||
|
|
||||||
private readonly Scheduler postScheduler = new Scheduler();
|
private readonly Scheduler postScheduler = new Scheduler();
|
||||||
|
|
||||||
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
|
public override bool IsPresent => base.IsPresent || postScheduler.HasPendingTasks;
|
||||||
|
|
||||||
private bool processingPosts = true;
|
private bool processingPosts = true;
|
||||||
|
|
||||||
|
private double? lastSamplePlayback;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Post a new notification for display.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="notification">The notification to display.</param>
|
||||||
public void Post(Notification notification) => postScheduler.Add(() =>
|
public void Post(Notification notification) => postScheduler.Add(() =>
|
||||||
{
|
{
|
||||||
++runningDepth;
|
++runningDepth;
|
||||||
@ -124,11 +132,13 @@ namespace osu.Game.Overlays
|
|||||||
Show();
|
Show();
|
||||||
|
|
||||||
updateCounts();
|
updateCounts();
|
||||||
|
playDebouncedSample(notification.PopInSampleName);
|
||||||
});
|
});
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
if (processingPosts)
|
if (processingPosts)
|
||||||
postScheduler.Update();
|
postScheduler.Update();
|
||||||
}
|
}
|
||||||
@ -151,6 +161,24 @@ namespace osu.Game.Overlays
|
|||||||
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
this.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void notificationClosed()
|
||||||
|
{
|
||||||
|
updateCounts();
|
||||||
|
|
||||||
|
// this debounce is currently shared between popin/popout sounds, which means one could potentially not play when the user is expecting it.
|
||||||
|
// popout is constant across all notification types, and should therefore be handled using playback concurrency instead, but seems broken at the moment.
|
||||||
|
playDebouncedSample("UI/overlay-pop-out");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void playDebouncedSample(string sampleName)
|
||||||
|
{
|
||||||
|
if (lastSamplePlayback == null || Time.Current - lastSamplePlayback > OsuGameBase.SAMPLE_DEBOUNCE_TIME)
|
||||||
|
{
|
||||||
|
audio.Samples.Get(sampleName)?.Play();
|
||||||
|
lastSamplePlayback = Time.Current;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void updateCounts()
|
private void updateCounts()
|
||||||
{
|
{
|
||||||
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();
|
UnreadCount.Value = sections.Select(c => c.UnreadCount).Sum();
|
||||||
|
@ -3,20 +3,18 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Audio.Sample;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
using osu.Framework.Graphics.Effects;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osuTK;
|
|
||||||
using osuTK.Graphics;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Notifications
|
namespace osu.Game.Overlays.Notifications
|
||||||
{
|
{
|
||||||
@ -42,10 +40,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool DisplayOnTop => true;
|
public virtual bool DisplayOnTop => true;
|
||||||
|
|
||||||
private Sample samplePopIn;
|
public virtual string PopInSampleName => "UI/notification-pop-in";
|
||||||
private Sample samplePopOut;
|
|
||||||
protected virtual string PopInSampleName => "UI/notification-pop-in";
|
|
||||||
protected virtual string PopOutSampleName => "UI/overlay-pop-out"; // TODO: replace with a unique sample?
|
|
||||||
|
|
||||||
protected NotificationLight Light;
|
protected NotificationLight Light;
|
||||||
private readonly CloseButton closeButton;
|
private readonly CloseButton closeButton;
|
||||||
@ -114,7 +109,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
closeButton = new CloseButton
|
closeButton = new CloseButton
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Action = () => Close(),
|
Action = Close,
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
@ -127,13 +122,6 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(AudioManager audio)
|
|
||||||
{
|
|
||||||
samplePopIn = audio.Samples.Get(PopInSampleName);
|
|
||||||
samplePopOut = audio.Samples.Get(PopOutSampleName);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
closeButton.FadeIn(75);
|
closeButton.FadeIn(75);
|
||||||
@ -158,8 +146,6 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
samplePopIn?.Play();
|
|
||||||
|
|
||||||
this.FadeInFromZero(200);
|
this.FadeInFromZero(200);
|
||||||
NotificationContent.MoveToX(DrawSize.X);
|
NotificationContent.MoveToX(DrawSize.X);
|
||||||
NotificationContent.MoveToX(0, 500, Easing.OutQuint);
|
NotificationContent.MoveToX(0, 500, Easing.OutQuint);
|
||||||
@ -167,15 +153,12 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
|
|
||||||
public bool WasClosed;
|
public bool WasClosed;
|
||||||
|
|
||||||
public virtual void Close(bool playSound = true)
|
public virtual void Close()
|
||||||
{
|
{
|
||||||
if (WasClosed) return;
|
if (WasClosed) return;
|
||||||
|
|
||||||
WasClosed = true;
|
WasClosed = true;
|
||||||
|
|
||||||
if (playSound)
|
|
||||||
samplePopOut?.Play();
|
|
||||||
|
|
||||||
Closed?.Invoke();
|
Closed?.Invoke();
|
||||||
this.FadeOut(100);
|
this.FadeOut(100);
|
||||||
Expire();
|
Expire();
|
||||||
|
@ -110,12 +110,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
|
|
||||||
private void clearAll()
|
private void clearAll()
|
||||||
{
|
{
|
||||||
bool first = true;
|
notifications.Children.ForEach(c => c.Close());
|
||||||
notifications.Children.ForEach(c =>
|
|
||||||
{
|
|
||||||
c.Close(first);
|
|
||||||
first = false;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -150,12 +150,12 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
colourCancelled = colours.Red;
|
colourCancelled = colours.Red;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Close(bool playSound = true)
|
public override void Close()
|
||||||
{
|
{
|
||||||
switch (State)
|
switch (State)
|
||||||
{
|
{
|
||||||
case ProgressNotificationState.Cancelled:
|
case ProgressNotificationState.Cancelled:
|
||||||
base.Close(playSound);
|
base.Close();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ProgressNotificationState.Active:
|
case ProgressNotificationState.Active:
|
||||||
|
@ -7,7 +7,7 @@ namespace osu.Game.Overlays.Notifications
|
|||||||
{
|
{
|
||||||
public class SimpleErrorNotification : SimpleNotification
|
public class SimpleErrorNotification : SimpleNotification
|
||||||
{
|
{
|
||||||
protected override string PopInSampleName => "UI/error-notification-pop-in";
|
public override string PopInSampleName => "UI/error-notification-pop-in";
|
||||||
|
|
||||||
public SimpleErrorNotification()
|
public SimpleErrorNotification()
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,8 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public void ShowUser(int userId) => ShowUser(new User { Id = userId });
|
public void ShowUser(int userId) => ShowUser(new User { Id = userId });
|
||||||
|
|
||||||
|
public void ShowUser(string username) => ShowUser(new User { Username = username });
|
||||||
|
|
||||||
public void ShowUser(User user, bool fetchOnline = true)
|
public void ShowUser(User user, bool fetchOnline = true)
|
||||||
{
|
{
|
||||||
if (user == User.SYSTEM_USER)
|
if (user == User.SYSTEM_USER)
|
||||||
@ -116,7 +118,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
if (fetchOnline)
|
if (fetchOnline)
|
||||||
{
|
{
|
||||||
userReq = new GetUserRequest(user.Id);
|
userReq = user.Id > 1 ? new GetUserRequest(user.Id) : new GetUserRequest(user.Username);
|
||||||
userReq.Success += userLoadComplete;
|
userReq.Success += userLoadComplete;
|
||||||
API.Queue(userReq);
|
API.Queue(userReq);
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@ using osu.Framework.Extensions.EnumExtensions;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Extensions;
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Rulesets.Filter;
|
using osu.Game.Rulesets.Filter;
|
||||||
|
using osu.Game.Screens.Edit.Setup;
|
||||||
using osu.Game.Screens.Ranking.Statistics;
|
using osu.Game.Screens.Ranking.Statistics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets
|
namespace osu.Game.Rulesets
|
||||||
@ -315,5 +316,11 @@ namespace osu.Game.Rulesets
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
public virtual IRulesetFilterCriteria CreateRulesetFilterCriteria() => null;
|
public virtual IRulesetFilterCriteria CreateRulesetFilterCriteria() => null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Can be overridden to add a ruleset-specific section to the editor beatmap setup screen.
|
||||||
|
/// </summary>
|
||||||
|
[CanBeNull]
|
||||||
|
public virtual RulesetSetupSection CreateEditorSetupSection() => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
20
osu.Game/Screens/Edit/Setup/RulesetSetupSection.cs
Normal file
20
osu.Game/Screens/Edit/Setup/RulesetSetupSection.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 osu.Framework.Localisation;
|
||||||
|
using osu.Game.Rulesets;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Edit.Setup
|
||||||
|
{
|
||||||
|
public abstract class RulesetSetupSection : SetupSection
|
||||||
|
{
|
||||||
|
public sealed override LocalisableString Title => $"Ruleset ({rulesetInfo.Name})";
|
||||||
|
|
||||||
|
private readonly RulesetInfo rulesetInfo;
|
||||||
|
|
||||||
|
protected RulesetSetupSection(RulesetInfo rulesetInfo)
|
||||||
|
{
|
||||||
|
this.rulesetInfo = rulesetInfo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -10,7 +11,7 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
public class SetupScreen : EditorRoundedScreen
|
public class SetupScreen : EditorRoundedScreen
|
||||||
{
|
{
|
||||||
[Cached]
|
[Cached]
|
||||||
private SectionsContainer<SetupSection> sections = new SectionsContainer<SetupSection>();
|
private SectionsContainer<SetupSection> sections { get; } = new SetupScreenSectionsContainer();
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
private SetupScreenHeader header = new SetupScreenHeader();
|
private SetupScreenHeader header = new SetupScreenHeader();
|
||||||
@ -21,24 +22,27 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(EditorBeatmap beatmap)
|
||||||
{
|
{
|
||||||
AddRange(new Drawable[]
|
var sectionsEnumerable = new List<SetupSection>
|
||||||
{
|
|
||||||
sections = new SetupScreenSectionsContainer
|
|
||||||
{
|
|
||||||
FixedHeader = header,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Children = new SetupSection[]
|
|
||||||
{
|
{
|
||||||
new ResourcesSection(),
|
new ResourcesSection(),
|
||||||
new MetadataSection(),
|
new MetadataSection(),
|
||||||
new DifficultySection(),
|
new DifficultySection(),
|
||||||
new ColoursSection(),
|
new ColoursSection(),
|
||||||
new DesignSection(),
|
new DesignSection(),
|
||||||
}
|
};
|
||||||
},
|
|
||||||
});
|
var rulesetSpecificSection = beatmap.BeatmapInfo.Ruleset?.CreateInstance()?.CreateEditorSetupSection();
|
||||||
|
if (rulesetSpecificSection != null)
|
||||||
|
sectionsEnumerable.Add(rulesetSpecificSection);
|
||||||
|
|
||||||
|
Add(sections.With(s =>
|
||||||
|
{
|
||||||
|
s.RelativeSizeAxes = Axes.Both;
|
||||||
|
s.ChildrenEnumerable = sectionsEnumerable;
|
||||||
|
s.FixedHeader = header;
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SetupScreenSectionsContainer : SectionsContainer<SetupSection>
|
private class SetupScreenSectionsContainer : SectionsContainer<SetupSection>
|
||||||
|
@ -12,9 +12,9 @@ using osuTK;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Setup
|
namespace osu.Game.Screens.Edit.Setup
|
||||||
{
|
{
|
||||||
internal abstract class SetupSection : Container
|
public abstract class SetupSection : Container
|
||||||
{
|
{
|
||||||
private readonly FillFlowContainer flow;
|
private FillFlowContainer flow;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to align some of the child <see cref="LabelledDrawable{T}"/>s together to achieve a grid-like look.
|
/// Used to align some of the child <see cref="LabelledDrawable{T}"/>s together to achieve a grid-like look.
|
||||||
@ -31,7 +31,8 @@ namespace osu.Game.Screens.Edit.Setup
|
|||||||
|
|
||||||
public abstract LocalisableString Title { get; }
|
public abstract LocalisableString Title { get; }
|
||||||
|
|
||||||
protected SetupSection()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Loading…
Reference in New Issue
Block a user