mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 05:32:54 +08:00
Merge branch 'master' into underscored_link
This commit is contained in:
commit
4dc9309a7e
@ -63,6 +63,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.711.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2019.719.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -15,6 +15,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
protected override string ResourceAssembly => "osu.Game.Rulesets.Osu";
|
||||
|
||||
[TestCase(6.931145117263422, "diffcalc-test")]
|
||||
[TestCase(1.0736587013228804d, "zero-length-sliders")]
|
||||
public void Test(double expected, string name)
|
||||
=> base.Test(expected, name);
|
||||
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
||||
this.hitCircle = hitCircle;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Scale = new Vector2(hitCircle.Scale);
|
||||
CornerRadius = Size.X / 2;
|
||||
|
||||
|
@ -24,7 +24,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
InternalChild = body = new ManualSliderBody
|
||||
{
|
||||
AccentColour = Color4.Transparent,
|
||||
PathRadius = slider.Scale * 64
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
body.BorderColour = colours.Yellow;
|
||||
|
||||
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||
ScaleBindable.BindValueChanged(scale => body.PathRadius = scale.NewValue * 64, true);
|
||||
ScaleBindable.BindValueChanged(scale => body.PathRadius = scale.NewValue * OsuHitObject.OBJECT_RADIUS, true);
|
||||
}
|
||||
|
||||
private void updatePosition() => Position = slider.StackedPosition;
|
||||
|
@ -29,6 +29,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
ShakeDuration = 30,
|
||||
RelativeSizeAxes = Axes.Both
|
||||
});
|
||||
|
||||
Alpha = 0;
|
||||
}
|
||||
|
||||
@ -38,6 +39,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
protected override void ClearInternal(bool disposeChildren = true) => shakeContainer.Clear(disposeChildren);
|
||||
protected override bool RemoveInternal(Drawable drawable) => shakeContainer.Remove(drawable);
|
||||
|
||||
protected sealed override double InitialLifetimeOffset => HitObject.TimePreempt;
|
||||
|
||||
protected sealed override void UpdateState(ArmedState state)
|
||||
{
|
||||
double transformTime = HitObject.StartTime - HitObject.TimePreempt;
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
Body = new SnakingSliderBody(s)
|
||||
{
|
||||
PathRadius = s.Scale * 64,
|
||||
PathRadius = s.Scale * OsuHitObject.OBJECT_RADIUS,
|
||||
},
|
||||
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
||||
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
||||
@ -156,6 +156,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnKilled()
|
||||
{
|
||||
base.OnKilled();
|
||||
Body.RecyclePath();
|
||||
}
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Masking = true;
|
||||
CornerRadius = Size.X / 2;
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public ExplodePiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public FlashPiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public RingPiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
|
||||
{
|
||||
private const float width = 128;
|
||||
|
||||
private Color4 accentColour = Color4.Black;
|
||||
|
||||
public Func<OsuAction?> GetInitialHitAction;
|
||||
@ -57,8 +55,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = width,
|
||||
Height = width,
|
||||
Width = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
Height = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
Alpha = 0,
|
||||
Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer
|
||||
{
|
||||
@ -84,8 +82,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
Alpha = 1,
|
||||
Child = new Container
|
||||
{
|
||||
Width = width,
|
||||
Height = width,
|
||||
Width = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
Height = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
||||
Child = new SkinnableDrawable("Play/osu/sliderb", _ => new CircularContainer
|
||||
{
|
||||
|
@ -13,7 +13,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public const float DEFAULT_BORDER_SIZE = 1;
|
||||
|
||||
private readonly SliderPath path;
|
||||
private SliderPath path;
|
||||
|
||||
protected Path Path => path;
|
||||
|
||||
public float PathRadius
|
||||
@ -77,6 +78,22 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
InternalChild = path = new SliderPath();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initialises a new <see cref="SliderPath"/>, releasing all resources retained by the old one.
|
||||
/// </summary>
|
||||
public void RecyclePath()
|
||||
{
|
||||
InternalChild = path = new SliderPath
|
||||
{
|
||||
Position = path.Position,
|
||||
PathRadius = path.PathRadius,
|
||||
AccentColour = path.AccentColour,
|
||||
BorderColour = path.BorderColour,
|
||||
BorderSize = path.BorderSize,
|
||||
Vertices = path.Vertices
|
||||
};
|
||||
}
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
/// <summary>
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition
|
||||
{
|
||||
public const double OBJECT_RADIUS = 64;
|
||||
public const float OBJECT_RADIUS = 64;
|
||||
|
||||
public double TimePreempt = 600;
|
||||
public double TimeFadeIn = 400;
|
||||
|
@ -0,0 +1,28 @@
|
||||
osu file format v14
|
||||
|
||||
[Difficulty]
|
||||
HPDrainRate:3
|
||||
CircleSize:3
|
||||
OverallDifficulty:3
|
||||
ApproachRate:4.5
|
||||
SliderMultiplier:0.799999999999999
|
||||
SliderTickRate:1
|
||||
|
||||
[TimingPoints]
|
||||
800,260.869565217391,3,2,10,60,1,0
|
||||
|
||||
[HitObjects]
|
||||
// Linear
|
||||
78,193,2365,2,0,L|330:193,1,0
|
||||
78,193,3669,2,0,L|330:193,1,0
|
||||
78,193,4973,2,0,L|330:193,1,0
|
||||
|
||||
// Perfect-curve
|
||||
151,206,6278,2,0,P|293:75|345:204,1,0
|
||||
151,206,8104,2,0,P|293:75|345:204,1,0
|
||||
151,206,9930,2,0,P|293:75|345:204,1,0
|
||||
|
||||
// Bezier
|
||||
76,191,11756,2,0,B|176:59|358:340|438:190,1,0
|
||||
76,191,13582,2,0,B|176:59|358:340|438:190,1,0
|
||||
76,191,15408,2,0,B|176:59|358:340|438:190,1,0
|
@ -162,7 +162,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
private readonly TrailPart[] parts = new TrailPart[max_sprites];
|
||||
private Vector2 size;
|
||||
|
||||
private readonly VertexBatch<TexturedTrailVertex> vertexBatch = new QuadBatch<TexturedTrailVertex>(max_sprites, 1);
|
||||
private readonly TrailBatch vertexBatch = new TrailBatch(max_sprites, 1);
|
||||
|
||||
public TrailDrawNode(CursorTrail source)
|
||||
: base(source)
|
||||
@ -196,21 +196,16 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
for (int i = 0; i < parts.Length; ++i)
|
||||
{
|
||||
vertexBatch.DrawTime = parts[i].Time;
|
||||
|
||||
Vector2 pos = parts[i].Position;
|
||||
float localTime = parts[i].Time;
|
||||
|
||||
DrawQuad(
|
||||
texture,
|
||||
new Quad(pos.X - size.X / 2, pos.Y - size.Y / 2, size.X, size.Y),
|
||||
DrawColourInfo.Colour,
|
||||
null,
|
||||
v => vertexBatch.Add(new TexturedTrailVertex
|
||||
{
|
||||
Position = v.Position,
|
||||
TexturePosition = v.TexturePosition,
|
||||
Time = localTime + 1,
|
||||
Colour = v.Colour,
|
||||
}));
|
||||
vertexBatch.AddAction);
|
||||
}
|
||||
|
||||
shader.Unbind();
|
||||
@ -222,6 +217,25 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
|
||||
|
||||
vertexBatch.Dispose();
|
||||
}
|
||||
|
||||
// Todo: This shouldn't exist, but is currently used to reduce allocations by caching variable-capturing closures.
|
||||
private class TrailBatch : QuadBatch<TexturedTrailVertex>
|
||||
{
|
||||
public new readonly Action<TexturedVertex2D> AddAction;
|
||||
public float DrawTime;
|
||||
|
||||
public TrailBatch(int size, int maxBuffers)
|
||||
: base(size, maxBuffers)
|
||||
{
|
||||
AddAction = v => Add(new TexturedTrailVertex
|
||||
{
|
||||
Position = v.Position,
|
||||
TexturePosition = v.TexturePosition,
|
||||
Time = DrawTime + 1,
|
||||
Colour = v.Colour,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
|
@ -12,6 +12,7 @@ using osu.Game.Rulesets.UI;
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Osu.UI.Cursor;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.UI
|
||||
{
|
||||
@ -39,7 +40,13 @@ namespace osu.Game.Rulesets.Osu.UI
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Depth = 1,
|
||||
},
|
||||
HitObjectContainer,
|
||||
// Todo: This should not exist, but currently helps to reduce LOH allocations due to unbinding skin source events on judgement disposal
|
||||
// Todo: Remove when hitobjects are properly pooled
|
||||
new LocalSkinOverrideContainer(null)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = HitObjectContainer,
|
||||
},
|
||||
approachCircles = new ApproachCircleProxyContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -66,6 +66,11 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public int FavouriteCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this beatmap set has been favourited by the current user.
|
||||
/// </summary>
|
||||
public bool HasFavourited { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The availability of this beatmap set.
|
||||
/// </summary>
|
||||
|
@ -247,7 +247,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
// cancelling the beatmap load is safe for now since the retrieval is a synchronous
|
||||
// operation. if we add an async retrieval method this may need to be reconsidered.
|
||||
beatmapCancellation.Cancel();
|
||||
beatmapCancellation?.Cancel();
|
||||
total_count.Value--;
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// </summary>
|
||||
public class Background : CompositeDrawable
|
||||
{
|
||||
public Sprite Sprite;
|
||||
public readonly Sprite Sprite;
|
||||
|
||||
private readonly string textureName;
|
||||
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
/// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
|
||||
public void BlurTo(Vector2 newBlurSigma, double duration = 0, Easing easing = Easing.None)
|
||||
{
|
||||
if (bufferedContainer == null)
|
||||
if (bufferedContainer == null && newBlurSigma != Vector2.Zero)
|
||||
{
|
||||
RemoveInternal(Sprite);
|
||||
|
||||
@ -63,7 +63,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
});
|
||||
}
|
||||
|
||||
bufferedContainer.BlurTo(newBlurSigma, duration, easing);
|
||||
bufferedContainer?.BlurTo(newBlurSigma, duration, easing);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ using osuTK.Graphics;
|
||||
using System;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osuTK.Graphics.ES30;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Allocation;
|
||||
@ -137,11 +136,13 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
}
|
||||
}
|
||||
|
||||
protected int AimCount;
|
||||
|
||||
private void addTriangles(bool randomY)
|
||||
{
|
||||
int aimTriangleCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
||||
AimCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
||||
|
||||
for (int i = 0; i < aimTriangleCount - parts.Count; i++)
|
||||
for (int i = 0; i < AimCount - parts.Count; i++)
|
||||
parts.Add(createTriangle(randomY));
|
||||
}
|
||||
|
||||
@ -190,7 +191,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
||||
private Vector2 size;
|
||||
|
||||
private readonly LinearBatch<TexturedVertex2D> vertexBatch = new LinearBatch<TexturedVertex2D>(100 * 3, 10, PrimitiveType.Triangles);
|
||||
private TriangleBatch<TexturedVertex2D> vertexBatch;
|
||||
|
||||
public TrianglesDrawNode(Triangles source)
|
||||
: base(source)
|
||||
@ -213,6 +214,12 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
base.Draw(vertexAction);
|
||||
|
||||
if (Source.AimCount > 0 && (vertexBatch == null || vertexBatch.Size != Source.AimCount))
|
||||
{
|
||||
vertexBatch?.Dispose();
|
||||
vertexBatch = new TriangleBatch<TexturedVertex2D>(Source.AimCount, 1);
|
||||
}
|
||||
|
||||
shader.Bind();
|
||||
|
||||
Vector2 localInflationAmount = edge_smoothness * DrawInfo.MatrixInverse.ExtractScale().Xy;
|
||||
@ -246,7 +253,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
vertexBatch.Dispose();
|
||||
vertexBatch?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,21 +7,20 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUserBeatmapsRequest : APIRequest<List<APIBeatmapSet>>
|
||||
public class GetUserBeatmapsRequest : PaginatedAPIRequest<List<APIBeatmapSet>>
|
||||
{
|
||||
private readonly long userId;
|
||||
private readonly int offset;
|
||||
|
||||
private readonly BeatmapSetType type;
|
||||
|
||||
public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0)
|
||||
public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int page = 0, int itemsPerPage = 6)
|
||||
: base(page, itemsPerPage)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.offset = offset;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}?offset={offset}";
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().Underscore()}";
|
||||
}
|
||||
|
||||
public enum BeatmapSetType
|
||||
|
@ -6,17 +6,16 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUserMostPlayedBeatmapsRequest : APIRequest<List<APIUserMostPlayedBeatmap>>
|
||||
public class GetUserMostPlayedBeatmapsRequest : PaginatedAPIRequest<List<APIUserMostPlayedBeatmap>>
|
||||
{
|
||||
private readonly long userId;
|
||||
private readonly int offset;
|
||||
|
||||
public GetUserMostPlayedBeatmapsRequest(long userId, int offset = 0)
|
||||
public GetUserMostPlayedBeatmapsRequest(long userId, int page = 0, int itemsPerPage = 5)
|
||||
: base(page, itemsPerPage)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/most_played?offset={offset}";
|
||||
protected override string Target => $@"users/{userId}/beatmapsets/most_played";
|
||||
}
|
||||
}
|
||||
|
@ -6,18 +6,17 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUserRecentActivitiesRequest : APIRequest<List<APIRecentActivity>>
|
||||
public class GetUserRecentActivitiesRequest : PaginatedAPIRequest<List<APIRecentActivity>>
|
||||
{
|
||||
private readonly long userId;
|
||||
private readonly int offset;
|
||||
|
||||
public GetUserRecentActivitiesRequest(long userId, int offset = 0)
|
||||
public GetUserRecentActivitiesRequest(long userId, int page = 0, int itemsPerPage = 5)
|
||||
: base(page, itemsPerPage)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
protected override string Target => $"users/{userId}/recent_activity?offset={offset}";
|
||||
protected override string Target => $"users/{userId}/recent_activity";
|
||||
}
|
||||
|
||||
public enum RecentActivityType
|
||||
|
@ -6,21 +6,19 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUserScoresRequest : APIRequest<List<APILegacyScoreInfo>>
|
||||
public class GetUserScoresRequest : PaginatedAPIRequest<List<APILegacyScoreInfo>>
|
||||
{
|
||||
private readonly long userId;
|
||||
private readonly ScoreType type;
|
||||
private readonly int offset;
|
||||
|
||||
public GetUserScoresRequest(long userId, ScoreType type, int offset = 0)
|
||||
public GetUserScoresRequest(long userId, ScoreType type, int page = 0, int itemsPerPage = 5)
|
||||
: base(page, itemsPerPage)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.type = type;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
// ReSharper disable once ImpureMethodCallOnReadonlyValueField
|
||||
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}?offset={offset}";
|
||||
protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}";
|
||||
}
|
||||
|
||||
public enum ScoreType
|
||||
|
30
osu.Game/Online/API/Requests/PaginatedAPIRequest.cs
Normal file
30
osu.Game/Online/API/Requests/PaginatedAPIRequest.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.Globalization;
|
||||
using osu.Framework.IO.Network;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public abstract class PaginatedAPIRequest<T> : APIRequest<T>
|
||||
{
|
||||
private readonly int page;
|
||||
private readonly int itemsPerPage;
|
||||
|
||||
protected PaginatedAPIRequest(int page, int itemsPerPage)
|
||||
{
|
||||
this.page = page;
|
||||
this.itemsPerPage = itemsPerPage;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
{
|
||||
var req = base.CreateWebRequest();
|
||||
|
||||
req.AddParameter("offset", (page * itemsPerPage).ToString(CultureInfo.InvariantCulture));
|
||||
req.AddParameter("limit", itemsPerPage.ToString(CultureInfo.InvariantCulture));
|
||||
|
||||
return req;
|
||||
}
|
||||
}
|
||||
}
|
@ -30,6 +30,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"preview_url")]
|
||||
private string preview { get; set; }
|
||||
|
||||
[JsonProperty(@"has_favourited")]
|
||||
private bool hasFavourited { get; set; }
|
||||
|
||||
[JsonProperty(@"play_count")]
|
||||
private int playCount { get; set; }
|
||||
|
||||
@ -91,6 +94,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
Ranked = ranked,
|
||||
LastUpdated = lastUpdated,
|
||||
Availability = availability,
|
||||
HasFavourited = hasFavourited,
|
||||
},
|
||||
Beatmaps = beatmaps?.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
||||
};
|
||||
|
@ -51,7 +51,6 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
loading.Hide();
|
||||
|
||||
// schedule because we may not be loaded yet (LoadComponentAsync complains).
|
||||
showScoresDelegate?.Cancel();
|
||||
showScoresCancellationSource?.Cancel();
|
||||
|
||||
@ -61,28 +60,22 @@ namespace osu.Game.Online.Leaderboards
|
||||
// ensure placeholder is hidden when displaying scores
|
||||
PlaceholderState = PlaceholderState.Successful;
|
||||
|
||||
scrollFlow = CreateScoreFlow();
|
||||
scrollFlow.ChildrenEnumerable = scores.Select((s, index) => CreateDrawableScore(s, index + 1));
|
||||
var sf = CreateScoreFlow();
|
||||
sf.ChildrenEnumerable = scores.Select((s, index) => CreateDrawableScore(s, index + 1));
|
||||
|
||||
if (!IsLoaded)
|
||||
showScoresDelegate = Schedule(showScores);
|
||||
else
|
||||
showScores();
|
||||
|
||||
void showScores() => LoadComponentAsync(scrollFlow, _ =>
|
||||
// schedule because we may not be loaded yet (LoadComponentAsync complains).
|
||||
showScoresDelegate = Schedule(() => LoadComponentAsync(sf, _ =>
|
||||
{
|
||||
scrollContainer.Add(scrollFlow);
|
||||
scrollContainer.Add(scrollFlow = sf);
|
||||
|
||||
int i = 0;
|
||||
|
||||
foreach (var s in scrollFlow.Children)
|
||||
{
|
||||
using (s.BeginDelayedSequence(i++ * 50, true))
|
||||
s.Show();
|
||||
}
|
||||
|
||||
scrollContainer.ScrollTo(0f, false);
|
||||
}, (showScoresCancellationSource = new CancellationTokenSource()).Token);
|
||||
}, (showScoresCancellationSource = new CancellationTokenSource()).Token));
|
||||
}
|
||||
}
|
||||
|
||||
@ -201,13 +194,17 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
private APIRequest getScoresRequest;
|
||||
|
||||
protected abstract bool IsOnlineScope { get; }
|
||||
|
||||
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case APIState.Online:
|
||||
case APIState.Offline:
|
||||
UpdateScores();
|
||||
if (IsOnlineScope)
|
||||
UpdateScores();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osuTK;
|
||||
@ -15,7 +16,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
{
|
||||
public class FavouriteButton : HeaderButton
|
||||
{
|
||||
public readonly Bindable<bool> Favourited = new Bindable<bool>();
|
||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
||||
|
||||
private readonly Bindable<bool> favourited = new Bindable<bool>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -54,7 +57,15 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
},
|
||||
});
|
||||
|
||||
Favourited.ValueChanged += favourited =>
|
||||
BeatmapSet.BindValueChanged(setInfo =>
|
||||
{
|
||||
if (setInfo.NewValue?.OnlineInfo?.HasFavourited == null)
|
||||
return;
|
||||
|
||||
favourited.Value = setInfo.NewValue.OnlineInfo.HasFavourited;
|
||||
});
|
||||
|
||||
favourited.ValueChanged += favourited =>
|
||||
{
|
||||
if (favourited.NewValue)
|
||||
{
|
||||
@ -67,8 +78,6 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
icon.Icon = FontAwesome.Regular.Heart;
|
||||
}
|
||||
};
|
||||
|
||||
Action = () => Favourited.Value = !Favourited.Value;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
|
@ -161,7 +161,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
favouriteButton = new FavouriteButton(),
|
||||
favouriteButton = new FavouriteButton
|
||||
{
|
||||
BeatmapSet = { BindTarget = BeatmapSet }
|
||||
},
|
||||
downloadButtonsContainer = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -19,7 +19,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
public class ScoresContainer : CompositeDrawable
|
||||
{
|
||||
private const int spacing = 15;
|
||||
private const int fade_duration = 200;
|
||||
|
||||
private readonly Box background;
|
||||
private readonly ScoreTable scoreTable;
|
||||
@ -53,8 +52,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
loading = false;
|
||||
|
||||
topScoresContainer.Clear();
|
||||
|
||||
if (value?.Scores.Any() != true)
|
||||
@ -128,11 +125,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
background.Colour = colours.Gray2;
|
||||
}
|
||||
|
||||
private bool loading
|
||||
{
|
||||
set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration);
|
||||
}
|
||||
|
||||
private void getScores(BeatmapInfo beatmap)
|
||||
{
|
||||
getScoresRequest?.Cancel();
|
||||
@ -141,15 +133,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Scores = null;
|
||||
|
||||
if (beatmap?.OnlineBeatmapID.HasValue != true)
|
||||
{
|
||||
loading = false;
|
||||
return;
|
||||
}
|
||||
|
||||
loadingAnimation.Show();
|
||||
getScoresRequest = new GetScoresRequest(beatmap, beatmap.Ruleset);
|
||||
getScoresRequest.Success += scores => Scores = scores;
|
||||
getScoresRequest.Success += scores =>
|
||||
{
|
||||
loadingAnimation.Hide();
|
||||
Scores = scores;
|
||||
};
|
||||
api.Queue(getScoresRequest);
|
||||
loading = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
},
|
||||
}
|
||||
},
|
||||
avatar = new UpdateableAvatar(hideImmediately: true)
|
||||
avatar = new UpdateableAvatar
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -99,7 +99,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold)
|
||||
},
|
||||
flag = new UpdateableFlag(hideImmediately: true)
|
||||
flag = new UpdateableFlag
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
|
@ -26,8 +26,13 @@ namespace osu.Game.Overlays.Direct
|
||||
TabContainer.Masking = false;
|
||||
TabContainer.Spacing = new Vector2(10, 0);
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
Current.DisabledChanged += value => SelectedTab.FadeColour(value ? Color4.DarkGray : Color4.White, 200, Easing.OutQuint);
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Current.BindDisabledChanged(value => SelectedTab.FadeColour(value ? Color4.DarkGray : Color4.White, 200, Easing.OutQuint), true);
|
||||
}
|
||||
|
||||
protected override TabItem<RulesetInfo> CreateTabItem(RulesetInfo value) => new DirectRulesetTabItem(value);
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
|
||||
|
||||
protected override void ShowMore()
|
||||
{
|
||||
request = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage);
|
||||
request = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
||||
request.Success += sets => Schedule(() =>
|
||||
{
|
||||
MoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0);
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
|
||||
protected override void ShowMore()
|
||||
{
|
||||
request = new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++ * ItemsPerPage);
|
||||
request = new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
|
||||
request.Success += beatmaps => Schedule(() =>
|
||||
{
|
||||
MoreButton.FadeTo(beatmaps.Count == ItemsPerPage ? 1 : 0);
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
|
||||
protected override void ShowMore()
|
||||
{
|
||||
request = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++ * ItemsPerPage);
|
||||
request = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);
|
||||
request.Success += scores => Schedule(() =>
|
||||
{
|
||||
foreach (var s in scores)
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
||||
|
||||
protected override void ShowMore()
|
||||
{
|
||||
request = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++ * ItemsPerPage);
|
||||
request = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++, ItemsPerPage);
|
||||
request.Success += activities => Schedule(() =>
|
||||
{
|
||||
MoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0);
|
||||
|
@ -7,7 +7,6 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
@ -179,6 +178,39 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
UpdateResult(false);
|
||||
}
|
||||
|
||||
private double? lifetimeStart;
|
||||
|
||||
public override double LifetimeStart
|
||||
{
|
||||
get => lifetimeStart ?? (HitObject.StartTime - InitialLifetimeOffset);
|
||||
set
|
||||
{
|
||||
base.LifetimeStart = value;
|
||||
lifetimeStart = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A safe offset prior to the start time of <see cref="HitObject"/> at which this <see cref="DrawableHitObject"/> may begin displaying contents.
|
||||
/// By default, <see cref="DrawableHitObject"/>s are assumed to display their contents within 10 seconds prior to the start time of <see cref="HitObject"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is only used as an optimisation to delay the initial update of this <see cref="DrawableHitObject"/> and may be tuned more aggressively if required.
|
||||
/// A more accurate <see cref="LifetimeStart"/> should be set inside <see cref="UpdateState"/> for an <see cref="ArmedState.Idle"/> state.
|
||||
/// </remarks>
|
||||
protected virtual double InitialLifetimeOffset => 10000;
|
||||
|
||||
/// <summary>
|
||||
/// Will be called at least once after this <see cref="DrawableHitObject"/> has become not alive.
|
||||
/// </summary>
|
||||
public virtual void OnKilled()
|
||||
{
|
||||
foreach (var nested in NestedHitObjects)
|
||||
nested.OnKilled();
|
||||
|
||||
UpdateResult(false);
|
||||
}
|
||||
|
||||
protected virtual void AddNested(DrawableHitObject h)
|
||||
{
|
||||
h.OnNewResult += (d, r) => OnNewResult?.Invoke(d, r);
|
||||
@ -223,16 +255,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
OnNewResult?.Invoke(this, Result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will called at least once after the <see cref="Drawable.LifetimeEnd"/> of this <see cref="DrawableHitObject"/> has been passed.
|
||||
/// </summary>
|
||||
internal void OnLifetimeEnd()
|
||||
{
|
||||
foreach (var nested in NestedHitObjects)
|
||||
nested.OnLifetimeEnd();
|
||||
UpdateResult(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes this <see cref="DrawableHitObject"/>, checking if a scoring result has occurred.
|
||||
/// </summary>
|
||||
|
@ -37,7 +37,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double? length, PathType pathType, int repeatCount,
|
||||
List<List<HitSampleInfo>> nodeSamples)
|
||||
{
|
||||
newCombo |= forceNewCombo;
|
||||
comboOffset += extraComboOffset;
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
else if (type.HasFlag(ConvertHitObjectType.Slider))
|
||||
{
|
||||
PathType pathType = PathType.Catmull;
|
||||
double length = 0;
|
||||
double? length = null;
|
||||
|
||||
string[] pointSplit = split[5].Split('|');
|
||||
|
||||
@ -130,7 +130,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
repeatCount = Math.Max(0, repeatCount - 1);
|
||||
|
||||
if (split.Length > 7)
|
||||
{
|
||||
length = Math.Max(0, Parsing.ParseDouble(split[7]));
|
||||
if (length == 0)
|
||||
length = null;
|
||||
}
|
||||
|
||||
if (split.Length > 10)
|
||||
readCustomSampleBanks(split[10], bankInfo);
|
||||
@ -291,7 +295,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
/// <param name="repeatCount">The slider repeat count.</param>
|
||||
/// <param name="nodeSamples">The samples to be played when the slider nodes are hit. This includes the head and tail of the slider.</param>
|
||||
/// <returns>The hit object.</returns>
|
||||
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples);
|
||||
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double? length, PathType pathType, int repeatCount,
|
||||
List<List<HitSampleInfo>> nodeSamples);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a legacy Spinner-type hit object.
|
||||
|
@ -26,7 +26,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double? length, PathType pathType, int repeatCount,
|
||||
List<List<HitSampleInfo>> nodeSamples)
|
||||
{
|
||||
return new ConvertSlider
|
||||
{
|
||||
|
@ -1,7 +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.
|
||||
|
||||
using System;
|
||||
using osuTK;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System.Collections.Generic;
|
||||
@ -38,7 +37,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double? length, PathType pathType, int repeatCount,
|
||||
List<List<HitSampleInfo>> nodeSamples)
|
||||
{
|
||||
newCombo |= forceNewCombo;
|
||||
comboOffset += extraComboOffset;
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
Position = position,
|
||||
NewCombo = FirstObject || newCombo,
|
||||
ComboOffset = comboOffset,
|
||||
Path = new SliderPath(pathType, controlPoints, Math.Max(0, length)),
|
||||
Path = new SliderPath(pathType, controlPoints, length),
|
||||
NodeSamples = nodeSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
|
@ -23,7 +23,8 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||
return new ConvertHit();
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<HitSampleInfo>> nodeSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double? length, PathType pathType, int repeatCount,
|
||||
List<List<HitSampleInfo>> nodeSamples)
|
||||
{
|
||||
return new ConvertSlider
|
||||
{
|
||||
|
@ -34,8 +34,14 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
protected override void OnChildLifetimeBoundaryCrossed(LifetimeBoundaryCrossedEvent e)
|
||||
{
|
||||
if (e.Kind == LifetimeBoundaryKind.End && e.Direction == LifetimeBoundaryCrossingDirection.Forward && e.Child is DrawableHitObject hitObject)
|
||||
hitObject.OnLifetimeEnd();
|
||||
if (!(e.Child is DrawableHitObject hitObject))
|
||||
return;
|
||||
|
||||
if ((e.Kind == LifetimeBoundaryKind.End && e.Direction == LifetimeBoundaryCrossingDirection.Forward)
|
||||
|| (e.Kind == LifetimeBoundaryKind.Start && e.Direction == LifetimeBoundaryCrossingDirection.Backward))
|
||||
{
|
||||
hitObject.OnKilled();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
@ -168,6 +168,12 @@ namespace osu.Game.Screens.Backgrounds
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
userBlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
userBlurLevel.ValueChanged += _ => UpdateVisuals();
|
||||
BlurAmount.ValueChanged += _ => UpdateVisuals();
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
}, true);
|
||||
}
|
||||
|
||||
protected override bool IsOnlineScope => true;
|
||||
|
||||
protected override APIRequest FetchScores(Action<IEnumerable<APIRoomScoreInfo>> scoresCallback)
|
||||
{
|
||||
if (roomId.Value == null)
|
||||
|
@ -256,9 +256,12 @@ namespace osu.Game.Screens.Ranking
|
||||
}
|
||||
};
|
||||
|
||||
foreach (var t in CreateResultPages())
|
||||
modeChangeButtons.AddItem(t);
|
||||
modeChangeButtons.Current.Value = modeChangeButtons.Items.FirstOrDefault();
|
||||
var pages = CreateResultPages();
|
||||
|
||||
foreach (var p in pages)
|
||||
modeChangeButtons.AddItem(p);
|
||||
|
||||
modeChangeButtons.Current.Value = pages.FirstOrDefault();
|
||||
|
||||
modeChangeButtons.Current.BindValueChanged(page =>
|
||||
{
|
||||
|
@ -120,7 +120,8 @@ namespace osu.Game.Screens.Select
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 24,
|
||||
Width = 0.5f,
|
||||
AutoSort = true
|
||||
AutoSort = true,
|
||||
Current = { Value = GroupMode.Title }
|
||||
},
|
||||
//spriteText = new OsuSpriteText
|
||||
//{
|
||||
@ -139,6 +140,7 @@ namespace osu.Game.Screens.Select
|
||||
Width = 0.5f,
|
||||
Height = 24,
|
||||
AutoSort = true,
|
||||
Current = { Value = SortMode.Title }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -9,18 +9,25 @@ using osu.Game.Rulesets.Mods;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class FooterButtonMods : FooterButton
|
||||
public class FooterButtonMods : FooterButton, IHasCurrentValue<IReadOnlyList<Mod>>
|
||||
{
|
||||
public FooterButtonMods(Bindable<IReadOnlyList<Mod>> mods)
|
||||
public Bindable<IReadOnlyList<Mod>> Current
|
||||
{
|
||||
FooterModDisplay modDisplay;
|
||||
get => modDisplay.Current;
|
||||
set => modDisplay.Current = value;
|
||||
}
|
||||
|
||||
private readonly FooterModDisplay modDisplay;
|
||||
|
||||
public FooterButtonMods()
|
||||
{
|
||||
Add(new Container
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
@ -33,9 +40,6 @@ namespace osu.Game.Screens.Select
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Margin = new MarginPadding { Left = 70 }
|
||||
});
|
||||
|
||||
if (mods != null)
|
||||
modDisplay.Current = mods;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -79,6 +79,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
};
|
||||
}
|
||||
|
||||
protected override bool IsOnlineScope => Scope != BeatmapLeaderboardScope.Local;
|
||||
|
||||
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
||||
{
|
||||
if (Scope == BeatmapLeaderboardScope.Local)
|
||||
|
@ -221,11 +221,9 @@ namespace osu.Game.Screens.Select
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores)
|
||||
{
|
||||
mods.BindTo(Mods);
|
||||
|
||||
if (Footer != null)
|
||||
{
|
||||
Footer.AddButton(new FooterButtonMods(mods), ModSelect);
|
||||
Footer.AddButton(new FooterButtonMods { Current = mods }, ModSelect);
|
||||
Footer.AddButton(new FooterButtonRandom { Action = triggerRandom });
|
||||
Footer.AddButton(new FooterButtonOptions(), BeatmapOptions);
|
||||
|
||||
@ -253,7 +251,7 @@ namespace osu.Game.Screens.Select
|
||||
Schedule(() =>
|
||||
{
|
||||
// if we have no beatmaps but osu-stable is found, let's prompt the user to import.
|
||||
if (!beatmaps.GetAllUsableBeatmapSets().Any() && beatmaps.StableInstallationAvailable)
|
||||
if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
|
||||
dialogOverlay.Push(new ImportFromStablePopup(() =>
|
||||
{
|
||||
Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
@ -263,6 +261,13 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
mods.BindTo(Mods);
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Skinning
|
||||
public Drawable GetDrawableComponent(string componentName)
|
||||
{
|
||||
Drawable sourceDrawable;
|
||||
if (beatmapSkins.Value && (sourceDrawable = skin.GetDrawableComponent(componentName)) != null)
|
||||
if (beatmapSkins.Value && (sourceDrawable = skin?.GetDrawableComponent(componentName)) != null)
|
||||
return sourceDrawable;
|
||||
|
||||
return fallbackSource?.GetDrawableComponent(componentName);
|
||||
@ -43,7 +43,7 @@ namespace osu.Game.Skinning
|
||||
public Texture GetTexture(string componentName)
|
||||
{
|
||||
Texture sourceTexture;
|
||||
if (beatmapSkins.Value && (sourceTexture = skin.GetTexture(componentName)) != null)
|
||||
if (beatmapSkins.Value && (sourceTexture = skin?.GetTexture(componentName)) != null)
|
||||
return sourceTexture;
|
||||
|
||||
return fallbackSource.GetTexture(componentName);
|
||||
@ -52,7 +52,7 @@ namespace osu.Game.Skinning
|
||||
public SampleChannel GetSample(string sampleName)
|
||||
{
|
||||
SampleChannel sourceChannel;
|
||||
if (beatmapHitsounds.Value && (sourceChannel = skin.GetSample(sampleName)) != null)
|
||||
if (beatmapHitsounds.Value && (sourceChannel = skin?.GetSample(sampleName)) != null)
|
||||
return sourceChannel;
|
||||
|
||||
return fallbackSource?.GetSample(sampleName);
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
@ -38,8 +37,6 @@ namespace osu.Game.Users.Drawables
|
||||
set => base.EdgeEffect = value;
|
||||
}
|
||||
|
||||
protected override bool TransformImmediately { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show a default guest representation on null user (as opposed to nothing).
|
||||
/// </summary>
|
||||
@ -50,14 +47,11 @@ namespace osu.Game.Users.Drawables
|
||||
/// </summary>
|
||||
public readonly BindableBool OpenOnClick = new BindableBool(true);
|
||||
|
||||
public UpdateableAvatar(User user = null, bool hideImmediately = false)
|
||||
public UpdateableAvatar(User user = null)
|
||||
{
|
||||
TransformImmediately = hideImmediately;
|
||||
User = user;
|
||||
}
|
||||
|
||||
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable);
|
||||
|
||||
protected override Drawable CreateDrawable(User user)
|
||||
{
|
||||
if (user == null && !ShowGuestOnNull)
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Users.Drawables
|
||||
{
|
||||
@ -15,21 +14,16 @@ namespace osu.Game.Users.Drawables
|
||||
set => Model = value;
|
||||
}
|
||||
|
||||
protected override bool TransformImmediately { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether to show a place holder on null country.
|
||||
/// </summary>
|
||||
public bool ShowPlaceholderOnNull = true;
|
||||
|
||||
public UpdateableFlag(Country country = null, bool hideImmediately = false)
|
||||
public UpdateableFlag(Country country = null)
|
||||
{
|
||||
TransformImmediately = hideImmediately;
|
||||
Country = country;
|
||||
}
|
||||
|
||||
protected override TransformSequence<Drawable> ApplyHideTransforms(Drawable drawable) => TransformImmediately ? drawable?.FadeOut() : base.ApplyHideTransforms(drawable);
|
||||
|
||||
protected override Drawable CreateDrawable(Country country)
|
||||
{
|
||||
if (country == null && !ShowPlaceholderOnNull)
|
||||
|
@ -15,7 +15,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.711.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.719.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.23.0" />
|
||||
<PackageReference Include="NUnit" Version="3.12.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
@ -105,8 +105,8 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.702.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.711.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.711.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2019.719.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.719.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user