mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:07:52 +08:00
Merge branch 'master' into user-profile/ruleset-switching
This commit is contained in:
commit
52eabbf224
@ -18,6 +18,36 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new CatchRuleset();
|
||||
|
||||
[Test]
|
||||
public void TestAlwaysHidden()
|
||||
{
|
||||
CreateModTest(new ModTestData
|
||||
{
|
||||
Mod = new CatchModNoScope
|
||||
{
|
||||
HiddenComboCount = { Value = 0 },
|
||||
},
|
||||
Autoplay = true,
|
||||
PassCondition = () => Player.ScoreProcessor.Combo.Value == 2,
|
||||
Beatmap = new Beatmap
|
||||
{
|
||||
HitObjects = new List<HitObject>
|
||||
{
|
||||
new Fruit
|
||||
{
|
||||
X = CatchPlayfield.CENTER_X * 0.5f,
|
||||
StartTime = 1000,
|
||||
},
|
||||
new Fruit
|
||||
{
|
||||
X = CatchPlayfield.CENTER_X * 1.5f,
|
||||
StartTime = 2000,
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestVisibleDuringBreak()
|
||||
{
|
||||
|
@ -26,6 +26,9 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
var catchPlayfield = (CatchPlayfield)playfield;
|
||||
bool shouldAlwaysShowCatcher = IsBreakTime.Value;
|
||||
float targetAlpha = shouldAlwaysShowCatcher ? 1 : ComboBasedAlpha;
|
||||
|
||||
// AlwaysPresent required for catcher to still act on input when fully hidden.
|
||||
catchPlayfield.CatcherArea.AlwaysPresent = true;
|
||||
catchPlayfield.CatcherArea.Alpha = (float)Interpolation.Lerp(catchPlayfield.CatcherArea.Alpha, targetAlpha, Math.Clamp(catchPlayfield.Time.Elapsed / TRANSITION_DURATION, 0, 1));
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
@ -106,41 +105,17 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
return updateAction(e.Button, getTouchCatchActionFromInput(e.ScreenSpaceMousePosition));
|
||||
}
|
||||
|
||||
protected override bool OnTouchDown(TouchDownEvent e)
|
||||
{
|
||||
return updateAction(e.Touch.Source, getTouchCatchActionFromInput(e.ScreenSpaceTouch.Position));
|
||||
}
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
Show();
|
||||
|
||||
TouchCatchAction? action = getTouchCatchActionFromInput(e.ScreenSpaceMousePosition);
|
||||
|
||||
// multiple mouse buttons may be pressed and handling the same action.
|
||||
foreach (MouseButton button in e.PressedButtons)
|
||||
updateAction(button, action);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override void OnTouchMove(TouchMoveEvent e)
|
||||
{
|
||||
updateAction(e.Touch.Source, getTouchCatchActionFromInput(e.ScreenSpaceTouch.Position));
|
||||
base.OnTouchMove(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
updateAction(e.Button, null);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override void OnTouchUp(TouchUpEvent e)
|
||||
{
|
||||
updateAction(e.Touch.Source, null);
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Mania
|
||||
|
||||
public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor();
|
||||
|
||||
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new ManiaHealthProcessor(drainStartTime, 0.5);
|
||||
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new ManiaHealthProcessor(drainStartTime);
|
||||
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap, this);
|
||||
|
||||
|
@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Mania.Scoring
|
||||
public partial class ManiaHealthProcessor : DrainingHealthProcessor
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public ManiaHealthProcessor(double drainStartTime, double drainLenience = 0)
|
||||
: base(drainStartTime, drainLenience)
|
||||
public ManiaHealthProcessor(double drainStartTime)
|
||||
: base(drainStartTime, 1.0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -209,18 +209,6 @@ namespace osu.Game.Rulesets.Mania.UI
|
||||
keyBindingContainer = maniaInputManager?.KeyBindingContainer;
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
keyBindingContainer?.TriggerPressed(column.Action.Value);
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
keyBindingContainer?.TriggerReleased(column.Action.Value);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnTouchDown(TouchDownEvent e)
|
||||
{
|
||||
keyBindingContainer?.TriggerPressed(column.Action.Value);
|
||||
|
@ -1,35 +1,64 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Osu.Objects.Drawables;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
{
|
||||
public partial class ArgonFollowCircle : FollowCircle
|
||||
{
|
||||
private readonly CircularContainer circleContainer;
|
||||
private readonly Box circleFill;
|
||||
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private DrawableHitObject? parentObject { get; set; }
|
||||
|
||||
public ArgonFollowCircle()
|
||||
{
|
||||
InternalChild = new CircularContainer
|
||||
InternalChild = circleContainer = new CircularContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
BorderThickness = 4,
|
||||
BorderColour = ColourInfo.GradientVertical(Colour4.FromHex("FC618F"), Colour4.FromHex("BB1A41")),
|
||||
Blending = BlendingParameters.Additive,
|
||||
Child = new Box
|
||||
Child = circleFill = new Box
|
||||
{
|
||||
Colour = ColourInfo.GradientVertical(Colour4.FromHex("FC618F"), Colour4.FromHex("BB1A41")),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.3f,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (parentObject != null)
|
||||
accentColour.BindTo(parentObject.AccentColour);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
circleContainer.BorderColour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.5f));
|
||||
circleFill.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.5f));
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override void OnSliderPress()
|
||||
{
|
||||
const float duration = 300f;
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
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;
|
||||
@ -21,6 +23,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
|
||||
private readonly Vector2 defaultIconScale = new Vector2(0.6f, 0.8f);
|
||||
|
||||
private readonly IBindable<Color4> accentColour = new Bindable<Color4>();
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private DrawableHitObject? parentObject { get; set; }
|
||||
|
||||
@ -37,7 +41,6 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
{
|
||||
fill = new Box
|
||||
{
|
||||
Colour = ColourInfo.GradientVertical(Colour4.FromHex("FC618F"), Colour4.FromHex("BB1A41")),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -53,10 +56,22 @@ namespace osu.Game.Rulesets.Osu.Skinning.Argon
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (parentObject != null)
|
||||
accentColour.BindTo(parentObject.AccentColour);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
accentColour.BindValueChanged(colour =>
|
||||
{
|
||||
fill.Colour = ColourInfo.GradientVertical(colour.NewValue, colour.NewValue.Darken(0.5f));
|
||||
}, true);
|
||||
|
||||
if (parentObject != null)
|
||||
{
|
||||
parentObject.ApplyCustomUpdateState += updateStateTransforms;
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Taiko.Mods
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
|
||||
{
|
||||
drawableTaikoRuleset = (DrawableTaikoRuleset)drawableRuleset;
|
||||
drawableTaikoRuleset.LockPlayfieldAspect.Value = false;
|
||||
drawableTaikoRuleset.LockPlayfieldMaxAspect.Value = false;
|
||||
|
||||
var playfield = (TaikoPlayfield)drawableRuleset.Playfield;
|
||||
playfield.ClassicHitTargetPosition.Value = true;
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
public new BindableDouble TimeRange => base.TimeRange;
|
||||
|
||||
public readonly BindableBool LockPlayfieldAspect = new BindableBool(true);
|
||||
public readonly BindableBool LockPlayfieldMaxAspect = new BindableBool(true);
|
||||
|
||||
protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping;
|
||||
|
||||
@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
public override PlayfieldAdjustmentContainer CreatePlayfieldAdjustmentContainer() => new TaikoPlayfieldAdjustmentContainer
|
||||
{
|
||||
LockPlayfieldAspect = { BindTarget = LockPlayfieldAspect }
|
||||
LockPlayfieldMaxAspect = { BindTarget = LockPlayfieldMaxAspect }
|
||||
};
|
||||
|
||||
protected override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo);
|
||||
|
@ -107,24 +107,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
if (!validMouse(e))
|
||||
return false;
|
||||
|
||||
handleDown(e.Button, e.ScreenSpaceMousePosition);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
if (!validMouse(e))
|
||||
return;
|
||||
|
||||
handleUp(e.Button);
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnTouchDown(TouchDownEvent e)
|
||||
{
|
||||
handleDown(e.Touch.Source, e.ScreenSpaceTouchDownPosition);
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
private const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
||||
private const float default_aspect = 16f / 9f;
|
||||
|
||||
public readonly IBindable<bool> LockPlayfieldAspect = new BindableBool(true);
|
||||
public readonly IBindable<bool> LockPlayfieldMaxAspect = new BindableBool(true);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
@ -21,7 +21,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
float height = default_relative_height;
|
||||
|
||||
if (LockPlayfieldAspect.Value)
|
||||
// Players coming from stable expect to be able to change the aspect ratio regardless of the window size.
|
||||
// We originally wanted to limit this more, but there was considerable pushback from the community.
|
||||
//
|
||||
// As a middle-ground, the aspect ratio can still be adjusted in the downwards direction but has a maximum limit.
|
||||
// This is still a bit weird, because readability changes with window size, but it is what it is.
|
||||
if (LockPlayfieldMaxAspect.Value && Parent.ChildSize.X / Parent.ChildSize.Y > default_aspect)
|
||||
height *= Math.Clamp(Parent.ChildSize.X / Parent.ChildSize.Y, 0.4f, 4) / default_aspect;
|
||||
|
||||
Height = height;
|
||||
|
BIN
osu.Game.Tests/Resources/Archives/modified-default-20221205.osk
Normal file
BIN
osu.Game.Tests/Resources/Archives/modified-default-20221205.osk
Normal file
Binary file not shown.
@ -42,7 +42,9 @@ namespace osu.Game.Tests.Skins
|
||||
// Covers longest combo counter
|
||||
"Archives/modified-default-20221012.osk",
|
||||
// Covers TextElement and BeatmapInfoDrawable
|
||||
"Archives/modified-default-20221102.osk"
|
||||
"Archives/modified-default-20221102.osk",
|
||||
// Covers BPM counter.
|
||||
"Archives/modified-default-20221205.osk"
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
|
@ -6,6 +6,7 @@
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Components.Timelines.Summary;
|
||||
@ -21,7 +22,13 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
public TestSceneEditorSummaryTimeline()
|
||||
{
|
||||
editorBeatmap = new EditorBeatmap(CreateBeatmap(new OsuRuleset().RulesetInfo));
|
||||
var beatmap = CreateBeatmap(new OsuRuleset().RulesetInfo);
|
||||
|
||||
beatmap.ControlPointInfo.Add(100000, new TimingControlPoint { BeatLength = 100 });
|
||||
beatmap.ControlPointInfo.Add(50000, new DifficultyControlPoint { SliderVelocity = 2 });
|
||||
beatmap.BeatmapInfo.Bookmarks = new[] { 75000, 125000 };
|
||||
|
||||
editorBeatmap = new EditorBeatmap(beatmap);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
35
osu.Game.Tests/Visual/Editing/TestScenePreviewTime.cs
Normal file
35
osu.Game.Tests/Visual/Editing/TestScenePreviewTime.cs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public partial class TestScenePreviewTime : EditorTestScene
|
||||
{
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
|
||||
[Test]
|
||||
public void TestSceneSetPreviewTimingPoint()
|
||||
{
|
||||
AddStep("seek to 1000", () => EditorClock.Seek(1000));
|
||||
AddAssert("time is 1000", () => EditorClock.CurrentTime == 1000);
|
||||
AddStep("set current time as preview point", () => Editor.SetPreviewPointToCurrentTime());
|
||||
AddAssert("preview time is 1000", () => EditorBeatmap.PreviewTime.Value == 1000);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScenePreviewTimeline()
|
||||
{
|
||||
AddStep("set preview time to -1", () => EditorBeatmap.PreviewTime.Value = -1);
|
||||
AddAssert("preview time line should not show", () => !Editor.ChildrenOfType<PreviewTimePart>().Single().Children.Any());
|
||||
AddStep("set preview time to 1000", () => EditorBeatmap.PreviewTime.Value = 1000);
|
||||
AddAssert("preview time line should show", () => Editor.ChildrenOfType<PreviewTimePart>().Single().Children.Single().Alpha == 1);
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
@ -46,10 +47,14 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
AddAssert("item removed", () => !playlist.Items.Contains(selectedItem));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNextItemSelectedAfterDeletion()
|
||||
[TestCase(true)]
|
||||
[TestCase(false)]
|
||||
public void TestNextItemSelectedAfterDeletion(bool allowSelection)
|
||||
{
|
||||
createPlaylist();
|
||||
createPlaylist(p =>
|
||||
{
|
||||
p.AllowSelection = allowSelection;
|
||||
});
|
||||
|
||||
moveToItem(0);
|
||||
AddStep("click", () => InputManager.Click(MouseButton.Left));
|
||||
@ -57,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
moveToDeleteButton(0);
|
||||
AddStep("click delete button", () => InputManager.Click(MouseButton.Left));
|
||||
|
||||
AddAssert("item 0 is selected", () => playlist.SelectedItem.Value == playlist.Items[0]);
|
||||
AddAssert("item 0 is " + (allowSelection ? "selected" : "not selected"), () => playlist.SelectedItem.Value == (allowSelection ? playlist.Items[0] : null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -117,7 +122,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
InputManager.MoveMouseTo(item.ChildrenOfType<DrawableRoomPlaylistItem.PlaylistRemoveButton>().ElementAt(0), offset);
|
||||
});
|
||||
|
||||
private void createPlaylist()
|
||||
private void createPlaylist(Action<TestPlaylist> setupPlaylist = null)
|
||||
{
|
||||
AddStep("create playlist", () =>
|
||||
{
|
||||
@ -154,6 +159,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
setupPlaylist?.Invoke(playlist);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for items to load", () => playlist.ItemMap.Values.All(i => i.IsLoaded));
|
||||
|
@ -27,6 +27,7 @@ using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.OnlinePlay.Lounge;
|
||||
using osu.Game.Screens.OnlinePlay.Match.Components;
|
||||
using osu.Game.Screens.OnlinePlay.Playlists;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
@ -80,7 +81,25 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
AddUntilStep("wait for return to playlist screen", () => playlistScreen.CurrentSubScreen is PlaylistsRoomSubScreen);
|
||||
|
||||
AddStep("go back to song select", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(playlistScreen.ChildrenOfType<PurpleRoundedButton>().Single(b => b.Text == "Edit playlist"));
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for song select", () => (playlistScreen.CurrentSubScreen as PlaylistsSongSelect)?.BeatmapSetsLoaded == true);
|
||||
|
||||
AddStep("press home button", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(Game.Toolbar.ChildrenOfType<ToolbarHomeButton>().Single());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddAssert("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is not null);
|
||||
|
||||
pushEscape();
|
||||
pushEscape();
|
||||
|
||||
AddAssert("confirmation dialog shown", () => Game.ChildrenOfType<DialogOverlay>().Single().CurrentDialog is not null);
|
||||
|
||||
AddStep("confirm exit", () => InputManager.Key(Key.Enter));
|
||||
|
@ -54,6 +54,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
overlay.ShowBeatmapSet(new APIBeatmapSet
|
||||
{
|
||||
Genre = new BeatmapSetOnlineGenre { Id = 15, Name = "Future genre" },
|
||||
Language = new BeatmapSetOnlineLanguage { Id = 15, Name = "Future language" },
|
||||
OnlineID = 1235,
|
||||
Title = @"an awesome beatmap",
|
||||
Artist = @"naru narusegawa",
|
||||
|
@ -39,8 +39,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
Child = section = new HistoricalSection(),
|
||||
});
|
||||
|
||||
AddStep("Show peppy", () => section.UserProfile.Value = new UserProfile(new APIUser { Id = 2 }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Show WubWoofWolf", () => section.UserProfile.Value = new UserProfile(new APIUser { Id = 39828 }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Show peppy", () => section.User.Value = new UserProfileData(new APIUser { Id = 2 }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Show WubWoofWolf", () => section.User.Value = new UserProfileData(new APIUser { Id = 39828 }, new OsuRuleset().RulesetInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Red);
|
||||
|
||||
private readonly Bindable<UserProfile?> user = new Bindable<UserProfile?>();
|
||||
private readonly Bindable<UserProfileData?> user = new Bindable<UserProfileData?>();
|
||||
private readonly PlayHistorySubsection section;
|
||||
|
||||
public TestScenePlayHistorySubsection()
|
||||
@ -45,49 +45,49 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestNullValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_null_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_null_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is hidden", () => section.Alpha == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestEmptyValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_empty_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_empty_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is hidden", () => section.Alpha == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOneValue()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_one_value, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_one_value, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is hidden", () => section.Alpha == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestTwoValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_two_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_two_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstantValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_constant_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_constant_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestConstantZeroValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_zero_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_zero_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFilledValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_filled_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_filled_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||
AddAssert("Array length is the same", () => user_with_filled_values.MonthlyPlayCounts.Length == getChartValuesLength());
|
||||
}
|
||||
@ -95,7 +95,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestMissingValues()
|
||||
{
|
||||
AddStep("Load user", () => user.Value = new UserProfile(user_with_missing_values, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Load user", () => user.Value = new UserProfileData(user_with_missing_values, new OsuRuleset().RulesetInfo));
|
||||
AddAssert("Section is visible", () => section.Alpha == 1);
|
||||
AddAssert("Array length is 7", () => getChartValuesLength() == 7);
|
||||
}
|
||||
|
@ -22,25 +22,25 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
public TestSceneProfileRulesetSelector()
|
||||
{
|
||||
var userProfile = new Bindable<UserProfile?>();
|
||||
var user = new Bindable<UserProfileData?>();
|
||||
|
||||
Child = new ProfileRulesetSelector
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
UserProfile = { BindTarget = userProfile }
|
||||
User = { BindTarget = user }
|
||||
};
|
||||
AddStep("User on osu ruleset", () => userProfile.Value = new UserProfile(new APIUser { Id = 0, PlayMode = "osu" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User on taiko ruleset", () => userProfile.Value = new UserProfile(new APIUser { Id = 1, PlayMode = "osu" }, new TaikoRuleset().RulesetInfo));
|
||||
AddStep("User on catch ruleset", () => userProfile.Value = new UserProfile(new APIUser { Id = 2, PlayMode = "osu" }, new CatchRuleset().RulesetInfo));
|
||||
AddStep("User on mania ruleset", () => userProfile.Value = new UserProfile(new APIUser { Id = 3, PlayMode = "osu" }, new ManiaRuleset().RulesetInfo));
|
||||
AddStep("User on osu ruleset", () => user.Value = new UserProfileData(new APIUser { Id = 0, PlayMode = "osu" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User on taiko ruleset", () => user.Value = new UserProfileData(new APIUser { Id = 1, PlayMode = "osu" }, new TaikoRuleset().RulesetInfo));
|
||||
AddStep("User on catch ruleset", () => user.Value = new UserProfileData(new APIUser { Id = 2, PlayMode = "osu" }, new CatchRuleset().RulesetInfo));
|
||||
AddStep("User on mania ruleset", () => user.Value = new UserProfileData(new APIUser { Id = 3, PlayMode = "osu" }, new ManiaRuleset().RulesetInfo));
|
||||
|
||||
AddStep("User with osu as default", () => userProfile.Value = new UserProfile(new APIUser { Id = 0, PlayMode = "osu" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with taiko as default", () => userProfile.Value = new UserProfile(new APIUser { Id = 1, PlayMode = "taiko" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with catch as default", () => userProfile.Value = new UserProfile(new APIUser { Id = 2, PlayMode = "fruits" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with mania as default", () => userProfile.Value = new UserProfile(new APIUser { Id = 3, PlayMode = "mania" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with osu as default", () => user.Value = new UserProfileData(new APIUser { Id = 0, PlayMode = "osu" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with taiko as default", () => user.Value = new UserProfileData(new APIUser { Id = 1, PlayMode = "taiko" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with catch as default", () => user.Value = new UserProfileData(new APIUser { Id = 2, PlayMode = "fruits" }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("User with mania as default", () => user.Value = new UserProfileData(new APIUser { Id = 3, PlayMode = "mania" }, new OsuRuleset().RulesetInfo));
|
||||
|
||||
AddStep("null user", () => userProfile.Value = null);
|
||||
AddStep("null user", () => user.Value = null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestBasic()
|
||||
{
|
||||
AddStep("Show example user", () => header.UserProfile.Value = new UserProfile(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Show example user", () => header.User.Value = new UserProfileData(TestSceneUserProfileOverlay.TEST_USER, new OsuRuleset().RulesetInfo));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestOnlineState()
|
||||
{
|
||||
AddStep("Show online user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||
AddStep("Show online user", () => header.User.Value = new UserProfileData(new APIUser
|
||||
{
|
||||
Id = 1001,
|
||||
Username = "IAmOnline",
|
||||
@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
IsOnline = true,
|
||||
}, new OsuRuleset().RulesetInfo));
|
||||
|
||||
AddStep("Show offline user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||
AddStep("Show offline user", () => header.User.Value = new UserProfileData(new APIUser
|
||||
{
|
||||
Id = 1002,
|
||||
Username = "IAmOffline",
|
||||
@ -56,10 +56,11 @@ namespace osu.Game.Tests.Visual.Online
|
||||
[Test]
|
||||
public void TestRankedState()
|
||||
{
|
||||
AddStep("Show ranked user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||
AddStep("Show ranked user", () => header.User.Value = new UserProfileData(new APIUser
|
||||
{
|
||||
Id = 2001,
|
||||
Username = "RankedUser",
|
||||
Groups = new[] { new APIUserGroup { Colour = "#EB47D0", ShortName = "DEV", Name = "Developers" } },
|
||||
Statistics = new UserStatistics
|
||||
{
|
||||
IsRanked = true,
|
||||
@ -73,7 +74,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
}
|
||||
}, new OsuRuleset().RulesetInfo));
|
||||
|
||||
AddStep("Show unranked user", () => header.UserProfile.Value = new UserProfile(new APIUser
|
||||
AddStep("Show unranked user", () => header.User.Value = new UserProfileData(new APIUser
|
||||
{
|
||||
Id = 2002,
|
||||
Username = "UnrankedUser",
|
||||
|
@ -87,6 +87,11 @@ namespace osu.Game.Tests.Visual.Online
|
||||
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" } }
|
||||
},
|
||||
Statistics = new UserStatistics
|
||||
{
|
||||
IsRanked = true,
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("Show cookiezi", () => ranks.UserProfile.Value = new UserProfile(new APIUser { Id = 124493 }, new OsuRuleset().RulesetInfo));
|
||||
AddStep("Show cookiezi", () => ranks.User.Value = new UserProfileData(new APIUser { Id = 124493 }, new OsuRuleset().RulesetInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
var visibleBeatmapPanels = carousel.Items.OfType<DrawableCarouselBeatmap>().Where(p => p.IsPresent).ToArray();
|
||||
|
||||
return visibleBeatmapPanels.Length == 1
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item).BeatmapInfo.Ruleset.OnlineID == 0) == 1;
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item)!.BeatmapInfo.Ruleset.OnlineID == 0) == 1;
|
||||
});
|
||||
|
||||
AddStep("filter to ruleset 1", () => carousel.Filter(new FilterCriteria
|
||||
@ -86,8 +86,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
var visibleBeatmapPanels = carousel.Items.OfType<DrawableCarouselBeatmap>().Where(p => p.IsPresent).ToArray();
|
||||
|
||||
return visibleBeatmapPanels.Length == 2
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item).BeatmapInfo.Ruleset.OnlineID == 0) == 1
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item).BeatmapInfo.Ruleset.OnlineID == 1) == 1;
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item)!.BeatmapInfo.Ruleset.OnlineID == 0) == 1
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item)!.BeatmapInfo.Ruleset.OnlineID == 1) == 1;
|
||||
});
|
||||
|
||||
AddStep("filter to ruleset 2", () => carousel.Filter(new FilterCriteria
|
||||
@ -101,8 +101,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
var visibleBeatmapPanels = carousel.Items.OfType<DrawableCarouselBeatmap>().Where(p => p.IsPresent).ToArray();
|
||||
|
||||
return visibleBeatmapPanels.Length == 2
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item).BeatmapInfo.Ruleset.OnlineID == 0) == 1
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item).BeatmapInfo.Ruleset.OnlineID == 2) == 1;
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item!).BeatmapInfo.Ruleset.OnlineID == 0) == 1
|
||||
&& visibleBeatmapPanels.Count(p => ((CarouselBeatmap)p.Item!).BeatmapInfo.Ruleset.OnlineID == 2) == 1;
|
||||
});
|
||||
}
|
||||
|
||||
@ -1069,7 +1069,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
return Precision.AlmostEquals(
|
||||
carousel.ScreenSpaceDrawQuad.Centre,
|
||||
carousel.Items
|
||||
.First(i => i.Item.State.Value == CarouselItemState.Selected)
|
||||
.First(i => i.Item?.State.Value == CarouselItemState.Selected)
|
||||
.ScreenSpaceDrawQuad.Centre, 100);
|
||||
});
|
||||
}
|
||||
@ -1103,7 +1103,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
if (currentlySelected == null)
|
||||
return true;
|
||||
|
||||
return currentlySelected.Item.Visible;
|
||||
return currentlySelected.Item!.Visible;
|
||||
}
|
||||
|
||||
private void checkInvisibleDifficultiesUnselectable()
|
||||
|
@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("select next and enter", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||
.First(b => !((CarouselBeatmap)b.Item).BeatmapInfo.Equals(songSelect!.Carousel.SelectedBeatmapInfo)));
|
||||
.First(b => !((CarouselBeatmap)b.Item!).BeatmapInfo.Equals(songSelect!.Carousel.SelectedBeatmapInfo)));
|
||||
|
||||
InputManager.Click(MouseButton.Left);
|
||||
|
||||
@ -235,7 +235,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep("select next and enter", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmap>()
|
||||
.First(b => !((CarouselBeatmap)b.Item).BeatmapInfo.Equals(songSelect!.Carousel.SelectedBeatmapInfo)));
|
||||
.First(b => !((CarouselBeatmap)b.Item!).BeatmapInfo.Equals(songSelect!.Carousel.SelectedBeatmapInfo)));
|
||||
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
|
||||
@ -614,7 +614,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
AddAssert("selected only shows expected ruleset (plus converts)", () =>
|
||||
{
|
||||
var selectedPanel = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First(s => s.Item.State.Value == CarouselItemState.Selected);
|
||||
var selectedPanel = songSelect!.Carousel.ChildrenOfType<DrawableCarouselBeatmapSet>().First(s => s.Item!.State.Value == CarouselItemState.Selected);
|
||||
|
||||
// special case for converts checked here.
|
||||
return selectedPanel.ChildrenOfType<FilterableDifficultyIcon>().All(i =>
|
||||
|
106
osu.Game.Tests/Visual/UserInterface/TestSceneOverlayContainer.cs
Normal file
106
osu.Game.Tests/Visual/UserInterface/TestSceneOverlayContainer.cs
Normal file
@ -0,0 +1,106 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays.Volume;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
using Box = osu.Framework.Graphics.Shapes.Box;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public partial class TestSceneOverlayContainer : OsuManualInputManagerTestScene
|
||||
{
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() => Child = new TestOverlay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f)
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestScrollBlocked()
|
||||
{
|
||||
OsuScrollContainer scroll = null!;
|
||||
|
||||
AddStep("add scroll container", () =>
|
||||
{
|
||||
Add(scroll = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = DrawHeight * 10,
|
||||
Colour = ColourInfo.GradientVertical(Colour4.Black, Colour4.White),
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
AddStep("perform scroll", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(Content);
|
||||
InputManager.ScrollVerticalBy(-10);
|
||||
});
|
||||
|
||||
AddAssert("scroll didn't receive input", () => scroll.Current == 0);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAltScrollNotBlocked()
|
||||
{
|
||||
bool scrollReceived = false;
|
||||
|
||||
AddStep("add volume control receptor", () => Add(new VolumeControlReceptor
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = float.MaxValue,
|
||||
ScrollActionRequested = (_, _, _) => scrollReceived = true,
|
||||
}));
|
||||
|
||||
AddStep("hold alt", () => InputManager.PressKey(Key.AltLeft));
|
||||
AddStep("perform scroll", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(Content);
|
||||
InputManager.ScrollVerticalBy(10);
|
||||
});
|
||||
|
||||
AddAssert("receptor received scroll input", () => scrollReceived);
|
||||
AddStep("release alt", () => InputManager.ReleaseKey(Key.AltLeft));
|
||||
}
|
||||
|
||||
private partial class TestOverlay : OsuFocusedOverlayContainer
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
State.Value = Visibility.Visible;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Text = "Overlay content",
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -55,6 +55,16 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestDisplay()
|
||||
{
|
||||
AddRepeatStep("toggle expanded state", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(group.ChildrenOfType<IconButton>().Single());
|
||||
InputManager.Click(MouseButton.Left);
|
||||
}, 5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestClickExpandButtonMultipleTimes()
|
||||
{
|
||||
|
@ -44,6 +44,16 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public Action<(BeatmapSetInfo beatmapSet, bool isBatch)>? ProcessBeatmap { private get; set; }
|
||||
|
||||
public override bool PauseImports
|
||||
{
|
||||
get => base.PauseImports;
|
||||
set
|
||||
{
|
||||
base.PauseImports = value;
|
||||
beatmapImporter.PauseImports = value;
|
||||
}
|
||||
}
|
||||
|
||||
public BeatmapManager(Storage storage, RealmAccess realm, IAPIProvider? api, AudioManager audioManager, IResourceStore<byte[]> gameResources, GameHost? host = null,
|
||||
WorkingBeatmap? defaultBeatmap = null, BeatmapDifficultyCache? difficultyCache = null, bool performOnlineLookups = false)
|
||||
: base(storage, realm)
|
||||
@ -458,7 +468,8 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public Task Import(ImportTask[] tasks, ImportParameters parameters = default) => beatmapImporter.Import(tasks, parameters);
|
||||
|
||||
public Task<IEnumerable<Live<BeatmapSetInfo>>> Import(ProgressNotification notification, ImportTask[] tasks, ImportParameters parameters = default) => beatmapImporter.Import(notification, tasks, parameters);
|
||||
public Task<IEnumerable<Live<BeatmapSetInfo>>> Import(ProgressNotification notification, ImportTask[] tasks, ImportParameters parameters = default) =>
|
||||
beatmapImporter.Import(notification, tasks, parameters);
|
||||
|
||||
public Task<Live<BeatmapSetInfo>?> Import(ImportTask task, ImportParameters parameters = default, CancellationToken cancellationToken = default) =>
|
||||
beatmapImporter.Import(task, parameters, cancellationToken);
|
||||
|
22
osu.Game/Beatmaps/BeatmapSetOnlineNomination.cs
Normal file
22
osu.Game/Beatmaps/BeatmapSetOnlineNomination.cs
Normal file
@ -0,0 +1,22 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
public struct BeatmapSetOnlineNomination
|
||||
{
|
||||
[JsonProperty(@"beatmapset_id")]
|
||||
public int BeatmapsetId { get; set; }
|
||||
|
||||
[JsonProperty(@"reset")]
|
||||
public bool Reset { get; set; }
|
||||
|
||||
[JsonProperty(@"rulesets")]
|
||||
public string[]? Rulesets { get; set; }
|
||||
|
||||
[JsonProperty(@"user_id")]
|
||||
public int UserId { get; set; }
|
||||
}
|
||||
}
|
@ -5,16 +5,19 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
{
|
||||
public abstract partial class BeatmapCard : OsuClickableContainer
|
||||
public abstract partial class BeatmapCard : OsuClickableContainer, IHasContextMenu
|
||||
{
|
||||
public const float TRANSITION_DURATION = 400;
|
||||
public const float CORNER_RADIUS = 10;
|
||||
@ -96,5 +99,10 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
throw new ArgumentOutOfRangeException(nameof(size), size, @"Unsupported card size");
|
||||
}
|
||||
}
|
||||
|
||||
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||
{
|
||||
new OsuMenuItem(ContextMenuStrings.ViewBeatmap, MenuItemType.Highlighted, Action),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -138,9 +138,18 @@ namespace osu.Game.Beatmaps.Drawables.Cards
|
||||
// This avoids depth issues where a hovered (scaled) card to the right of another card would be beneath the card to the left.
|
||||
this.ScaleTo(Expanded.Value ? 1.03f : 1, 500, Easing.OutQuint);
|
||||
|
||||
background.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
dropdownContent.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
borderContainer.FadeTo(Expanded.Value ? 1 : 0, BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
if (Expanded.Value)
|
||||
{
|
||||
background.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
dropdownContent.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
borderContainer.FadeIn(BeatmapCard.TRANSITION_DURATION, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
background.FadeOut(BeatmapCard.TRANSITION_DURATION / 3f, Easing.OutQuint);
|
||||
dropdownContent.FadeOut(BeatmapCard.TRANSITION_DURATION / 3f, Easing.OutQuint);
|
||||
borderContainer.FadeOut(BeatmapCard.TRANSITION_DURATION / 3f, Easing.OutQuint);
|
||||
}
|
||||
|
||||
content.TweenEdgeEffectTo(new EdgeEffectParameters
|
||||
{
|
||||
|
@ -300,7 +300,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
var comboColour = colours[i];
|
||||
|
||||
writer.Write(FormattableString.Invariant($"Combo{i}: "));
|
||||
writer.Write(FormattableString.Invariant($"Combo{1 + i}: "));
|
||||
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.R * byte.MaxValue)},"));
|
||||
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.G * byte.MaxValue)},"));
|
||||
writer.Write(FormattableString.Invariant($"{(byte)(comboColour.B * byte.MaxValue)},"));
|
||||
|
@ -34,8 +34,6 @@ namespace osu.Game.Beatmaps
|
||||
// TODO: remove once the fallback lookup is not required (and access via `working.BeatmapInfo.Metadata` directly).
|
||||
public BeatmapMetadata Metadata => BeatmapInfo.Metadata;
|
||||
|
||||
public Waveform Waveform => waveform.Value;
|
||||
|
||||
public Storyboard Storyboard => storyboard.Value;
|
||||
|
||||
public Texture Background => GetBackground(); // Texture uses ref counting, so we want to return a new instance every usage.
|
||||
@ -48,10 +46,11 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private readonly object beatmapFetchLock = new object();
|
||||
|
||||
private readonly Lazy<Waveform> waveform;
|
||||
private readonly Lazy<Storyboard> storyboard;
|
||||
private readonly Lazy<ISkin> skin;
|
||||
|
||||
private Track track; // track is not Lazy as we allow transferring and loading multiple times.
|
||||
private Waveform waveform; // waveform is also not Lazy as the track may change.
|
||||
|
||||
protected WorkingBeatmap(BeatmapInfo beatmapInfo, AudioManager audioManager)
|
||||
{
|
||||
@ -60,7 +59,6 @@ namespace osu.Game.Beatmaps
|
||||
BeatmapInfo = beatmapInfo;
|
||||
BeatmapSetInfo = beatmapInfo.BeatmapSet ?? new BeatmapSetInfo();
|
||||
|
||||
waveform = new Lazy<Waveform>(GetWaveform);
|
||||
storyboard = new Lazy<Storyboard>(GetStoryboard);
|
||||
skin = new Lazy<ISkin>(GetSkin);
|
||||
}
|
||||
@ -108,7 +106,16 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public virtual bool TrackLoaded => track != null;
|
||||
|
||||
public Track LoadTrack() => track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||
public Track LoadTrack()
|
||||
{
|
||||
track = GetBeatmapTrack() ?? GetVirtualTrack(1000);
|
||||
|
||||
// the track may have changed, recycle the current waveform.
|
||||
waveform?.Dispose();
|
||||
waveform = null;
|
||||
|
||||
return track;
|
||||
}
|
||||
|
||||
public void PrepareTrackForPreview(bool looping, double offsetFromPreviewPoint = 0)
|
||||
{
|
||||
@ -171,6 +178,12 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
#endregion
|
||||
|
||||
#region Waveform
|
||||
|
||||
public Waveform Waveform => waveform ??= GetWaveform();
|
||||
|
||||
#endregion
|
||||
|
||||
#region Beatmap
|
||||
|
||||
public virtual bool BeatmapLoaded => beatmapLoadTask?.IsCompleted ?? false;
|
||||
|
@ -33,13 +33,15 @@ namespace osu.Game.Database
|
||||
UserFileStorage = storage.GetStorageForDirectory(@"files");
|
||||
}
|
||||
|
||||
protected virtual string GetFilename(TModel item) => item.GetDisplayString();
|
||||
|
||||
/// <summary>
|
||||
/// Exports an item to a legacy (.zip based) package.
|
||||
/// </summary>
|
||||
/// <param name="item">The item to export.</param>
|
||||
public void Export(TModel item)
|
||||
{
|
||||
string itemFilename = item.GetDisplayString().GetValidFilename();
|
||||
string itemFilename = GetFilename(item).GetValidFilename();
|
||||
|
||||
IEnumerable<string> existingExports = exportStorage.GetFiles("", $"{itemFilename}*{FileExtension}");
|
||||
|
||||
|
@ -54,14 +54,14 @@ namespace osu.Game.Database
|
||||
|
||||
public void UpdateStorage(string stablePath) => cachedStorage = new StableStorage(stablePath, gameHost as DesktopGameHost);
|
||||
|
||||
public bool CheckHardLinkAvailability()
|
||||
public bool CheckSongsFolderHardLinkAvailability()
|
||||
{
|
||||
var stableStorage = GetCurrentStableStorage();
|
||||
|
||||
if (stableStorage == null || gameHost is not DesktopGameHost desktopGameHost)
|
||||
return false;
|
||||
|
||||
string testExistingPath = stableStorage.GetFullPath(string.Empty);
|
||||
string testExistingPath = stableStorage.GetSongStorage().GetFullPath(string.Empty);
|
||||
string testDestinationPath = desktopGameHost.Storage.GetFullPath(string.Empty);
|
||||
|
||||
return HardLinkHelper.CheckAvailability(testDestinationPath, testExistingPath);
|
||||
|
@ -20,6 +20,14 @@ namespace osu.Game.Database
|
||||
{
|
||||
}
|
||||
|
||||
protected override string GetFilename(ScoreInfo score)
|
||||
{
|
||||
string scoreString = score.GetDisplayString();
|
||||
string filename = $"{scoreString} ({score.Date.LocalDateTime:yyyy-MM-dd_HH-mm})";
|
||||
|
||||
return filename;
|
||||
}
|
||||
|
||||
public override void ExportModelTo(ScoreInfo model, Stream outputStream)
|
||||
{
|
||||
var file = model.Files.SingleOrDefault();
|
||||
|
@ -18,6 +18,11 @@ namespace osu.Game.Database
|
||||
public class ModelManager<TModel> : IModelManager<TModel>, IModelFileManager<TModel, RealmNamedFileUsage>
|
||||
where TModel : RealmObject, IHasRealmFiles, IHasGuidPrimaryKey, ISoftDelete
|
||||
{
|
||||
/// <summary>
|
||||
/// Temporarily pause imports to avoid performance overheads affecting gameplay scenarios.
|
||||
/// </summary>
|
||||
public virtual bool PauseImports { get; set; }
|
||||
|
||||
protected RealmAccess Realm { get; }
|
||||
|
||||
private readonly RealmFileStore realmFileStore;
|
||||
|
@ -56,6 +56,11 @@ namespace osu.Game.Database
|
||||
/// </summary>
|
||||
private static readonly ThreadedTaskScheduler import_scheduler_batch = new ThreadedTaskScheduler(import_queue_request_concurrency, nameof(RealmArchiveModelImporter<TModel>));
|
||||
|
||||
/// <summary>
|
||||
/// Temporarily pause imports to avoid performance overheads affecting gameplay scenarios.
|
||||
/// </summary>
|
||||
public bool PauseImports { get; set; }
|
||||
|
||||
public abstract IEnumerable<string> HandledExtensions { get; }
|
||||
|
||||
protected readonly RealmFileStore Files;
|
||||
@ -149,9 +154,12 @@ namespace osu.Game.Database
|
||||
}
|
||||
else
|
||||
{
|
||||
notification.CompletionText = imported.Count == 1
|
||||
? $"Imported {imported.First().GetDisplayString()}!"
|
||||
: $"Imported {imported.Count} {HumanisedModelName}s!";
|
||||
if (tasks.Length > imported.Count)
|
||||
notification.CompletionText = $"Imported {imported.Count} of {tasks.Length} {HumanisedModelName}s.";
|
||||
else if (imported.Count > 1)
|
||||
notification.CompletionText = $"Imported {imported.Count} {HumanisedModelName}s!";
|
||||
else
|
||||
notification.CompletionText = $"Imported {imported.First().GetDisplayString()}!";
|
||||
|
||||
if (imported.Count > 0 && PresentImport != null)
|
||||
{
|
||||
@ -253,7 +261,7 @@ namespace osu.Game.Database
|
||||
/// <param name="cancellationToken">An optional cancellation token.</param>
|
||||
public virtual Live<TModel>? ImportModel(TModel item, ArchiveReader? archive = null, ImportParameters parameters = default, CancellationToken cancellationToken = default) => Realm.Run(realm =>
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
pauseIfNecessary(cancellationToken);
|
||||
|
||||
TModel? existing;
|
||||
|
||||
@ -551,6 +559,23 @@ namespace osu.Game.Database
|
||||
/// <returns>Whether to perform deletion.</returns>
|
||||
protected virtual bool ShouldDeleteArchive(string path) => false;
|
||||
|
||||
private void pauseIfNecessary(CancellationToken cancellationToken)
|
||||
{
|
||||
if (!PauseImports)
|
||||
return;
|
||||
|
||||
Logger.Log($@"{GetType().Name} is being paused.");
|
||||
|
||||
while (PauseImports)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
Thread.Sleep(500);
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
Logger.Log($@"{GetType().Name} is being resumed.");
|
||||
}
|
||||
|
||||
private IEnumerable<string> getIDs(IEnumerable<INamedFile> files)
|
||||
{
|
||||
foreach (var f in files.OrderBy(f => f.Filename))
|
||||
|
@ -25,8 +25,6 @@ namespace osu.Game.Graphics.Containers
|
||||
protected virtual string PopInSampleName => "UI/overlay-pop-in";
|
||||
protected virtual string PopOutSampleName => "UI/overlay-pop-out";
|
||||
|
||||
protected override bool BlockScrollInput => false;
|
||||
|
||||
protected override bool BlockNonPositionalInput => true;
|
||||
|
||||
/// <summary>
|
||||
@ -90,6 +88,15 @@ namespace osu.Game.Graphics.Containers
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
{
|
||||
// allow for controlling volume when alt is held.
|
||||
// mostly for compatibility with osu-stable.
|
||||
if (e.AltPressed) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public virtual bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (e.Repeat)
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
@ -117,11 +118,11 @@ namespace osu.Game.Graphics
|
||||
|
||||
host.GetClipboard()?.SetImage(image);
|
||||
|
||||
string filename = getFilename();
|
||||
(string filename, var stream) = getWritableStream();
|
||||
|
||||
if (filename == null) return;
|
||||
|
||||
using (var stream = storage.CreateFileSafely(filename))
|
||||
using (stream)
|
||||
{
|
||||
switch (screenshotFormat.Value)
|
||||
{
|
||||
@ -142,7 +143,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
notificationOverlay.Post(new SimpleNotification
|
||||
{
|
||||
Text = $"{filename} saved!",
|
||||
Text = $"Screenshot {filename} saved!",
|
||||
Activated = () =>
|
||||
{
|
||||
storage.PresentFileExternally(filename);
|
||||
@ -152,23 +153,28 @@ namespace osu.Game.Graphics
|
||||
}
|
||||
});
|
||||
|
||||
private string getFilename()
|
||||
private static readonly object filename_reservation_lock = new object();
|
||||
|
||||
private (string filename, Stream stream) getWritableStream()
|
||||
{
|
||||
var dt = DateTime.Now;
|
||||
string fileExt = screenshotFormat.ToString().ToLowerInvariant();
|
||||
|
||||
string withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}";
|
||||
if (!storage.Exists(withoutIndex))
|
||||
return withoutIndex;
|
||||
|
||||
for (ulong i = 1; i < ulong.MaxValue; i++)
|
||||
lock (filename_reservation_lock)
|
||||
{
|
||||
string indexedName = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}-{i}.{fileExt}";
|
||||
if (!storage.Exists(indexedName))
|
||||
return indexedName;
|
||||
}
|
||||
var dt = DateTime.Now;
|
||||
string fileExt = screenshotFormat.ToString().ToLowerInvariant();
|
||||
|
||||
return null;
|
||||
string withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}";
|
||||
if (!storage.Exists(withoutIndex))
|
||||
return (withoutIndex, storage.GetStream(withoutIndex, FileAccess.Write, FileMode.Create));
|
||||
|
||||
for (ulong i = 1; i < ulong.MaxValue; i++)
|
||||
{
|
||||
string indexedName = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}-{i}.{fileExt}";
|
||||
if (!storage.Exists(indexedName))
|
||||
return (indexedName, storage.GetStream(indexedName, FileAccess.Write, FileMode.Create));
|
||||
}
|
||||
|
||||
return (null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.ShiftPressed)
|
||||
return false;
|
||||
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Up:
|
||||
|
24
osu.Game/Localisation/ContextMenuStrings.cs
Normal file
24
osu.Game/Localisation/ContextMenuStrings.cs
Normal file
@ -0,0 +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.
|
||||
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation
|
||||
{
|
||||
public static class ContextMenuStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.ContextMenu";
|
||||
|
||||
/// <summary>
|
||||
/// "View profile"
|
||||
/// </summary>
|
||||
public static LocalisableString ViewProfile => new TranslatableString(getKey(@"view_profile"), @"View profile");
|
||||
|
||||
/// <summary>
|
||||
/// "View beatmap"
|
||||
/// </summary>
|
||||
public static LocalisableString ViewBeatmap => new TranslatableString(getKey(@"view_beatmap"), @"View beatmap");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -54,11 +54,6 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString RestartAndReOpenRequiredForCompletion => new TranslatableString(getKey(@"restart_and_re_open_required_for_completion"), @"To complete this operation, osu! will close. Please open it again to use the new data location.");
|
||||
|
||||
/// <summary>
|
||||
/// "Import beatmaps from stable"
|
||||
/// </summary>
|
||||
public static LocalisableString ImportBeatmapsFromStable => new TranslatableString(getKey(@"import_beatmaps_from_stable"), @"Import beatmaps from stable");
|
||||
|
||||
/// <summary>
|
||||
/// "Delete ALL beatmaps"
|
||||
/// </summary>
|
||||
@ -69,31 +64,16 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString DeleteAllBeatmapVideos => new TranslatableString(getKey(@"delete_all_beatmap_videos"), @"Delete ALL beatmap videos");
|
||||
|
||||
/// <summary>
|
||||
/// "Import scores from stable"
|
||||
/// </summary>
|
||||
public static LocalisableString ImportScoresFromStable => new TranslatableString(getKey(@"import_scores_from_stable"), @"Import scores from stable");
|
||||
|
||||
/// <summary>
|
||||
/// "Delete ALL scores"
|
||||
/// </summary>
|
||||
public static LocalisableString DeleteAllScores => new TranslatableString(getKey(@"delete_all_scores"), @"Delete ALL scores");
|
||||
|
||||
/// <summary>
|
||||
/// "Import skins from stable"
|
||||
/// </summary>
|
||||
public static LocalisableString ImportSkinsFromStable => new TranslatableString(getKey(@"import_skins_from_stable"), @"Import skins from stable");
|
||||
|
||||
/// <summary>
|
||||
/// "Delete ALL skins"
|
||||
/// </summary>
|
||||
public static LocalisableString DeleteAllSkins => new TranslatableString(getKey(@"delete_all_skins"), @"Delete ALL skins");
|
||||
|
||||
/// <summary>
|
||||
/// "Import collections from stable"
|
||||
/// </summary>
|
||||
public static LocalisableString ImportCollectionsFromStable => new TranslatableString(getKey(@"import_collections_from_stable"), @"Import collections from stable");
|
||||
|
||||
/// <summary>
|
||||
/// "Delete ALL collections"
|
||||
/// </summary>
|
||||
|
@ -259,7 +259,11 @@ namespace osu.Game.Online.API
|
||||
|
||||
var friendsReq = new GetFriendsRequest();
|
||||
friendsReq.Failure += _ => state.Value = APIState.Failing;
|
||||
friendsReq.Success += res => friends.AddRange(res);
|
||||
friendsReq.Success += res =>
|
||||
{
|
||||
friends.Clear();
|
||||
friends.AddRange(res);
|
||||
};
|
||||
|
||||
if (!handleRequest(friendsReq))
|
||||
{
|
||||
|
@ -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.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
@ -11,10 +9,11 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetScoresRequest : APIRequest<APIScoresCollection>
|
||||
public class GetScoresRequest : APIRequest<APIScoresCollection>, IEquatable<GetScoresRequest>
|
||||
{
|
||||
public const int MAX_SCORES_PER_REQUEST = 50;
|
||||
|
||||
@ -23,7 +22,7 @@ namespace osu.Game.Online.API.Requests
|
||||
private readonly IRulesetInfo ruleset;
|
||||
private readonly IEnumerable<IMod> mods;
|
||||
|
||||
public GetScoresRequest(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset, BeatmapLeaderboardScope scope = BeatmapLeaderboardScope.Global, IEnumerable<IMod> mods = null)
|
||||
public GetScoresRequest(IBeatmapInfo beatmapInfo, IRulesetInfo ruleset, BeatmapLeaderboardScope scope = BeatmapLeaderboardScope.Global, IEnumerable<IMod>? mods = null)
|
||||
{
|
||||
if (beatmapInfo.OnlineID <= 0)
|
||||
throw new InvalidOperationException($"Cannot lookup a beatmap's scores without having a populated {nameof(IBeatmapInfo.OnlineID)}.");
|
||||
@ -51,5 +50,16 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
return query.ToString();
|
||||
}
|
||||
|
||||
public bool Equals(GetScoresRequest? other)
|
||||
{
|
||||
if (ReferenceEquals(null, other)) return false;
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
|
||||
return beatmapInfo.Equals(other.beatmapInfo)
|
||||
&& scope == other.scope
|
||||
&& ruleset.Equals(other.ruleset)
|
||||
&& mods.SequenceEqual(other.mods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,12 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"language")]
|
||||
public BeatmapSetOnlineLanguage Language { get; set; }
|
||||
|
||||
[JsonProperty(@"current_nominations")]
|
||||
public BeatmapSetOnlineNomination[]? CurrentNominations { get; set; }
|
||||
|
||||
[JsonProperty(@"related_users")]
|
||||
public APIUser[]? RelatedUsers { get; set; }
|
||||
|
||||
public string Source { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty(@"tags")]
|
||||
|
@ -255,6 +255,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[CanBeNull]
|
||||
public Dictionary<string, UserStatistics> RulesetsStatistics { get; set; }
|
||||
|
||||
[JsonProperty("groups")]
|
||||
public APIUserGroup[] Groups;
|
||||
|
||||
public override string ToString() => Username;
|
||||
|
||||
/// <summary>
|
||||
|
37
osu.Game/Online/API/Requests/Responses/APIUserGroup.cs
Normal file
37
osu.Game/Online/API/Requests/Responses/APIUserGroup.cs
Normal file
@ -0,0 +1,37 @@
|
||||
// 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 Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIUserGroup
|
||||
{
|
||||
[JsonProperty(@"colour")]
|
||||
public string Colour { get; set; } = null!;
|
||||
|
||||
[JsonProperty(@"has_listing")]
|
||||
public bool HasListings { get; set; }
|
||||
|
||||
[JsonProperty(@"has_playmodes")]
|
||||
public bool HasPlaymodes { get; set; }
|
||||
|
||||
[JsonProperty(@"id")]
|
||||
public int Id { get; set; }
|
||||
|
||||
[JsonProperty(@"identifier")]
|
||||
public string Identifier { get; set; } = null!;
|
||||
|
||||
[JsonProperty(@"is_probationary")]
|
||||
public bool IsProbationary { get; set; }
|
||||
|
||||
[JsonProperty(@"name")]
|
||||
public string Name { get; set; } = null!;
|
||||
|
||||
[JsonProperty(@"short_name")]
|
||||
public string ShortName { get; set; } = null!;
|
||||
|
||||
[JsonProperty(@"playmodes")]
|
||||
public string[]? Playmodes { get; set; }
|
||||
}
|
||||
}
|
@ -71,7 +71,6 @@ namespace osu.Game.Online.Chat
|
||||
private UserLookupCache users { get; set; }
|
||||
|
||||
private readonly IBindable<APIState> apiState = new Bindable<APIState>();
|
||||
private bool channelsInitialised;
|
||||
private ScheduledDelegate scheduledAck;
|
||||
|
||||
private long? lastSilenceMessageId;
|
||||
@ -95,15 +94,7 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
connector.NewMessages += msgs => Schedule(() => addMessages(msgs));
|
||||
|
||||
connector.PresenceReceived += () => Schedule(() =>
|
||||
{
|
||||
if (!channelsInitialised)
|
||||
{
|
||||
channelsInitialised = true;
|
||||
// we want this to run after the first presence so we can see if the user is in any channels already.
|
||||
initializeChannels();
|
||||
}
|
||||
});
|
||||
connector.PresenceReceived += () => Schedule(initializeChannels);
|
||||
|
||||
connector.Start();
|
||||
|
||||
@ -335,6 +326,11 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
private void initializeChannels()
|
||||
{
|
||||
// This request is self-retrying until it succeeds.
|
||||
// To avoid requests piling up when not logged in (ie. API is unavailable) exit early.
|
||||
if (!api.IsLoggedIn)
|
||||
return;
|
||||
|
||||
var req = new ListChannelsRequest();
|
||||
|
||||
bool joinDefaults = JoinedChannels.Count == 0;
|
||||
@ -350,10 +346,11 @@ namespace osu.Game.Online.Chat
|
||||
joinChannel(ch);
|
||||
}
|
||||
};
|
||||
|
||||
req.Failure += error =>
|
||||
{
|
||||
Logger.Error(error, "Fetching channel list failed");
|
||||
initializeChannels();
|
||||
Scheduler.AddDelayed(initializeChannels, 60000);
|
||||
};
|
||||
|
||||
api.Queue(req);
|
||||
|
@ -341,6 +341,8 @@ namespace osu.Game.Online.Chat
|
||||
OpenWiki,
|
||||
Custom,
|
||||
OpenChangelog,
|
||||
FilterBeatmapSetGenre,
|
||||
FilterBeatmapSetLanguage,
|
||||
}
|
||||
|
||||
public class Link : IComparable<Link>
|
||||
|
@ -46,6 +46,7 @@ using osu.Game.Online;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
using osu.Game.Overlays.Music;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Overlays.Toolbar;
|
||||
@ -306,6 +307,13 @@ namespace osu.Game
|
||||
// Transfer any runtime changes back to configuration file.
|
||||
SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID.ToString();
|
||||
|
||||
LocalUserPlaying.BindValueChanged(p =>
|
||||
{
|
||||
BeatmapManager.PauseImports = p.NewValue;
|
||||
SkinManager.PauseImports = p.NewValue;
|
||||
ScoreManager.PauseImports = p.NewValue;
|
||||
}, true);
|
||||
|
||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||
|
||||
Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeFade);
|
||||
@ -359,6 +367,14 @@ namespace osu.Game
|
||||
SearchBeatmapSet(argString);
|
||||
break;
|
||||
|
||||
case LinkAction.FilterBeatmapSetGenre:
|
||||
FilterBeatmapSetGenre((SearchGenre)link.Argument);
|
||||
break;
|
||||
|
||||
case LinkAction.FilterBeatmapSetLanguage:
|
||||
FilterBeatmapSetLanguage((SearchLanguage)link.Argument);
|
||||
break;
|
||||
|
||||
case LinkAction.OpenEditorTimestamp:
|
||||
case LinkAction.JoinMultiplayerMatch:
|
||||
case LinkAction.Spectate:
|
||||
@ -463,6 +479,10 @@ namespace osu.Game
|
||||
/// <param name="query">The query to search for.</param>
|
||||
public void SearchBeatmapSet(string query) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithSearch(query));
|
||||
|
||||
public void FilterBeatmapSetGenre(SearchGenre genre) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithGenreFilter(genre));
|
||||
|
||||
public void FilterBeatmapSetLanguage(SearchLanguage language) => waitForReady(() => beatmapListing, _ => beatmapListing.ShowWithLanguageFilter(language));
|
||||
|
||||
/// <summary>
|
||||
/// Show a wiki's page as an overlay
|
||||
/// </summary>
|
||||
|
@ -145,6 +145,12 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
public void Search(string query)
|
||||
=> Schedule(() => searchControl.Query.Value = query);
|
||||
|
||||
public void FilterGenre(SearchGenre genre)
|
||||
=> Schedule(() => searchControl.Genre.Value = genre);
|
||||
|
||||
public void FilterLanguage(SearchLanguage language)
|
||||
=> Schedule(() => searchControl.Language.Value = language);
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
@ -12,6 +12,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osuTK;
|
||||
@ -100,9 +101,30 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
|
||||
protected partial class MultipleSelectionFilterTabItem : FilterTabItem<T>
|
||||
{
|
||||
private readonly Box selectedUnderline;
|
||||
|
||||
protected override bool HighlightOnHoverWhenActive => true;
|
||||
|
||||
public MultipleSelectionFilterTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
// This doesn't match any actual design, but should make it easier for the user to understand
|
||||
// that filters are applied until we settle on a final design.
|
||||
AddInternal(selectedUnderline = new Box
|
||||
{
|
||||
Depth = float.MaxValue,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 1.5f,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
});
|
||||
}
|
||||
|
||||
protected override void UpdateState()
|
||||
{
|
||||
base.UpdateState();
|
||||
selectedUnderline.FadeTo(Active.Value ? 1 : 0, 200, Easing.OutQuint);
|
||||
selectedUnderline.FadeColour(IsHovered ? ColourProvider.Content2 : GetStateColour(), 200, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
public partial class FilterTabItem<T> : TabItem<T>
|
||||
{
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; }
|
||||
protected OverlayColourProvider ColourProvider { get; private set; }
|
||||
|
||||
private OsuSpriteText text;
|
||||
|
||||
@ -52,38 +52,42 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
updateState();
|
||||
UpdateState();
|
||||
FinishTransforms(true);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
base.OnHover(e);
|
||||
updateState();
|
||||
UpdateState();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
base.OnHoverLost(e);
|
||||
updateState();
|
||||
UpdateState();
|
||||
}
|
||||
|
||||
protected override void OnActivated() => updateState();
|
||||
protected override void OnActivated() => UpdateState();
|
||||
|
||||
protected override void OnDeactivated() => updateState();
|
||||
protected override void OnDeactivated() => UpdateState();
|
||||
|
||||
/// <summary>
|
||||
/// Returns the label text to be used for the supplied <paramref name="value"/>.
|
||||
/// </summary>
|
||||
protected virtual LocalisableString LabelFor(T value) => (value as Enum)?.GetLocalisableDescription() ?? value.ToString();
|
||||
|
||||
private void updateState()
|
||||
protected virtual bool HighlightOnHoverWhenActive => false;
|
||||
|
||||
protected virtual void UpdateState()
|
||||
{
|
||||
text.FadeColour(IsHovered ? colourProvider.Light1 : GetStateColour(), 200, Easing.OutQuint);
|
||||
text.Font = text.Font.With(weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
|
||||
bool highlightHover = IsHovered && (!Active.Value || HighlightOnHoverWhenActive);
|
||||
|
||||
text.FadeColour(highlightHover ? ColourProvider.Content2 : GetStateColour(), 200, Easing.OutQuint);
|
||||
text.Font = text.Font.With(weight: Active.Value ? FontWeight.Bold : FontWeight.Regular);
|
||||
}
|
||||
|
||||
protected virtual Color4 GetStateColour() => Active.Value ? colourProvider.Content1 : colourProvider.Light2;
|
||||
protected virtual Color4 GetStateColour() => Active.Value ? ColourProvider.Content1 : ColourProvider.Light2;
|
||||
}
|
||||
}
|
||||
|
@ -110,6 +110,18 @@ namespace osu.Game.Overlays
|
||||
ScrollFlow.ScrollToStart();
|
||||
}
|
||||
|
||||
public void ShowWithGenreFilter(SearchGenre genre)
|
||||
{
|
||||
ShowWithSearch(string.Empty);
|
||||
filterControl.FilterGenre(genre);
|
||||
}
|
||||
|
||||
public void ShowWithLanguageFilter(SearchLanguage language)
|
||||
{
|
||||
ShowWithSearch(string.Empty);
|
||||
filterControl.FilterLanguage(language);
|
||||
}
|
||||
|
||||
protected override BeatmapListingHeader CreateHeader() => new BeatmapListingHeader();
|
||||
|
||||
protected override Color4 BackgroundColour => ColourProvider.Background6;
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -91,79 +90,74 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
},
|
||||
},
|
||||
},
|
||||
new OsuContextMenuContainer
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = new Container
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding
|
||||
Vertical = BeatmapSetOverlay.Y_PADDING,
|
||||
Left = BeatmapSetOverlay.X_PADDING,
|
||||
Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
fadeContent = new FillFlowContainer
|
||||
{
|
||||
Vertical = BeatmapSetOverlay.Y_PADDING,
|
||||
Left = BeatmapSetOverlay.X_PADDING,
|
||||
Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
fadeContent = new FillFlowContainer
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
new Container
|
||||
{
|
||||
new Container
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = Picker = new BeatmapPicker(),
|
||||
},
|
||||
title = new MetadataFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.GetFont(size: 30, weight: FontWeight.SemiBold, italics: true);
|
||||
})
|
||||
{
|
||||
Margin = new MarginPadding { Top = 15 },
|
||||
},
|
||||
artist = new MetadataFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, italics: true);
|
||||
})
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 20 },
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = author = new AuthorInfo(),
|
||||
},
|
||||
beatmapAvailability = new BeatmapAvailability(),
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = buttons_height,
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = Picker = new BeatmapPicker(),
|
||||
},
|
||||
title = new MetadataFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.GetFont(size: 30, weight: FontWeight.SemiBold, italics: true);
|
||||
})
|
||||
{
|
||||
Margin = new MarginPadding { Top = 15 },
|
||||
},
|
||||
artist = new MetadataFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, italics: true);
|
||||
})
|
||||
{
|
||||
Margin = new MarginPadding { Bottom = 20 },
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = author = new AuthorInfo(),
|
||||
},
|
||||
beatmapAvailability = new BeatmapAvailability(),
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = buttons_height,
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Children = new Drawable[]
|
||||
favouriteButton = new FavouriteButton
|
||||
{
|
||||
favouriteButton = new FavouriteButton
|
||||
{
|
||||
BeatmapSet = { BindTarget = BeatmapSet }
|
||||
},
|
||||
downloadButtonsContainer = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = buttons_height + buttons_spacing },
|
||||
Spacing = new Vector2(buttons_spacing),
|
||||
},
|
||||
BeatmapSet = { BindTarget = BeatmapSet }
|
||||
},
|
||||
},
|
||||
downloadButtonsContainer = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = buttons_height + buttons_spacing },
|
||||
Spacing = new Vector2(buttons_spacing),
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
loading = new LoadingSpinner
|
||||
{
|
||||
|
@ -3,14 +3,17 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
@ -34,7 +37,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
public Info()
|
||||
{
|
||||
MetadataSection source, tags, genre, language;
|
||||
MetadataSectionNominators nominators;
|
||||
MetadataSection source, tags;
|
||||
MetadataSectionGenre genre;
|
||||
MetadataSectionLanguage language;
|
||||
OsuSpriteText notRankedPlaceholder;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -59,7 +65,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = new MetadataSection(MetadataType.Description),
|
||||
Child = new MetadataSectionDescription(),
|
||||
},
|
||||
},
|
||||
new Container
|
||||
@ -76,12 +82,13 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Full,
|
||||
Children = new[]
|
||||
Children = new Drawable[]
|
||||
{
|
||||
source = new MetadataSection(MetadataType.Source),
|
||||
genre = new MetadataSection(MetadataType.Genre) { Width = 0.5f },
|
||||
language = new MetadataSection(MetadataType.Language) { Width = 0.5f },
|
||||
tags = new MetadataSection(MetadataType.Tags),
|
||||
nominators = new MetadataSectionNominators(),
|
||||
source = new MetadataSectionSource(),
|
||||
genre = new MetadataSectionGenre { Width = 0.5f },
|
||||
language = new MetadataSectionLanguage { Width = 0.5f },
|
||||
tags = new MetadataSectionTags(),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -118,10 +125,11 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
BeatmapSet.ValueChanged += b =>
|
||||
{
|
||||
source.Text = b.NewValue?.Source ?? string.Empty;
|
||||
tags.Text = b.NewValue?.Tags ?? string.Empty;
|
||||
genre.Text = b.NewValue?.Genre.Name ?? string.Empty;
|
||||
language.Text = b.NewValue?.Language.Name ?? string.Empty;
|
||||
nominators.Metadata = (b.NewValue?.CurrentNominations ?? Array.Empty<BeatmapSetOnlineNomination>(), b.NewValue?.RelatedUsers ?? Array.Empty<APIUser>());
|
||||
source.Metadata = b.NewValue?.Source ?? string.Empty;
|
||||
tags.Metadata = b.NewValue?.Tags ?? string.Empty;
|
||||
genre.Metadata = b.NewValue?.Genre ?? new BeatmapSetOnlineGenre { Id = (int)SearchGenre.Unspecified };
|
||||
language.Metadata = b.NewValue?.Language ?? new BeatmapSetOnlineLanguage { Id = (int)SearchLanguage.Unspecified };
|
||||
bool setHasLeaderboard = b.NewValue?.Status > 0;
|
||||
successRate.Alpha = setHasLeaderboard ? 1 : 0;
|
||||
notRankedPlaceholder.Alpha = setHasLeaderboard ? 0 : 1;
|
||||
|
@ -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.Extensions.Color4Extensions;
|
||||
@ -11,26 +9,45 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Chat;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSection : Container
|
||||
public abstract partial class MetadataSection : MetadataSection<string>
|
||||
{
|
||||
public override string Metadata
|
||||
{
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
{
|
||||
this.FadeOut(TRANSITION_DURATION);
|
||||
return;
|
||||
}
|
||||
|
||||
base.Metadata = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected MetadataSection(MetadataType type, Action<string>? searchAction = null)
|
||||
: base(type, searchAction)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public abstract partial class MetadataSection<T> : Container
|
||||
{
|
||||
private readonly FillFlowContainer textContainer;
|
||||
private readonly MetadataType type;
|
||||
private TextFlowContainer textFlow;
|
||||
private TextFlowContainer? textFlow;
|
||||
|
||||
private readonly Action<string> searchAction;
|
||||
protected readonly Action<T>? SearchAction;
|
||||
|
||||
private const float transition_duration = 250;
|
||||
protected const float TRANSITION_DURATION = 250;
|
||||
|
||||
public MetadataSection(MetadataType type, Action<string> searchAction = null)
|
||||
protected MetadataSection(MetadataType type, Action<T>? searchAction = null)
|
||||
{
|
||||
this.type = type;
|
||||
this.searchAction = searchAction;
|
||||
SearchAction = searchAction;
|
||||
|
||||
Alpha = 0;
|
||||
|
||||
@ -53,7 +70,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = new OsuSpriteText
|
||||
{
|
||||
Text = this.type.GetLocalisableDescription(),
|
||||
Text = type.GetLocalisableDescription(),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14),
|
||||
},
|
||||
},
|
||||
@ -61,23 +78,23 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
};
|
||||
}
|
||||
|
||||
public string Text
|
||||
public virtual T Metadata
|
||||
{
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrEmpty(value))
|
||||
if (value == null)
|
||||
{
|
||||
this.FadeOut(transition_duration);
|
||||
this.FadeOut(TRANSITION_DURATION);
|
||||
return;
|
||||
}
|
||||
|
||||
this.FadeIn(transition_duration);
|
||||
this.FadeIn(TRANSITION_DURATION);
|
||||
|
||||
setTextAsync(value);
|
||||
setTextFlowAsync(value);
|
||||
}
|
||||
}
|
||||
|
||||
private void setTextAsync(string text)
|
||||
private void setTextFlowAsync(T metadata)
|
||||
{
|
||||
LoadComponentAsync(new LinkFlowContainer(s => s.Font = s.Font.With(size: 14))
|
||||
{
|
||||
@ -88,44 +105,15 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
textFlow?.Expire();
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MetadataType.Tags:
|
||||
string[] tags = text.Split(" ");
|
||||
|
||||
for (int i = 0; i <= tags.Length - 1; i++)
|
||||
{
|
||||
string tag = tags[i];
|
||||
|
||||
if (searchAction != null)
|
||||
loaded.AddLink(tag, () => searchAction(tag));
|
||||
else
|
||||
loaded.AddLink(tag, LinkAction.SearchBeatmapSet, tag);
|
||||
|
||||
if (i != tags.Length - 1)
|
||||
loaded.AddText(" ");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case MetadataType.Source:
|
||||
if (searchAction != null)
|
||||
loaded.AddLink(text, () => searchAction(text));
|
||||
else
|
||||
loaded.AddLink(text, LinkAction.SearchBeatmapSet, text);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
loaded.AddText(text);
|
||||
break;
|
||||
}
|
||||
AddMetadata(metadata, loaded);
|
||||
|
||||
textContainer.Add(textFlow = loaded);
|
||||
|
||||
// fade in if we haven't yet.
|
||||
textContainer.FadeIn(transition_duration);
|
||||
textContainer.FadeIn(TRANSITION_DURATION);
|
||||
});
|
||||
}
|
||||
|
||||
protected abstract void AddMetadata(T metadata, LinkFlowContainer loaded);
|
||||
}
|
||||
}
|
||||
|
21
osu.Game/Overlays/BeatmapSet/MetadataSectionDescription.cs
Normal file
21
osu.Game/Overlays/BeatmapSet/MetadataSectionDescription.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSectionDescription : MetadataSection
|
||||
{
|
||||
public MetadataSectionDescription(Action<string>? searchAction = null)
|
||||
: base(MetadataType.Description, searchAction)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddMetadata(string metadata, LinkFlowContainer loaded)
|
||||
{
|
||||
loaded.AddText(metadata);
|
||||
}
|
||||
}
|
||||
}
|
30
osu.Game/Overlays/BeatmapSet/MetadataSectionGenre.cs
Normal file
30
osu.Game/Overlays/BeatmapSet/MetadataSectionGenre.cs
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSectionGenre : MetadataSection<BeatmapSetOnlineGenre>
|
||||
{
|
||||
public MetadataSectionGenre(Action<BeatmapSetOnlineGenre>? searchAction = null)
|
||||
: base(MetadataType.Genre, searchAction)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddMetadata(BeatmapSetOnlineGenre metadata, LinkFlowContainer loaded)
|
||||
{
|
||||
var genre = (SearchGenre)metadata.Id;
|
||||
|
||||
if (Enum.IsDefined(genre))
|
||||
loaded.AddLink(genre.GetLocalisableDescription(), LinkAction.FilterBeatmapSetGenre, genre);
|
||||
else
|
||||
loaded.AddText(metadata.Name);
|
||||
}
|
||||
}
|
||||
}
|
30
osu.Game/Overlays/BeatmapSet/MetadataSectionLanguage.cs
Normal file
30
osu.Game/Overlays/BeatmapSet/MetadataSectionLanguage.cs
Normal file
@ -0,0 +1,30 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays.BeatmapListing;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSectionLanguage : MetadataSection<BeatmapSetOnlineLanguage>
|
||||
{
|
||||
public MetadataSectionLanguage(Action<BeatmapSetOnlineLanguage>? searchAction = null)
|
||||
: base(MetadataType.Language, searchAction)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddMetadata(BeatmapSetOnlineLanguage metadata, LinkFlowContainer loaded)
|
||||
{
|
||||
var language = (SearchLanguage)metadata.Id;
|
||||
|
||||
if (Enum.IsDefined(language))
|
||||
loaded.AddLink(language.GetLocalisableDescription(), LinkAction.FilterBeatmapSetLanguage, language);
|
||||
else
|
||||
loaded.AddText(metadata.Name);
|
||||
}
|
||||
}
|
||||
}
|
63
osu.Game/Overlays/BeatmapSet/MetadataSectionNominators.cs
Normal file
63
osu.Game/Overlays/BeatmapSet/MetadataSectionNominators.cs
Normal file
@ -0,0 +1,63 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSectionNominators : MetadataSection<(BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers)>
|
||||
{
|
||||
public override (BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers) Metadata
|
||||
{
|
||||
set
|
||||
{
|
||||
if (value.CurrentNominations.Length == 0)
|
||||
{
|
||||
this.FadeOut(TRANSITION_DURATION);
|
||||
return;
|
||||
}
|
||||
|
||||
base.Metadata = value;
|
||||
}
|
||||
}
|
||||
|
||||
public MetadataSectionNominators(Action<(BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers)>? searchAction = null)
|
||||
: base(MetadataType.Nominators, searchAction)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddMetadata((BeatmapSetOnlineNomination[] CurrentNominations, APIUser[] RelatedUsers) metadata, LinkFlowContainer loaded)
|
||||
{
|
||||
int[] nominatorIds = metadata.CurrentNominations.Select(n => n.UserId).ToArray();
|
||||
|
||||
int nominatorsFound = 0;
|
||||
|
||||
foreach (int nominatorId in nominatorIds)
|
||||
{
|
||||
foreach (var user in metadata.RelatedUsers)
|
||||
{
|
||||
if (nominatorId != user.OnlineID) continue;
|
||||
|
||||
nominatorsFound++;
|
||||
|
||||
loaded.AddUserLink(new APIUser
|
||||
{
|
||||
Username = user.Username,
|
||||
Id = nominatorId,
|
||||
});
|
||||
|
||||
if (nominatorsFound < nominatorIds.Length)
|
||||
loaded.AddText(CommonStrings.ArrayAndWordsConnector);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
25
osu.Game/Overlays/BeatmapSet/MetadataSectionSource.cs
Normal file
25
osu.Game/Overlays/BeatmapSet/MetadataSectionSource.cs
Normal file
@ -0,0 +1,25 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSectionSource : MetadataSection
|
||||
{
|
||||
public MetadataSectionSource(Action<string>? searchAction = null)
|
||||
: base(MetadataType.Source, searchAction)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddMetadata(string metadata, LinkFlowContainer loaded)
|
||||
{
|
||||
if (SearchAction != null)
|
||||
loaded.AddLink(metadata, () => SearchAction(metadata));
|
||||
else
|
||||
loaded.AddLink(metadata, LinkAction.SearchBeatmapSet, metadata);
|
||||
}
|
||||
}
|
||||
}
|
35
osu.Game/Overlays/BeatmapSet/MetadataSectionTags.cs
Normal file
35
osu.Game/Overlays/BeatmapSet/MetadataSectionTags.cs
Normal file
@ -0,0 +1,35 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
public partial class MetadataSectionTags : MetadataSection
|
||||
{
|
||||
public MetadataSectionTags(Action<string>? searchAction = null)
|
||||
: base(MetadataType.Tags, searchAction)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void AddMetadata(string metadata, LinkFlowContainer loaded)
|
||||
{
|
||||
string[] tags = metadata.Split(" ");
|
||||
|
||||
for (int i = 0; i <= tags.Length - 1; i++)
|
||||
{
|
||||
string tag = tags[i];
|
||||
|
||||
if (SearchAction != null)
|
||||
loaded.AddLink(tag, () => SearchAction(tag));
|
||||
else
|
||||
loaded.AddLink(tag, LinkAction.SearchBeatmapSet, tag);
|
||||
|
||||
if (i != tags.Length - 1)
|
||||
loaded.AddText(" ");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Genre,
|
||||
|
||||
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoLanguage))]
|
||||
Language
|
||||
Language,
|
||||
|
||||
[LocalisableDescription(typeof(BeatmapsetsStrings), nameof(BeatmapsetsStrings.ShowInfoNominators))]
|
||||
Nominators,
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.BeatmapSet;
|
||||
@ -30,6 +31,13 @@ namespace osu.Game.Overlays
|
||||
|
||||
private readonly Bindable<APIBeatmapSet> beatmapSet = new Bindable<APIBeatmapSet>();
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
private IBindable<APIUser> apiUser;
|
||||
|
||||
private (BeatmapSetLookupType type, int id)? lastLookup;
|
||||
|
||||
/// <remarks>
|
||||
/// Isolates the beatmap set overlay from the game-wide selected mods bindable
|
||||
/// to avoid affecting the beatmap details section (i.e. <see cref="AdvancedStats.StatisticRow"/>).
|
||||
@ -72,6 +80,17 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
apiUser = api.LocalUser.GetBoundCopy();
|
||||
apiUser.BindValueChanged(_ => Schedule(() =>
|
||||
{
|
||||
if (api.IsLoggedIn)
|
||||
performFetch();
|
||||
}));
|
||||
}
|
||||
|
||||
protected override BeatmapSetHeader CreateHeader() => new BeatmapSetHeader();
|
||||
|
||||
protected override Color4 BackgroundColour => ColourProvider.Background6;
|
||||
@ -84,27 +103,20 @@ namespace osu.Game.Overlays
|
||||
|
||||
public void FetchAndShowBeatmap(int beatmapId)
|
||||
{
|
||||
lastLookup = (BeatmapSetLookupType.BeatmapId, beatmapId);
|
||||
beatmapSet.Value = null;
|
||||
|
||||
var req = new GetBeatmapSetRequest(beatmapId, BeatmapSetLookupType.BeatmapId);
|
||||
req.Success += res =>
|
||||
{
|
||||
beatmapSet.Value = res;
|
||||
Header.HeaderContent.Picker.Beatmap.Value = Header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineID == beatmapId);
|
||||
};
|
||||
API.Queue(req);
|
||||
|
||||
performFetch();
|
||||
Show();
|
||||
}
|
||||
|
||||
public void FetchAndShowBeatmapSet(int beatmapSetId)
|
||||
{
|
||||
lastLookup = (BeatmapSetLookupType.SetId, beatmapSetId);
|
||||
|
||||
beatmapSet.Value = null;
|
||||
|
||||
var req = new GetBeatmapSetRequest(beatmapSetId);
|
||||
req.Success += res => beatmapSet.Value = res;
|
||||
API.Queue(req);
|
||||
|
||||
performFetch();
|
||||
Show();
|
||||
}
|
||||
|
||||
@ -118,6 +130,24 @@ namespace osu.Game.Overlays
|
||||
Show();
|
||||
}
|
||||
|
||||
private void performFetch()
|
||||
{
|
||||
if (!api.IsLoggedIn)
|
||||
return;
|
||||
|
||||
if (lastLookup == null)
|
||||
return;
|
||||
|
||||
var req = new GetBeatmapSetRequest(lastLookup.Value.id, BeatmapSetLookupType.BeatmapId);
|
||||
req.Success += res =>
|
||||
{
|
||||
beatmapSet.Value = res;
|
||||
if (lastLookup.Value.type == BeatmapSetLookupType.BeatmapId)
|
||||
Header.HeaderContent.Picker.Beatmap.Value = Header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineID == lastLookup.Value.id);
|
||||
};
|
||||
API.Queue(req);
|
||||
}
|
||||
|
||||
private partial class CommentsSection : BeatmapSetLayoutSection
|
||||
{
|
||||
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
|
||||
|
@ -17,9 +17,11 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -148,11 +150,11 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
List<MenuItem> items = new List<MenuItem>
|
||||
{
|
||||
new OsuMenuItem("View Profile", MenuItemType.Highlighted, openUserProfile)
|
||||
new OsuMenuItem(ContextMenuStrings.ViewProfile, MenuItemType.Highlighted, openUserProfile)
|
||||
};
|
||||
|
||||
if (!user.Equals(api.LocalUser.Value))
|
||||
items.Add(new OsuMenuItem("Start Chat", MenuItemType.Standard, openUserChannel));
|
||||
items.Add(new OsuMenuItem(UsersStrings.CardSendMessage, MenuItemType.Standard, openUserChannel));
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Chat.Listing
|
||||
private Box hoverBox = null!;
|
||||
private SpriteIcon checkbox = null!;
|
||||
private OsuSpriteText channelText = null!;
|
||||
private OsuSpriteText topicText = null!;
|
||||
private OsuTextFlowContainer topicText = null!;
|
||||
private IBindable<bool> channelJoined = null!;
|
||||
|
||||
[Resolved]
|
||||
@ -65,8 +65,8 @@ namespace osu.Game.Overlays.Chat.Listing
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 20 + (vertical_margin * 2);
|
||||
RelativeSizeAxes = Content.RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Content.AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -79,14 +79,19 @@ namespace osu.Game.Overlays.Chat.Listing
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.Absolute, 40),
|
||||
new Dimension(GridSizeMode.Absolute, 200),
|
||||
new Dimension(GridSizeMode.Absolute, 400),
|
||||
new Dimension(maxSize: 400),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
new Dimension(GridSizeMode.Absolute, 50), // enough for any 5 digit user count
|
||||
},
|
||||
RowDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.AutoSize, minSize: 20 + (vertical_margin * 2)),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
@ -108,12 +113,13 @@ namespace osu.Game.Overlays.Chat.Listing
|
||||
Font = OsuFont.Torus.With(size: text_size, weight: FontWeight.SemiBold),
|
||||
Margin = new MarginPadding { Bottom = 2 },
|
||||
},
|
||||
topicText = new OsuSpriteText
|
||||
topicText = new OsuTextFlowContainer(t => t.Font = OsuFont.Torus.With(size: text_size))
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = Channel.Topic,
|
||||
Font = OsuFont.Torus.With(size: text_size),
|
||||
Margin = new MarginPadding { Bottom = 2 },
|
||||
},
|
||||
new SpriteIcon
|
||||
|
@ -122,8 +122,8 @@ namespace osu.Game.Overlays.FirstRunSetup
|
||||
stableLocatorTextBox.Current.Value = storage.GetFullPath(string.Empty);
|
||||
importButton.Enabled.Value = true;
|
||||
|
||||
bool available = legacyImportManager.CheckHardLinkAvailability();
|
||||
Logger.Log($"Hard link support is {available}");
|
||||
bool available = legacyImportManager.CheckSongsFolderHardLinkAvailability();
|
||||
Logger.Log($"Hard link support for beatmaps is {available}");
|
||||
|
||||
if (available)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Game.Graphics.Cursor;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online;
|
||||
|
||||
@ -38,20 +39,30 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
Child = new FillFlowContainer
|
||||
Child = new OsuContextMenuContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = new PopoverContainer
|
||||
{
|
||||
Header.With(h => h.Depth = float.MinValue),
|
||||
content = new PopoverContainer
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
Header.With(h => h.Depth = float.MinValue),
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
Loading = new LoadingLayer(true)
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
public partial class BottomHeaderContainer : CompositeDrawable
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
private LinkFlowContainer topLinkContainer = null!;
|
||||
private LinkFlowContainer bottomLinkContainer = null!;
|
||||
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
}
|
||||
};
|
||||
|
||||
UserProfile.BindValueChanged(user => updateDisplay(user.NewValue?.User));
|
||||
User.BindValueChanged(user => updateDisplay(user.NewValue?.User));
|
||||
}
|
||||
|
||||
private void updateDisplay(APIUser? user)
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
public partial class CentreHeaderContainer : CompositeDrawable
|
||||
{
|
||||
public readonly BindableBool DetailsVisible = new BindableBool(true);
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
private OverlinedInfoContainer hiddenDetailGlobal = null!;
|
||||
private OverlinedInfoContainer hiddenDetailCountry = null!;
|
||||
@ -53,15 +53,15 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
new FollowersButton
|
||||
{
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
},
|
||||
new MappingSubscribersButton
|
||||
{
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
},
|
||||
new MessageUserButton
|
||||
{
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -92,7 +92,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Size = new Vector2(40),
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
},
|
||||
expandedDetailContainer = new Container
|
||||
{
|
||||
@ -104,7 +104,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
Child = new LevelProgressBar
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
}
|
||||
},
|
||||
hiddenDetailContainer = new FillFlowContainer
|
||||
@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
expandedDetailContainer.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint);
|
||||
});
|
||||
|
||||
UserProfile.BindValueChanged(userProfile => updateDisplay(userProfile.NewValue?.User));
|
||||
User.BindValueChanged(user => updateDisplay(user.NewValue?.User));
|
||||
}
|
||||
|
||||
private void updateDisplay(APIUser? user)
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class FollowersButton : ProfileHeaderStatisticsButton
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
public override LocalisableString TooltipText => FriendsStrings.ButtonsDisabled;
|
||||
|
||||
@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
private void load()
|
||||
{
|
||||
// todo: when friending/unfriending is implemented, the APIAccess.Friends list should be updated accordingly.
|
||||
UserProfile.BindValueChanged(user => SetValue(user.NewValue?.User.FollowerCount ?? 0), true);
|
||||
User.BindValueChanged(user => SetValue(user.NewValue?.User.FollowerCount ?? 0), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
84
osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs
Normal file
84
osu.Game/Overlays/Profile/Header/Components/GroupBadge.cs
Normal file
@ -0,0 +1,84 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Rulesets;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class GroupBadge : Container, IHasTooltip
|
||||
{
|
||||
public LocalisableString TooltipText { get; }
|
||||
|
||||
public int TextSize { get; set; } = 12;
|
||||
|
||||
private readonly APIUserGroup group;
|
||||
|
||||
public GroupBadge(APIUserGroup group)
|
||||
{
|
||||
this.group = group;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Masking = true;
|
||||
CornerRadius = 8;
|
||||
|
||||
TooltipText = group.Name;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider? colourProvider, RulesetStore rulesets)
|
||||
{
|
||||
FillFlowContainer innerContainer;
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider?.Background6 ?? Colour4.Black
|
||||
},
|
||||
innerContainer = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Padding = new MarginPadding { Vertical = 2, Horizontal = 10 },
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = group.ShortName,
|
||||
Colour = Color4Extensions.FromHex(group.Colour),
|
||||
Shadow = false,
|
||||
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (group.Playmodes?.Length > 0)
|
||||
{
|
||||
innerContainer.AddRange(group.Playmodes.Select(p =>
|
||||
(rulesets.GetRuleset(p)?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.Regular.QuestionCircle }).With(icon =>
|
||||
{
|
||||
icon.Size = new Vector2(TextSize - 1);
|
||||
})).ToList()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class GroupBadgeFlow : FillFlowContainer
|
||||
{
|
||||
public readonly Bindable<APIUser?> User = new Bindable<APIUser?>();
|
||||
|
||||
public GroupBadgeFlow()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Direction = FillDirection.Horizontal;
|
||||
Spacing = new Vector2(2);
|
||||
|
||||
User.BindValueChanged(user =>
|
||||
{
|
||||
Clear(true);
|
||||
|
||||
if (user.NewValue?.Groups != null)
|
||||
AddRange(user.NewValue.Groups.Select(g => new GroupBadge(g)));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class LevelBadge : CompositeDrawable, IHasTooltip
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
public LocalisableString TooltipText { get; private set; }
|
||||
|
||||
@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
}
|
||||
};
|
||||
|
||||
UserProfile.BindValueChanged(user => updateLevel(user.NewValue?.User));
|
||||
User.BindValueChanged(user => updateLevel(user.NewValue?.User));
|
||||
}
|
||||
|
||||
private void updateLevel(APIUser? user)
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class LevelProgressBar : CompositeDrawable, IHasTooltip
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
public LocalisableString TooltipText { get; }
|
||||
|
||||
@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
}
|
||||
};
|
||||
|
||||
UserProfile.BindValueChanged(user => updateProgress(user.NewValue?.User));
|
||||
User.BindValueChanged(user => updateProgress(user.NewValue?.User));
|
||||
}
|
||||
|
||||
private void updateProgress(APIUser? user)
|
||||
|
@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class MappingSubscribersButton : ProfileHeaderStatisticsButton
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
public override LocalisableString TooltipText => FollowsStrings.MappingFollowers;
|
||||
|
||||
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
UserProfile.BindValueChanged(user => SetValue(user.NewValue?.User.MappingFollowerCount ?? 0), true);
|
||||
User.BindValueChanged(user => SetValue(user.NewValue?.User.MappingFollowerCount ?? 0), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class MessageUserButton : ProfileHeaderButton
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
public override LocalisableString TooltipText => UsersStrings.CardSendMessage;
|
||||
|
||||
@ -48,12 +48,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
if (!Content.IsPresent) return;
|
||||
|
||||
channelManager?.OpenPrivateChannel(UserProfile.Value?.User);
|
||||
channelManager?.OpenPrivateChannel(User.Value?.User);
|
||||
userOverlay?.Hide();
|
||||
chatOverlay?.Show();
|
||||
};
|
||||
|
||||
UserProfile.ValueChanged += e =>
|
||||
User.ValueChanged += e =>
|
||||
{
|
||||
var user = e.NewValue?.User;
|
||||
Content.Alpha = user != null && !user.PMFriendsOnly && apiProvider.LocalUser.Value.Id != user.Id ? 1 : 0;
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
public partial class OverlinedTotalPlayTime : CompositeDrawable, IHasTooltip
|
||||
{
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
public LocalisableString TooltipText { get; set; }
|
||||
|
||||
@ -35,12 +35,12 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
LineColour = colourProvider.Highlight1,
|
||||
};
|
||||
|
||||
UserProfile.BindValueChanged(updateTime, true);
|
||||
User.BindValueChanged(updateTime, true);
|
||||
}
|
||||
|
||||
private void updateTime(ValueChangedEvent<UserProfile?> userProfile)
|
||||
private void updateTime(ValueChangedEvent<UserProfileData?> user)
|
||||
{
|
||||
int? playTime = userProfile.NewValue?.User.Statistics?.PlayTime;
|
||||
int? playTime = user.NewValue?.User.Statistics?.PlayTime;
|
||||
TooltipText = (playTime ?? 0) / 3600 + " hours";
|
||||
info.Content = formatTime(playTime);
|
||||
}
|
||||
|
@ -16,24 +16,24 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
[Resolved]
|
||||
private UserProfileOverlay? profileOverlay { get; set; }
|
||||
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
UserProfile.BindValueChanged(userProfile => updateState(userProfile.NewValue), true);
|
||||
User.BindValueChanged(user => updateState(user.NewValue), true);
|
||||
Current.BindValueChanged(ruleset =>
|
||||
{
|
||||
if (UserProfile.Value != null && !ruleset.NewValue.Equals(UserProfile.Value.Ruleset))
|
||||
profileOverlay?.ShowUser(UserProfile.Value.User, ruleset.NewValue);
|
||||
if (User.Value != null && !ruleset.NewValue.Equals(User.Value.Ruleset))
|
||||
profileOverlay?.ShowUser(User.Value.User, ruleset.NewValue);
|
||||
});
|
||||
}
|
||||
|
||||
private void updateState(UserProfile? userProfile)
|
||||
private void updateState(UserProfileData? user)
|
||||
{
|
||||
Current.Value = Items.SingleOrDefault(ruleset => userProfile?.Ruleset.MatchesOnlineID(ruleset) == true);
|
||||
SetDefaultRuleset(Rulesets.GetRuleset(userProfile?.User.PlayMode ?? @"osu").AsNonNull());
|
||||
Current.Value = Items.SingleOrDefault(ruleset => user?.Ruleset.MatchesOnlineID(ruleset) == true);
|
||||
SetDefaultRuleset(Rulesets.GetRuleset(user?.User.PlayMode ?? @"osu").AsNonNull());
|
||||
}
|
||||
|
||||
public void SetDefaultRuleset(RulesetInfo ruleset)
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
private FillFlowContainer? fillFlow;
|
||||
private RankGraph rankGraph = null!;
|
||||
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
private bool expanded = true;
|
||||
|
||||
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
UserProfile.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
@ -98,7 +98,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
new OverlinedTotalPlayTime
|
||||
{
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
},
|
||||
medalInfo = new OverlinedInfoContainer
|
||||
{
|
||||
@ -170,9 +170,9 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
};
|
||||
}
|
||||
|
||||
private void updateDisplay(UserProfile? userProfile)
|
||||
private void updateDisplay(UserProfileData? data)
|
||||
{
|
||||
var user = userProfile?.User;
|
||||
var user = data?.User;
|
||||
|
||||
medalInfo.Content = user?.Achievements?.Length.ToString() ?? "0";
|
||||
ppInfo.Content = user?.Statistics?.PP?.ToLocalisableString("#,##0") ?? (LocalisableString)"0";
|
||||
|
@ -20,14 +20,14 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
private FillFlowContainer badgeFlowContainer = null!;
|
||||
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
{
|
||||
Alpha = 0;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
UserProfile.ValueChanged += e => updateDisplay(e.NewValue?.User);
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue?.User);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
private const float avatar_size = 110;
|
||||
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
@ -39,6 +39,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
private UpdateableFlag userFlag = null!;
|
||||
private OsuSpriteText userCountryText = null!;
|
||||
private FillFlowContainer userStats = null!;
|
||||
private GroupBadgeFlow groupBadgeFlow = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider)
|
||||
@ -89,6 +90,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
usernameText = new OsuSpriteText
|
||||
@ -97,10 +99,14 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
},
|
||||
openUserExternally = new ExternalLinkButton
|
||||
{
|
||||
Margin = new MarginPadding { Left = 5 },
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
groupBadgeFlow = new GroupBadgeFlow
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
}
|
||||
}
|
||||
},
|
||||
titleText = new OsuSpriteText
|
||||
@ -170,12 +176,12 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
}
|
||||
};
|
||||
|
||||
UserProfile.BindValueChanged(user => updateUser(user.NewValue));
|
||||
User.BindValueChanged(user => updateUser(user.NewValue));
|
||||
}
|
||||
|
||||
private void updateUser(UserProfile? userProfile)
|
||||
private void updateUser(UserProfileData? data)
|
||||
{
|
||||
var user = userProfile?.User;
|
||||
var user = data?.User;
|
||||
|
||||
avatar.User = user;
|
||||
usernameText.Text = user?.Username ?? string.Empty;
|
||||
@ -185,6 +191,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
supporterTag.SupportLevel = user?.SupportLevel ?? 0;
|
||||
titleText.Text = user?.Title ?? string.Empty;
|
||||
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");
|
||||
groupBadgeFlow.User.Value = user;
|
||||
|
||||
userStats.Clear();
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
private UserCoverBackground coverContainer = null!;
|
||||
|
||||
public Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
private CentreHeaderContainer centreHeaderContainer;
|
||||
private DetailHeaderContainer detailHeaderContainer;
|
||||
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
ContentSidePadding = UserProfileOverlay.CONTENT_X_MARGIN;
|
||||
|
||||
UserProfile.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
User.ValueChanged += e => updateDisplay(e.NewValue);
|
||||
|
||||
TabControl.AddItem(LayoutStrings.HeaderUsersShow);
|
||||
|
||||
@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
UserProfile = { BindTarget = UserProfile }
|
||||
User = { BindTarget = User }
|
||||
});
|
||||
|
||||
// Haphazardly guaranteed by OverlayHeader constructor (see CreateBackground / CreateContent).
|
||||
@ -80,34 +80,34 @@ namespace osu.Game.Overlays.Profile
|
||||
new TopHeaderContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
UserProfile = { BindTarget = UserProfile },
|
||||
User = { BindTarget = User },
|
||||
},
|
||||
centreHeaderContainer = new CentreHeaderContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
UserProfile = { BindTarget = UserProfile },
|
||||
User = { BindTarget = User },
|
||||
},
|
||||
detailHeaderContainer = new DetailHeaderContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
UserProfile = { BindTarget = UserProfile },
|
||||
User = { BindTarget = User },
|
||||
},
|
||||
new MedalHeaderContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
UserProfile = { BindTarget = UserProfile },
|
||||
User = { BindTarget = User },
|
||||
},
|
||||
new BottomHeaderContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
UserProfile = { BindTarget = UserProfile },
|
||||
User = { BindTarget = User },
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
protected override OverlayTitle CreateTitle() => new ProfileHeaderTitle();
|
||||
|
||||
private void updateDisplay(UserProfile? userProfile) => coverContainer.User = userProfile?.User;
|
||||
private void updateDisplay(UserProfileData? user) => coverContainer.User = user?.User;
|
||||
|
||||
private partial class ProfileHeaderTitle : OverlayTitle
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
public readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
public readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
protected ProfileSection()
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
protected override int InitialItemsCount => type == BeatmapSetType.Graveyard ? 2 : 6;
|
||||
|
||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<UserProfile?> user, LocalisableString headerText)
|
||||
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<UserProfileData?> user, LocalisableString headerText)
|
||||
: base(user, headerText)
|
||||
{
|
||||
this.type = type;
|
||||
@ -64,8 +64,8 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
}
|
||||
}
|
||||
|
||||
protected override APIRequest<List<APIBeatmapSet>> CreateRequest(UserProfile userProfile, PaginationParameters pagination) =>
|
||||
new GetUserBeatmapsRequest(userProfile.User.Id, type, pagination);
|
||||
protected override APIRequest<List<APIBeatmapSet>> CreateRequest(UserProfileData user, PaginationParameters pagination) =>
|
||||
new GetUserBeatmapsRequest(user.User.Id, type, pagination);
|
||||
|
||||
protected override Drawable? CreateDrawableItem(APIBeatmapSet model) => model.OnlineID > 0
|
||||
? new BeatmapCardNormal(model)
|
||||
|
@ -18,13 +18,13 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, UserProfile, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Ranked, UserProfile, UsersStrings.ShowExtraBeatmapsRankedTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Loved, UserProfile, UsersStrings.ShowExtraBeatmapsLovedTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Guest, UserProfile, UsersStrings.ShowExtraBeatmapsGuestTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Pending, UserProfile, UsersStrings.ShowExtraBeatmapsPendingTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, UserProfile, UsersStrings.ShowExtraBeatmapsGraveyardTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Nominated, UserProfile, UsersStrings.ShowExtraBeatmapsNominatedTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, UsersStrings.ShowExtraBeatmapsFavouriteTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Ranked, User, UsersStrings.ShowExtraBeatmapsRankedTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Loved, User, UsersStrings.ShowExtraBeatmapsLovedTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Guest, User, UsersStrings.ShowExtraBeatmapsGuestTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Pending, User, UsersStrings.ShowExtraBeatmapsPendingTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Graveyard, User, UsersStrings.ShowExtraBeatmapsGraveyardTitle),
|
||||
new PaginatedBeatmapContainer(BeatmapSetType.Nominated, User, UsersStrings.ShowExtraBeatmapsNominatedTitle),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
/// </summary>
|
||||
protected abstract LocalisableString GraphCounterName { get; }
|
||||
|
||||
protected ChartProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString headerText)
|
||||
: base(userProfile, headerText)
|
||||
protected ChartProfileSubsection(Bindable<UserProfileData?> user, LocalisableString headerText)
|
||||
: base(user, headerText)
|
||||
{
|
||||
}
|
||||
|
||||
@ -41,10 +41,10 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
UserProfile.BindValueChanged(onUserChanged, true);
|
||||
User.BindValueChanged(onUserChanged, true);
|
||||
}
|
||||
|
||||
private void onUserChanged(ValueChangedEvent<UserProfile?> e)
|
||||
private void onUserChanged(ValueChangedEvent<UserProfileData?> e)
|
||||
{
|
||||
var values = GetValues(e.NewValue?.User);
|
||||
|
||||
|
@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public partial class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection<APIUserMostPlayedBeatmap>
|
||||
{
|
||||
public PaginatedMostPlayedBeatmapContainer(Bindable<UserProfile?> userProfile)
|
||||
: base(userProfile, UsersStrings.ShowExtraHistoricalMostPlayedTitle)
|
||||
public PaginatedMostPlayedBeatmapContainer(Bindable<UserProfileData?> user)
|
||||
: base(user, UsersStrings.ShowExtraHistoricalMostPlayedTitle)
|
||||
{
|
||||
}
|
||||
|
||||
@ -29,8 +29,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
|
||||
protected override int GetCount(APIUser user) => user.BeatmapPlayCountsCount;
|
||||
|
||||
protected override APIRequest<List<APIUserMostPlayedBeatmap>> CreateRequest(UserProfile userProfile, PaginationParameters pagination) =>
|
||||
new GetUserMostPlayedBeatmapsRequest(userProfile.User.Id, pagination);
|
||||
protected override APIRequest<List<APIUserMostPlayedBeatmap>> CreateRequest(UserProfileData user, PaginationParameters pagination) =>
|
||||
new GetUserMostPlayedBeatmapsRequest(user.User.Id, pagination);
|
||||
|
||||
protected override Drawable CreateDrawableItem(APIUserMostPlayedBeatmap mostPlayed) =>
|
||||
new DrawableMostPlayedBeatmap(mostPlayed);
|
||||
|
@ -12,8 +12,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalMonthlyPlaycountsCountLabel;
|
||||
|
||||
public PlayHistorySubsection(Bindable<UserProfile?> userProfile)
|
||||
: base(userProfile, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle)
|
||||
public PlayHistorySubsection(Bindable<UserProfileData?> user)
|
||||
: base(user, UsersStrings.ShowExtraHistoricalMonthlyPlaycountsTitle)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,8 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
protected override LocalisableString GraphCounterName => UsersStrings.ShowExtraHistoricalReplaysWatchedCountsCountLabel;
|
||||
|
||||
public ReplaysSubsection(Bindable<UserProfile?> userProfile)
|
||||
: base(userProfile, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle)
|
||||
public ReplaysSubsection(Bindable<UserProfileData?> user)
|
||||
: base(user, UsersStrings.ShowExtraHistoricalReplaysWatchedCountsTitle)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -20,10 +20,10 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new PlayHistorySubsection(UserProfile),
|
||||
new PaginatedMostPlayedBeatmapContainer(UserProfile),
|
||||
new PaginatedScoreContainer(ScoreType.Recent, UserProfile, UsersStrings.ShowExtraHistoricalRecentPlaysTitle),
|
||||
new ReplaysSubsection(UserProfile)
|
||||
new PlayHistorySubsection(User),
|
||||
new PaginatedMostPlayedBeatmapContainer(User),
|
||||
new PaginatedScoreContainer(ScoreType.Recent, User, UsersStrings.ShowExtraHistoricalRecentPlaysTitle),
|
||||
new ReplaysSubsection(User)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,11 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
||||
{
|
||||
public partial class KudosuInfo : Container
|
||||
{
|
||||
private readonly Bindable<UserProfile?> userProfile = new Bindable<UserProfile?>();
|
||||
private readonly Bindable<UserProfileData?> user = new Bindable<UserProfileData?>();
|
||||
|
||||
public KudosuInfo(Bindable<UserProfile?> userProfile)
|
||||
public KudosuInfo(Bindable<UserProfileData?> user)
|
||||
{
|
||||
this.userProfile.BindTo(userProfile);
|
||||
this.user.BindTo(user);
|
||||
CountSection total;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
||||
CornerRadius = 3;
|
||||
Child = total = new CountTotal();
|
||||
|
||||
this.userProfile.ValueChanged += u => total.Count = u.NewValue?.User.Kudosu.Total ?? 0;
|
||||
this.user.ValueChanged += u => total.Count = u.NewValue?.User.Kudosu.Total ?? 0;
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e) => true;
|
||||
|
@ -13,13 +13,13 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu
|
||||
{
|
||||
public partial class PaginatedKudosuHistoryContainer : PaginatedProfileSubsection<APIKudosuHistory>
|
||||
{
|
||||
public PaginatedKudosuHistoryContainer(Bindable<UserProfile?> userProfile)
|
||||
: base(userProfile, missingText: UsersStrings.ShowExtraKudosuEntryEmpty)
|
||||
public PaginatedKudosuHistoryContainer(Bindable<UserProfileData?> user)
|
||||
: base(user, missingText: UsersStrings.ShowExtraKudosuEntryEmpty)
|
||||
{
|
||||
}
|
||||
|
||||
protected override APIRequest<List<APIKudosuHistory>> CreateRequest(UserProfile userProfile, PaginationParameters pagination)
|
||||
=> new GetUserKudosuHistoryRequest(userProfile.User.Id, pagination);
|
||||
protected override APIRequest<List<APIKudosuHistory>> CreateRequest(UserProfileData user, PaginationParameters pagination)
|
||||
=> new GetUserKudosuHistoryRequest(user.User.Id, pagination);
|
||||
|
||||
protected override Drawable CreateDrawableItem(APIKudosuHistory item) => new DrawableKudosuHistoryItem(item);
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new KudosuInfo(UserProfile),
|
||||
new PaginatedKudosuHistoryContainer(UserProfile),
|
||||
new KudosuInfo(User),
|
||||
new PaginatedKudosuHistoryContainer(User),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
private OsuSpriteText missing = null!;
|
||||
private readonly LocalisableString? missingText;
|
||||
|
||||
protected PaginatedProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, LocalisableString? missingText = null)
|
||||
: base(userProfile, headerText, CounterVisibilityState.AlwaysVisible)
|
||||
protected PaginatedProfileSubsection(Bindable<UserProfileData?> user, LocalisableString? headerText = null, LocalisableString? missingText = null)
|
||||
: base(user, headerText, CounterVisibilityState.AlwaysVisible)
|
||||
{
|
||||
this.missingText = missingText;
|
||||
}
|
||||
@ -89,10 +89,10 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
UserProfile.BindValueChanged(onUserChanged, true);
|
||||
User.BindValueChanged(onUserChanged, true);
|
||||
}
|
||||
|
||||
private void onUserChanged(ValueChangedEvent<UserProfile?> e)
|
||||
private void onUserChanged(ValueChangedEvent<UserProfileData?> e)
|
||||
{
|
||||
loadCancellation?.Cancel();
|
||||
retrievalRequest?.Cancel();
|
||||
@ -109,14 +109,14 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
|
||||
private void showMore()
|
||||
{
|
||||
if (UserProfile.Value == null)
|
||||
if (User.Value == null)
|
||||
return;
|
||||
|
||||
loadCancellation = new CancellationTokenSource();
|
||||
|
||||
CurrentPage = CurrentPage?.TakeNext(ItemsPerPage) ?? new PaginationParameters(InitialItemsCount);
|
||||
|
||||
retrievalRequest = CreateRequest(UserProfile.Value, CurrentPage.Value);
|
||||
retrievalRequest = CreateRequest(User.Value, CurrentPage.Value);
|
||||
retrievalRequest.Success += items => UpdateItems(items, loadCancellation);
|
||||
|
||||
api.Queue(retrievalRequest);
|
||||
@ -154,7 +154,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
}
|
||||
|
||||
protected abstract APIRequest<List<TModel>> CreateRequest(UserProfile userProfile, PaginationParameters pagination);
|
||||
protected abstract APIRequest<List<TModel>> CreateRequest(UserProfileData user, PaginationParameters pagination);
|
||||
|
||||
protected abstract Drawable? CreateDrawableItem(TModel model);
|
||||
|
||||
|
@ -11,18 +11,18 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
public abstract partial class ProfileSubsection : FillFlowContainer
|
||||
{
|
||||
protected readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
||||
protected readonly Bindable<UserProfileData?> User = new Bindable<UserProfileData?>();
|
||||
|
||||
private readonly LocalisableString headerText;
|
||||
private readonly CounterVisibilityState counterVisibilityState;
|
||||
|
||||
private ProfileSubsectionHeader header = null!;
|
||||
|
||||
protected ProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
|
||||
protected ProfileSubsection(Bindable<UserProfileData?> user, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
|
||||
{
|
||||
this.headerText = headerText ?? string.Empty;
|
||||
this.counterVisibilityState = counterVisibilityState;
|
||||
UserProfile.BindTo(userProfile);
|
||||
User.BindTo(user);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user