mirror of
https://github.com/ppy/osu.git
synced 2025-03-12 10:27:20 +08:00
Merge branch 'master' into storyboard-clock
This commit is contained in:
commit
4390e163fc
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Catch.Difficulty.Skills;
|
using osu.Game.Rulesets.Catch.Difficulty.Skills;
|
||||||
|
using osu.Game.Rulesets.Catch.Mods;
|
||||||
using osu.Game.Rulesets.Catch.Objects;
|
using osu.Game.Rulesets.Catch.Objects;
|
||||||
using osu.Game.Rulesets.Catch.UI;
|
using osu.Game.Rulesets.Catch.UI;
|
||||||
using osu.Game.Rulesets.Difficulty;
|
using osu.Game.Rulesets.Difficulty;
|
||||||
@ -88,5 +89,13 @@ namespace osu.Game.Rulesets.Catch.Difficulty
|
|||||||
{
|
{
|
||||||
new Movement(),
|
new Movement(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||||
|
{
|
||||||
|
new CatchModDoubleTime(),
|
||||||
|
new CatchModHalfTime(),
|
||||||
|
new CatchModHardRock(),
|
||||||
|
new CatchModEasy(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
if (lastPlateableFruit.IsLoaded)
|
if (lastPlateableFruit.IsLoaded)
|
||||||
action();
|
action();
|
||||||
else
|
else
|
||||||
lastPlateableFruit.OnLoadComplete = _ => action();
|
lastPlateableFruit.OnLoadComplete += _ => action();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.IsHit && fruit.CanBePlated)
|
if (result.IsHit && fruit.CanBePlated)
|
||||||
|
@ -22,22 +22,15 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
JudgementText.Font = JudgementText.Font.With(size: 25);
|
JudgementText.Font = JudgementText.Font.With(size: 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override double FadeInDuration => 50;
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
this.FadeInFromZero(50, Easing.OutQuint);
|
protected override void ApplyHitAnimations()
|
||||||
|
|
||||||
if (Result.IsHit)
|
|
||||||
{
|
{
|
||||||
JudgementBody.ScaleTo(0.8f);
|
JudgementBody.ScaleTo(0.8f);
|
||||||
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
|
JudgementBody.ScaleTo(1, 250, Easing.OutElastic);
|
||||||
|
|
||||||
JudgementBody.Delay(50).ScaleTo(0.75f, 250);
|
JudgementBody.Delay(FadeInDuration).ScaleTo(0.75f, 250);
|
||||||
this.Delay(50).FadeOut(200);
|
this.Delay(FadeInDuration).FadeOut(200);
|
||||||
}
|
|
||||||
|
|
||||||
Expire();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,6 @@ using osu.Framework.Graphics;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||||
{
|
{
|
||||||
@ -16,12 +15,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void ApplyHitAnimations()
|
||||||
{
|
{
|
||||||
if (Result.Type != HitResult.Miss)
|
|
||||||
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
JudgementText?.TransformSpacingTo(new Vector2(14, 0), 1800, Easing.OutQuint);
|
||||||
|
base.ApplyHitAnimations();
|
||||||
base.LoadComplete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,6 +132,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
|||||||
base.ClearTransformsAfter(time, false, targetMember);
|
base.ClearTransformsAfter(time, false, targetMember);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void ApplyTransformsAt(double time, bool propagateChildren = false)
|
||||||
|
{
|
||||||
|
// For the same reasons as above w.r.t rewinding, we shouldn't propagate to children here either.
|
||||||
|
base.ApplyTransformsAt(time, false);
|
||||||
|
}
|
||||||
|
|
||||||
private bool tracking;
|
private bool tracking;
|
||||||
|
|
||||||
public bool Tracking
|
public bool Tracking
|
||||||
|
@ -39,12 +39,10 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void ApplyHitAnimations()
|
||||||
{
|
{
|
||||||
if (Result.IsHit)
|
|
||||||
this.MoveToY(-100, 500);
|
this.MoveToY(-100, 500);
|
||||||
|
base.ApplyHitAnimations();
|
||||||
base.LoadComplete();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
72
osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs
Normal file
72
osu.Game.Tests/Beatmaps/Formats/ParsingTest.cs
Normal file
@ -0,0 +1,72 @@
|
|||||||
|
// 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.Globalization;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Beatmaps.Formats;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Beatmaps.Formats
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class ParsingTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestNaNHandling() => allThrow<FormatException>("NaN");
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestBadStringHandling() => allThrow<FormatException>("Random string 123");
|
||||||
|
|
||||||
|
[TestCase(Parsing.MAX_PARSE_VALUE)]
|
||||||
|
[TestCase(-1)]
|
||||||
|
[TestCase(0)]
|
||||||
|
[TestCase(1)]
|
||||||
|
[TestCase(-Parsing.MAX_PARSE_VALUE)]
|
||||||
|
[TestCase(10, 10)]
|
||||||
|
[TestCase(-10, 10)]
|
||||||
|
public void TestValidRanges(double input, double limit = Parsing.MAX_PARSE_VALUE)
|
||||||
|
{
|
||||||
|
Assert.AreEqual(Parsing.ParseInt((input).ToString(CultureInfo.InvariantCulture), (int)limit), (int)input);
|
||||||
|
Assert.AreEqual(Parsing.ParseFloat((input).ToString(CultureInfo.InvariantCulture), (float)limit), (float)input);
|
||||||
|
Assert.AreEqual(Parsing.ParseDouble((input).ToString(CultureInfo.InvariantCulture), limit), input);
|
||||||
|
}
|
||||||
|
|
||||||
|
[TestCase(double.PositiveInfinity)]
|
||||||
|
[TestCase(double.NegativeInfinity)]
|
||||||
|
[TestCase(999999999999)]
|
||||||
|
[TestCase(Parsing.MAX_PARSE_VALUE * 1.1)]
|
||||||
|
[TestCase(-Parsing.MAX_PARSE_VALUE * 1.1)]
|
||||||
|
[TestCase(11, 10)]
|
||||||
|
[TestCase(-11, 10)]
|
||||||
|
public void TestOutOfRangeHandling(double input, double limit = Parsing.MAX_PARSE_VALUE)
|
||||||
|
=> allThrow<OverflowException>(input.ToString(CultureInfo.InvariantCulture), limit);
|
||||||
|
|
||||||
|
private void allThrow<T>(string input, double limit = Parsing.MAX_PARSE_VALUE)
|
||||||
|
where T : Exception
|
||||||
|
{
|
||||||
|
Assert.Throws(getIntParseException(input) ?? typeof(T), () => Parsing.ParseInt(input, (int)limit));
|
||||||
|
Assert.Throws<T>(() => Parsing.ParseFloat(input, (float)limit));
|
||||||
|
Assert.Throws<T>(() => Parsing.ParseDouble(input, limit));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// <see cref="int"/> may not be able to parse some inputs.
|
||||||
|
/// In this case we expect to receive the raw parsing exception.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="input">The input attempting to be parsed.</param>
|
||||||
|
/// <returns>The type of exception thrown by <see cref="int.Parse(string)"/>. Null if no exception is thrown.</returns>
|
||||||
|
private Type getIntParseException(string input)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var _ = int.Parse(input);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
return e.GetType();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,12 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -12,14 +16,145 @@ namespace osu.Game.Tests.Visual
|
|||||||
[System.ComponentModel.Description("PlaySongSelect leaderboard/details area")]
|
[System.ComponentModel.Description("PlaySongSelect leaderboard/details area")]
|
||||||
public class TestCaseBeatmapDetailArea : OsuTestCase
|
public class TestCaseBeatmapDetailArea : OsuTestCase
|
||||||
{
|
{
|
||||||
|
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(BeatmapDetails) };
|
||||||
|
|
||||||
public TestCaseBeatmapDetailArea()
|
public TestCaseBeatmapDetailArea()
|
||||||
{
|
{
|
||||||
Add(new BeatmapDetailArea
|
BeatmapDetailArea detailsArea;
|
||||||
|
Add(detailsArea = new BeatmapDetailArea
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Size = new Vector2(550f, 450f),
|
Size = new Vector2(550f, 450f),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep("all metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Version = "All Metrics",
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Source = "osu!lazer",
|
||||||
|
Tags = "this beatmap has all the metrics",
|
||||||
|
},
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
CircleSize = 7,
|
||||||
|
DrainRate = 1,
|
||||||
|
OverallDifficulty = 5.7f,
|
||||||
|
ApproachRate = 3.5f,
|
||||||
|
},
|
||||||
|
StarDifficulty = 5.3f,
|
||||||
|
Metrics = new BeatmapMetrics
|
||||||
|
{
|
||||||
|
Ratings = Enumerable.Range(0, 11),
|
||||||
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||||
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
AddStep("all except source", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Version = "All Metrics",
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Tags = "this beatmap has all the metrics",
|
||||||
|
},
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
CircleSize = 7,
|
||||||
|
DrainRate = 1,
|
||||||
|
OverallDifficulty = 5.7f,
|
||||||
|
ApproachRate = 3.5f,
|
||||||
|
},
|
||||||
|
StarDifficulty = 5.3f,
|
||||||
|
Metrics = new BeatmapMetrics
|
||||||
|
{
|
||||||
|
Ratings = Enumerable.Range(0, 11),
|
||||||
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||||
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("ratings", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Version = "Only Ratings",
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Source = "osu!lazer",
|
||||||
|
Tags = "this beatmap has ratings metrics but not retries or fails",
|
||||||
|
},
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
CircleSize = 6,
|
||||||
|
DrainRate = 9,
|
||||||
|
OverallDifficulty = 6,
|
||||||
|
ApproachRate = 6,
|
||||||
|
},
|
||||||
|
StarDifficulty = 4.8f,
|
||||||
|
Metrics = new BeatmapMetrics
|
||||||
|
{
|
||||||
|
Ratings = Enumerable.Range(0, 11),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("fails+retries", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Version = "Only Retries and Fails",
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Source = "osu!lazer",
|
||||||
|
Tags = "this beatmap has retries and fails but no ratings",
|
||||||
|
},
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
CircleSize = 3.7f,
|
||||||
|
DrainRate = 6,
|
||||||
|
OverallDifficulty = 6,
|
||||||
|
ApproachRate = 7,
|
||||||
|
},
|
||||||
|
StarDifficulty = 2.91f,
|
||||||
|
Metrics = new BeatmapMetrics
|
||||||
|
{
|
||||||
|
Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6),
|
||||||
|
Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("null metrics", () => detailsArea.Beatmap = new DummyWorkingBeatmap
|
||||||
|
{
|
||||||
|
BeatmapInfo =
|
||||||
|
{
|
||||||
|
Version = "No Metrics",
|
||||||
|
Metadata = new BeatmapMetadata
|
||||||
|
{
|
||||||
|
Source = "osu!lazer",
|
||||||
|
Tags = "this beatmap has no metrics",
|
||||||
|
},
|
||||||
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
CircleSize = 5,
|
||||||
|
DrainRate = 5,
|
||||||
|
OverallDifficulty = 5.5f,
|
||||||
|
ApproachRate = 6.5f,
|
||||||
|
},
|
||||||
|
StarDifficulty = 1.97f,
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("null beatmap", () => detailsArea.Beatmap = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
private BeatmapManager beatmaps { get; set; }
|
private BeatmapManager beatmaps { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGameBase osu, APIAccess api, RulesetStore rulesets)
|
private void load(OsuGameBase osu, IAPIProvider api, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
Bindable<BeatmapInfo> beatmapBindable = new Bindable<BeatmapInfo>();
|
Bindable<BeatmapInfo> beatmapBindable = new Bindable<BeatmapInfo>();
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
public class TestCaseUserProfile : OsuTestCase
|
public class TestCaseUserProfile : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly TestUserProfileOverlay profile;
|
private readonly TestUserProfileOverlay profile;
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private readonly BeatmapStore beatmaps;
|
private readonly BeatmapStore beatmaps;
|
||||||
|
|
||||||
private readonly APIAccess api;
|
private readonly IAPIProvider api;
|
||||||
|
|
||||||
private readonly AudioManager audioManager;
|
private readonly AudioManager audioManager;
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
private readonly List<DownloadBeatmapSetRequest> currentDownloads = new List<DownloadBeatmapSetRequest>();
|
private readonly List<DownloadBeatmapSetRequest> currentDownloads = new List<DownloadBeatmapSetRequest>();
|
||||||
|
|
||||||
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, APIAccess api, AudioManager audioManager, GameHost host = null,
|
public BeatmapManager(Storage storage, IDatabaseContextFactory contextFactory, RulesetStore rulesets, IAPIProvider api, AudioManager audioManager, GameHost host = null,
|
||||||
WorkingBeatmap defaultBeatmap = null)
|
WorkingBeatmap defaultBeatmap = null)
|
||||||
: base(storage, contextFactory, new BeatmapStore(contextFactory), host)
|
: base(storage, contextFactory, new BeatmapStore(contextFactory), host)
|
||||||
{
|
{
|
||||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
drawable.Anchor = Anchor.Centre;
|
drawable.Anchor = Anchor.Centre;
|
||||||
drawable.Origin = Anchor.Centre;
|
drawable.Origin = Anchor.Centre;
|
||||||
drawable.FillMode = FillMode.Fill;
|
drawable.FillMode = FillMode.Fill;
|
||||||
drawable.OnLoadComplete = d => d.FadeInFromZero(400);
|
drawable.OnLoadComplete += d => d.FadeInFromZero(400);
|
||||||
|
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
@ -67,16 +67,19 @@ namespace osu.Game.Beatmaps.Drawables
|
|||||||
|
|
||||||
if (beatmapSet != null)
|
if (beatmapSet != null)
|
||||||
{
|
{
|
||||||
|
BeatmapSetCover cover;
|
||||||
|
|
||||||
Add(displayedCover = new DelayedLoadWrapper(
|
Add(displayedCover = new DelayedLoadWrapper(
|
||||||
new BeatmapSetCover(beatmapSet, coverType)
|
cover = new BeatmapSetCover(beatmapSet, coverType)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cover.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,12 @@ namespace osu.Game.Beatmaps
|
|||||||
Title = "no beatmaps available!"
|
Title = "no beatmaps available!"
|
||||||
},
|
},
|
||||||
BeatmapSet = new BeatmapSetInfo(),
|
BeatmapSet = new BeatmapSetInfo(),
|
||||||
BaseDifficulty = new BeatmapDifficulty(),
|
BaseDifficulty = new BeatmapDifficulty
|
||||||
|
{
|
||||||
|
DrainRate = 0,
|
||||||
|
CircleSize = 0,
|
||||||
|
OverallDifficulty = 0,
|
||||||
|
},
|
||||||
Ruleset = new DummyRulesetInfo()
|
Ruleset = new DummyRulesetInfo()
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.IO.File;
|
using osu.Framework.IO.File;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Objects.Legacy;
|
using osu.Game.Rulesets.Objects.Legacy;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
@ -25,7 +25,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
public static void Register()
|
public static void Register()
|
||||||
{
|
{
|
||||||
AddDecoder<Beatmap>(@"osu file format v", m => new LegacyBeatmapDecoder(int.Parse(m.Split('v').Last())));
|
AddDecoder<Beatmap>(@"osu file format v", m => new LegacyBeatmapDecoder(Parsing.ParseInt(m.Split('v').Last())));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -104,25 +104,25 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
metadata.AudioFile = FileSafety.PathStandardise(pair.Value);
|
metadata.AudioFile = FileSafety.PathStandardise(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"AudioLeadIn":
|
case @"AudioLeadIn":
|
||||||
beatmap.BeatmapInfo.AudioLeadIn = int.Parse(pair.Value);
|
beatmap.BeatmapInfo.AudioLeadIn = Parsing.ParseInt(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"PreviewTime":
|
case @"PreviewTime":
|
||||||
metadata.PreviewTime = getOffsetTime(int.Parse(pair.Value));
|
metadata.PreviewTime = getOffsetTime(Parsing.ParseInt(pair.Value));
|
||||||
break;
|
break;
|
||||||
case @"Countdown":
|
case @"Countdown":
|
||||||
beatmap.BeatmapInfo.Countdown = int.Parse(pair.Value) == 1;
|
beatmap.BeatmapInfo.Countdown = Parsing.ParseInt(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
case @"SampleSet":
|
case @"SampleSet":
|
||||||
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value);
|
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"SampleVolume":
|
case @"SampleVolume":
|
||||||
defaultSampleVolume = int.Parse(pair.Value);
|
defaultSampleVolume = Parsing.ParseInt(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"StackLeniency":
|
case @"StackLeniency":
|
||||||
beatmap.BeatmapInfo.StackLeniency = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.StackLeniency = Parsing.ParseFloat(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"Mode":
|
case @"Mode":
|
||||||
beatmap.BeatmapInfo.RulesetID = int.Parse(pair.Value);
|
beatmap.BeatmapInfo.RulesetID = Parsing.ParseInt(pair.Value);
|
||||||
|
|
||||||
switch (beatmap.BeatmapInfo.RulesetID)
|
switch (beatmap.BeatmapInfo.RulesetID)
|
||||||
{
|
{
|
||||||
@ -142,13 +142,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
case @"LetterboxInBreaks":
|
case @"LetterboxInBreaks":
|
||||||
beatmap.BeatmapInfo.LetterboxInBreaks = int.Parse(pair.Value) == 1;
|
beatmap.BeatmapInfo.LetterboxInBreaks = Parsing.ParseInt(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
case @"SpecialStyle":
|
case @"SpecialStyle":
|
||||||
beatmap.BeatmapInfo.SpecialStyle = int.Parse(pair.Value) == 1;
|
beatmap.BeatmapInfo.SpecialStyle = Parsing.ParseInt(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
case @"WidescreenStoryboard":
|
case @"WidescreenStoryboard":
|
||||||
beatmap.BeatmapInfo.WidescreenStoryboard = int.Parse(pair.Value) == 1;
|
beatmap.BeatmapInfo.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -163,16 +163,16 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"DistanceSpacing":
|
case @"DistanceSpacing":
|
||||||
beatmap.BeatmapInfo.DistanceSpacing = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value));
|
||||||
break;
|
break;
|
||||||
case @"BeatDivisor":
|
case @"BeatDivisor":
|
||||||
beatmap.BeatmapInfo.BeatDivisor = int.Parse(pair.Value);
|
beatmap.BeatmapInfo.BeatDivisor = Parsing.ParseInt(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"GridSize":
|
case @"GridSize":
|
||||||
beatmap.BeatmapInfo.GridSize = int.Parse(pair.Value);
|
beatmap.BeatmapInfo.GridSize = Parsing.ParseInt(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"TimelineZoom":
|
case @"TimelineZoom":
|
||||||
beatmap.BeatmapInfo.TimelineZoom = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
beatmap.BeatmapInfo.TimelineZoom = Math.Max(0, Parsing.ParseDouble(pair.Value));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -209,10 +209,10 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
|
beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
|
||||||
break;
|
break;
|
||||||
case @"BeatmapID":
|
case @"BeatmapID":
|
||||||
beatmap.BeatmapInfo.OnlineBeatmapID = int.Parse(pair.Value);
|
beatmap.BeatmapInfo.OnlineBeatmapID = Parsing.ParseInt(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"BeatmapSetID":
|
case @"BeatmapSetID":
|
||||||
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = int.Parse(pair.Value) };
|
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = Parsing.ParseInt(pair.Value) };
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -225,22 +225,22 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
switch (pair.Key)
|
switch (pair.Key)
|
||||||
{
|
{
|
||||||
case @"HPDrainRate":
|
case @"HPDrainRate":
|
||||||
difficulty.DrainRate = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
difficulty.DrainRate = Parsing.ParseFloat(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"CircleSize":
|
case @"CircleSize":
|
||||||
difficulty.CircleSize = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
difficulty.CircleSize = Parsing.ParseFloat(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"OverallDifficulty":
|
case @"OverallDifficulty":
|
||||||
difficulty.OverallDifficulty = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"ApproachRate":
|
case @"ApproachRate":
|
||||||
difficulty.ApproachRate = float.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
difficulty.ApproachRate = Parsing.ParseFloat(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"SliderMultiplier":
|
case @"SliderMultiplier":
|
||||||
difficulty.SliderMultiplier = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value);
|
||||||
break;
|
break;
|
||||||
case @"SliderTickRate":
|
case @"SliderTickRate":
|
||||||
difficulty.SliderTickRate = double.Parse(pair.Value, NumberFormatInfo.InvariantInfo);
|
difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -260,10 +260,12 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(filename);
|
beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(filename);
|
||||||
break;
|
break;
|
||||||
case EventType.Break:
|
case EventType.Break:
|
||||||
|
double start = getOffsetTime(Parsing.ParseDouble(split[1]));
|
||||||
|
|
||||||
var breakEvent = new BreakPeriod
|
var breakEvent = new BreakPeriod
|
||||||
{
|
{
|
||||||
StartTime = getOffsetTime(double.Parse(split[1], NumberFormatInfo.InvariantInfo)),
|
StartTime = start,
|
||||||
EndTime = getOffsetTime(double.Parse(split[2], NumberFormatInfo.InvariantInfo))
|
EndTime = Math.Max(start, getOffsetTime(Parsing.ParseDouble(split[2])))
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!breakEvent.HasEffect)
|
if (!breakEvent.HasEffect)
|
||||||
@ -280,25 +282,25 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
{
|
{
|
||||||
string[] split = line.Split(',');
|
string[] split = line.Split(',');
|
||||||
|
|
||||||
double time = getOffsetTime(double.Parse(split[0].Trim(), NumberFormatInfo.InvariantInfo));
|
double time = getOffsetTime(Parsing.ParseDouble(split[0].Trim()));
|
||||||
double beatLength = double.Parse(split[1].Trim(), NumberFormatInfo.InvariantInfo);
|
double beatLength = Parsing.ParseDouble(split[1].Trim());
|
||||||
double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
|
double speedMultiplier = beatLength < 0 ? 100.0 / -beatLength : 1;
|
||||||
|
|
||||||
TimeSignatures timeSignature = TimeSignatures.SimpleQuadruple;
|
TimeSignatures timeSignature = TimeSignatures.SimpleQuadruple;
|
||||||
if (split.Length >= 3)
|
if (split.Length >= 3)
|
||||||
timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)int.Parse(split[2]);
|
timeSignature = split[2][0] == '0' ? TimeSignatures.SimpleQuadruple : (TimeSignatures)Parsing.ParseInt(split[2]);
|
||||||
|
|
||||||
LegacySampleBank sampleSet = defaultSampleBank;
|
LegacySampleBank sampleSet = defaultSampleBank;
|
||||||
if (split.Length >= 4)
|
if (split.Length >= 4)
|
||||||
sampleSet = (LegacySampleBank)int.Parse(split[3]);
|
sampleSet = (LegacySampleBank)Parsing.ParseInt(split[3]);
|
||||||
|
|
||||||
int customSampleBank = 0;
|
int customSampleBank = 0;
|
||||||
if (split.Length >= 5)
|
if (split.Length >= 5)
|
||||||
customSampleBank = int.Parse(split[4]);
|
customSampleBank = Parsing.ParseInt(split[4]);
|
||||||
|
|
||||||
int sampleVolume = defaultSampleVolume;
|
int sampleVolume = defaultSampleVolume;
|
||||||
if (split.Length >= 6)
|
if (split.Length >= 6)
|
||||||
sampleVolume = int.Parse(split[5]);
|
sampleVolume = Parsing.ParseInt(split[5]);
|
||||||
|
|
||||||
bool timingChange = true;
|
bool timingChange = true;
|
||||||
if (split.Length >= 7)
|
if (split.Length >= 7)
|
||||||
@ -308,7 +310,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
bool omitFirstBarSignature = false;
|
bool omitFirstBarSignature = false;
|
||||||
if (split.Length >= 8)
|
if (split.Length >= 8)
|
||||||
{
|
{
|
||||||
EffectFlags effectFlags = (EffectFlags)int.Parse(split[7]);
|
EffectFlags effectFlags = (EffectFlags)Parsing.ParseInt(split[7]);
|
||||||
kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai);
|
kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai);
|
||||||
omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine);
|
omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine);
|
||||||
}
|
}
|
||||||
@ -348,8 +350,13 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
CustomSampleBank = customSampleBank
|
CustomSampleBank = customSampleBank
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (FormatException e)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
|
Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
}
|
||||||
|
catch (OverflowException)
|
||||||
|
{
|
||||||
|
Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
52
osu.Game/Beatmaps/Formats/Parsing.cs
Normal file
52
osu.Game/Beatmaps/Formats/Parsing.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Formats
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Helper methods to parse from string to number and perform very basic validation.
|
||||||
|
/// </summary>
|
||||||
|
public static class Parsing
|
||||||
|
{
|
||||||
|
public const int MAX_COORDINATE_VALUE = 65536;
|
||||||
|
|
||||||
|
public const double MAX_PARSE_VALUE = int.MaxValue;
|
||||||
|
|
||||||
|
public static float ParseFloat(string input, float parseLimit = (float)MAX_PARSE_VALUE)
|
||||||
|
{
|
||||||
|
var output = float.Parse(input, CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||||
|
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||||
|
|
||||||
|
if (float.IsNaN(output)) throw new FormatException("Not a number");
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double ParseDouble(string input, double parseLimit = MAX_PARSE_VALUE)
|
||||||
|
{
|
||||||
|
var output = double.Parse(input, CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||||
|
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||||
|
|
||||||
|
if (double.IsNaN(output)) throw new FormatException("Not a number");
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int ParseInt(string input, int parseLimit = (int)MAX_PARSE_VALUE)
|
||||||
|
{
|
||||||
|
var output = int.Parse(input, CultureInfo.InvariantCulture);
|
||||||
|
|
||||||
|
if (output < -parseLimit) throw new OverflowException("Value is too low");
|
||||||
|
if (output > parseLimit) throw new OverflowException("Value is too high");
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,6 @@ namespace osu.Game.Migrations
|
|||||||
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Online.API
|
|||||||
private readonly OsuConfigManager config;
|
private readonly OsuConfigManager config;
|
||||||
private readonly OAuth authentication;
|
private readonly OAuth authentication;
|
||||||
|
|
||||||
public string Endpoint = @"https://osu.ppy.sh";
|
public string Endpoint => @"https://osu.ppy.sh";
|
||||||
private const string client_id = @"5";
|
private const string client_id = @"5";
|
||||||
private const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
private const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
||||||
|
|
||||||
|
@ -61,9 +61,12 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
private Action pendingFailure;
|
private Action pendingFailure;
|
||||||
|
|
||||||
public void Perform(APIAccess api)
|
public void Perform(IAPIProvider api)
|
||||||
{
|
{
|
||||||
API = api;
|
if (!(api is APIAccess apiAccess))
|
||||||
|
throw new NotSupportedException($"A {nameof(APIAccess)} is required to perform requests.");
|
||||||
|
|
||||||
|
API = apiAccess;
|
||||||
|
|
||||||
if (checkAndScheduleFailure())
|
if (checkAndScheduleFailure())
|
||||||
return;
|
return;
|
||||||
@ -71,7 +74,7 @@ namespace osu.Game.Online.API
|
|||||||
WebRequest = CreateWebRequest();
|
WebRequest = CreateWebRequest();
|
||||||
WebRequest.Failed += Fail;
|
WebRequest.Failed += Fail;
|
||||||
WebRequest.AllowRetryOnTimeout = false;
|
WebRequest.AllowRetryOnTimeout = false;
|
||||||
WebRequest.AddHeader("Authorization", $"Bearer {api.AccessToken}");
|
WebRequest.AddHeader("Authorization", $"Bearer {API.AccessToken}");
|
||||||
|
|
||||||
if (checkAndScheduleFailure())
|
if (checkAndScheduleFailure())
|
||||||
return;
|
return;
|
||||||
@ -85,7 +88,7 @@ namespace osu.Game.Online.API
|
|||||||
if (checkAndScheduleFailure())
|
if (checkAndScheduleFailure())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
api.Schedule(delegate { Success?.Invoke(); });
|
API.Schedule(delegate { Success?.Invoke(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled"));
|
public void Cancel() => Fail(new OperationCanceledException(@"Request cancelled"));
|
||||||
|
@ -11,14 +11,16 @@ namespace osu.Game.Online.API
|
|||||||
public Bindable<User> LocalUser { get; } = new Bindable<User>(new User
|
public Bindable<User> LocalUser { get; } = new Bindable<User>(new User
|
||||||
{
|
{
|
||||||
Username = @"Dummy",
|
Username = @"Dummy",
|
||||||
Id = 1,
|
Id = 1001,
|
||||||
});
|
});
|
||||||
|
|
||||||
public bool IsLoggedIn => true;
|
public bool IsLoggedIn => true;
|
||||||
|
|
||||||
public void Update()
|
public string ProvidedUsername => LocalUser.Value.Username;
|
||||||
{
|
|
||||||
}
|
public string Endpoint => "http://localhost";
|
||||||
|
|
||||||
|
public APIState State => LocalUser.Value.Id == 1 ? APIState.Offline : APIState.Online;
|
||||||
|
|
||||||
public virtual void Queue(APIRequest request)
|
public virtual void Queue(APIRequest request)
|
||||||
{
|
{
|
||||||
@ -26,6 +28,28 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
public void Register(IOnlineComponent component)
|
public void Register(IOnlineComponent component)
|
||||||
{
|
{
|
||||||
|
// todo: add support
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Unregister(IOnlineComponent component)
|
||||||
|
{
|
||||||
|
// todo: add support
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Login(string username, string password)
|
||||||
|
{
|
||||||
|
LocalUser.Value = new User
|
||||||
|
{
|
||||||
|
Username = @"Dummy",
|
||||||
|
Id = 1001,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Logout()
|
||||||
|
{
|
||||||
|
LocalUser.Value = new GuestUser();
|
||||||
|
}
|
||||||
|
|
||||||
|
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password) => null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,6 +18,19 @@ namespace osu.Game.Online.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
bool IsLoggedIn { get; }
|
bool IsLoggedIn { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The last username provided by the end-user.
|
||||||
|
/// May not be authenticated.
|
||||||
|
/// </summary>
|
||||||
|
string ProvidedUsername { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The URL endpoint for this API. Does not include a trailing slash.
|
||||||
|
/// </summary>
|
||||||
|
string Endpoint { get; }
|
||||||
|
|
||||||
|
APIState State { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Queue a new request.
|
/// Queue a new request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -29,5 +42,32 @@ namespace osu.Game.Online.API
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="component">The component to register.</param>
|
/// <param name="component">The component to register.</param>
|
||||||
void Register(IOnlineComponent component);
|
void Register(IOnlineComponent component);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Unregisters a component to receive state changes.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="component">The component to unregister.</param>
|
||||||
|
void Unregister(IOnlineComponent component);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attempt to login using the provided credentials. This is a non-blocking operation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="username">The user's username.</param>
|
||||||
|
/// <param name="password">The user's password.</param>
|
||||||
|
void Login(string username, string password);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Log out the current user.
|
||||||
|
/// </summary>
|
||||||
|
void Logout();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a new user account. This is a blocking operation.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="email">The email to create the account with.</param>
|
||||||
|
/// <param name="username">The username to create the account with.</param>
|
||||||
|
/// <param name="password">The password to create the account with.</param>
|
||||||
|
/// <returns>Any errors encoutnered during account creation.</returns>
|
||||||
|
RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,6 @@ namespace osu.Game.Online.API
|
|||||||
{
|
{
|
||||||
public interface IOnlineComponent
|
public interface IOnlineComponent
|
||||||
{
|
{
|
||||||
void APIStateChanged(APIAccess api, APIState state);
|
void APIStateChanged(IAPIProvider api, APIState state);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,12 +174,12 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
private ScheduledDelegate pendingUpdateScores;
|
private ScheduledDelegate pendingUpdateScores;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
api?.Register(this);
|
api?.Register(this);
|
||||||
@ -195,7 +195,7 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
private APIRequest getScoresRequest;
|
private APIRequest getScoresRequest;
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
if (state == APIState.Online)
|
if (state == APIState.Online)
|
||||||
UpdateScores();
|
UpdateScores();
|
||||||
|
@ -64,6 +64,8 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
|
|
||||||
statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList();
|
statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList();
|
||||||
|
|
||||||
|
Avatar innerAvatar;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -109,12 +111,11 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
avatar = new DelayedLoadWrapper(
|
avatar = new DelayedLoadWrapper(
|
||||||
new Avatar(user)
|
innerAvatar = new Avatar(user)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
CornerRadius = corner_radius,
|
CornerRadius = corner_radius,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(200),
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
@ -214,6 +215,8 @@ namespace osu.Game.Online.Leaderboards
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Show()
|
public override void Show()
|
||||||
|
@ -152,7 +152,6 @@ namespace osu.Game
|
|||||||
|
|
||||||
API = new APIAccess(LocalConfig);
|
API = new APIAccess(LocalConfig);
|
||||||
|
|
||||||
dependencies.Cache(API);
|
|
||||||
dependencies.CacheAs<IAPIProvider>(API);
|
dependencies.CacheAs<IAPIProvider>(API);
|
||||||
|
|
||||||
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
var defaultBeatmap = new DummyWorkingBeatmap(this);
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
private OsuTextBox emailTextBox;
|
private OsuTextBox emailTextBox;
|
||||||
private OsuPasswordTextBox passwordTextBox;
|
private OsuPasswordTextBox passwordTextBox;
|
||||||
|
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
private ShakeContainer registerShake;
|
private ShakeContainer registerShake;
|
||||||
private IEnumerable<Drawable> characterCheckText;
|
private IEnumerable<Drawable> characterCheckText;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
private GameHost host;
|
private GameHost host;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, APIAccess api, GameHost host)
|
private void load(OsuColour colours, IAPIProvider api, GameHost host)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.host = host;
|
this.host = host;
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
{
|
{
|
||||||
private OsuTextFlowContainer multiAccountExplanationText;
|
private OsuTextFlowContainer multiAccountExplanationText;
|
||||||
private LinkFlowContainer furtherAssistance;
|
private LinkFlowContainer furtherAssistance;
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
private const string help_centre_url = "/help/wiki/Help_Centre#login";
|
private const string help_centre_url = "/help/wiki/Help_Centre#login";
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.AccountCreation
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, APIAccess api, OsuGame game, TextureStore textures)
|
private void load(OsuColour colours, IAPIProvider api, OsuGame game, TextureStore textures)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, APIAccess api)
|
private void load(OsuColour colours, IAPIProvider api)
|
||||||
{
|
{
|
||||||
api.Register(this);
|
api.Register(this);
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ namespace osu.Game.Overlays
|
|||||||
this.FadeOut(100);
|
this.FadeOut(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api, BeatmapManager beatmaps)
|
private void load(IAPIProvider api, BeatmapManager beatmaps)
|
||||||
{
|
{
|
||||||
FillFlowContainer textSprites;
|
FillFlowContainer textSprites;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
|
|
||||||
private GetScoresRequest getScoresRequest;
|
private GetScoresRequest getScoresRequest;
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
public BeatmapInfo Beatmap
|
public BeatmapInfo Beatmap
|
||||||
{
|
{
|
||||||
@ -129,7 +129,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private readonly Header header;
|
private readonly Header header;
|
||||||
|
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly ScrollContainer scroll;
|
private readonly ScrollContainer scroll;
|
||||||
@ -101,7 +101,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api, RulesetStore rulesets)
|
private void load(IAPIProvider api, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
if (value.Type != ChannelType.PM)
|
if (value.Type != ChannelType.PM)
|
||||||
throw new ArgumentException("Argument value needs to have the targettype user!");
|
throw new ArgumentException("Argument value needs to have the targettype user!");
|
||||||
|
|
||||||
|
Avatar avatar;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -49,11 +51,10 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Child = new DelayedLoadWrapper(new Avatar(value.Users.First())
|
Child = new DelayedLoadWrapper(avatar = new Avatar(value.Users.First())
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OpenOnClick = { Value = false },
|
OpenOnClick = { Value = false },
|
||||||
OnLoadComplete = d => d.FadeInFromZero(300, Easing.OutQuint),
|
|
||||||
})
|
})
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -63,6 +64,8 @@ namespace osu.Game.Overlays.Chat.Tabs
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
|
||||||
|
|
||||||
Text.X = ChatOverlay.TAB_AREA_HEIGHT;
|
Text.X = ChatOverlay.TAB_AREA_HEIGHT;
|
||||||
TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
|
TextBold.X = ChatOverlay.TAB_AREA_HEIGHT;
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
private const float panel_padding = 10f;
|
private const float panel_padding = 10f;
|
||||||
|
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly FillFlowContainer resultCountsContainer;
|
private readonly FillFlowContainer resultCountsContainer;
|
||||||
@ -164,7 +164,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, APIAccess api, RulesetStore rulesets, PreviewTrackManager previewTrackManager)
|
private void load(OsuColour colours, IAPIProvider api, RulesetStore rulesets, PreviewTrackManager previewTrackManager)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
s.Font = s.Font.With(size: 16);
|
s.Font = s.Font.With(size: 16);
|
||||||
});
|
});
|
||||||
|
|
||||||
medalContainer.OnLoadComplete = d =>
|
medalContainer.OnLoadComplete += d =>
|
||||||
{
|
{
|
||||||
unlocked.Position = new Vector2(0f, medalContainer.DrawSize.Y / 2 + 10);
|
unlocked.Position = new Vector2(0f, medalContainer.DrawSize.Y / 2 + 10);
|
||||||
infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90);
|
infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90);
|
||||||
|
@ -335,9 +335,12 @@ namespace osu.Game.Overlays.Profile
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(200),
|
|
||||||
Depth = float.MaxValue,
|
Depth = float.MaxValue,
|
||||||
}, coverContainer.Add);
|
}, background =>
|
||||||
|
{
|
||||||
|
coverContainer.Add(background);
|
||||||
|
background.FadeInFromZero(200);
|
||||||
|
});
|
||||||
|
|
||||||
if (user.IsSupporter)
|
if (user.IsSupporter)
|
||||||
SupporterTag.Show();
|
SupporterTag.Show();
|
||||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
protected readonly Bindable<User> User = new Bindable<User>();
|
protected readonly Bindable<User> User = new Bindable<User>();
|
||||||
|
|
||||||
protected APIAccess Api;
|
protected IAPIProvider Api;
|
||||||
protected APIRequest RetrievalRequest;
|
protected APIRequest RetrievalRequest;
|
||||||
protected RulesetStore Rulesets;
|
protected RulesetStore Rulesets;
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api, RulesetStore rulesets)
|
private void load(IAPIProvider api, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
Api = api;
|
Api = api;
|
||||||
Rulesets = rulesets;
|
Rulesets = rulesets;
|
||||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
{
|
{
|
||||||
public class DrawableRecentActivity : DrawableProfileRow
|
public class DrawableRecentActivity : DrawableProfileRow
|
||||||
{
|
{
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
private readonly APIRecentActivity activity;
|
private readonly APIRecentActivity activity;
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
|
@ -58,14 +58,14 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(OsuColour colours, APIAccess api)
|
private void load(OsuColour colours, IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.colours = colours;
|
this.colours = colours;
|
||||||
|
|
||||||
api?.Register(this);
|
api?.Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
form = null;
|
form = null;
|
||||||
|
|
||||||
@ -194,7 +194,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
{
|
{
|
||||||
private TextBox username;
|
private TextBox username;
|
||||||
private TextBox password;
|
private TextBox password;
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
public Action RequestHide;
|
public Action RequestHide;
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader(permitNulls: true)]
|
[BackgroundDependencyLoader(permitNulls: true)]
|
||||||
private void load(APIAccess api, OsuConfigManager config, AccountCreationOverlay accountCreation)
|
private void load(IAPIProvider api, OsuConfigManager config, AccountCreationOverlay accountCreation)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
Direction = FillDirection.Vertical;
|
Direction = FillDirection.Vertical;
|
||||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>, IOnlineComponent
|
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>, IOnlineComponent
|
||||||
{
|
{
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
private readonly LoadingAnimation loading;
|
private readonly LoadingAnimation loading;
|
||||||
private FillFlowContainer<SocialPanel> panels;
|
private FillFlowContainer<SocialPanel> panels;
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
api.Register(this);
|
api.Register(this);
|
||||||
@ -193,7 +193,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -43,12 +43,12 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
api.Register(this);
|
api.Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Overlays
|
|||||||
private ProfileSection lastSection;
|
private ProfileSection lastSection;
|
||||||
private ProfileSection[] sections;
|
private ProfileSection[] sections;
|
||||||
private GetUserRequest userReq;
|
private GetUserRequest userReq;
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
protected ProfileHeader Header;
|
protected ProfileHeader Header;
|
||||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
private SectionsContainer<ProfileSection> sectionsContainer;
|
||||||
private ProfileTabControl tabs;
|
private ProfileTabControl tabs;
|
||||||
@ -56,7 +56,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,12 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
protected Container JudgementBody;
|
protected Container JudgementBody;
|
||||||
protected SpriteText JudgementText;
|
protected SpriteText JudgementText;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Duration of initial fade in.
|
||||||
|
/// Default fade out will start immediately after this duration.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual double FadeInDuration => 100;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
/// Creates a drawable which visualises a <see cref="Judgements.Judgement"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -65,11 +71,19 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void ApplyHitAnimations()
|
||||||
|
{
|
||||||
|
JudgementBody.ScaleTo(0.9f);
|
||||||
|
JudgementBody.ScaleTo(1, 500, Easing.OutElastic);
|
||||||
|
|
||||||
|
this.Delay(FadeInDuration).FadeOut(400);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
this.FadeInFromZero(100, Easing.OutQuint);
|
this.FadeInFromZero(FadeInDuration, Easing.OutQuint);
|
||||||
|
|
||||||
switch (Result.Type)
|
switch (Result.Type)
|
||||||
{
|
{
|
||||||
@ -85,10 +99,7 @@ namespace osu.Game.Rulesets.Judgements
|
|||||||
this.Delay(600).FadeOut(200);
|
this.Delay(600).FadeOut(200);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
JudgementBody.ScaleTo(0.9f);
|
ApplyHitAnimations();
|
||||||
JudgementBody.ScaleTo(1, 500, Easing.OutElastic);
|
|
||||||
|
|
||||||
this.Delay(100).FadeOut(400);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override void ApplyToClock(IAdjustableClock clock)
|
public override void ApplyToClock(IAdjustableClock clock)
|
||||||
{
|
{
|
||||||
if (clock is IHasPitchAdjust pitchAdjust)
|
if (clock is IHasPitchAdjust pitchAdjust)
|
||||||
pitchAdjust.PitchAdjust = 0.75;
|
pitchAdjust.PitchAdjust *= RateAdjust;
|
||||||
else
|
else
|
||||||
base.ApplyToClock(clock);
|
base.ApplyToClock(clock);
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Timing;
|
using System.Linq;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModDoubleTime : Mod, IApplicableToClock
|
public abstract class ModDoubleTime : ModTimeAdjust, IApplicableToClock
|
||||||
{
|
{
|
||||||
public override string Name => "Double Time";
|
public override string Name => "Double Time";
|
||||||
public override string Acronym => "DT";
|
public override string Acronym => "DT";
|
||||||
@ -15,11 +15,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override ModType Type => ModType.DifficultyIncrease;
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Zoooooooooom...";
|
public override string Description => "Zoooooooooom...";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime), typeof(ModTimeRamp) };
|
|
||||||
|
|
||||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModHalfTime)).ToArray();
|
||||||
{
|
|
||||||
clock.Rate = 1.5;
|
protected override double RateAdjust => 1.5;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Timing;
|
using System.Linq;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModHalfTime : Mod, IApplicableToClock
|
public abstract class ModHalfTime : ModTimeAdjust, IApplicableToClock
|
||||||
{
|
{
|
||||||
public override string Name => "Half Time";
|
public override string Name => "Half Time";
|
||||||
public override string Acronym => "HT";
|
public override string Acronym => "HT";
|
||||||
@ -15,11 +15,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override ModType Type => ModType.DifficultyReduction;
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "Less zoom...";
|
public override string Description => "Less zoom...";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModTimeRamp) };
|
|
||||||
|
|
||||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModDoubleTime)).ToArray();
|
||||||
{
|
|
||||||
clock.Rate = 0.75;
|
protected override double RateAdjust => 0.75;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override void ApplyToClock(IAdjustableClock clock)
|
public override void ApplyToClock(IAdjustableClock clock)
|
||||||
{
|
{
|
||||||
if (clock is IHasPitchAdjust pitchAdjust)
|
if (clock is IHasPitchAdjust pitchAdjust)
|
||||||
pitchAdjust.PitchAdjust = 1.5;
|
pitchAdjust.PitchAdjust *= RateAdjust;
|
||||||
else
|
else
|
||||||
base.ApplyToClock(clock);
|
base.ApplyToClock(clock);
|
||||||
}
|
}
|
||||||
|
24
osu.Game/Rulesets/Mods/ModTimeAdjust.cs
Normal file
24
osu.Game/Rulesets/Mods/ModTimeAdjust.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 System;
|
||||||
|
using osu.Framework.Audio;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
public abstract class ModTimeAdjust : Mod
|
||||||
|
{
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(ModTimeRamp) };
|
||||||
|
|
||||||
|
protected abstract double RateAdjust { get; }
|
||||||
|
|
||||||
|
public virtual void ApplyToClock(IAdjustableClock clock)
|
||||||
|
{
|
||||||
|
if (clock is IHasTempoAdjust tempo)
|
||||||
|
tempo.TempoAdjust *= RateAdjust;
|
||||||
|
else
|
||||||
|
clock.Rate *= RateAdjust;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public abstract class ModTimeRamp : Mod
|
public abstract class ModTimeRamp : Mod
|
||||||
{
|
{
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModHalfTime) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModTimeAdjust) };
|
||||||
|
|
||||||
protected abstract double FinalRateAdjustment { get; }
|
protected abstract double FinalRateAdjustment { get; }
|
||||||
}
|
}
|
||||||
@ -29,8 +29,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
private IAdjustableClock clock;
|
private IAdjustableClock clock;
|
||||||
|
|
||||||
private IHasPitchAdjust pitchAdjust;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The point in the beatmap at which the final ramping rate should be reached.
|
/// The point in the beatmap at which the final ramping rate should be reached.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -39,10 +37,11 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public virtual void ApplyToClock(IAdjustableClock clock)
|
public virtual void ApplyToClock(IAdjustableClock clock)
|
||||||
{
|
{
|
||||||
this.clock = clock;
|
this.clock = clock;
|
||||||
pitchAdjust = (IHasPitchAdjust)clock;
|
|
||||||
|
|
||||||
// for preview purposes
|
lastAdjust = 1;
|
||||||
pitchAdjust.PitchAdjust = 1.0 + FinalRateAdjustment;
|
|
||||||
|
// for preview purposes. during gameplay, Update will overwrite this setting.
|
||||||
|
applyAdjustment(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void ApplyToBeatmap(Beatmap<T> beatmap)
|
public virtual void ApplyToBeatmap(Beatmap<T> beatmap)
|
||||||
@ -55,10 +54,36 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public virtual void Update(Playfield playfield)
|
public virtual void Update(Playfield playfield)
|
||||||
{
|
{
|
||||||
var absRate = Math.Abs(FinalRateAdjustment);
|
applyAdjustment((clock.CurrentTime - beginRampTime) / finalRateTime);
|
||||||
var adjustment = MathHelper.Clamp(absRate * ((clock.CurrentTime - beginRampTime) / finalRateTime), 0, absRate);
|
}
|
||||||
|
|
||||||
pitchAdjust.PitchAdjust = 1 + Math.Sign(FinalRateAdjustment) * adjustment;
|
private double lastAdjust = 1;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adjust the rate along the specified ramp
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="amount">The amount of adjustment to apply (from 0..1).</param>
|
||||||
|
private void applyAdjustment(double amount)
|
||||||
|
{
|
||||||
|
double adjust = 1 + (Math.Sign(FinalRateAdjustment) * MathHelper.Clamp(amount, 0, 1) * Math.Abs(FinalRateAdjustment));
|
||||||
|
|
||||||
|
switch (clock)
|
||||||
|
{
|
||||||
|
case IHasPitchAdjust pitch:
|
||||||
|
pitch.PitchAdjust /= lastAdjust;
|
||||||
|
pitch.PitchAdjust *= adjust;
|
||||||
|
break;
|
||||||
|
case IHasTempoAdjust tempo:
|
||||||
|
tempo.TempoAdjust /= lastAdjust;
|
||||||
|
tempo.TempoAdjust *= adjust;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
clock.Rate /= lastAdjust;
|
||||||
|
clock.Rate *= adjust;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
lastAdjust = adjust;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
@ -14,6 +16,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override string Description => "Sloooow doooown...";
|
public override string Description => "Sloooow doooown...";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_down;
|
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_down;
|
||||||
public override double ScoreMultiplier => 1.0;
|
public override double ScoreMultiplier => 1.0;
|
||||||
|
|
||||||
protected override double FinalRateAdjustment => -0.25;
|
protected override double FinalRateAdjustment => -0.25;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp<T>)).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
|
|
||||||
@ -14,6 +16,9 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override string Description => "Can you keep up?";
|
public override string Description => "Can you keep up?";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_up;
|
public override FontAwesome Icon => FontAwesome.fa_chevron_circle_up;
|
||||||
public override double ScoreMultiplier => 1.0;
|
public override double ScoreMultiplier => 1.0;
|
||||||
|
|
||||||
protected override double FinalRateAdjustment => 0.5;
|
protected override double FinalRateAdjustment => 0.5;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindDown<T>)).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,6 @@ using osuTK;
|
|||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using osu.Game.Beatmaps.Formats;
|
using osu.Game.Beatmaps.Formats;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
@ -46,9 +45,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
{
|
{
|
||||||
string[] split = text.Split(',');
|
string[] split = text.Split(',');
|
||||||
|
|
||||||
Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture));
|
Vector2 pos = new Vector2((int)Parsing.ParseFloat(split[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseFloat(split[1], Parsing.MAX_COORDINATE_VALUE));
|
||||||
|
|
||||||
ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]);
|
double startTime = Parsing.ParseDouble(split[2]) + Offset;
|
||||||
|
|
||||||
|
ConvertHitObjectType type = (ConvertHitObjectType)Parsing.ParseInt(split[3]);
|
||||||
|
|
||||||
int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
|
int comboOffset = (int)(type & ConvertHitObjectType.ComboOffset) >> 4;
|
||||||
type &= ~ConvertHitObjectType.ComboOffset;
|
type &= ~ConvertHitObjectType.ComboOffset;
|
||||||
@ -56,7 +57,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
bool combo = type.HasFlag(ConvertHitObjectType.NewCombo);
|
||||||
type &= ~ConvertHitObjectType.NewCombo;
|
type &= ~ConvertHitObjectType.NewCombo;
|
||||||
|
|
||||||
var soundType = (LegacySoundType)int.Parse(split[4]);
|
var soundType = (LegacySoundType)Parsing.ParseInt(split[4]);
|
||||||
var bankInfo = new SampleBankInfo();
|
var bankInfo = new SampleBankInfo();
|
||||||
|
|
||||||
HitObject result = null;
|
HitObject result = null;
|
||||||
@ -107,7 +108,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
}
|
}
|
||||||
|
|
||||||
string[] temp = t.Split(':');
|
string[] temp = t.Split(':');
|
||||||
points[pointIndex++] = new Vector2((int)Convert.ToDouble(temp[0], CultureInfo.InvariantCulture), (int)Convert.ToDouble(temp[1], CultureInfo.InvariantCulture)) - pos;
|
points[pointIndex++] = new Vector2((int)Parsing.ParseDouble(temp[0], Parsing.MAX_COORDINATE_VALUE), (int)Parsing.ParseDouble(temp[1], Parsing.MAX_COORDINATE_VALUE)) - pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
// osu-stable special-cased colinear perfect curves to a CurveType.Linear
|
// osu-stable special-cased colinear perfect curves to a CurveType.Linear
|
||||||
@ -116,7 +117,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points))
|
if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points))
|
||||||
pathType = PathType.Linear;
|
pathType = PathType.Linear;
|
||||||
|
|
||||||
int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
|
int repeatCount = Parsing.ParseInt(split[6]);
|
||||||
|
|
||||||
if (repeatCount > 9000)
|
if (repeatCount > 9000)
|
||||||
throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
|
throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
|
||||||
@ -125,7 +126,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
repeatCount = Math.Max(0, repeatCount - 1);
|
repeatCount = Math.Max(0, repeatCount - 1);
|
||||||
|
|
||||||
if (split.Length > 7)
|
if (split.Length > 7)
|
||||||
length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture);
|
length = Math.Max(0, Parsing.ParseDouble(split[7]));
|
||||||
|
|
||||||
if (split.Length > 10)
|
if (split.Length > 10)
|
||||||
readCustomSampleBanks(split[10], bankInfo);
|
readCustomSampleBanks(split[10], bankInfo);
|
||||||
@ -184,7 +185,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
}
|
}
|
||||||
else if (type.HasFlag(ConvertHitObjectType.Spinner))
|
else if (type.HasFlag(ConvertHitObjectType.Spinner))
|
||||||
{
|
{
|
||||||
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + Offset);
|
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[5]) + Offset);
|
||||||
|
|
||||||
|
result = CreateSpinner(new Vector2(512, 384) / 2, combo, comboOffset, endTime);
|
||||||
|
|
||||||
if (split.Length > 6)
|
if (split.Length > 6)
|
||||||
readCustomSampleBanks(split[6], bankInfo);
|
readCustomSampleBanks(split[6], bankInfo);
|
||||||
@ -193,12 +196,12 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
{
|
{
|
||||||
// Note: Hold is generated by BMS converts
|
// Note: Hold is generated by BMS converts
|
||||||
|
|
||||||
double endTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture);
|
double endTime = Math.Max(startTime, Parsing.ParseDouble(split[2]));
|
||||||
|
|
||||||
if (split.Length > 5 && !string.IsNullOrEmpty(split[5]))
|
if (split.Length > 5 && !string.IsNullOrEmpty(split[5]))
|
||||||
{
|
{
|
||||||
string[] ss = split[5].Split(':');
|
string[] ss = split[5].Split(':');
|
||||||
endTime = Convert.ToDouble(ss[0], CultureInfo.InvariantCulture);
|
endTime = Math.Max(startTime, Parsing.ParseDouble(ss[0]));
|
||||||
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -211,7 +214,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
result.StartTime = Convert.ToDouble(split[2], CultureInfo.InvariantCulture) + Offset;
|
result.StartTime = startTime;
|
||||||
|
|
||||||
if (result.Samples.Count == 0)
|
if (result.Samples.Count == 0)
|
||||||
result.Samples = convertSoundType(soundType, bankInfo);
|
result.Samples = convertSoundType(soundType, bankInfo);
|
||||||
@ -222,8 +225,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
}
|
}
|
||||||
catch (FormatException)
|
catch (FormatException)
|
||||||
{
|
{
|
||||||
throw new FormatException("One or more hit objects were malformed.");
|
Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
}
|
}
|
||||||
|
catch (OverflowException)
|
||||||
|
{
|
||||||
|
Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
|
private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
|
||||||
@ -233,8 +242,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
|
|
||||||
string[] split = str.Split(':');
|
string[] split = str.Split(':');
|
||||||
|
|
||||||
var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]);
|
var bank = (LegacyBeatmapDecoder.LegacySampleBank)Parsing.ParseInt(split[0]);
|
||||||
var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]);
|
var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Parsing.ParseInt(split[1]);
|
||||||
|
|
||||||
string stringBank = bank.ToString().ToLowerInvariant();
|
string stringBank = bank.ToString().ToLowerInvariant();
|
||||||
if (stringBank == @"none")
|
if (stringBank == @"none")
|
||||||
@ -247,10 +256,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
|||||||
bankInfo.Add = string.IsNullOrEmpty(stringAddBank) ? stringBank : stringAddBank;
|
bankInfo.Add = string.IsNullOrEmpty(stringAddBank) ? stringBank : stringAddBank;
|
||||||
|
|
||||||
if (split.Length > 2)
|
if (split.Length > 2)
|
||||||
bankInfo.CustomSampleBank = int.Parse(split[2]);
|
bankInfo.CustomSampleBank = Parsing.ParseInt(split[2]);
|
||||||
|
|
||||||
if (split.Length > 3)
|
if (split.Length > 3)
|
||||||
bankInfo.Volume = int.Parse(split[3]);
|
bankInfo.Volume = Math.Max(0, Parsing.ParseInt(split[3]));
|
||||||
|
|
||||||
bankInfo.Filename = split.Length > 4 ? split[4] : null;
|
bankInfo.Filename = split.Length > 4 ? split[4] : null;
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects
|
|||||||
|
|
||||||
for (var d = tickDistance; d <= length; d += tickDistance)
|
for (var d = tickDistance; d <= length; d += tickDistance)
|
||||||
{
|
{
|
||||||
if (d > length - minDistanceFromEnd)
|
if (d >= length - minDistanceFromEnd)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
var pathProgress = d / length;
|
var pathProgress = d / length;
|
||||||
|
153
osu.Game/Rulesets/UI/FrameStabilityContainer.cs
Normal file
153
osu.Game/Rulesets/UI/FrameStabilityContainer.cs
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Input.Handlers;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.UI
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A container which consumes a parent gameplay clock and standardises frame counts for children.
|
||||||
|
/// Will ensure a minimum of 40 frames per clock second is maintained, regardless of any system lag or seeks.
|
||||||
|
/// </summary>
|
||||||
|
public class FrameStabilityContainer : Container, IHasReplayHandler
|
||||||
|
{
|
||||||
|
public FrameStabilityContainer()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly ManualClock manualClock;
|
||||||
|
|
||||||
|
private readonly FramedClock framedClock;
|
||||||
|
|
||||||
|
[Cached]
|
||||||
|
private GameplayClock gameplayClock;
|
||||||
|
|
||||||
|
private IFrameBasedClock parentGameplayClock;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(GameplayClock clock)
|
||||||
|
{
|
||||||
|
if (clock != null)
|
||||||
|
parentGameplayClock = clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
setClock();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether we are running up-to-date with our parent clock.
|
||||||
|
/// If not, we will need to keep processing children until we catch up.
|
||||||
|
/// </summary>
|
||||||
|
private bool requireMoreUpdateLoops;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether we are in a valid state (ie. should we keep processing children frames).
|
||||||
|
/// This should be set to false when the replay is, for instance, waiting for future frames to arrive.
|
||||||
|
/// </summary>
|
||||||
|
private bool validState;
|
||||||
|
|
||||||
|
protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate && validState;
|
||||||
|
|
||||||
|
private bool isAttached => ReplayInputHandler != null;
|
||||||
|
|
||||||
|
private const int max_catch_up_updates_per_frame = 50;
|
||||||
|
|
||||||
|
private const double sixty_frame_time = 1000.0 / 60;
|
||||||
|
|
||||||
|
public override bool UpdateSubTree()
|
||||||
|
{
|
||||||
|
requireMoreUpdateLoops = true;
|
||||||
|
validState = true;
|
||||||
|
|
||||||
|
int loops = 0;
|
||||||
|
|
||||||
|
while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame)
|
||||||
|
{
|
||||||
|
updateClock();
|
||||||
|
|
||||||
|
if (validState)
|
||||||
|
{
|
||||||
|
base.UpdateSubTree();
|
||||||
|
UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateClock()
|
||||||
|
{
|
||||||
|
if (parentGameplayClock == null)
|
||||||
|
setClock(); // LoadComplete may not be run yet, but we still want the clock.
|
||||||
|
|
||||||
|
validState = true;
|
||||||
|
|
||||||
|
manualClock.Rate = parentGameplayClock.Rate;
|
||||||
|
manualClock.IsRunning = parentGameplayClock.IsRunning;
|
||||||
|
|
||||||
|
var newProposedTime = parentGameplayClock.CurrentTime;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
|
||||||
|
{
|
||||||
|
newProposedTime = manualClock.Rate > 0
|
||||||
|
? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)
|
||||||
|
: Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isAttached)
|
||||||
|
{
|
||||||
|
manualClock.CurrentTime = newProposedTime;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
double? newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime);
|
||||||
|
|
||||||
|
if (newTime == null)
|
||||||
|
{
|
||||||
|
// we shouldn't execute for this time value. probably waiting on more replay data.
|
||||||
|
validState = false;
|
||||||
|
|
||||||
|
requireMoreUpdateLoops = true;
|
||||||
|
manualClock.CurrentTime = newProposedTime;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
manualClock.CurrentTime = newTime.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
requireMoreUpdateLoops = manualClock.CurrentTime != parentGameplayClock.CurrentTime;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
// The manual clock time has changed in the above code. The framed clock now needs to be updated
|
||||||
|
// to ensure that the its time is valid for our children before input is processed
|
||||||
|
framedClock.ProcessFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setClock()
|
||||||
|
{
|
||||||
|
// in case a parent gameplay clock isn't available, just use the parent clock.
|
||||||
|
if (parentGameplayClock == null)
|
||||||
|
parentGameplayClock = Clock;
|
||||||
|
|
||||||
|
Clock = gameplayClock;
|
||||||
|
ProcessCustomClock = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReplayInputHandler ReplayInputHandler { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -132,6 +132,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null;
|
protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null;
|
||||||
|
|
||||||
|
protected FrameStabilityContainer FrameStabilityContainer;
|
||||||
|
|
||||||
public Score ReplayScore { get; private set; }
|
public Score ReplayScore { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -149,7 +151,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available");
|
throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available");
|
||||||
|
|
||||||
ReplayScore = replayScore;
|
ReplayScore = replayScore;
|
||||||
ReplayInputManager.ReplayInputHandler = replayScore != null ? CreateReplayInputHandler(replayScore.Replay) : null;
|
|
||||||
|
var handler = replayScore != null ? CreateReplayInputHandler(replayScore.Replay) : null;
|
||||||
|
|
||||||
|
ReplayInputManager.ReplayInputHandler = handler;
|
||||||
|
FrameStabilityContainer.ReplayInputHandler = handler;
|
||||||
|
|
||||||
HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null;
|
HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null;
|
||||||
}
|
}
|
||||||
@ -243,7 +249,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
Beatmap = (Beatmap<TObject>)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
||||||
|
|
||||||
KeyBindingInputManager = CreateInputManager();
|
KeyBindingInputManager = CreateInputManager();
|
||||||
KeyBindingInputManager.RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
applyBeatmapMods(Mods);
|
applyBeatmapMods(Mods);
|
||||||
}
|
}
|
||||||
@ -262,7 +267,10 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
KeyBindingInputManager,
|
FrameStabilityContainer = new FrameStabilityContainer
|
||||||
|
{
|
||||||
|
Child = KeyBindingInputManager,
|
||||||
|
},
|
||||||
Overlays = new Container { RelativeSizeAxes = Axes.Both }
|
Overlays = new Container { RelativeSizeAxes = Axes.Both }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
@ -12,7 +11,6 @@ using osu.Framework.Input.Bindings;
|
|||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Input.StateChanges.Events;
|
using osu.Framework.Input.StateChanges.Events;
|
||||||
using osu.Framework.Input.States;
|
using osu.Framework.Input.States;
|
||||||
using osu.Framework.Timing;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Input.Handlers;
|
using osu.Game.Input.Handlers;
|
||||||
@ -41,7 +39,12 @@ namespace osu.Game.Rulesets.UI
|
|||||||
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
protected RulesetInputManager(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||||
{
|
{
|
||||||
InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique);
|
InternalChild = KeyBindingContainer = CreateKeyBindingContainer(ruleset, variant, unique);
|
||||||
gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuConfigManager config)
|
||||||
|
{
|
||||||
|
mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Action mapping (for replays)
|
#region Action mapping (for replays)
|
||||||
@ -85,137 +88,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Clock control
|
|
||||||
|
|
||||||
private readonly ManualClock manualClock;
|
|
||||||
|
|
||||||
private readonly FramedClock framedClock;
|
|
||||||
|
|
||||||
[Cached]
|
|
||||||
private GameplayClock gameplayClock;
|
|
||||||
|
|
||||||
private IFrameBasedClock parentGameplayClock;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
|
||||||
private void load(OsuConfigManager config, GameplayClock clock)
|
|
||||||
{
|
|
||||||
mouseDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableButtons);
|
|
||||||
|
|
||||||
if (clock != null)
|
|
||||||
parentGameplayClock = clock;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
setClock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether we are running up-to-date with our parent clock.
|
|
||||||
/// If not, we will need to keep processing children until we catch up.
|
|
||||||
/// </summary>
|
|
||||||
private bool requireMoreUpdateLoops;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether we are in a valid state (ie. should we keep processing children frames).
|
|
||||||
/// This should be set to false when the replay is, for instance, waiting for future frames to arrive.
|
|
||||||
/// </summary>
|
|
||||||
private bool validState;
|
|
||||||
|
|
||||||
protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate && validState;
|
|
||||||
|
|
||||||
private bool isAttached => replayInputHandler != null && !UseParentInput;
|
|
||||||
|
|
||||||
private const int max_catch_up_updates_per_frame = 50;
|
|
||||||
|
|
||||||
private const double sixty_frame_time = 1000.0 / 60;
|
|
||||||
|
|
||||||
public override bool UpdateSubTree()
|
|
||||||
{
|
|
||||||
requireMoreUpdateLoops = true;
|
|
||||||
validState = true;
|
|
||||||
|
|
||||||
int loops = 0;
|
|
||||||
|
|
||||||
while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame)
|
|
||||||
{
|
|
||||||
updateClock();
|
|
||||||
|
|
||||||
if (validState)
|
|
||||||
{
|
|
||||||
base.UpdateSubTree();
|
|
||||||
UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateClock()
|
|
||||||
{
|
|
||||||
if (parentGameplayClock == null)
|
|
||||||
setClock(); // LoadComplete may not be run yet, but we still want the clock.
|
|
||||||
|
|
||||||
validState = true;
|
|
||||||
|
|
||||||
manualClock.Rate = parentGameplayClock.Rate;
|
|
||||||
manualClock.IsRunning = parentGameplayClock.IsRunning;
|
|
||||||
|
|
||||||
var newProposedTime = parentGameplayClock.CurrentTime;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
|
|
||||||
{
|
|
||||||
newProposedTime = manualClock.Rate > 0
|
|
||||||
? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)
|
|
||||||
: Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isAttached)
|
|
||||||
{
|
|
||||||
manualClock.CurrentTime = newProposedTime;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
double? newTime = replayInputHandler.SetFrameFromTime(newProposedTime);
|
|
||||||
|
|
||||||
if (newTime == null)
|
|
||||||
{
|
|
||||||
// we shouldn't execute for this time value. probably waiting on more replay data.
|
|
||||||
validState = false;
|
|
||||||
|
|
||||||
requireMoreUpdateLoops = true;
|
|
||||||
manualClock.CurrentTime = newProposedTime;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
manualClock.CurrentTime = newTime.Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
requireMoreUpdateLoops = manualClock.CurrentTime != parentGameplayClock.CurrentTime;
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
// The manual clock time has changed in the above code. The framed clock now needs to be updated
|
|
||||||
// to ensure that the its time is valid for our children before input is processed
|
|
||||||
framedClock.ProcessFrame();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setClock()
|
|
||||||
{
|
|
||||||
// in case a parent gameplay clock isn't available, just use the parent clock.
|
|
||||||
if (parentGameplayClock == null)
|
|
||||||
parentGameplayClock = Clock;
|
|
||||||
|
|
||||||
Clock = gameplayClock;
|
|
||||||
ProcessCustomClock = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Setting application (disables etc.)
|
#region Setting application (disables etc.)
|
||||||
|
|
||||||
private Bindable<bool> mouseDisabled;
|
private Bindable<bool> mouseDisabled;
|
||||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
private OsuGame game { get; set; }
|
private OsuGame game { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private NotificationOverlay notifications { get; set; }
|
private NotificationOverlay notifications { get; set; }
|
||||||
|
@ -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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -44,7 +44,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, APIAccess api)
|
private void load(OsuColour colours, IAPIProvider api)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -246,7 +246,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
private GetRoomScoresRequest request;
|
private GetRoomScoresRequest request;
|
||||||
|
|
||||||
|
@ -52,12 +52,18 @@ namespace osu.Game.Screens.Multi.Match.Components
|
|||||||
|
|
||||||
Participants.BindValueChanged(participants =>
|
Participants.BindValueChanged(participants =>
|
||||||
{
|
{
|
||||||
usersFlow.Children = participants.NewValue.Select(u => new UserPanel(u)
|
usersFlow.Children = participants.NewValue.Select(u =>
|
||||||
|
{
|
||||||
|
var panel = new UserPanel(u)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Width = 300,
|
Width = 300,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(60),
|
};
|
||||||
|
|
||||||
|
panel.OnLoadComplete += d => d.FadeInFromZero(60);
|
||||||
|
|
||||||
|
return panel;
|
||||||
}).ToList();
|
}).ToList();
|
||||||
}, true);
|
}, true);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
private OsuGameBase game { get; set; }
|
private OsuGameBase game { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private OsuLogo logo { get; set; }
|
private OsuLogo logo { get; set; }
|
||||||
@ -163,7 +163,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
this.Push(new PlayerLoader(player));
|
this.Push(new PlayerLoader(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(APIAccess api, APIState state)
|
public void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
if (state != APIState.Online)
|
if (state != APIState.Online)
|
||||||
forcefullyExit();
|
forcefullyExit();
|
||||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Multi.Play
|
|||||||
private readonly PlaylistItem playlistItem;
|
private readonly PlaylistItem playlistItem;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Multi
|
|||||||
private Bindable<FilterCriteria> currentFilter { get; set; }
|
private Bindable<FilterCriteria> currentFilter { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private RulesetStore rulesets { get; set; }
|
private RulesetStore rulesets { get; set; }
|
||||||
|
@ -6,6 +6,7 @@ using System.Linq;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -141,11 +142,15 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
if (sourceClock == null) return;
|
if (sourceClock == null) return;
|
||||||
|
|
||||||
sourceClock.Rate = 1;
|
sourceClock.ResetSpeedAdjustments();
|
||||||
|
|
||||||
|
if (sourceClock is IHasTempoAdjust tempo)
|
||||||
|
tempo.TempoAdjust = UserPlaybackRate.Value;
|
||||||
|
else
|
||||||
|
sourceClock.Rate = UserPlaybackRate.Value;
|
||||||
|
|
||||||
foreach (var mod in beatmap.Mods.Value.OfType<IApplicableToClock>())
|
foreach (var mod in beatmap.Mods.Value.OfType<IApplicableToClock>())
|
||||||
mod.ApplyToClock(sourceClock);
|
mod.ApplyToClock(sourceClock);
|
||||||
|
|
||||||
sourceClock.Rate *= UserPlaybackRate.Value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private RulesetInfo ruleset;
|
private RulesetInfo ruleset;
|
||||||
|
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
private SampleChannel sampleRestart;
|
private SampleChannel sampleRestart;
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ namespace osu.Game.Screens.Play
|
|||||||
private GameplayClockContainer gameplayClockContainer;
|
private GameplayClockContainer gameplayClockContainer;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
|
private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ namespace osu.Game.Screens.Select
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
float y = currentY;
|
float y = currentY;
|
||||||
d.OnLoadComplete = _ => performMove(y, setY);
|
d.OnLoadComplete += _ => performMove(y, setY);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Select
|
|||||||
private readonly FailRetryGraph failRetryGraph;
|
private readonly FailRetryGraph failRetryGraph;
|
||||||
private readonly DimmedLoadingAnimation loading;
|
private readonly DimmedLoadingAnimation loading;
|
||||||
|
|
||||||
private APIAccess api;
|
private IAPIProvider api;
|
||||||
|
|
||||||
private ScheduledDelegate pendingBeatmapSwitch;
|
private ScheduledDelegate pendingBeatmapSwitch;
|
||||||
|
|
||||||
@ -160,7 +160,7 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(APIAccess api)
|
private void load(IAPIProvider api)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
}
|
}
|
||||||
@ -175,21 +175,22 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private void updateStatistics()
|
private void updateStatistics()
|
||||||
{
|
{
|
||||||
if (Beatmap == null)
|
advanced.Beatmap = Beatmap;
|
||||||
|
description.Text = Beatmap?.Version;
|
||||||
|
source.Text = Beatmap?.Metadata?.Source;
|
||||||
|
tags.Text = Beatmap?.Metadata?.Tags;
|
||||||
|
|
||||||
|
// metrics may have been previously fetched
|
||||||
|
if (Beatmap?.Metrics != null)
|
||||||
{
|
{
|
||||||
clearStats();
|
updateMetrics(Beatmap.Metrics);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ratingsContainer.FadeIn(transition_duration);
|
// metrics may not be fetched but can be
|
||||||
advanced.Beatmap = Beatmap;
|
if (Beatmap?.OnlineBeatmapID != null)
|
||||||
description.Text = Beatmap.Version;
|
|
||||||
source.Text = Beatmap.Metadata.Source;
|
|
||||||
tags.Text = Beatmap.Metadata.Tags;
|
|
||||||
|
|
||||||
var requestedBeatmap = Beatmap;
|
|
||||||
if (requestedBeatmap.Metrics == null)
|
|
||||||
{
|
{
|
||||||
|
var requestedBeatmap = Beatmap;
|
||||||
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
var lookup = new GetBeatmapDetailsRequest(requestedBeatmap);
|
||||||
lookup.Success += res =>
|
lookup.Success += res =>
|
||||||
{
|
{
|
||||||
@ -198,39 +199,34 @@ namespace osu.Game.Screens.Select
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
requestedBeatmap.Metrics = res;
|
requestedBeatmap.Metrics = res;
|
||||||
Schedule(() => displayMetrics(res));
|
Schedule(() => updateMetrics(res));
|
||||||
};
|
};
|
||||||
lookup.Failure += e => Schedule(() => displayMetrics(null));
|
lookup.Failure += e => Schedule(() => updateMetrics());
|
||||||
|
|
||||||
api.Queue(lookup);
|
api.Queue(lookup);
|
||||||
loading.Show();
|
loading.Show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayMetrics(requestedBeatmap.Metrics, false);
|
updateMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMetrics(BeatmapMetrics metrics, bool failOnMissing = true)
|
private void updateMetrics(BeatmapMetrics metrics = null)
|
||||||
{
|
{
|
||||||
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
var hasRatings = metrics?.Ratings?.Any() ?? false;
|
||||||
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
var hasRetriesFails = (metrics?.Retries?.Any() ?? false) && (metrics.Fails?.Any() ?? false);
|
||||||
|
|
||||||
if (failOnMissing) loading.Hide();
|
|
||||||
|
|
||||||
if (hasRatings)
|
if (hasRatings)
|
||||||
{
|
{
|
||||||
ratings.Metrics = metrics;
|
ratings.Metrics = metrics;
|
||||||
ratings.FadeIn(transition_duration);
|
ratingsContainer.FadeIn(transition_duration);
|
||||||
}
|
}
|
||||||
else if (failOnMissing)
|
else
|
||||||
{
|
{
|
||||||
ratings.Metrics = new BeatmapMetrics
|
ratings.Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Ratings = new int[10],
|
Ratings = new int[10],
|
||||||
};
|
};
|
||||||
}
|
ratingsContainer.FadeTo(0.25f, transition_duration);
|
||||||
else
|
|
||||||
{
|
|
||||||
ratings.FadeTo(0.25f, transition_duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasRetriesFails)
|
if (hasRetriesFails)
|
||||||
@ -238,41 +234,17 @@ namespace osu.Game.Screens.Select
|
|||||||
failRetryGraph.Metrics = metrics;
|
failRetryGraph.Metrics = metrics;
|
||||||
failRetryContainer.FadeIn(transition_duration);
|
failRetryContainer.FadeIn(transition_duration);
|
||||||
}
|
}
|
||||||
else if (failOnMissing)
|
else
|
||||||
{
|
{
|
||||||
failRetryGraph.Metrics = new BeatmapMetrics
|
failRetryGraph.Metrics = new BeatmapMetrics
|
||||||
{
|
{
|
||||||
Fails = new int[100],
|
Fails = new int[100],
|
||||||
Retries = new int[100],
|
Retries = new int[100],
|
||||||
};
|
};
|
||||||
|
failRetryContainer.FadeOut(transition_duration);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
failRetryContainer.FadeTo(0.25f, transition_duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void clearStats()
|
|
||||||
{
|
|
||||||
description.Text = null;
|
|
||||||
source.Text = null;
|
|
||||||
tags.Text = null;
|
|
||||||
|
|
||||||
advanced.Beatmap = new BeatmapInfo
|
|
||||||
{
|
|
||||||
StarDifficulty = 0,
|
|
||||||
BaseDifficulty = new BeatmapDifficulty
|
|
||||||
{
|
|
||||||
CircleSize = 0,
|
|
||||||
DrainRate = 0,
|
|
||||||
OverallDifficulty = 0,
|
|
||||||
ApproachRate = 0,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
loading.Hide();
|
loading.Hide();
|
||||||
ratingsContainer.FadeOut(transition_duration);
|
|
||||||
failRetryContainer.FadeOut(transition_duration);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DetailBox : Container
|
private class DetailBox : Container
|
||||||
|
@ -49,10 +49,15 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DelayedLoadUnloadWrapper(() =>
|
new DelayedLoadUnloadWrapper(() =>
|
||||||
new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
|
{
|
||||||
|
var background = new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault()))
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint),
|
};
|
||||||
|
|
||||||
|
background.OnLoadComplete += d => d.FadeInFromZero(1000, Easing.OutQuint);
|
||||||
|
|
||||||
|
return background;
|
||||||
}, 300, 5000
|
}, 300, 5000
|
||||||
),
|
),
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private APIAccess api { get; set; }
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
base.Update();
|
base.Update();
|
||||||
|
|
||||||
// note that this will override any mod rate application
|
// note that this will override any mod rate application
|
||||||
Beatmap.Value.Track.Rate = Clock.Rate;
|
Beatmap.Value.Track.TempoAdjust = Clock.Rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,9 @@ namespace osu.Game.Users
|
|||||||
var avatar = new Avatar(user)
|
var avatar = new Avatar(user)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(300, Easing.OutQuint),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
avatar.OnLoadComplete += d => d.FadeInFromZero(300, Easing.OutQuint);
|
||||||
avatar.OpenOnClick.BindTo(OpenOnClick);
|
avatar.OpenOnClick.BindTo(OpenOnClick);
|
||||||
|
|
||||||
Add(displayedAvatar = new DelayedLoadWrapper(avatar));
|
Add(displayedAvatar = new DelayedLoadWrapper(avatar));
|
||||||
|
@ -59,6 +59,8 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
FillFlowContainer infoContainer;
|
FillFlowContainer infoContainer;
|
||||||
|
|
||||||
|
UserCoverBackground coverBackground;
|
||||||
|
|
||||||
AddInternal(content = new Container
|
AddInternal(content = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -73,13 +75,12 @@ namespace osu.Game.Users
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new DelayedLoadWrapper(new UserCoverBackground(user)
|
new DelayedLoadWrapper(coverBackground = new UserCoverBackground(user)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out)
|
|
||||||
}, 300) { RelativeSizeAxes = Axes.Both },
|
}, 300) { RelativeSizeAxes = Axes.Both },
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
@ -181,6 +182,8 @@ namespace osu.Game.Users
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out);
|
||||||
|
|
||||||
if (user.IsSupporter)
|
if (user.IsSupporter)
|
||||||
{
|
{
|
||||||
infoContainer.Add(new SupporterIcon
|
infoContainer.Add(new SupporterIcon
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.308.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.315.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -105,8 +105,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.308.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.315.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.308.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.315.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -13,4 +13,3 @@ namespace osu.iOS
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,6 +111,7 @@
|
|||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleMultipleEnumeration/@EntryIndexedValue">HINT</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PossibleMultipleEnumeration/@EntryIndexedValue">HINT</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PrivateVariableCanBeMadeReadonly/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PrivateVariableCanBeMadeReadonly/@EntryIndexedValue">WARNING</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PublicConstructorInAbstractClass/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=PublicConstructorInAbstractClass/@EntryIndexedValue">WARNING</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArgumentDefaultValue/@EntryIndexedValue">HINT</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArrayCreationExpression/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantArrayCreationExpression/@EntryIndexedValue">WARNING</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAttributeParentheses/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAttributeParentheses/@EntryIndexedValue">WARNING</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAttributeUsageProperty/@EntryIndexedValue">WARNING</s:String>
|
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantAttributeUsageProperty/@EntryIndexedValue">WARNING</s:String>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user