1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:42:56 +08:00

Merge branch 'master' into song_select_nullability

This commit is contained in:
Dean Herbert 2023-01-15 22:44:13 +09:00 committed by GitHub
commit c5775aa452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
110 changed files with 707 additions and 824 deletions

View File

@ -188,7 +188,8 @@ namespace osu.Game.Rulesets.Catch.Edit
if (EditorBeatmap.PlacementObject.Value is JuiceStream)
{
// Juice stream path is not subject to snapping.
return null;
if (BlueprintContainer.CurrentPlacement.PlacementActive is PlacementBlueprint.PlacementState.Active)
return null;
}
double timeAtCursor = ((CatchPlayfield)Playfield).TimeAtScreenSpacePosition(inputManager.CurrentState.Mouse.Position);

View File

@ -75,6 +75,8 @@ namespace osu.Game.Tests.Chat
return false;
};
});
AddUntilStep("wait for notifications client", () => channelManager.NotificationsConnected);
}
[Test]

View File

@ -73,16 +73,6 @@ namespace osu.Game.Tests.Gameplay
}
[Test]
[FlakyTest]
/*
* Fail rate around 0.15%
*
* TearDown : osu.Framework.Testing.Drawables.Steps.AssertButton+TracedException : gameplay clock time = 2500
* --TearDown
* at osu.Framework.Threading.ScheduledDelegate.RunTaskInternal()
* at osu.Framework.Threading.Scheduler.Update()
* at osu.Framework.Graphics.Drawable.UpdateSubTree()
*/
public void TestSeekPerformsInGameplayTime(
[Values(1.0, 0.5, 2.0)] double clockRate,
[Values(0.0, 200.0, -200.0)] double userOffset,
@ -92,6 +82,9 @@ namespace osu.Game.Tests.Gameplay
ClockBackedTestWorkingBeatmap working = null;
GameplayClockContainer gameplayClockContainer = null;
// ReSharper disable once NotAccessedVariable
BindableDouble trackAdjustment = null; // keeping a reference for track adjustment
if (setAudioOffsetBeforeConstruction)
AddStep($"preset audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));
@ -103,16 +96,16 @@ namespace osu.Game.Tests.Gameplay
gameplayClockContainer.Reset(startClock: !whileStopped);
});
AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate)));
AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, trackAdjustment = new BindableDouble(clockRate)));
if (!setAudioOffsetBeforeConstruction)
AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));
AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500));
AddStep("gameplay clock time = 2500", () => Assert.AreEqual(gameplayClockContainer.CurrentTime, 2500, 10f));
AddAssert("gameplay clock time = 2500", () => gameplayClockContainer.CurrentTime, () => Is.EqualTo(2500).Within(10f));
AddStep("seek to 10000", () => gameplayClockContainer.Seek(10000));
AddStep("gameplay clock time = 10000", () => Assert.AreEqual(gameplayClockContainer.CurrentTime, 10000, 10f));
AddAssert("gameplay clock time = 10000", () => gameplayClockContainer.CurrentTime, () => Is.EqualTo(10000).Within(10f));
}
protected override void Dispose(bool isDisposing)

View File

@ -12,6 +12,7 @@ using System.Threading;
using NUnit.Framework;
using osu.Framework.Extensions;
using osu.Framework.IO.Stores;
using osu.Framework.Logging;
using osu.Framework.Testing;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
@ -93,10 +94,12 @@ namespace osu.Game.Tests.Resources
{
// Create random metadata, then we can check if sorting works based on these
Artist = "Some Artist " + RNG.Next(0, 9),
Title = $"Some Song (set id {setId}) {Guid.NewGuid()}",
Title = $"Some Song (set id {setId:000}) {Guid.NewGuid()}",
Author = { Username = "Some Guy " + RNG.Next(0, 9) },
};
Logger.Log($"🛠️ Generating beatmap set \"{metadata}\" for test consumption.");
var beatmapSet = new BeatmapSetInfo
{
OnlineID = setId,

View File

@ -181,7 +181,8 @@ namespace osu.Game.Tests.Visual.Gameplay
AddUntilStep("wait for fail", () => Player.GameplayState.HasFailed);
AddStep("exit", () => Player.Exit());
AddAssert("ensure failing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == false);
AddUntilStep("wait for submission", () => Player.SubmittedScore != null);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Passed == false);
}
[Test]
@ -209,7 +210,9 @@ namespace osu.Game.Tests.Visual.Gameplay
addFakeHit();
AddStep("exit", () => Player.Exit());
AddAssert("ensure failing submission", () => Player.SubmittedScore?.ScoreInfo.Passed == false);
AddUntilStep("wait for submission", () => Player.SubmittedScore != null);
AddAssert("ensure failing submission", () => Player.SubmittedScore.ScoreInfo.Passed == false);
}
[Test]

View File

@ -5,12 +5,12 @@ using osu.Game.Overlays.Profile.Sections.Kudosu;
using System.Collections.Generic;
using System;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics;
using osu.Game.Online.API.Requests.Responses;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Overlays;
namespace osu.Game.Tests.Visual.Online
{
@ -18,6 +18,9 @@ namespace osu.Game.Tests.Visual.Online
{
private readonly Box background;
[Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Pink);
public TestSceneKudosuHistory()
{
FillFlowContainer<DrawableKudosuHistoryItem> content;
@ -42,9 +45,9 @@ namespace osu.Game.Tests.Visual.Online
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load()
{
background.Colour = colours.GreySeaFoam;
background.Colour = colourProvider.Background4;
}
private readonly IEnumerable<APIKudosuHistory> items = new[]

View File

@ -86,12 +86,21 @@ namespace osu.Game.Tests.Visual.Online
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
JoinDate = DateTimeOffset.Now.AddDays(-1),
LastVisit = DateTimeOffset.Now,
ProfileOrder = new[] { "me" },
Groups = new[]
{
new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" },
new APIUserGroup { Colour = "#A347EB", ShortName = "BN", Name = "Beatmap Nominators", Playmodes = new[] { "osu", "taiko" } }
},
ProfileOrder = new[]
{
@"me",
@"recent_activity",
@"beatmaps",
@"historical",
@"kudosu",
@"top_ranks",
@"medals"
},
Statistics = new UserStatistics
{
IsRanked = true,
@ -128,7 +137,12 @@ namespace osu.Game.Tests.Visual.Online
Title = "osu!volunteer",
Colour = "ff0000",
Achievements = Array.Empty<APIUserAchievement>(),
PlayMode = "osu"
PlayMode = "osu",
Kudosu = new APIUser.KudosuCount
{
Available = 10,
Total = 50
}
};
}
}

View File

@ -16,7 +16,9 @@ using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Taiko;
using osu.Game.Screens.Select;
using osu.Game.Screens.Select.Carousel;
using osu.Game.Screens.Select.Filter;
@ -926,10 +928,7 @@ namespace osu.Game.Tests.Visual.SongSelect
// 10 sets that go osu! -> taiko -> catch -> osu! -> ...
for (int i = 0; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 3);
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { rulesetInfo }));
}
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { getRuleset(i) }));
// Sort mode is important to keep the ruleset order
loadBeatmaps(sets, () => new FilterCriteria { Sort = SortMode.Title });
@ -937,13 +936,29 @@ namespace osu.Game.Tests.Visual.SongSelect
for (int i = 1; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 3);
var rulesetInfo = getRuleset(i % 3);
AddStep($"Set ruleset to {rulesetInfo.ShortName}", () =>
{
carousel.Filter(new FilterCriteria { Ruleset = rulesetInfo, Sort = SortMode.Title }, false);
});
waitForSelection(i + 1, 1);
}
static RulesetInfo getRuleset(int index)
{
switch (index % 3)
{
default:
return new OsuRuleset().RulesetInfo;
case 1:
return new TaikoRuleset().RulesetInfo;
case 2:
return new CatchRuleset().RulesetInfo;
}
}
}
[Test]
@ -953,10 +968,7 @@ namespace osu.Game.Tests.Visual.SongSelect
// 10 sets that go taiko, osu!, osu!, osu!, taiko, osu!, osu!, osu!, ...
for (int i = 0; i < 10; i++)
{
var rulesetInfo = rulesets.AvailableRulesets.ElementAt(i % 4 == 0 ? 1 : 0);
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { rulesetInfo }));
}
sets.Add(TestResources.CreateTestBeatmapSetInfo(5, new[] { getRuleset(i) }));
// Sort mode is important to keep the ruleset order
loadBeatmaps(sets, () => new FilterCriteria { Sort = SortMode.Title });
@ -974,6 +986,18 @@ namespace osu.Game.Tests.Visual.SongSelect
carousel.Filter(new FilterCriteria { Sort = SortMode.Title }, false);
});
}
static RulesetInfo getRuleset(int index)
{
switch (index % 4)
{
case 0:
return new TaikoRuleset().RulesetInfo;
default:
return new OsuRuleset().RulesetInfo;
}
}
}
private void loadBeatmaps(List<BeatmapSetInfo> beatmapSets = null, Func<FilterCriteria> initialCriteria = null, Action<BeatmapCarousel> carouselAdjust = null, int? count = null,

View File

@ -1,13 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
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.UserInterface;
using osu.Framework.Localisation;
using osu.Framework.Testing;
using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
using osu.Game.Overlays.Comments;
using osuTK;
@ -20,8 +23,8 @@ namespace osu.Game.Tests.Visual.UserInterface
[Cached]
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
private TestCommentEditor commentEditor;
private TestCancellableCommentEditor cancellableCommentEditor;
private TestCommentEditor commentEditor = null!;
private TestCancellableCommentEditor cancellableCommentEditor = null!;
[SetUp]
public void SetUp() => Schedule(() =>
@ -45,15 +48,16 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click on text box", () =>
{
InputManager.MoveMouseTo(commentEditor);
InputManager.MoveMouseTo(commentEditor.ChildrenOfType<TextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("enter text", () => commentEditor.Current.Value = "text");
AddStep("press Enter", () => InputManager.Key(Key.Enter));
AddUntilStep("button is loading", () => commentEditor.IsSpinnerShown);
AddAssert("text committed", () => commentEditor.CommittedText == "text");
AddAssert("button is loading", () => commentEditor.IsLoading);
AddUntilStep("button is not loading", () => !commentEditor.IsSpinnerShown);
}
[Test]
@ -61,14 +65,14 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click on text box", () =>
{
InputManager.MoveMouseTo(commentEditor);
InputManager.MoveMouseTo(commentEditor.ChildrenOfType<TextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("press Enter", () => InputManager.Key(Key.Enter));
AddAssert("no text committed", () => commentEditor.CommittedText == null);
AddAssert("button is not loading", () => !commentEditor.IsLoading);
AddAssert("button is not loading", () => !commentEditor.IsSpinnerShown);
AddAssert("no text committed", () => commentEditor.CommittedText.Length == 0);
}
[Test]
@ -76,7 +80,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click on text box", () =>
{
InputManager.MoveMouseTo(commentEditor);
InputManager.MoveMouseTo(commentEditor.ChildrenOfType<TextBox>().Single());
InputManager.Click(MouseButton.Left);
});
AddStep("enter text", () => commentEditor.Current.Value = "some other text");
@ -87,8 +91,9 @@ namespace osu.Game.Tests.Visual.UserInterface
InputManager.Click(MouseButton.Left);
});
AddUntilStep("button is loading", () => commentEditor.IsSpinnerShown);
AddAssert("text committed", () => commentEditor.CommittedText == "some other text");
AddAssert("button is loading", () => commentEditor.IsLoading);
AddUntilStep("button is not loading", () => !commentEditor.IsSpinnerShown);
}
[Test]
@ -96,7 +101,7 @@ namespace osu.Game.Tests.Visual.UserInterface
{
AddStep("click cancel button", () =>
{
InputManager.MoveMouseTo(cancellableCommentEditor.ButtonsContainer);
InputManager.MoveMouseTo(cancellableCommentEditor.ButtonsContainer[1]);
InputManager.Click(MouseButton.Left);
});
@ -108,28 +113,27 @@ namespace osu.Game.Tests.Visual.UserInterface
public new Bindable<string> Current => base.Current;
public new FillFlowContainer ButtonsContainer => base.ButtonsContainer;
public string CommittedText { get; private set; }
public string CommittedText { get; private set; } = string.Empty;
public TestCommentEditor()
{
OnCommit = onCommit;
}
public bool IsSpinnerShown => this.ChildrenOfType<LoadingSpinner>().Single().IsPresent;
private void onCommit(string value)
protected override void OnCommit(string value)
{
ShowLoadingSpinner = true;
CommittedText = value;
Scheduler.AddDelayed(() => IsLoading = false, 1000);
Scheduler.AddDelayed(() => ShowLoadingSpinner = false, 1000);
}
protected override string FooterText => @"Footer text. And it is pretty long. Cool.";
protected override string CommitButtonText => @"Commit";
protected override string TextBoxPlaceholder => @"This text box is empty";
protected override LocalisableString FooterText => @"Footer text. And it is pretty long. Cool.";
protected override LocalisableString CommitButtonText => @"Commit";
protected override LocalisableString TextBoxPlaceholder => @"This text box is empty";
}
private partial class TestCancellableCommentEditor : CancellableCommentEditor
{
public new FillFlowContainer ButtonsContainer => base.ButtonsContainer;
protected override string FooterText => @"Wow, another one. Sicc";
protected override LocalisableString FooterText => @"Wow, another one. Sicc";
public bool Cancelled { get; private set; }
@ -138,8 +142,12 @@ namespace osu.Game.Tests.Visual.UserInterface
OnCancel = () => Cancelled = true;
}
protected override string CommitButtonText => @"Save";
protected override string TextBoxPlaceholder => @"Multiline textboxes soon";
protected override void OnCommit(string text)
{
}
protected override LocalisableString CommitButtonText => @"Save";
protected override LocalisableString TextBoxPlaceholder => @"Multiline textboxes soon";
}
}
}

View File

@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.UserInterface
protected override OverlayTitle CreateTitle() => new TestTitle();
protected override Drawable CreateTitleContent() => new OverlayRulesetSelector();
protected override Drawable CreateTabControlContent() => new OverlayRulesetSelector();
public TestStringTabControlHeader()
{

View File

@ -15,10 +15,52 @@ namespace osu.Game.Localisation
public static LocalisableString HeaderTitle => new TranslatableString(getKey(@"header_title"), @"notifications");
/// <summary>
/// "waiting for 'ya"
/// "waiting for &#39;ya"
/// </summary>
public static LocalisableString HeaderDescription => new TranslatableString(getKey(@"header_description"), @"waiting for 'ya");
private static string getKey(string key) => $"{prefix}:{key}";
/// <summary>
/// "Running Tasks"
/// </summary>
public static LocalisableString RunningTasks => new TranslatableString(getKey(@"running_tasks"), @"Running Tasks");
/// <summary>
/// "Clear All"
/// </summary>
public static LocalisableString ClearAll => new TranslatableString(getKey(@"clear_all"), @"Clear All");
/// <summary>
/// "Cancel All"
/// </summary>
public static LocalisableString CancelAll => new TranslatableString(getKey(@"cancel_all"), @"Cancel All");
/// <summary>
/// "Your battery level is low! Charge your device to prevent interruptions during gameplay."
/// </summary>
public static LocalisableString BatteryLow => new TranslatableString(getKey(@"battery_low"), @"Your battery level is low! Charge your device to prevent interruptions during gameplay.");
/// <summary>
/// "Your game volume is too low to hear anything! Click here to restore it."
/// </summary>
public static LocalisableString GameVolumeTooLow => new TranslatableString(getKey(@"game_volume_too_low"), @"Your game volume is too low to hear anything! Click here to restore it.");
/// <summary>
/// "The current ruleset doesn&#39;t have an autoplay mod available!"
/// </summary>
public static LocalisableString NoAutoplayMod => new TranslatableString(getKey(@"no_autoplay_mod"), @"The current ruleset doesn't have an autoplay mod available!");
/// <summary>
/// "osu! doesn&#39;t seem to be able to play audio correctly.\n\nPlease try changing your audio device to a working setting."
/// </summary>
public static LocalisableString AudioPlaybackIssue => new TranslatableString(getKey(@"audio_playback_issue"),
@"osu! doesn't seem to be able to play audio correctly.\n\nPlease try changing your audio device to a working setting.");
/// <summary>
/// "The score overlay is currently disabled. You can toggle this by pressing {0}."
/// </summary>
public static LocalisableString ScoreOverlayDisabled(LocalisableString arg0) => new TranslatableString(getKey(@"score_overlay_disabled"),
@"The score overlay is currently disabled. You can toggle this by pressing {0}.", arg0);
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -329,12 +329,35 @@ namespace osu.Game.Online.API
{
try
{
return JObject.Parse(req.GetResponseString().AsNonNull()).SelectToken("form_error", true).AsNonNull().ToObject<RegistrationRequest.RegistrationRequestErrors>();
return JObject.Parse(req.GetResponseString().AsNonNull()).SelectToken(@"form_error", true).AsNonNull().ToObject<RegistrationRequest.RegistrationRequestErrors>();
}
catch
{
// if we couldn't deserialize the error message let's throw the original exception outwards.
e.Rethrow();
try
{
// attempt to parse a non-form error message
var response = JObject.Parse(req.GetResponseString().AsNonNull());
string redirect = (string)response.SelectToken(@"url", true);
string message = (string)response.SelectToken(@"error", false);
if (!string.IsNullOrEmpty(redirect))
{
return new RegistrationRequest.RegistrationRequestErrors
{
Redirect = redirect,
Message = message,
};
}
// if we couldn't deserialize the error message let's throw the original exception outwards.
e.Rethrow();
}
catch
{
// if we couldn't deserialize the error message let's throw the original exception outwards.
e.Rethrow();
}
}
}

View File

@ -1,17 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using Newtonsoft.Json;
namespace osu.Game.Online.API
{
public class RegistrationRequest : OsuWebRequest
{
internal string Username;
internal string Email;
internal string Password;
internal string Username = string.Empty;
internal string Email = string.Empty;
internal string Password = string.Empty;
protected override void PrePerform()
{
@ -24,18 +23,28 @@ namespace osu.Game.Online.API
public class RegistrationRequestErrors
{
public UserErrors User;
/// <summary>
/// An optional error message.
/// </summary>
public string? Message;
/// <summary>
/// An optional URL which the user should be directed towards to complete registration.
/// </summary>
public string? Redirect;
public UserErrors? User;
public class UserErrors
{
[JsonProperty("username")]
public string[] Username;
public string[] Username = Array.Empty<string>();
[JsonProperty("user_email")]
public string[] Email;
public string[] Email = Array.Empty<string>();
[JsonProperty("password")]
public string[] Password;
public string[] Password = Array.Empty<string>();
}
}
}

View File

@ -8,7 +8,7 @@ namespace osu.Game.Online.API.Requests.Responses
public class APIUserGroup
{
[JsonProperty(@"colour")]
public string Colour { get; set; } = null!;
public string? Colour { get; set; }
[JsonProperty(@"has_listing")]
public bool HasListings { get; set; }

View File

@ -64,6 +64,11 @@ namespace osu.Game.Online.Chat
/// </summary>
public IBindableList<Channel> AvailableChannels => availableChannels;
/// <summary>
/// Whether the client responsible for channel notifications is connected.
/// </summary>
public bool NotificationsConnected => connector.IsConnected.Value;
private readonly IAPIProvider api;
private readonly NotificationsClientConnector connector;

View File

@ -47,6 +47,9 @@ namespace osu.Game.Overlays.AccountCreation
[Resolved]
private GameHost host { get; set; }
[Resolved]
private OsuGame game { get; set; }
[BackgroundDependencyLoader]
private void load()
{
@ -194,9 +197,20 @@ namespace osu.Game.Overlays.AccountCreation
{
if (errors != null)
{
usernameDescription.AddErrors(errors.User.Username);
emailAddressDescription.AddErrors(errors.User.Email);
passwordDescription.AddErrors(errors.User.Password);
if (errors.User != null)
{
usernameDescription.AddErrors(errors.User.Username);
emailAddressDescription.AddErrors(errors.User.Email);
passwordDescription.AddErrors(errors.User.Password);
}
if (!string.IsNullOrEmpty(errors.Redirect))
{
if (!string.IsNullOrEmpty(errors.Message))
passwordDescription.AddErrors(new[] { errors.Message });
game.OpenUrlExternally($"{errors.Redirect}?username={usernameTextBox.Text}&email={emailTextBox.Text}");
}
}
else
{

View File

@ -6,6 +6,7 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Extensions;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
@ -28,7 +29,13 @@ namespace osu.Game.Overlays.BeatmapListing
AddTabItem(new RulesetFilterTabItemAny());
foreach (var r in rulesets.AvailableRulesets)
{
// Don't display non-legacy rulesets
if (!r.IsLegacyRuleset())
continue;
AddItem(r);
}
}
}

View File

@ -8,6 +8,7 @@ using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Framework.Localisation;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Rulesets;
@ -16,7 +17,7 @@ using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapSet
{
public partial class BeatmapSetHeader : OverlayHeader
public partial class BeatmapSetHeader : TabControlOverlayHeader<BeatmapSetTabs>
{
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
@ -46,7 +47,7 @@ namespace osu.Game.Overlays.BeatmapSet
BeatmapSet = { BindTarget = BeatmapSet }
};
protected override Drawable CreateTitleContent() => RulesetSelector = new BeatmapRulesetSelector
protected override Drawable CreateTabControlContent() => RulesetSelector = new BeatmapRulesetSelector
{
Current = ruleset
};
@ -62,4 +63,10 @@ namespace osu.Game.Overlays.BeatmapSet
}
}
}
public enum BeatmapSetTabs
{
[LocalisableDescription(typeof(LayoutStrings), nameof(LayoutStrings.HeaderBeatmapsetsShow))]
Info,
}
}

View File

@ -1,76 +1,24 @@
// 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.
#nullable disable
using System;
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Comments
{
public abstract partial class CancellableCommentEditor : CommentEditor
{
public Action OnCancel;
public Action? OnCancel;
[BackgroundDependencyLoader]
private void load()
{
ButtonsContainer.Add(new CancelButton
ButtonsContainer.Add(new EditorButton
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Action = () => OnCancel?.Invoke()
Action = () => OnCancel?.Invoke(),
Text = CommonStrings.ButtonsCancel,
});
}
private partial class CancelButton : OsuHoverContainer
{
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private readonly Box background;
public CancelButton()
: base(HoverSampleSet.Button)
{
AutoSizeAxes = Axes.Both;
Child = new CircularContainer
{
Masking = true,
Height = 25,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both
},
new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 },
Text = CommonStrings.ButtonsCancel
}
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Light4;
HoverColour = colourProvider.Light3;
}
}
}
}

View File

@ -1,22 +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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics.Containers;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Sprites;
using osuTK.Graphics;
using osu.Game.Graphics.UserInterface;
using System.Collections.Generic;
using System;
using osu.Game.Graphics.UserInterfaceV2;
using osuTK;
using osu.Framework.Bindables;
using osuTK.Graphics;
namespace osu.Game.Overlays.Comments
{
@ -24,26 +22,32 @@ namespace osu.Game.Overlays.Comments
{
private const int side_padding = 8;
public Action<string> OnCommit;
protected abstract LocalisableString FooterText { get; }
public bool IsLoading
protected abstract LocalisableString CommitButtonText { get; }
protected abstract LocalisableString TextBoxPlaceholder { get; }
protected FillFlowContainer ButtonsContainer { get; private set; } = null!;
protected readonly Bindable<string> Current = new Bindable<string>(string.Empty);
private RoundedButton commitButton = null!;
private LoadingSpinner loadingSpinner = null!;
protected bool ShowLoadingSpinner
{
get => commitButton.IsLoading;
set => commitButton.IsLoading = value;
set
{
if (value)
loadingSpinner.Show();
else
loadingSpinner.Hide();
updateCommitButtonState();
}
}
protected abstract string FooterText { get; }
protected abstract string CommitButtonText { get; }
protected abstract string TextBoxPlaceholder { get; }
protected FillFlowContainer ButtonsContainer { get; private set; }
protected readonly Bindable<string> Current = new Bindable<string>();
private CommitButton commitButton;
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
@ -79,7 +83,7 @@ namespace osu.Game.Overlays.Comments
},
new Container
{
Name = "Footer",
Name = @"Footer",
RelativeSizeAxes = Axes.X,
Height = 35,
Padding = new MarginPadding { Horizontal = side_padding },
@ -92,54 +96,64 @@ namespace osu.Game.Overlays.Comments
Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold),
Text = FooterText
},
ButtonsContainer = new FillFlowContainer
new FillFlowContainer
{
Name = "Buttons",
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Child = commitButton = new CommitButton(CommitButtonText)
Children = new Drawable[]
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Action = () =>
ButtonsContainer = new FillFlowContainer
{
OnCommit?.Invoke(Current.Value);
Current.Value = string.Empty;
}
Name = @"Buttons",
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Child = commitButton = new EditorButton
{
Text = CommitButtonText,
Action = () => OnCommit(Current.Value)
}
},
loadingSpinner = new LoadingSpinner
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Size = new Vector2(18),
},
}
}
},
}
}
}
}
});
textBox.OnCommit += (_, _) =>
{
if (commitButton.IsBlocked.Value)
return;
commitButton.TriggerClick();
};
textBox.OnCommit += (_, _) => commitButton.TriggerClick();
}
protected override void LoadComplete()
{
base.LoadComplete();
Current.BindValueChanged(text => commitButton.IsBlocked.Value = string.IsNullOrEmpty(text.NewValue), true);
Current.BindValueChanged(_ => updateCommitButtonState(), true);
}
protected abstract void OnCommit(string text);
private void updateCommitButtonState() =>
commitButton.Enabled.Value = loadingSpinner.State.Value == Visibility.Hidden && !string.IsNullOrEmpty(Current.Value);
private partial class EditorTextBox : BasicTextBox
{
protected override float LeftRightPadding => side_padding;
protected override Color4 SelectionColour => Color4.Gray;
private OsuSpriteText placeholder;
private OsuSpriteText placeholder = null!;
public EditorTextBox()
{
@ -163,88 +177,26 @@ namespace osu.Game.Overlays.Comments
protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
{
AutoSizeAxes = Axes.Both,
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) },
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }
};
}
private partial class CommitButton : LoadingButton
protected partial class EditorButton : RoundedButton
{
private const int duration = 200;
public readonly BindableBool IsBlocked = new BindableBool();
public override bool PropagatePositionalInputSubTree => !IsBlocked.Value && base.PropagatePositionalInputSubTree;
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
private readonly string text;
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private OsuSpriteText drawableText;
private Box background;
private Box blockedBackground;
public CommitButton(string text)
public EditorButton()
{
this.text = text;
AutoSizeAxes = Axes.Both;
LoadingAnimationSize = new Vector2(10);
Width = 80;
Height = 25;
Anchor = Anchor.CentreRight;
Origin = Anchor.CentreRight;
}
[BackgroundDependencyLoader]
private void load()
protected override SpriteText CreateText()
{
IdleColour = colourProvider.Light4;
HoverColour = colourProvider.Light3;
blockedBackground.Colour = colourProvider.Background5;
var t = base.CreateText();
t.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12);
return t;
}
protected override void LoadComplete()
{
base.LoadComplete();
IsBlocked.BindValueChanged(onBlockedStateChanged, true);
}
private void onBlockedStateChanged(ValueChangedEvent<bool> isBlocked)
{
drawableText.FadeColour(isBlocked.NewValue ? colourProvider.Foreground1 : Color4.White, duration, Easing.OutQuint);
background.FadeTo(isBlocked.NewValue ? 0 : 1, duration, Easing.OutQuint);
}
protected override Drawable CreateContent() => new CircularContainer
{
Masking = true,
Height = 25,
AutoSizeAxes = Axes.X,
Children = new Drawable[]
{
blockedBackground = new Box
{
RelativeSizeAxes = Axes.Both
},
background = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0
},
drawableText = new OsuSpriteText
{
AlwaysPresent = true,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
Margin = new MarginPadding { Horizontal = 20 },
Text = text,
}
}
};
protected override void OnLoadStarted() => drawableText.FadeOut(duration, Easing.OutQuint);
protected override void OnLoadFinished() => drawableText.FadeIn(duration, Easing.OutQuint);
}
}
}

View File

@ -7,10 +7,10 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Users.Drawables;
using osuTK;
using osuTK.Graphics;
@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Login
{
public const float LABEL_LEFT_MARGIN = 20;
private readonly SpriteIcon statusIcon;
private readonly StatusIcon statusIcon;
public Color4 StatusColour
{
@ -101,11 +101,10 @@ namespace osu.Game.Overlays.Login
Icon.Size = new Vector2(14);
Icon.Margin = new MarginPadding(0);
Foreground.Add(statusIcon = new SpriteIcon
Foreground.Add(statusIcon = new StatusIcon
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.Regular.Circle,
Size = new Vector2(14),
});

View File

@ -92,8 +92,8 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X,
Children = new[]
{
new NotificationSection(AccountsStrings.NotificationsTitle, new[] { typeof(SimpleNotification) }, "Clear All"),
new NotificationSection(@"Running Tasks", new[] { typeof(ProgressNotification) }, @"Cancel All"),
new NotificationSection(AccountsStrings.NotificationsTitle, new[] { typeof(SimpleNotification) }, NotificationsStrings.ClearAll),
new NotificationSection(NotificationsStrings.RunningTasks, new[] { typeof(ProgressNotification) }, NotificationsStrings.CancelAll),
}
}
}

View File

@ -33,15 +33,15 @@ namespace osu.Game.Overlays.Notifications
public IEnumerable<Type> AcceptedNotificationTypes { get; }
private readonly string clearButtonText;
private readonly LocalisableString clearButtonText;
private readonly LocalisableString titleText;
public NotificationSection(LocalisableString title, IEnumerable<Type> acceptedNotificationTypes, string clearButtonText)
public NotificationSection(LocalisableString title, IEnumerable<Type> acceptedNotificationTypes, LocalisableString clearButtonText)
{
AcceptedNotificationTypes = acceptedNotificationTypes.ToArray();
this.clearButtonText = clearButtonText.ToUpperInvariant();
this.clearButtonText = clearButtonText.ToUpper();
titleText = title;
}

View File

@ -75,19 +75,11 @@ namespace osu.Game.Overlays
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new[]
Child = Title = CreateTitle().With(title =>
{
Title = CreateTitle().With(title =>
{
title.Anchor = Anchor.CentreLeft;
title.Origin = Anchor.CentreLeft;
}),
CreateTitleContent().With(content =>
{
content.Anchor = Anchor.CentreRight;
content.Origin = Anchor.CentreRight;
})
}
title.Anchor = Anchor.CentreLeft;
title.Origin = Anchor.CentreLeft;
}),
}
}
},
@ -112,12 +104,6 @@ namespace osu.Game.Overlays
[NotNull]
protected virtual Drawable CreateBackground() => Empty();
/// <summary>
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="OverlayTitle"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
/// </summary>
[NotNull]
protected virtual Drawable CreateTitleContent() => Empty();
protected abstract OverlayTitle CreateTitle();
}
}

View File

@ -13,6 +13,9 @@ namespace osu.Game.Overlays
{
public partial class OverlayRulesetSelector : RulesetSelector
{
// Since this component is used in online overlays and currently web-side doesn't support non-legacy rulesets, let's disable them for now.
protected override bool LegacyOnly => true;
public OverlayRulesetSelector()
{
AutoSizeAxes = Axes.Both;

View File

@ -3,26 +3,18 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Profile.Header.Components;
using osu.Game.Resources.Localisation.Web;
using osuTK;
namespace osu.Game.Overlays.Profile.Header
{
public partial class CentreHeaderContainer : CompositeDrawable
{
public readonly BindableBool DetailsVisible = new BindableBool(true);
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
private OverlinedInfoContainer hiddenDetailGlobal = null!;
private OverlinedInfoContainer hiddenDetailCountry = null!;
public CentreHeaderContainer()
{
Height = 60;
@ -31,15 +23,12 @@ namespace osu.Game.Overlays.Profile.Header
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Container<Drawable> hiddenDetailContainer;
Container<Drawable> expandedDetailContainer;
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background4
Colour = colourProvider.Background3
},
new FillFlowContainer
{
@ -66,20 +55,6 @@ namespace osu.Game.Overlays.Profile.Header
}
},
new Container
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Y,
Padding = new MarginPadding { Vertical = 10 },
Width = UserProfileOverlay.CONTENT_X_MARGIN,
Child = new ExpandDetailsButton
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
DetailsVisible = { BindTarget = DetailsVisible }
},
},
new Container
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
@ -94,7 +69,7 @@ namespace osu.Game.Overlays.Profile.Header
Size = new Vector2(40),
User = { BindTarget = User }
},
expandedDetailContainer = new Container
new Container
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
@ -107,47 +82,9 @@ namespace osu.Game.Overlays.Profile.Header
User = { BindTarget = User }
}
},
hiddenDetailContainer = new FillFlowContainer
{
Direction = FillDirection.Horizontal,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Width = 200,
AutoSizeAxes = Axes.Y,
Alpha = 0,
Spacing = new Vector2(10, 0),
Margin = new MarginPadding { Right = 50 },
Children = new[]
{
hiddenDetailGlobal = new OverlinedInfoContainer
{
Title = UsersStrings.ShowRankGlobalSimple,
LineColour = colourProvider.Highlight1
},
hiddenDetailCountry = new OverlinedInfoContainer
{
Title = UsersStrings.ShowRankCountrySimple,
LineColour = colourProvider.Highlight1
},
}
}
}
}
};
DetailsVisible.BindValueChanged(visible =>
{
hiddenDetailContainer.FadeTo(visible.NewValue ? 0 : 1, 200, Easing.OutQuint);
expandedDetailContainer.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
});
User.BindValueChanged(user => updateDisplay(user.NewValue?.User));
}
private void updateDisplay(APIUser? user)
{
hiddenDetailGlobal.Content = user?.Statistics?.GlobalRank?.ToLocalisableString("\\##,##0") ?? (LocalisableString)"-";
hiddenDetailCountry.Content = user?.Statistics?.CountryRank?.ToLocalisableString("\\##,##0") ?? (LocalisableString)"-";
}
}
}

View File

@ -62,7 +62,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
new OsuSpriteText
{
Text = group.ShortName,
Colour = Color4Extensions.FromHex(group.Colour),
Colour = Color4Extensions.FromHex(group.Colour ?? Colour4.White.ToHex()),
Shadow = false,
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true)
}

View File

@ -1,19 +1,17 @@
// 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.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class OverlinedInfoContainer : CompositeDrawable
public partial class ProfileValueDisplay : CompositeDrawable
{
private readonly Circle line;
private readonly OsuSpriteText title;
private readonly OsuSpriteText content;
@ -27,12 +25,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
set => content.Text = value;
}
public Color4 LineColour
{
set => line.Colour = value;
}
public OverlinedInfoContainer(bool big = false, int minimumWidth = 60)
public ProfileValueDisplay(bool big = false, int minimumWidth = 60)
{
AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer
@ -41,19 +34,13 @@ namespace osu.Game.Overlays.Profile.Header.Components
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
line = new Circle
{
RelativeSizeAxes = Axes.X,
Height = 2,
Margin = new MarginPadding { Bottom = 2 }
},
title = new OsuSpriteText
{
Font = OsuFont.GetFont(size: big ? 14 : 12, weight: FontWeight.Bold)
Font = OsuFont.GetFont(size: 12)
},
content = new OsuSpriteText
{
Font = OsuFont.GetFont(size: big ? 40 : 18, weight: FontWeight.Light)
Font = OsuFont.GetFont(size: big ? 30 : 20, weight: FontWeight.Light)
},
new Container // Add a minimum size to the FillFlowContainer
{
@ -62,5 +49,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
title.Colour = colourProvider.Content1;
content.Colour = colourProvider.Content2;
}
}
}

View File

@ -11,15 +11,15 @@ using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile.Header.Components
{
public partial class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip
public partial class TotalPlayTime : CompositeDrawable, IHasTooltip
{
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
public LocalisableString TooltipText { get; set; }
private OverlinedInfoContainer info = null!;
private ProfileValueDisplay info = null!;
public OverlinedTotalPlayTime()
public TotalPlayTime()
{
AutoSizeAxes = Axes.Both;
@ -27,12 +27,11 @@ namespace osu.Game.Overlays.Profile.Header.Components
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
private void load()
{
InternalChild = info = new OverlinedInfoContainer
InternalChild = info = new ProfileValueDisplay(minimumWidth: 140)
{
Title = UsersStrings.ShowStatsPlayTime,
LineColour = colourProvider.Highlight1,
};
User.BindValueChanged(updateTime, true);

View File

@ -22,41 +22,16 @@ namespace osu.Game.Overlays.Profile.Header
public partial class DetailHeaderContainer : CompositeDrawable
{
private readonly Dictionary<ScoreRank, ScoreRankInfo> scoreRankInfos = new Dictionary<ScoreRank, ScoreRankInfo>();
private OverlinedInfoContainer medalInfo = null!;
private OverlinedInfoContainer ppInfo = null!;
private OverlinedInfoContainer detailGlobalRank = null!;
private OverlinedInfoContainer detailCountryRank = null!;
private FillFlowContainer? fillFlow;
private ProfileValueDisplay medalInfo = null!;
private ProfileValueDisplay ppInfo = null!;
private ProfileValueDisplay detailGlobalRank = null!;
private ProfileValueDisplay detailCountryRank = null!;
private RankGraph rankGraph = null!;
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
private bool expanded = true;
public bool Expanded
{
set
{
if (expanded == value) return;
expanded = value;
if (fillFlow == null) return;
fillFlow.ClearTransforms();
if (expanded)
fillFlow.AutoSizeAxes = Axes.Y;
else
{
fillFlow.AutoSizeAxes = Axes.None;
fillFlow.ResizeHeightTo(0, 200, Easing.OutQuint);
}
}
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider, OsuColour colours)
private void load(OverlayColourProvider colourProvider)
{
AutoSizeAxes = Axes.Y;
@ -69,18 +44,48 @@ namespace osu.Game.Overlays.Profile.Header
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
},
fillFlow = new FillFlowContainer
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = expanded ? Axes.Y : Axes.None,
AutoSizeAxes = Axes.Y,
AutoSizeDuration = 200,
AutoSizeEasing = Easing.OutQuint,
Masking = true,
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 },
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 20),
Spacing = new Vector2(0, 15),
Children = new Drawable[]
{
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(20),
Children = new Drawable[]
{
detailGlobalRank = new ProfileValueDisplay(true)
{
Title = UsersStrings.ShowRankGlobalSimple,
},
detailCountryRank = new ProfileValueDisplay(true)
{
Title = UsersStrings.ShowRankCountrySimple,
},
}
},
new Container
{
RelativeSizeAxes = Axes.X,
Height = 60,
Children = new Drawable[]
{
rankGraph = new RankGraph
{
RelativeSizeAxes = Axes.Both,
},
}
},
new Container
{
RelativeSizeAxes = Axes.X,
@ -96,19 +101,17 @@ namespace osu.Game.Overlays.Profile.Header
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new OverlinedTotalPlayTime
{
User = { BindTarget = User }
},
medalInfo = new OverlinedInfoContainer
medalInfo = new ProfileValueDisplay
{
Title = UsersStrings.ShowStatsMedals,
LineColour = colours.GreenLight,
},
ppInfo = new OverlinedInfoContainer
ppInfo = new ProfileValueDisplay
{
Title = "pp",
LineColour = colours.Red,
},
new TotalPlayTime
{
User = { BindTarget = User }
},
}
},
@ -130,41 +133,6 @@ namespace osu.Game.Overlays.Profile.Header
}
}
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Right = 130 },
Children = new Drawable[]
{
rankGraph = new RankGraph
{
RelativeSizeAxes = Axes.Both,
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
Width = 130,
Anchor = Anchor.TopRight,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Horizontal = 10 },
Spacing = new Vector2(0, 20),
Children = new Drawable[]
{
detailGlobalRank = new OverlinedInfoContainer(true, 110)
{
Title = UsersStrings.ShowRankGlobalSimple,
LineColour = colourProvider.Highlight1,
},
detailCountryRank = new OverlinedInfoContainer(false, 110)
{
Title = UsersStrings.ShowRankCountrySimple,
LineColour = colourProvider.Highlight1,
},
}
}
}
},
}
},
};
@ -201,14 +169,14 @@ namespace osu.Game.Overlays.Profile.Header
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Y,
Width = 56,
Width = 44,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DrawableRank(rank)
{
RelativeSizeAxes = Axes.X,
Height = 30,
Height = 22,
},
rankCount = new OsuSpriteText
{

View File

@ -4,7 +4,6 @@
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
@ -12,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Profile.Header.Components;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.Profile.Header
{
@ -43,23 +41,16 @@ namespace osu.Game.Overlays.Profile.Header
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new ColourInfo
{
TopLeft = Color4.Black.Opacity(0.2f),
TopRight = Color4.Black.Opacity(0.2f),
BottomLeft = Color4.Black.Opacity(0),
BottomRight = Color4.Black.Opacity(0)
}
},
Colour = ColourInfo.GradientVertical(Colour4.Black.Opacity(0.2f), Colour4.Black.Opacity(0))
}
},
badgeFlowContainer = new FillFlowContainer
{
Direction = FillDirection.Full,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Top = 5 },
Spacing = new Vector2(10, 10),
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Vertical = 10 },
Padding = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, Top = 10 },
}
};
}

View File

@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Profile.Header
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5,
Colour = colourProvider.Background4,
},
new FillFlowContainer
{

View File

@ -36,18 +36,9 @@ namespace osu.Game.Overlays.Profile
// todo: pending implementation.
// TabControl.AddItem(LayoutStrings.HeaderUsersModding);
TabControlContainer.Add(new ProfileRulesetSelector
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
User = { BindTarget = User }
});
// Haphazardly guaranteed by OverlayHeader constructor (see CreateBackground / CreateContent).
Debug.Assert(centreHeaderContainer != null);
Debug.Assert(detailHeaderContainer != null);
centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true);
}
protected override Drawable CreateBackground() =>
@ -82,7 +73,7 @@ namespace osu.Game.Overlays.Profile
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
centreHeaderContainer = new CentreHeaderContainer
new MedalHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
@ -92,7 +83,7 @@ namespace osu.Game.Overlays.Profile
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
},
new MedalHeaderContainer
centreHeaderContainer = new CentreHeaderContainer
{
RelativeSizeAxes = Axes.X,
User = { BindTarget = User },
@ -107,6 +98,11 @@ namespace osu.Game.Overlays.Profile
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
protected override Drawable CreateTabControlContent() => new ProfileRulesetSelector
{
User = { BindTarget = User }
};
private void updateDisplay(UserProfileData? user) => coverContainer.User = user?.User;
private partial class ProfileHeaderTitle : OverlayTitle

View File

@ -3,16 +3,15 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osuTK;
namespace osu.Game.Overlays.Profile
{
@ -30,22 +29,29 @@ namespace osu.Game.Overlays.Profile
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
private const float outer_gutter_width = 10;
protected ProfileSection()
{
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Masking = true;
CornerRadius = 10;
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Offset = new Vector2(0, 1),
Radius = 3,
Colour = Colour4.Black.Opacity(0.25f)
};
InternalChildren = new Drawable[]
{
background = new Box
{
RelativeSizeAxes = Axes.Both,
},
new SectionTriangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
@ -58,8 +64,8 @@ namespace osu.Game.Overlays.Profile
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Top = 15,
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN - outer_gutter_width,
Top = 20,
Bottom = 20,
},
Children = new Drawable[]
@ -67,7 +73,7 @@ namespace osu.Game.Overlays.Profile
new OsuSpriteText
{
Text = Title,
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold),
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Bold),
},
underscore = new Box
{
@ -88,7 +94,7 @@ namespace osu.Game.Overlays.Profile
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding
{
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN,
Horizontal = UserProfileOverlay.CONTENT_X_MARGIN - outer_gutter_width,
Bottom = 20
}
},
@ -100,43 +106,8 @@ namespace osu.Game.Overlays.Profile
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
background.Colour = colourProvider.Background5;
background.Colour = colourProvider.Background4;
underscore.Colour = colourProvider.Highlight1;
}
private partial class SectionTriangles : Container
{
private readonly Triangles triangles;
private readonly Box foreground;
public SectionTriangles()
{
RelativeSizeAxes = Axes.X;
Height = 100;
Masking = true;
Children = new Drawable[]
{
triangles = new Triangles
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
RelativeSizeAxes = Axes.Both,
TriangleScale = 3,
},
foreground = new Box
{
RelativeSizeAxes = Axes.Both,
}
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
triangles.ColourLight = colourProvider.Background4;
triangles.ColourDark = colourProvider.Background5.Darken(0.2f);
foreground.Colour = ColourInfo.GradientVertical(colourProvider.Background5, colourProvider.Background5.Opacity(0));
}
}
}
}

View File

@ -112,8 +112,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Background4;
HoverColour = colourProvider.Background3;
IdleColour = colourProvider.Background3;
HoverColour = colourProvider.Background2;
}
}

View File

@ -17,9 +17,6 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
{
private const int height = 25;
[Resolved]
private OsuColour colours { get; set; } = null!;
private readonly APIKudosuHistory historyItem;
private readonly LinkFlowContainer linkFlowContainer;
private readonly DrawableDate date;
@ -48,9 +45,9 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
}
[BackgroundDependencyLoader]
private void load()
private void load(OverlayColourProvider colourProvider)
{
date.Colour = colours.GreySeaFoamLighter;
date.Colour = colourProvider.Foreground1;
var formattedSource = MessageFormatter.FormatText(getString(historyItem));
linkFlowContainer.AddLinks(formattedSource.Text, formattedSource.Links);
}

View File

@ -14,6 +14,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Game.Resources.Localisation.Web;
using osu.Framework.Localisation;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Profile.Sections.Kudosu
{
@ -42,7 +43,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
: base(UsersStrings.ShowExtraKudosuTotal)
{
DescriptionText.AddText("Based on how much of a contribution the user has made to beatmap moderation. See ");
DescriptionText.AddLink("this page", "https://osu.ppy.sh/wiki/Kudosu");
DescriptionText.AddLink("this page", LinkAction.OpenWiki, @"Modding/Kudosu");
DescriptionText.AddText(" for more information.");
}
}

View File

@ -65,8 +65,8 @@ namespace osu.Game.Overlays.Profile.Sections
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Background3;
HoverColour = colourProvider.Background2;
IdleColour = colourProvider.Background2;
HoverColour = colourProvider.Background1;
}
protected override bool OnHover(HoverEvent e)

View File

@ -160,7 +160,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.Both,
Height = 0.5f,
Colour = colourProvider.Background4,
Colour = colourProvider.Background3,
Shear = new Vector2(-performance_background_shear, 0),
EdgeSmoothness = new Vector2(2, 0),
},
@ -172,7 +172,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
RelativePositionAxes = Axes.Y,
Height = -0.5f,
Position = new Vector2(0, 1),
Colour = colourProvider.Background4,
Colour = colourProvider.Background3,
Shear = new Vector2(performance_background_shear, 0),
EdgeSmoothness = new Vector2(2, 0),
},

View File

@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Rankings
protected override OverlayTitle CreateTitle() => new RankingsTitle();
protected override Drawable CreateTitleContent() => rulesetSelector = new OverlayRulesetSelector();
protected override Drawable CreateTabControlContent() => rulesetSelector = new OverlayRulesetSelector();
protected override Drawable CreateContent() => countryFilter = new CountryFilter();

View File

@ -27,7 +27,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
new SettingsEnumDropdown<FrameSync>
{
LabelText = GraphicsSettingsStrings.FrameLimiter,
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync)
Current = config.GetBindable<FrameSync>(FrameworkSetting.FrameSync),
Keywords = new[] { @"fps" },
},
new SettingsEnumDropdown<ExecutionMode>
{

View File

@ -62,10 +62,18 @@ namespace osu.Game.Overlays
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = ContentSidePadding },
Child = TabControl = CreateTabControl().With(control =>
Children = new[]
{
control.Current = Current;
})
TabControl = CreateTabControl().With(control =>
{
control.Current = Current;
}),
CreateTabControlContent().With(content =>
{
content.Anchor = Anchor.CentreRight;
content.Origin = Anchor.CentreRight;
}),
}
}
}
});
@ -80,6 +88,12 @@ namespace osu.Game.Overlays
[NotNull]
protected virtual OsuTabControl<T> CreateTabControl() => new OverlayHeaderTabControl();
/// <summary>
/// Creates a <see cref="Drawable"/> on the opposite side of the <see cref="OsuTabControl{T}"/>. Used mostly to create <see cref="OverlayRulesetSelector"/>.
/// </summary>
[NotNull]
protected virtual Drawable CreateTabControlContent() => Empty();
public partial class OverlayHeaderTabControl : OverlayTabControl<T>
{
private const float bar_height = 1;

View File

@ -12,7 +12,9 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Extensions;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
using osu.Game.Online.API.Requests;
@ -42,7 +44,7 @@ namespace osu.Game.Overlays
[Resolved]
private RulesetStore rulesets { get; set; } = null!;
public const float CONTENT_X_MARGIN = 70;
public const float CONTENT_X_MARGIN = 50;
public UserProfileOverlay()
: base(OverlayColourScheme.Pink)
@ -59,7 +61,7 @@ namespace osu.Game.Overlays
protected override ProfileHeader CreateHeader() => new ProfileHeader();
protected override Color4 BackgroundColour => ColourProvider.Background6;
protected override Color4 BackgroundColour => ColourProvider.Background5;
public void ShowUser(IUser user, IRulesetInfo? ruleset = null)
{
@ -171,46 +173,72 @@ namespace osu.Game.Overlays
loadingLayer.Hide();
}
private partial class ProfileSectionTabControl : OverlayTabControl<ProfileSection>
private partial class ProfileSectionTabControl : OsuTabControl<ProfileSection>
{
private const float bar_height = 2;
public ProfileSectionTabControl()
{
TabContainer.RelativeSizeAxes &= ~Axes.X;
TabContainer.AutoSizeAxes |= Axes.X;
TabContainer.Anchor |= Anchor.x1;
TabContainer.Origin |= Anchor.x1;
Height = 36 + bar_height;
BarHeight = bar_height;
Height = 40;
Padding = new MarginPadding { Horizontal = CONTENT_X_MARGIN };
TabContainer.Spacing = new Vector2(20);
}
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileSectionTabItem(value)
{
AccentColour = AccentColour,
};
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
AccentColour = colourProvider.Highlight1;
}
protected override TabItem<ProfileSection> CreateTabItem(ProfileSection value) => new ProfileSectionTabItem(value);
protected override bool OnClick(ClickEvent e) => true;
protected override bool OnHover(HoverEvent e) => true;
private partial class ProfileSectionTabItem : OverlayTabItem
private partial class ProfileSectionTabItem : TabItem<ProfileSection>
{
private OsuSpriteText text = null!;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public ProfileSectionTabItem(ProfileSection value)
: base(value)
{
Text.Text = value.Title;
Text.Font = Text.Font.With(size: 16);
Text.Margin = new MarginPadding { Bottom = 10 + bar_height };
Bar.ExpandedSize = 10;
Bar.Margin = new MarginPadding { Bottom = bar_height };
}
[BackgroundDependencyLoader]
private void load()
{
AutoSizeAxes = Axes.Both;
Anchor = Anchor.CentreLeft;
Origin = Anchor.CentreLeft;
InternalChild = text = new OsuSpriteText
{
Text = Value.Title
};
updateState();
}
protected override void OnActivated() => updateState();
protected override void OnDeactivated() => updateState();
protected override bool OnHover(HoverEvent e)
{
updateState();
return true;
}
protected override void OnHoverLost(HoverLostEvent e) => updateState();
private void updateState()
{
text.Font = OsuFont.Default.With(size: 14, weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
Colour4 textColour;
if (IsHovered)
textColour = colourProvider.Light1;
else
textColour = Active.Value ? colourProvider.Content1 : colourProvider.Light2;
text.FadeColour(textColour, 300, Easing.OutQuint);
}
}
}
@ -231,7 +259,9 @@ namespace osu.Game.Overlays
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Spacing = new Vector2(0, 20),
Spacing = new Vector2(0, 10),
Padding = new MarginPadding { Horizontal = 10 },
Margin = new MarginPadding { Bottom = 10 },
};
}
}

View File

@ -88,5 +88,13 @@ namespace osu.Game.Overlays.Volume
{
Content.TransformTo<Container<Drawable>, ColourInfo>("BorderColour", unhoveredColour, 500, Easing.OutQuint);
}
protected override bool OnMouseDown(MouseDownEvent e)
{
base.OnMouseDown(e);
// Block mouse down to avoid dismissing overlays sitting behind the mute button
return true;
}
}
}

View File

@ -6,6 +6,7 @@
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Allocation;
using osu.Framework.Logging;
using osu.Game.Extensions;
namespace osu.Game.Rulesets
{
@ -16,11 +17,16 @@ namespace osu.Game.Rulesets
protected override Dropdown<RulesetInfo> CreateDropdown() => null;
protected virtual bool LegacyOnly => false;
[BackgroundDependencyLoader]
private void load()
{
foreach (var ruleset in Rulesets.AvailableRulesets)
{
if (!ruleset.IsLegacyRuleset() && LegacyOnly)
continue;
try
{
AddItem(ruleset);

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
@ -38,7 +36,7 @@ namespace osu.Game.Screens.Edit.Components.Menus
});
}
protected override Dropdown<EditorScreenMode> CreateDropdown() => null;
protected override Dropdown<EditorScreenMode> CreateDropdown() => null!;
protected override TabItem<EditorScreenMode> CreateTabItem(EditorScreenMode value) => new TabItem(value);

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using osuTK;
using osuTK.Graphics;
@ -25,10 +23,10 @@ namespace osu.Game.Screens.Edit.Components
{
public partial class PlaybackControl : BottomBarContainer
{
private IconButton playButton;
private IconButton playButton = null!;
[Resolved]
private EditorClock editorClock { get; set; }
private EditorClock editorClock { get; set; } = null!;
private readonly BindableNumber<double> freqAdjust = new BindableDouble(1);
@ -108,7 +106,7 @@ namespace osu.Game.Screens.Edit.Components
protected override TabItem<double> CreateTabItem(double value) => new PlaybackTabItem(value);
protected override Dropdown<double> CreateDropdown() => null;
protected override Dropdown<double> CreateDropdown() => null!;
public PlaybackTabControl()
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
@ -24,7 +22,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
/// <summary>
/// Invoked when this <see cref="EditorRadioButton"/> has been selected.
/// </summary>
public Action<RadioButton> Selected;
public Action<RadioButton>? Selected;
public readonly RadioButton Button;
@ -33,10 +31,10 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
private Color4 selectedBackgroundColour;
private Color4 selectedIconColour;
private Drawable icon;
private Drawable icon = null!;
[Resolved(canBeNull: true)]
private EditorBeatmap editorBeatmap { get; set; }
[Resolved]
private EditorBeatmap? editorBeatmap { get; set; }
public EditorRadioButton(RadioButton button)
{

View File

@ -1,8 +1,7 @@
// 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.
#nullable disable
using System;
using System.Collections.Generic;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
@ -13,7 +12,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
{
public partial class EditorRadioButtonCollection : CompositeDrawable
{
private IReadOnlyList<RadioButton> items;
private IReadOnlyList<RadioButton> items = Array.Empty<RadioButton>();
public IReadOnlyList<RadioButton> Items
{
@ -45,7 +44,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
};
}
private RadioButton currentlySelected;
private RadioButton? currentlySelected;
private void addButton(RadioButton button)
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -24,11 +22,11 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons
/// <summary>
/// A function which creates a drawable icon to represent this item. If null, a sane default should be used.
/// </summary>
public readonly Func<Drawable> CreateIcon;
public readonly Func<Drawable>? CreateIcon;
private readonly Action action;
private readonly Action? action;
public RadioButton(string label, Action action, Func<Drawable> createIcon = null)
public RadioButton(string label, Action? action, Func<Drawable>? createIcon = null)
{
Label = label;
CreateIcon = createIcon;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
@ -23,7 +21,7 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
private Color4 selectedBackgroundColour;
private Color4 selectedIconColour;
private Drawable icon;
private Drawable icon = null!;
public readonly TernaryButton Button;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -19,9 +17,9 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
/// <summary>
/// A function which creates a drawable icon to represent this item. If null, a sane default should be used.
/// </summary>
public readonly Func<Drawable> CreateIcon;
public readonly Func<Drawable>? CreateIcon;
public TernaryButton(Bindable<TernaryState> bindable, string description, Func<Drawable> createIcon = null)
public TernaryButton(Bindable<TernaryState> bindable, string description, Func<Drawable>? createIcon = null)
{
Bindable = bindable;
Description = description;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Framework.Allocation;
@ -15,14 +13,14 @@ namespace osu.Game.Screens.Edit.Components
{
public partial class TimeInfoContainer : BottomBarContainer
{
private OsuSpriteText trackTimer;
private OsuSpriteText bpm;
private OsuSpriteText trackTimer = null!;
private OsuSpriteText bpm = null!;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
private EditorBeatmap editorBeatmap { get; set; } = null!;
[Resolved]
private EditorClock editorClock { get; set; }
private EditorClock editorClock { get; set; } = null!;
[BackgroundDependencyLoader]
private void load(OsuColour colours, OverlayColourProvider colourProvider)

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Game.Beatmaps.Timing;
using osu.Game.Graphics;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using System.Collections.Specialized;
using System.Diagnostics;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Game.Beatmaps.ControlPoints;
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
@ -20,10 +18,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
/// </summary>
public partial class MarkerPart : TimelinePart
{
private Drawable marker;
private Drawable marker = null!;
[Resolved]
private EditorClock editorClock { get; set; }
private EditorClock editorClock { get; set; } = null!;
[BackgroundDependencyLoader]
private void load()
@ -44,7 +42,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
return true;
}
private ScheduledDelegate scheduledSeek;
private ScheduledDelegate? scheduledSeek;
/// <summary>
/// Seeks the <see cref="SummaryTimeline"/> to the time closest to a position on the screen relative to the <see cref="SummaryTimeline"/>.

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio.Track;
@ -26,7 +24,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
private readonly IBindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
[Resolved]
protected EditorBeatmap EditorBeatmap { get; private set; }
protected EditorBeatmap EditorBeatmap { get; private set; } = null!;
protected readonly IBindable<Track> Track = new Bindable<Track>();
@ -34,7 +32,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
protected override Container<T> Content => content;
public TimelinePart(Container<T> content = null)
public TimelinePart(Container<T>? content = null)
{
AddInternal(this.content = content ?? new Container<T> { RelativeSizeAxes = Axes.Both });

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;

View File

@ -36,7 +36,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
protected new EditorSelectionHandler SelectionHandler => (EditorSelectionHandler)base.SelectionHandler;
private PlacementBlueprint currentPlacement;
public PlacementBlueprint CurrentPlacement { get; private set; }
/// <remarks>
/// Positional input must be received outside the container's bounds,
@ -137,13 +137,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void updatePlacementNewCombo()
{
if (currentPlacement?.HitObject is IHasComboInformation c)
if (CurrentPlacement?.HitObject is IHasComboInformation c)
c.NewCombo = NewCombo.Value == TernaryState.True;
}
private void updatePlacementSamples()
{
if (currentPlacement == null) return;
if (CurrentPlacement == null) return;
foreach (var kvp in SelectionHandler.SelectionSampleStates)
sampleChanged(kvp.Key, kvp.Value.Value);
@ -151,9 +151,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void sampleChanged(string sampleName, TernaryState state)
{
if (currentPlacement == null) return;
if (CurrentPlacement == null) return;
var samples = currentPlacement.HitObject.Samples;
var samples = CurrentPlacement.HitObject.Samples;
var existingSample = samples.FirstOrDefault(s => s.Name == sampleName);
@ -225,7 +225,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
// if no time was found from positional snapping, we should still quantize to the beat.
snapResult.Time ??= Beatmap.SnapTime(EditorClock.CurrentTime, null);
currentPlacement.UpdateTimeAndPosition(snapResult);
CurrentPlacement.UpdateTimeAndPosition(snapResult);
}
#endregion
@ -234,9 +234,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
{
base.Update();
if (currentPlacement != null)
if (CurrentPlacement != null)
{
switch (currentPlacement.PlacementActive)
switch (CurrentPlacement.PlacementActive)
{
case PlacementBlueprint.PlacementState.Waiting:
if (!Composer.CursorInPlacementArea)
@ -252,7 +252,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
if (Composer.CursorInPlacementArea)
ensurePlacementCreated();
if (currentPlacement != null)
if (CurrentPlacement != null)
updatePlacementPosition();
}
@ -281,13 +281,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void ensurePlacementCreated()
{
if (currentPlacement != null) return;
if (CurrentPlacement != null) return;
var blueprint = CurrentTool?.CreatePlacementBlueprint();
if (blueprint != null)
{
placementBlueprintContainer.Child = currentPlacement = blueprint;
placementBlueprintContainer.Child = CurrentPlacement = blueprint;
// Fixes a 1-frame position discrepancy due to the first mouse move event happening in the next frame
updatePlacementPosition();
@ -300,11 +300,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
private void removePlacement()
{
if (currentPlacement == null) return;
if (CurrentPlacement == null) return;
currentPlacement.EndPlacement(false);
currentPlacement.Expire();
currentPlacement = null;
CurrentPlacement.EndPlacement(false);
CurrentPlacement.Expire();
CurrentPlacement = null;
}
private HitObjectCompositionTool currentTool;

View File

@ -291,7 +291,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
[Resolved]
private Timeline timeline { get; set; } = null!;
[Resolved(CanBeNull = true)]
[Resolved]
private IEditorChangeHandler? changeHandler { get; set; }
private ScheduledDelegate? dragOperation;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
namespace osu.Game.Screens.Edit.Design
{
public partial class DesignScreen : EditorScreen

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
@ -15,7 +13,7 @@ namespace osu.Game.Screens.Edit.Setup
{
public override LocalisableString Title => EditorSetupStrings.ColoursHeader;
private LabelledColourPalette comboColours;
private LabelledColourPalette comboColours = null!;
[BackgroundDependencyLoader]
private void load()

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using System.Globalization;
using System.Linq;
@ -19,16 +17,16 @@ namespace osu.Game.Screens.Edit.Setup
{
internal partial class DesignSection : SetupSection
{
protected LabelledSwitchButton EnableCountdown;
protected LabelledSwitchButton EnableCountdown = null!;
protected FillFlowContainer CountdownSettings;
protected LabelledEnumDropdown<CountdownType> CountdownSpeed;
protected LabelledNumberBox CountdownOffset;
protected FillFlowContainer CountdownSettings = null!;
protected LabelledEnumDropdown<CountdownType> CountdownSpeed = null!;
protected LabelledNumberBox CountdownOffset = null!;
private LabelledSwitchButton widescreenSupport;
private LabelledSwitchButton epilepsyWarning;
private LabelledSwitchButton letterboxDuringBreaks;
private LabelledSwitchButton samplesMatchPlaybackRate;
private LabelledSwitchButton widescreenSupport = null!;
private LabelledSwitchButton epilepsyWarning = null!;
private LabelledSwitchButton letterboxDuringBreaks = null!;
private LabelledSwitchButton samplesMatchPlaybackRate = null!;
public override LocalisableString Title => EditorSetupStrings.DesignHeader;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -17,10 +15,10 @@ namespace osu.Game.Screens.Edit.Setup
{
internal partial class DifficultySection : SetupSection
{
private LabelledSliderBar<float> circleSizeSlider;
private LabelledSliderBar<float> healthDrainSlider;
private LabelledSliderBar<float> approachRateSlider;
private LabelledSliderBar<float> overallDifficultySlider;
private LabelledSliderBar<float> circleSizeSlider = null!;
private LabelledSliderBar<float> healthDrainSlider = null!;
private LabelledSliderBar<float> approachRateSlider = null!;
private LabelledSliderBar<float> overallDifficultySlider = null!;
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
@ -30,7 +28,7 @@ namespace osu.Game.Screens.Edit.Setup
internal partial class PopoverTextBox : OsuTextBox
{
public Action OnFocused;
public Action? OnFocused;
protected override bool OnDragStart(DragStartEvent e)
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics.UserInterface;
@ -16,16 +14,16 @@ namespace osu.Game.Screens.Edit.Setup
{
public partial class MetadataSection : SetupSection
{
protected LabelledTextBox ArtistTextBox;
protected LabelledTextBox RomanisedArtistTextBox;
protected LabelledTextBox ArtistTextBox = null!;
protected LabelledTextBox RomanisedArtistTextBox = null!;
protected LabelledTextBox TitleTextBox;
protected LabelledTextBox RomanisedTitleTextBox;
protected LabelledTextBox TitleTextBox = null!;
protected LabelledTextBox RomanisedTitleTextBox = null!;
private LabelledTextBox creatorTextBox;
private LabelledTextBox difficultyTextBox;
private LabelledTextBox sourceTextBox;
private LabelledTextBox tagsTextBox;
private LabelledTextBox creatorTextBox = null!;
private LabelledTextBox difficultyTextBox = null!;
private LabelledTextBox sourceTextBox = null!;
private LabelledTextBox tagsTextBox = null!;
public override LocalisableString Title => EditorSetupStrings.MetadataHeader;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Localisation;
using osu.Game.Rulesets;
using osu.Game.Localisation;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Collections.Generic;
using osu.Framework.Allocation;
using osu.Framework.Graphics;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
@ -18,12 +16,12 @@ namespace osu.Game.Screens.Edit.Setup
{
internal partial class SetupScreenHeader : OverlayHeader
{
public SetupScreenHeaderBackground Background { get; private set; }
public SetupScreenHeaderBackground Background { get; private set; } = null!;
[Resolved]
private SectionsContainer<SetupSection> sections { get; set; }
private SectionsContainer<SetupSection> sections { get; set; } = null!;
private SetupScreenTabControl tabControl;
private SetupScreenTabControl tabControl = null!;
protected override OverlayTitle CreateTitle() => new SetupScreenTitle();

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -18,10 +16,10 @@ namespace osu.Game.Screens.Edit.Setup
public partial class SetupScreenHeaderBackground : CompositeDrawable
{
[Resolved]
private OsuColour colours { get; set; }
private OsuColour colours { get; set; } = null!;
[Resolved]
private IBindable<WorkingBeatmap> working { get; set; }
private IBindable<WorkingBeatmap> working { get; set; } = null!;
private readonly Container content;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -16,7 +14,7 @@ namespace osu.Game.Screens.Edit.Setup
{
public abstract partial class SetupSection : Container
{
private FillFlowContainer flow;
private FillFlowContainer flow = null!;
/// <summary>
/// Used to align some of the child <see cref="LabelledDrawable{T}"/>s together to achieve a grid-like look.
@ -24,10 +22,10 @@ namespace osu.Game.Screens.Edit.Setup
protected const float LABEL_WIDTH = 160;
[Resolved]
protected OsuColour Colours { get; private set; }
protected OsuColour Colours { get; private set; } = null!;
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }
protected EditorBeatmap Beatmap { get; private set; } = null!;
protected override Container<Drawable> Content => flow;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Collections.Generic;
using osu.Framework.Graphics;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -15,10 +13,10 @@ namespace osu.Game.Screens.Edit.Timing
{
internal partial class EffectSection : Section<EffectControlPoint>
{
private LabelledSwitchButton kiai;
private LabelledSwitchButton omitBarLine;
private LabelledSwitchButton kiai = null!;
private LabelledSwitchButton omitBarLine = null!;
private SliderWithTextBoxInput<double> scrollSpeedSlider;
private SliderWithTextBoxInput<double> scrollSpeedSlider = null!;
[BackgroundDependencyLoader]
private void load()
@ -55,7 +53,7 @@ namespace osu.Game.Screens.Edit.Timing
private bool isRebinding;
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint> point)
protected override void OnControlPointChanged(ValueChangedEvent<EffectControlPoint?> point)
{
if (point.NewValue != null)
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -17,21 +15,21 @@ namespace osu.Game.Screens.Edit.Timing
{
internal partial class GroupSection : CompositeDrawable
{
private LabelledTextBox textBox;
private LabelledTextBox textBox = null!;
private OsuButton button;
private OsuButton button = null!;
[Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; } = null!;
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }
protected EditorBeatmap Beatmap { get; private set; } = null!;
[Resolved]
private EditorClock clock { get; set; }
private EditorClock clock { get; set; } = null!;
[Resolved(canBeNull: true)]
private IEditorChangeHandler changeHandler { get; set; }
[Resolved]
private IEditorChangeHandler? changeHandler { get; set; }
[BackgroundDependencyLoader]
private void load()

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using System.Globalization;
using osu.Framework.Bindables;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -35,7 +33,7 @@ namespace osu.Game.Screens.Edit.Timing
set => current.Current = value;
}
private OsuNumberBox numeratorBox;
private OsuNumberBox numeratorBox = null!;
[BackgroundDependencyLoader]
private void load()

View File

@ -1,10 +1,7 @@
// 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.
#nullable disable
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@ -28,24 +25,23 @@ namespace osu.Game.Screens.Edit.Timing
{
public partial class MetronomeDisplay : BeatSyncedContainer
{
private Container swing;
private Container swing = null!;
private OsuSpriteText bpmText;
private OsuSpriteText bpmText = null!;
private Drawable weight;
private Drawable stick;
private Drawable weight = null!;
private Drawable stick = null!;
private IAdjustableClock metronomeClock;
private IAdjustableClock metronomeClock = null!;
private Sample sampleTick;
private Sample sampleTickDownbeat;
private Sample sampleLatch;
private Sample? sampleTick;
private Sample? sampleTickDownbeat;
private Sample? sampleLatch;
[CanBeNull]
private ScheduledDelegate tickPlaybackDelegate;
private ScheduledDelegate? tickPlaybackDelegate;
[Resolved]
private OverlayColourProvider overlayColourProvider { get; set; }
private OverlayColourProvider overlayColourProvider { get; set; } = null!;
public bool EnableClicking { get; set; } = true;
@ -225,13 +221,13 @@ namespace osu.Game.Screens.Edit.Timing
private double beatLength;
private TimingControlPoint timingPoint;
private TimingControlPoint timingPoint = null!;
private bool isSwinging;
private readonly BindableInt interpolatedBpm = new BindableInt();
private ScheduledDelegate latchDelegate;
private ScheduledDelegate? latchDelegate;
protected override void LoadComplete()
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using osu.Framework.Allocation;
using osu.Framework.Audio;
@ -23,10 +21,10 @@ namespace osu.Game.Screens.Edit.Timing
private readonly Drawable button;
private Sample sample;
private Sample? sample;
public Action RepeatBegan;
public Action RepeatEnded;
public Action? RepeatBegan;
public Action? RepeatEnded;
/// <summary>
/// An additive modifier for the frequency of the sample played on next actuation.
@ -61,7 +59,7 @@ namespace osu.Game.Screens.Edit.Timing
base.OnMouseUp(e);
}
private ScheduledDelegate adjustDelegate;
private ScheduledDelegate? adjustDelegate;
private double adjustDelay = initial_delay;
private void beginRepeat()

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -21,9 +19,9 @@ namespace osu.Game.Screens.Edit.Timing
private readonly string label;
protected Drawable Background { get; private set; }
protected Drawable Background { get; private set; } = null!;
protected FillFlowContainer Content { get; private set; }
protected FillFlowContainer Content { get; private set; } = null!;
public RowAttribute(ControlPoint point, string label)
{

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -15,7 +13,7 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
private readonly BindableNumber<double> speedMultiplier;
private OsuSpriteText text;
private OsuSpriteText text = null!;
public DifficultyRowAttribute(DifficultyControlPoint difficulty)
: base(difficulty, "difficulty")

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -16,9 +14,9 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
private readonly Bindable<bool> omitBarLine;
private readonly BindableNumber<double> scrollSpeed;
private AttributeText kiaiModeBubble;
private AttributeText omitBarLineBubble;
private AttributeText text;
private AttributeText kiaiModeBubble = null!;
private AttributeText omitBarLineBubble = null!;
private AttributeText text = null!;
public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect")

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -13,8 +11,8 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
public partial class SampleRowAttribute : RowAttribute
{
private AttributeText sampleText;
private OsuSpriteText volumeText;
private AttributeText sampleText = null!;
private OsuSpriteText volumeText = null!;
private readonly Bindable<string> sampleBank;
private readonly BindableNumber<int> volume;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
@ -17,7 +15,7 @@ namespace osu.Game.Screens.Edit.Timing.RowAttributes
{
private readonly BindableNumber<double> beatLength;
private readonly Bindable<TimeSignature> timeSignature;
private OsuSpriteText text;
private OsuSpriteText text = null!;
public TimingRowAttribute(TimingControlPoint timing)
: base(timing, "timing")

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -19,23 +17,23 @@ namespace osu.Game.Screens.Edit.Timing
internal abstract partial class Section<T> : CompositeDrawable
where T : ControlPoint
{
private OsuCheckbox checkbox;
private Container content;
private OsuCheckbox checkbox = null!;
private Container content = null!;
protected FillFlowContainer Flow { get; private set; }
protected FillFlowContainer Flow { get; private set; } = null!;
protected Bindable<T> ControlPoint { get; } = new Bindable<T>();
protected Bindable<T?> ControlPoint { get; } = new Bindable<T?>();
private const float header_height = 50;
[Resolved]
protected EditorBeatmap Beatmap { get; private set; }
protected EditorBeatmap Beatmap { get; private set; } = null!;
[Resolved]
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; }
protected Bindable<ControlPointGroup> SelectedGroup { get; private set; } = null!;
[Resolved(canBeNull: true)]
protected IEditorChangeHandler ChangeHandler { get; private set; }
[Resolved]
protected IEditorChangeHandler? ChangeHandler { get; private set; }
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colours)
@ -128,7 +126,7 @@ namespace osu.Game.Screens.Edit.Timing
ControlPoint.BindValueChanged(OnControlPointChanged, true);
}
protected abstract void OnControlPointChanged(ValueChangedEvent<T> point);
protected abstract void OnControlPointChanged(ValueChangedEvent<T?> point);
protected abstract T CreatePoint();
}

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using System.Globalization;
using osu.Framework.Bindables;

View File

@ -37,10 +37,10 @@ namespace osu.Game.Screens.Edit.Timing
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
[Resolved(canBeNull: true)]
[Resolved]
private Bindable<ControlPointGroup>? selectedGroup { get; set; }
[Resolved(canBeNull: true)]
[Resolved]
private IBeatSyncProvider? beatSyncSource { get; set; }
private Circle hoverLayer = null!;

View File

@ -1,8 +1,6 @@
// 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.
#nullable disable
using System;
using System.Linq;
using osu.Framework.Allocation;
@ -22,7 +20,7 @@ namespace osu.Game.Screens.Edit.Timing
/// </summary>
public partial class TimingAdjustButton : CompositeDrawable
{
public Action<double> Action;
public Action<double>? Action;
private readonly double adjustAmount;
@ -44,10 +42,10 @@ namespace osu.Game.Screens.Edit.Timing
private readonly RepeatingButtonBehaviour repeatBehaviour;
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private OverlayColourProvider colourProvider { get; set; } = null!;
[Resolved]
private EditorBeatmap editorBeatmap { get; set; }
private EditorBeatmap editorBeatmap { get; set; } = null!;
public TimingAdjustButton(double adjustAmount)
{
@ -104,7 +102,7 @@ namespace osu.Game.Screens.Edit.Timing
if (hoveredBox == null)
return false;
Action(adjustAmount * hoveredBox.Multiplier);
Action?.Invoke(adjustAmount * hoveredBox.Multiplier);
hoveredBox.Flash();
@ -119,6 +117,9 @@ namespace osu.Game.Screens.Edit.Timing
private readonly Box box;
private readonly OsuSpriteText text;
[Resolved]
private OverlayColourProvider colourProvider { get; set; } = null!;
public IncrementBox(int index, double amount)
{
Multiplier = Math.Sign(index) * convertMultiplier(index);
@ -156,9 +157,6 @@ namespace osu.Game.Screens.Edit.Timing
};
}
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
protected override void LoadComplete()
{
base.LoadComplete();

Some files were not shown because too many files have changed in this diff Show More