From 99e28b6efa5a9bcfb6b6491ba58ffcc8da767a1d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 17:38:43 +0900 Subject: [PATCH 001/171] No reason for beatmap conversion tests to be internal --- osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs | 4 ++-- osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs | 4 ++-- osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs | 4 ++-- osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 5b34e46247..14d913cffa 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -12,7 +12,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Catch.Tests { - internal class CatchBeatmapConversionTest : BeatmapConversionTest + public class CatchBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Catch.Tests protected override Ruleset CreateRuleset() => new CatchRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index 5ae899f6d6..f9e6531119 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -12,7 +12,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Mania.Tests { - internal class ManiaBeatmapConversionTest : BeatmapConversionTest + public class ManiaBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Mania.Tests protected override Ruleset CreateRuleset() => new ManiaRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 386ae5eb05..1383256352 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -13,7 +13,7 @@ using OpenTK; namespace osu.Game.Rulesets.Osu.Tests { - internal class OsuBeatmapConversionTest : BeatmapConversionTest + public class OsuBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Tests protected override Ruleset CreateRuleset() => new OsuRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs index 11586e340b..fb0b2040f4 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoBeatmapConversionTest.cs @@ -12,7 +12,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Taiko.Tests { - internal class TaikoBeatmapConversionTest : BeatmapConversionTest + public class TaikoBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Taiko.Tests protected override Ruleset CreateRuleset() => new TaikoRuleset(); } - internal struct ConvertValue : IEquatable + public struct ConvertValue : IEquatable { /// /// A sane value to account for osu!stable using ints everwhere. From e94518697833fc60837078492607acadfbab79aa Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 17:59:52 +0900 Subject: [PATCH 002/171] Expose the beatmap converter --- osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index cf4dda52a8..b95173e44d 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -25,6 +25,8 @@ namespace osu.Game.Tests.Beatmaps protected abstract string ResourceAssembly { get; } + protected IBeatmapConverter Converter { get; private set; } + protected void Test(string name) { var ourResult = convert(name); @@ -88,10 +90,11 @@ namespace osu.Game.Tests.Beatmaps var rulesetInstance = CreateRuleset(); beatmap.BeatmapInfo.Ruleset = beatmap.BeatmapInfo.RulesetID == rulesetInstance.RulesetInfo.ID ? rulesetInstance.RulesetInfo : new RulesetInfo(); - var result = new ConvertResult(); - var converter = rulesetInstance.CreateBeatmapConverter(beatmap); + Converter = rulesetInstance.CreateBeatmapConverter(beatmap); - converter.ObjectConverted += (orig, converted) => + var result = new ConvertResult(); + + Converter.ObjectConverted += (orig, converted) => { converted.ForEach(h => h.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty)); @@ -103,7 +106,7 @@ namespace osu.Game.Tests.Beatmaps result.Mappings.Add(mapping); }; - IBeatmap convertedBeatmap = converter.Convert(); + IBeatmap convertedBeatmap = Converter.Convert(); rulesetInstance.CreateBeatmapProcessor(convertedBeatmap)?.PostProcess(); return result; From 47ae962099fdb248c6fc547ecb85bd2ee01b6398 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 18:20:28 +0900 Subject: [PATCH 003/171] Output only one mapping failure per mapping --- .../Tests/Beatmaps/BeatmapConversionTest.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index b95173e44d..ff57ef41c5 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -43,14 +43,22 @@ namespace osu.Game.Tests.Beatmaps Assert.Fail($"A conversion did not generate any hitobjects, but should have, for hitobject at time: {expectedResult.Mappings[mappingCounter].StartTime}\n"); else if (mappingCounter >= expectedResult.Mappings.Count) Assert.Fail($"A conversion generated hitobjects, but should not have, for hitobject at time: {ourResult.Mappings[mappingCounter].StartTime}\n"); + else if (!expectedResult.Mappings[mappingCounter].Equals(ourResult.Mappings[mappingCounter])) + { + var expectedMapping = expectedResult.Mappings[mappingCounter]; + var ourMapping = ourResult.Mappings[mappingCounter]; + + Assert.Fail($"The conversion mapping differed for object at time {expectedMapping.StartTime}:\n" + + $"Expected {JsonConvert.SerializeObject(expectedMapping)}\n" + + $"Received: {JsonConvert.SerializeObject(ourMapping)}\n"); + } else { - var counter = mappingCounter; + var ourMapping = ourResult.Mappings[mappingCounter]; + var expectedMapping = expectedResult.Mappings[mappingCounter]; + Assert.Multiple(() => { - var ourMapping = ourResult.Mappings[counter]; - var expectedMapping = expectedResult.Mappings[counter]; - int objectCounter = 0; while (true) { @@ -62,10 +70,6 @@ namespace osu.Game.Tests.Beatmaps else if (objectCounter >= expectedMapping.Objects.Count) Assert.Fail($"The conversion generated a hitobject, but should not have, for hitobject at time: {ourMapping.StartTime}:\n" + $"Received: {JsonConvert.SerializeObject(ourMapping.Objects[objectCounter])}\n"); - else if (!expectedMapping.Equals(ourMapping)) - Assert.Fail($"The conversion mapping differed for object at time {expectedMapping.StartTime}:\n" - + $"Expected {JsonConvert.SerializeObject(expectedMapping)}\n" - + $"Received: {JsonConvert.SerializeObject(ourMapping)}\n"); else if (!expectedMapping.Objects[objectCounter].Equals(ourMapping.Objects[objectCounter])) { Assert.Fail($"The conversion generated differing hitobjects for object at time: {expectedMapping.StartTime}:\n" From afbf35b81416ec5e76c6425971ec6ca7677abf74 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:48:36 +0900 Subject: [PATCH 004/171] Add rng components to mania conversion tests --- .../ManiaBeatmapConversionTest.cs | 30 ++++++++++++++++++- .../MathUtils/FastRandom.cs | 18 ++++++----- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index f9e6531119..c13319ace9 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.MathUtils; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; @@ -12,7 +14,7 @@ using osu.Game.Tests.Beatmaps; namespace osu.Game.Rulesets.Mania.Tests { - public class ManiaBeatmapConversionTest : BeatmapConversionTest + public class ManiaBeatmapConversionTest : BeatmapConversionTest { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; @@ -33,9 +35,35 @@ namespace osu.Game.Rulesets.Mania.Tests }; } + protected override ManiaConvertMapping CreateConvertMapping() => new ManiaConvertMapping(Converter); + protected override Ruleset CreateRuleset() => new ManiaRuleset(); } + public class ManiaConvertMapping : ConvertMapping, IEquatable + { + public uint RandomW; + public uint RandomX; + public uint RandomY; + public uint RandomZ; + + public ManiaConvertMapping() + { + } + + public ManiaConvertMapping(IBeatmapConverter converter) + { + var maniaConverter = (ManiaBeatmapConverter)converter; + RandomW = maniaConverter.Random.W; + RandomX = maniaConverter.Random.X; + RandomY = maniaConverter.Random.Y; + RandomZ = maniaConverter.Random.Z; + } + + public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ; + public override bool Equals(ConvertMapping other) => base.Equals(other) && Equals(other as ManiaConvertMapping); + } + public struct ConvertValue : IEquatable { /// diff --git a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs index a3efd5c2bd..785cd5ab06 100644 --- a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs +++ b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs @@ -15,11 +15,15 @@ namespace osu.Game.Rulesets.Mania.MathUtils private const uint y = 842502087; private const uint z = 3579807591; private const uint w = 273326509; - private uint _x, _y = y, _z = z, _w = w; + + internal uint X { get; private set; } + internal uint Y { get; private set; } = y; + internal uint Z { get; private set; } = z; + internal uint W { get; private set; } = w; public FastRandom(int seed) { - _x = (uint)seed; + X = (uint)seed; } public FastRandom() @@ -33,11 +37,11 @@ namespace osu.Game.Rulesets.Mania.MathUtils /// The random value. public uint NextUInt() { - uint t = _x ^ _x << 11; - _x = _y; - _y = _z; - _z = _w; - return _w = _w ^ _w >> 19 ^ t ^ t >> 8; + uint t = X ^ X << 11; + X = Y; + Y = Z; + Z = W; + return W = W ^ W >> 19 ^ t ^ t >> 8; } /// From 481546ec7a76ba80a6e5753f9e40f1c6d94a2b45 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:49:11 +0900 Subject: [PATCH 005/171] Fix drain time not being rounded to the second --- .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 930597c1ad..8ef942c683 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -103,17 +103,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy HitObject lastObject = OriginalBeatmap.HitObjects.LastOrDefault(); HitObject firstObject = OriginalBeatmap.HitObjects.FirstOrDefault(); - double drainTime = (lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0); - drainTime -= OriginalBeatmap.TotalBreakTime; + // Drain time in seconds + int drainTime = (int)(((lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0) - OriginalBeatmap.TotalBreakTime) / 1000); if (drainTime == 0) - drainTime = 10000000; - - // We need this in seconds - drainTime /= 1000; + drainTime = 100000; BeatmapDifficulty difficulty = OriginalBeatmap.BeatmapInfo.BaseDifficulty; - conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; + conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; conversionDifficulty = Math.Min(conversionDifficulty.Value, 12); return conversionDifficulty.Value; From fe9aaf000c97abd7029a129331b14dc62b6bbc62 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:50:36 +0900 Subject: [PATCH 006/171] Fix missing conditional --- .../Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index b4160dc98b..1ea2863520 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -82,7 +82,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && TotalColumns != 8) convertType |= PatternType.Mirror; - else + else if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)) convertType |= PatternType.Gathered; } } From c1f7db80f17a013ba313aa3640fe4f21e2d9a604 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:52:09 +0900 Subject: [PATCH 007/171] Forgot to commit random change --- .../Beatmaps/ManiaBeatmapConverter.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 19fef9eb54..d76ae4f081 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -28,8 +28,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps public int TargetColumns; public readonly bool IsForCurrentRuleset; + // Internal for testing purposes + internal FastRandom Random { get; private set; } + private Pattern lastPattern = new Pattern(); - private FastRandom random; private ManiaBeatmap beatmap; @@ -62,7 +64,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps BeatmapDifficulty difficulty = original.BeatmapInfo.BaseDifficulty; int seed = (int)Math.Round(difficulty.DrainRate + difficulty.CircleSize) * 20 + (int)(difficulty.OverallDifficulty * 41.2) + (int)Math.Round(difficulty.ApproachRate); - random = new FastRandom(seed); + Random = new FastRandom(seed); return base.ConvertBeatmap(original); } @@ -115,7 +117,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps /// The hit objects generated. private IEnumerable generateSpecific(HitObject original, IBeatmap originalBeatmap) { - var generator = new SpecificBeatmapPatternGenerator(random, original, beatmap, lastPattern, originalBeatmap); + var generator = new SpecificBeatmapPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); Pattern newPattern = generator.Generate(); lastPattern = newPattern; @@ -138,14 +140,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps Patterns.PatternGenerator conversion = null; if (distanceData != null) - conversion = new DistanceObjectPatternGenerator(random, original, beatmap, lastPattern, originalBeatmap); + { + var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); + conversion = generator; + } else if (endTimeData != null) - conversion = new EndTimeObjectPatternGenerator(random, original, beatmap, originalBeatmap); + conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, originalBeatmap); else if (positionData != null) { computeDensity(original.StartTime); - conversion = new HitObjectPatternGenerator(random, original, beatmap, lastPattern, lastTime, lastPosition, density, lastStair, originalBeatmap); + conversion = new HitObjectPatternGenerator(Random, original, beatmap, lastPattern, lastTime, lastPosition, density, lastStair, originalBeatmap); recordNote(original.StartTime, positionData.Position); } From e51f96e181d1996d1da4ac4ce62e0e126e8c68e0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 20:52:36 +0900 Subject: [PATCH 008/171] Fix some notes not being recorded --- .../Beatmaps/ManiaBeatmapConverter.cs | 12 +++++ .../Legacy/DistanceObjectPatternGenerator.cs | 47 ++++++++++--------- 2 files changed, 36 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index d76ae4f081..bc2c9943db 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -136,6 +136,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var endTimeData = original as IHasEndTime; var distanceData = original as IHasDistance; var positionData = original as IHasPosition; + var repeatsData = original as IHasRepeats; Patterns.PatternGenerator conversion = null; @@ -143,9 +144,20 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); conversion = generator; + + for (double time = original.StartTime; time <= generator.EndTime; time += generator.SegmentDuration) + { + recordNote(time, positionData?.Position ?? Vector2.Zero); + computeDensity(time); + } } else if (endTimeData != null) + { conversion = new EndTimeObjectPatternGenerator(Random, original, beatmap, originalBeatmap); + + recordNote(endTimeData.EndTime, new Vector2(256, 192)); + computeDensity(endTimeData.EndTime); + } else if (positionData != null) { computeDensity(original.StartTime); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index f60958d581..a4275be504 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -24,8 +24,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy /// private const float osu_base_scoring_distance = 100; - private readonly double endTime; - private readonly double segmentDuration; + public readonly double EndTime; + public readonly double SegmentDuration; + private readonly int spanCount; private PatternType convertType; @@ -52,8 +53,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy // The duration of the osu! hit object double osuDuration = distance / osuVelocity; - endTime = hitObject.StartTime + osuDuration; - segmentDuration = (endTime - HitObject.StartTime) / spanCount; + EndTime = hitObject.StartTime + osuDuration; + SegmentDuration = (EndTime - HitObject.StartTime) / spanCount; } public override Pattern Generate() @@ -61,44 +62,44 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (TotalColumns == 1) { var pattern = new Pattern(); - addToPattern(pattern, 0, HitObject.StartTime, endTime); + addToPattern(pattern, 0, HitObject.StartTime, EndTime); return pattern; } if (spanCount > 1) { - if (segmentDuration <= 90) + if (SegmentDuration <= 90) return generateRandomHoldNotes(HitObject.StartTime, 1); - if (segmentDuration <= 120) + if (SegmentDuration <= 120) { convertType |= PatternType.ForceNotStack; return generateRandomNotes(HitObject.StartTime, spanCount + 1); } - if (segmentDuration <= 160) + if (SegmentDuration <= 160) return generateStair(HitObject.StartTime); - if (segmentDuration <= 200 && ConversionDifficulty > 3) + if (SegmentDuration <= 200 && ConversionDifficulty > 3) return generateRandomMultipleNotes(HitObject.StartTime); - double duration = endTime - HitObject.StartTime; + double duration = EndTime - HitObject.StartTime; if (duration >= 4000) return generateNRandomNotes(HitObject.StartTime, 0.23, 0, 0); - if (segmentDuration > 400 && spanCount < TotalColumns - 1 - RandomStart) + if (SegmentDuration > 400 && spanCount < TotalColumns - 1 - RandomStart) return generateTiledHoldNotes(HitObject.StartTime); return generateHoldAndNormalNotes(HitObject.StartTime); } - if (segmentDuration <= 110) + if (SegmentDuration <= 110) { if (PreviousPattern.ColumnWithObjects < TotalColumns) convertType |= PatternType.ForceNotStack; else convertType &= ~PatternType.ForceNotStack; - return generateRandomNotes(HitObject.StartTime, segmentDuration < 80 ? 1 : 2); + return generateRandomNotes(HitObject.StartTime, SegmentDuration < 80 ? 1 : 2); } if (ConversionDifficulty > 6.5) @@ -148,7 +149,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn)) //find available column nextColumn = Random.Next(RandomStart, TotalColumns); - addToPattern(pattern, nextColumn, startTime, endTime); + addToPattern(pattern, nextColumn, startTime, EndTime); } // This is can't be combined with the above loop due to RNG @@ -156,7 +157,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); - addToPattern(pattern, nextColumn, startTime, endTime); + addToPattern(pattern, nextColumn, startTime, EndTime); } return pattern; @@ -193,7 +194,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy nextColumn = Random.Next(RandomStart, TotalColumns); lastColumn = nextColumn; - startTime += segmentDuration; + startTime += SegmentDuration; } return pattern; @@ -223,7 +224,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy for (int i = 0; i <= spanCount; i++) { addToPattern(pattern, column, startTime, startTime); - startTime += segmentDuration; + startTime += SegmentDuration; // Check if we're at the borders of the stage, and invert the pattern if so if (increasing) @@ -284,7 +285,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy addToPattern(pattern, nextColumn, startTime, startTime); nextColumn = Random.Next(RandomStart, TotalColumns); - startTime += segmentDuration; + startTime += SegmentDuration; } return pattern; @@ -372,8 +373,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy while (pattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); - addToPattern(pattern, nextColumn, startTime, endTime); - startTime += segmentDuration; + addToPattern(pattern, nextColumn, startTime, EndTime); + startTime += SegmentDuration; } return pattern; @@ -402,7 +403,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } // Create the hold note - addToPattern(pattern, holdColumn, startTime, endTime); + addToPattern(pattern, holdColumn, startTime, EndTime); int nextColumn = Random.Next(RandomStart, TotalColumns); int noteCount; @@ -434,7 +435,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy pattern.Add(rowPattern); rowPattern.Clear(); - startTime += segmentDuration; + startTime += SegmentDuration; } return pattern; @@ -452,7 +453,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (curveData == null) return HitObject.Samples; - double segmentTime = (endTime - HitObject.StartTime) / spanCount; + double segmentTime = (EndTime - HitObject.StartTime) / spanCount; int index = (int)(segmentTime == 0 ? 0 : (time - HitObject.StartTime) / segmentTime); return curveData.RepeatSamples[index]; From 5f5d797c1effc6ae2f9c96811ab6e5272ebdf347 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 21:06:35 +0900 Subject: [PATCH 009/171] Remove unused field --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index bc2c9943db..0f99f999da 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -136,7 +136,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var endTimeData = original as IHasEndTime; var distanceData = original as IHasDistance; var positionData = original as IHasPosition; - var repeatsData = original as IHasRepeats; Patterns.PatternGenerator conversion = null; From 53a6d01304a3540f8a9f3684e471f683ad4c14a3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 21:06:54 +0900 Subject: [PATCH 010/171] Fix stair type not being flipped correctly --- .../Legacy/HitObjectPatternGenerator.cs | 199 +++++++++--------- 1 file changed, 100 insertions(+), 99 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 1ea2863520..2210c76788 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -89,120 +89,121 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy public override Pattern Generate() { - if (TotalColumns == 1) + var pattern = new Pattern(); + + try { - var pattern = new Pattern(); - addToPattern(pattern, 0); - return pattern; - } - - int lastColumn = PreviousPattern.HitObjects.FirstOrDefault()?.Column ?? 0; - - if ((convertType & PatternType.Reverse) > 0 && PreviousPattern.HitObjects.Any()) - { - // Generate a new pattern by copying the last hit objects in reverse-column order - var pattern = new Pattern(); - - for (int i = RandomStart; i < TotalColumns; i++) - if (PreviousPattern.ColumnHasObject(i)) - addToPattern(pattern, RandomStart + TotalColumns - i - 1); - - return pattern; - } - - if ((convertType & PatternType.Cycle) > 0 && PreviousPattern.HitObjects.Count() == 1 - // If we convert to 7K + 1, let's not overload the special key - && (TotalColumns != 8 || lastColumn != 0) - // Make sure the last column was not the centre column - && (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2)) - { - // Generate a new pattern by cycling backwards (similar to Reverse but for only one hit object) - var pattern = new Pattern(); - - int column = RandomStart + TotalColumns - lastColumn - 1; - addToPattern(pattern, column); - - return pattern; - } - - if ((convertType & PatternType.ForceStack) > 0 && PreviousPattern.HitObjects.Any()) - { - // Generate a new pattern by placing on the already filled columns - var pattern = new Pattern(); - - for (int i = RandomStart; i < TotalColumns; i++) - if (PreviousPattern.ColumnHasObject(i)) - addToPattern(pattern, i); - - return pattern; - } - - if ((convertType & PatternType.Stair) > 0 && PreviousPattern.HitObjects.Count() == 1) - { - // Generate a new pattern by placing on the next column, cycling back to the start if there is no "next" - var pattern = new Pattern(); - - int targetColumn = lastColumn + 1; - if (targetColumn == TotalColumns) + if (TotalColumns == 1) { - targetColumn = RandomStart; - StairType = PatternType.ReverseStair; + addToPattern(pattern, 0); + return pattern; } - addToPattern(pattern, targetColumn); - return pattern; - } + int lastColumn = PreviousPattern.HitObjects.FirstOrDefault()?.Column ?? 0; - if ((convertType & PatternType.ReverseStair) > 0 && PreviousPattern.HitObjects.Count() == 1) - { - // Generate a new pattern by placing on the previous column, cycling back to the end if there is no "previous" - var pattern = new Pattern(); - - int targetColumn = lastColumn - 1; - if (targetColumn == RandomStart - 1) + if ((convertType & PatternType.Reverse) > 0 && PreviousPattern.HitObjects.Any()) { - targetColumn = TotalColumns - 1; - StairType = PatternType.Stair; + // Generate a new pattern by copying the last hit objects in reverse-column order + for (int i = RandomStart; i < TotalColumns; i++) + if (PreviousPattern.ColumnHasObject(i)) + addToPattern(pattern, RandomStart + TotalColumns - i - 1); + + return pattern; } - addToPattern(pattern, targetColumn); - return pattern; - } + if ((convertType & PatternType.Cycle) > 0 && PreviousPattern.HitObjects.Count() == 1 + // If we convert to 7K + 1, let's not overload the special key + && (TotalColumns != 8 || lastColumn != 0) + // Make sure the last column was not the centre column + && (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2)) + { + // Generate a new pattern by cycling backwards (similar to Reverse but for only one hit object) + int column = RandomStart + TotalColumns - lastColumn - 1; + addToPattern(pattern, column); - if ((convertType & PatternType.KeepSingle) > 0) - return generateRandomNotes(1); + return pattern; + } + + if ((convertType & PatternType.ForceStack) > 0 && PreviousPattern.HitObjects.Any()) + { + // Generate a new pattern by placing on the already filled columns + for (int i = RandomStart; i < TotalColumns; i++) + if (PreviousPattern.ColumnHasObject(i)) + addToPattern(pattern, i); + + return pattern; + } + + if (PreviousPattern.HitObjects.Count() == 1) + { + if ((convertType & PatternType.Stair) > 0) + { + // Generate a new pattern by placing on the next column, cycling back to the start if there is no "next" + int targetColumn = lastColumn + 1; + if (targetColumn == TotalColumns) + targetColumn = RandomStart; + + addToPattern(pattern, targetColumn); + return pattern; + } + + if ((convertType & PatternType.ReverseStair) > 0) + { + // Generate a new pattern by placing on the previous column, cycling back to the end if there is no "previous" + int targetColumn = lastColumn - 1; + if (targetColumn == RandomStart - 1) + targetColumn = TotalColumns - 1; + + addToPattern(pattern, targetColumn); + return pattern; + } + } + + if ((convertType & PatternType.KeepSingle) > 0) + return pattern = generateRandomNotes(1); + + if ((convertType & PatternType.Mirror) > 0) + { + if (ConversionDifficulty > 6.5) + return pattern = generateRandomPatternWithMirrored(0.12, 0.38, 0.12); + if (ConversionDifficulty > 4) + return pattern = generateRandomPatternWithMirrored(0.12, 0.17, 0); + return pattern = generateRandomPatternWithMirrored(0.12, 0, 0); + } - if ((convertType & PatternType.Mirror) > 0) - { if (ConversionDifficulty > 6.5) - return generateRandomPatternWithMirrored(0.12, 0.38, 0.12); + { + if ((convertType & PatternType.LowProbability) > 0) + return pattern = generateRandomPattern(0.78, 0.42, 0, 0); + return pattern = generateRandomPattern(1, 0.62, 0, 0); + } + if (ConversionDifficulty > 4) - return generateRandomPatternWithMirrored(0.12, 0.17, 0); - return generateRandomPatternWithMirrored(0.12, 0, 0); - } + { + if ((convertType & PatternType.LowProbability) > 0) + return pattern = generateRandomPattern(0.35, 0.08, 0, 0); + return pattern = generateRandomPattern(0.52, 0.15, 0, 0); + } - if (ConversionDifficulty > 6.5) + if (ConversionDifficulty > 2) + { + if ((convertType & PatternType.LowProbability) > 0) + return pattern = generateRandomPattern(0.18, 0, 0, 0); + return pattern = generateRandomPattern(0.45, 0, 0, 0); + } + + return pattern = generateRandomPattern(0, 0, 0, 0); + } + finally { - if ((convertType & PatternType.LowProbability) > 0) - return generateRandomPattern(0.78, 0.42, 0, 0); - return generateRandomPattern(1, 0.62, 0, 0); + foreach (var obj in pattern.HitObjects) + { + if ((convertType & PatternType.Stair) > 0 && obj.Column == TotalColumns - 1) + StairType = PatternType.ReverseStair; + if ((convertType & PatternType.ReverseStair) > 0 && obj.Column == RandomStart) + StairType = PatternType.Stair; + } } - - if (ConversionDifficulty > 4) - { - if ((convertType & PatternType.LowProbability) > 0) - return generateRandomPattern(0.35, 0.08, 0, 0); - return generateRandomPattern(0.52, 0.15, 0, 0); - } - - if (ConversionDifficulty > 2) - { - if ((convertType & PatternType.LowProbability) > 0) - return generateRandomPattern(0.18, 0, 0, 0); - return generateRandomPattern(0.45, 0, 0, 0); - } - - return generateRandomPattern(0, 0, 0, 0); } /// From 2d59ae9354249a2e39930db38f1a74e24175bcbb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 22:08:24 +0900 Subject: [PATCH 011/171] Commit forgotten variable --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 0f99f999da..536b1a8552 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private double lastTime; private Vector2 lastPosition; - private PatternType lastStair; + private PatternType lastStair = PatternType.Stair; private void recordNote(double time, Vector2 position) { lastTime = time; From 55f0b3c42cc895ca859a3864c60714d973271647 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Jun 2018 22:10:57 +0900 Subject: [PATCH 012/171] Distance object generator should output a secondary pattern In osu!stable, only the hitobjects which ended at the distance object's EndTime would be considered for further pattern generation. Previously this generator was group _all_ objects including those that don't end at the object's EndTime, resulting in incorrect hitobject count for further pattern generation. --- .../Beatmaps/ManiaBeatmapConverter.cs | 29 +++++++++++++------ .../Legacy/DistanceObjectPatternGenerator.cs | 26 ++++++++++++++++- .../Legacy/EndTimeObjectPatternGenerator.cs | 7 ++++- .../Legacy/HitObjectPatternGenerator.cs | 8 ++++- .../Beatmaps/Patterns/PatternGenerator.cs | 7 +++-- 5 files changed, 62 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 536b1a8552..2c4c7b0f18 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -119,10 +119,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { var generator = new SpecificBeatmapPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); - Pattern newPattern = generator.Generate(); - lastPattern = newPattern; + foreach (var newPattern in generator.Generate()) + { + lastPattern = newPattern; - return newPattern.HitObjects; + foreach (var obj in newPattern.HitObjects) + yield return obj; + } } /// @@ -167,14 +170,17 @@ namespace osu.Game.Rulesets.Mania.Beatmaps } if (conversion == null) - return null; + yield break; - Pattern newPattern = conversion.Generate(); + foreach (var newPattern in conversion.Generate()) + { + lastPattern = conversion is EndTimeObjectPatternGenerator ? lastPattern : newPattern; + lastStair = (conversion as HitObjectPatternGenerator)?.StairType ?? lastStair; - lastPattern = conversion is EndTimeObjectPatternGenerator ? lastPattern : newPattern; - lastStair = (conversion as HitObjectPatternGenerator)?.StairType ?? lastStair; + foreach (var obj in newPattern.HitObjects) + yield return obj; - return newPattern.HitObjects; + } } /// @@ -187,7 +193,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { } - public override Pattern Generate() + public override IEnumerable Generate() + { + yield return generate(); + } + + private Pattern generate() { var endTimeData = HitObject as IHasEndTime; var positionData = HitObject as IHasXPosition; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index a4275be504..e33af44df2 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.MathUtils; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.MathUtils; @@ -57,7 +58,30 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy SegmentDuration = (EndTime - HitObject.StartTime) / spanCount; } - public override Pattern Generate() + public override IEnumerable Generate() + { + var originalPattern = generate(); + + // We need to split the intermediate pattern into two new patterns: + // 1. A pattern containing all objects that do not end at our EndTime. + // 2. A pattern containing all objects that end at our EndTime. This will be used for further pattern generation. + var intermediatePattern = new Pattern(); + var endTimePattern = new Pattern(); + + foreach (var obj in originalPattern.HitObjects) + { + if (!Precision.AlmostEquals(EndTime, (obj as IHasEndTime)?.EndTime ?? obj.StartTime)) + intermediatePattern.Add(obj); + else + endTimePattern.Add(obj); + } + + + yield return intermediatePattern; + yield return endTimePattern; + } + + private Pattern generate() { if (TotalColumns == 1) { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 3f34afee85..0f170e8540 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -24,7 +24,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy endTime = endtimeData?.EndTime ?? 0; } - public override Pattern Generate() + public override IEnumerable Generate() + { + yield return generate(); + } + + private Pattern generate() { var pattern = new Pattern(); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 2210c76788..0e839d87a2 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using System.Linq; using OpenTK; using osu.Game.Audio; @@ -87,7 +88,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } } - public override Pattern Generate() + public override IEnumerable Generate() + { + yield return generate(); + } + + private Pattern generate() { var pattern = new Pattern(); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs index 2bfcd52b6a..a42d57cdd1 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/PatternGenerator.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns @@ -42,9 +43,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns } /// - /// Generates the pattern for , filled with hit objects. + /// Generates the patterns for , each filled with hit objects. /// - /// The containing the hit objects. - public abstract Pattern Generate(); + /// The s containing the hit objects. + public abstract IEnumerable Generate(); } } From 8529cece4a65bc006d4946fabee4cab9e98c48c5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Jun 2018 20:17:19 +0900 Subject: [PATCH 013/171] Fix precision error --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 2c4c7b0f18..e21738f8c8 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -147,7 +147,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var generator = new DistanceObjectPatternGenerator(Random, original, beatmap, lastPattern, originalBeatmap); conversion = generator; - for (double time = original.StartTime; time <= generator.EndTime; time += generator.SegmentDuration) + for (double time = original.StartTime; !Precision.DefinitelyBigger(time, generator.EndTime); time += generator.SegmentDuration) { recordNote(time, positionData?.Position ?? Vector2.Zero); computeDensity(time); From 0625bfda301f8dfea9531d9c14c765bf9c66a855 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Jun 2018 20:17:49 +0900 Subject: [PATCH 014/171] Don't split single hitobject into multiple patterns --- .../Patterns/Legacy/DistanceObjectPatternGenerator.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index e33af44df2..e96ba19c80 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -62,6 +62,12 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { var originalPattern = generate(); + if (originalPattern.HitObjects.Count() == 1) + { + yield return originalPattern; + yield break; + } + // We need to split the intermediate pattern into two new patterns: // 1. A pattern containing all objects that do not end at our EndTime. // 2. A pattern containing all objects that end at our EndTime. This will be used for further pattern generation. @@ -76,7 +82,6 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy endTimePattern.Add(obj); } - yield return intermediatePattern; yield return endTimePattern; } From f090e82b638a2dc0a6f82f76e803d79039028e43 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Jun 2018 21:06:09 +0900 Subject: [PATCH 015/171] Fix inverted conditional --- .../Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index e96ba19c80..280c2f45d4 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -359,7 +359,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy break; } - bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP && sample.Name == SampleInfo.HIT_FINISH; + bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP || sample.Name == SampleInfo.HIT_FINISH; bool canGenerateTwoNotes = (convertType & PatternType.LowProbability) == 0; canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample); From a623155b9fbe87236acbafbcc0d302ac30cfde63 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Jun 2018 13:51:53 +0900 Subject: [PATCH 016/171] Fix missing using --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index e21738f8c8..c15b303048 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -5,6 +5,7 @@ using osu.Game.Rulesets.Mania.Objects; using System; using System.Linq; using System.Collections.Generic; +using osu.Framework.MathUtils; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; From 6cd9a22e265ad31688eadc4d41247a1b851c2a19 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Jun 2018 13:52:14 +0900 Subject: [PATCH 017/171] Update testcase --- .../ManiaBeatmapConversionTest.cs | 1 - .../Beatmaps/basic-expected-conversion.json | 229 ++++++++++-------- 2 files changed, 129 insertions(+), 101 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index c13319ace9..33ac1e00e4 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -18,7 +18,6 @@ namespace osu.Game.Rulesets.Mania.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; - [NonParallelizable] [TestCase("basic")] public new void Test(string name) { diff --git a/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json b/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json index d593b2b052..753db99856 100644 --- a/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json +++ b/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/basic-expected-conversion.json @@ -1,103 +1,132 @@ { "Mappings": [{ - "StartTime": 500, - "Objects": [{ - "StartTime": 500, - "EndTime": 2500, - "Column": 0 - }, - { - "StartTime": 1500, - "EndTime": 2500, - "Column": 1 - } - ] - }, - { - "StartTime": 3000, - "Objects": [{ - "StartTime": 3000, - "EndTime": 4000, - "Column": 2 - }] - }, - { - "StartTime": 4500, - "Objects": [{ - "StartTime": 4500, - "EndTime": 5500, - "Column": 4 - }] - }, - { - "StartTime": 6000, - "Objects": [{ - "StartTime": 6000, - "EndTime": 6500, - "Column": 2 - }] - }, - { - "StartTime": 7000, - "Objects": [{ - "StartTime": 7000, - "EndTime": 8000, - "Column": 2 - }] - }, - { - "StartTime": 8500, - "Objects": [{ - "StartTime": 8500, - "EndTime": 11000, - "Column": 0 - }] - }, - { - "StartTime": 11500, - "Objects": [{ - "StartTime": 11500, - "EndTime": 12000, - "Column": 1 - }] - }, - { - "StartTime": 12500, - "Objects": [{ - "StartTime": 12500, - "EndTime": 16500, - "Column": 4 - }] - }, - { - "StartTime": 17000, - "Objects": [{ - "StartTime": 17000, - "EndTime": 18000, - "Column": 2 - }] - }, - { - "StartTime": 18500, - "Objects": [{ - "StartTime": 18500, - "EndTime": 19450, - "Column": 0 - }] - }, - { - "StartTime": 19875, - "Objects": [{ - "StartTime": 19875, - "EndTime": 23875, - "Column": 1 - }, - { - "StartTime": 19875, - "EndTime": 23875, - "Column": 0 - } - ] - } - ] + "RandomW": 2659373485, + "RandomX": 3579807591, + "RandomY": 273326509, + "RandomZ": 272969173, + "StartTime": 500.0, + "Objects": [{ + "StartTime": 500.0, + "EndTime": 2500.0, + "Column": 0 + }, { + "StartTime": 1500.0, + "EndTime": 2500.0, + "Column": 1 + }] + }, { + "RandomW": 3083803045, + "RandomX": 273326509, + "RandomY": 272969173, + "RandomZ": 2659373485, + "StartTime": 3000.0, + "Objects": [{ + "StartTime": 3000.0, + "EndTime": 4000.0, + "Column": 2 + }] + }, { + "RandomW": 4073554232, + "RandomX": 272969173, + "RandomY": 2659373485, + "RandomZ": 3083803045, + "StartTime": 4500.0, + "Objects": [{ + "StartTime": 4500.0, + "EndTime": 5500.0, + "Column": 4 + }] + }, { + "RandomW": 3420401969, + "RandomX": 2659373485, + "RandomY": 3083803045, + "RandomZ": 4073554232, + "StartTime": 6000.0, + "Objects": [{ + "StartTime": 6000.0, + "EndTime": 6500.0, + "Column": 2 + }] + }, { + "RandomW": 1129881182, + "RandomX": 3083803045, + "RandomY": 4073554232, + "RandomZ": 3420401969, + "StartTime": 7000.0, + "Objects": [{ + "StartTime": 7000.0, + "EndTime": 8000.0, + "Column": 2 + }] + }, { + "RandomW": 315568458, + "RandomX": 3420401969, + "RandomY": 1129881182, + "RandomZ": 2358617505, + "StartTime": 8500.0, + "Objects": [{ + "StartTime": 8500.0, + "EndTime": 11000.0, + "Column": 0 + }] + }, { + "RandomW": 548134043, + "RandomX": 1129881182, + "RandomY": 2358617505, + "RandomZ": 315568458, + "StartTime": 11500.0, + "Objects": [{ + "StartTime": 11500.0, + "EndTime": 12000.0, + "Column": 1 + }] + }, { + "RandomW": 3979422122, + "RandomX": 548134043, + "RandomY": 2810584254, + "RandomZ": 2250186050, + "StartTime": 12500.0, + "Objects": [{ + "StartTime": 12500.0, + "EndTime": 16500.0, + "Column": 4 + }] + }, { + "RandomW": 2466283411, + "RandomX": 2810584254, + "RandomY": 2250186050, + "RandomZ": 3979422122, + "StartTime": 17000.0, + "Objects": [{ + "StartTime": 17000.0, + "EndTime": 18000.0, + "Column": 2 + }] + }, { + "RandomW": 83157665, + "RandomX": 2250186050, + "RandomY": 3979422122, + "RandomZ": 2466283411, + "StartTime": 18500.0, + "Objects": [{ + "StartTime": 18500.0, + "EndTime": 19450.0, + "Column": 0 + }] + }, { + "RandomW": 2383087700, + "RandomX": 83157665, + "RandomY": 2055150192, + "RandomZ": 510071020, + "StartTime": 19875.0, + "Objects": [{ + "StartTime": 19875.0, + "EndTime": 23875.0, + "Column": 1 + }, { + "StartTime": 19875.0, + "EndTime": 23875.0, + "Column": 0 + }] + }] } \ No newline at end of file From e180d49304356b0d54fe0003467ecd43b70d24e3 Mon Sep 17 00:00:00 2001 From: LastExceed Date: Sat, 23 Jun 2018 16:37:58 +0200 Subject: [PATCH 018/171] preload BASS --- .vscode/launch.json | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index ed67fa92cc..2c781363af 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,12 @@ ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build tests (Debug)", - "env": {}, + "linux": { + "env": { + "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/libbass.so", + "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/", + }, + }, "console": "internalConsole" }, { @@ -24,7 +29,12 @@ ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build tests (Release)", - "env": {}, + "linux": { + "env": { + "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/libbass.so", + "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/", + }, + }, "console": "internalConsole" }, { @@ -37,7 +47,12 @@ ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build osu! (Debug)", - "env": {}, + "linux": { + "env": { + "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/libbass.so", + "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/", + }, + }, "console": "internalConsole" }, { @@ -50,7 +65,12 @@ ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build osu! (Release)", - "env": {}, + "linux": { + "env": { + "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1/libbass.so", + "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1/", + }, + }, "console": "internalConsole" } ] From 1ed6a672f20987336683f354f313400ce1f52c95 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 27 Jun 2018 18:43:29 +0900 Subject: [PATCH 019/171] Update volme control Use IMouseWheelBindingHandler for volume VolumeControlReceptor. VolumeMeter is no longer an IKeyBindingHandler because it is unused. --- osu.Game/OsuGame.cs | 3 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 2 +- .../Overlays/Volume/VolumeControlReceptor.cs | 4 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 62 +++++-------------- osu.Game/Overlays/VolumeOverlay.cs | 6 +- 5 files changed, 23 insertions(+), 54 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ba8685b5b2..bc680193bc 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -247,7 +247,8 @@ namespace osu.Game new VolumeControlReceptor { RelativeSizeAxes = Axes.Both, - ActionRequested = action => volume.Adjust(action) + ActionRequested = action => volume.Adjust(action), + WheelActionRequested = (action, amount, isPrecise) => volume.Adjust(action, amount, isPrecise), }, mainContent = new Container { RelativeSizeAxes = Axes.Both }, overlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue }, diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index a12f9dee7e..d537a68486 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -186,7 +186,7 @@ namespace osu.Game.Overlays.KeyBinding { if (bindTarget.IsHovered) { - bindTarget.UpdateKeyCombination(new KeyCombination(KeyCombination.FromInputState(state).Keys.Append(state.Mouse.ScrollDelta.Y > 0 ? InputKey.MouseWheelUp : InputKey.MouseWheelDown))); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state, state.Mouse.ScrollDelta)); finalise(); return true; } diff --git a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs index 572b3f0c27..bb9aadb888 100644 --- a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs +++ b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs @@ -9,11 +9,13 @@ using osu.Game.Input.Bindings; namespace osu.Game.Overlays.Volume { - public class VolumeControlReceptor : Container, IKeyBindingHandler, IHandleGlobalInput + public class VolumeControlReceptor : Container, IMouseWheelBindingHandler, IHandleGlobalInput { public Func ActionRequested; + public Func WheelActionRequested; public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false; + public bool OnMouseWheel(GlobalAction action, float amount, bool isPrecise) => WheelActionRequested?.Invoke(action, amount, isPrecise) ?? false; public bool OnReleased(GlobalAction action) => false; } } diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 1d392e6ee8..9aeca1f35f 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -12,17 +12,15 @@ using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input; -using osu.Framework.Input.Bindings; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Input.Bindings; using OpenTK; using OpenTK.Graphics; namespace osu.Game.Overlays.Volume { - public class VolumeMeter : Container, IKeyBindingHandler + public class VolumeMeter : Container { private CircularProgress volumeCircle; private CircularProgress volumeCircleGlow; @@ -226,59 +224,27 @@ namespace osu.Game.Overlays.Volume private const float adjust_step = 0.05f; - public void Increase() => adjust(1); - public void Decrease() => adjust(-1); - - private void adjust(int direction) - { - float amount = adjust_step * direction; - - // handle the case where the OnPressed action was actually a mouse wheel. - // this allows for precise wheel handling. - var state = GetContainingInputManager().CurrentState; - if (state.Mouse?.ScrollDelta.Y != 0) - { - OnScroll(state); - return; - } - - Volume += amount; - } - - public bool OnPressed(GlobalAction action) - { - if (!IsHovered) return false; - - switch (action) - { - case GlobalAction.DecreaseVolume: - Decrease(); - return true; - case GlobalAction.IncreaseVolume: - Increase(); - return true; - } - - return false; - } + public void Increase(double amount = 1, bool isPrecise = false) => adjust(amount, isPrecise); + public void Decrease(double amount = 1, bool isPrecise = false) => adjust(-amount, isPrecise); // because volume precision is set to 0.01, this local is required to keep track of more precise adjustments and only apply when possible. - private double scrollAmount; + private double adjustAccumulator; + + private void adjust(double delta, bool isPrecise) + { + adjustAccumulator += delta * adjust_step * (isPrecise ? 0.1 : 1); + if (Math.Abs(adjustAccumulator) < Bindable.Precision) + return; + Volume += adjustAccumulator; + adjustAccumulator = 0; + } protected override bool OnScroll(InputState state) { - scrollAmount += adjust_step * state.Mouse.ScrollDelta.Y * (state.Mouse.HasPreciseScroll ? 0.1f : 1); - - if (Math.Abs(scrollAmount) < Bindable.Precision) - return true; - - Volume += scrollAmount; - scrollAmount = 0; + adjust(state.Mouse.ScrollDelta.Y, state.Mouse.HasPreciseScroll); return true; } - public bool OnReleased(GlobalAction action) => false; - private const float transition_length = 500; protected override bool OnHover(InputState state) diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 1c9c615bbb..e40597b2d4 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -93,7 +93,7 @@ namespace osu.Game.Overlays muteButton.Current.ValueChanged += _ => Show(); } - public bool Adjust(GlobalAction action) + public bool Adjust(GlobalAction action, float amount = 1, bool isPrecise = false) { if (!IsLoaded) return false; @@ -103,13 +103,13 @@ namespace osu.Game.Overlays if (State == Visibility.Hidden) Show(); else - volumeMeterMaster.Decrease(); + volumeMeterMaster.Decrease(amount, isPrecise); return true; case GlobalAction.IncreaseVolume: if (State == Visibility.Hidden) Show(); else - volumeMeterMaster.Increase(); + volumeMeterMaster.Increase(amount, isPrecise); return true; case GlobalAction.ToggleMute: Show(); From d879b96d9f70869d001b4dfc62481eab93591390 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 13:43:56 +0900 Subject: [PATCH 020/171] Implement storyboard samples --- .../Drawables/DrawableStoryboardSample.cs | 68 +++++++++++++++++++ osu.Game/Storyboards/StoryboardSample.cs | 9 +-- 2 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs new file mode 100644 index 0000000000..9a539072d0 --- /dev/null +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -0,0 +1,68 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.IO; +using osu.Framework.Allocation; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Game.Beatmaps; + +namespace osu.Game.Storyboards.Drawables +{ + public class DrawableStoryboardSample : Component + { + /// + /// The amount of time allowable beyond the start time of the sample, for the sample to start. + /// + private const double allowable_late_start = 100; + + private readonly StoryboardSample sample; + private SampleChannel channel; + + public override bool RemoveWhenNotAlive => false; + + public DrawableStoryboardSample(StoryboardSample sample) + { + this.sample = sample; + LifetimeStart = sample.Time; + } + + [BackgroundDependencyLoader] + private void load(IBindableBeatmap beatmap) + { + // Try first with the full name, then attempt with no path + channel = beatmap.Value.Skin.GetSample(sample.Path) ?? beatmap.Value.Skin.GetSample(Path.ChangeExtension(sample.Path, null)); + + if (channel != null) + channel.Volume.Value = sample.Volume / 100; + } + + protected override void Update() + { + base.Update(); + + if (Time.Current < sample.Time) + { + // We've rewound before the start time of the sample + channel?.Stop(); + + // In the case that the user fast-forwards to a point far beyond the start time of the sample, + // we want to be able to fall into the if-conditional below (therefore we must not have a life time end) + LifetimeStart = sample.Time; + LifetimeEnd = double.MaxValue; + } + else if (Time.Current - Time.Elapsed < sample.Time) + { + // We've passed the start time of the sample. We only play the sample if we're within an allowable range + // from the sample's start, to reduce layering if we've been fast-forwarded far into the future + if (Time.Current - sample.Time < allowable_late_start) + channel?.Play(); + + // In the case that the user rewinds to a point far behind the start time of the sample, + // we want to be able to fall into the if-conditional above (therefore we must not have a life time start) + LifetimeStart = double.MinValue; + LifetimeEnd = sample.Time; + } + } + } +} diff --git a/osu.Game/Storyboards/StoryboardSample.cs b/osu.Game/Storyboards/StoryboardSample.cs index d0555493a6..c34a39a7bf 100644 --- a/osu.Game/Storyboards/StoryboardSample.cs +++ b/osu.Game/Storyboards/StoryboardSample.cs @@ -2,14 +2,14 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using System; +using osu.Game.Storyboards.Drawables; namespace osu.Game.Storyboards { public class StoryboardSample : IStoryboardElement { public string Path { get; set; } - public bool IsDrawable => false; + public bool IsDrawable => true; public double Time; public float Volume; @@ -21,9 +21,6 @@ namespace osu.Game.Storyboards Volume = volume; } - public Drawable CreateDrawable() - { - throw new InvalidOperationException(); - } + public Drawable CreateDrawable() => new DrawableStoryboardSample(this); } } From 2882981f9c2494a84ddf8f055f860434437d0608 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 18:08:46 +0900 Subject: [PATCH 021/171] Implement and use equality comparers for ControlPoint --- .../Beatmaps/ControlPoints/ControlPoint.cs | 8 +- .../ControlPoints/DifficultyControlPoint.cs | 5 ++ .../ControlPoints/EffectControlPoint.cs | 6 ++ .../ControlPoints/SampleControlPoint.cs | 6 ++ .../ControlPoints/TimingControlPoint.cs | 6 ++ .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 81 ++++++++++++------- 6 files changed, 82 insertions(+), 30 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index db9e712d86..e1e5affc78 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -14,6 +14,12 @@ namespace osu.Game.Beatmaps.ControlPoints public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); - public bool Equals(ControlPoint other) => Time.Equals(other?.Time); + public virtual bool Equals(ControlPoint other) + { + if (ReferenceEquals(null, other)) return false; + if (ReferenceEquals(this, other)) return true; + + return Time.Equals(other.Time); + } } } diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 9f717d21e3..9c6735a36a 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -17,5 +17,10 @@ namespace osu.Game.Beatmaps.ControlPoints } private double speedMultiplier = 1; + + public override bool Equals(ControlPoint other) + => base.Equals(other) + && other is DifficultyControlPoint difficulty + && SpeedMultiplier == difficulty.SpeedMultiplier; } } diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 73d5232f44..6fdddc44bb 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -14,5 +14,11 @@ namespace osu.Game.Beatmaps.ControlPoints /// Whether the first bar line of this control point is ignored. /// public bool OmitFirstBarLine; + + public override bool Equals(ControlPoint other) + => base.Equals(other) + && other is EffectControlPoint effect + && KiaiMode == effect.KiaiMode + && OmitFirstBarLine == effect.OmitFirstBarLine; } } diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 5d801a1163..69c00e463c 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -30,5 +30,11 @@ namespace osu.Game.Beatmaps.ControlPoints Name = sampleName, Volume = SampleVolume, }; + + public override bool Equals(ControlPoint other) + => base.Equals(other) + && other is SampleControlPoint sample + && SampleBank == sample.SampleBank + && SampleVolume == sample.SampleVolume; } } diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index d20b1b87a6..cc1546675b 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -23,5 +23,11 @@ namespace osu.Game.Beatmaps.ControlPoints } private double beatLength = 1000; + + public override bool Equals(ControlPoint other) + => base.Equals(other) + && other is TimingControlPoint timing + && TimeSignature == timing.TimeSignature + && BeatLength == timing.beatLength; } } diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 581207607a..603de5949e 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -314,13 +314,9 @@ namespace osu.Game.Beatmaps.Formats if (stringSampleSet == @"none") stringSampleSet = @"normal"; - DifficultyControlPoint difficultyPoint = beatmap.ControlPointInfo.DifficultyPointAt(time); - SampleControlPoint samplePoint = beatmap.ControlPointInfo.SamplePointAt(time); - EffectControlPoint effectPoint = beatmap.ControlPointInfo.EffectPointAt(time); - if (timingChange) { - beatmap.ControlPointInfo.TimingPoints.Add(new TimingControlPoint + handleTimingControlPoint(new TimingControlPoint { Time = time, BeatLength = beatLength, @@ -328,41 +324,68 @@ namespace osu.Game.Beatmaps.Formats }); } - if (speedMultiplier != difficultyPoint.SpeedMultiplier) + handleDifficultyControlPoint(new DifficultyControlPoint { - beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == time); - beatmap.ControlPointInfo.DifficultyPoints.Add(new DifficultyControlPoint - { - Time = time, - SpeedMultiplier = speedMultiplier - }); - } + Time = time, + SpeedMultiplier = speedMultiplier + }); - if (stringSampleSet != samplePoint.SampleBank || sampleVolume != samplePoint.SampleVolume) + handleEffectControlPoint(new EffectControlPoint { - beatmap.ControlPointInfo.SamplePoints.Add(new SampleControlPoint - { - Time = time, - SampleBank = stringSampleSet, - SampleVolume = sampleVolume - }); - } + Time = time, + KiaiMode = kiaiMode, + OmitFirstBarLine = omitFirstBarSignature + }); - if (kiaiMode != effectPoint.KiaiMode || omitFirstBarSignature != effectPoint.OmitFirstBarLine) + handleSampleControlPoint(new LegacySampleControlPoint { - beatmap.ControlPointInfo.EffectPoints.Add(new EffectControlPoint - { - Time = time, - KiaiMode = kiaiMode, - OmitFirstBarLine = omitFirstBarSignature - }); - } + Time = time, + SampleBank = stringSampleSet, + SampleVolume = sampleVolume, + CustomSampleBank = customSampleBank + }); } catch (FormatException e) { } } + private void handleTimingControlPoint(TimingControlPoint newPoint) + { + beatmap.ControlPointInfo.TimingPoints.Add(newPoint); + } + + private void handleDifficultyControlPoint(DifficultyControlPoint newPoint) + { + var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time); + + if (newPoint.Equals(existing)) + return; + + beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time); + beatmap.ControlPointInfo.DifficultyPoints.Add(newPoint); + } + + private void handleEffectControlPoint(EffectControlPoint newPoint) + { + var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time); + + if (newPoint.Equals(existing)) + return; + + beatmap.ControlPointInfo.EffectPoints.Add(newPoint); + } + + private void handleSampleControlPoint(SampleControlPoint newPoint) + { + var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time); + + if (newPoint.Equals(existing)) + return; + + beatmap.ControlPointInfo.SamplePoints.Add(newPoint); + } + private void handleHitObject(string line) { // If the ruleset wasn't specified, assume the osu!standard ruleset. From 781095b96bd781bc930ed65a571cadc42467fc64 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 18:20:29 +0900 Subject: [PATCH 022/171] Encapsulate the method to apply SampleControlPoints to SampleInfos --- .../Beatmaps/ControlPoints/SampleControlPoint.cs | 12 ++++++++++++ .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 13 ++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 69c00e463c..ae65e7ea42 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -31,6 +31,18 @@ namespace osu.Game.Beatmaps.ControlPoints Volume = SampleVolume, }; + /// + /// Applies and to a if necessary, returning the modified . + /// + /// The . This will not be modified. + /// The modified . This does not share a reference with . + public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) => new SampleInfo + { + Bank = sampleInfo.Bank ?? SampleBank, + Name = sampleInfo.Name, + Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume + }; + public override bool Equals(ControlPoint other) => base.Equals(other) && other is SampleControlPoint sample diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 88990d435c..4892e20814 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -90,13 +90,12 @@ namespace osu.Game.Rulesets.Objects.Drawables if (HitObject.SampleControlPoint == null) throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}." + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}."); - AddInternal(Samples = new SkinnableSound(samples.Select(s => new SampleInfo - { - Bank = s.Bank ?? HitObject.SampleControlPoint.SampleBank, - Name = s.Name, - Volume = s.Volume > 0 ? s.Volume : HitObject.SampleControlPoint.SampleVolume, - Namespace = SampleNamespace - }).ToArray())); + + samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray(); + foreach (var s in samples) + s.Namespace = SampleNamespace; + + AddInternal(Samples = new SkinnableSound(samples)); } } From 3a9a82c80c5c2d6a2843fa5cb64432d2d0ce455b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 18:20:43 +0900 Subject: [PATCH 023/171] Add back legacy custom sample banks --- .../Formats/LegacyBeatmapDecoderTest.cs | 17 ++++++++++++++ osu.Game.Tests/Resources/custom-samples.osu | 16 ++++++++++++++ .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 6 ++--- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 22 +++++++++++++++++++ 4 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 osu.Game.Tests/Resources/custom-samples.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 1628423fe8..a77730c453 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -8,6 +8,7 @@ using OpenTK.Graphics; using osu.Game.Tests.Resources; using System.Linq; using osu.Game.Audio; +using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; @@ -211,5 +212,21 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.IsTrue(hitObjects[1].Samples.Any(s => s.Name == SampleInfo.HIT_CLAP)); } } + + [Test] + public void TestDecodeCustomSamples() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + using (var resStream = Resource.OpenResource("custom-samples.osu")) + using (var stream = new StreamReader(resStream)) + { + var hitObjects = decoder.Decode(stream).HitObjects; + + Assert.AreEqual(0, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[0].SampleControlPoint).CustomSampleBank); + Assert.AreEqual(1, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[1].SampleControlPoint).CustomSampleBank); + Assert.AreEqual(2, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[2].SampleControlPoint).CustomSampleBank); + Assert.AreEqual(0, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[3].SampleControlPoint).CustomSampleBank); + } + } } } diff --git a/osu.Game.Tests/Resources/custom-samples.osu b/osu.Game.Tests/Resources/custom-samples.osu new file mode 100644 index 0000000000..1e0e6f558e --- /dev/null +++ b/osu.Game.Tests/Resources/custom-samples.osu @@ -0,0 +1,16 @@ +osu file format v14 + +[General] +SampleSet: Normal + +[TimingPoints] +2170,468.75,4,1,0,40,1,0 +2638,-100,4,1,1,40,0,0 +3107,-100,4,1,2,40,0,0 +3576,-100,4,1,0,40,0,0 + +[HitObjects] +255,193,2170,1,0,0:0:0:0: +256,191,2638,5,0,0:0:0:0: +255,193,3107,1,0,0:0:0:0: +256,191,3576,1,0,0:0:0:0: diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 603de5949e..f33e963f08 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -289,9 +289,9 @@ namespace osu.Game.Beatmaps.Formats if (split.Length >= 4) sampleSet = (LegacySampleBank)int.Parse(split[3]); - //SampleBank sampleBank = SampleBank.Default; - //if (split.Length >= 5) - // sampleBank = (SampleBank)int.Parse(split[4]); + int customSampleBank = 0; + if (split.Length >= 5) + customSampleBank = int.Parse(split[4]); int sampleVolume = defaultSampleVolume; if (split.Length >= 6) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index e77efd8508..c207761866 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -5,6 +5,8 @@ using System; using System.Collections.Generic; using System.IO; using osu.Framework.Logging; +using osu.Game.Audio; +using osu.Game.Beatmaps.ControlPoints; using OpenTK.Graphics; namespace osu.Game.Beatmaps.Formats @@ -167,5 +169,25 @@ namespace osu.Game.Beatmaps.Formats Pass = 2, Foreground = 3 } + + internal class LegacySampleControlPoint : SampleControlPoint + { + public int CustomSampleBank; + + public override SampleInfo ApplyTo(SampleInfo sampleInfo) + { + var baseInfo = base.ApplyTo(sampleInfo); + + if (CustomSampleBank > 0) + baseInfo.Name += CustomSampleBank; + + return baseInfo; + } + + public override bool Equals(ControlPoint other) + => base.Equals(other) + && other is LegacySampleControlPoint legacy + && CustomSampleBank == legacy.CustomSampleBank; + } } } From 94f1b2eeb867d2ff457b66a6a4b26f1ca8a8ff72 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 18:27:33 +0900 Subject: [PATCH 024/171] Only custom sample banks > 1 modify the filename --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 11 +++++++---- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index a77730c453..4be6eeef0d 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -12,6 +12,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; +using osu.Game.Rulesets.Objects; using osu.Game.Skinning; namespace osu.Game.Tests.Beatmaps.Formats @@ -222,11 +223,13 @@ namespace osu.Game.Tests.Beatmaps.Formats { var hitObjects = decoder.Decode(stream).HitObjects; - Assert.AreEqual(0, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[0].SampleControlPoint).CustomSampleBank); - Assert.AreEqual(1, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[1].SampleControlPoint).CustomSampleBank); - Assert.AreEqual(2, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[2].SampleControlPoint).CustomSampleBank); - Assert.AreEqual(0, ((LegacyDecoder.LegacySampleControlPoint)hitObjects[3].SampleControlPoint).CustomSampleBank); + Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[0]).Name); + Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[1]).Name); + Assert.AreEqual("hitnormal2", getTestableSampleInfo(hitObjects[2]).Name); + Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[3]).Name); } + + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); } } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index c207761866..60fff4bd7f 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -178,7 +178,7 @@ namespace osu.Game.Beatmaps.Formats { var baseInfo = base.ApplyTo(sampleInfo); - if (CustomSampleBank > 0) + if (CustomSampleBank > 1) baseInfo.Name += CustomSampleBank; return baseInfo; From 9fd9af22f0f2a2370177fe93568340a0d7e1fd49 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Jun 2018 18:40:12 +0900 Subject: [PATCH 025/171] Remove unused using --- osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 4be6eeef0d..d3c61960bb 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -8,7 +8,6 @@ using OpenTK.Graphics; using osu.Game.Tests.Resources; using System.Linq; using osu.Game.Audio; -using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects.Types; using osu.Game.Beatmaps.Formats; using osu.Game.Beatmaps.Timing; From aea50e770b6a58f4e196cbf33bb2db1701248862 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 13:23:59 +0900 Subject: [PATCH 026/171] Use .Equals everywhere --- osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs | 2 +- osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs | 4 ++-- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 4 ++-- osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 9c6735a36a..296dcf66b1 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -21,6 +21,6 @@ namespace osu.Game.Beatmaps.ControlPoints public override bool Equals(ControlPoint other) => base.Equals(other) && other is DifficultyControlPoint difficulty - && SpeedMultiplier == difficulty.SpeedMultiplier; + && SpeedMultiplier.Equals(difficulty.SpeedMultiplier); } } diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 6fdddc44bb..e41fb3a1d3 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps.ControlPoints public override bool Equals(ControlPoint other) => base.Equals(other) && other is EffectControlPoint effect - && KiaiMode == effect.KiaiMode - && OmitFirstBarLine == effect.OmitFirstBarLine; + && KiaiMode.Equals(effect.KiaiMode) + && OmitFirstBarLine.Equals(effect.OmitFirstBarLine); } } diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index ae65e7ea42..c4d6ad24a0 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -46,7 +46,7 @@ namespace osu.Game.Beatmaps.ControlPoints public override bool Equals(ControlPoint other) => base.Equals(other) && other is SampleControlPoint sample - && SampleBank == sample.SampleBank - && SampleVolume == sample.SampleVolume; + && SampleBank.Equals(sample.SampleBank) + && SampleVolume.Equals(sample.SampleVolume); } } diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index cc1546675b..3e4e2a0bb1 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -27,7 +27,7 @@ namespace osu.Game.Beatmaps.ControlPoints public override bool Equals(ControlPoint other) => base.Equals(other) && other is TimingControlPoint timing - && TimeSignature == timing.TimeSignature - && BeatLength == timing.beatLength; + && TimeSignature.Equals(timing.TimeSignature) + && BeatLength.Equals(timing.BeatLength); } } From c78bfbfa55f9d49f0a20d1184820ede77259c964 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 13:24:09 +0900 Subject: [PATCH 027/171] Fix failing json conversion testcases --- osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs index b834be71f1..64bd563897 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs @@ -118,7 +118,11 @@ namespace osu.Game.Tests.Beatmaps.Formats public void TestParity(string beatmap) { var legacy = decode(beatmap, out Beatmap json); - json.WithDeepEqual(legacy).IgnoreProperty(r => r.DeclaringType == typeof(HitWindows)).Assert(); + json.WithDeepEqual(legacy) + .IgnoreProperty(r => r.DeclaringType == typeof(HitWindows) + // Todo: CustomSampleBank shouldn't exist going forward, we need a conversion mechanism + || r.Name == nameof(LegacyDecoder.LegacySampleControlPoint.CustomSampleBank)) + .Assert(); } /// From b664d3ef8176662bfe44855394fcba78a268955b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 13:33:59 +0900 Subject: [PATCH 028/171] Fix time being a part of controlpoint change comparisons --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 15 +++++++++------ .../ControlPoints/DifficultyControlPoint.cs | 4 ++-- .../Beatmaps/ControlPoints/EffectControlPoint.cs | 4 ++-- .../Beatmaps/ControlPoints/SampleControlPoint.cs | 4 ++-- .../Beatmaps/ControlPoints/TimingControlPoint.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 6 +++--- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 ++-- 7 files changed, 22 insertions(+), 19 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index e1e5affc78..cf6d9a3ccd 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -14,12 +14,15 @@ namespace osu.Game.Beatmaps.ControlPoints public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); - public virtual bool Equals(ControlPoint other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; + /// + /// Whether this provides the same changes to gameplay as another . + /// + /// The to compare to. + /// Whether this provides the same changes to gameplay as . + public virtual bool ChangeEquals(ControlPoint other) => !ReferenceEquals(null, other); - return Time.Equals(other.Time); - } + public bool Equals(ControlPoint other) + => ChangeEquals(other) + && Time.Equals(other.Time); } } diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index 296dcf66b1..f821ff11f4 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -18,8 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints private double speedMultiplier = 1; - public override bool Equals(ControlPoint other) - => base.Equals(other) + public override bool ChangeEquals(ControlPoint other) + => base.ChangeEquals(other) && other is DifficultyControlPoint difficulty && SpeedMultiplier.Equals(difficulty.SpeedMultiplier); } diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index e41fb3a1d3..0cbdf7fdf2 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps.ControlPoints /// public bool OmitFirstBarLine; - public override bool Equals(ControlPoint other) - => base.Equals(other) + public override bool ChangeEquals(ControlPoint other) + => base.ChangeEquals(other) && other is EffectControlPoint effect && KiaiMode.Equals(effect.KiaiMode) && OmitFirstBarLine.Equals(effect.OmitFirstBarLine); diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index c4d6ad24a0..11de392d14 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -43,8 +43,8 @@ namespace osu.Game.Beatmaps.ControlPoints Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume }; - public override bool Equals(ControlPoint other) - => base.Equals(other) + public override bool ChangeEquals(ControlPoint other) + => base.ChangeEquals(other) && other is SampleControlPoint sample && SampleBank.Equals(sample.SampleBank) && SampleVolume.Equals(sample.SampleVolume); diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 3e4e2a0bb1..8fe3257786 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints private double beatLength = 1000; - public override bool Equals(ControlPoint other) - => base.Equals(other) + public override bool ChangeEquals(ControlPoint other) + => base.ChangeEquals(other) && other is TimingControlPoint timing && TimeSignature.Equals(timing.TimeSignature) && BeatLength.Equals(timing.BeatLength); diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index f33e963f08..fe55d19908 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time); - if (newPoint.Equals(existing)) + if (newPoint.ChangeEquals(existing)) return; beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time); @@ -370,7 +370,7 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time); - if (newPoint.Equals(existing)) + if (newPoint.ChangeEquals(existing)) return; beatmap.ControlPointInfo.EffectPoints.Add(newPoint); @@ -380,7 +380,7 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time); - if (newPoint.Equals(existing)) + if (newPoint.ChangeEquals(existing)) return; beatmap.ControlPointInfo.SamplePoints.Add(newPoint); diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 60fff4bd7f..f5e3a34462 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -184,8 +184,8 @@ namespace osu.Game.Beatmaps.Formats return baseInfo; } - public override bool Equals(ControlPoint other) - => base.Equals(other) + public override bool ChangeEquals(ControlPoint other) + => base.ChangeEquals(other) && other is LegacySampleControlPoint legacy && CustomSampleBank == legacy.CustomSampleBank; } From 37495c34faa7a02852934d2d9db0dab9e2492a66 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Mon, 2 Jul 2018 13:51:47 +0900 Subject: [PATCH 029/171] Fix possible nullreference --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index cf6d9a3ccd..90c0ded38f 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -23,6 +23,7 @@ namespace osu.Game.Beatmaps.ControlPoints public bool Equals(ControlPoint other) => ChangeEquals(other) + && !ReferenceEquals(null, other) && Time.Equals(other.Time); } } From 8b0c6a4c855509aa3de33ddd97e33b70525ab5d8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 14:17:19 +0900 Subject: [PATCH 030/171] Make SampleControlPoint clone the existing SampleInfo --- osu.Game/Audio/SampleInfo.cs | 2 ++ .../Beatmaps/ControlPoints/SampleControlPoint.cs | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index f635b74030..53b6e439f5 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -32,5 +32,7 @@ namespace osu.Game.Audio /// The sample volume. /// public int Volume; + + public SampleInfo Clone() => (SampleInfo)MemberwiseClone(); } } diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 11de392d14..77d42551c6 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -36,12 +36,14 @@ namespace osu.Game.Beatmaps.ControlPoints /// /// The . This will not be modified. /// The modified . This does not share a reference with . - public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) => new SampleInfo + public virtual SampleInfo ApplyTo(SampleInfo sampleInfo) { - Bank = sampleInfo.Bank ?? SampleBank, - Name = sampleInfo.Name, - Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume - }; + var newSampleInfo = sampleInfo.Clone(); + newSampleInfo.Bank = sampleInfo.Bank ?? SampleBank; + newSampleInfo.Name = sampleInfo.Name; + newSampleInfo.Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume; + return newSampleInfo; + } public override bool ChangeEquals(ControlPoint other) => base.ChangeEquals(other) From 310c4a7d6c04213b93a38082a3a225533a3cdc0d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 14:18:41 +0900 Subject: [PATCH 031/171] Make SampleInfo choose its own lookup name --- osu.Game/Audio/SampleInfo.cs | 7 +++++++ osu.Game/Skinning/SkinnableSound.cs | 18 ++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 53b6e439f5..7906a6012f 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Collections.Generic; namespace osu.Game.Audio { @@ -33,6 +34,12 @@ namespace osu.Game.Audio /// public int Volume; + public virtual IEnumerable LookupNames => new[] + { + $"{Namespace}/{Bank}-{Name}", + $"{Bank}-{Name}" // Without namespace as a fallback + }; + public SampleInfo Clone() => (SampleInfo)MemberwiseClone(); } } diff --git a/osu.Game/Skinning/SkinnableSound.cs b/osu.Game/Skinning/SkinnableSound.cs index 1a11b0c03e..2fc9cff463 100644 --- a/osu.Game/Skinning/SkinnableSound.cs +++ b/osu.Game/Skinning/SkinnableSound.cs @@ -44,19 +44,17 @@ namespace osu.Game.Skinning private SampleChannel loadChannel(SampleInfo info, Func getSampleFunction) { - SampleChannel ch = null; + foreach (var lookup in info.LookupNames) + { + var ch = getSampleFunction($"Gameplay/{lookup}"); + if (ch == null) + continue; - if (info.Namespace != null) - ch = getSampleFunction($"Gameplay/{info.Namespace}/{info.Bank}-{info.Name}"); - - // try without namespace as a fallback. - if (ch == null) - ch = getSampleFunction($"Gameplay/{info.Bank}-{info.Name}"); - - if (ch != null) ch.Volume.Value = info.Volume / 100.0; + return ch; + } - return ch; + return null; } } } From 73fac2115a286570e8673d0be0194a45037c8e61 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 14:20:35 +0900 Subject: [PATCH 032/171] Implement hitobject sample files --- .../Objects/Legacy/ConvertHitObjectParser.cs | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 9edd0f1f34..8a996cfe30 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -6,6 +6,7 @@ using osu.Game.Rulesets.Objects.Types; using System; using System.Collections.Generic; using System.Globalization; +using System.IO; using osu.Game.Beatmaps.Formats; using osu.Game.Audio; using System.Linq; @@ -196,8 +197,7 @@ namespace osu.Game.Rulesets.Objects.Legacy var bank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[0]); var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[1]); - // Let's not implement this for now, because this doesn't fit nicely into the bank structure - //string sampleFile = split2.Length > 4 ? split2[4] : string.Empty; + bankInfo.Filename = split.Length > 4 ? split[4] : null; string stringBank = bank.ToString().ToLower(); if (stringBank == @"none") @@ -252,6 +252,10 @@ namespace osu.Game.Rulesets.Objects.Legacy private List convertSoundType(LegacySoundType type, SampleBankInfo bankInfo) { + // Todo: This should return the normal SampleInfos if the specified sample file isn't found, but that's a pretty edge-case scenario + if (!string.IsNullOrEmpty(bankInfo.Filename)) + return new List { new FileSampleInfo { Filename = bankInfo.Filename } }; + var soundTypes = new List { new SampleInfo @@ -297,14 +301,24 @@ namespace osu.Game.Rulesets.Objects.Legacy private class SampleBankInfo { + public string Filename; + public string Normal; public string Add; public int Volume; - public SampleBankInfo Clone() + public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone(); + } + + private class FileSampleInfo : SampleInfo + { + public string Filename; + + public override IEnumerable LookupNames => new[] { - return (SampleBankInfo)MemberwiseClone(); - } + Filename, + Path.ChangeExtension(Filename, null) + }; } [Flags] From 7f832e34c05fab9975b83f8b4f7a8e175510fd60 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 14:29:18 +0900 Subject: [PATCH 033/171] Reorder sample bank property setters --- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 8a996cfe30..95589d8953 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -197,8 +197,6 @@ namespace osu.Game.Rulesets.Objects.Legacy var bank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[0]); var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[1]); - bankInfo.Filename = split.Length > 4 ? split[4] : null; - string stringBank = bank.ToString().ToLower(); if (stringBank == @"none") stringBank = null; @@ -211,6 +209,8 @@ namespace osu.Game.Rulesets.Objects.Legacy if (split.Length > 3) bankInfo.Volume = int.Parse(split[3]); + + bankInfo.Filename = split.Length > 4 ? split[4] : null; } /// From 189194ee8d3e36261152760dc66a7437ec8adf49 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 14:35:03 +0900 Subject: [PATCH 034/171] Don't include empty namespace in sample lookup --- osu.Game/Audio/SampleInfo.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 7906a6012f..3d76184e09 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -34,11 +34,16 @@ namespace osu.Game.Audio /// public int Volume; - public virtual IEnumerable LookupNames => new[] + public virtual IEnumerable LookupNames { - $"{Namespace}/{Bank}-{Name}", - $"{Bank}-{Name}" // Without namespace as a fallback - }; + get + { + if (!string.IsNullOrEmpty(Namespace)) + yield return $"{Namespace}/{Bank}-{Name}"; + + yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace + } + } public SampleInfo Clone() => (SampleInfo)MemberwiseClone(); } From c1b8799253e4ab2f4789306308925b9b20be326a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 2 Jul 2018 14:40:43 +0900 Subject: [PATCH 035/171] Add simple testcase --- .../Formats/LegacyBeatmapDecoderTest.cs | 18 ++++++++++++++++++ .../Resources/custom-hitobject-samples.osu | 16 ++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 osu.Game.Tests/Resources/custom-hitobject-samples.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index d3c61960bb..ad203d2107 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -230,5 +230,23 @@ namespace osu.Game.Tests.Beatmaps.Formats SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); } + + [Test] + public void TestDecodeCustomHitObjectSamples() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + using (var resStream = Resource.OpenResource("custom-hitobject-samples.osu")) + using (var stream = new StreamReader(resStream)) + { + var hitObjects = decoder.Decode(stream).HitObjects; + + Assert.AreEqual("hit_1.wav", hitObjects[0].Samples[0].LookupNames.First()); + Assert.AreEqual("hit_2.wav", hitObjects[1].Samples[0].LookupNames.First()); + Assert.AreEqual("hitnormal2", getTestableSampleInfo(hitObjects[2]).Name); + Assert.AreEqual("hit_1.wav", hitObjects[3].Samples[0].LookupNames.First()); + } + + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); + } } } diff --git a/osu.Game.Tests/Resources/custom-hitobject-samples.osu b/osu.Game.Tests/Resources/custom-hitobject-samples.osu new file mode 100644 index 0000000000..588672e2d9 --- /dev/null +++ b/osu.Game.Tests/Resources/custom-hitobject-samples.osu @@ -0,0 +1,16 @@ +osu file format v14 + +[General] +SampleSet: Normal + +[TimingPoints] +2170,468.75,4,1,0,40,1,0 +2638,-100,4,1,1,40,0,0 +3107,-100,4,1,2,40,0,0 +3576,-100,4,1,0,40,0,0 + +[HitObjects] +255,193,2170,1,0,0:0:0:0:hit_1.wav +256,191,2638,5,0,0:0:0:0:hit_2.wav +255,193,3107,1,0,0:0:0:0: +256,191,3576,1,0,0:0:0:0:hit_1.wav From d476842c4462e04a9dcdad598c13a7938c1c1384 Mon Sep 17 00:00:00 2001 From: Joehu Date: Mon, 2 Jul 2018 22:03:17 -0700 Subject: [PATCH 036/171] Fix FooterButton clicking area --- osu.Game/Screens/Select/FooterButton.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 602b03380c..3fa12283b5 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -55,6 +55,8 @@ namespace osu.Game.Screens.Select private readonly Box box; private readonly Box light; + public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos); + public FooterButton() { Children = new Drawable[] From f9f192ce3439a5649cf86ee091d3b01dcc4a93d3 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Mon, 2 Jul 2018 16:28:05 +0900 Subject: [PATCH 037/171] Modify MenuCursor hightlight animation --- osu.Game/Graphics/Cursor/MenuCursor.cs | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 0bb33930b0..14a976f0c0 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -68,11 +68,15 @@ namespace osu.Game.Graphics.Cursor protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - ActiveCursor.Scale = new Vector2(1); - ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint); + // only trigger animation for main mouse buttons + if (args.Button <= MouseButton.Right) + { + ActiveCursor.Scale = new Vector2(1); + ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint); - ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0; - ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); + ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0; + ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); + } if (args.Button == MouseButton.Left && cursorRotate) { @@ -86,7 +90,7 @@ namespace osu.Game.Graphics.Cursor { if (!state.Mouse.HasMainButtonPressed) { - ((Cursor)ActiveCursor).AdditiveLayer.FadeOut(500, Easing.OutQuint); + ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); ActiveCursor.ScaleTo(1, 500, Easing.OutElastic); } @@ -99,13 +103,6 @@ namespace osu.Game.Graphics.Cursor return base.OnMouseUp(state, args); } - protected override bool OnClick(InputState state) - { - ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); - - return base.OnClick(state); - } - protected override void PopIn() { ActiveCursor.FadeTo(1, 250, Easing.OutQuint); From 2aae528e1ccf08e0feb586a83faf02c3205de8d3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 3 Jul 2018 18:18:04 +0900 Subject: [PATCH 038/171] Improve code quality of main menu button system --- osu.Game.Tests/Visual/TestCaseButtonSystem.cs | 13 ++ osu.Game/Screens/Menu/Button.cs | 36 ++- osu.Game/Screens/Menu/ButtonArea.cs | 148 ++++++++++++ osu.Game/Screens/Menu/ButtonSystem.cs | 217 +++++------------- osu.Game/Screens/Menu/MainMenu.cs | 10 +- 5 files changed, 263 insertions(+), 161 deletions(-) create mode 100644 osu.Game/Screens/Menu/ButtonArea.cs diff --git a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs index 5eb81cdf9f..7f8133d638 100644 --- a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs +++ b/osu.Game.Tests/Visual/TestCaseButtonSystem.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; +using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -13,6 +16,13 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseButtonSystem : OsuTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ButtonSystem), + typeof(ButtonArea), + typeof(Button) + }; + public TestCaseButtonSystem() { OsuLogo logo; @@ -30,6 +40,9 @@ namespace osu.Game.Tests.Visual }; buttons.SetOsuLogo(logo); + + foreach (var s in Enum.GetValues(typeof(ButtonSystemState)).OfType().Skip(1)) + AddStep($"State to {s}", () => buttons.State = s); } } } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 542ddd2c92..f862905b5e 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -35,6 +35,12 @@ namespace osu.Game.Screens.Menu private readonly Box boxHoverLayer; private readonly SpriteIcon icon; private readonly string sampleName; + + /// + /// The menu state for which we are visible for. + /// + public ButtonSystemState? VisibleState; + private readonly Action clickAction; private readonly Key triggerKey; private SampleChannel sampleClick; @@ -51,7 +57,7 @@ namespace osu.Game.Screens.Menu AutoSizeAxes = Axes.Both; Alpha = 0; - Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonSystem.BUTTON_AREA_HEIGHT); + Vector2 boxSize = new Vector2(ButtonSystem.BUTTON_WIDTH + Math.Abs(extraWidth), ButtonArea.BUTTON_AREA_HEIGHT); Children = new Drawable[] { @@ -260,6 +266,7 @@ namespace osu.Game.Screens.Menu this.FadeOut(800); break; } + break; case ButtonState.Expanded: const int expand_duration = 500; @@ -276,6 +283,33 @@ namespace osu.Game.Screens.Menu StateChanged?.Invoke(State); } } + + public ButtonSystemState ButtonSystemState + { + set + { + ContractStyle = 0; + + switch (value) + { + case ButtonSystemState.Initial: + State = ButtonState.Contracted; + break; + case ButtonSystemState.EnteringMode: + ContractStyle = 1; + State = ButtonState.Contracted; + break; + default: + if (!VisibleState.HasValue || value == VisibleState) + State = ButtonState.Expanded; + else if (value < VisibleState) + State = ButtonState.Contracted; + else + State = ButtonState.Exploded; + break; + } + } + } } public enum ButtonState diff --git a/osu.Game/Screens/Menu/ButtonArea.cs b/osu.Game/Screens/Menu/ButtonArea.cs new file mode 100644 index 0000000000..06004405b6 --- /dev/null +++ b/osu.Game/Screens/Menu/ButtonArea.cs @@ -0,0 +1,148 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using osu.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using OpenTK; + +namespace osu.Game.Screens.Menu +{ + public class ButtonArea : Container, IStateful + { + public FlowContainerWithOrigin Flow; + + protected override Container Content => Flow; + + private readonly ButtonAreaBackground buttonAreaBackground; + private Visibility state; + + public const float BUTTON_AREA_HEIGHT = 100; + + public ButtonArea() + { + RelativeSizeAxes = Axes.Both; + InternalChild = new Container + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Size = new Vector2(1, BUTTON_AREA_HEIGHT), + Alpha = 0, + Children = new Drawable[] + { + buttonAreaBackground = new ButtonAreaBackground(), + Flow = new FlowContainerWithOrigin + { + Direction = FillDirection.Horizontal, + Spacing = new Vector2(-ButtonSystem.WEDGE_WIDTH, 0), + Anchor = Anchor.Centre, + AutoSizeAxes = Axes.Both, + } + } + }; + } + + public ButtonSystemState ButtonSystemState + { + set + { + switch (value) + { + case ButtonSystemState.Exit: + case ButtonSystemState.Initial: + case ButtonSystemState.EnteringMode: + State = Visibility.Hidden; + break; + case ButtonSystemState.TopLevel: + case ButtonSystemState.Play: + State = Visibility.Visible; + break; + } + + buttonAreaBackground.ButtonSystemState = value; + } + } + + public Visibility State + { + get => state; + set + { + if (value == state) return; + + state = value; + InternalChild.FadeTo(state == Visibility.Hidden ? 0 : 1, 300); + StateChanged?.Invoke(state); + } + } + + public event Action StateChanged; + + private class ButtonAreaBackground : Box, IStateful + { + private ButtonAreaBackgroundState state; + + public ButtonAreaBackground() + { + RelativeSizeAxes = Axes.Both; + Size = new Vector2(2, 1); + Colour = OsuColour.Gray(50); + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + } + + public ButtonAreaBackgroundState State + { + get => state; + set + { + if (value == state) return; + + state = value; + + switch (state) + { + case ButtonAreaBackgroundState.Flat: + this.ScaleTo(new Vector2(2, 0), 300, Easing.InSine); + break; + case ButtonAreaBackgroundState.Normal: + this.ScaleTo(Vector2.One, 400, Easing.OutQuint); + break; + } + + StateChanged?.Invoke(state); + } + } + + public ButtonSystemState ButtonSystemState + { + set + { + switch (value) + { + default: + State = ButtonAreaBackgroundState.Normal; + break; + case ButtonSystemState.Initial: + case ButtonSystemState.Exit: + case ButtonSystemState.EnteringMode: + State = ButtonAreaBackgroundState.Flat; + break; + } + } + } + + public event Action StateChanged; + } + + public enum ButtonAreaBackgroundState + { + Normal, + Flat + } + } +} diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 374877673f..4f2437cf01 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -10,9 +10,9 @@ using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Logging; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; @@ -23,9 +23,9 @@ using OpenTK.Input; namespace osu.Game.Screens.Menu { - public class ButtonSystem : Container, IStateful, IKeyBindingHandler + public class ButtonSystem : Container, IStateful, IKeyBindingHandler { - public event Action StateChanged; + public event Action StateChanged; public Action OnEdit; public Action OnExit; @@ -34,12 +34,6 @@ namespace osu.Game.Screens.Menu public Action OnSettings; public Action OnMulti; public Action OnChart; - public Action OnTest; - - private readonly FlowContainerWithOrigin buttonFlow; - - //todo: make these non-internal somehow. - public const float BUTTON_AREA_HEIGHT = 100; public const float BUTTON_WIDTH = 140f; public const float WEDGE_WIDTH = 20; @@ -55,18 +49,16 @@ namespace osu.Game.Screens.Menu this.logo.Action = onOsuLogo; // osuLogo.SizeForFlow relies on loading to be complete. - buttonFlow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0); + buttonArea.Flow.Position = new Vector2(WEDGE_WIDTH * 2 - (BUTTON_WIDTH + this.logo.SizeForFlow / 4), 0); updateLogoState(); } } private readonly Drawable iconFacade; - private readonly Container buttonArea; - private readonly Box buttonAreaBackground; + private readonly ButtonArea buttonArea; private readonly Button backButton; - private readonly Button settingsButton; private readonly List public event Action BeatmapDownloadBegan; + /// + /// Fired when a beatmap download is interrupted, due to user cancellation or other failures. + /// + public event Action BeatmapDownloadFailed; + /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -175,6 +180,8 @@ namespace osu.Game.Beatmaps request.Failure += error => { + BeatmapDownloadFailed?.Invoke(request); + if (error is OperationCanceledException) return; downloadNotification.State = ProgressNotificationState.Cancelled; diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs index 6acb58e165..6f4d4c0d6f 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs @@ -5,6 +5,7 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Game.Online.API.Requests; namespace osu.Game.Beatmaps.Drawables { @@ -19,9 +20,9 @@ namespace osu.Game.Beatmaps.Drawables private BeatmapManager beatmaps; /// - /// Whether the associated beatmap set has been downloading (by this instance or any other instance). + /// Holds the current download state of the beatmap, whether is has already been downloaded, is in progress, or is not downloaded. /// - public readonly BindableBool Downloaded = new BindableBool(); + public readonly Bindable DownloadState = new Bindable(); public BeatmapSetDownloader(BeatmapSetInfo set, bool noVideo = false) { @@ -36,10 +37,16 @@ namespace osu.Game.Beatmaps.Drawables beatmaps.ItemAdded += setAdded; beatmaps.ItemRemoved += setRemoved; + beatmaps.BeatmapDownloadBegan += downloadBegan; + beatmaps.BeatmapDownloadFailed += downloadFailed; // initial value - if (set.OnlineBeatmapSetID != null) - Downloaded.Value = beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any(); + if (set.OnlineBeatmapSetID != null && beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any()) + DownloadState.Value = DownloadStatus.Downloaded; + else if (beatmaps.GetExistingDownload(set) != null) + DownloadState.Value = DownloadStatus.Downloading; + else + DownloadState.Value = DownloadStatus.NotDownloaded; } protected override void Dispose(bool isDisposing) @@ -50,6 +57,8 @@ namespace osu.Game.Beatmaps.Drawables { beatmaps.ItemAdded -= setAdded; beatmaps.ItemRemoved -= setRemoved; + beatmaps.BeatmapDownloadBegan -= downloadBegan; + beatmaps.BeatmapDownloadFailed -= downloadFailed; } } @@ -57,28 +66,45 @@ namespace osu.Game.Beatmaps.Drawables /// Begin downloading the associated beatmap set. /// /// True if downloading began. False if an existing download is active or completed. - public bool Download() + public void Download() { - if (Downloaded.Value) - return false; - - if (beatmaps.GetExistingDownload(set) != null) - return false; + if (DownloadState.Value > DownloadStatus.NotDownloaded) + return; beatmaps.Download(set, noVideo); - return true; + + DownloadState.Value = DownloadStatus.Downloading; } private void setAdded(BeatmapSetInfo s) { if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID) - Downloaded.Value = true; + DownloadState.Value = DownloadStatus.Downloaded; } private void setRemoved(BeatmapSetInfo s) { if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID) - Downloaded.Value = false; + DownloadState.Value = DownloadStatus.NotDownloaded; + } + + private void downloadBegan(DownloadBeatmapSetRequest d) + { + if (d.BeatmapSet.OnlineBeatmapSetID == set.OnlineBeatmapSetID) + DownloadState.Value = DownloadStatus.Downloading; + } + + private void downloadFailed(DownloadBeatmapSetRequest d) + { + if (d.BeatmapSet.OnlineBeatmapSetID == set.OnlineBeatmapSetID) + DownloadState.Value = DownloadStatus.NotDownloaded; + } + + public enum DownloadStatus + { + NotDownloaded, + Downloading, + Downloaded, } } } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 4fce6a49fb..7a227f4bfa 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -61,20 +61,23 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons Action = () => { - if (!downloader.Download()) + if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading) { Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); + return; } + + downloader.Download(); }; - downloader.Downloaded.ValueChanged += d => + downloader.DownloadState.ValueChanged += d => { - if (d) + if (d == BeatmapSetDownloader.DownloadStatus.Downloaded) this.FadeOut(200); - else + else if (d == BeatmapSetDownloader.DownloadStatus.NotDownloaded) this.FadeIn(200); }; } diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index e286837746..48963a91e8 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -168,11 +168,10 @@ namespace osu.Game.Overlays.Direct }, new DownloadButton(SetInfo) { - Size = new Vector2(30), + Size = new Vector2(50, 30), Margin = new MarginPadding(horizontal_padding), - Anchor = Anchor.CentreRight, - Origin = Anchor.CentreRight, - Colour = colours.Gray5, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, }, }, }, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index e63c290ce5..76da4b61b0 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -99,6 +99,7 @@ namespace osu.Game.Overlays.Direct attachDownload(downloadRequest); beatmaps.BeatmapDownloadBegan += attachDownload; + beatmaps.ItemAdded += setAdded; } public override bool DisposeOnDeathRemoval => true; @@ -107,6 +108,7 @@ namespace osu.Game.Overlays.Direct { base.Dispose(isDisposing); beatmaps.BeatmapDownloadBegan -= attachDownload; + beatmaps.ItemAdded -= setAdded; } protected override void Update() @@ -171,6 +173,12 @@ namespace osu.Game.Overlays.Direct }; } + private void setAdded(BeatmapSetInfo s) + { + if (s.OnlineBeatmapSetID == SetInfo.OnlineBeatmapSetID) + progressBar.FadeOut(500); + } + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 1ffa8dbd35..68380b951c 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -1,76 +1,146 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Overlays.Direct { public class DownloadButton : OsuClickableContainer { private readonly SpriteIcon icon; + private readonly SpriteIcon checkmark; + private readonly BeatmapSetDownloader downloader; + private readonly Box background; + + private OsuColour colours; public DownloadButton(BeatmapSetInfo set, bool noVideo = false) { - BeatmapSetDownloader downloader; Children = new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), + new Container + { + RelativeSizeAxes = Axes.Both, + CornerRadius = 17, + Masking = true, + Child = background = new Box + { + RelativeSizeAxes = Axes.Both, + }, + }, icon = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(30), - Icon = FontAwesome.fa_osu_chevron_down_o, + Size = new Vector2(13), + Icon = FontAwesome.fa_download, }, + checkmark = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + X = 8, + Size = Vector2.Zero, + Icon = FontAwesome.fa_check, + } }; Action = () => { - if (!downloader.Download()) + if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading) { Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); } + else if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloaded) + { + // TODO: Jump to song select with this set when the capability is implemented + } + else + { + downloader.Download(); + } }; - downloader.Downloaded.ValueChanged += d => - { - if (d) - this.FadeOut(200); - else - this.FadeIn(200); - }; + downloader.DownloadState.ValueChanged += _ => updateState(); + + Colour = Color4.White; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + updateState(); + } + + [BackgroundDependencyLoader(permitNulls:true)] + private void load(OsuColour colours) + { + this.colours = colours; } protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { - icon.ScaleTo(0.9f, 1000, Easing.Out); + Content.ScaleTo(0.9f, 1000, Easing.Out); return base.OnMouseDown(state, args); } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { - icon.ScaleTo(1f, 500, Easing.OutElastic); + Content.ScaleTo(1f, 500, Easing.OutElastic); return base.OnMouseUp(state, args); } protected override bool OnHover(InputState state) { - icon.ScaleTo(1.1f, 500, Easing.OutElastic); + Content.ScaleTo(1.1f, 500, Easing.OutElastic); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - icon.ScaleTo(1f, 500, Easing.OutElastic); + Content.ScaleTo(1f, 500, Easing.OutElastic); + } + + private void updateState() + { + if (!IsLoaded) + return; + + switch (downloader.DownloadState.Value) + { + case BeatmapSetDownloader.DownloadStatus.NotDownloaded: + background.FadeColour(colours.Gray4, 500, Easing.InOutExpo); + icon.MoveToX(0, 500, Easing.InOutExpo); + checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); + break; + + case BeatmapSetDownloader.DownloadStatus.Downloading: + background.FadeColour(colours.Blue, 500, Easing.InOutExpo); + icon.MoveToX(0, 500, Easing.InOutExpo); + checkmark.ScaleTo(Vector2.Zero, 500, Easing.InOutExpo); + break; + + case BeatmapSetDownloader.DownloadStatus.Downloaded: + background.FadeColour(colours.Green, 500, Easing.InOutExpo); + icon.MoveToX(-8, 500, Easing.InOutExpo); + checkmark.ScaleTo(new Vector2(13), 500, Easing.InOutExpo); + break; + } } } } From 6ea6a10defeafddd5e698b5f6d41af42653d9335 Mon Sep 17 00:00:00 2001 From: naoey Date: Tue, 3 Jul 2018 20:26:49 +0530 Subject: [PATCH 042/171] Reduce size of download button in list view to fit hover effect --- osu.Game/Overlays/Direct/DirectListPanel.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 812a0e2073..17c5153dab 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -120,8 +120,8 @@ namespace osu.Game.Overlays.Direct Alpha = 0, Child = new DownloadButton(SetInfo) { - Size = new Vector2(height - vertical_padding * 2), - Margin = new MarginPadding { Left = vertical_padding }, + Size = new Vector2(height - vertical_padding * 3), + Margin = new MarginPadding { Left = vertical_padding, Right = vertical_padding }, }, }, new FillFlowContainer From e28a6107578ae52d17298a6fc929d49ce17e5ca1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 4 Jul 2018 12:40:55 +0900 Subject: [PATCH 043/171] Fix mods not correctly resetting when changing ruleset at song select --- .../ManiaSettingsSubsection.cs | 5 ++- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 7 +++- .../Settings/RulesetSettingsSubsection.cs | 9 +++-- osu.Game/Rulesets/Mods/ModAutoplay.cs | 2 +- osu.Game/Screens/Select/PlaySongSelect.cs | 4 +- osu.Game/Screens/Select/SongSelect.cs | 38 +++++++++++++------ osu.Game/osu.Game.csproj | 2 +- 7 files changed, 46 insertions(+), 21 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index 54a7bf954d..8d1fad8a82 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.UI; @@ -19,14 +20,14 @@ namespace osu.Game.Rulesets.Mania } [BackgroundDependencyLoader] - private void load(ManiaConfigManager config) + private void load() { Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Scrolling direction", - Bindable = config.GetBindable(ManiaSetting.ScrollDirection) + Bindable = (Config as RulesetConfigManager)?.GetBindable(ManiaSetting.ScrollDirection) } }; } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index c584a32a82..98cf111ba0 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -44,6 +44,8 @@ namespace osu.Game.Overlays.Mods private void rulesetChanged(RulesetInfo newRuleset) { + if (newRuleset == null) return; + var instance = newRuleset.CreateInstance(); foreach (ModSection section in ModSectionsContainer.Children) @@ -173,7 +175,10 @@ namespace osu.Game.Overlays.Mods refreshSelectedMods(); } - private void refreshSelectedMods() => SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); + private void refreshSelectedMods() + { + SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray(); + } public ModSelectOverlay() { diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 05104018cd..5340a01743 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Rulesets; +using osu.Game.Rulesets.Configuration; namespace osu.Game.Overlays.Settings { @@ -14,6 +15,8 @@ namespace osu.Game.Overlays.Settings { private readonly Ruleset ruleset; + protected IRulesetConfigManager Config; + protected RulesetSettingsSubsection(Ruleset ruleset) { this.ruleset = ruleset; @@ -25,9 +28,9 @@ namespace osu.Game.Overlays.Settings { dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); - var config = dependencies.Get().GetConfigFor(ruleset); - if (config != null) - dependencies.Cache(config); + Config = dependencies.Get().GetConfigFor(ruleset); + if (Config != null) + dependencies.Cache(Config); return dependencies; } diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 7058d1bed6..8f73ff4c2d 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -11,7 +11,7 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mods { - public class ModAutoplay : ModAutoplay, IApplicableToRulesetContainer + public abstract class ModAutoplay : ModAutoplay, IApplicableToRulesetContainer where T : HitObject { protected virtual Score CreateReplayScore(Beatmap beatmap) => new Score { Replay = new Replay() }; diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index 8ce40fcfa0..a346911ca2 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -84,10 +84,10 @@ namespace osu.Game.Screens.Select protected override void UpdateBeatmap(WorkingBeatmap beatmap) { - base.UpdateBeatmap(beatmap); - beatmap.Mods.BindTo(SelectedMods); + base.UpdateBeatmap(beatmap); + BeatmapDetails.Beatmap = beatmap; if (beatmap.Track != null) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 94c16f1797..e940cac419 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Linq; using OpenTK; using OpenTK.Input; using osu.Framework.Allocation; @@ -19,6 +20,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Overlays; using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; @@ -67,8 +69,17 @@ namespace osu.Game.Screens.Select protected new readonly Bindable Ruleset = new Bindable(); private DependencyContainer dependencies; + protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + { + dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + + dependencies.CacheAs(this); + dependencies.CacheAs(Ruleset); + dependencies.CacheAs>(Ruleset); + + return dependencies; + } protected SongSelect() { @@ -183,11 +194,9 @@ namespace osu.Game.Screens.Select [BackgroundDependencyLoader(true)] private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuColour colours) { - dependencies.CacheAs(this); - dependencies.CacheAs(Ruleset); - dependencies.CacheAs>(Ruleset); - + // manual binding to parent ruleset to allow for delayed load in the incoming direction. base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); + Ruleset.ValueChanged += r => base.Ruleset.Value = r; if (Footer != null) { @@ -263,7 +272,7 @@ namespace osu.Game.Screens.Select // If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != Ruleset.Value) { - Ruleset.Value = beatmap.BeatmapInfo.Ruleset; + base.Ruleset.Value = beatmap.BeatmapInfo.Ruleset; Carousel.SelectBeatmap(beatmap.BeatmapInfo); } } @@ -281,16 +290,22 @@ namespace osu.Game.Screens.Select void performLoad() { + WorkingBeatmap working = Beatmap.Value; + bool preview = false; + // We may be arriving here due to another component changing the bindable Beatmap. // In these cases, the other component has already loaded the beatmap, so we don't need to do so again. if (beatmap?.Equals(Beatmap.Value.BeatmapInfo) != true) { - bool preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; - - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); - ensurePlayingSelected(preview); + preview = beatmap?.BeatmapSetInfoID != Beatmap.Value?.BeatmapInfo.BeatmapSetInfoID; + working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); } + ensurePlayingSelected(preview); + + working.Mods.Value = Enumerable.Empty(); + + Beatmap.Value = working; Ruleset.Value = ruleset; UpdateBeatmap(Beatmap.Value); @@ -464,7 +479,8 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) + if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false + && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) return; if (Carousel.SelectedBeatmapSet == null && !Carousel.SelectNextRandom()) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 56c33c47af..74da553bfe 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 44aecdc3a0ebd60873058cbb25922c6bc69ef1c3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 15:00:02 +0900 Subject: [PATCH 044/171] Rename method to EquivalentTo --- osu.Game/Beatmaps/ControlPoints/ControlPoint.cs | 11 +++++------ .../Beatmaps/ControlPoints/DifficultyControlPoint.cs | 4 ++-- osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs | 4 ++-- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 4 ++-- osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 6 +++--- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 4 ++-- 7 files changed, 18 insertions(+), 19 deletions(-) diff --git a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs index 90c0ded38f..9ed476d97c 100644 --- a/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/ControlPoint.cs @@ -15,15 +15,14 @@ namespace osu.Game.Beatmaps.ControlPoints public int CompareTo(ControlPoint other) => Time.CompareTo(other.Time); /// - /// Whether this provides the same changes to gameplay as another . + /// Whether this provides the same parametric changes as another . + /// Basically an equality check without considering the . /// /// The to compare to. - /// Whether this provides the same changes to gameplay as . - public virtual bool ChangeEquals(ControlPoint other) => !ReferenceEquals(null, other); + /// Whether this is equivalent to . + public virtual bool EquivalentTo(ControlPoint other) => true; public bool Equals(ControlPoint other) - => ChangeEquals(other) - && !ReferenceEquals(null, other) - && Time.Equals(other.Time); + => EquivalentTo(other) && Time.Equals(other?.Time); } } diff --git a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs index f821ff11f4..526bddf51a 100644 --- a/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/DifficultyControlPoint.cs @@ -18,8 +18,8 @@ namespace osu.Game.Beatmaps.ControlPoints private double speedMultiplier = 1; - public override bool ChangeEquals(ControlPoint other) - => base.ChangeEquals(other) + public override bool EquivalentTo(ControlPoint other) + => base.EquivalentTo(other) && other is DifficultyControlPoint difficulty && SpeedMultiplier.Equals(difficulty.SpeedMultiplier); } diff --git a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs index 0cbdf7fdf2..dd9d568133 100644 --- a/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/EffectControlPoint.cs @@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps.ControlPoints /// public bool OmitFirstBarLine; - public override bool ChangeEquals(ControlPoint other) - => base.ChangeEquals(other) + public override bool EquivalentTo(ControlPoint other) + => base.EquivalentTo(other) && other is EffectControlPoint effect && KiaiMode.Equals(effect.KiaiMode) && OmitFirstBarLine.Equals(effect.OmitFirstBarLine); diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index 77d42551c6..acccbcde46 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -45,8 +45,8 @@ namespace osu.Game.Beatmaps.ControlPoints return newSampleInfo; } - public override bool ChangeEquals(ControlPoint other) - => base.ChangeEquals(other) + public override bool EquivalentTo(ControlPoint other) + => base.EquivalentTo(other) && other is SampleControlPoint sample && SampleBank.Equals(sample.SampleBank) && SampleVolume.Equals(sample.SampleVolume); diff --git a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs index 8fe3257786..eb60133fed 100644 --- a/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/TimingControlPoint.cs @@ -24,8 +24,8 @@ namespace osu.Game.Beatmaps.ControlPoints private double beatLength = 1000; - public override bool ChangeEquals(ControlPoint other) - => base.ChangeEquals(other) + public override bool EquivalentTo(ControlPoint other) + => base.EquivalentTo(other) && other is TimingControlPoint timing && TimeSignature.Equals(timing.TimeSignature) && BeatLength.Equals(timing.BeatLength); diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index fe55d19908..c79938e613 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -359,7 +359,7 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.DifficultyPointAt(newPoint.Time); - if (newPoint.ChangeEquals(existing)) + if (newPoint.EquivalentTo(existing)) return; beatmap.ControlPointInfo.DifficultyPoints.RemoveAll(x => x.Time == newPoint.Time); @@ -370,7 +370,7 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.EffectPointAt(newPoint.Time); - if (newPoint.ChangeEquals(existing)) + if (newPoint.EquivalentTo(existing)) return; beatmap.ControlPointInfo.EffectPoints.Add(newPoint); @@ -380,7 +380,7 @@ namespace osu.Game.Beatmaps.Formats { var existing = beatmap.ControlPointInfo.SamplePointAt(newPoint.Time); - if (newPoint.ChangeEquals(existing)) + if (newPoint.EquivalentTo(existing)) return; beatmap.ControlPointInfo.SamplePoints.Add(newPoint); diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index f5e3a34462..22a6acf459 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -184,8 +184,8 @@ namespace osu.Game.Beatmaps.Formats return baseInfo; } - public override bool ChangeEquals(ControlPoint other) - => base.ChangeEquals(other) + public override bool EquivalentTo(ControlPoint other) + => base.EquivalentTo(other) && other is LegacySampleControlPoint legacy && CustomSampleBank == legacy.CustomSampleBank; } From 1d6609d9f3688ddfd5ee76818db001fb5877225d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 11:32:09 +0900 Subject: [PATCH 045/171] Add common custom words to dotsettings dictionary Also fixes some typos and reduces spelling suggestions to hints. --- osu.Desktop/Program.cs | 4 +-- .../TestCaseCatcherArea.cs | 2 +- ...tCaseHyperdash.cs => TestCaseHyperDash.cs} | 4 +-- .../Difficulty/CatchDifficultyCalculator.cs | 4 +-- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 26 +++++++++---------- .../Legacy/EndTimeObjectPatternGenerator.cs | 4 +-- .../OsuBeatmapConversionTest.cs | 2 +- .../Difficulty/OsuDifficultyCalculator.cs | 8 +++--- osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs | 4 +-- .../Connections/FollowPointRenderer.cs | 8 +++--- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableOsuHitObject.cs | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/Pieces/SliderBody.cs | 2 +- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 4 +-- osu.Game.Rulesets.Osu/Objects/SliderTick.cs | 2 +- .../Visual/TestCaseBeatmapInfoWedge.cs | 6 ++--- osu.Game.Tests/Visual/TestCaseMods.cs | 4 +-- osu.Game/Graphics/SpriteIcon.cs | 1 + osu.sln.DotSettings | 23 +++++++++++++++- 20 files changed, 67 insertions(+), 47 deletions(-) rename osu.Game.Rulesets.Catch.Tests/{TestCaseHyperdash.cs => TestCaseHyperDash.cs} (88%) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 61d2006315..780a9994fd 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -21,7 +21,7 @@ namespace osu.Desktop // required to initialise native SQLite libraries on some platforms. if (!RuntimeInfo.IsMono) - useMulticoreJit(); + useMultiCoreJit(); // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; @@ -54,7 +54,7 @@ namespace osu.Desktop } } - private static void useMulticoreJit() + private static void useMultiCoreJit() { #if NET_FRAMEWORK var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs index 0ba6398ced..25f7ca108d 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseCatcherArea.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Catch.Tests { } - public void ToggleHyperDash(bool status) => MovableCatcher.SetHyperdashState(status ? 2 : 1); + public void ToggleHyperDash(bool status) => MovableCatcher.SetHyperDashState(status ? 2 : 1); } } } diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperdash.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs similarity index 88% rename from osu.Game.Rulesets.Catch.Tests/TestCaseHyperdash.cs rename to osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs index 896582bf0a..14487b2c7f 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperdash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs @@ -8,9 +8,9 @@ using osu.Game.Rulesets.Catch.Objects; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] - public class TestCaseHyperdash : Game.Tests.Visual.TestCasePlayer + public class TestCaseHyperDash : Game.Tests.Visual.TestCasePlayer { - public TestCaseHyperdash() + public TestCaseHyperDash() : base(new CatchRuleset()) { } diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 3d1013aad3..31c56c37c4 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -61,12 +61,12 @@ namespace osu.Game.Rulesets.Catch.Difficulty return new CatchDifficultyAttributes(mods, 0); // this is the same as osu!, so there's potential to share the implementation... maybe - double preEmpt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; double starRating = Math.Sqrt(calculateDifficulty(difficultyHitObjects, timeRate)) * star_scaling_factor; return new CatchDifficultyAttributes(mods, starRating) { - ApproachRate = preEmpt > 1200.0 ? -(preEmpt - 1800.0) / 120.0 : -(preEmpt - 1200.0) / 150.0 + 5.0, + ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, MaxCombo = difficultyHitObjects.Count }; } diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 9c376f340a..2f42902fd0 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -255,11 +255,11 @@ namespace osu.Game.Rulesets.Catch.UI double positionDifference = target.X * CatchPlayfield.BASE_WIDTH - catcherPosition; double velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0); - SetHyperdashState(Math.Abs(velocity), target.X); + SetHyperDashState(Math.Abs(velocity), target.X); } else { - SetHyperdashState(); + SetHyperDashState(); } return validCatch; @@ -270,18 +270,18 @@ namespace osu.Game.Rulesets.Catch.UI private float hyperDashTargetPosition; /// - /// Whether we are hypderdashing or not. + /// Whether we are hyper-dashing or not. /// public bool HyperDashing => hyperDashModifier != 1; /// - /// Set hyperdash state. + /// Set hyper-dash state. /// - /// The speed multiplier. If this is less or equals to 1, this catcher will be non-hyperdashing state. - /// When this catcher crosses this position, this catcher ends hyperdashing. - public void SetHyperdashState(double modifier = 1, float targetPosition = -1) + /// The speed multiplier. If this is less or equals to 1, this catcher will be non-hyper-dashing state. + /// When this catcher crosses this position, this catcher ends hyper-dashing. + public void SetHyperDashState(double modifier = 1, float targetPosition = -1) { - const float hyperdash_transition_length = 180; + const float hyper_dash_transition_length = 180; bool previouslyHyperDashing = HyperDashing; if (modifier <= 1 || X == targetPosition) @@ -291,8 +291,8 @@ namespace osu.Game.Rulesets.Catch.UI if (previouslyHyperDashing) { - this.FadeColour(Color4.White, hyperdash_transition_length, Easing.OutQuint); - this.FadeTo(1, hyperdash_transition_length, Easing.OutQuint); + this.FadeColour(Color4.White, hyper_dash_transition_length, Easing.OutQuint); + this.FadeTo(1, hyper_dash_transition_length, Easing.OutQuint); } } else @@ -303,8 +303,8 @@ namespace osu.Game.Rulesets.Catch.UI if (!previouslyHyperDashing) { - this.FadeColour(Color4.OrangeRed, hyperdash_transition_length, Easing.OutQuint); - this.FadeTo(0.2f, hyperdash_transition_length, Easing.OutQuint); + this.FadeColour(Color4.OrangeRed, hyper_dash_transition_length, Easing.OutQuint); + this.FadeTo(0.2f, hyper_dash_transition_length, Easing.OutQuint); Trail = true; } } @@ -370,7 +370,7 @@ namespace osu.Game.Rulesets.Catch.UI hyperDashDirection < 0 && hyperDashTargetPosition > X) { X = hyperDashTargetPosition; - SetHyperdashState(); + SetHyperDashState(); } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index 3f34afee85..01b2b1e68e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -19,9 +19,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy public EndTimeObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, new Pattern(), originalBeatmap) { - var endtimeData = HitObject as IHasEndTime; - - endTime = endtimeData?.EndTime ?? 0; + endTime = (HitObject as IHasEndTime)?.EndTime ?? 0; } public override Pattern Generate() diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 3fa039d946..3a551bbbcf 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Tests public struct ConvertValue : IEquatable { /// - /// A sane value to account for osu!stable using ints everwhere. + /// A sane value to account for osu!stable using s everywhere. /// private const double conversion_lenience = 2; diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 62fafd8196..5e91ed7a97 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -61,19 +61,19 @@ namespace osu.Game.Rulesets.Osu.Difficulty double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; - // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future + // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; - double preEmpt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; int maxCombo = beatmap.HitObjects.Count(); - // Add the ticks + tail of the slider. 1 is subtracted because the "headcircle" would be counted twice (once for the slider itself in the line above) + // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) maxCombo += beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); return new OsuDifficultyAttributes(mods, starRating) { AimStrain = aimRating, SpeedStrain = speedRating, - ApproachRate = preEmpt > 1200 ? (1800 - preEmpt) / 120 : (1200 - preEmpt) / 150 + 5, + ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, OverallDifficulty = (80 - hitWindowGreat) / 6, MaxCombo = maxCombo }; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs index 4220b72b16..4eff2a55c8 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModHidden.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods public override void ApplyToDrawableHitObjects(IEnumerable drawables) { - void adjustFadeIn(OsuHitObject h) => h.TimeFadein = h.TimePreempt * fade_in_duration_multiplier; + void adjustFadeIn(OsuHitObject h) => h.TimeFadeIn = h.TimePreempt * fade_in_duration_multiplier; foreach (var d in drawables.OfType()) { @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Mods var h = d.HitObject; - var fadeOutStartTime = h.StartTime - h.TimePreempt + h.TimeFadein; + var fadeOutStartTime = h.StartTime - h.TimePreempt + h.TimeFadeIn; var fadeOutDuration = h.TimePreempt * fade_out_duration_multiplier; // new duration from completed fade in to end (before fading out) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 4653f45149..4ac3b0c983 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -96,12 +96,12 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections using (fp.BeginAbsoluteSequence(fadeInTime)) { - fp.FadeIn(currHitObject.TimeFadein); - fp.ScaleTo(1, currHitObject.TimeFadein, Easing.Out); + fp.FadeIn(currHitObject.TimeFadeIn); + fp.ScaleTo(1, currHitObject.TimeFadeIn, Easing.Out); - fp.MoveTo(pointEndPosition, currHitObject.TimeFadein, Easing.Out); + fp.MoveTo(pointEndPosition, currHitObject.TimeFadeIn, Easing.Out); - fp.Delay(fadeOutTime - fadeInTime).FadeOut(currHitObject.TimeFadein); + fp.Delay(fadeOutTime - fadeInTime).FadeOut(currHitObject.TimeFadeIn); } fp.Expire(true); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 421c93d485..c525b4bd97 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { base.UpdatePreemptState(); - ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadein * 2, HitObject.TimePreempt)); + ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt)); ApproachCircle.ScaleTo(1.1f, HitObject.TimePreempt); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs index 7c9503dfe2..02def2189f 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableOsuHitObject.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables AccentColour = skin.GetValue(s => s.ComboColours.Count > 0 ? s.ComboColours[combo.ComboIndex % s.ComboColours.Count] : (Color4?)null) ?? Color4.White; } - protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadein); + protected virtual void UpdatePreemptState() => this.FadeIn(HitObject.TimeFadeIn); protected virtual void UpdateCurrentState(ArmedState state) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 10539f85a2..1d3df69fb8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { Disc.Tracking = OsuActionInputManager.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton); if (!spmCounter.IsPresent && Disc.Tracking) - spmCounter.FadeIn(HitObject.TimeFadein); + spmCounter.FadeIn(HitObject.TimeFadeIn); base.Update(); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 94a61e7904..283d6b91f6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -212,7 +212,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces var spanProgress = slider.ProgressAt(completionProgress); double start = 0; - double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadein, 0, 1) : 1; + double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; if (span >= slider.SpanCount() - 1) { diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index befbc01f3c..48a6365c00 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Objects public event Action PositionChanged; public double TimePreempt = 600; - public double TimeFadein = 400; + public double TimeFadeIn = 400; private Vector2 position; @@ -65,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.Objects base.ApplyDefaultsToSelf(controlPointInfo, difficulty); TimePreempt = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1800, 1200, 450); - TimeFadein = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1200, 800, 300); + TimeFadeIn = (float)BeatmapDifficulty.DifficultyRange(difficulty.ApproachRate, 1200, 800, 300); Scale = (1.0f - 0.7f * (difficulty.CircleSize - 5) / 5) / 2; } diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs index 4db6eb9883..54337a12be 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTick.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Osu.Objects // This is so on repeats ticks don't appear too late to be visually processed by the player. offset = 200; else - offset = TimeFadein * 0.66f; + offset = TimeFadeIn * 0.66f; TimePreempt = (StartTime - SpanStartTime) / 2 + offset; } diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index ee66f53ddc..b232180eba 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -110,8 +110,8 @@ namespace osu.Game.Tests.Visual private void testInfoLabels(int expectedCount) { - AddAssert("check infolabels exists", () => infoWedge.Info.InfoLabelContainer.Children.Any()); - AddAssert("check infolabels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount); + AddAssert("check info labels exists", () => infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check info labels count", () => infoWedge.Info.InfoLabelContainer.Children.Count == expectedCount); } private void testNullBeatmap() @@ -121,7 +121,7 @@ namespace osu.Game.Tests.Visual AddAssert("check default title", () => infoWedge.Info.TitleLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Title); AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Text == Beatmap.Default.BeatmapInfo.Metadata.Artist); AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any()); - AddAssert("check no infolabels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); + AddAssert("check no info labels", () => !infoWedge.Info.InfoLabelContainer.Children.Any()); } private void selectBeatmap(IBeatmap b) diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index 73c37348d5..1a28442e38 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual testMultiplierTextColour(noFailMod, modSelect.LowMultiplierColour); testMultiplierTextColour(hiddenMod, modSelect.HighMultiplierColour); - testUnimplmentedMod(autoPilotMod); + testUnimplementedMod(autoPilotMod); } private void testManiaMods(ManiaRuleset ruleset) @@ -154,7 +154,7 @@ namespace osu.Game.Tests.Visual checkNotSelected(mod); } - private void testUnimplmentedMod(Mod mod) + private void testUnimplementedMod(Mod mod) { selectNext(mod); checkNotSelected(mod); diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 6acd20719e..45c4cebfcf 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -10,6 +10,7 @@ using osu.Framework.IO.Stores; using OpenTK; using OpenTK.Graphics; using osu.Framework.Caching; +// ReSharper disable IdentifierTypo namespace osu.Game.Graphics { diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 0b631d008b..1f1b6a79b1 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -23,6 +23,7 @@ HINT SUGGESTION HINT + HINT HINT WARNING WARNING @@ -43,6 +44,7 @@ DO_NOT_SHOW WARNING WARNING + HINT HINT ERROR HINT @@ -133,6 +135,7 @@ WARNING WARNING WARNING + HINT DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW @@ -666,4 +669,22 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste True True True - True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True From bbceac6cdaa93a215899cd6b137b1f61053152d8 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Thu, 5 Jul 2018 16:50:04 +0900 Subject: [PATCH 046/171] Apply renaming of wheel -> scroll --- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/Volume/VolumeControlReceptor.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index bc680193bc..49c774a5a0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -248,7 +248,7 @@ namespace osu.Game { RelativeSizeAxes = Axes.Both, ActionRequested = action => volume.Adjust(action), - WheelActionRequested = (action, amount, isPrecise) => volume.Adjust(action, amount, isPrecise), + ScrollActionRequested = (action, amount, isPrecise) => volume.Adjust(action, amount, isPrecise), }, mainContent = new Container { RelativeSizeAxes = Axes.Both }, overlayContent = new Container { RelativeSizeAxes = Axes.Both, Depth = float.MinValue }, diff --git a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs index bb9aadb888..3a64e12b27 100644 --- a/osu.Game/Overlays/Volume/VolumeControlReceptor.cs +++ b/osu.Game/Overlays/Volume/VolumeControlReceptor.cs @@ -9,13 +9,13 @@ using osu.Game.Input.Bindings; namespace osu.Game.Overlays.Volume { - public class VolumeControlReceptor : Container, IMouseWheelBindingHandler, IHandleGlobalInput + public class VolumeControlReceptor : Container, IScrollBindingHandler, IHandleGlobalInput { public Func ActionRequested; - public Func WheelActionRequested; + public Func ScrollActionRequested; public bool OnPressed(GlobalAction action) => ActionRequested?.Invoke(action) ?? false; - public bool OnMouseWheel(GlobalAction action, float amount, bool isPrecise) => WheelActionRequested?.Invoke(action, amount, isPrecise) ?? false; + public bool OnScroll(GlobalAction action, float amount, bool isPrecise) => ScrollActionRequested?.Invoke(action, amount, isPrecise) ?? false; public bool OnReleased(GlobalAction action) => false; } } From 7328121ef5ab766f6ce75c35cc8b788b5199a07e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 19:29:49 +0900 Subject: [PATCH 047/171] Remove LD_PRELOAD as it is now unnecessary --- .vscode/launch.json | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 2c781363af..12bb5b7734 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -13,9 +13,8 @@ "preLaunchTask": "Build tests (Debug)", "linux": { "env": { - "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/libbass.so", - "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/", - }, + "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tests/bin/Debug/netcoreapp2.1:${env:LD_LIBRARY_PATH}" + } }, "console": "internalConsole" }, @@ -31,9 +30,8 @@ "preLaunchTask": "Build tests (Release)", "linux": { "env": { - "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/libbass.so", - "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/", - }, + "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Game.Tests/bin/Release/netcoreapp2.1:${env:LD_LIBRARY_PATH}" + } }, "console": "internalConsole" }, @@ -49,9 +47,8 @@ "preLaunchTask": "Build osu! (Debug)", "linux": { "env": { - "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/libbass.so", - "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/", - }, + "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1:${env:LD_LIBRARY_PATH}" + } }, "console": "internalConsole" }, @@ -67,9 +64,8 @@ "preLaunchTask": "Build osu! (Release)", "linux": { "env": { - "LD_PRELOAD": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1/libbass.so", - "LD_LIBRARY_PATH" : "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1/", - }, + "LD_LIBRARY_PATH": "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1:${env:LD_LIBRARY_PATH}" + } }, "console": "internalConsole" } From 8f04acc506bf5ae4474897f0f420d43583e4fcee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 20:16:55 +0900 Subject: [PATCH 048/171] Add missing xmldoc --- osu.Game/Audio/SampleInfo.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 3d76184e09..7e329ac651 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -34,6 +34,9 @@ namespace osu.Game.Audio /// public int Volume; + /// + /// Retrieve all possible filenames that can be used as a source, returned in order of preference (highest first). + /// public virtual IEnumerable LookupNames { get From 625b9ead4c1eec712824d59b91bf7cd00479cb3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 21:00:23 +0900 Subject: [PATCH 049/171] Fix links from profile top scores to beatmaps not working correctly --- osu.Game/Beatmaps/BeatmapMetadata.cs | 1 - osu.Game/Online/API/Requests/Responses/APIScore.cs | 9 ++++++++- .../Profile/Sections/BeatmapMetadataContainer.cs | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index 6c1bcd0531..57983ec568 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -14,7 +14,6 @@ namespace osu.Game.Beatmaps public class BeatmapMetadata : IEquatable { [DatabaseGenerated(DatabaseGeneratedOption.Identity)] - [JsonIgnore] public int ID { get; set; } public string Title { get; set; } diff --git a/osu.Game/Online/API/Requests/Responses/APIScore.cs b/osu.Game/Online/API/Requests/Responses/APIScore.cs index a398bf46ee..25eb32a79f 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScore.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScore.cs @@ -63,7 +63,14 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmapset")] private BeatmapMetadata metadata { - set => Beatmap.Metadata = value; + set + { + // extract the set ID to its correct place. + Beatmap.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = value.ID }; + value.ID = 0; + + Beatmap.Metadata = value; + } } [JsonProperty(@"statistics")] diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 359bfc7564..eaa0ac4aaa 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -9,6 +9,7 @@ using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; + namespace osu.Game.Overlays.Profile.Sections { /// @@ -32,7 +33,10 @@ namespace osu.Game.Overlays.Profile.Sections { Action = () => { - if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); + if (beatmap.OnlineBeatmapID != null) + beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.OnlineBeatmapID.Value); + else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) + beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; Child = new FillFlowContainer From 7e28a993f7e0e86132d91f1cbc310518e6bcd76f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 5 Jul 2018 21:08:53 +0900 Subject: [PATCH 050/171] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 56c33c47af..da55726447 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 7a091083871223584a659bd0986eb1f90bc1e124 Mon Sep 17 00:00:00 2001 From: John Neijzen Date: Thu, 5 Jul 2018 22:38:34 +0800 Subject: [PATCH 051/171] Remove extra , make this valid JSON file --- .vscode/launch.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 12bb5b7734..e9b8d6f397 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -41,7 +41,7 @@ "request": "launch", "program": "dotnet", "args": [ - "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/osu!.dll", + "${workspaceRoot}/osu.Desktop/bin/Debug/netcoreapp2.1/osu!.dll" ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build osu! (Debug)", @@ -58,7 +58,7 @@ "request": "launch", "program": "dotnet", "args": [ - "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1/osu!.dll", + "${workspaceRoot}/osu.Desktop/bin/Release/netcoreapp2.1/osu!.dll" ], "cwd": "${workspaceRoot}", "preLaunchTask": "Build osu! (Release)", @@ -70,4 +70,4 @@ "console": "internalConsole" } ] -} \ No newline at end of file +} From a1d2092cc9ab5cfa0537d1f80aa9a09373d16920 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Fri, 6 Jul 2018 13:29:40 +0900 Subject: [PATCH 052/171] Fix incorrect default drain time --- .../Beatmaps/Patterns/Legacy/PatternGenerator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index 8ef942c683..55081e5822 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -107,7 +107,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int drainTime = (int)(((lastObject?.StartTime ?? 0) - (firstObject?.StartTime ?? 0) - OriginalBeatmap.TotalBreakTime) / 1000); if (drainTime == 0) - drainTime = 100000; + drainTime = 10000; BeatmapDifficulty difficulty = OriginalBeatmap.BeatmapInfo.BaseDifficulty; conversionDifficulty = ((difficulty.DrainRate + MathHelper.Clamp(difficulty.ApproachRate, 4, 7)) / 1.5 + (double)OriginalBeatmap.HitObjects.Count() / drainTime * 9f) / 38f * 5f / 1.15; From b8d314a809c7b39a20d97a35373181954fdbddf9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 16:39:27 +0900 Subject: [PATCH 053/171] Tidy up updater namespace --- osu.Desktop/OsuGameDesktop.cs | 85 ++++++++++--------- osu.Desktop/Overlays/VersionManager.cs | 4 - .../SquirrelUpdateManager.cs | 5 +- 3 files changed, 48 insertions(+), 46 deletions(-) rename osu.Desktop/{Overlays => Updater}/SquirrelUpdateManager.cs (97%) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index 64adcecba4..d27bd70cda 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -12,6 +12,7 @@ using osu.Framework.Platform; using osu.Game; using OpenTK.Input; using Microsoft.Win32; +using osu.Desktop.Updater; using osu.Framework.Platform.Windows; namespace osu.Desktop @@ -38,6 +39,50 @@ namespace osu.Desktop } } + protected override void LoadComplete() + { + base.LoadComplete(); + + if (!noVersionOverlay) + { + LoadComponentAsync(new VersionManager { Depth = int.MinValue }, v => + { + Add(v); + v.State = Visibility.Visible; + }); + +#if NET_FRAMEWORK + Add(new SquirrelUpdateManager()); +#endif + } + } + + public override void SetHost(GameHost host) + { + base.SetHost(host); + var desktopWindow = host.Window as DesktopGameWindow; + if (desktopWindow != null) + { + desktopWindow.CursorState |= CursorState.Hidden; + + desktopWindow.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "lazer.ico")); + desktopWindow.Title = Name; + + desktopWindow.FileDrop += fileDrop; + } + } + + private void fileDrop(object sender, FileDropEventArgs e) + { + var filePaths = new[] { e.FileName }; + + var firstExtension = Path.GetExtension(filePaths.First()); + + if (filePaths.Any(f => Path.GetExtension(f) != firstExtension)) return; + + Task.Factory.StartNew(() => Import(filePaths), TaskCreationOptions.LongRunning); + } + /// /// A method of accessing an osu-stable install in a controlled fashion. /// @@ -77,45 +122,5 @@ namespace osu.Desktop { } } - - protected override void LoadComplete() - { - base.LoadComplete(); - - if (!noVersionOverlay) - { - LoadComponentAsync(new VersionManager { Depth = int.MinValue }, v => - { - Add(v); - v.State = Visibility.Visible; - }); - } - } - - public override void SetHost(GameHost host) - { - base.SetHost(host); - var desktopWindow = host.Window as DesktopGameWindow; - if (desktopWindow != null) - { - desktopWindow.CursorState |= CursorState.Hidden; - - desktopWindow.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), "lazer.ico")); - desktopWindow.Title = Name; - - desktopWindow.FileDrop += fileDrop; - } - } - - private void fileDrop(object sender, FileDropEventArgs e) - { - var filePaths = new[] { e.FileName }; - - var firstExtension = Path.GetExtension(filePaths.First()); - - if (filePaths.Any(f => Path.GetExtension(f) != firstExtension)) return; - - Task.Factory.StartNew(() => Import(filePaths), TaskCreationOptions.LongRunning); - } } } diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index bc1faec822..1129969694 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -91,10 +91,6 @@ namespace osu.Desktop.Overlays } } }; - -#if NET_FRAMEWORK - Add(new SquirrelUpdateManager()); -#endif } protected override void LoadComplete() diff --git a/osu.Desktop/Overlays/SquirrelUpdateManager.cs b/osu.Desktop/Updater/SquirrelUpdateManager.cs similarity index 97% rename from osu.Desktop/Overlays/SquirrelUpdateManager.cs rename to osu.Desktop/Updater/SquirrelUpdateManager.cs index ea86d2f028..81da26cff2 100644 --- a/osu.Desktop/Overlays/SquirrelUpdateManager.cs +++ b/osu.Desktop/Updater/SquirrelUpdateManager.cs @@ -3,6 +3,7 @@ #if NET_FRAMEWORK using System; +using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -16,7 +17,7 @@ using OpenTK; using OpenTK.Graphics; using Squirrel; -namespace osu.Desktop.Overlays +namespace osu.Desktop.Updater { public class SquirrelUpdateManager : Component { @@ -35,7 +36,7 @@ namespace osu.Desktop.Overlays notificationOverlay = notification; if (game.IsDeployedBuild) - Schedule(() => checkForUpdateAsync()); + Schedule(() => Task.Run(() => checkForUpdateAsync())); } private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null) From 7120408a634ef1b272a7dde57e190b74707a9a8b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 16:39:42 +0900 Subject: [PATCH 054/171] Add fallback "updater", which prompts the user to update --- osu.Desktop/OsuGameDesktop.cs | 2 + osu.Desktop/Updater/SimpleUpdateManager.cs | 103 +++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 osu.Desktop/Updater/SimpleUpdateManager.cs diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index d27bd70cda..a4270f22b4 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -53,6 +53,8 @@ namespace osu.Desktop #if NET_FRAMEWORK Add(new SquirrelUpdateManager()); +#else + Add(new SimpleUpdateManager()); #endif } } diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs new file mode 100644 index 0000000000..cda8e6a7ca --- /dev/null +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -0,0 +1,103 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Newtonsoft.Json; +using osu.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Containers; +using osu.Framework.IO.Network; +using osu.Framework.Platform; +using osu.Game; +using osu.Game.Graphics; +using osu.Game.Overlays; +using osu.Game.Overlays.Notifications; + +namespace osu.Desktop.Updater +{ + /// + /// An update manager that shows notifications if a newer release is detected. + /// Installation is left up to the user. + /// + internal class SimpleUpdateManager : CompositeDrawable + { + private NotificationOverlay notificationOverlay; + private string version; + private GameHost host; + + [BackgroundDependencyLoader] + private void load(NotificationOverlay notification, OsuGameBase game, GameHost host) + { + notificationOverlay = notification; + + this.host = host; + version = game.Version; + + if (game.IsDeployedBuild) + Schedule(() => Task.Run(() => checkForUpdateAsync())); + } + + private async void checkForUpdateAsync() + { + var releases = new JsonWebRequest("https://api.github.com/repos/ppy/osu/releases/latest"); + await releases.PerformAsync(); + + var latest = releases.ResponseObject; + + if (latest.TagName != version) + { + notificationOverlay.Post(new SimpleNotification + { + Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + + "Click here to download the new version, which can be installed over the top of your existing installation", + Icon = FontAwesome.fa_upload, + Activated = () => + { + host.OpenUrlExternally(getBestUrl(latest)); + return true; + } + }); + } + } + + private string getBestUrl(GitHubRelease release) + { + GitHubAsset bestAsset = null; + + switch (RuntimeInfo.OS) + { + case RuntimeInfo.Platform.Windows: + bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe")); + break; + case RuntimeInfo.Platform.MacOsx: + bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".dmg")); + break; + } + + return bestAsset?.BrowserDownloadUrl ?? release.HtmlUrl; + } + + public class GitHubRelease + { + [JsonProperty("html_url")] + public string HtmlUrl { get; set; } + + [JsonProperty("tag_name")] + public string TagName { get; set; } + + [JsonProperty("assets")] + public List Assets { get; set; } + } + + public class GitHubAsset + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("browser_download_url")] + public string BrowserDownloadUrl { get; set; } + } + } +} From 54db2877918186d1ddff1cd568312e3353734504 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 17:45:39 +0900 Subject: [PATCH 055/171] Remove casting --- osu.Game/Graphics/Cursor/MenuCursor.cs | 32 ++++++++++++++------------ 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 14a976f0c0..517be4c055 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -22,7 +22,9 @@ namespace osu.Game.Graphics.Cursor private readonly IBindable screenshotCursorVisibility = new Bindable(true); public override bool IsPresent => screenshotCursorVisibility.Value && base.IsPresent; - protected override Drawable CreateCursor() => new Cursor(); + protected override Drawable CreateCursor() => activeCursor = new Cursor(); + + private Cursor activeCursor; private Bindable cursorRotate; private DragRotationState dragRotationState; @@ -54,12 +56,12 @@ namespace osu.Game.Graphics.Cursor float degrees = (float)MathHelper.RadiansToDegrees(Math.Atan2(-offset.X, offset.Y)) + 24.3f; // Always rotate in the direction of least distance - float diff = (degrees - ActiveCursor.Rotation) % 360; + float diff = (degrees - activeCursor.Rotation) % 360; if (diff < -180) diff += 360; if (diff > 180) diff -= 360; - degrees = ActiveCursor.Rotation + diff; + degrees = activeCursor.Rotation + diff; - ActiveCursor.RotateTo(degrees, 600, Easing.OutQuint); + activeCursor.RotateTo(degrees, 600, Easing.OutQuint); } } @@ -71,11 +73,11 @@ namespace osu.Game.Graphics.Cursor // only trigger animation for main mouse buttons if (args.Button <= MouseButton.Right) { - ActiveCursor.Scale = new Vector2(1); - ActiveCursor.ScaleTo(0.90f, 800, Easing.OutQuint); + activeCursor.Scale = new Vector2(1); + activeCursor.ScaleTo(0.90f, 800, Easing.OutQuint); - ((Cursor)ActiveCursor).AdditiveLayer.Alpha = 0; - ((Cursor)ActiveCursor).AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); + activeCursor.AdditiveLayer.Alpha = 0; + activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); } if (args.Button == MouseButton.Left && cursorRotate) @@ -90,14 +92,14 @@ namespace osu.Game.Graphics.Cursor { if (!state.Mouse.HasMainButtonPressed) { - ((Cursor)ActiveCursor).AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); - ActiveCursor.ScaleTo(1, 500, Easing.OutElastic); + activeCursor.AdditiveLayer.FadeOutFromOne(500, Easing.OutQuint); + activeCursor.ScaleTo(1, 500, Easing.OutElastic); } if (args.Button == MouseButton.Left) { if (dragRotationState == DragRotationState.Rotating) - ActiveCursor.RotateTo(0, 600 * (1 + Math.Abs(ActiveCursor.Rotation / 720)), Easing.OutElasticHalf); + activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); dragRotationState = DragRotationState.NotDragging; } return base.OnMouseUp(state, args); @@ -105,14 +107,14 @@ namespace osu.Game.Graphics.Cursor protected override void PopIn() { - ActiveCursor.FadeTo(1, 250, Easing.OutQuint); - ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); + activeCursor.FadeTo(1, 250, Easing.OutQuint); + activeCursor.ScaleTo(1, 400, Easing.OutQuint); } protected override void PopOut() { - ActiveCursor.FadeTo(0, 250, Easing.OutQuint); - ActiveCursor.ScaleTo(0.6f, 250, Easing.In); + activeCursor.FadeTo(0, 250, Easing.OutQuint); + activeCursor.ScaleTo(0.6f, 250, Easing.In); } public class Cursor : Container From c025158735b96c275d8d31b13c27305c1ba3a271 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 6 Jul 2018 17:53:01 +0900 Subject: [PATCH 056/171] Give VisibleState a default rather than nullable --- osu.Game/Screens/Menu/Button.cs | 4 ++-- osu.Game/Screens/Menu/ButtonSystem.cs | 6 +----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index f862905b5e..29820f234d 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Menu /// /// The menu state for which we are visible for. /// - public ButtonSystemState? VisibleState; + public ButtonSystemState VisibleState = ButtonSystemState.TopLevel; private readonly Action clickAction; private readonly Key triggerKey; @@ -300,7 +300,7 @@ namespace osu.Game.Screens.Menu State = ButtonState.Contracted; break; default: - if (!VisibleState.HasValue || value == VisibleState) + if (value == VisibleState) State = ButtonState.Expanded; else if (value < VisibleState) State = ButtonState.Contracted; diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 4f2437cf01..1a0cd4fa5b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -73,10 +73,7 @@ namespace osu.Game.Screens.Menu buttonArea.AddRange(new[] { - new Button(@"settings", string.Empty, FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O) - { - VisibleState = ButtonSystemState.TopLevel, - }, + new Button(@"settings", string.Empty, FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O), backButton = new Button(@"back", @"button-back-select", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), () => State = ButtonSystemState.TopLevel, -WEDGE_WIDTH) { VisibleState = ButtonSystemState.Play, @@ -98,7 +95,6 @@ namespace osu.Game.Screens.Menu buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); - buttonsTopLevel.ForEach(b => b.VisibleState = ButtonSystemState.TopLevel); buttonArea.AddRange(buttonsPlay); buttonArea.AddRange(buttonsTopLevel); From f92a90c098002fd4ea63052e3ca681944ffcfa64 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jul 2018 02:03:42 +0900 Subject: [PATCH 057/171] Update README.md --- README.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9d19f16ebd..c270da198f 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,32 @@ # osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy) -Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! +Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! Commonly known by the codename "osu!lazer". Pew pew. # Status -This is still heavily under development and is not intended for end-user use. This repository is intended for developer collaboration. You're welcome to try and use it but please do not submit bug reports without a patch. Please do not ask for help building or using this software. +This project is still heavily under development, but is in a state where users are encouraged to try it out and keep it installed alongside the stable osu! client. It will continue to evolve over the coming months and hopefully bring some new unique features to the table. + +We are accepting bug reports (please report with as much detail as possible). Feature requests are welcome as long as you read and understand the contribution guidelines listed below. # Requirements -- A desktop platform that can compile .NET 4.7.1. We recommend using [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio for Mac](https://www.visualstudio.com/vs/visual-studio-mac/) (macOS) or [MonoDevelop](http://www.monodevelop.com/download/) (Linux), all of which are free. [Visual Studio Code](https://code.visualstudio.com/) may also be used but requires further setup steps which are not covered here. +- A desktop platform with the [.NET Core SDK 2.1](https://www.microsoft.com/net/learn/get-started) or higher installed. +- When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio Community Edition](https://www.visualstudio.com/) (Windows), [Visual Studio Code](https://code.visualstudio.com/) (with the C# plugin installed) or [Jetbrains Rider](https://www.jetbrains.com/rider/) (commercial). -# Getting Started -- Clone the repository including submodules (`git clone --recurse-submodules https://github.com/ppy/osu`) -- Build in your IDE of choice (recommended IDEs automatically restore nuget packages; if you are using an alternative make sure to `nuget restore`) +# Building and running + +If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled (download and run the install executable for your platform). + +Clone the repository including submodules + +`git clone --recurse-submodules https://github.com/ppy/osu` + +Build and run + +- Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) +- From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` + +The above methods should automatically do so, but if you run into issues building you may need to `nuget restore`. # Contributing From 27311ce1fcfaa228cb3675d04361a92db6b38792 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 8 Jul 2018 11:21:18 +0900 Subject: [PATCH 058/171] Update nuget restore instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c270da198f..fd0ba838cc 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` -The above methods should automatically do so, but if you run into issues building you may need to `nuget restore`. +The above methods should automatically do so, but if you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). # Contributing From e223074876d09c8897a8aa4af88f01a6446d157b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 00:24:55 +0900 Subject: [PATCH 059/171] Fix import failures if single set has multiple conflicting OnlineBeatmapIDs Resolves #2970. --- osu.Game/Beatmaps/BeatmapManager.cs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e488dacf80..fd24e4297b 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -339,6 +339,8 @@ namespace osu.Game.Beatmaps { var beatmapInfos = new List(); + bool invalidateOnlineIDs = false; + foreach (var name in reader.Filenames.Where(f => f.EndsWith(".osu"))) { using (var raw = reader.GetStream(name)) @@ -355,9 +357,18 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash(); beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash(); - // check that no existing beatmap exists that is imported with the same online beatmap ID. if so, give it precedence. - if (beatmap.BeatmapInfo.OnlineBeatmapID.HasValue && QueryBeatmap(b => b.OnlineBeatmapID.Value == beatmap.BeatmapInfo.OnlineBeatmapID.Value) != null) - beatmap.BeatmapInfo.OnlineBeatmapID = null; + if (beatmap.BeatmapInfo.OnlineBeatmapID.HasValue) + { + var ourId = beatmap.BeatmapInfo.OnlineBeatmapID; + + // check that no existing beatmap in database exists that is imported with the same online beatmap ID. if so, give it precedence. + if (QueryBeatmap(b => b.OnlineBeatmapID.Value == ourId) != null) + beatmap.BeatmapInfo.OnlineBeatmapID = null; + + // check that no other beatmap in this imported set has a conflicting online beatmap ID. If so, presume *all* are incorrect. + if (beatmapInfos.Any(b => b.OnlineBeatmapID == ourId)) + invalidateOnlineIDs = true; + } RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID); @@ -375,6 +386,9 @@ namespace osu.Game.Beatmaps } } + if (invalidateOnlineIDs) + beatmapInfos.ForEach(b => b.OnlineBeatmapID = null); + return beatmapInfos; } From 157ca8b2a44d27e4f10f8330d302a4bbcd3b4118 Mon Sep 17 00:00:00 2001 From: Ethan Yang Date: Sun, 8 Jul 2018 11:47:39 -0700 Subject: [PATCH 060/171] Change osu key bindings --- osu.Game.Rulesets.Osu/OsuRuleset.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index ce80537b93..b8ba1e2945 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -31,8 +31,8 @@ namespace osu.Game.Rulesets.Osu public override IEnumerable GetDefaultKeyBindings(int variant = 0) => new[] { - new KeyBinding(InputKey.Z, OsuAction.LeftButton), - new KeyBinding(InputKey.X, OsuAction.RightButton), + new KeyBinding(InputKey.A, OsuAction.LeftButton), + new KeyBinding(InputKey.S, OsuAction.RightButton), new KeyBinding(InputKey.MouseLeft, OsuAction.LeftButton), new KeyBinding(InputKey.MouseRight, OsuAction.RightButton), }; From b20afb915db429e0e3c2463d88e19d98c52e9684 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 15:26:22 +0900 Subject: [PATCH 061/171] Fix right mouse activated absolute scroll not working --- osu.Game/OsuGameBase.cs | 30 ++++++++++++++++++++++++++++++ osu.Game/osu.Game.csproj | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 246229a794..c1d5ae581e 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -20,6 +20,7 @@ using osu.Game.Graphics.Cursor; using osu.Game.Online.API; using osu.Framework.Graphics.Performance; using osu.Framework.Graphics.Textures; +using osu.Framework.Input; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Database; @@ -30,6 +31,7 @@ using osu.Game.IO; using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; +using OpenTK.Input; using DebugUtils = osu.Game.Utils.DebugUtils; namespace osu.Game @@ -98,6 +100,8 @@ namespace osu.Game private DatabaseContextFactory contextFactory; + protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager(); + [BackgroundDependencyLoader] private void load() { @@ -267,5 +271,31 @@ namespace osu.Game return copy; } } + + private class OsuUserInputManager : UserInputManager + { + protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button) + { + switch (button) + { + case MouseButton.Right: + return new RightMouseManager(button); + } + + return base.CreateButtonManagerFor(button); + } + + private class RightMouseManager : MouseButtonEventManager + { + public RightMouseManager(MouseButton button) + : base(button) + { + } + + public override bool EnableDrag => true; // allow right-mouse dragging for absolute scroll in scroll containers. + public override bool EnableClick => false; + public override bool ChangeFocusOnClick => false; + } + } } } diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da55726447..cac3459412 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 0a67e5a274676b0bbb7146ce9c4b1fda24ec7c49 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 9 Jul 2018 17:09:17 +0900 Subject: [PATCH 062/171] Fix some possible null reference exceptions --- osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 4 +++- osu.Game/Users/Country.cs | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 2a11bf8346..228633a41f 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -46,7 +46,9 @@ namespace osu.Game.Screens.Select.Leaderboards public void UpdateRank(ScoreRank newRank) { Rank = newRank; - updateTexture(); + + if (IsLoaded) + updateTexture(); } } } diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index c9b577a62f..98b3a2df0c 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -42,7 +42,9 @@ namespace osu.Game.Users return; country = value; - sprite.Texture = getFlagTexture(); + + if (IsLoaded) + sprite.Texture = getFlagTexture(); } } From 930667d0f9046ac16bae01598a7262a4236adf2b Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 9 Jul 2018 10:12:10 +0200 Subject: [PATCH 063/171] Remove unused age display code --- osu.Game/Overlays/Profile/ProfileHeader.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c72ff6131b..c5510d3d70 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -360,11 +360,6 @@ namespace osu.Game.Overlays.Profile Text = text }; - if (user.Age != null) - { - infoTextLeft.AddText($"{user.Age} years old ", boldItalic); - } - if (user.Country != null) { infoTextLeft.AddText("From ", lightText); From 10aae3b0eead50a05be15cfb2e218ffc9a5ac4be Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Mon, 9 Jul 2018 10:33:46 +0200 Subject: [PATCH 064/171] Remove age from User class --- osu.Game.Tests/Visual/TestCaseUserProfile.cs | 1 - osu.Game/Users/User.cs | 3 --- 2 files changed, 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/TestCaseUserProfile.cs index aca832110a..cb281d045b 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/TestCaseUserProfile.cs @@ -53,7 +53,6 @@ namespace osu.Game.Tests.Visual CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg", JoinDate = DateTimeOffset.Now.AddDays(-1), LastVisit = DateTimeOffset.Now, - Age = 1, ProfileOrder = new[] { "me" }, Statistics = new UserStatistics { diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index e1f68e1ce8..f42df4023f 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -23,9 +23,6 @@ namespace osu.Game.Users public Bindable Status = new Bindable(); - [JsonProperty(@"age")] - public int? Age; - //public Team Team; [JsonProperty(@"profile_colour")] From df67c0498de51314d30cdbeeeb4741bc92c7f302 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 17:53:39 +0900 Subject: [PATCH 065/171] Fix OSD fade-in not correctly debouncing It could potentially never fade in on quick presses. --- .../Visual/TestCaseOnScreenDisplay.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 38 +++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs b/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs index 123c1fe055..bc232d814d 100644 --- a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs +++ b/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs @@ -88,7 +88,7 @@ namespace osu.Game.Tests.Visual private class TestOnScreenDisplay : OnScreenDisplay { - protected override void Display(Drawable toDisplay) => toDisplay.FadeIn().ResizeHeightTo(110); + protected override void DisplayTemporarily(Drawable toDisplay) => toDisplay.FadeIn().ResizeHeightTo(110); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 1c80f2e626..753cd33cc6 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -14,6 +14,8 @@ using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics.Transforms; +using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics.Sprites; @@ -135,7 +137,7 @@ namespace osu.Game.Overlays /// If is already being tracked from the same . public void BeginTracking(object source, ITrackableConfigManager configManager) { - if (configManager == null) throw new ArgumentNullException(nameof(configManager)); + if (configManager == null) throw new ArgumentNullException(nameof(configManager)); if (trackedConfigManagers.ContainsKey((source, configManager))) throw new InvalidOperationException($"{nameof(configManager)} is already registered."); @@ -159,7 +161,7 @@ namespace osu.Game.Overlays /// If is not being tracked from the same . public void StopTracking(object source, ITrackableConfigManager configManager) { - if (configManager == null) throw new ArgumentNullException(nameof(configManager)); + if (configManager == null) throw new ArgumentNullException(nameof(configManager)); if (!trackedConfigManagers.TryGetValue((source, configManager), out var existing)) throw new InvalidOperationException($"{nameof(configManager)} is not registered."); @@ -181,7 +183,7 @@ namespace osu.Game.Overlays if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; - Display(box); + DisplayTemporarily(box); int optionCount = 0; int selectedOption = -1; @@ -213,15 +215,29 @@ namespace osu.Game.Overlays }); } - protected virtual void Display(Drawable toDisplay) + private TransformSequence fadeIn; + private ScheduledDelegate fadeOut; + + protected virtual void DisplayTemporarily(Drawable toDisplay) { - toDisplay.Animate( - b => b.FadeIn(500, Easing.OutQuint), - b => b.ResizeHeightTo(height, 500, Easing.OutQuint) - ).Then( - b => b.FadeOutFromOne(1500, Easing.InQuint), - b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint) - ); + // avoid starting a new fade-in if one is already active. + if (fadeIn == null) + { + fadeIn = toDisplay.Animate( + b => b.FadeIn(500, Easing.OutQuint), + b => b.ResizeHeightTo(height, 500, Easing.OutQuint) + ); + + fadeIn.Finally(_ => fadeIn = null); + } + + fadeOut?.Cancel(); + fadeOut = Scheduler.AddDelayed(() => + { + toDisplay.Animate( + b => b.FadeOutFromOne(1500, Easing.InQuint), + b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint)); + }, 500); } private class OptionLight : Container From 09b3375a9d157ac4380f0f4308cd9e2f43a7d8fb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 18:12:23 +0900 Subject: [PATCH 066/171] Fix pressing escape too fast causing multiple exit attempts at song select --- osu.Game/Screens/Select/SongSelect.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9c62f92311..1d051a159e 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -138,7 +138,11 @@ namespace osu.Game.Screens.Select Height = filter_height, FilterChanged = c => Carousel.Filter(c), Background = { Width = 2 }, - Exit = Exit, + Exit = () => + { + if (IsCurrentScreen) + Exit(); + }, }, } }, From 49e94850b62b552bbb598cb509ea8b7f05357788 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 18:43:20 +0900 Subject: [PATCH 067/171] Fix being able to trigger player before carousel is ready Causes an eventual crash. --- osu.Game/Screens/Select/SongSelect.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9c62f92311..6b0f9d83cf 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -231,6 +231,10 @@ namespace osu.Game.Screens.Select /// Whether to trigger . public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true) { + // avoid attempting to continue before a selection has been obtained. + // this could happen via a user interaction while the carousel is still in a loading state. + if (Carousel.SelectedBeatmap == null) return; + // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). Carousel.FlushPendingFilterOperations(); From abfebbddd9c666a7fe3b973b0dc6efb8c571b09d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 9 Jul 2018 23:50:45 +0900 Subject: [PATCH 068/171] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index da55726447..ec2742d4a9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 974c4f5185f98bee0a1b61cf6f79c137d8de6882 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 01:20:21 +0900 Subject: [PATCH 069/171] ToolbarMode* -> ToolbarRuleset* --- osu.Game.Tests/Visual/TestCaseToolbar.cs | 4 ++-- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- .../{ToolbarModeButton.cs => ToolbarRulesetButton.cs} | 2 +- ...oolbarModeSelector.cs => ToolbarRulesetSelector.cs} | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game/Overlays/Toolbar/{ToolbarModeButton.cs => ToolbarRulesetButton.cs} (96%) rename osu.Game/Overlays/Toolbar/{ToolbarModeSelector.cs => ToolbarRulesetSelector.cs} (93%) diff --git a/osu.Game.Tests/Visual/TestCaseToolbar.cs b/osu.Game.Tests/Visual/TestCaseToolbar.cs index fd218af054..96f14e6b32 100644 --- a/osu.Game.Tests/Visual/TestCaseToolbar.cs +++ b/osu.Game.Tests/Visual/TestCaseToolbar.cs @@ -16,8 +16,8 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { typeof(ToolbarButton), - typeof(ToolbarModeSelector), - typeof(ToolbarModeButton), + typeof(ToolbarRulesetSelector), + typeof(ToolbarRulesetButton), typeof(ToolbarNotificationButton), }; diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 48d0674b3d..eeace2f11c 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Toolbar { Action = () => OnHome?.Invoke() }, - new ToolbarModeSelector() + new ToolbarRulesetSelector() } }, new FillFlowContainer diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs similarity index 96% rename from osu.Game/Overlays/Toolbar/ToolbarModeButton.cs rename to osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs index 90b9abb2e4..bbdf796e7a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs @@ -7,7 +7,7 @@ using OpenTK.Graphics; namespace osu.Game.Overlays.Toolbar { - public class ToolbarModeButton : ToolbarButton + public class ToolbarRulesetButton : ToolbarButton { private RulesetInfo ruleset; public RulesetInfo Ruleset diff --git a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs similarity index 93% rename from osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs rename to osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index dae4f84b1a..b1af3f0d62 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarModeSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -16,18 +16,18 @@ using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar { - public class ToolbarModeSelector : Container + public class ToolbarRulesetSelector : Container { private const float padding = 10; private readonly FillFlowContainer modeButtons; private readonly Drawable modeButtonLine; - private ToolbarModeButton activeButton; + private ToolbarRulesetButton activeButton; private RulesetStore rulesets; private readonly Bindable ruleset = new Bindable(); - public ToolbarModeSelector() + public ToolbarRulesetSelector() { RelativeSizeAxes = Axes.Y; @@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Toolbar this.rulesets = rulesets; foreach (var r in rulesets.AvailableRulesets) { - modeButtons.Add(new ToolbarModeButton + modeButtons.Add(new ToolbarRulesetButton { Ruleset = r, Action = delegate { ruleset.Value = r; } @@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Toolbar private void rulesetChanged(RulesetInfo ruleset) { - foreach (ToolbarModeButton m in modeButtons.Children.Cast()) + foreach (ToolbarRulesetButton m in modeButtons.Children.Cast()) { bool isActive = m.Ruleset.ID == ruleset.ID; m.Active = isActive; From 9e59b4a8e2122f6ed824795f546bbe6cc86703a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 01:29:24 +0900 Subject: [PATCH 070/171] Fix SongSelect binding to ruleset too early Causes music to stop playing while at main menu. --- osu.Game/Screens/Select/SongSelect.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 85eecd5c1a..81502fc024 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -193,8 +193,6 @@ namespace osu.Game.Screens.Select dependencies.CacheAs(Ruleset); dependencies.CacheAs>(Ruleset); - base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); - if (Footer != null) { Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); @@ -222,6 +220,12 @@ namespace osu.Game.Screens.Select Beatmap.BindValueChanged(workingBeatmapChanged); } + protected override void LoadComplete() + { + base.LoadComplete(); + base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); + } + public void Edit(BeatmapInfo beatmap) { Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); From ba258b8a054398a1a860220db453301245b064b8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 02:56:00 +0900 Subject: [PATCH 071/171] Fix lack of fallback logic for custom bank samples Closes #2966. --- Was causing some beatmaps to not play all of their hitsounds --- osu.Game/Audio/SampleInfo.cs | 13 ++++++++++++- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 7e329ac651..9ed40c648e 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -29,6 +29,11 @@ namespace osu.Game.Audio /// public string Name; + /// + /// An optional suffix to provide priority lookup. Falls back to non-suffixed . + /// + public string Suffix; + /// /// The sample volume. /// @@ -41,9 +46,15 @@ namespace osu.Game.Audio { get { + if (!string.IsNullOrEmpty(Suffix)) + { + if (!string.IsNullOrEmpty(Namespace)) + yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; + yield return $"{Bank}-{Name}{Suffix}"; // Without namespace as a fallback even when we have a namespace + } + if (!string.IsNullOrEmpty(Namespace)) yield return $"{Namespace}/{Bank}-{Name}"; - yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace } } diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 22a6acf459..c8874c3bc7 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -179,7 +179,7 @@ namespace osu.Game.Beatmaps.Formats var baseInfo = base.ApplyTo(sampleInfo); if (CustomSampleBank > 1) - baseInfo.Name += CustomSampleBank; + baseInfo.Suffix = CustomSampleBank.ToString(); return baseInfo; } From 7f315d79c27cea08e07a8c321cb69094232ab19e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 13:06:03 +0900 Subject: [PATCH 072/171] Fix pixel gap in user profile when scrolling --- osu.Game/Overlays/Profile/ProfileHeader.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c5510d3d70..9d09836d25 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -158,6 +158,13 @@ namespace osu.Game.Overlays.Profile } } }, + new Box // this is a temporary workaround for incorrect masking behaviour of FillMode.Fill used in UserCoverBackground (see https://github.com/ppy/osu-framework/issues/1675) + { + RelativeSizeAxes = Axes.X, + Height = 1, + Y = cover_height, + Colour = OsuColour.Gray(34), + }, infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14) { X = UserProfileOverlay.CONTENT_X_MARGIN, From 14c3cc70b15da9a3ac20cb25c37e704a8536dc61 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 15:23:47 +0900 Subject: [PATCH 073/171] Prefer namespace lookups first --- osu.Game/Audio/SampleInfo.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 9ed40c648e..4345d09e05 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -46,16 +46,17 @@ namespace osu.Game.Audio { get { - if (!string.IsNullOrEmpty(Suffix)) + if (!string.IsNullOrEmpty(Namespace)) { - if (!string.IsNullOrEmpty(Namespace)) + if (!string.IsNullOrEmpty(Suffix)) yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; - yield return $"{Bank}-{Name}{Suffix}"; // Without namespace as a fallback even when we have a namespace + yield return $"{Namespace}/{Bank}-{Name}"; } - if (!string.IsNullOrEmpty(Namespace)) - yield return $"{Namespace}/{Bank}-{Name}"; - yield return $"{Bank}-{Name}"; // Without namespace as a fallback even when we have a namespace + // check non-namespace as a fallback even when we have a namespace + if (!string.IsNullOrEmpty(Suffix)) + yield return $"{Bank}-{Name}{Suffix}"; + yield return $"{Bank}-{Name}"; } } From bf1ce8cdd8895f618437ca39857609bc15871f84 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 10 Jul 2018 16:02:13 +0900 Subject: [PATCH 074/171] Fix linking still being broken --- osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index eaa0ac4aaa..1a1f13933d 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Profile.Sections Action = () => { if (beatmap.OnlineBeatmapID != null) - beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.OnlineBeatmapID.Value); + beatmapSetOverlay?.FetchAndShowBeatmap(beatmap.OnlineBeatmapID.Value); else if (beatmap.BeatmapSet?.OnlineBeatmapSetID != null) beatmapSetOverlay?.FetchAndShowBeatmapSet(beatmap.BeatmapSet.OnlineBeatmapSetID.Value); }; From ab155e511f88db6dd25e565d85f9a40269cad196 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Tue, 10 Jul 2018 16:09:18 +0900 Subject: [PATCH 075/171] Remove commented disable-once --- osu.Game/Graphics/SpriteIcon.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 45c4cebfcf..6acd20719e 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -10,7 +10,6 @@ using osu.Framework.IO.Stores; using OpenTK; using OpenTK.Graphics; using osu.Framework.Caching; -// ReSharper disable IdentifierTypo namespace osu.Game.Graphics { From 65d351c31a7494c1103e92a2425a24310d482d01 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 10 Jul 2018 16:26:04 +0900 Subject: [PATCH 076/171] Fix failing test cases --- .../Beatmaps/Formats/LegacyBeatmapDecoderTest.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index ad203d2107..2f5b4a13d9 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -222,10 +222,10 @@ namespace osu.Game.Tests.Beatmaps.Formats { var hitObjects = decoder.Decode(stream).HitObjects; - Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[0]).Name); - Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[1]).Name); - Assert.AreEqual("hitnormal2", getTestableSampleInfo(hitObjects[2]).Name); - Assert.AreEqual("hitnormal", getTestableSampleInfo(hitObjects[3]).Name); + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[3]).LookupNames.First()); } SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); @@ -242,7 +242,7 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("hit_1.wav", hitObjects[0].Samples[0].LookupNames.First()); Assert.AreEqual("hit_2.wav", hitObjects[1].Samples[0].LookupNames.First()); - Assert.AreEqual("hitnormal2", getTestableSampleInfo(hitObjects[2]).Name); + Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); Assert.AreEqual("hit_1.wav", hitObjects[3].Samples[0].LookupNames.First()); } From 2150cb10283ad38604c9b67aa6b3abcad6568aeb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 20:30:08 +0900 Subject: [PATCH 077/171] Update framework and other packages --- osu.Desktop/Program.cs | 6 ++---- osu.Game/osu.Game.csproj | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index 780a9994fd..7e6a07c89f 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -7,6 +7,7 @@ using System.Linq; using osu.Framework; using osu.Framework.Platform; using osu.Game.IPC; + #if NET_FRAMEWORK using System.Runtime; #endif @@ -18,10 +19,7 @@ namespace osu.Desktop [STAThread] public static int Main(string[] args) { - // required to initialise native SQLite libraries on some platforms. - - if (!RuntimeInfo.IsMono) - useMultiCoreJit(); + useMultiCoreJit(); // Back up the cwd before DesktopGameHost changes it var cwd = Environment.CurrentDirectory; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index ec2742d4a9..f7c8c62e91 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -14,11 +14,11 @@ - + - + From dd20663192abde634e45437ec39a3c749fb95266 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Tue, 10 Jul 2018 17:28:56 +0200 Subject: [PATCH 078/171] Lesser keyboard steps --- .../Overlays/Settings/Sections/Audio/OffsetSettings.cs | 2 +- .../Overlays/Settings/Sections/Audio/VolumeSettings.cs | 8 ++++---- .../Settings/Sections/Gameplay/GeneralSettings.cs | 4 ++-- .../Settings/Sections/Gameplay/SongSelectSettings.cs | 4 ++-- .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 4 ++-- osu.Game/Overlays/Settings/Sections/SkinSection.cs | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 8850f716e0..0fe41327db 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { LabelText = "Audio Offset", Bindable = config.GetBindable(OsuSetting.AudioOffset), - KeyboardStep = 100f + KeyboardStep = 1f }, new SettingsButton { diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 80896c163f..369c751448 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -17,10 +17,10 @@ namespace osu.Game.Overlays.Settings.Sections.Audio { Children = new Drawable[] { - new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.1f }, - new SettingsSlider { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.1f }, - new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.1f }, - new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.1f }, + new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Master (Window Inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, }; } } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 9c8f5e2643..21d5d452bf 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -21,13 +21,13 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { LabelText = "Background dim", Bindable = config.GetBindable(OsuSetting.DimLevel), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Background blur", Bindable = config.GetBindable(OsuSetting.BlurLevel), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsCheckbox { diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs index 7893d76fb8..235ff0f319 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs @@ -31,13 +31,13 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay { LabelText = "Display beatmaps from", Bindable = config.GetBindable(OsuSetting.DisplayStarsMinimum), - KeyboardStep = 1f + KeyboardStep = 0.1f }, new SettingsSlider { LabelText = "up to", Bindable = config.GetBindable(OsuSetting.DisplayStarsMaximum), - KeyboardStep = 1f + KeyboardStep = 0.1f }, new SettingsEnumDropdown { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 1f87a635de..42028f6bd5 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -50,13 +50,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "Horizontal position", Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionX), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Vertical position", Bindable = config.GetBindable(FrameworkSetting.LetterboxPositionY), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, } }, diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 18a371e904..df8ebaf4aa 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -36,13 +36,13 @@ namespace osu.Game.Overlays.Settings.Sections { LabelText = "Menu cursor size", Bindable = config.GetBindable(OsuSetting.MenuCursorSize), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Gameplay cursor size", Bindable = config.GetBindable(OsuSetting.GameplayCursorSize), - KeyboardStep = 0.1f + KeyboardStep = 0.01f }, new SettingsCheckbox { From 1418d1369fe76c5e76a0cfaeda57b331334d090f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 01:32:10 +0900 Subject: [PATCH 079/171] Add the ability to click completed download notifications to select beatmap Closes #2731. --- osu.Game/Beatmaps/BeatmapManager.cs | 15 ++++++++++++++- osu.Game/OsuGame.cs | 27 +++++++++++++++++++++++++++ osu.Game/Screens/Menu/MainMenu.cs | 6 +++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fd24e4297b..e63f70610e 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -45,6 +45,11 @@ namespace osu.Game.Beatmaps /// public event Action BeatmapDownloadBegan; + /// + /// Fired when a beatmap load is requested (into the interactive game UI). + /// + public Action PresentBeatmap; + /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// @@ -163,12 +168,20 @@ namespace osu.Game.Beatmaps Task.Factory.StartNew(() => { + BeatmapSetInfo importedBeatmap; + // This gets scheduled back to the update thread, but we want the import to run in the background. using (var stream = new MemoryStream(data)) using (var archive = new ZipArchiveReader(stream, beatmapSetInfo.ToString())) - Import(archive); + importedBeatmap = Import(archive); + downloadNotification.CompletionClickAction = () => + { + PresentBeatmap?.Invoke(importedBeatmap); + return true; + }; downloadNotification.State = ProgressNotificationState.Completed; + currentDownloads.Remove(request); }, TaskCreationOptions.LongRunning); }; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 922d228701..f8fdaf368c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -23,6 +23,7 @@ using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Platform; using osu.Framework.Threading; +using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Rulesets.Scoring; using osu.Game.Overlays.Notifications; @@ -33,6 +34,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Skinning; using OpenTK.Graphics; using osu.Game.Overlays.Volume; +using osu.Game.Screens.Select; namespace osu.Game { @@ -178,6 +180,30 @@ namespace osu.Game /// The set to display. public void ShowBeatmapSet(int setId) => beatmapSetOverlay.FetchAndShowBeatmapSet(setId); + /// + /// Present a beatmap at song select. + /// + /// The beatmap to select. + public void PresentBeatmap(BeatmapSetInfo beatmap) + { + CloseAllOverlays(); + + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + + switch (currentScreen) + { + case SongSelect _: + break; + default: + // navigate to song select if we are not already there. + var menu = (MainMenu)intro.ChildScreen; + + menu.MakeCurrent(); + menu.LoadToSolo(); + break; + } + } + /// /// Show a user's profile as an overlay. /// @@ -244,6 +270,7 @@ namespace osu.Game BeatmapManager.PostNotification = n => notifications?.Post(n); BeatmapManager.GetStableStorage = GetStorageForStableInstall; + BeatmapManager.PresentBeatmap = PresentBeatmap; AddRange(new Drawable[] { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index d922f49ce3..4790996833 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Menu OnChart = delegate { Push(new ChartListing()); }, OnDirect = delegate { Push(new OnlineListing()); }, OnEdit = delegate { Push(new Editor()); }, - OnSolo = delegate { Push(consumeSongSelect()); }, + OnSolo = onSolo, OnMulti = delegate { Push(new Multiplayer()); }, OnExit = Exit, } @@ -85,6 +85,10 @@ namespace osu.Game.Screens.Menu LoadComponentAsync(songSelect = new PlaySongSelect()); } + public void LoadToSolo() => Schedule(onSolo); + + private void onSolo() => Push(consumeSongSelect()); + private Screen consumeSongSelect() { var s = songSelect; From 7157428882545b367e4bc975556a9361a620e735 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 02:59:00 +0900 Subject: [PATCH 080/171] Fix import failure of beatmap sets containing duplicate beatmap difficulties --- osu.Game/Beatmaps/BeatmapManager.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fd24e4297b..fc4d43080e 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -92,7 +92,7 @@ namespace osu.Game.Beatmaps // by setting the model here, we can update the noline set id below. b.BeatmapSet = model; - fetchAndPopulateOnlineIDs(b); + fetchAndPopulateOnlineIDs(b, model.Beatmaps); } // check if a set already exists with the same online id, delete if it does. @@ -396,9 +396,10 @@ namespace osu.Game.Beatmaps /// Query the API to populate mising OnlineBeatmapID / OnlineBeatmapSetID properties. /// /// The beatmap to populate. + /// The other beatmaps contained within this set. /// Whether to re-query if the provided beatmap already has populated values. /// True if population was successful. - private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, bool force = false) + private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) return true; @@ -418,6 +419,12 @@ namespace osu.Game.Beatmaps Logger.Log($"Successfully mapped to {res.OnlineBeatmapSetID} / {res.OnlineBeatmapID}.", LoggingTarget.Database); + if (otherBeatmaps.Any(b => b.OnlineBeatmapID == res.OnlineBeatmapID)) + { + Logger.Log("Another beatmap in the same set already mapped to this ID. We'll skip adding it this time.", LoggingTarget.Database); + return false; + } + beatmap.BeatmapSet.OnlineBeatmapSetID = res.OnlineBeatmapSetID; beatmap.OnlineBeatmapID = res.OnlineBeatmapID; return true; From 55e0cd770d5c8451634ff461b402d29546cb4054 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Wed, 11 Jul 2018 11:24:43 +0900 Subject: [PATCH 081/171] Use BypassAutoSizeAxes --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 5d4d627995..d407dc9cf9 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -102,6 +102,7 @@ namespace osu.Game.Overlays.KeyBinding RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding(padding), + Padding = new MarginPadding { Top = height }, Alpha = 0, Colour = colours.YellowDark } @@ -267,7 +268,7 @@ namespace osu.Game.Overlays.KeyBinding GetContainingInputManager().ChangeFocus(null); pressAKey.FadeOut(300, Easing.OutQuint); - pressAKey.Padding = new MarginPadding { Top = height, Bottom = -pressAKey.DrawHeight }; + pressAKey.BypassAutoSizeAxes |= Axes.Y; } protected override void OnFocus(InputState state) @@ -276,7 +277,7 @@ namespace osu.Game.Overlays.KeyBinding AutoSizeEasing = Easing.OutQuint; pressAKey.FadeIn(300, Easing.OutQuint); - pressAKey.Padding = new MarginPadding { Top = height }; + pressAKey.BypassAutoSizeAxes &= ~Axes.Y; updateBindTarget(); base.OnFocus(state); From 5615a32953065870204f9dff6c2ed4a6739ca158 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 14:53:40 +0900 Subject: [PATCH 082/171] Fix mac installer extension being incorrect --- osu.Desktop/Updater/SimpleUpdateManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index cda8e6a7ca..6c363422f7 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -72,7 +72,7 @@ namespace osu.Desktop.Updater bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".exe")); break; case RuntimeInfo.Platform.MacOsx: - bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".dmg")); + bestAsset = release.Assets?.FirstOrDefault(f => f.Name.EndsWith(".app.zip")); break; } From 8bc7c4c9a262057013a14cb4f05c1fc81f64e8c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 16:30:33 +0900 Subject: [PATCH 083/171] Add TestCase and update disclaimer screen --- osu.Game.Tests/Visual/TestCaseDisclaimer.cs | 28 +++++ osu.Game/Screens/Menu/Disclaimer.cs | 120 +++++++++----------- 2 files changed, 84 insertions(+), 64 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseDisclaimer.cs diff --git a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs new file mode 100644 index 0000000000..a8253a991a --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs @@ -0,0 +1,28 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Game.Screens.Menu; +using OpenTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseDisclaimer : OsuTestCase + { + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + new Disclaimer() + }; + } + } +} diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 0c70dbf570..694f911773 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -3,10 +3,9 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; using osu.Game.Overlays; @@ -16,96 +15,89 @@ namespace osu.Game.Screens.Menu public class Disclaimer : OsuScreen { private Intro intro; - private readonly SpriteIcon icon; + private SpriteIcon icon; private Color4 iconColour; + private LinkFlowContainer textFlow; protected override bool HideOverlaysOnEnter => true; protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled; public override bool CursorVisible => false; + private const float icon_y = -0.09f; + public Disclaimer() { ValidForResume = false; - - Children = new Drawable[] - { - new FillFlowContainer - { - AutoSizeAxes = Axes.Both, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Direction = FillDirection.Vertical, - Spacing = new Vector2(0, 2), - Children = new Drawable[] - { - icon = new SpriteIcon - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Icon = FontAwesome.fa_warning, - Size = new Vector2(30), - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 30, - Text = "This is a development build", - Margin = new MarginPadding - { - Bottom = 20 - }, - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Don't expect shit to work perfectly as this is very much a work in progress." - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Don't report bugs because we are aware. Don't complain about missing features because we are adding them." - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - Text = "Sit back and enjoy. Visit discord.gg/ppy if you want to help out!", - Margin = new MarginPadding { Bottom = 20 }, - }, - new OsuSpriteText - { - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 12, - Text = "oh and yes, you will get seizures.", - }, - } - } - }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { - LoadComponentAsync(intro = new Intro()); + Children = new Drawable[] + { + icon = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Icon = FontAwesome.fa_warning, + Size = new Vector2(30), + RelativePositionAxes = Axes.Both, + Y = icon_y, + }, + textFlow = new LinkFlowContainer + { + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, + Padding = new MarginPadding(50), + TextAnchor = Anchor.TopCentre, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Spacing = new Vector2(0, 2), + } + }; + + textFlow.AddText("This is an ", t => + { + t.TextSize = 30; + t.Font = @"Exo2.0-Light"; + }); + textFlow.AddText("early development build", t => + { + t.TextSize = 30; + t.Font = @"Exo2.0-SemiBold"; + }); + + textFlow.AddParagraph("Don't expect everything to work perfectly."); + textFlow.AddParagraph(""); + textFlow.AddParagraph("Detailed bug reports are welcomed via github issues."); + textFlow.AddParagraph(""); + + textFlow.AddText("Visit "); + textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy"); + textFlow.AddText(" if you want to help out or follow progress!"); iconColour = colours.Yellow; } + protected override void LoadComplete() + { + base.LoadComplete(); + LoadComponentAsync(intro = new Intro()); + } + protected override void OnEntering(Screen last) { base.OnEntering(last); - icon.Delay(1500).FadeColour(iconColour, 200); + icon.Delay(1500).FadeColour(iconColour, 200, Easing.OutQuint); + icon.Delay(1500).MoveToY(icon_y * 1.1f, 100, Easing.OutCirc).Then().MoveToY(icon_y, 100, Easing.InCirc); Content .FadeInFromZero(500) .Then(5500) .FadeOut(250) + .ScaleTo(0.9f, 250, Easing.InQuint) .Finally(d => Push(intro)); } } From 4638ac902c63c5501e69cb4ce1fdc3afdb533d5d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 16:30:16 +0900 Subject: [PATCH 084/171] Remove pointless rate adjust slider from TestCaseOsuGame --- osu.Game.Tests/Visual/TestCaseOsuGame.cs | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuGame.cs b/osu.Game.Tests/Visual/TestCaseOsuGame.cs index f1a21a58d5..7a4e4c1210 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuGame.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuGame.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Timing; using osu.Game.Screens; using osu.Game.Screens.Menu; using OpenTK.Graphics; @@ -23,19 +22,15 @@ namespace osu.Game.Tests.Visual public TestCaseOsuGame() { - var rateAdjustClock = new StopwatchClock(true); - var framedClock = new FramedClock(rateAdjustClock); - framedClock.ProcessFrame(); - - Add(new Box + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black, - }); - - Add(new Loader()); - - AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v); + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + }, + new Loader() + }; } } } From fbc5250bf1ba54de25889fd534ba9f3b9d5c1a7d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 17:07:14 +0900 Subject: [PATCH 085/171] Update framework --- osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs | 4 ++-- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 4 ++-- osu.Game.Rulesets.Mania/UI/Column.cs | 4 ++-- osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs | 4 ++-- osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs | 8 ++++---- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 4 ++-- osu.Game/OsuGame.cs | 4 ++-- osu.Game/OsuGameBase.cs | 4 ++-- osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs | 4 ++-- osu.Game/Rulesets/UI/RulesetContainer.cs | 4 ++-- osu.Game/Screens/Edit/Editor.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 4 ++-- osu.Game/Screens/Tournament/Drawings.cs | 4 ++-- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 4 ++-- osu.Game/Storyboards/Drawables/DrawableStoryboard.cs | 4 ++-- osu.Game/Tests/Visual/EditorClockTestCase.cs | 4 ++-- osu.Game/Tests/Visual/OsuTestCase.cs | 4 ++-- osu.Game/osu.Game.csproj | 2 +- 18 files changed, 37 insertions(+), 37 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs index 78a98e83e8..5a93efb0dc 100644 --- a/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs +++ b/osu.Game.Rulesets.Mania.Tests/ScrollingTestContainer.cs @@ -21,9 +21,9 @@ namespace osu.Game.Rulesets.Mania.Tests this.direction = direction; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(new ScrollingInfo { Direction = { Value = direction }}); return dependencies; } diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index e827fa1fdc..64ed08373a 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -137,9 +137,9 @@ namespace osu.Game.Rulesets.Mania.Tests }; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs>(new Bindable()); return dependencies; } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index a19a6fb5d4..8465258055 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -118,9 +118,9 @@ namespace osu.Game.Rulesets.Mania.UI } } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs>(Action); return dependencies; } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index e6ebf43c67..f1dff29a0c 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -80,9 +80,9 @@ namespace osu.Game.Rulesets.Mania.UI private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(scrollingInfo = new ScrollingInfo()); return dependencies; } diff --git a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs b/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs index d711d501fe..e4cb848d90 100644 --- a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs @@ -14,9 +14,9 @@ namespace osu.Game.Tests.Visual { private readonly PreviewTrackManager trackManager = new TestPreviewTrackManager(); - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(trackManager); dependencies.CacheAs(this); return dependencies; @@ -101,9 +101,9 @@ namespace osu.Game.Tests.Visual AddInternal(track); } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(this); return dependencies; } diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index d6bc4a2095..1d832d1c54 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -26,9 +26,9 @@ namespace osu.Game.Graphics.Containers protected readonly Bindable OverlayActivationMode = new Bindable(OverlayActivation.All); - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.CacheAs(this); return dependencies; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 922d228701..b654e5d53f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -122,8 +122,8 @@ namespace osu.Game private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] private void load(FrameworkConfigManager frameworkConfig) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index c1d5ae581e..a9b74d6740 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -95,8 +95,8 @@ namespace osu.Game private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); private DatabaseContextFactory contextFactory; diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 05104018cd..191308cca6 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -21,9 +21,9 @@ namespace osu.Game.Overlays.Settings private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); var config = dependencies.Get().GetConfigFor(ruleset); if (config != null) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index fedb6abed3..71d7919dd4 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -85,9 +85,9 @@ namespace osu.Game.Rulesets.UI Cursor = CreateCursor(); } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); onScreenDisplay = dependencies.Get(); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 7eeabd3e5e..a52fa3b462 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -42,8 +42,8 @@ namespace osu.Game.Screens.Edit private DependencyContainer dependencies; private GameHost host; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] private void load(OsuColour colours, GameHost host) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 81502fc024..e6926c118b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) - => dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); protected SongSelect() { diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 29301899d5..49a46b96e3 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -49,8 +49,8 @@ namespace osu.Game.Screens.Tournament private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); [BackgroundDependencyLoader] private void load(TextureStore textures, Storage storage) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index ad6a033936..3adf287cf7 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -71,9 +71,9 @@ namespace osu.Game.Skinning private void onSourceChanged() => SourceChanged?.Invoke(); - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); fallbackSource = dependencies.Get(); dependencies.CacheAs(this); diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index a2f4372323..d746bb90c4 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -36,8 +36,8 @@ namespace osu.Game.Storyboards.Drawables public override bool RemoveCompletedTransforms => false; private DependencyContainer dependencies; - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) => - dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => + dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); public DrawableStoryboard(Storyboard storyboard) { diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 521b51529e..22f3e5b6df 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -25,9 +25,9 @@ namespace osu.Game.Tests.Visual Clock = new EditorClock(new ControlPointInfo(), 5000, BeatDivisor) { IsCoupled = false }; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.Cache(BeatDivisor); dependencies.CacheAs(Clock); diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 5f70055021..fcbab5b8f5 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -20,9 +20,9 @@ namespace osu.Game.Tests.Visual protected DependencyContainer Dependencies { get; private set; } - protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - Dependencies = new DependencyContainer(base.CreateLocalDependencies(parent)); + Dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); Dependencies.CacheAs(beatmap); Dependencies.CacheAs(beatmap); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f7c8c62e91..bfc7b21242 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 24054246b80def77001f1a55c5e0d498aaaaa632 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 17:25:57 +0900 Subject: [PATCH 086/171] Fix DI regression --- .../ManiaSettingsSubsection.cs | 4 ++-- .../UI/ManiaRulesetContainer.cs | 4 ++-- .../Settings/RulesetSettingsSubsection.cs | 9 ++++++--- osu.Game/Rulesets/UI/RulesetContainer.cs | 17 +++++++++-------- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index 54a7bf954d..783142fadc 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -19,14 +19,14 @@ namespace osu.Game.Rulesets.Mania } [BackgroundDependencyLoader] - private void load(ManiaConfigManager config) + private void load() { Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Scrolling direction", - Bindable = config.GetBindable(ManiaSetting.ScrollDirection) + Bindable = ((ManiaConfigManager)Config).GetBindable(ManiaSetting.ScrollDirection) } }; } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index f1dff29a0c..abc9705119 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -70,11 +70,11 @@ namespace osu.Game.Rulesets.Mania.UI } [BackgroundDependencyLoader] - private void load(ManiaConfigManager config) + private void load() { BarLines.ForEach(Playfield.Add); - config.BindWith(ManiaSetting.ScrollDirection, configDirection); + ((ManiaConfigManager)Config).BindWith(ManiaSetting.ScrollDirection, configDirection); configDirection.BindValueChanged(d => scrollingInfo.Direction.Value = (ScrollingDirection)d, true); } diff --git a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs index 191308cca6..60a1c7c125 100644 --- a/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/RulesetSettingsSubsection.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Game.Rulesets; +using osu.Game.Rulesets.Configuration; namespace osu.Game.Overlays.Settings { @@ -14,6 +15,8 @@ namespace osu.Game.Overlays.Settings { private readonly Ruleset ruleset; + protected IRulesetConfigManager Config; + protected RulesetSettingsSubsection(Ruleset ruleset) { this.ruleset = ruleset; @@ -25,9 +28,9 @@ namespace osu.Game.Overlays.Settings { dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - var config = dependencies.Get().GetConfigFor(ruleset); - if (config != null) - dependencies.Cache(config); + Config = dependencies.Get().GetConfigFor(ruleset); + if (Config != null) + dependencies.Cache(Config); return dependencies; } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 71d7919dd4..0bfde148e7 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -70,7 +70,8 @@ namespace osu.Game.Rulesets.UI protected readonly Ruleset Ruleset; - private IRulesetConfigManager rulesetConfig; + protected IRulesetConfigManager Config { get; private set; } + private OnScreenDisplay onScreenDisplay; /// @@ -91,11 +92,11 @@ namespace osu.Game.Rulesets.UI onScreenDisplay = dependencies.Get(); - rulesetConfig = dependencies.Get().GetConfigFor(Ruleset); - if (rulesetConfig != null) + Config = dependencies.Get().GetConfigFor(Ruleset); + if (Config != null) { - dependencies.Cache(rulesetConfig); - onScreenDisplay?.BeginTracking(this, rulesetConfig); + dependencies.Cache(Config); + onScreenDisplay?.BeginTracking(this, Config); } return dependencies; @@ -143,10 +144,10 @@ namespace osu.Game.Rulesets.UI { base.Dispose(isDisposing); - if (rulesetConfig != null) + if (Config != null) { - onScreenDisplay?.StopTracking(this, rulesetConfig); - rulesetConfig = null; + onScreenDisplay?.StopTracking(this, Config); + Config = null; } } } From e550b3f52b46946af51c6550215bf3f3d184a63c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 18:25:55 +0900 Subject: [PATCH 087/171] Turn cache back on for chocolatey packages --- appveyor.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index ac6d6ebff8..7c08eb9e9c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,6 +2,9 @@ clone_depth: 1 version: '{branch}-{build}' image: Visual Studio 2017 configuration: Debug +cache: + - C:\ProgramData\chocolatey\bin -> appveyor.yml + - C:\ProgramData\chocolatey\lib -> appveyor.yml install: - cmd: git submodule update --init --recursive --depth=5 - cmd: choco install resharper-clt -y @@ -18,4 +21,4 @@ build: verbosity: minimal after_build: - cmd: inspectcode --o="inspectcodereport.xml" --projects:osu.Game* --caches-home="inspectcode" osu.sln > NUL - - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors \ No newline at end of file + - cmd: NVika parsereport "inspectcodereport.xml" --treatwarningsaserrors From 1e48582dc2eb7582938385be546a4916039c3576 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Wed, 11 Jul 2018 13:49:37 +0200 Subject: [PATCH 088/171] Instantly hide pause menu for quick retry --- osu.Game/Screens/Play/Player.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b406bda411..48a398a209 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -222,6 +222,7 @@ namespace osu.Game.Screens.Play //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. RulesetContainer?.Hide(); + pauseContainer?.Hide(); Restart(); }, } From 5df2df9b3aa8bcf55fd78b949af89449bb74dc67 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Jul 2018 12:15:22 +0900 Subject: [PATCH 089/171] Fix osu! logo handling non-left mouse buttons --- osu.Game/Screens/Menu/OsuLogo.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index 16482b0e48..b74546310f 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; using OpenTK; using OpenTK.Graphics; +using OpenTK.Input; namespace osu.Game.Screens.Menu { @@ -345,12 +346,16 @@ namespace osu.Game.Screens.Menu protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) { + if (args.Button != MouseButton.Left) return false; + logoBounceContainer.ScaleTo(0.9f, 1000, Easing.Out); return true; } protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) { + if (args.Button != MouseButton.Left) return false; + logoBounceContainer.ScaleTo(1f, 500, Easing.OutElastic); return true; } From c67e11b2c78025f1a708f8a1f64d0a9a3b26eeac Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Jul 2018 15:27:17 +0900 Subject: [PATCH 090/171] Restore old tooltip appear delay behaviour --- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index c0e331148d..44156f6e83 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -21,6 +21,8 @@ namespace osu.Game.Graphics.Cursor { } + protected override double AppearDelay => (1 - CurrentTooltip.Alpha) * base.AppearDelay; // reduce appear delay if the tooltip is already partly visible. + public class OsuTooltip : Tooltip { private readonly Box background; From 6bcc8d1cbcc2a680dd4895c2870a68e30df841e9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 12 Jul 2018 19:56:41 +0900 Subject: [PATCH 091/171] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index bfc7b21242..c8db3e4d66 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From a9f8c2acb8560b30f03d6aa3606680324d65da25 Mon Sep 17 00:00:00 2001 From: Criminalllz Date: Thu, 12 Jul 2018 20:36:57 +0200 Subject: [PATCH 092/171] Use Regex to only care about colors and commas when parsing a color. --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index c8874c3bc7..c2ab156637 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Text.RegularExpressions; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; @@ -73,10 +74,12 @@ namespace osu.Game.Beatmaps.Formats bool isCombo = pair.Key.StartsWith(@"Combo"); - string[] split = pair.Value.Split(','); + line = Regex.Replace(pair.Value, "[^0-9,]", ""); + + string[] split = line.Split(','); if (split.Length != 3) - throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); + throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {line}"); if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); From 0676919496463b4dacd4e5e6782398cb689e30ee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 14:56:44 +0900 Subject: [PATCH 093/171] Fix incorrect corner radius --- osu.Game/Overlays/Direct/DownloadButton.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 68380b951c..2d678c572c 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -29,10 +29,9 @@ namespace osu.Game.Overlays.Direct Children = new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), - new Container + new CircularContainer { RelativeSizeAxes = Axes.Both, - CornerRadius = 17, Masking = true, Child = background = new Box { From ee2c7c50adc0160648a8c097b9fd688d056ffcef Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 16:28:18 +0900 Subject: [PATCH 094/171] Tidy up button hierarchy --- osu.Game.Tests/Visual/TestCaseIconButton.cs | 15 ++- osu.Game/Graphics/UserInterface/IconButton.cs | 111 +++--------------- .../UserInterface/OsuAnimatedButton.cs | 109 +++++++++++++++++ osu.Game/Overlays/Direct/DownloadButton.cs | 62 ++-------- osu.Game/Overlays/MusicController.cs | 18 ++- .../Compose/Timeline/TimelineButton.cs | 24 ++-- 6 files changed, 175 insertions(+), 164 deletions(-) create mode 100644 osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs diff --git a/osu.Game.Tests/Visual/TestCaseIconButton.cs b/osu.Game.Tests/Visual/TestCaseIconButton.cs index 16363da527..14cba71ec8 100644 --- a/osu.Game.Tests/Visual/TestCaseIconButton.cs +++ b/osu.Game.Tests/Visual/TestCaseIconButton.cs @@ -25,11 +25,7 @@ namespace osu.Game.Tests.Visual Children = new[] { new NamedIconButton("No change", new IconButton()), - new NamedIconButton("Background colours", new IconButton - { - FlashColour = Color4.DarkGreen, - HoverColour = Color4.Green, - }), + new NamedIconButton("Background colours", new ColouredIconButton()), new NamedIconButton("Full-width", new IconButton { ButtonSize = new Vector2(200, 30) }), new NamedIconButton("Unchanging size", new IconButton(), false), new NamedIconButton("Icon colours", new IconButton @@ -41,6 +37,15 @@ namespace osu.Game.Tests.Visual }; } + private class ColouredIconButton : IconButton + { + public ColouredIconButton() + { + FlashColour = Color4.DarkGreen; + HoverColour = Color4.Green; + } + } + private class NamedIconButton : Container { public NamedIconButton(string name, IconButton button, bool allowSizeChange = true) diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index 5a25fe641d..eca7bf57c8 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -3,31 +3,17 @@ using OpenTK; using OpenTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; using osu.Framework.Input; -using osu.Game.Graphics.Containers; namespace osu.Game.Graphics.UserInterface { - public class IconButton : OsuClickableContainer + public class IconButton : OsuAnimatedButton { public const float BUTTON_SIZE = 30; - private Color4? flashColour; - /// - /// The colour that should be flashed when the is clicked. - /// - public Color4 FlashColour - { - get { return flashColour ?? Color4.White; } - set { flashColour = value; } - } - private Color4? iconColour; + /// /// The icon colour. This does not affect . /// @@ -42,6 +28,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4? iconHoverColour; + /// /// The icon colour while the is hovered. /// @@ -51,20 +38,6 @@ namespace osu.Game.Graphics.UserInterface set { iconHoverColour = value; } } - private Color4? hoverColour; - /// - /// The background colour of the while it is hovered. - /// - public Color4 HoverColour - { - get { return hoverColour ?? Color4.White; } - set - { - hoverColour = value; - hover.Colour = value; - } - } - /// /// The icon. /// @@ -88,93 +61,39 @@ namespace osu.Game.Graphics.UserInterface /// public Vector2 ButtonSize { - get { return content.Size; } - set { content.Size = value; } + get => Content.Size; + set + { + Content.RelativeSizeAxes = Axes.None; + Content.Size = value; + } } - private readonly Container content; private readonly SpriteIcon icon; - private readonly Box hover; public IconButton() { AutoSizeAxes = Axes.Both; + ButtonSize = new Vector2(BUTTON_SIZE); - Children = new Drawable[] + Add(icon = new SpriteIcon { - content = new Container - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(BUTTON_SIZE), - CornerRadius = 5, - Masking = true, - EdgeEffect = new EdgeEffectParameters - { - Colour = Color4.Black.Opacity(0.04f), - Type = EdgeEffectType.Shadow, - Radius = 5, - }, - Children = new Drawable[] - { - hover = new Box - { - RelativeSizeAxes = Axes.Both, - Alpha = 0, - }, - icon = new SpriteIcon - { - Origin = Anchor.Centre, - Anchor = Anchor.Centre, - Size = new Vector2(18), - } - } - } - }; - } - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - if (hoverColour == null) - HoverColour = colours.Yellow.Opacity(0.6f); - - if (flashColour == null) - FlashColour = colours.Yellow; - - Enabled.ValueChanged += enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint); + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Size = new Vector2(18), + }); } protected override bool OnHover(InputState state) { - hover.FadeIn(500, Easing.OutQuint); icon.FadeColour(IconHoverColour, 500, Easing.OutQuint); return base.OnHover(state); } protected override void OnHoverLost(InputState state) { - hover.FadeOut(500, Easing.OutQuint); icon.FadeColour(IconColour, 500, Easing.OutQuint); base.OnHoverLost(state); } - - protected override bool OnClick(InputState state) - { - hover.FlashColour(FlashColour, 800, Easing.OutQuint); - return base.OnClick(state); - } - - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) - { - content.ScaleTo(0.75f, 2000, Easing.OutQuint); - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - content.ScaleTo(1, 1000, Easing.OutElastic); - return base.OnMouseUp(state, args); - } } } diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs new file mode 100644 index 0000000000..990a2f20a9 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -0,0 +1,109 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Input; +using osu.Game.Graphics.Containers; +using OpenTK.Graphics; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// Highlight on hover, bounce on click. + /// + public class OsuAnimatedButton : OsuClickableContainer + { + /// + /// The colour that should be flashed when the is clicked. + /// + protected Color4 FlashColour = Color4.White.Opacity(0.3f); + + private Color4 hoverColour = Color4.White.Opacity(0.1f); + + /// + /// The background colour of the while it is hovered. + /// + protected Color4 HoverColour + { + get => hoverColour; + set + { + hoverColour = value; + hover.Colour = value; + } + } + + protected override Container Content => content; + + private readonly Container content; + private readonly Box hover; + + public OsuAnimatedButton() + { + base.Content.Add(content = new Container + { + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + CornerRadius = 5, + Masking = true, + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.04f), + Type = EdgeEffectType.Shadow, + Radius = 5, + }, + Children = new Drawable[] + { + hover = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = HoverColour, + Blending = BlendingMode.Additive, + Alpha = 0, + }, + } + }); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); + } + + protected override bool OnHover(InputState state) + { + hover.FadeIn(500, Easing.OutQuint); + return base.OnHover(state); + } + + protected override void OnHoverLost(InputState state) + { + hover.FadeOut(500, Easing.OutQuint); + base.OnHoverLost(state); + } + + protected override bool OnClick(InputState state) + { + hover.FlashColour(FlashColour, 800, Easing.OutQuint); + return base.OnClick(state); + } + + protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + { + Content.ScaleTo(0.75f, 2000, Easing.OutQuint); + return base.OnMouseDown(state, args); + } + + protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) + { + Content.ScaleTo(1, 1000, Easing.OutElastic); + return base.OnMouseUp(state, args); + } + } +} diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 2d678c572c..5c5e4907ed 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -3,19 +3,16 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; -using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using OpenTK; -using OpenTK.Graphics; namespace osu.Game.Overlays.Direct { - public class DownloadButton : OsuClickableContainer + public class DownloadButton : OsuAnimatedButton { private readonly SpriteIcon icon; private readonly SpriteIcon checkmark; @@ -26,17 +23,13 @@ namespace osu.Game.Overlays.Direct public DownloadButton(BeatmapSetInfo set, bool noVideo = false) { - Children = new Drawable[] + AddRange(new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), - new CircularContainer + background = new Box { RelativeSizeAxes = Axes.Both, - Masking = true, - Child = background = new Box - { - RelativeSizeAxes = Axes.Both, - }, + Depth = float.MaxValue }, icon = new SpriteIcon { @@ -53,18 +46,19 @@ namespace osu.Game.Overlays.Direct Size = Vector2.Zero, Icon = FontAwesome.fa_check, } - }; + }); Action = () => { - if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloading) + if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloading) { + // todo: replace with ShakeContainer after https://github.com/ppy/osu/pull/2909 is merged. Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); } - else if (downloader.DownloadState.Value == BeatmapSetDownloader.DownloadStatus.Downloaded) + else if (downloader.DownloadState == BeatmapSetDownloader.DownloadStatus.Downloaded) { // TODO: Jump to song select with this set when the capability is implemented } @@ -73,54 +67,24 @@ namespace osu.Game.Overlays.Direct downloader.Download(); } }; - - downloader.DownloadState.ValueChanged += _ => updateState(); - - Colour = Color4.White; } protected override void LoadComplete() { base.LoadComplete(); - updateState(); + downloader.DownloadState.BindValueChanged(updateState, true); } - [BackgroundDependencyLoader(permitNulls:true)] + [BackgroundDependencyLoader(permitNulls: true)] private void load(OsuColour colours) { this.colours = colours; } - protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) + private void updateState(BeatmapSetDownloader.DownloadStatus state) { - Content.ScaleTo(0.9f, 1000, Easing.Out); - return base.OnMouseDown(state, args); - } - - protected override bool OnMouseUp(InputState state, MouseUpEventArgs args) - { - Content.ScaleTo(1f, 500, Easing.OutElastic); - return base.OnMouseUp(state, args); - } - - protected override bool OnHover(InputState state) - { - Content.ScaleTo(1.1f, 500, Easing.OutElastic); - return base.OnHover(state); - } - - protected override void OnHoverLost(InputState state) - { - Content.ScaleTo(1f, 500, Easing.OutElastic); - } - - private void updateState() - { - if (!IsLoaded) - return; - - switch (downloader.DownloadState.Value) + switch (state) { case BeatmapSetDownloader.DownloadStatus.NotDownloaded: background.FadeColour(colours.Gray4, 500, Easing.InOutExpo); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a57d5fd183..56af04c498 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -142,14 +142,14 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Children = new[] { - prevButton = new IconButton + prevButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Action = prev, Icon = FontAwesome.fa_step_backward, }, - playButton = new IconButton + playButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -158,7 +158,7 @@ namespace osu.Game.Overlays Action = play, Icon = FontAwesome.fa_play_circle_o, }, - nextButton = new IconButton + nextButton = new MusicIconButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, @@ -167,7 +167,7 @@ namespace osu.Game.Overlays }, } }, - playlistButton = new IconButton + playlistButton = new MusicIconButton { Origin = Anchor.Centre, Anchor = Anchor.CentreRight, @@ -405,6 +405,16 @@ namespace osu.Game.Overlays Prev } + private class MusicIconButton : IconButton + { + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + HoverColour = colours.YellowDark.Opacity(0.6f); + FlashColour = colours.Yellow; + } + } + private class Background : BufferedContainer { private readonly Sprite sprite; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs index f46cc7ef9d..5928fbaa1b 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/TimelineButton.cs @@ -27,16 +27,7 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline public TimelineButton() { - InternalChild = button = new IconButton - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - IconColour = OsuColour.Gray(0.35f), - IconHoverColour = Color4.White, - HoverColour = OsuColour.Gray(0.25f), - FlashColour = OsuColour.Gray(0.5f), - Action = () => Action?.Invoke() - }; + InternalChild = button = new TimelineIconButton { Action = () => Action?.Invoke() }; button.Enabled.BindTo(Enabled); Width = button.ButtonSize.X; @@ -48,5 +39,18 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Timeline button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight); } + + private class TimelineIconButton : IconButton + { + public TimelineIconButton() + { + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + IconColour = OsuColour.Gray(0.35f); + IconHoverColour = Color4.White; + HoverColour = OsuColour.Gray(0.25f); + FlashColour = OsuColour.Gray(0.5f); + } + } } } From 159b26509bf4e0be715afce89a603e80ce82f841 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 17:15:06 +0900 Subject: [PATCH 095/171] Improve visuals of difficulty icons --- .../Drawables/DifficultyColouredContainer.cs | 4 +-- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 28 +++++++++++++++---- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index 025ab0037f..7d00c35862 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -9,14 +9,14 @@ using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { - public class DifficultyColouredContainer : Container, IHasAccentColour + public abstract class DifficultyColouredContainer : Container, IHasAccentColour { public Color4 AccentColour { get; set; } private readonly BeatmapInfo beatmap; private OsuColour palette; - public DifficultyColouredContainer(BeatmapInfo beatmap) + protected DifficultyColouredContainer(BeatmapInfo beatmap) { this.beatmap = beatmap; } diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index 42c98aef24..24604711d4 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -3,10 +3,14 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; +using OpenTK.Graphics; namespace osu.Game.Beatmaps.Drawables { @@ -14,7 +18,8 @@ namespace osu.Game.Beatmaps.Drawables { private readonly BeatmapInfo beatmap; - public DifficultyIcon(BeatmapInfo beatmap) : base(beatmap) + public DifficultyIcon(BeatmapInfo beatmap) + : base(beatmap) { if (beatmap == null) throw new ArgumentNullException(nameof(beatmap)); @@ -28,16 +33,29 @@ namespace osu.Game.Beatmaps.Drawables { Children = new Drawable[] { - new SpriteIcon + new CircularContainer { + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.84f), Anchor = Anchor.Centre, Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Colour = AccentColour, - Icon = FontAwesome.fa_circle + Masking = true, + EdgeEffect = new EdgeEffectParameters + { + Colour = Color4.Black.Opacity(0.08f), + Type = EdgeEffectType.Shadow, + Radius = 5, + }, + Child = new Box + { + RelativeSizeAxes = Axes.Both, + Colour = AccentColour, + }, }, new ConstrainedIconContainer { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, // the null coalesce here is only present to make unit tests work (ruleset dlls aren't copied correctly for testing at the moment) Icon = beatmap.Ruleset?.CreateInstance().CreateIcon() ?? new SpriteIcon { Icon = FontAwesome.fa_question_circle_o } From 2d602c0e3c4e599564ef165f3f4159aec185af65 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 18:23:12 +0900 Subject: [PATCH 096/171] Add todo regarding playback skip logic --- osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs index 9a539072d0..cdec8c042f 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -41,6 +41,7 @@ namespace osu.Game.Storyboards.Drawables { base.Update(); + // TODO: this logic will need to be consolidated with other game samples like hitsounds. if (Time.Current < sample.Time) { // We've rewound before the start time of the sample From 3f44f5c60e8fca9f82abbb37d03b359500214134 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 18:34:38 +0900 Subject: [PATCH 097/171] Remove migration log output --- osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index 98ce5def08..1f3c015614 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -8,7 +8,6 @@ namespace osu.Game.Migrations protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.Sql("DELETE FROM KeyBinding WHERE RulesetID = 1"); - Logger.Log("osu!taiko bindings have been reset due to new defaults", LoggingTarget.Runtime, LogLevel.Important); } protected override void Down(MigrationBuilder migrationBuilder) From bbb11a4066f0742d17636f7c7528b61deb4a3df9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 19:53:29 +0900 Subject: [PATCH 098/171] Fix regression in drawable rank first display --- osu.Game/Screens/Select/Leaderboards/DrawableRank.cs | 2 +- osu.Game/Users/Country.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs index 228633a41f..0c4b369f36 100644 --- a/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs +++ b/osu.Game/Screens/Select/Leaderboards/DrawableRank.cs @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select.Leaderboards { Rank = newRank; - if (IsLoaded) + if (LoadState >= LoadState.Ready) updateTexture(); } } diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index 98b3a2df0c..80039eadad 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -43,7 +43,7 @@ namespace osu.Game.Users country = value; - if (IsLoaded) + if (LoadState >= LoadState.Ready) sprite.Texture = getFlagTexture(); } } From 96eb44425b26910f69594d8808beda2acb636380 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 20:32:22 +0900 Subject: [PATCH 099/171] Fix informational overlays not hiding when user toggles other overlay views Closes #3014. --- osu.Game/OsuGame.cs | 48 ++++++++++++++++++--------------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b654e5d53f..557b6e4469 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -19,6 +19,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using osu.Framework.Audio; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Platform; @@ -322,24 +323,6 @@ namespace osu.Game dependencies.Cache(notifications); dependencies.Cache(dialogOverlay); - // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; - overlays.AddRange(singleDisplayOverlays); - - foreach (var overlay in singleDisplayOverlays) - { - overlay.StateChanged += state => - { - if (state == Visibility.Hidden) return; - - foreach (var c in singleDisplayOverlays) - { - if (c == overlay) continue; - c.State = Visibility.Hidden; - } - }; - } - var singleDisplaySideOverlays = new OverlayContainer[] { settings, notifications }; overlays.AddRange(singleDisplaySideOverlays); @@ -348,12 +331,7 @@ namespace osu.Game overlay.StateChanged += state => { if (state == Visibility.Hidden) return; - - foreach (var c in singleDisplaySideOverlays) - { - if (c == overlay) continue; - c.State = Visibility.Hidden; - } + singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } @@ -366,12 +344,24 @@ namespace osu.Game overlay.StateChanged += state => { if (state == Visibility.Hidden) return; + informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); + }; + } - foreach (var c in informationalOverlays) - { - if (c == overlay) continue; - c.State = Visibility.Hidden; - } + // ensure only one of these overlays are open at once. + var singleDisplayOverlays = new OverlayContainer[] { chat, social, direct }; + overlays.AddRange(singleDisplayOverlays); + + foreach (var overlay in singleDisplayOverlays) + { + overlay.StateChanged += state => + { + // informational overlays should be dismissed on a show or hide of a full overlay. + informationalOverlays.ForEach(o => o.Hide()); + + if (state == Visibility.Hidden) return; + + singleDisplayOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } From 3308f8f823e0844c0f62868a6de5717c0e1daab3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 20:37:49 +0900 Subject: [PATCH 100/171] Fix focused overlays not blocking select action --- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 1d832d1c54..2e2e018fcb 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -69,10 +69,13 @@ namespace osu.Game.Graphics.Containers public virtual bool OnPressed(GlobalAction action) { - if (action == GlobalAction.Back) + switch (action) { - State = Visibility.Hidden; - return true; + case GlobalAction.Back: + State = Visibility.Hidden; + return true; + case GlobalAction.Select: + return true; } return false; From 67e7e371ccae21b8c3d7b0c0cc5dec51236d2faa Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 20:40:49 +0900 Subject: [PATCH 101/171] Also block keyboard completely --- osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 2e2e018fcb..0dc6297ad2 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -22,8 +22,11 @@ namespace osu.Game.Graphics.Containers protected virtual bool PlaySamplesOnStateChange => true; + protected override bool BlockPassThroughKeyboard => true; + private PreviewTrackManager previewTrackManager; + protected readonly Bindable OverlayActivationMode = new Bindable(OverlayActivation.All); protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) From b33a0f772e585d77d8aaaeb59fbc57dd59341d07 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:00:52 +0900 Subject: [PATCH 102/171] Don't close toolbar --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f8fdaf368c..bed4c98b53 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -186,7 +186,7 @@ namespace osu.Game /// The beatmap to select. public void PresentBeatmap(BeatmapSetInfo beatmap) { - CloseAllOverlays(); + CloseAllOverlays(false); Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); From 95f314d9499dce6ae165d8c206bb6481756428a4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:04:10 +0900 Subject: [PATCH 103/171] Fix crash when clicking notification from player --- osu.Game/OsuGame.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index bed4c98b53..a96768629e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -188,17 +188,19 @@ namespace osu.Game { CloseAllOverlays(false); - Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + void setBeatmap() => Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); switch (currentScreen) { case SongSelect _: + setBeatmap(); break; default: // navigate to song select if we are not already there. var menu = (MainMenu)intro.ChildScreen; menu.MakeCurrent(); + setBeatmap(); menu.LoadToSolo(); break; } From 6d8923a37cc1a14772538d455cbc819332d3b423 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:08:41 +0900 Subject: [PATCH 104/171] Use better logic --- osu.Game/OsuGame.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 17c8ad8aa0..e2b93d0599 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -189,22 +189,31 @@ namespace osu.Game { CloseAllOverlays(false); - void setBeatmap() => Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + void setBeatmap() + { + if (Beatmap.Disabled) + { + Schedule(setBeatmap); + return; + } + + Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); + }; switch (currentScreen) { case SongSelect _: - setBeatmap(); break; default: // navigate to song select if we are not already there. var menu = (MainMenu)intro.ChildScreen; menu.MakeCurrent(); - setBeatmap(); menu.LoadToSolo(); break; } + + setBeatmap(); } /// From fc3aff66896f146e48eb14df7e2d298ed1eff945 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:19:10 +0900 Subject: [PATCH 105/171] Fix initial colour --- osu.Game/Overlays/Direct/DownloadButton.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 5c5e4907ed..7758e171c5 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -72,8 +72,8 @@ namespace osu.Game.Overlays.Direct protected override void LoadComplete() { base.LoadComplete(); - downloader.DownloadState.BindValueChanged(updateState, true); + FinishTransforms(true); } [BackgroundDependencyLoader(permitNulls: true)] From ac4f25c5bc55c1bdc92977c18b9bd19913bee806 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:25:08 +0900 Subject: [PATCH 106/171] Make notifications less noisy --- osu.Desktop/Overlays/VersionManager.cs | 2 ++ osu.Game/Database/ArchiveModelManager.cs | 7 ++++++- osu.Game/Overlays/NotificationOverlay.cs | 3 ++- osu.Game/Overlays/Notifications/Notification.cs | 5 +++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 1129969694..0c564f8113 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -111,6 +111,8 @@ namespace osu.Desktop.Overlays private class UpdateCompleteNotification : SimpleNotification { + public override bool IsImportant => true; + public UpdateCompleteNotification(string version, Action openUrl = null) { Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index cbf0df3227..c5591c00dc 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -116,7 +116,7 @@ namespace osu.Game.Database /// One or more archive locations on disk. public void Import(params string[] paths) { - var notification = new ProgressNotification + var notification = new ImportNotification { Text = "Import is initialising...", Progress = 0, @@ -407,5 +407,10 @@ namespace osu.Game.Database return new LegacyFilesystemReader(path); throw new InvalidFormatException($"{path} is not a valid archive"); } + + private class ImportNotification : ProgressNotification + { + public override bool IsImportant => true; + } } } diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 3dc8f5ec15..d891cd96e8 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -128,7 +128,8 @@ namespace osu.Game.Overlays var section = sections.Children.FirstOrDefault(s => s.AcceptTypes.Any(accept => accept.IsAssignableFrom(ourType))); section?.Add(notification, notification.DisplayOnTop ? -runningDepth : runningDepth); - State = Visibility.Visible; + if (notification.IsImportant) + State = Visibility.Visible; updateCounts(); }); diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index d2b5ae1829..c98ac3b2cd 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -23,6 +23,11 @@ namespace osu.Game.Overlays.Notifications /// public event Action Closed; + /// + /// Whether this notification should forcefully display itself. + /// + public virtual bool IsImportant => false; + /// /// Run on user activating the notification. Return true to close. /// From ac35e8bd9939fd3d227915213dca699565e7ef38 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:27:09 +0900 Subject: [PATCH 107/171] Remove redundant empty statement --- osu.Game/OsuGame.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e2b93d0599..18a1d018d0 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -198,7 +198,7 @@ namespace osu.Game } Beatmap.Value = BeatmapManager.GetWorkingBeatmap(beatmap.Beatmaps.First()); - }; + } switch (currentScreen) { From 63c40e9051c0125aa41cdb50902873d65aca98a1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:45:42 +0900 Subject: [PATCH 108/171] Remove unnecessary cache operations --- osu.Game/Screens/Select/SongSelect.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index a695aedda7..e6f33a7d29 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -202,10 +202,6 @@ namespace osu.Game.Screens.Select base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce); Ruleset.ValueChanged += r => base.Ruleset.Value = r; - dependencies.CacheAs(this); - dependencies.CacheAs(Ruleset); - dependencies.CacheAs>(Ruleset); - if (Footer != null) { Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2); From 4f5578245efc81f29a81a86b178150ad036ba2e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 13 Jul 2018 21:45:49 +0900 Subject: [PATCH 109/171] Fix regression causing previews to not play --- osu.Game/Screens/Select/SongSelect.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e6f33a7d29..234508a195 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -315,13 +315,14 @@ namespace osu.Game.Screens.Select working = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value); } - ensurePlayingSelected(preview); working.Mods.Value = Enumerable.Empty(); Beatmap.Value = working; Ruleset.Value = ruleset; + ensurePlayingSelected(preview); + UpdateBeatmap(Beatmap.Value); } From 81e5a37d6d5c0a324ef864d498a80872c41b3142 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 Jul 2018 03:31:19 +0900 Subject: [PATCH 110/171] Enlist a few more important notifications --- osu.Desktop/Updater/SimpleUpdateManager.cs | 7 ++++++- .../Notifications/ProgressCompletionNotification.cs | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index 6c363422f7..5b62298010 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.Updater if (latest.TagName != version) { - notificationOverlay.Post(new SimpleNotification + notificationOverlay.Post(new UpdateNotification { Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + "Click here to download the new version, which can be installed over the top of your existing installation", @@ -62,6 +62,11 @@ namespace osu.Desktop.Updater } } + private class UpdateNotification : SimpleNotification + { + public override bool IsImportant => true; + } + private string getBestUrl(GitHubRelease release) { GitHubAsset bestAsset = null; diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index 0711e49608..cd72049702 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -9,6 +9,8 @@ namespace osu.Game.Overlays.Notifications { public class ProgressCompletionNotification : SimpleNotification { + public override bool IsImportant => true; + public ProgressCompletionNotification() { Icon = FontAwesome.fa_check; From 730eb2daa2e19d7c3c3fa3c7ef9eea8823166d08 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 14 Jul 2018 03:47:56 +0900 Subject: [PATCH 111/171] Reduce osu!direct panel width to allow three panels displayed at 16:9 resolutions --- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index e286837746..4060f26008 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Direct public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) { - Width = 400; + Width = 380; Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) } From c8697e1743560b627ce595e8ce4241c538290517 Mon Sep 17 00:00:00 2001 From: Berkan Diler Date: Sat, 14 Jul 2018 03:08:28 +0200 Subject: [PATCH 112/171] Fix KeyCounter counting clicks when game is paused --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b406bda411..d8b714529b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -169,7 +169,7 @@ namespace osu.Game.Screens.Play OnPause = () => { pauseContainer.Retries = RestartCount; - hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused; + hudOverlay.KeyCounter.IsCounting = !pauseContainer.IsPaused; }, OnResume = () => hudOverlay.KeyCounter.IsCounting = true, Children = new[] From 453d58bcbd7be12fbc9e6f7ff85c37e6223776d6 Mon Sep 17 00:00:00 2001 From: HoutarouOreki Date: Sun, 15 Jul 2018 01:10:05 +0200 Subject: [PATCH 113/171] Hide Content instead of particular overlays --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 48a398a209..3992ebc6ee 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Play //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. RulesetContainer?.Hide(); - pauseContainer?.Hide(); + Content.Hide(); Restart(); }, } From 6c861a16385d88340768f0a29c88f4b0cbf26b84 Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 01:04:41 +0200 Subject: [PATCH 114/171] Strip comments from everything except metadata --- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 16 +++++++++------- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 15 +++++++++++---- .../Beatmaps/Formats/LegacyStoryboardDecoder.cs | 2 ++ osu.Game/Skinning/LegacySkinDecoder.cs | 2 ++ 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index c79938e613..641cdc4fd6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -62,32 +62,34 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseLine(Beatmap beatmap, Section section, string line) { + var stripped_line = StripComments(line); + switch (section) { case Section.General: - handleGeneral(line); + handleGeneral(stripped_line); return; case Section.Editor: - handleEditor(line); + handleEditor(stripped_line); return; case Section.Metadata: handleMetadata(line); return; case Section.Difficulty: - handleDifficulty(line); + handleDifficulty(stripped_line); return; case Section.Events: - handleEvent(line); + handleEvent(stripped_line); return; case Section.TimingPoints: - handleTimingPoint(line); + handleTimingPoint(stripped_line); return; case Section.HitObjects: - handleHitObject(line); + handleHitObject(stripped_line); return; } - base.ParseLine(beatmap, section, line); + base.ParseLine(beatmap, section, stripped_line); } private void handleGeneral(string line) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index c2ab156637..7a97281c76 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -58,6 +58,8 @@ namespace osu.Game.Beatmaps.Formats protected virtual void ParseLine(T output, Section section, string line) { + line = StripComments(line); + switch (section) { case Section.Colours: @@ -65,6 +67,13 @@ namespace osu.Game.Beatmaps.Formats return; } } + internal string StripComments(string line) + { + var index = line.IndexOf("//"); + if (index > 0) + return line.Substring(0, index); + return line; + } private bool hasComboColours; @@ -74,12 +83,10 @@ namespace osu.Game.Beatmaps.Formats bool isCombo = pair.Key.StartsWith(@"Combo"); - line = Regex.Replace(pair.Value, "[^0-9,]", ""); - - string[] split = line.Split(','); + string[] split = pair.Value.Split(','); if (split.Length != 3) - throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {line}"); + throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}"); if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b)) throw new InvalidOperationException(@"Color must be specified with 8-bit integer components"); diff --git a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs index 868ae5206a..b418cbd5ec 100644 --- a/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyStoryboardDecoder.cs @@ -42,6 +42,8 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseLine(Storyboard storyboard, Section section, string line) { + line = StripComments(line); + switch (section) { case Section.Events: diff --git a/osu.Game/Skinning/LegacySkinDecoder.cs b/osu.Game/Skinning/LegacySkinDecoder.cs index 0ef54c7310..d4f1c5c6f1 100644 --- a/osu.Game/Skinning/LegacySkinDecoder.cs +++ b/osu.Game/Skinning/LegacySkinDecoder.cs @@ -14,6 +14,8 @@ namespace osu.Game.Skinning protected override void ParseLine(SkinConfiguration skin, Section section, string line) { + line = StripComments(line); + switch (section) { case Section.General: From 87a4bf3d92f143a737b1ef45ae75b19608846cab Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 01:08:30 +0200 Subject: [PATCH 115/171] Remove using directive for regex in LegacyDecoder --- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7a97281c76..7ceb78c30d 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Text.RegularExpressions; using osu.Framework.Logging; using osu.Game.Audio; using osu.Game.Beatmaps.ControlPoints; From 429306aa876ef9bbe24aa16412d366124fd2c72d Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 01:54:20 +0200 Subject: [PATCH 116/171] Fix casing, use ordinal string comparison when stripping comments --- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 16 ++++++++-------- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 641cdc4fd6..7664a4cea3 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -62,34 +62,34 @@ namespace osu.Game.Beatmaps.Formats protected override void ParseLine(Beatmap beatmap, Section section, string line) { - var stripped_line = StripComments(line); + var strippedLine = StripComments(line); switch (section) { case Section.General: - handleGeneral(stripped_line); + handleGeneral(strippedLine); return; case Section.Editor: - handleEditor(stripped_line); + handleEditor(strippedLine); return; case Section.Metadata: handleMetadata(line); return; case Section.Difficulty: - handleDifficulty(stripped_line); + handleDifficulty(strippedLine); return; case Section.Events: - handleEvent(stripped_line); + handleEvent(strippedLine); return; case Section.TimingPoints: - handleTimingPoint(stripped_line); + handleTimingPoint(strippedLine); return; case Section.HitObjects: - handleHitObject(stripped_line); + handleHitObject(strippedLine); return; } - base.ParseLine(beatmap, section, stripped_line); + base.ParseLine(beatmap, section, strippedLine); } private void handleGeneral(string line) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 7ceb78c30d..0698954bb6 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -68,7 +68,7 @@ namespace osu.Game.Beatmaps.Formats } internal string StripComments(string line) { - var index = line.IndexOf("//"); + var index = line.IndexOf("//", StringComparison.Ordinal); if (index > 0) return line.Substring(0, index); return line; From a12c47536b4158561d26315e004ad2476c748523 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 13:00:21 +0900 Subject: [PATCH 117/171] Change default to being important --- osu.Desktop/Overlays/VersionManager.cs | 2 -- osu.Desktop/Updater/SimpleUpdateManager.cs | 7 +------ osu.Game/Beatmaps/BeatmapManager.cs | 18 +++++++++++++++++- osu.Game/Database/ArchiveModelManager.cs | 7 +------ .../Overlays/Notifications/Notification.cs | 2 +- .../ProgressCompletionNotification.cs | 2 -- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 0c564f8113..1129969694 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -111,8 +111,6 @@ namespace osu.Desktop.Overlays private class UpdateCompleteNotification : SimpleNotification { - public override bool IsImportant => true; - public UpdateCompleteNotification(string version, Action openUrl = null) { Text = $"You are now running osu!lazer {version}.\nClick to see what's new!"; diff --git a/osu.Desktop/Updater/SimpleUpdateManager.cs b/osu.Desktop/Updater/SimpleUpdateManager.cs index 5b62298010..6c363422f7 100644 --- a/osu.Desktop/Updater/SimpleUpdateManager.cs +++ b/osu.Desktop/Updater/SimpleUpdateManager.cs @@ -48,7 +48,7 @@ namespace osu.Desktop.Updater if (latest.TagName != version) { - notificationOverlay.Post(new UpdateNotification + notificationOverlay.Post(new SimpleNotification { Text = $"A newer release of osu! has been found ({version} → {latest.TagName}).\n\n" + "Click here to download the new version, which can be installed over the top of your existing installation", @@ -62,11 +62,6 @@ namespace osu.Desktop.Updater } } - private class UpdateNotification : SimpleNotification - { - public override bool IsImportant => true; - } - private string getBestUrl(GitHubRelease release) { GitHubAsset bestAsset = null; diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index fc4d43080e..49aa4eca28 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -143,7 +143,7 @@ namespace osu.Game.Beatmaps return; } - var downloadNotification = new ProgressNotification + var downloadNotification = new DownloadNotification { CompletionText = $"Imported {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}!", Text = $"Downloading {beatmapSetInfo.Metadata.Artist} - {beatmapSetInfo.Metadata.Title}", @@ -453,5 +453,21 @@ namespace osu.Game.Beatmaps protected override Texture GetBackground() => null; protected override Track GetTrack() => null; } + + private class DownloadNotification : ProgressNotification + { + public override bool IsImportant => false; + + protected override Notification CreateCompletionNotification() => new SilencedProgressCompletionNotification + { + Activated = CompletionClickAction, + Text = CompletionText + }; + + private class SilencedProgressCompletionNotification : ProgressCompletionNotification + { + public override bool IsImportant => false; + } + } } } diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index c5591c00dc..cbf0df3227 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -116,7 +116,7 @@ namespace osu.Game.Database /// One or more archive locations on disk. public void Import(params string[] paths) { - var notification = new ImportNotification + var notification = new ProgressNotification { Text = "Import is initialising...", Progress = 0, @@ -407,10 +407,5 @@ namespace osu.Game.Database return new LegacyFilesystemReader(path); throw new InvalidFormatException($"{path} is not a valid archive"); } - - private class ImportNotification : ProgressNotification - { - public override bool IsImportant => true; - } } } diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index c98ac3b2cd..3a3fcb54e0 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -26,7 +26,7 @@ namespace osu.Game.Overlays.Notifications /// /// Whether this notification should forcefully display itself. /// - public virtual bool IsImportant => false; + public virtual bool IsImportant => true; /// /// Run on user activating the notification. Return true to close. diff --git a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs index cd72049702..0711e49608 100644 --- a/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressCompletionNotification.cs @@ -9,8 +9,6 @@ namespace osu.Game.Overlays.Notifications { public class ProgressCompletionNotification : SimpleNotification { - public override bool IsImportant => true; - public ProgressCompletionNotification() { Icon = FontAwesome.fa_check; From dbc538abbe5806b5f8a273cffbae1e200fc90a78 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 16:17:22 +0900 Subject: [PATCH 118/171] Use Enum.HasFlag With .NET core 2.0+ this is as efficient as the ugly code we've been using. --- .../Legacy/DistanceObjectPatternGenerator.cs | 16 ++++----- .../Legacy/HitObjectPatternGenerator.cs | 35 ++++++++++--------- .../Objects/Drawables/Pieces/BodyPiece.cs | 2 +- .../Replays/ManiaReplayFrame.cs | 2 +- .../Beatmaps/Formats/LegacyBeatmapDecoder.cs | 4 +-- osu.Game/Graphics/SpriteIcon.cs | 2 +- osu.Game/Graphics/UserInterface/BarGraph.cs | 8 ++--- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- .../Graphics/UserInterface/TwoLayerButton.cs | 10 +++--- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 4 +-- .../Objects/Legacy/ConvertHitObjectParser.cs | 14 ++++---- .../Replays/Legacy/LegacyReplayFrame.cs | 8 ++--- osu.Game/Screens/Play/SquareGraph.cs | 2 +- 13 files changed, 55 insertions(+), 54 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 280c2f45d4..8d0d78120a 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -133,26 +133,26 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (ConversionDifficulty > 6.5) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0); return generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03); } if (ConversionDifficulty > 4) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0); return generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0); } if (ConversionDifficulty > 2.5) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0); return generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0); } - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0); return generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0); } @@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < TotalColumns) + if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { while (PreviousPattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); @@ -361,7 +361,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy bool isDoubleSample(SampleInfo sample) => sample.Name == SampleInfo.HIT_CLAP || sample.Name == SampleInfo.HIT_FINISH; - bool canGenerateTwoNotes = (convertType & PatternType.LowProbability) == 0; + bool canGenerateTwoNotes = !convertType.HasFlag(PatternType.LowProbability); canGenerateTwoNotes &= HitObject.Samples.Any(isDoubleSample) || sampleInfoListAt(HitObject.StartTime).Any(isDoubleSample); if (canGenerateTwoNotes) @@ -391,7 +391,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int columnRepeat = Math.Min(spanCount, TotalColumns); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < TotalColumns) + if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { while (PreviousPattern.ColumnHasObject(nextColumn)) nextColumn = Random.Next(RandomStart, TotalColumns); @@ -425,7 +425,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy var pattern = new Pattern(); int holdColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); - if ((convertType & PatternType.ForceNotStack) > 0 && PreviousPattern.ColumnWithObjects < TotalColumns) + if (convertType.HasFlag(PatternType.ForceNotStack) && PreviousPattern.ColumnWithObjects < TotalColumns) { while (PreviousPattern.ColumnHasObject(holdColumn)) holdColumn = Random.Next(RandomStart, TotalColumns); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 0e839d87a2..84ebfdb839 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -21,7 +21,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy private readonly PatternType convertType; - public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, PatternType lastStair, IBeatmap originalBeatmap) + public HitObjectPatternGenerator(FastRandom random, HitObject hitObject, ManiaBeatmap beatmap, Pattern previousPattern, double previousTime, Vector2 previousPosition, double density, + PatternType lastStair, IBeatmap originalBeatmap) : base(random, hitObject, beatmap, previousPattern, originalBeatmap) { if (previousTime > hitObject.StartTime) throw new ArgumentOutOfRangeException(nameof(previousTime)); @@ -79,7 +80,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy else convertType |= PatternType.LowProbability; - if ((convertType & PatternType.KeepSingle) == 0) + if (!convertType.HasFlag(PatternType.KeepSingle)) { if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && TotalColumns != 8) convertType |= PatternType.Mirror; @@ -107,7 +108,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy int lastColumn = PreviousPattern.HitObjects.FirstOrDefault()?.Column ?? 0; - if ((convertType & PatternType.Reverse) > 0 && PreviousPattern.HitObjects.Any()) + if (convertType.HasFlag(PatternType.Reverse) && PreviousPattern.HitObjects.Any()) { // Generate a new pattern by copying the last hit objects in reverse-column order for (int i = RandomStart; i < TotalColumns; i++) @@ -117,7 +118,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern; } - if ((convertType & PatternType.Cycle) > 0 && PreviousPattern.HitObjects.Count() == 1 + if (convertType.HasFlag(PatternType.Cycle) && PreviousPattern.HitObjects.Count() == 1 // If we convert to 7K + 1, let's not overload the special key && (TotalColumns != 8 || lastColumn != 0) // Make sure the last column was not the centre column @@ -130,7 +131,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern; } - if ((convertType & PatternType.ForceStack) > 0 && PreviousPattern.HitObjects.Any()) + if (convertType.HasFlag(PatternType.ForceStack) && PreviousPattern.HitObjects.Any()) { // Generate a new pattern by placing on the already filled columns for (int i = RandomStart; i < TotalColumns; i++) @@ -142,7 +143,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (PreviousPattern.HitObjects.Count() == 1) { - if ((convertType & PatternType.Stair) > 0) + if (convertType.HasFlag(PatternType.Stair)) { // Generate a new pattern by placing on the next column, cycling back to the start if there is no "next" int targetColumn = lastColumn + 1; @@ -153,7 +154,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern; } - if ((convertType & PatternType.ReverseStair) > 0) + if (convertType.HasFlag(PatternType.ReverseStair)) { // Generate a new pattern by placing on the previous column, cycling back to the end if there is no "previous" int targetColumn = lastColumn - 1; @@ -165,10 +166,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } } - if ((convertType & PatternType.KeepSingle) > 0) + if (convertType.HasFlag(PatternType.KeepSingle)) return pattern = generateRandomNotes(1); - if ((convertType & PatternType.Mirror) > 0) + if (convertType.HasFlag(PatternType.Mirror)) { if (ConversionDifficulty > 6.5) return pattern = generateRandomPatternWithMirrored(0.12, 0.38, 0.12); @@ -179,21 +180,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (ConversionDifficulty > 6.5) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.78, 0.42, 0, 0); return pattern = generateRandomPattern(1, 0.62, 0, 0); } if (ConversionDifficulty > 4) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.35, 0.08, 0, 0); return pattern = generateRandomPattern(0.52, 0.15, 0, 0); } if (ConversionDifficulty > 2) { - if ((convertType & PatternType.LowProbability) > 0) + if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.18, 0, 0, 0); return pattern = generateRandomPattern(0.45, 0, 0, 0); } @@ -204,9 +205,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { foreach (var obj in pattern.HitObjects) { - if ((convertType & PatternType.Stair) > 0 && obj.Column == TotalColumns - 1) + if (convertType.HasFlag(PatternType.Stair) && obj.Column == TotalColumns - 1) StairType = PatternType.ReverseStair; - if ((convertType & PatternType.ReverseStair) > 0 && obj.Column == RandomStart) + if (convertType.HasFlag(PatternType.ReverseStair) && obj.Column == RandomStart) StairType = PatternType.Stair; } } @@ -225,7 +226,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { var pattern = new Pattern(); - bool allowStacking = (convertType & PatternType.ForceNotStack) == 0; + bool allowStacking = !convertType.HasFlag(PatternType.ForceNotStack); if (!allowStacking) noteCount = Math.Min(noteCount, TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects); @@ -235,7 +236,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { while (pattern.ColumnHasObject(nextColumn) || PreviousPattern.ColumnHasObject(nextColumn) && !allowStacking) { - if ((convertType & PatternType.Gathered) > 0) + if (convertType.HasFlag(PatternType.Gathered)) { nextColumn++; if (nextColumn == TotalColumns) @@ -367,7 +368,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { addToCentre = false; - if ((convertType & PatternType.ForceNotStack) > 0) + if (convertType.HasFlag(PatternType.ForceNotStack)) return getRandomNoteCount(1 / 2f + p2 / 2, p2, (p2 + p3) / 2, p3); switch (TotalColumns) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index 4ab2da208a..dbba56501e 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.DrawSize) > 0) + if (invalidation.HasFlag(Invalidation.DrawSize)) subtractionCache.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index bc9fd6e06f..e2dc2d6a03 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Replays { var isSpecial = stage.IsSpecialColumn(counter); - if ((activeColumns & 1) > 0) + if (activeColumns.HasFlag(1)) Actions.Add(isSpecial ? specialAction : normalAction); if (isSpecial) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index c79938e613..81f1e056fb 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -306,8 +306,8 @@ namespace osu.Game.Beatmaps.Formats if (split.Length >= 8) { int effectFlags = int.Parse(split[7]); - kiaiMode = (effectFlags & 1) > 0; - omitFirstBarSignature = (effectFlags & 8) > 0; + kiaiMode = effectFlags.HasFlag(1); + omitFirstBarSignature = effectFlags.HasFlag(8); } string stringSampleSet = sampleSet.ToString().ToLower(); diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 6acd20719e..244844f6d5 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -84,7 +84,7 @@ namespace osu.Game.Graphics public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.Colour) > 0 && Shadow) + if (invalidation.HasFlag(Invalidation.Colour) && Shadow) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index d065ecdd5f..0ba49929e9 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -26,10 +26,10 @@ namespace osu.Game.Graphics.UserInterface set { direction = value; - base.Direction = (direction & BarDirection.Horizontal) > 0 ? FillDirection.Vertical : FillDirection.Horizontal; + base.Direction = direction.HasFlag(BarDirection.Horizontal) ? FillDirection.Vertical : FillDirection.Horizontal; foreach (var bar in Children) { - bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1); + bar.Size = direction.HasFlag(BarDirection.Horizontal) ? new Vector2(1, 1.0f / Children.Count) : new Vector2(1.0f / Children.Count, 1); bar.Direction = direction; } } @@ -56,14 +56,14 @@ namespace osu.Game.Graphics.UserInterface if (bar.Bar != null) { bar.Bar.Length = length; - bar.Bar.Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, size) : new Vector2(size, 1); + bar.Bar.Size = direction.HasFlag(BarDirection.Horizontal) ? new Vector2(1, size) : new Vector2(size, 1); } else { Add(new Bar { RelativeSizeAxes = Axes.Both, - Size = (direction & BarDirection.Horizontal) > 0 ? new Vector2(1, size) : new Vector2(size, 1), + Size = direction.HasFlag(BarDirection.Horizontal) ? new Vector2(1, size) : new Vector2(size, 1), Length = length, Direction = Direction, }); diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 3cb2446acc..c4e1e1d283 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -75,7 +75,7 @@ namespace osu.Game.Graphics.UserInterface public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.DrawSize) > 0) + if (invalidation.HasFlag(Invalidation.DrawSize)) pathCached.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index f490306acf..dd5454314d 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -56,15 +56,15 @@ namespace osu.Game.Graphics.UserInterface set { base.Origin = value; - c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight; - c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft; + c1.Origin = c1.Anchor = value.HasFlag(Anchor.x2) ? Anchor.TopLeft : Anchor.TopRight; + c2.Origin = c2.Anchor = value.HasFlag(Anchor.x2) ? Anchor.TopRight : Anchor.TopLeft; - X = (value & Anchor.x2) > 0 ? SIZE_RETRACTED.X * shear * 0.5f : 0; + X = value.HasFlag(Anchor.x2) ? SIZE_RETRACTED.X * shear * 0.5f : 0; Remove(c1); Remove(c2); - c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1; - c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0; + c1.Depth = value.HasFlag(Anchor.x2) ? 0 : 1; + c2.Depth = value.HasFlag(Anchor.x2) ? 1 : 0; Add(c1); Add(c2); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index c7870a72de..4514f3c33c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -118,9 +118,9 @@ namespace osu.Game.Overlays.Toolbar { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize - Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight, + Anchor = TooltipAnchor.HasFlag(Anchor.x0) ? Anchor.BottomLeft : Anchor.BottomRight, Origin = TooltipAnchor, - Position = new Vector2((TooltipAnchor & Anchor.x0) > 0 ? 5 : -5, 5), + Position = new Vector2(TooltipAnchor.HasFlag(Anchor.x0) ? 5 : -5, 5), Alpha = 0, Children = new[] { diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 95589d8953..48512a71c2 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -39,14 +39,14 @@ namespace osu.Game.Rulesets.Objects.Legacy HitObject result = null; - if ((type & ConvertHitObjectType.Circle) > 0) + if (type.HasFlag(ConvertHitObjectType.Circle)) { result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } - else if ((type & ConvertHitObjectType.Slider) > 0) + else if (type.HasFlag(ConvertHitObjectType.Slider)) { var pos = new Vector2(int.Parse(split[0]), int.Parse(split[1])); @@ -150,14 +150,14 @@ namespace osu.Game.Rulesets.Objects.Legacy result = CreateSlider(pos, combo, points, length, curveType, repeatCount, nodeSamples); } - else if ((type & ConvertHitObjectType.Spinner) > 0) + else if (type.HasFlag(ConvertHitObjectType.Spinner)) { result = CreateSpinner(new Vector2(512, 384) / 2, Convert.ToDouble(split[5], CultureInfo.InvariantCulture) + offset); if (split.Length > 6) readCustomSampleBanks(split[6], bankInfo); } - else if ((type & ConvertHitObjectType.Hold) > 0) + else if (type.HasFlag(ConvertHitObjectType.Hold)) { // Note: Hold is generated by BMS converts @@ -266,7 +266,7 @@ namespace osu.Game.Rulesets.Objects.Legacy } }; - if ((type & LegacySoundType.Finish) > 0) + if (type.HasFlag(LegacySoundType.Finish)) { soundTypes.Add(new SampleInfo { @@ -276,7 +276,7 @@ namespace osu.Game.Rulesets.Objects.Legacy }); } - if ((type & LegacySoundType.Whistle) > 0) + if (type.HasFlag(LegacySoundType.Whistle)) { soundTypes.Add(new SampleInfo { @@ -286,7 +286,7 @@ namespace osu.Game.Rulesets.Objects.Legacy }); } - if ((type & LegacySoundType.Clap) > 0) + if (type.HasFlag(LegacySoundType.Clap)) { soundTypes.Add(new SampleInfo { diff --git a/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs b/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs index d39d765bfe..5bd56e0cc0 100644 --- a/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs +++ b/osu.Game/Rulesets/Replays/Legacy/LegacyReplayFrame.cs @@ -15,10 +15,10 @@ namespace osu.Game.Rulesets.Replays.Legacy public bool MouseLeft => MouseLeft1 || MouseLeft2; public bool MouseRight => MouseRight1 || MouseRight2; - public bool MouseLeft1 => (ButtonState & ReplayButtonState.Left1) > 0; - public bool MouseRight1 => (ButtonState & ReplayButtonState.Right1) > 0; - public bool MouseLeft2 => (ButtonState & ReplayButtonState.Left2) > 0; - public bool MouseRight2 => (ButtonState & ReplayButtonState.Right2) > 0; + public bool MouseLeft1 => ButtonState.HasFlag(ReplayButtonState.Left1); + public bool MouseRight1 => ButtonState.HasFlag(ReplayButtonState.Right1); + public bool MouseLeft2 => ButtonState.HasFlag(ReplayButtonState.Left2); + public bool MouseRight2 => ButtonState.HasFlag(ReplayButtonState.Right2); public ReplayButtonState ButtonState; diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 8ffd04b35c..1d13b4548d 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if ((invalidation & Invalidation.DrawSize) > 0) + if (invalidation.HasFlag(Invalidation.DrawSize)) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } From 98cddc0c04ef451e3fffcdc393ab628086a7f121 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 16:26:37 +0900 Subject: [PATCH 119/171] Fix some legacy cases --- .../Replays/ManiaReplayFrame.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 14 +++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs index e2dc2d6a03..bc9fd6e06f 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaReplayFrame.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Replays { var isSpecial = stage.IsSpecialColumn(counter); - if (activeColumns.HasFlag(1)) + if ((activeColumns & 1) > 0) Actions.Add(isSpecial ? specialAction : normalAction); if (isSpecial) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 81f1e056fb..770dab9eeb 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -305,9 +305,9 @@ namespace osu.Game.Beatmaps.Formats bool omitFirstBarSignature = false; if (split.Length >= 8) { - int effectFlags = int.Parse(split[7]); - kiaiMode = effectFlags.HasFlag(1); - omitFirstBarSignature = effectFlags.HasFlag(8); + EffectFlags effectFlags = (EffectFlags)int.Parse(split[7]); + kiaiMode = effectFlags.HasFlag(EffectFlags.Kiai); + omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine); } string stringSampleSet = sampleSet.ToString().ToLower(); @@ -405,5 +405,13 @@ namespace osu.Game.Beatmaps.Formats private double getOffsetTime() => ApplyOffsets ? offset : 0; private double getOffsetTime(double time) => time + (ApplyOffsets ? offset : 0); + + [Flags] + internal enum EffectFlags + { + None = 0, + Kiai = 1, + OmitFirstBarLine = 8 + } } } From 58fe434dd01d0953586bbe7a1b9f00111502effe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 16 Jul 2018 16:39:52 +0900 Subject: [PATCH 120/171] Don't use in invalidation logic to avoid incorrect execution --- osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs | 2 +- osu.Game/Graphics/SpriteIcon.cs | 2 +- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- osu.Game/Screens/Play/SquareGraph.cs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index dbba56501e..4ab2da208a 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.DrawSize)) + if ((invalidation & Invalidation.DrawSize) > 0) subtractionCache.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index 244844f6d5..6acd20719e 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -84,7 +84,7 @@ namespace osu.Game.Graphics public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.Colour) && Shadow) + if ((invalidation & Invalidation.Colour) > 0 && Shadow) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index c4e1e1d283..3cb2446acc 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -75,7 +75,7 @@ namespace osu.Game.Graphics.UserInterface public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.DrawSize)) + if ((invalidation & Invalidation.DrawSize) > 0) pathCached.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 1d13b4548d..8ffd04b35c 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -71,7 +71,7 @@ namespace osu.Game.Screens.Play public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - if (invalidation.HasFlag(Invalidation.DrawSize)) + if ((invalidation & Invalidation.DrawSize) > 0) layout.Invalidate(); return base.Invalidate(invalidation, source, shallPropagate); } From fc77e01ba980a03ed366820f5a7b645ff11ba0ff Mon Sep 17 00:00:00 2001 From: morguldir Date: Mon, 16 Jul 2018 16:35:55 +0200 Subject: [PATCH 121/171] Fix formatting, make StripComments protected Don't strip comments when calling ParseLine --- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 7664a4cea3..d1b47b449b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -89,7 +89,7 @@ namespace osu.Game.Beatmaps.Formats return; } - base.ParseLine(beatmap, section, strippedLine); + base.ParseLine(beatmap, section, line); } private void handleGeneral(string line) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 0698954bb6..91c1c98438 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -66,7 +66,8 @@ namespace osu.Game.Beatmaps.Formats return; } } - internal string StripComments(string line) + + protected string StripComments(string line) { var index = line.IndexOf("//", StringComparison.Ordinal); if (index > 0) From da300baff156caf2a6c02f7921daf2ee096bd65b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 00:06:51 +0900 Subject: [PATCH 122/171] Update hide logic --- osu.Game/Screens/Play/Player.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f97ee27ced..49a180902b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -219,10 +219,7 @@ namespace osu.Game.Screens.Play { if (!IsCurrentScreen) return; - //we want to hide the hitrenderer immediately (looks better). - //we may be able to remove this once the mouse cursor trail is improved. - RulesetContainer?.Hide(); - Content.Hide(); + pauseContainer.Hide(); Restart(); }, } From b967fe714b8ef7b13c6266efe52043ad94a488d1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 14:29:22 +0900 Subject: [PATCH 123/171] Fix lead-in time now being long enough in many cases --- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 10 ++++++++++ osu.Game/Rulesets/UI/RulesetContainer.cs | 6 ++++++ osu.Game/Screens/Play/Player.cs | 7 +++---- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 33d4e16662..c18d180783 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Linq; using osu.Framework.Graphics.Cursor; using osu.Framework.Input; using OpenTK; @@ -46,6 +47,15 @@ namespace osu.Game.Rulesets.Osu.UI protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuReplayInputHandler(replay); + public override double GameplayStartTime + { + get + { + var first = (OsuHitObject)Objects.First(); + return first.StartTime - first.TimePreempt; + } + } + protected override Vector2 GetAspectAdjustedSize() { var aspectSize = DrawSize.X * 0.75f < DrawSize.Y ? new Vector2(DrawSize.X, DrawSize.X * 0.75f) : new Vector2(DrawSize.Y * 4f / 3f, DrawSize.Y); diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 0bfde148e7..d68afdfedc 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -56,6 +56,12 @@ namespace osu.Game.Rulesets.UI public abstract IEnumerable Objects { get; } + /// + /// The point in time at which gameplay starts, including any required lead-in for display purposes. + /// Defaults to two seconds before the first . Override as necessary. + /// + public virtual double GameplayStartTime => Objects.First().StartTime - 2000; + private readonly Lazy playfield; /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 49a180902b..fc439a48c5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -138,10 +138,9 @@ namespace osu.Game.Screens.Play sourceClock = (IAdjustableClock)working.Track ?? new StopwatchClock(); adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; - var firstObjectTime = RulesetContainer.Objects.First().StartTime; adjustableClock.Seek(AllowLeadIn - ? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)) - : firstObjectTime); + ? Math.Min(RulesetContainer.GameplayStartTime, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); @@ -199,7 +198,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.Centre, Origin = Anchor.Centre }, - new SkipOverlay(firstObjectTime) + new SkipOverlay(RulesetContainer.GameplayStartTime) { Clock = Clock, // skip button doesn't want to use the audio clock directly ProcessCustomClock = false, From 825941aff11aecbeae4666f6a9e46e8bac08c0ca Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 14:35:09 +0900 Subject: [PATCH 124/171] Use switch with type matching in place of if-else where possible --- .../CatchBeatmapConversionTest.cs | 22 ++++--- .../Difficulty/CatchDifficultyCalculator.cs | 13 ++-- .../Legacy/EndTimeObjectPatternGenerator.cs | 14 ++-- .../Replays/ManiaAutoGenerator.cs | 13 ++-- .../Replays/OsuAutoGenerator.cs | 65 ++++++++++--------- .../UI/OsuRulesetContainer.cs | 16 +++-- .../Scoring/TaikoScoreProcessor.cs | 40 ++++++------ osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 16 +++-- .../UI/TaikoRulesetContainer.cs | 32 ++++----- .../BeatmapSet/Buttons/DownloadButton.cs | 15 +++-- osu.Game/Overlays/OnScreenDisplay.cs | 19 +++--- .../Difficulty/DifficultyCalculator.cs | 16 +++-- 12 files changed, 150 insertions(+), 131 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index 4b95a6754e..162624da57 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -28,18 +28,20 @@ namespace osu.Game.Rulesets.Catch.Tests protected override IEnumerable CreateConvertValue(HitObject hitObject) { - if (hitObject is JuiceStream stream) + switch (hitObject) { - foreach (var nested in stream.NestedHitObjects) - yield return new ConvertValue((CatchHitObject)nested); + case JuiceStream stream: + foreach (var nested in stream.NestedHitObjects) + yield return new ConvertValue((CatchHitObject)nested); + break; + case BananaShower shower: + foreach (var nested in shower.NestedHitObjects) + yield return new ConvertValue((CatchHitObject)nested); + break; + default: + yield return new ConvertValue((CatchHitObject)hitObject); + break; } - else if (hitObject is BananaShower shower) - { - foreach (var nested in shower.NestedHitObjects) - yield return new ConvertValue((CatchHitObject)nested); - } - else - yield return new ConvertValue((CatchHitObject)hitObject); } protected override Ruleset CreateRuleset() => new CatchRuleset(); diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 31c56c37c4..978b71576e 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -46,13 +46,16 @@ namespace osu.Game.Rulesets.Catch.Difficulty foreach (var hitObject in beatmap.HitObjects) { - // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. - if (hitObject is Fruit) + switch (hitObject) { - difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth)); + // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. + case Fruit _: + difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth)); + break; + case JuiceStream _: + difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); + break; } - if (hitObject is JuiceStream) - difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); } difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs index b902ee63c6..06b4b8a27e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/EndTimeObjectPatternGenerator.cs @@ -33,15 +33,19 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy bool generateHold = endTime - HitObject.StartTime >= 100; - if (TotalColumns == 8) + switch (TotalColumns) { - if (HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000) + case 8 when HitObject.Samples.Any(s => s.Name == SampleInfo.HIT_FINISH) && endTime - HitObject.StartTime < 1000: addToPattern(pattern, 0, generateHold); - else + break; + case 8: addToPattern(pattern, getNextRandomColumn(RandomStart), generateHold); + break; + default: + if (TotalColumns > 0) + addToPattern(pattern, getNextRandomColumn(0), generateHold); + break; } - else if (TotalColumns > 0) - addToPattern(pattern, getNextRandomColumn(0), generateHold); return pattern; } diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs index d006a3e1c7..0eef540d97 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaAutoGenerator.cs @@ -56,10 +56,15 @@ namespace osu.Game.Rulesets.Mania.Replays { foreach (var point in group) { - if (point is HitPoint) - actions.Add(columnActions[point.Column]); - if (point is ReleasePoint) - actions.Remove(columnActions[point.Column]); + switch (point) + { + case HitPoint _: + actions.Add(columnActions[point.Column]); + break; + case ReleasePoint _: + actions.Remove(columnActions[point.Column]); + break; + } } Replay.Frames.Add(new ManiaReplayFrame(group.First().Time, actions.ToArray())); diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index ad4ea343d2..7322f65066 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -285,44 +285,45 @@ namespace osu.Game.Rulesets.Osu.Replays AddFrameToReplay(startFrame); - // We add intermediate frames for spinning / following a slider here. - if (h is Spinner) + switch (h) { - Spinner s = h as Spinner; - - Vector2 difference = startPosition - SPINNER_CENTRE; - - float radius = difference.Length; - float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X); - - double t; - - for (double j = h.StartTime + FrameDelay; j < s.EndTime; j += FrameDelay) + // We add intermediate frames for spinning / following a slider here. + case Spinner spinner: { - t = ApplyModsToTime(j - h.StartTime) * spinnerDirection; + Vector2 difference = startPosition - SPINNER_CENTRE; - Vector2 pos = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); - AddFrameToReplay(new OsuReplayFrame((int)j, new Vector2(pos.X, pos.Y), action)); + float radius = difference.Length; + float angle = radius == 0 ? 0 : (float)Math.Atan2(difference.Y, difference.X); + + double t; + + for (double j = h.StartTime + FrameDelay; j < spinner.EndTime; j += FrameDelay) + { + t = ApplyModsToTime(j - h.StartTime) * spinnerDirection; + + Vector2 pos = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); + AddFrameToReplay(new OsuReplayFrame((int)j, new Vector2(pos.X, pos.Y), action)); + } + + t = ApplyModsToTime(spinner.EndTime - h.StartTime) * spinnerDirection; + Vector2 endPosition = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); + + AddFrameToReplay(new OsuReplayFrame(spinner.EndTime, new Vector2(endPosition.X, endPosition.Y), action)); + + endFrame.Position = endPosition; + break; } - - t = ApplyModsToTime(s.EndTime - h.StartTime) * spinnerDirection; - Vector2 endPosition = SPINNER_CENTRE + CirclePosition(t / 20 + angle, SPIN_RADIUS); - - AddFrameToReplay(new OsuReplayFrame(s.EndTime, new Vector2(endPosition.X, endPosition.Y), action)); - - endFrame.Position = endPosition; - } - else if (h is Slider) - { - Slider s = h as Slider; - - for (double j = FrameDelay; j < s.Duration; j += FrameDelay) + case Slider slider: { - Vector2 pos = s.StackedPositionAt(j / s.Duration); - AddFrameToReplay(new OsuReplayFrame(h.StartTime + j, new Vector2(pos.X, pos.Y), action)); - } + for (double j = FrameDelay; j < slider.Duration; j += FrameDelay) + { + Vector2 pos = slider.StackedPositionAt(j / slider.Duration); + AddFrameToReplay(new OsuReplayFrame(h.StartTime + j, new Vector2(pos.X, pos.Y), action)); + } - AddFrameToReplay(new OsuReplayFrame(s.EndTime, new Vector2(s.StackedEndPosition.X, s.StackedEndPosition.Y), action)); + AddFrameToReplay(new OsuReplayFrame(slider.EndTime, new Vector2(slider.StackedEndPosition.X, slider.StackedEndPosition.Y), action)); + break; + } } // We only want to let go of our button if we are at the end of the current replay. Otherwise something is still going on after us so we need to keep the button pressed! diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 33d4e16662..3558c347a9 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -33,14 +33,16 @@ namespace osu.Game.Rulesets.Osu.UI protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { - if (h is HitCircle circle) - return new DrawableHitCircle(circle); + switch (h) + { + case HitCircle circle: + return new DrawableHitCircle(circle); + case Slider slider: + return new DrawableSlider(slider); + case Spinner spinner: + return new DrawableSpinner(spinner); + } - if (h is Slider slider) - return new DrawableSlider(slider); - - if (h is Spinner spinner) - return new DrawableSpinner(spinner); return null; } diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index c7f75e44fa..6347cf9da2 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -80,30 +80,30 @@ namespace osu.Game.Rulesets.Taiko.Scoring foreach (var obj in beatmap.HitObjects) { - if (obj is Hit) + switch (obj) { - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - } - else if (obj is DrumRoll) - { - for (int i = 0; i < ((DrumRoll)obj).NestedHitObjects.OfType().Count(); i++) - { - AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); + case Hit _: + AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + if (obj.IsStrong) + AddJudgement(new TaikoStrongHitJudgement()); + break; + case DrumRoll _: + for (int i = 0; i < ((DrumRoll)obj).NestedHitObjects.OfType().Count(); i++) + { + AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); + + if (obj.IsStrong) + AddJudgement(new TaikoStrongHitJudgement()); + } + + AddJudgement(new TaikoJudgement { Result = HitResult.Great }); if (obj.IsStrong) AddJudgement(new TaikoStrongHitJudgement()); - } - - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); - - if (obj.IsStrong) - AddJudgement(new TaikoStrongHitJudgement()); - } - else if (obj is Swell) - { - AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + break; + case Swell _: + AddJudgement(new TaikoJudgement { Result = HitResult.Great }); + break; } } } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 7fdd3cd1e2..8cb260776a 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -212,13 +212,15 @@ namespace osu.Game.Rulesets.Taiko.UI base.Add(h); - var barline = h as DrawableBarLine; - if (barline != null) - barlineContainer.Add(barline.CreateProxy()); - - var taikoObject = h as DrawableTaikoHitObject; - if (taikoObject != null) - topLevelHitContainer.Add(taikoObject.CreateProxiedContent()); + switch (h) + { + case DrawableBarLine barline: + barlineContainer.Add(barline.CreateProxy()); + break; + case DrawableTaikoHitObject taikoObject: + topLevelHitContainer.Add(taikoObject.CreateProxiedContent()); + break; + } } internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index e04b4d45f6..2fa4627bde 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -98,32 +98,22 @@ namespace osu.Game.Rulesets.Taiko.UI protected override DrawableHitObject GetVisualRepresentation(TaikoHitObject h) { - var centreHit = h as CentreHit; - if (centreHit != null) + switch (h) { - if (h.IsStrong) + case CentreHit centreHit when h.IsStrong: return new DrawableCentreHitStrong(centreHit); - return new DrawableCentreHit(centreHit); - } - - var rimHit = h as RimHit; - if (rimHit != null) - { - if (h.IsStrong) + case CentreHit centreHit: + return new DrawableCentreHit(centreHit); + case RimHit rimHit when h.IsStrong: return new DrawableRimHitStrong(rimHit); - return new DrawableRimHit(rimHit); + case RimHit rimHit: + return new DrawableRimHit(rimHit); + case DrumRoll drumRoll: + return new DrawableDrumRoll(drumRoll); + case Swell swell: + return new DrawableSwell(swell); } - var drumRoll = h as DrumRoll; - if (drumRoll != null) - { - return new DrawableDrumRoll(drumRoll); - } - - var swell = h as Swell; - if (swell != null) - return new DrawableSwell(swell); - return null; } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 7a227f4bfa..223ca1c904 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -73,12 +73,17 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons downloader.Download(); }; - downloader.DownloadState.ValueChanged += d => + downloader.DownloadState.ValueChanged += state => { - if (d == BeatmapSetDownloader.DownloadStatus.Downloaded) - this.FadeOut(200); - else if (d == BeatmapSetDownloader.DownloadStatus.NotDownloaded) - this.FadeIn(200); + switch (state) + { + case BeatmapSetDownloader.DownloadStatus.Downloaded: + this.FadeOut(200); + break; + case BeatmapSetDownloader.DownloadStatus.NotDownloaded: + this.FadeIn(200); + break; + } }; } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 753cd33cc6..5a5b90ee25 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -188,16 +188,17 @@ namespace osu.Game.Overlays int optionCount = 0; int selectedOption = -1; - if (description.RawValue is bool) + switch (description.RawValue) { - optionCount = 1; - if ((bool)description.RawValue) selectedOption = 0; - } - else if (description.RawValue is Enum) - { - var values = Enum.GetValues(description.RawValue.GetType()); - optionCount = values.Length; - selectedOption = Convert.ToInt32(description.RawValue); + case bool val: + optionCount = 1; + if (val) selectedOption = 0; + break; + case Enum _: + var values = Enum.GetValues(description.RawValue.GetType()); + optionCount = values.Length; + selectedOption = Convert.ToInt32(description.RawValue); + break; } textLine2.Origin = optionCount > 0 ? Anchor.BottomCentre : Anchor.Centre; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 8f9651ab09..0c9e03cedd 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -62,12 +62,16 @@ namespace osu.Game.Rulesets.Difficulty IEnumerable createDifficultyAdjustmentModCombinations(IEnumerable currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0) { - // Initial-case: Empty current set - if (currentSetCount == 0) - yield return new NoModMod(); - - if (currentSetCount == 1) - yield return currentSet.Single(); + switch (currentSetCount) + { + case 0: + // Initial-case: Empty current set + yield return new NoModMod(); + break; + case 1: + yield return currentSet.Single(); + break; + } if (currentSetCount > 1) yield return new MultiMod(currentSet.ToArray()); From 827c5c4939e1a2abbcc5888fe9754f2a9fd1e086 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 17 Jul 2018 15:14:03 +0900 Subject: [PATCH 125/171] Remove scroll direction from ScrolingPlayfield constructor --- osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs | 4 +++- osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs | 2 +- osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 3 +-- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 6 ++---- osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs | 5 ----- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 5 ++--- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 3 ++- osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs | 1 - osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 7 ++++--- 11 files changed, 17 insertions(+), 23 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs index 9eca8f6871..ea3b6fb0e0 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchPlayfield.cs @@ -23,8 +23,10 @@ namespace osu.Game.Rulesets.Catch.UI private readonly CatcherArea catcherArea; public CatchPlayfield(BeatmapDifficulty difficulty, Func> getVisualRepresentation) - : base(ScrollingDirection.Down, BASE_WIDTH) + : base(BASE_WIDTH) { + Direction.Value = ScrollingDirection.Down; + Container explodingFruitContainer; Anchor = Anchor.TopCentre; diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs index de2bfaed9c..cceee718ca 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseColumn.cs @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Mania.Tests private Drawable createColumn(ScrollingDirection direction, ManiaAction action) { - var column = new Column(direction) + var column = new Column { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs index 8046c46fc1..b1bb7f5187 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseStage.cs @@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Mania.Tests { var specialAction = ManiaAction.Special1; - var stage = new ManiaStage(direction, 0, new StageDefinition { Columns = 2 }, ref action, ref specialAction) { VisibleTimeRange = { Value = 2000 } }; + var stage = new ManiaStage(0, new StageDefinition { Columns = 2 }, ref action, ref specialAction) { VisibleTimeRange = { Value = 2000 } }; stages.Add(stage); return new ScrollingTestContainer(direction) diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 8465258055..063531da45 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -32,8 +32,7 @@ namespace osu.Game.Rulesets.Mania.UI protected override Container Content => hitObjectArea; - public Column(ScrollingDirection direction) - : base(direction) + public Column() { RelativeSizeAxes = Axes.Y; Width = column_width; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index 2f8ad7b17e..d6781a6e8f 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Mania.Configuration; -using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.UI { @@ -21,8 +20,7 @@ namespace osu.Game.Rulesets.Mania.UI public List Columns => stages.SelectMany(x => x.Columns).ToList(); private readonly List stages = new List(); - public ManiaPlayfield(ScrollingDirection direction, List stageDefinitions) - : base(direction) + public ManiaPlayfield(List stageDefinitions) { if (stageDefinitions == null) throw new ArgumentNullException(nameof(stageDefinitions)); @@ -42,7 +40,7 @@ namespace osu.Game.Rulesets.Mania.UI int firstColumnIndex = 0; for (int i = 0; i < stageDefinitions.Count; i++) { - var newStage = new ManiaStage(direction, firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); + var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); newStage.VisibleTimeRange.BindTo(VisibleTimeRange); playfieldGrid.Content[0][i] = newStage; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index abc9705119..aaa4505b5e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -87,7 +87,7 @@ namespace osu.Game.Rulesets.Mania.UI return dependencies; } - protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(scrollingInfo.Direction, Beatmap.Stages) + protected sealed override Playfield CreatePlayfield() => new ManiaPlayfield(Beatmap.Stages) { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs index f1ff0665cd..4d6c5a747a 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaScrollingPlayfield.cs @@ -11,11 +11,6 @@ namespace osu.Game.Rulesets.Mania.UI { private readonly IBindable direction = new Bindable(); - public ManiaScrollingPlayfield(ScrollingDirection direction) - : base(direction) - { - } - [BackgroundDependencyLoader] private void load(IScrollingInfo scrollingInfo) { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 4c7deb4567..a0ff8780ad 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -43,8 +43,7 @@ namespace osu.Game.Rulesets.Mania.UI private readonly int firstColumnIndex; - public ManiaStage(ScrollingDirection direction, int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) - : base(direction) + public ManiaStage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) { this.firstColumnIndex = firstColumnIndex; @@ -124,7 +123,7 @@ namespace osu.Game.Rulesets.Mania.UI for (int i = 0; i < definition.Columns; i++) { var isSpecial = definition.IsSpecialColumn(i); - var column = new Column(direction) + var column = new Column { IsSpecial = isSpecial, Action = { Value = isSpecial ? specialColumnStartAction++ : normalColumnStartAction++ } diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 7fdd3cd1e2..a47c433631 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -58,8 +58,9 @@ namespace osu.Game.Rulesets.Taiko.UI private readonly Box background; public TaikoPlayfield(ControlPointInfo controlPoints) - : base(ScrollingDirection.Left) { + Direction.Value = ScrollingDirection.Left; + AddRangeInternal(new Drawable[] { backgroundContainer = new Container diff --git a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs index 9b48ec17bd..bbc9d2b860 100644 --- a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs +++ b/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs @@ -117,7 +117,6 @@ namespace osu.Game.Tests.Visual public new readonly ScrollingDirection Direction; public TestPlayfield(ScrollingDirection direction) - : base(direction) { Direction = direction; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index cfcfca157b..7146ad8064 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -57,22 +57,23 @@ namespace osu.Game.Rulesets.UI.Scrolling /// public new ScrollingHitObjectContainer HitObjects => (ScrollingHitObjectContainer)base.HitObjects; + /// + /// The direction in which s in this should scroll. + /// protected readonly Bindable Direction = new Bindable(); /// /// Creates a new . /// - /// The direction in which s in this container should scroll. /// The width to scale the internal coordinate space to. /// May be null if scaling based on is desired. If is also null, no scaling will occur. /// /// The height to scale the internal coordinate space to. /// May be null if scaling based on is desired. If is also null, no scaling will occur. /// - protected ScrollingPlayfield(ScrollingDirection direction, float? customWidth = null, float? customHeight = null) + protected ScrollingPlayfield(float? customWidth = null, float? customHeight = null) : base(customWidth, customHeight) { - Direction.Value = direction; } [BackgroundDependencyLoader] From 9f933187e9cc071d5ad269287ecebc5467b37b36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Jul 2018 16:33:08 +0900 Subject: [PATCH 126/171] Apply review feedback --- .../Difficulty/CatchDifficultyCalculator.cs | 4 ++-- osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 4 ++-- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 978b71576e..a763989750 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -49,8 +49,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty switch (hitObject) { // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. - case Fruit _: - difficultyHitObjects.Add(new CatchDifficultyHitObject((CatchHitObject)hitObject, halfCatchWidth)); + case Fruit fruit: + difficultyHitObjects.Add(new CatchDifficultyHitObject(fruit, halfCatchWidth)); break; case JuiceStream _: difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 6347cf9da2..cea59c3fea 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -87,8 +87,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring if (obj.IsStrong) AddJudgement(new TaikoStrongHitJudgement()); break; - case DrumRoll _: - for (int i = 0; i < ((DrumRoll)obj).NestedHitObjects.OfType().Count(); i++) + case DrumRoll drumRoll: + for (int i = 0; i < drumRoll.NestedHitObjects.OfType().Count(); i++) { AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 0c9e03cedd..0de0a620e3 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -71,11 +71,11 @@ namespace osu.Game.Rulesets.Difficulty case 1: yield return currentSet.Single(); break; + default: + yield return new MultiMod(currentSet.ToArray()); + break; } - if (currentSetCount > 1) - yield return new MultiMod(currentSet.ToArray()); - // Apply mods in the adjustment set recursively. Using the entire adjustment set would result in duplicate multi-mod mod // combinations in further recursions, so a moving subset is used to eliminate this effect for (int i = adjustmentSetStart; i < adjustmentSet.Length; i++) From c6816a6cf3f638b5ee031280f6be7b1c9e79c4e9 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 17 Jul 2018 17:00:28 +0900 Subject: [PATCH 127/171] Fix potential quadratic complexity in taiko autoplay --- osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index cea59c3fea..7dd50ab8b8 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -88,7 +88,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring AddJudgement(new TaikoStrongHitJudgement()); break; case DrumRoll drumRoll: - for (int i = 0; i < drumRoll.NestedHitObjects.OfType().Count(); i++) + var count = drumRoll.NestedHitObjects.OfType().Count(); + for (int i = 0; i < count; i++) { AddJudgement(new TaikoDrumRollTickJudgement { Result = HitResult.Great }); From e3fb781a5a712883a83380b2023e2e09f11d4b83 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 12:58:28 +0900 Subject: [PATCH 128/171] Fix ArchiveModelManager's model import method not running import logic --- osu.Game/Beatmaps/BeatmapManager.cs | 3 +- osu.Game/Database/ArchiveModelManager.cs | 42 ++++++++++++-------- osu.Game/Database/SingletonContextFactory.cs | 2 +- 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 78042349d1..4ff16b604a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -91,7 +91,8 @@ namespace osu.Game.Beatmaps protected override void Populate(BeatmapSetInfo model, ArchiveReader archive) { - model.Beatmaps = createBeatmapDifficulties(archive); + if (archive != null) + model.Beatmaps = createBeatmapDifficulties(archive); foreach (BeatmapInfo b in model.Beatmaps) { diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index cbf0df3227..0465c0ad73 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using osu.Framework.IO.File; using osu.Framework.Logging; @@ -175,7 +176,24 @@ namespace osu.Game.Database /// The archive to be imported. public TModel Import(ArchiveReader archive) { - TModel item = null; + try + { + return Import(CreateModel(archive), archive); + } + catch (Exception e) + { + Logger.Error(e, $"Model creation of {archive.Name} failed.", LoggingTarget.Database); + return null; + } + } + + /// + /// Import an item from a . + /// + /// The model to be imported. + /// An optional archive to use for model population. + public TModel Import(TModel item, ArchiveReader archive = null) + { delayEvents(); try @@ -186,18 +204,16 @@ namespace osu.Game.Database { if (!write.IsTransactionLeader) throw new InvalidOperationException($"Ensure there is no parent transaction so errors can correctly be handled by {this}"); - // create a new model (don't yet add to database) - item = CreateModel(archive); - var existing = CheckForExisting(item); if (existing != null) { - Logger.Log($"Found existing {typeof(TModel)} for {archive.Name} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); + Logger.Log($"Found existing {typeof(TModel)} for {item} (ID {existing.ID}). Skipping import.", LoggingTarget.Database); return existing; } - item.Files = createFileInfos(archive, Files); + if (archive != null) + item.Files = createFileInfos(archive, Files); Populate(item, archive); @@ -211,11 +227,11 @@ namespace osu.Game.Database } } - Logger.Log($"Import of {archive.Name} successfully completed!", LoggingTarget.Database); + Logger.Log($"Import of {item} successfully completed!", LoggingTarget.Database); } catch (Exception e) { - Logger.Error(e, $"Import of {archive.Name} failed and has been rolled back.", LoggingTarget.Database); + Logger.Error(e, $"Import of {item} failed and has been rolled back.", LoggingTarget.Database); item = null; } finally @@ -227,12 +243,6 @@ namespace osu.Game.Database return item; } - /// - /// Import an item from a . - /// - /// The model to be imported. - public void Import(TModel item) => ModelStore.Add(item); - /// /// Perform an update of the specified item. /// TODO: Support file changes. @@ -385,8 +395,8 @@ namespace osu.Game.Database /// After this method, the model should be in a state ready to commit to a store. /// /// The model to populate. - /// The archive to use as a reference for population. - protected virtual void Populate(TModel model, ArchiveReader archive) + /// The archive to use as a reference for population. May be null. + protected virtual void Populate(TModel model, [CanBeNull] ArchiveReader archive) { } diff --git a/osu.Game/Database/SingletonContextFactory.cs b/osu.Game/Database/SingletonContextFactory.cs index ce3fbf6881..a7158c0583 100644 --- a/osu.Game/Database/SingletonContextFactory.cs +++ b/osu.Game/Database/SingletonContextFactory.cs @@ -14,6 +14,6 @@ namespace osu.Game.Database public OsuDbContext Get() => context; - public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null); + public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null) { IsTransactionLeader = true }; } } From 0c242443400529b107b567c318198210f2a846f6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 16:43:46 +0900 Subject: [PATCH 129/171] Remove SingletonContextFactory It is dangerous to use this as it doesn't correctly handle contexts and can cause issues that will never actually arise in normal execution. # Conflicts: # osu.Game/Database/SingletonContextFactory.cs --- .../Visual/TestCasePlaySongSelect.cs | 7 ++++++- osu.Game/Database/DatabaseContextFactory.cs | 10 +++++----- osu.Game/Database/SingletonContextFactory.cs | 19 ------------------- osu.Game/OsuGameBase.cs | 2 +- osu.Game/Tests/Platform/TestStorage.cs | 8 +++----- 5 files changed, 15 insertions(+), 31 deletions(-) delete mode 100644 osu.Game/Database/SingletonContextFactory.cs diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index dab7f7e037..4afb76a7e2 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -62,7 +62,12 @@ namespace osu.Game.Tests.Visual var storage = new TestStorage(@"TestCasePlaySongSelect"); // this is by no means clean. should be replacing inside of OsuGameBase somehow. - IDatabaseContextFactory factory = new SingletonContextFactory(new OsuDbContext()); + DatabaseContextFactory factory = new DatabaseContextFactory(storage); + + factory.ResetDatabase(); + + using (var usage = factory.Get()) + usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index 5160239c38..c20d4569f6 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -11,7 +11,7 @@ namespace osu.Game.Database { public class DatabaseContextFactory : IDatabaseContextFactory { - private readonly GameHost host; + private readonly Storage storage; private const string database_name = @"client"; @@ -26,9 +26,9 @@ namespace osu.Game.Database private IDbContextTransaction currentWriteTransaction; - public DatabaseContextFactory(GameHost host) + public DatabaseContextFactory(Storage storage) { - this.host = host; + this.storage = storage; recycleThreadContexts(); } @@ -117,7 +117,7 @@ namespace osu.Game.Database private void recycleThreadContexts() => threadContexts = new ThreadLocal(CreateContext); - protected virtual OsuDbContext CreateContext() => new OsuDbContext(host.Storage.GetDatabaseConnectionString(database_name)) + protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name)) { Database = { AutoTransactionsEnabled = false } }; @@ -129,7 +129,7 @@ namespace osu.Game.Database recycleThreadContexts(); GC.Collect(); GC.WaitForPendingFinalizers(); - host.Storage.DeleteDatabase(database_name); + storage.DeleteDatabase(database_name); } } } diff --git a/osu.Game/Database/SingletonContextFactory.cs b/osu.Game/Database/SingletonContextFactory.cs deleted file mode 100644 index ce3fbf6881..0000000000 --- a/osu.Game/Database/SingletonContextFactory.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -namespace osu.Game.Database -{ - public class SingletonContextFactory : IDatabaseContextFactory - { - private readonly OsuDbContext context; - - public SingletonContextFactory(OsuDbContext context) - { - this.context = context; - } - - public OsuDbContext Get() => context; - - public DatabaseWriteUsage GetForWrite(bool withTransaction = true) => new DatabaseWriteUsage(context, null); - } -} diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index a9b74d6740..63cc883844 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -107,7 +107,7 @@ namespace osu.Game { Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll")); - dependencies.Cache(contextFactory = new DatabaseContextFactory(Host)); + dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage)); dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore(Resources, @"Textures")))); diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs index 5b31c7b4d0..a6b6b5530d 100644 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ b/osu.Game/Tests/Platform/TestStorage.cs @@ -7,13 +7,11 @@ namespace osu.Game.Tests.Platform { public class TestStorage : DesktopStorage { - public TestStorage(string baseName) : base(baseName, null) + public TestStorage(string baseName) + : base(baseName, null) { } - public override string GetDatabaseConnectionString(string name) - { - return "DataSource=:memory:"; - } + public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true); } } From ffd3040fe2da3de865f3b28b9e10c43a9835144d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 10 Jul 2018 14:41:07 +0900 Subject: [PATCH 130/171] Fix GameplayCursor state not restoring correctly after Show/Hide --- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 35146dfe29..4d6722b61b 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -39,6 +39,11 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor private int downCount; + private const float pressed_scale = 1.2f; + private const float released_scale = 1f; + + private float targetScale => downCount > 0 ? pressed_scale : released_scale; + public bool OnPressed(OsuAction action) { switch (action) @@ -46,7 +51,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor case OsuAction.LeftButton: case OsuAction.RightButton: downCount++; - ActiveCursor.ScaleTo(1).ScaleTo(1.2f, 100, Easing.OutQuad); + ActiveCursor.ScaleTo(released_scale).ScaleTo(targetScale, 100, Easing.OutQuad); break; } @@ -60,7 +65,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor case OsuAction.LeftButton: case OsuAction.RightButton: if (--downCount == 0) - ActiveCursor.ScaleTo(1, 200, Easing.OutQuad); + ActiveCursor.ScaleTo(targetScale, 200, Easing.OutQuad); break; } @@ -72,13 +77,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor protected override void PopIn() { fadeContainer.FadeTo(1, 300, Easing.OutQuint); - ActiveCursor.ScaleTo(1, 400, Easing.OutQuint); + ActiveCursor.ScaleTo(targetScale, 400, Easing.OutQuint); } protected override void PopOut() { fadeContainer.FadeTo(0.05f, 450, Easing.OutQuint); - ActiveCursor.ScaleTo(0.8f, 450, Easing.OutQuint); + ActiveCursor.ScaleTo(targetScale * 0.8f, 450, Easing.OutQuint); } public class OsuCursor : Container From c2cdf12986a1e879a700b4a411b345df8a3f92ed Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jul 2018 17:01:27 +0900 Subject: [PATCH 131/171] Better pause logic --- osu.Game/Rulesets/UI/RulesetContainer.cs | 13 +++++++++++++ osu.Game/Screens/Play/PauseContainer.cs | 12 ++++-------- osu.Game/Screens/Play/Player.cs | 8 ++------ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index d68afdfedc..ee34e2df04 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -89,6 +89,14 @@ namespace osu.Game.Rulesets.UI Ruleset = ruleset; playfield = new Lazy(CreatePlayfield); + IsPaused.ValueChanged += paused => + { + if (HasReplayLoaded) + return; + + KeyBindingInputManager.UseParentInput = !paused; + }; + Cursor = CreateCursor(); } @@ -120,6 +128,11 @@ namespace osu.Game.Rulesets.UI public Replay Replay { get; private set; } + /// + /// Whether the game is paused. Used to block user input. + /// + public readonly BindableBool IsPaused = new BindableBool(); + /// /// Sets a replay to be used, overriding local input. /// diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index e2f133dde3..d9677e5daf 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -4,6 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; @@ -18,7 +19,7 @@ namespace osu.Game.Screens.Play /// public class PauseContainer : Container { - public bool IsPaused { get; private set; } + public readonly BindableBool IsPaused = new BindableBool(); public Func CheckCanPause; @@ -39,9 +40,6 @@ namespace osu.Game.Screens.Play public Action OnRetry; public Action OnQuit; - public Action OnResume; - public Action OnPause; - private readonly FramedClock framedClock; private readonly DecoupleableInterpolatingFramedClock decoupledClock; @@ -84,9 +82,8 @@ namespace osu.Game.Screens.Play // stop the seekable clock (stops the audio eventually) decoupledClock.Stop(); - IsPaused = true; + IsPaused.Value = true; - OnPause?.Invoke(); pauseOverlay.Show(); lastPauseActionTime = Time.Current; @@ -96,7 +93,7 @@ namespace osu.Game.Screens.Play { if (!IsPaused) return; - IsPaused = false; + IsPaused.Value = false; IsResuming = false; lastPauseActionTime = Time.Current; @@ -105,7 +102,6 @@ namespace osu.Game.Screens.Play decoupledClock.Seek(decoupledClock.CurrentTime); decoupledClock.Start(); - OnResume?.Invoke(); pauseOverlay.Hide(); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fc439a48c5..e92805bf57 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -165,12 +165,6 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = Exit, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, - OnPause = () => - { - pauseContainer.Retries = RestartCount; - hudOverlay.KeyCounter.IsCounting = !pauseContainer.IsPaused; - }, - OnResume = () => hudOverlay.KeyCounter.IsCounting = true, Children = new[] { storyboardContainer = new Container @@ -227,6 +221,8 @@ namespace osu.Game.Screens.Play hudOverlay.HoldToQuit.Action = Exit; hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); + RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); + if (ShowStoryboard) initializeStoryboard(false); From a01361f8334f0bf2cfdfb4c76a7abf38f7a46428 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 22:05:24 +0900 Subject: [PATCH 132/171] Set restart count --- osu.Game/Screens/Play/Player.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e92805bf57..f28ddb09a2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -162,6 +162,7 @@ namespace osu.Game.Screens.Play { pauseContainer = new PauseContainer(offsetClock, adjustableClock) { + Retries = RestartCount, OnRetry = Restart, OnQuit = Exit, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, From 8414fe9d05ff2e948a25e6e46d551bc0d4a92a21 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 22:19:32 +0900 Subject: [PATCH 133/171] Add key counter exceptions for paused state --- osu.Game/Screens/Play/Player.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f28ddb09a2..28ae77a53c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -223,6 +223,7 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); + RulesetContainer.IsPaused.ValueChanged += paused => hudOverlay.KeyCounter.IsCounting = !paused; if (ShowStoryboard) initializeStoryboard(false); From 41441771ae2d4cb0bc95ecceef32b3a8d2b19593 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 18 Jul 2018 22:22:28 +0900 Subject: [PATCH 134/171] Remove unnecessary cast --- osu.Game/Tests/Platform/TestStorage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs index a6b6b5530d..8391de3405 100644 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ b/osu.Game/Tests/Platform/TestStorage.cs @@ -12,6 +12,6 @@ namespace osu.Game.Tests.Platform { } - public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{(object)name}.db", true); + public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{name}.db", true); } } From 82ddbb3f5d1126cb570110e9226d3498fd7668f9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 01:18:07 +0900 Subject: [PATCH 135/171] Delay key count stop --- osu.Game/Screens/Play/Player.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 28ae77a53c..427519bff8 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -223,7 +223,9 @@ namespace osu.Game.Screens.Play hudOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); - RulesetContainer.IsPaused.ValueChanged += paused => hudOverlay.KeyCounter.IsCounting = !paused; + + // schedule to ensure we count any key presses from the current frame (which may affect gameplay). + RulesetContainer.IsPaused.ValueChanged += paused => Schedule(() => hudOverlay.KeyCounter.IsCounting = !paused); if (ShowStoryboard) initializeStoryboard(false); From 68614f1512e2becfb23b2845e90265a1d54540e2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 13:41:09 +0900 Subject: [PATCH 136/171] Ensure online IDs are validated for imports that don't have an associated archive too --- osu.Game/Beatmaps/BeatmapManager.cs | 73 ++++++++++++----------------- 1 file changed, 30 insertions(+), 43 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 4ff16b604a..3bd5c440c1 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -89,34 +89,46 @@ namespace osu.Game.Beatmaps this.audioManager = audioManager; } - protected override void Populate(BeatmapSetInfo model, ArchiveReader archive) + protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive) { if (archive != null) - model.Beatmaps = createBeatmapDifficulties(archive); + beatmapSet.Beatmaps = createBeatmapDifficulties(archive); - foreach (BeatmapInfo b in model.Beatmaps) + foreach (BeatmapInfo b in beatmapSet.Beatmaps) { // remove metadata from difficulties where it matches the set - if (model.Metadata.Equals(b.Metadata)) + if (beatmapSet.Metadata.Equals(b.Metadata)) b.Metadata = null; - // by setting the model here, we can update the noline set id below. - b.BeatmapSet = model; - - fetchAndPopulateOnlineIDs(b, model.Beatmaps); + b.BeatmapSet = beatmapSet; } // check if a set already exists with the same online id, delete if it does. - if (model.OnlineBeatmapSetID != null) + if (beatmapSet.OnlineBeatmapSetID != null) { - var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == model.OnlineBeatmapSetID); + var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID); if (existingOnlineId != null) { Delete(existingOnlineId); beatmaps.PurgeDeletable(s => s.ID == existingOnlineId.ID); - Logger.Log($"Found existing beatmap set with same OnlineBeatmapSetID ({model.OnlineBeatmapSetID}). It has been purged.", LoggingTarget.Database); + Logger.Log($"Found existing beatmap set with same OnlineBeatmapSetID ({beatmapSet.OnlineBeatmapSetID}). It has been purged.", LoggingTarget.Database); } } + + validateOnlineIds(beatmapSet.Beatmaps); + + foreach (BeatmapInfo b in beatmapSet.Beatmaps) + fetchAndPopulateOnlineIDs(b, beatmapSet.Beatmaps); + } + + private void validateOnlineIds(List beatmaps) + { + var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID); + + // ensure all IDs are unique in this set and none match existing IDs in the local beatmap store. + if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any()) + // remove all online IDs if any problems were found. + beatmaps.ForEach(b => b.OnlineBeatmapID = null); } protected override BeatmapSetInfo CheckForExisting(BeatmapSetInfo model) @@ -297,7 +309,7 @@ namespace osu.Game.Beatmaps /// /// The query. /// Results from the provided query. - public IEnumerable QueryBeatmaps(Expression> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); + public IQueryable QueryBeatmaps(Expression> query) => beatmaps.Beatmaps.AsNoTracking().Where(query); /// /// Denotes whether an osu-stable installation is present to perform automated imports from. @@ -360,8 +372,6 @@ namespace osu.Game.Beatmaps { var beatmapInfos = new List(); - bool invalidateOnlineIDs = false; - foreach (var name in reader.Filenames.Where(f => f.EndsWith(".osu"))) { using (var raw = reader.GetStream(name)) @@ -378,38 +388,15 @@ namespace osu.Game.Beatmaps beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash(); beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash(); - if (beatmap.BeatmapInfo.OnlineBeatmapID.HasValue) - { - var ourId = beatmap.BeatmapInfo.OnlineBeatmapID; - - // check that no existing beatmap in database exists that is imported with the same online beatmap ID. if so, give it precedence. - if (QueryBeatmap(b => b.OnlineBeatmapID.Value == ourId) != null) - beatmap.BeatmapInfo.OnlineBeatmapID = null; - - // check that no other beatmap in this imported set has a conflicting online beatmap ID. If so, presume *all* are incorrect. - if (beatmapInfos.Any(b => b.OnlineBeatmapID == ourId)) - invalidateOnlineIDs = true; - } - - RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID); - + var ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID); beatmap.BeatmapInfo.Ruleset = ruleset; - - if (ruleset != null) - { - // TODO: this should be done in a better place once we actually need to dynamically update it. - beatmap.BeatmapInfo.StarDifficulty = ruleset.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating; - } - else - beatmap.BeatmapInfo.StarDifficulty = 0; + // TODO: this should be done in a better place once we actually need to dynamically update it. + beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance().CreateDifficultyCalculator(new DummyConversionBeatmap(beatmap)).Calculate().StarRating ?? 0; beatmapInfos.Add(beatmap.BeatmapInfo); } } - if (invalidateOnlineIDs) - beatmapInfos.ForEach(b => b.OnlineBeatmapID = null); - return beatmapInfos; } @@ -422,12 +409,12 @@ namespace osu.Game.Beatmaps /// True if population was successful. private bool fetchAndPopulateOnlineIDs(BeatmapInfo beatmap, IEnumerable otherBeatmaps, bool force = false) { + if (api?.State != APIState.Online) + return false; + if (!force && beatmap.OnlineBeatmapID != null && beatmap.BeatmapSet.OnlineBeatmapSetID != null) return true; - if (api.State != APIState.Online) - return false; - Logger.Log("Attempting online lookup for IDs...", LoggingTarget.Database); try From 7be3a5d466bafa64a4e462a5c1ec0ca70f6d5d7b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 19 Jul 2018 14:07:55 +0900 Subject: [PATCH 137/171] Centralise test storage logic --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 10 +++------- osu.Game/Tests/Platform/TestStorage.cs | 17 ----------------- osu.Game/Tests/Visual/OsuTestCase.cs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 24 deletions(-) delete mode 100644 osu.Game/Tests/Platform/TestStorage.cs diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 4afb76a7e2..b94fb42bf0 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -16,7 +16,6 @@ using osu.Game.Rulesets; using osu.Game.Screens.Select; using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Filter; -using osu.Game.Tests.Platform; namespace osu.Game.Tests.Visual { @@ -28,6 +27,7 @@ namespace osu.Game.Tests.Visual private RulesetStore rulesets; private WorkingBeatmap defaultBeatmap; + private DatabaseContextFactory factory; public override IReadOnlyList RequiredTypes => new[] { @@ -59,18 +59,14 @@ namespace osu.Game.Tests.Visual { TestSongSelect songSelect = null; - var storage = new TestStorage(@"TestCasePlaySongSelect"); - - // this is by no means clean. should be replacing inside of OsuGameBase somehow. - DatabaseContextFactory factory = new DatabaseContextFactory(storage); - + factory = new DatabaseContextFactory(LocalStorage); factory.ResetDatabase(); using (var usage = factory.Get()) usage.Migrate(); Dependencies.Cache(rulesets = new RulesetStore(factory)); - Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null) + Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null) { DefaultBeatmap = defaultBeatmap = Beatmap.Default }); diff --git a/osu.Game/Tests/Platform/TestStorage.cs b/osu.Game/Tests/Platform/TestStorage.cs deleted file mode 100644 index 8391de3405..0000000000 --- a/osu.Game/Tests/Platform/TestStorage.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Platform; - -namespace osu.Game.Tests.Platform -{ - public class TestStorage : DesktopStorage - { - public TestStorage(string baseName) - : base(baseName, null) - { - } - - public override string GetDatabaseConnectionString(string name) => "Data Source=" + GetUsablePathFor($"{name}.db", true); - } -} diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index fcbab5b8f5..8e09ec849c 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -1,10 +1,12 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Configuration; +using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets; @@ -20,6 +22,9 @@ namespace osu.Game.Tests.Visual protected DependencyContainer Dependencies { get; private set; } + private readonly Lazy localStorage; + protected Storage LocalStorage => localStorage.Value; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { Dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); @@ -33,6 +38,11 @@ namespace osu.Game.Tests.Visual return Dependencies; } + protected OsuTestCase() + { + localStorage = new Lazy(() => new DesktopStorage($"{GetType().Name}-{Guid.NewGuid()}", null)); + } + [BackgroundDependencyLoader] private void load(AudioManager audioManager, RulesetStore rulesets) { @@ -50,6 +60,9 @@ namespace osu.Game.Tests.Visual beatmap.Disabled = true; beatmap.Value.Track.Stop(); } + + if (localStorage.IsValueCreated) + localStorage.Value.DeleteDirectory("."); } protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner(); From 4e72794101d75c52b93acd1659d52079d5128b2b Mon Sep 17 00:00:00 2001 From: David V Date: Thu, 19 Jul 2018 15:55:38 +0200 Subject: [PATCH 138/171] Converts float to int. --- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 48512a71c2..1b6c6f5ce8 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -41,14 +41,14 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo); + result = CreateHit(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - var pos = new Vector2(int.Parse(split[0]), int.Parse(split[1])); + var pos = new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])); CurveType curveType = CurveType.Catmull; double length = 0; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(new Vector2(int.Parse(split[0]), int.Parse(split[1])), combo, endTime + offset); + result = CreateHold(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo, endTime + offset); } if (result == null) From 9eb69a1e768848ab304b5134d8f3ca8fcfde098a Mon Sep 17 00:00:00 2001 From: David V Date: Thu, 19 Jul 2018 17:47:55 +0200 Subject: [PATCH 139/171] Restructure + corrects converting to support all systems --- .../Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 1b6c6f5ce8..dc1cd5ed3b 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -30,6 +30,8 @@ namespace osu.Game.Rulesets.Objects.Legacy { string[] split = text.Split(','); + Vector2 pos = new Vector2((int)Convert.ToSingle(split[0], CultureInfo.InvariantCulture), (int)Convert.ToSingle(split[1], CultureInfo.InvariantCulture)); + ConvertHitObjectType type = (ConvertHitObjectType)int.Parse(split[3]) & ~ConvertHitObjectType.ColourHax; bool combo = type.HasFlag(ConvertHitObjectType.NewCombo); type &= ~ConvertHitObjectType.NewCombo; @@ -41,15 +43,13 @@ namespace osu.Game.Rulesets.Objects.Legacy if (type.HasFlag(ConvertHitObjectType.Circle)) { - result = CreateHit(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo); + result = CreateHit(pos, combo); if (split.Length > 5) readCustomSampleBanks(split[5], bankInfo); } else if (type.HasFlag(ConvertHitObjectType.Slider)) { - var pos = new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])); - CurveType curveType = CurveType.Catmull; double length = 0; var points = new List { Vector2.Zero }; @@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Objects.Legacy readCustomSampleBanks(string.Join(":", ss.Skip(1)), bankInfo); } - result = CreateHold(new Vector2((int)float.Parse(split[0]), (int)float.Parse(split[1])), combo, endTime + offset); + result = CreateHold(pos, combo, endTime + offset); } if (result == null) From 967d0c3c72269e9fad90d090601c71a25a186ec5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 15:12:04 +0900 Subject: [PATCH 140/171] Adjust testcase --- .../Formats/LegacyBeatmapDecoderTest.cs | 18 +++++++++--------- ....osu => controlpoint-custom-samplebank.osu} | 0 ...-samples.osu => hitobject-file-samples.osu} | 0 3 files changed, 9 insertions(+), 9 deletions(-) rename osu.Game.Tests/Resources/{custom-samples.osu => controlpoint-custom-samplebank.osu} (100%) rename osu.Game.Tests/Resources/{custom-hitobject-samples.osu => hitobject-file-samples.osu} (100%) diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 2f5b4a13d9..6b72dc5733 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -214,10 +214,10 @@ namespace osu.Game.Tests.Beatmaps.Formats } [Test] - public void TestDecodeCustomSamples() + public void TestDecodeControlPointCustomSampleBank() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; - using (var resStream = Resource.OpenResource("custom-samples.osu")) + using (var resStream = Resource.OpenResource("controlpoint-custom-samplebank.osu")) using (var stream = new StreamReader(resStream)) { var hitObjects = decoder.Decode(stream).HitObjects; @@ -228,25 +228,25 @@ namespace osu.Game.Tests.Beatmaps.Formats Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[3]).LookupNames.First()); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } [Test] - public void TestDecodeCustomHitObjectSamples() + public void TestDecodeHitObjectCustomSampleBank() { var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; - using (var resStream = Resource.OpenResource("custom-hitobject-samples.osu")) + using (var resStream = Resource.OpenResource("hitobject-custom-samplebank.osu")) using (var stream = new StreamReader(resStream)) { var hitObjects = decoder.Decode(stream).HitObjects; - Assert.AreEqual("hit_1.wav", hitObjects[0].Samples[0].LookupNames.First()); - Assert.AreEqual("hit_2.wav", hitObjects[1].Samples[0].LookupNames.First()); + Assert.AreEqual("hit_1.wav", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); + Assert.AreEqual("hit_2.wav", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); - Assert.AreEqual("hit_1.wav", hitObjects[3].Samples[0].LookupNames.First()); + Assert.AreEqual("hit_1.wav", getTestableSampleInfo(hitObjects[3]).LookupNames.First()); } - SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(new SampleInfo { Name = "hitnormal" }); + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); } } } diff --git a/osu.Game.Tests/Resources/custom-samples.osu b/osu.Game.Tests/Resources/controlpoint-custom-samplebank.osu similarity index 100% rename from osu.Game.Tests/Resources/custom-samples.osu rename to osu.Game.Tests/Resources/controlpoint-custom-samplebank.osu diff --git a/osu.Game.Tests/Resources/custom-hitobject-samples.osu b/osu.Game.Tests/Resources/hitobject-file-samples.osu similarity index 100% rename from osu.Game.Tests/Resources/custom-hitobject-samples.osu rename to osu.Game.Tests/Resources/hitobject-file-samples.osu From de8d05bb0cbc64c80877ca2ee98a5388ff56c037 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 15:12:21 +0900 Subject: [PATCH 141/171] Remove unnecessary setting of sample name to same value --- osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs index acccbcde46..18680f9985 100644 --- a/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs +++ b/osu.Game/Beatmaps/ControlPoints/SampleControlPoint.cs @@ -40,7 +40,6 @@ namespace osu.Game.Beatmaps.ControlPoints { var newSampleInfo = sampleInfo.Clone(); newSampleInfo.Bank = sampleInfo.Bank ?? SampleBank; - newSampleInfo.Name = sampleInfo.Name; newSampleInfo.Volume = sampleInfo.Volume > 0 ? sampleInfo.Volume : SampleVolume; return newSampleInfo; } From c087a73f403c73bdfb428d4b5bd1880097da2df4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 15:12:44 +0900 Subject: [PATCH 142/171] Implement per-hitobject custom sample banks --- .../Formats/LegacyBeatmapDecoderTest.cs | 17 ++++++++ .../Resources/hitobject-custom-samplebank.osu | 13 ++++++ osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 +- .../Objects/Legacy/ConvertHitObjectParser.cs | 41 ++++++++++++++----- 4 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 osu.Game.Tests/Resources/hitobject-custom-samplebank.osu diff --git a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs index 6b72dc5733..400380b407 100644 --- a/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/LegacyBeatmapDecoderTest.cs @@ -240,6 +240,23 @@ namespace osu.Game.Tests.Beatmaps.Formats { var hitObjects = decoder.Decode(stream).HitObjects; + Assert.AreEqual("normal-hitnormal", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); + Assert.AreEqual("normal-hitnormal3", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); + } + + SampleInfo getTestableSampleInfo(HitObject hitObject) => hitObject.SampleControlPoint.ApplyTo(hitObject.Samples[0]); + } + + [Test] + public void TestDecodeHitObjectFileSamples() + { + var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false }; + using (var resStream = Resource.OpenResource("hitobject-file-samples.osu")) + using (var stream = new StreamReader(resStream)) + { + var hitObjects = decoder.Decode(stream).HitObjects; + Assert.AreEqual("hit_1.wav", getTestableSampleInfo(hitObjects[0]).LookupNames.First()); Assert.AreEqual("hit_2.wav", getTestableSampleInfo(hitObjects[1]).LookupNames.First()); Assert.AreEqual("normal-hitnormal2", getTestableSampleInfo(hitObjects[2]).LookupNames.First()); diff --git a/osu.Game.Tests/Resources/hitobject-custom-samplebank.osu b/osu.Game.Tests/Resources/hitobject-custom-samplebank.osu new file mode 100644 index 0000000000..56b1a8762f --- /dev/null +++ b/osu.Game.Tests/Resources/hitobject-custom-samplebank.osu @@ -0,0 +1,13 @@ +osu file format v14 + +[General] +SampleSet: Normal + +[TimingPoints] +2170,468.75,4,1,0,40,1,0 +3107,-100,4,1,2,40,0,0 + +[HitObjects] +255,193,2170,1,0,0:0:0:0: +256,191,3107,5,0,0:0:0:0: +255,193,4000,1,0,0:0:3:70: diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 91c1c98438..76a3d75e36 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -188,7 +188,7 @@ namespace osu.Game.Beatmaps.Formats { var baseInfo = base.ApplyTo(sampleInfo); - if (CustomSampleBank > 1) + if (string.IsNullOrEmpty(baseInfo.Suffix) && CustomSampleBank > 1) baseInfo.Suffix = CustomSampleBank.ToString(); return baseInfo; diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 48512a71c2..5de05a99cc 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -194,8 +194,8 @@ namespace osu.Game.Rulesets.Objects.Legacy string[] split = str.Split(':'); - var bank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[0]); - var addbank = (LegacyBeatmapDecoder.LegacySampleBank)Convert.ToInt32(split[1]); + var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]); + var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]); string stringBank = bank.ToString().ToLower(); if (stringBank == @"none") @@ -207,6 +207,9 @@ namespace osu.Game.Rulesets.Objects.Legacy bankInfo.Normal = stringBank; bankInfo.Add = stringAddBank; + if (split.Length > 2) + bankInfo.CustomSampleBank = int.Parse(split[2]); + if (split.Length > 3) bankInfo.Volume = int.Parse(split[3]); @@ -258,41 +261,45 @@ namespace osu.Game.Rulesets.Objects.Legacy var soundTypes = new List { - new SampleInfo + new LegacySampleInfo { Bank = bankInfo.Normal, Name = SampleInfo.HIT_NORMAL, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank } }; if (type.HasFlag(LegacySoundType.Finish)) { - soundTypes.Add(new SampleInfo + soundTypes.Add(new LegacySampleInfo { Bank = bankInfo.Add, Name = SampleInfo.HIT_FINISH, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank }); } if (type.HasFlag(LegacySoundType.Whistle)) { - soundTypes.Add(new SampleInfo + soundTypes.Add(new LegacySampleInfo { Bank = bankInfo.Add, Name = SampleInfo.HIT_WHISTLE, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank }); } if (type.HasFlag(LegacySoundType.Clap)) { - soundTypes.Add(new SampleInfo + soundTypes.Add(new LegacySampleInfo { Bank = bankInfo.Add, Name = SampleInfo.HIT_CLAP, - Volume = bankInfo.Volume + Volume = bankInfo.Volume, + CustomSampleBank = bankInfo.CustomSampleBank }); } @@ -307,9 +314,23 @@ namespace osu.Game.Rulesets.Objects.Legacy public string Add; public int Volume; + public int CustomSampleBank; + public SampleBankInfo Clone() => (SampleBankInfo)MemberwiseClone(); } + private class LegacySampleInfo : SampleInfo + { + public int CustomSampleBank + { + set + { + if (value > 1) + Suffix = value.ToString(); + } + } + } + private class FileSampleInfo : SampleInfo { public string Filename; From 7fea2b3a8b683e433451c7a504de0569bfd06de8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Jul 2018 16:38:02 +0900 Subject: [PATCH 143/171] Add ToList --- osu.Game/Beatmaps/BeatmapManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 3bd5c440c1..67f02c8ac4 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -123,7 +123,7 @@ namespace osu.Game.Beatmaps private void validateOnlineIds(List beatmaps) { - var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID); + var beatmapIds = beatmaps.Where(b => b.OnlineBeatmapID.HasValue).Select(b => b.OnlineBeatmapID).ToList(); // ensure all IDs are unique in this set and none match existing IDs in the local beatmap store. if (beatmapIds.GroupBy(b => b).Any(g => g.Count() > 1) || QueryBeatmaps(b => beatmapIds.Contains(b.OnlineBeatmapID)).Any()) From 1139f0dbf248ebf29dc96d53faa64aae26de8c55 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 20 Jul 2018 17:04:33 +0900 Subject: [PATCH 144/171] Centralise method of disabling playfield judgements --- osu.Game.Rulesets.Mania/UI/Column.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs | 6 ------ osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 2 +- osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs | 12 ------------ .../Edit/OsuEditRulesetContainer.cs | 3 --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 -- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 3 +++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 7 +++++++ osu.Game/Rulesets/UI/Playfield.cs | 8 ++++++++ 9 files changed, 20 insertions(+), 25 deletions(-) delete mode 100644 osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 063531da45..877189dd61 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -138,7 +138,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { - if (!judgement.IsHit || !judgedObject.DisplayJudgement) + if (!judgement.IsHit || !judgedObject.DisplayJudgement || !DisplayJudgements) return; explosionContainer.Add(new HitExplosion(judgedObject) diff --git a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs index d6781a6e8f..f88169726e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaPlayfield.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Mania.Configuration; @@ -74,10 +73,5 @@ namespace osu.Game.Rulesets.Mania.UI { maniaConfig.BindWith(ManiaSetting.ScrollTime, VisibleTimeRange); } - - internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) - { - getStageByColumn(((ManiaHitObject)judgedObject.HitObject).Column).OnJudgement(judgedObject, judgement); - } } } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index a0ff8780ad..f386cf15a2 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -163,7 +163,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { - if (!judgedObject.DisplayJudgement) + if (!judgedObject.DisplayJudgement || !DisplayJudgements) return; judgements.Clear(); diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs deleted file mode 100644 index 6213bb1329..0000000000 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditPlayfield.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Game.Rulesets.Osu.UI; - -namespace osu.Game.Rulesets.Osu.Edit -{ - public class OsuEditPlayfield : OsuPlayfield - { - protected override bool DisplayJudgements => false; - } -} diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs index ea33ec9ae0..6efa16bf56 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.UI; -using osu.Game.Rulesets.UI; using OpenTK; namespace osu.Game.Rulesets.Osu.Edit @@ -16,8 +15,6 @@ namespace osu.Game.Rulesets.Osu.Edit { } - protected override Playfield CreatePlayfield() => new OsuEditPlayfield(); - protected override Vector2 PlayfieldArea => Vector2.One; protected override CursorContainer CreateCursor() => null; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 04724931ae..b0ba9afee6 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -20,8 +20,6 @@ namespace osu.Game.Rulesets.Osu.UI private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; - protected virtual bool DisplayJudgements => true; - public static readonly Vector2 BASE_SIZE = new Vector2(512, 384); public OsuPlayfield() diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index bb5994c2f2..4cb8dd48a7 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -226,6 +226,9 @@ namespace osu.Game.Rulesets.Taiko.UI internal void OnJudgement(DrawableHitObject judgedObject, Judgement judgement) { + if (!DisplayJudgements) + return; + if (judgedObject.DisplayJudgement && judgementContainer.FirstOrDefault(j => j.JudgedObject == judgedObject) == null) { judgementContainer.Add(new DrawableTaikoJudgement(judgement, judgedObject) diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 0c91c9f548..b2f6e909d2 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -110,6 +110,13 @@ namespace osu.Game.Rulesets.Edit toolboxCollection.Items[0].Select(); } + protected override void LoadComplete() + { + base.LoadComplete(); + + rulesetContainer.Playfield.DisplayJudgements.Value = false; + } + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index f2c9b49900..2f44d99e18 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; +using osu.Framework.Configuration; namespace osu.Game.Rulesets.UI { @@ -21,6 +22,11 @@ namespace osu.Game.Rulesets.UI public IReadOnlyList NestedPlayfields => nestedPlayfields; private List nestedPlayfields; + /// + /// Whether judgements should be displayed by this and and all nested s. + /// + public readonly BindableBool DisplayJudgements = new BindableBool(true); + /// /// A container for keeping track of DrawableHitObjects. /// @@ -73,6 +79,8 @@ namespace osu.Game.Rulesets.UI nestedPlayfields = new List(); nestedPlayfields.Add(otherPlayfield); + + otherPlayfield.DisplayJudgements.BindTo(DisplayJudgements); } /// From 241437c819e89db8b6e06d45405d6d8fef30b689 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 20 Jul 2018 17:08:25 +0900 Subject: [PATCH 145/171] Remove unnecessary counting change logic --- osu.Game.Tests/Visual/TestCaseKeyCounter.cs | 1 - osu.Game/Screens/Play/HUDOverlay.cs | 1 - osu.Game/Screens/Play/KeyCounter.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 3 +-- osu.Game/Screens/Play/Player.cs | 3 --- 5 files changed, 2 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs index a20f67e336..b98875cd6a 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseKeyCounter.cs @@ -18,7 +18,6 @@ namespace osu.Game.Tests.Visual { Origin = Anchor.Centre, Anchor = Anchor.Centre, - IsCounting = true, Children = new KeyCounter[] { new KeyCounterKeyboard(Key.Z), diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index f920b20649..4f3fe15211 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -195,7 +195,6 @@ namespace osu.Game.Screens.Play protected virtual KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection { - IsCounting = true, FadeTime = 50, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 2a0587133b..2c31e61114 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Play private Container textLayer; private SpriteText countSpriteText; - public bool IsCounting { get; set; } + public bool IsCounting { get; set; } = true; private int countPresses; public int CountPresses { diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 114ea83ba6..721d925d63 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -53,8 +53,7 @@ namespace osu.Game.Screens.Play configVisibility.BindValueChanged(_ => updateVisibility(), true); } - //further: change default values here and in KeyCounter if needed, instead of passing them in every constructor - private bool isCounting; + private bool isCounting = true; public bool IsCounting { get { return isCounting; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 427519bff8..f28ddb09a2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -224,9 +224,6 @@ namespace osu.Game.Screens.Play RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); - // schedule to ensure we count any key presses from the current frame (which may affect gameplay). - RulesetContainer.IsPaused.ValueChanged += paused => Schedule(() => hudOverlay.KeyCounter.IsCounting = !paused); - if (ShowStoryboard) initializeStoryboard(false); From f200cfe40dec998572f43a1ed1c859c97c7c9d15 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 13:05:19 +0300 Subject: [PATCH 146/171] Add labelled text box files --- .../LabelledComponents/LabelledTextBox.cs | 207 ++++++++++++++++++ .../Setup/Components/OsuSetupTextBox.cs | 24 ++ 2 files changed, 231 insertions(+) create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs create mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs new file mode 100644 index 0000000000..e0c734f764 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -0,0 +1,207 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using OpenTK.Graphics; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using System; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents +{ + public class LabelledTextBox : CompositeDrawable + { + private readonly OsuSetupTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + + public const float LABEL_CONTAINER_WIDTH = 150; + public const float OUTER_CORNER_RADIUS = 15; + public const float INNER_CORNER_RADIUS = 10; + public const float DEFAULT_HEIGHT = 40; + public const float DEFAULT_LABEL_LEFT_PADDING = 15; + public const float DEFAULT_LABEL_TOP_PADDING = 12; + public const float DEFAULT_LABEL_TEXT_SIZE = 16; + + public event Action TextBoxTextChanged; + + public void TriggerTextBoxTextChanged(string newText) + { + TextBoxTextChanged?.Invoke(newText); + } + + private bool readOnly; + public bool ReadOnly + { + get => readOnly; + set + { + textBox.ReadOnly = value; + readOnly = value; + } + } + + private string labelText; + public string LabelText + { + get => labelText; + set + { + labelText = value; + label.Text = value; + } + } + + private float labelTextSize; + public float LabelTextSize + { + get => labelTextSize; + set + { + labelTextSize = value; + label.TextSize = value; + } + } + + private string textBoxPlaceholderText; + public string TextBoxPlaceholderText + { + get => textBoxPlaceholderText; + set + { + textBoxPlaceholderText = value; + textBox.PlaceholderText = value; + } + } + + private string textBoxText; + public string TextBoxText + { + get => textBoxText; + set + { + textBoxText = value; + textBox.Text = value; + TextBoxTextChanged?.Invoke(value); + } + } + + private float height = DEFAULT_HEIGHT; + public float Height + { + get => height; + private set + { + height = value; + textBox.Height = value; + content.Height = value; + } + } + + public MarginPadding Padding + { + get => base.Padding; + set + { + base.Padding = value; + base.Height = Height + base.Padding.Top; + } + } + + public MarginPadding LabelPadding + { + get => label.Padding; + set => label.Padding = value; + } + + public MarginPadding TextBoxPadding + { + get => textBox.Padding; + set => textBox.Padding = value; + } + + public Color4 LabelTextColour + { + get => label.Colour; + set => label.Colour = value; + } + + public Color4 BackgroundColour + { + get => content.Colour; + set => content.Colour = value; + } + + public LabelledTextBox() + { + Masking = true; + CornerRadius = OUTER_CORNER_RADIUS; + RelativeSizeAxes = Axes.X; + base.Height = DEFAULT_HEIGHT + Padding.Top; + + InternalChildren = new Drawable[] + { + new Container + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + CornerRadius = OUTER_CORNER_RADIUS, + Masking = true, + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Colour = OsuColour.FromHex("1c2125"), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Child = new GridContainer + { + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + Content = new[] + { + new Drawable[] + { + label = new OsuSpriteText + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = DEFAULT_LABEL_LEFT_PADDING, Top = DEFAULT_LABEL_TOP_PADDING }, + Colour = Color4.White, + TextSize = DEFAULT_LABEL_TEXT_SIZE, + Text = LabelText, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuSetupTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = DEFAULT_HEIGHT, + ReadOnly = ReadOnly, + CornerRadius = INNER_CORNER_RADIUS, + }, + }, + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, LABEL_CONTAINER_WIDTH), + new Dimension() + } + } + } + } + } + }; + + textBox.OnCommit += delegate { TriggerTextBoxTextChanged(textBox.Text); }; + } + } +} diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs new file mode 100644 index 0000000000..1a31582291 --- /dev/null +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs @@ -0,0 +1,24 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; + +namespace osu.Game.Screens.Edit.Screens.Setup.Components +{ + public class OsuSetupTextBox : OsuTextBox + { + protected override float LeftRightPadding => 15; + + [BackgroundDependencyLoader] + private void load(OsuColour osuColour) + { + BorderColour = osuColour.Blue; + } + + protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Colour = BorderColour, TextSize = CalculatedTextSize }; + } +} From 6dd5c7e5ab46b6fe548eff85ffc6871c232b71d9 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Fri, 20 Jul 2018 14:28:39 +0300 Subject: [PATCH 147/171] Add test case --- .../Visual/TestCaseLabelledTextBox.cs | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs new file mode 100644 index 0000000000..a9f0375d39 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -0,0 +1,37 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using NUnit.Framework; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; +using System; +using System.Collections.Generic; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseLabelledTextBox : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(LabelledTextBox), + }; + + [BackgroundDependencyLoader] + private void load() + { + Children = new Drawable[] + { + new LabelledTextBox + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + LabelText = "Testing text", + TextBoxPlaceholderText = "This is definitely working as intended", + Padding = new MarginPadding { Left = 150, Right = 150 } + } + }; + } + } +} From 0f37758314c9f74b2119de35d5a3abc775fe52af Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 21 Jul 2018 11:38:28 +0900 Subject: [PATCH 148/171] Update framework --- .../Replays/CatchFramedReplayInputHandler.cs | 2 +- .../Replays/ManiaFramedReplayInputHandler.cs | 2 +- .../Objects/Drawables/Pieces/SliderBall.cs | 3 ++- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 2 +- osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs | 1 + .../Replays/TaikoFramedReplayInputHandler.cs | 2 +- osu.Game.Tests/Visual/TestCaseCursors.cs | 2 +- osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs | 2 +- osu.Game/Beatmaps/IBeatmapConverter.cs | 1 + osu.Game/Beatmaps/IBeatmapProcessor.cs | 3 +++ osu.Game/Beatmaps/WorkingBeatmap.cs | 1 + osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs | 1 + .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 2 +- osu.Game/Graphics/Containers/OsuHoverContainer.cs | 2 +- osu.Game/Graphics/Containers/OsuScrollContainer.cs | 3 ++- osu.Game/Graphics/Cursor/MenuCursor.cs | 3 ++- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/ExternalLinkButton.cs | 2 +- osu.Game/Graphics/UserInterface/FocusedTextBox.cs | 3 ++- osu.Game/Graphics/UserInterface/HoverClickSounds.cs | 2 +- osu.Game/Graphics/UserInterface/HoverSounds.cs | 2 +- osu.Game/Graphics/UserInterface/IconButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuMenu.cs | 2 +- osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 3 ++- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/PageTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/SearchTextBox.cs | 3 ++- osu.Game/Graphics/UserInterface/TriangleButton.cs | 3 ++- osu.Game/Graphics/UserInterface/TwoLayerButton.cs | 3 ++- osu.Game/Input/Handlers/ReplayInputHandler.cs | 3 ++- .../20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs | 2 -- .../Migrations/20171209034410_AddRulesetInfoShortName.cs | 2 -- osu.Game/Migrations/20180125143340_Settings.cs | 2 -- osu.Game/Migrations/20180131154205_AddMuteBinding.cs | 2 -- osu.Game/Migrations/20180219060912_AddSkins.cs | 2 -- .../20180529055154_RemoveUniqueHashConstraints.cs | 2 -- .../20180621044111_UpdateTaikoDefaultBindings.cs | 1 - osu.Game/Migrations/OsuDbContextModelSnapshot.cs | 3 +-- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 2 +- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- osu.Game/Overlays/Chat/ChannelListItem.cs | 2 +- osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/Chat/ChatTabControl.cs | 3 ++- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 3 ++- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectListPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/Direct/PlayButton.cs | 2 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 8 +++++--- osu.Game/Overlays/MainSettings.cs | 3 ++- osu.Game/Overlays/MedalOverlay.cs | 4 ++-- osu.Game/Overlays/Mods/ModButton.cs | 3 ++- osu.Game/Overlays/Mods/ModSection.cs | 3 ++- osu.Game/Overlays/Music/PlaylistItem.cs | 3 ++- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Overlays/Notifications/Notification.cs | 2 +- osu.Game/Overlays/Profile/Header/BadgeContainer.cs | 2 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 2 +- osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs | 2 +- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 2 +- osu.Game/Overlays/SearchableList/SearchableListOverlay.cs | 2 +- .../Overlays/Settings/Sections/General/LoginSettings.cs | 2 +- .../Overlays/Settings/Sections/Input/MouseSettings.cs | 1 + osu.Game/Overlays/Settings/SettingsItem.cs | 3 ++- osu.Game/Overlays/Settings/Sidebar.cs | 2 +- osu.Game/Overlays/Settings/SidebarButton.cs | 2 +- osu.Game/Overlays/SettingsOverlay.cs | 2 +- osu.Game/Overlays/Social/SocialPanel.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 3 ++- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 3 ++- osu.Game/Overlays/Volume/MuteButton.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Overlays/VolumeOverlay.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectMask.cs | 3 ++- osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs | 8 +++----- osu.Game/Rulesets/UI/RulesetInputManager.cs | 3 +++ osu.Game/Screens/BackgroundScreen.cs | 3 ++- osu.Game/Screens/Edit/Components/PlaybackControl.cs | 2 +- .../Edit/Components/Timelines/Summary/Parts/MarkerPart.cs | 3 ++- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Edit/Menus/EditorMenuBar.cs | 2 +- .../Screens/Edit/Screens/Compose/BeatDivisorControl.cs | 3 ++- osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs | 2 +- .../Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs | 3 ++- .../Screens/Edit/Screens/Compose/Layers/MaskContainer.cs | 2 +- .../Screens/Edit/Screens/Compose/Layers/MaskSelection.cs | 2 +- .../Screens/Compose/RadioButtons/DrawableRadioButton.cs | 2 +- .../Screens/Edit/Screens/Compose/Timeline/Timeline.cs | 3 ++- .../Screens/Compose/Timeline/ZoomableScrollContainer.cs | 2 +- osu.Game/Screens/Menu/Button.cs | 3 ++- osu.Game/Screens/Menu/MainMenu.cs | 3 ++- osu.Game/Screens/Menu/OsuLogo.cs | 3 ++- osu.Game/Screens/Multi/Components/DrawableRoom.cs | 2 +- osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs | 2 +- osu.Game/Screens/Multi/Screens/Match/Header.cs | 3 ++- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 3 ++- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs | 3 ++- osu.Game/Screens/Play/HUD/QuitButton.cs | 3 ++- osu.Game/Screens/Play/HUDOverlay.cs | 3 ++- osu.Game/Screens/Play/KeyCounterCollection.cs | 3 ++- osu.Game/Screens/Play/KeyCounterKeyboard.cs | 3 ++- osu.Game/Screens/Play/KeyCounterMouse.cs | 3 ++- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 3 ++- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 ++- osu.Game/Screens/Play/SkipOverlay.cs | 3 ++- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 ++- .../Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 2 +- osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 3 ++- osu.Game/Screens/Select/Footer.cs | 3 ++- osu.Game/Screens/Select/FooterButton.cs | 3 ++- osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs | 2 +- .../Select/Leaderboards/RetrievalFailurePlaceholder.cs | 3 ++- osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs | 3 ++- osu.Game/Screens/Select/SongSelect.cs | 3 ++- osu.Game/Tests/Visual/EditorClockTestCase.cs | 2 +- osu.Game/osu.Game.csproj | 2 +- 132 files changed, 183 insertions(+), 139 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs index 8d3d898655..f05eb31454 100644 --- a/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Catch/Replays/CatchFramedReplayInputHandler.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Framework.MathUtils; using osu.Game.Rulesets.Replays; diff --git a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs index 29eeb1cab5..ea239bf80f 100644 --- a/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Mania/Replays/ManiaFramedReplayInputHandler.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Game.Rulesets.Replays; namespace osu.Game.Rulesets.Mania.Replays diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 894d972e47..92c42af861 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -5,7 +5,8 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets.Objects.Types; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index bb5fa1b575..5aba60ba03 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs index 2eed41d13f..5c07860b19 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Framework.MathUtils; using osu.Game.Rulesets.Replays; using OpenTK; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 7bd80b5718..0532fe0223 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Timing; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs index eae033401e..ab7856eb8f 100644 --- a/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs +++ b/osu.Game.Rulesets.Taiko/Replays/TaikoFramedReplayInputHandler.cs @@ -4,7 +4,7 @@ using osu.Game.Rulesets.Replays; using System.Collections.Generic; using System.Linq; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; namespace osu.Game.Rulesets.Taiko.Replays { diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/TestCaseCursors.cs index 0aa8e9691e..361e255894 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/TestCaseCursors.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Sprites; diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 130685a4cf..45b5ec2c11 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -8,7 +8,7 @@ using System.Linq; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; using osu.Framework.Logging; using osu.Game.Screens.Play; diff --git a/osu.Game/Beatmaps/IBeatmapConverter.cs b/osu.Game/Beatmaps/IBeatmapConverter.cs index cbf9d184ac..a710afad16 100644 --- a/osu.Game/Beatmaps/IBeatmapConverter.cs +++ b/osu.Game/Beatmaps/IBeatmapConverter.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; namespace osu.Game.Beatmaps diff --git a/osu.Game/Beatmaps/IBeatmapProcessor.cs b/osu.Game/Beatmaps/IBeatmapProcessor.cs index 282662373a..4d634d7912 100644 --- a/osu.Game/Beatmaps/IBeatmapProcessor.cs +++ b/osu.Game/Beatmaps/IBeatmapProcessor.cs @@ -1,6 +1,9 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; + namespace osu.Game.Beatmaps { /// diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 74da978d9c..cfd34d44e7 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -14,6 +14,7 @@ using osu.Framework.IO.File; using System.IO; using osu.Game.IO.Serialization; using osu.Game.Rulesets; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI; using osu.Game.Skinning; diff --git a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs index 0e0a9a3bb9..d2e6ac1db8 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap_VirtualBeatmapTrack.cs @@ -3,6 +3,7 @@ using System.Linq; using osu.Framework.Audio.Track; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; namespace osu.Game.Beatmaps diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 0dc6297ad2..d2ab8441eb 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -5,10 +5,10 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using OpenTK; using osu.Framework.Configuration; using osu.Framework.Input.Bindings; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Input.Bindings; using osu.Game.Overlays; diff --git a/osu.Game/Graphics/Containers/OsuHoverContainer.cs b/osu.Game/Graphics/Containers/OsuHoverContainer.cs index e88dad93ef..12df19e7c0 100644 --- a/osu.Game/Graphics/Containers/OsuHoverContainer.cs +++ b/osu.Game/Graphics/Containers/OsuHoverContainer.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.Containers { diff --git a/osu.Game/Graphics/Containers/OsuScrollContainer.cs b/osu.Game/Graphics/Containers/OsuScrollContainer.cs index ebea9c49de..6d42be6fca 100644 --- a/osu.Game/Graphics/Containers/OsuScrollContainer.cs +++ b/osu.Game/Graphics/Containers/OsuScrollContainer.cs @@ -2,7 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Graphics.Containers diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 517be4c055..b55e1aa5dd 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -8,11 +8,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Configuration; using System; using JetBrains.Annotations; using osu.Framework.Graphics.Textures; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Graphics.Cursor diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 17d22587ad..ee2448ff02 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Configuration; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index be2412ccad..fe8995f310 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Platform; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 28d04c9a82..e4fd71e17e 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -2,8 +2,9 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using OpenTK.Graphics; -using osu.Framework.Input; using System; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; using OpenTK.Input; diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 1a9d124dfb..27a06ba0b7 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Extensions; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index dc35c75cd6..821305bc92 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -8,7 +8,7 @@ using osu.Framework.Audio.Sample; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index eca7bf57c8..be60812ba6 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -4,7 +4,7 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 990a2f20a9..4428a058db 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -6,7 +6,8 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index ea337d5f42..68f59bd8cd 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -8,7 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 41aeb534f0..abb077e94f 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs index 07920865c0..75655ddb36 100644 --- a/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuPasswordTextBox.cs @@ -9,7 +9,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Platform; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 7604009aab..b7b5319e06 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -11,9 +11,10 @@ using osu.Framework.Audio.Sample; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index d015a563f6..1b91d0cad3 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -14,7 +14,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 13740c935f..04ba111153 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 88b0543de0..7a45ffdd4b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -5,11 +5,11 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Input.Bindings; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 3a8c72725e..d203532f9c 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 7d53c9e9d9..6067481979 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -2,7 +2,8 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK; using OpenTK.Input; diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index a6492ddd63..bfdc0c3bef 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -9,7 +9,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index dd5454314d..4e6361d1ae 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -4,7 +4,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using OpenTK; using OpenTK.Graphics; using osu.Game.Graphics.Sprites; @@ -14,6 +13,8 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Framework.Audio.Track; using System; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; namespace osu.Game.Graphics.UserInterface { diff --git a/osu.Game/Input/Handlers/ReplayInputHandler.cs b/osu.Game/Input/Handlers/ReplayInputHandler.cs index 57a2e5df6d..5f53868b28 100644 --- a/osu.Game/Input/Handlers/ReplayInputHandler.cs +++ b/osu.Game/Input/Handlers/ReplayInputHandler.cs @@ -3,8 +3,9 @@ using System; using System.Collections.Generic; -using osu.Framework.Input; using osu.Framework.Input.Handlers; +using osu.Framework.Input.StateChanges; +using osu.Framework.Input.States; using osu.Framework.Platform; using OpenTK; diff --git a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs index 66ebda785b..084ae67940 100644 --- a/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs +++ b/osu.Game/Migrations/20171119065731_AddBeatmapOnlineIDUniqueConstraint.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs index 5227d1f8f9..09cf0af89c 100644 --- a/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs +++ b/osu.Game/Migrations/20171209034410_AddRulesetInfoShortName.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180125143340_Settings.cs b/osu.Game/Migrations/20180125143340_Settings.cs index 20701d672a..2e2768dc7c 100644 --- a/osu.Game/Migrations/20180125143340_Settings.cs +++ b/osu.Game/Migrations/20180125143340_Settings.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs index 374830ad93..5564a30bbf 100644 --- a/osu.Game/Migrations/20180131154205_AddMuteBinding.cs +++ b/osu.Game/Migrations/20180131154205_AddMuteBinding.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Infrastructure; using osu.Game.Database; using osu.Game.Input.Bindings; diff --git a/osu.Game/Migrations/20180219060912_AddSkins.cs b/osu.Game/Migrations/20180219060912_AddSkins.cs index 6cce4354d9..a0270ab0fd 100644 --- a/osu.Game/Migrations/20180219060912_AddSkins.cs +++ b/osu.Game/Migrations/20180219060912_AddSkins.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs index fe8c983a3f..27269cc5fc 100644 --- a/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs +++ b/osu.Game/Migrations/20180529055154_RemoveUniqueHashConstraints.cs @@ -1,6 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using System; -using System.Collections.Generic; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs index 1f3c015614..71304ea979 100644 --- a/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs +++ b/osu.Game/Migrations/20180621044111_UpdateTaikoDefaultBindings.cs @@ -1,5 +1,4 @@ using Microsoft.EntityFrameworkCore.Migrations; -using osu.Framework.Logging; namespace osu.Game.Migrations { diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index bd80cb743b..6dbeaed62f 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -1,8 +1,7 @@ // -using System; + using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using osu.Game.Database; namespace osu.Game.Migrations diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 6b75ac095d..8186bf8685 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 505b7a7540..18391c1177 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index 1f1a2a68d2..dc350d2c4c 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -3,10 +3,10 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; -using osu.Framework.Input; namespace osu.Game.Overlays.BeatmapSet.Scores { diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index fc8b3a6800..d9af81c19a 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index b3ceffd35e..a1ebab09b1 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 88f0a72ddf..02cc89e57e 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -7,7 +7,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index 910c87e0a8..7a60bf9f47 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -9,7 +9,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 57f2cd405d..4e4fe4f10a 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/Chat/ChatTabControl.cs b/osu.Game/Overlays/Chat/ChatTabControl.cs index 91b790ece4..2e3c9f9c5f 100644 --- a/osu.Game/Overlays/Chat/ChatTabControl.cs +++ b/osu.Game/Overlays/Chat/ChatTabControl.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -17,6 +16,8 @@ using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; using System; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Chat diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index a2542c537f..8e20d76914 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Threading; using osu.Game.Configuration; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index e32d7fb036..c9c90b4555 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -8,7 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index c9e6f39270..eb940bff60 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -11,7 +11,7 @@ using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index 17c5153dab..45e1164a57 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites; using osu.Framework.Allocation; using osu.Framework.Localisation; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; namespace osu.Game.Overlays.Direct diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 76da4b61b0..7d5c0c16cc 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 28cc484109..092c9ddbea 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index d407dc9cf9..86baaf3905 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -9,14 +9,16 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input; using OpenTK.Graphics; using OpenTK.Input; +using JoystickEventArgs = osu.Framework.Input.EventArgs.JoystickEventArgs; namespace osu.Game.Overlays.KeyBinding { @@ -230,7 +232,7 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnJoystickPress(InputState state, Framework.Input.JoystickEventArgs args) + protected override bool OnJoystickPress(InputState state, JoystickEventArgs args) { if (!HasFocus) return false; @@ -241,7 +243,7 @@ namespace osu.Game.Overlays.KeyBinding return true; } - protected override bool OnJoystickRelease(InputState state, Framework.Input.JoystickEventArgs args) + protected override bool OnJoystickRelease(InputState state, JoystickEventArgs args) { if (!HasFocus) return base.OnJoystickRelease(state, args); diff --git a/osu.Game/Overlays/MainSettings.cs b/osu.Game/Overlays/MainSettings.cs index 99a86f19a1..6e8b4494dc 100644 --- a/osu.Game/Overlays/MainSettings.cs +++ b/osu.Game/Overlays/MainSettings.cs @@ -5,8 +5,9 @@ using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 97a9217b23..bd67a718a7 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -16,11 +16,11 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Sample; using osu.Framework.Audio; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; using OpenTK.Input; -using System.Linq; using osu.Framework.Graphics.Shapes; using System; +using System.Linq; +using osu.Framework.Input.States; using osu.Framework.MathUtils; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index f4e0e3db04..8024f9a732 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -7,13 +7,14 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using System; using System.Linq; using osu.Framework.Graphics.Cursor; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Mods diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 48f51f72ca..2fb44bb927 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -6,12 +6,13 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using System; using System.Linq; using System.Collections.Generic; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; namespace osu.Game.Overlays.Mods { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index a630a86fce..62c9020160 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -8,7 +8,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index 19ce0cf932..32674f0a84 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -8,7 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using OpenTK; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 56af04c498..3def4c144e 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -13,7 +13,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Threading; using osu.Game.Beatmaps; diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index 3a3fcb54e0..6798ae2bb2 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -7,11 +7,11 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; namespace osu.Game.Overlays.Notifications diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index f968f94187..bfade5e45c 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users; diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 2c70507536..a059792796 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs index 3c841cbf14..3a4bfc6804 100644 --- a/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs +++ b/osu.Game/Overlays/Profile/Sections/DrawableProfileRow.cs @@ -6,7 +6,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 15b446efa5..38bc419838 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs index 47cdb4a765..f9e4a983bb 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListOverlay.cs @@ -5,7 +5,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 9a42bdd2aa..c7f98f4107 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -11,12 +11,12 @@ using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using OpenTK; -using osu.Framework.Input; using osu.Game.Users; using System.ComponentModel; using osu.Game.Graphics; using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; +using osu.Framework.Input.States; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; using Container = osu.Framework.Graphics.Containers.Container; diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 51a624330b..71ab4d3782 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Configuration; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 4c1ea1f32e..0f8d3aa2ac 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -12,7 +12,8 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 50452a7110..fdda5b870e 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -9,7 +9,7 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Threading; using osu.Game.Overlays.Toolbar; diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index 0a3a30480b..ac2c840c94 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 55326b53ed..83e121e998 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -11,7 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Settings; diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index 2411db7535..b0455f7edd 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -6,7 +6,7 @@ using OpenTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Users; namespace osu.Game.Overlays.Social diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index eeace2f11c..2eabf1eb74 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -6,12 +6,12 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics; using OpenTK; using osu.Framework.Graphics.Shapes; using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Input.States; namespace osu.Game.Overlays.Toolbar { diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 4514f3c33c..74af5d7e9c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -5,13 +5,14 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index b1af3f0d62..f2744ae83f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -6,12 +6,13 @@ using osu.Framework.Allocation; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using OpenTK; using OpenTK.Input; using OpenTK.Graphics; using osu.Framework.Configuration; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets; namespace osu.Game.Overlays.Toolbar diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index d0aa58e668..47169d7a7b 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using OpenTK; using OpenTK.Graphics; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 9aeca1f35f..a6c98aa97e 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Effects; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index e40597b2d4..4dcdd23768 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input.Bindings; diff --git a/osu.Game/Rulesets/Edit/HitObjectMask.cs b/osu.Game/Rulesets/Edit/HitObjectMask.cs index 61fb700dd3..ada026b32f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectMask.cs +++ b/osu.Game/Rulesets/Edit/HitObjectMask.cs @@ -5,7 +5,8 @@ using System; using osu.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets.Objects.Drawables; using OpenTK; diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index f13d96b35e..edad5cff80 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -3,12 +3,10 @@ using System; using System.Collections.Generic; -using osu.Framework.Input; +using osu.Framework.Input.StateChanges; using osu.Game.Input.Handlers; using OpenTK; using OpenTK.Input; -using KeyboardState = osu.Framework.Input.KeyboardState; -using MouseState = osu.Framework.Input.MouseState; namespace osu.Game.Rulesets.Replays { @@ -107,7 +105,7 @@ namespace osu.Game.Rulesets.Replays return CurrentTime = time; } - protected class ReplayMouseState : MouseState + protected class ReplayMouseState : osu.Framework.Input.States.MouseState { public ReplayMouseState(Vector2 position) { @@ -115,7 +113,7 @@ namespace osu.Game.Rulesets.Replays } } - protected class ReplayKeyboardState : KeyboardState + protected class ReplayKeyboardState : osu.Framework.Input.States.KeyboardState { public ReplayKeyboardState(List keys) { diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index a3120179a4..b05efce146 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -9,6 +9,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.StateChanges; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Configuration; using osu.Game.Input.Bindings; diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 9d9432b2ce..46d1260410 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,7 +5,8 @@ using System; using System.Threading; using osu.Framework.Screens; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK; namespace osu.Game.Screens diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 5f62843faf..6cd7fd52d4 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 0dc110951b..7ff3849361 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -6,7 +6,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index a52fa3b462..7159cd919c 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -12,7 +12,7 @@ using osu.Game.Screens.Edit.Menus; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Platform; using osu.Framework.Timing; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs index cb7c0fa803..c6351c8520 100644 --- a/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Menus/EditorMenuBar.cs @@ -6,12 +6,12 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; using OpenTK.Graphics; using osu.Framework.Configuration; +using osu.Framework.Input.States; using osu.Game.Screens.Edit.Screens; namespace osu.Game.Screens.Edit.Menus diff --git a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs index 21e48d8b0a..63df143ca8 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/BeatDivisorControl.cs @@ -12,7 +12,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using OpenTK; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs index d8200d6c37..c4392bbc60 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/DragLayer.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using OpenTK.Graphics; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs index b9a8e9914a..03ac8e91f0 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/HitObjectMaskLayer.cs @@ -5,7 +5,8 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs index df2691c28e..5ee31769a3 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskContainer.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Rulesets.Edit; using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs index 54697bad77..927e7a2342 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/MaskSelection.cs @@ -7,7 +7,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Edit.Types; diff --git a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs index 0a009d9958..803a1275d7 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/RadioButtons/DrawableRadioButton.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs index 8cb0fdd908..30205c5aa1 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/Timeline.cs @@ -7,7 +7,8 @@ using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs index 0bfea68e50..d30aaacc6a 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Timeline/ZoomableScrollContainer.cs @@ -5,7 +5,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Transforms; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using OpenTK; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 29820f234d..e53905a102 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -9,7 +9,6 @@ using osu.Framework.Audio.Sample; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; @@ -18,6 +17,8 @@ using OpenTK.Input; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; using osu.Framework.Audio.Track; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Beatmaps.ControlPoints; namespace osu.Game.Screens.Menu diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 4790996833..7e97859be6 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -6,7 +6,8 @@ using OpenTK.Graphics; using OpenTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index b74546310f..f0f765a4c9 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -11,7 +11,8 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Multi/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Components/DrawableRoom.cs index 54bd0ae7cc..739346fabe 100644 --- a/osu.Game/Screens/Multi/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Components/DrawableRoom.cs @@ -10,7 +10,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs index 51dea355bf..1a47829ad7 100644 --- a/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs +++ b/osu.Game/Screens/Multi/Screens/Lounge/Lounge.cs @@ -6,7 +6,7 @@ using System.Linq; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/Multi/Screens/Match/Header.cs b/osu.Game/Screens/Multi/Screens/Match/Header.cs index 02e717d4be..cc31f10fd2 100644 --- a/osu.Game/Screens/Multi/Screens/Match/Header.cs +++ b/osu.Game/Screens/Multi/Screens/Match/Header.cs @@ -8,7 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 52c08bb351..1ca3bc2189 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -5,7 +5,6 @@ using System; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Game.Graphics.Sprites; using OpenTK; using OpenTK.Graphics; @@ -17,6 +16,8 @@ using OpenTK.Input; using System.Collections.Generic; using System.Linq; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 33a8e1d7cf..894322dd41 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -10,9 +10,9 @@ using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.UI; using OpenTK; -using osu.Framework.Input; using osu.Game.Graphics.Containers; using System.Linq; +using osu.Framework.Input.States; namespace osu.Game.Screens.Play.HUD { diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 9025f323be..e5e2ed7ee0 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -3,8 +3,9 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK; -using osu.Framework.Input; using osu.Game.Screens.Play.PlayerSettings; using OpenTK.Input; diff --git a/osu.Game/Screens/Play/HUD/QuitButton.cs b/osu.Game/Screens/Play/HUD/QuitButton.cs index 29382c25f3..2a4b1f408d 100644 --- a/osu.Game/Screens/Play/HUD/QuitButton.cs +++ b/osu.Game/Screens/Play/HUD/QuitButton.cs @@ -8,7 +8,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 4f3fe15211..f51ea6fe3e 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -5,7 +5,8 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 721d925d63..5cb5bb152a 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -6,9 +6,10 @@ using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK.Graphics; -using osu.Framework.Input; using osu.Framework.Configuration; using osu.Framework.Allocation; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Configuration; using OpenTK; diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index cfa6efbd12..1c2f2c0ac4 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 7c680efcba..20cc53caee 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -1,7 +1,8 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using OpenTK.Input; using OpenTK; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index f28ddb09a2..4f37b59e6e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -12,7 +12,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 6e1c3d24f0..4abc0dfcd9 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -6,7 +6,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index cff3eca895..1813d02d02 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -5,7 +5,8 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index 383addc607..3e946288d9 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -6,7 +6,6 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; using osu.Framework.Threading; using osu.Framework.Timing; using osu.Game.Graphics; @@ -17,6 +16,8 @@ using OpenTK.Graphics; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Framework.Input.Bindings; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Input.Bindings; namespace osu.Game.Screens.Play diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 3c9a14e1f4..f1721d8941 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -8,7 +8,6 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Game.Configuration; -using osu.Framework.Input; using OpenTK.Input; using osu.Framework.MathUtils; using System.Diagnostics; @@ -18,6 +17,8 @@ using osu.Framework.Caching; using osu.Framework.Threading; using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index c5996327b9..6071e163cf 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs index b6dd6cad65..8a0052559e 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselItem.cs @@ -8,7 +8,7 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.MathUtils; using osu.Game.Graphics; using OpenTK; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 278d32b2d5..274b859e82 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -13,8 +13,9 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using Container = osu.Framework.Graphics.Containers.Container; -using osu.Framework.Input; using osu.Framework.Graphics.Shapes; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Configuration; using osu.Game.Rulesets; diff --git a/osu.Game/Screens/Select/Footer.cs b/osu.Game/Screens/Select/Footer.cs index 8f07e0a763..bc4d216f00 100644 --- a/osu.Game/Screens/Select/Footer.cs +++ b/osu.Game/Screens/Select/Footer.cs @@ -11,7 +11,8 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Select diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index 3fa12283b5..1b0e3a1620 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -8,7 +8,8 @@ using OpenTK.Input; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs index 19732107c7..95e9dde68e 100644 --- a/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Screens/Select/Leaderboards/LeaderboardScore.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; diff --git a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs index 99b0c53835..19cba72f1f 100644 --- a/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs +++ b/osu.Game/Screens/Select/Leaderboards/RetrievalFailurePlaceholder.cs @@ -3,7 +3,8 @@ using System; using osu.Framework.Graphics; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using OpenTK; diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index d789d41ef4..d4cd882433 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -5,7 +5,8 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using OpenTK; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 234508a195..3cf406fabb 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -12,7 +12,8 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Input; +using osu.Framework.Input.EventArgs; +using osu.Framework.Input.States; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 22f3e5b6df..0ca7ff011f 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -2,7 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Allocation; -using osu.Framework.Input; +using osu.Framework.Input.States; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c8db3e4d66..56a1979382 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -18,7 +18,7 @@ - + From 41ffc17fe3f268e2aa55e0721866fe1e15496912 Mon Sep 17 00:00:00 2001 From: VperuS Date: Sat, 21 Jul 2018 13:27:45 +0300 Subject: [PATCH 149/171] Small clarification about to run dotnet restore --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd0ba838cc..07d9ccf8ad 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` -The above methods should automatically do so, but if you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). +If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). VScode users must run `Restore` task from debug tab before attempt to build. # Contributing From 717345f2608b1c43e82f351ff4282db8f8f65495 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 20:00:34 +0200 Subject: [PATCH 150/171] Use full application name --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 07d9ccf8ad..a1932b0fdf 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Build and run - Using Visual Studio 2017, Rider or Visual Studio Code (configurations are included) - From command line using `dotnet run --project osu.Desktop --framework netcoreapp2.1` -If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). VScode users must run `Restore` task from debug tab before attempt to build. +If you run into issues building you may need to restore nuget packages (commonly via `dotnet restore`). Visual Studio Code users must run `Restore` task from debug tab before attempt to build. # Contributing From 3c59ccadd05e22af7e8ec7e3dff722e6736ab4dc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:19:58 +0200 Subject: [PATCH 151/171] Fix gameplay always skipping to first hitobject time Regresssed with previous build --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4f37b59e6e..e9e353d698 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; adjustableClock.Seek(AllowLeadIn - ? Math.Min(RulesetContainer.GameplayStartTime, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + ? Math.Min(0, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); From 8501967b6a3a61c38a1499e53914a5d5030860a0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:47:25 +0200 Subject: [PATCH 152/171] Fix testing regression --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b94fb42bf0..41c45f00f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -54,6 +54,12 @@ namespace osu.Game.Tests.Visual public new BeatmapCarousel Carousel => base.Carousel; } + protected override void Dispose(bool isDisposing) + { + factory.ResetDatabase(); + base.Dispose(isDisposing); + } + [BackgroundDependencyLoader] private void load() { From 44a2ae5f9ac83238d151d848580a8ee33bedfdc8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 08:33:47 +0200 Subject: [PATCH 153/171] Fix incorrect variable usage --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e9e353d698..00ba1a8d12 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -139,7 +139,7 @@ namespace osu.Game.Screens.Play adjustableClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false }; adjustableClock.Seek(AllowLeadIn - ? Math.Min(0, beatmap.HitObjects.First().StartTime - beatmap.BeatmapInfo.AudioLeadIn) + ? Math.Min(0, RulesetContainer.GameplayStartTime - beatmap.BeatmapInfo.AudioLeadIn) : RulesetContainer.GameplayStartTime); adjustableClock.ProcessFrame(); From 82ea4456e42d7dd4b96243f5e97cb78347ecd2d7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 22 Jul 2018 22:47:25 +0200 Subject: [PATCH 154/171] Fix testing regression --- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index b94fb42bf0..41c45f00f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -54,6 +54,12 @@ namespace osu.Game.Tests.Visual public new BeatmapCarousel Carousel => base.Carousel; } + protected override void Dispose(bool isDisposing) + { + factory.ResetDatabase(); + base.Dispose(isDisposing); + } + [BackgroundDependencyLoader] private void load() { From 2169a473253247b8bddeee98b27b9511b181c6f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 10:39:43 +0200 Subject: [PATCH 155/171] Prevent fatal failures on delete failures --- osu.Game/Tests/Visual/OsuTestCase.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 8e09ec849c..67a13bd850 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -62,7 +62,16 @@ namespace osu.Game.Tests.Visual } if (localStorage.IsValueCreated) - localStorage.Value.DeleteDirectory("."); + { + try + { + localStorage.Value.DeleteDirectory("."); + } + catch + { + // we don't really care if this fails; it will just leave folders lying around from test runs. + } + } } protected override ITestCaseTestRunner CreateRunner() => new OsuTestCaseTestRunner(); From 1b456fd7166a5645d9b3b058a8fbd7783a345518 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 23 Jul 2018 13:11:06 +0200 Subject: [PATCH 156/171] Fix a potential InvalidOperationException when entering song select Closes #3052. --- osu.Game/Screens/Select/Carousel/CarouselGroup.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index 2118cfdc78..ea461e7bd5 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -79,8 +79,13 @@ namespace osu.Game.Screens.Select.Carousel public override void Filter(FilterCriteria criteria) { base.Filter(criteria); - InternalChildren.Sort((x, y) => x.CompareTo(criteria, y)); - InternalChildren.ForEach(c => c.Filter(criteria)); + + var children = new List(InternalChildren); + + children.Sort((x, y) => x.CompareTo(criteria, y)); + children.ForEach(c => c.Filter(criteria)); + + InternalChildren = children; } protected virtual void ChildItemStateChanged(CarouselItem item, CarouselItemState value) From dd56a2d95fc15a3db53fbf4ad5d3252e79686072 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Mon, 23 Jul 2018 15:44:10 +0300 Subject: [PATCH 157/171] Apply proposed changes (untested) --- .../Visual/TestCaseLabelledTextBox.cs | 2 +- .../LabelledComponents/LabelledTextBox.cs | 74 +++++++++---------- .../{OsuSetupTextBox.cs => SetupTextBox.cs} | 2 +- 3 files changed, 36 insertions(+), 42 deletions(-) rename osu.Game/Screens/Edit/Screens/Setup/Components/{OsuSetupTextBox.cs => SetupTextBox.cs} (94%) diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index a9f0375d39..be11562bb0 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -28,7 +28,7 @@ namespace osu.Game.Tests.Visual Anchor = Anchor.Centre, Origin = Anchor.Centre, LabelText = "Testing text", - TextBoxPlaceholderText = "This is definitely working as intended", + PlaceholderText = "This is definitely working as intended", Padding = new MarginPadding { Left = 150, Right = 150 } } }; diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index e0c734f764..806e6b6f6d 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -8,29 +8,25 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using System; +using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly OsuSetupTextBox textBox; + private readonly SetupTextBox textBox; private readonly Container content; private readonly OsuSpriteText label; - public const float LABEL_CONTAINER_WIDTH = 150; - public const float OUTER_CORNER_RADIUS = 15; - public const float INNER_CORNER_RADIUS = 10; - public const float DEFAULT_HEIGHT = 40; - public const float DEFAULT_LABEL_LEFT_PADDING = 15; - public const float DEFAULT_LABEL_TOP_PADDING = 12; - public const float DEFAULT_LABEL_TEXT_SIZE = 16; + private const float label_container_width = 150; + private const float outer_corner_radius = 15; + private const float inner_corner_radius = 10; + private const float default_height = 40; + private const float default_label_left_padding = 15; + private const float default_label_top_padding = 12; + private const float default_label_text_size = 16; - public event Action TextBoxTextChanged; - - public void TriggerTextBoxTextChanged(string newText) - { - TextBoxTextChanged?.Invoke(newText); - } + public event OnCommitHandler TextBoxTextChanged; private bool readOnly; public bool ReadOnly @@ -65,30 +61,30 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } } - private string textBoxPlaceholderText; - public string TextBoxPlaceholderText + private string placeholderText; + public string PlaceholderText { - get => textBoxPlaceholderText; + get => placeholderText; set { - textBoxPlaceholderText = value; + placeholderText = value; textBox.PlaceholderText = value; } } - private string textBoxText; - public string TextBoxText + private string text; + public string Text { - get => textBoxText; + get => text; set { - textBoxText = value; + text = value; textBox.Text = value; - TextBoxTextChanged?.Invoke(value); + TextBoxTextChanged?.Invoke(textBox, true); } } - private float height = DEFAULT_HEIGHT; + private float height = default_height; public float Height { get => height; @@ -137,34 +133,32 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { Masking = true; - CornerRadius = OUTER_CORNER_RADIUS; + CornerRadius = outer_corner_radius; RelativeSizeAxes = Axes.X; - base.Height = DEFAULT_HEIGHT + Padding.Top; + base.Height = default_height + Padding.Top; InternalChildren = new Drawable[] { new Container { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, - CornerRadius = OUTER_CORNER_RADIUS, + RelativeSizeAxes = Axes.Both, + CornerRadius = outer_corner_radius, Masking = true, Children = new Drawable[] { new Box { - RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex("1c2125"), }, new Container { RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, Child = new GridContainer { RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, Content = new[] { new Drawable[] @@ -173,26 +167,26 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = DEFAULT_LABEL_LEFT_PADDING, Top = DEFAULT_LABEL_TOP_PADDING }, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, Colour = Color4.White, - TextSize = DEFAULT_LABEL_TEXT_SIZE, + TextSize = default_label_text_size, Text = LabelText, Font = @"Exo2.0-Bold", }, - textBox = new OsuSetupTextBox + textBox = new SetupTextBox { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.X, - Height = DEFAULT_HEIGHT, + Height = default_height, ReadOnly = ReadOnly, - CornerRadius = INNER_CORNER_RADIUS, + CornerRadius = inner_corner_radius, }, }, }, ColumnDimensions = new[] { - new Dimension(GridSizeMode.Absolute, LABEL_CONTAINER_WIDTH), + new Dimension(GridSizeMode.Absolute, label_container_width), new Dimension() } } @@ -201,7 +195,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } }; - textBox.OnCommit += delegate { TriggerTextBoxTextChanged(textBox.Text); }; + textBox.OnCommit += (_, a) => TextBoxTextChanged?.Invoke(textBox, a); } } } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs similarity index 94% rename from osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs rename to osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs index 1a31582291..206170e1eb 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/OsuSetupTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Screens.Edit.Screens.Setup.Components { - public class OsuSetupTextBox : OsuTextBox + public class SetupTextBox : OsuTextBox { protected override float LeftRightPadding => 15; From a833fa3d924e05df4047d5ba00965819156f4a2a Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:19:45 +0300 Subject: [PATCH 158/171] Update framework and apply suggested changes --- .../Setup/Components/LabelledComponents/LabelledTextBox.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 806e6b6f6d..09797e3180 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_top_padding = 12; private const float default_label_text_size = 16; - public event OnCommitHandler TextBoxTextChanged; + public event OnCommitHandler OnCommit; private bool readOnly; public bool ReadOnly @@ -80,7 +80,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { text = value; textBox.Text = value; - TextBoxTextChanged?.Invoke(textBox, true); } } @@ -195,7 +194,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents } }; - textBox.OnCommit += (_, a) => TextBoxTextChanged?.Invoke(textBox, a); + textBox.OnCommit += OnCommit; } } } From 2f452c162cb9b9c09dd21dba9780f6630fdb3270 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:21:01 +0300 Subject: [PATCH 159/171] Make text colour white --- .../Screens/Edit/Screens/Setup/Components/SetupTextBox.cs | 8 -------- 1 file changed, 8 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs index 206170e1eb..c3938fae9c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs @@ -12,13 +12,5 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components public class SetupTextBox : OsuTextBox { protected override float LeftRightPadding => 15; - - [BackgroundDependencyLoader] - private void load(OsuColour osuColour) - { - BorderColour = osuColour.Blue; - } - - protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Colour = BorderColour, TextSize = CalculatedTextSize }; } } From 765c6e4eccbe0a3744fd6c3dfca1f42aa1522f34 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 09:46:24 +0300 Subject: [PATCH 160/171] Remove custom text box --- .../LabelledComponents/LabelledTextBox.cs | 5 +++-- .../Screens/Setup/Components/SetupTextBox.cs | 16 ---------------- 2 files changed, 3 insertions(+), 18 deletions(-) delete mode 100644 osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 09797e3180..15723c0eaf 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using System; using static osu.Framework.Graphics.UserInterface.TextBox; @@ -14,7 +15,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly SetupTextBox textBox; + private readonly OsuTextBox textBox; private readonly Container content; private readonly OsuSpriteText label; @@ -172,7 +173,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents Text = LabelText, Font = @"Exo2.0-Bold", }, - textBox = new SetupTextBox + textBox = new OsuTextBox { Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs deleted file mode 100644 index c3938fae9c..0000000000 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/SetupTextBox.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Game.Graphics; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; - -namespace osu.Game.Screens.Edit.Screens.Setup.Components -{ - public class SetupTextBox : OsuTextBox - { - protected override float LeftRightPadding => 15; - } -} From 0e50e4ee346d6e7f1d06e89a7749b72d95cd239c Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 10:10:17 +0300 Subject: [PATCH 161/171] Clean code --- .../LabelledComponents/LabelledTextBox.cs | 82 +++++++++---------- 1 file changed, 38 insertions(+), 44 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 15723c0eaf..5f4e88b52c 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using System; using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents @@ -132,63 +131,58 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { - Masking = true; - CornerRadius = outer_corner_radius; RelativeSizeAxes = Axes.X; base.Height = default_height + Padding.Top; + CornerRadius = outer_corner_radius; + Masking = true; - InternalChildren = new Drawable[] + InternalChild = new Container { - new Container + RelativeSizeAxes = Axes.Both, + CornerRadius = outer_corner_radius, + Masking = true, + Children = new Drawable[] { - RelativeSizeAxes = Axes.Both, - CornerRadius = outer_corner_radius, - Masking = true, - Children = new Drawable[] + new Box { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = OsuColour.FromHex("1c2125"), - }, - new Container + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex("1c2125"), + }, + new Container + { + RelativeSizeAxes = Axes.X, + Height = default_height, + Child = new GridContainer { RelativeSizeAxes = Axes.X, Height = default_height, - Child = new GridContainer + Content = new[] { - RelativeSizeAxes = Axes.X, - Height = default_height, - Content = new[] + new Drawable[] { - new Drawable[] + label = new OsuSpriteText { - label = new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, - Colour = Color4.White, - TextSize = default_label_text_size, - Text = LabelText, - Font = @"Exo2.0-Bold", - }, - textBox = new OsuTextBox - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = default_height, - ReadOnly = ReadOnly, - CornerRadius = inner_corner_radius, - }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, + Colour = Color4.White, + TextSize = default_label_text_size, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.X, + Height = default_height, + CornerRadius = inner_corner_radius, }, }, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, label_container_width), - new Dimension() - } + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() } } } From ab9340f4be8ab5410177a0eb4b611437177a28b4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 11:34:06 +0200 Subject: [PATCH 162/171] Fix usage of culture local ToUpper causing incorrect display on Turkish machines Closes #3098. --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 3 ++- osu.Game/Overlays/Chat/ChannelSection.cs | 3 ++- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 ++- osu.Game/Overlays/Notifications/NotificationSection.cs | 7 ++++--- osu.Game/Overlays/OnScreenDisplay.cs | 5 +++-- osu.Game/Overlays/Settings/SettingsSubsection.cs | 3 ++- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 3 ++- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 ++- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 ++- osu.Game/Screens/Tournament/Drawings.cs | 3 ++- osu.Game/Screens/Tournament/Group.cs | 5 +++-- 11 files changed, 26 insertions(+), 15 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 24e6021421..4e92f49937 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -23,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables if (value == status) return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(); + statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(CultureInfo.InvariantCulture); } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 89d9d2231c..2d0c406ef2 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Globalization; using System.Linq; using OpenTK; using osu.Framework.Graphics; @@ -30,7 +31,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(); } + set { header.Text = value.ToUpper(CultureInfo.InvariantCulture); } } public IEnumerable Channels diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index ce79e70b1c..222c966a2b 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; +using System.Globalization; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -62,7 +63,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(), + Text = "Medal Unlocked".ToUpper(CultureInfo.InvariantCulture), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index c166624d2b..1537c65a1f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -55,7 +56,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(); + if (titleText != null) titleText.Text = title.ToUpper(CultureInfo.InvariantCulture); } } @@ -101,7 +102,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(), + Text = title.ToUpper(CultureInfo.InvariantCulture), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -154,7 +155,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(); } + set { text.Text = value.ToUpper(CultureInfo.InvariantCulture); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 5a5b90ee25..ba5bb9c49e 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -176,9 +177,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(); + textLine1.Text = description.Name.ToUpper(CultureInfo.InvariantCulture); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(); + textLine3.Text = description.Shortcut.ToUpper(CultureInfo.InvariantCulture); if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 82589a99bd..4498828118 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using System.Collections.Generic; +using System.Globalization; using System.Linq; using osu.Framework.Allocation; @@ -51,7 +52,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(), + Text = Header.ToUpper(CultureInfo.InvariantCulture), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, Font = @"Exo2.0-Black", }, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 74ee025823..6fa10977d0 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(), + Text = Judgement.Result.GetDescription().ToUpper(CultureInfo.InvariantCulture), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index 77c9c967b4..fb7f6cd03b 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -28,7 +29,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(), + Text = "current progress".ToUpper(CultureInfo.InvariantCulture), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 1813d02d02..9a17e7708b 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -94,7 +95,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(), + Text = Title.ToUpper(CultureInfo.InvariantCulture), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 49a46b96e3..7bc8217329 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -323,7 +324,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper().StartsWith("GROUP")) + if (line.ToUpper(CultureInfo.InvariantCulture).StartsWith("GROUP")) continue; // ReSharper disable once AccessToModifiedClosure diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index b1bcd6052c..f62c26a62e 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -2,6 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; +using System.Globalization; using System.Linq; using System.Text; using osu.Framework.Allocation; @@ -51,7 +52,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper()}", + Text = $"GROUP {name.ToUpper(CultureInfo.InvariantCulture)}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -161,7 +162,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(), + Text = team.Acronym.ToUpper(CultureInfo.InvariantCulture), TextSize = 10f, Font = @"Exo2.0-Bold" } From b38da34da9df8e8910e293a3a93766b58aab4bf0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 12:11:14 +0200 Subject: [PATCH 163/171] Fix resetting database failing due to incorrect disposal logic --- osu.Game/Database/DatabaseContextFactory.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game/Database/DatabaseContextFactory.cs b/osu.Game/Database/DatabaseContextFactory.cs index c20d4569f6..e70d753114 100644 --- a/osu.Game/Database/DatabaseContextFactory.cs +++ b/osu.Game/Database/DatabaseContextFactory.cs @@ -5,6 +5,7 @@ using System; using System.Linq; using System.Threading; using Microsoft.EntityFrameworkCore.Storage; +using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Platform; namespace osu.Game.Database @@ -115,7 +116,11 @@ namespace osu.Game.Database } } - private void recycleThreadContexts() => threadContexts = new ThreadLocal(CreateContext); + private void recycleThreadContexts() + { + threadContexts?.Values.ForEach(c => c.Dispose()); + threadContexts = new ThreadLocal(CreateContext, true); + } protected virtual OsuDbContext CreateContext() => new OsuDbContext(storage.GetDatabaseConnectionString(database_name)) { @@ -127,8 +132,6 @@ namespace osu.Game.Database lock (writeLock) { recycleThreadContexts(); - GC.Collect(); - GC.WaitForPendingFinalizers(); storage.DeleteDatabase(database_name); } } From 1d86083981b80ee725645ce9b10719c384a9687a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 12:11:20 +0200 Subject: [PATCH 164/171] Hide unnecessary log output --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 63cc883844..bada2a794d 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -224,7 +224,7 @@ namespace osu.Game // todo: we probably want a better (non-destructive) migrations/recovery process at a later point than this. contextFactory.ResetDatabase(); - Logger.Log("Database purged successfully.", LoggingTarget.Database, LogLevel.Important); + Logger.Log("Database purged successfully.", LoggingTarget.Database); // only run once more, then hard bail. using (var db = contextFactory.GetForWrite(false)) From 5364a6148a2b6adcbd77fbde14359cc1d6b9b259 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 24 Jul 2018 14:42:06 +0200 Subject: [PATCH 165/171] Use ToUpperInvariant --- osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs | 3 +-- osu.Game/Overlays/Chat/ChannelSection.cs | 3 +-- osu.Game/Overlays/MedalSplash/DrawableMedal.cs | 3 +-- osu.Game/Overlays/Notifications/NotificationSection.cs | 7 +++---- osu.Game/Overlays/OnScreenDisplay.cs | 5 ++--- osu.Game/Overlays/Settings/SettingsSubsection.cs | 3 +-- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 3 +-- osu.Game/Screens/Play/Break/BreakInfo.cs | 3 +-- .../Screens/Play/PlayerSettings/PlayerSettingsGroup.cs | 3 +-- osu.Game/Screens/Tournament/Drawings.cs | 3 +-- osu.Game/Screens/Tournament/Group.cs | 5 ++--- 11 files changed, 15 insertions(+), 26 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 4e92f49937..c7e97cef55 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -24,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables if (value == status) return; status = value; - statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpper(CultureInfo.InvariantCulture); + statusText.Text = Enum.GetName(typeof(BeatmapSetOnlineStatus), Status)?.ToUpperInvariant(); } } diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index 2d0c406ef2..85fdecaaba 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Globalization; using System.Linq; using OpenTK; using osu.Framework.Graphics; @@ -31,7 +30,7 @@ namespace osu.Game.Overlays.Chat public string Header { get { return header.Text; } - set { header.Text = value.ToUpper(CultureInfo.InvariantCulture); } + set { header.Text = value.ToUpperInvariant(); } } public IEnumerable Channels diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 222c966a2b..a27278e002 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Globalization; using osu.Framework; using OpenTK; using osu.Framework.Allocation; @@ -63,7 +62,7 @@ namespace osu.Game.Overlays.MedalSplash { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "Medal Unlocked".ToUpper(CultureInfo.InvariantCulture), + Text = "Medal Unlocked".ToUpperInvariant(), TextSize = 24, Font = @"Exo2.0-Light", Alpha = 0f, diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 1537c65a1f..f41e3e876f 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Extensions.IEnumerableExtensions; @@ -56,7 +55,7 @@ namespace osu.Game.Overlays.Notifications set { title = value; - if (titleText != null) titleText.Text = title.ToUpper(CultureInfo.InvariantCulture); + if (titleText != null) titleText.Text = title.ToUpperInvariant(); } } @@ -102,7 +101,7 @@ namespace osu.Game.Overlays.Notifications { titleText = new OsuSpriteText { - Text = title.ToUpper(CultureInfo.InvariantCulture), + Text = title.ToUpperInvariant(), Font = @"Exo2.0-Black", }, countText = new OsuSpriteText @@ -155,7 +154,7 @@ namespace osu.Game.Overlays.Notifications public string Text { get { return text.Text; } - set { text.Text = value.ToUpper(CultureInfo.InvariantCulture); } + set { text.Text = value.ToUpperInvariant(); } } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index ba5bb9c49e..041ceab365 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Configuration.Tracking; @@ -177,9 +176,9 @@ namespace osu.Game.Overlays { Schedule(() => { - textLine1.Text = description.Name.ToUpper(CultureInfo.InvariantCulture); + textLine1.Text = description.Name.ToUpperInvariant(); textLine2.Text = description.Value; - textLine3.Text = description.Shortcut.ToUpper(CultureInfo.InvariantCulture); + textLine3.Text = description.Shortcut.ToUpperInvariant(); if (string.IsNullOrEmpty(textLine3.Text)) textLine3.Text = "NO KEY BOUND"; diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 4498828118..9296972749 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using System.Collections.Generic; -using System.Globalization; using System.Linq; using osu.Framework.Allocation; @@ -52,7 +51,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - Text = Header.ToUpper(CultureInfo.InvariantCulture), + Text = Header.ToUpperInvariant(), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, Font = @"Exo2.0-Black", }, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index 6fa10977d0..5de14ae579 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using OpenTK; using osu.Framework.Allocation; using osu.Framework.Extensions; @@ -52,7 +51,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Judgement.Result}", _ => JudgementText = new OsuSpriteText { - Text = Judgement.Result.GetDescription().ToUpper(CultureInfo.InvariantCulture), + Text = Judgement.Result.GetDescription().ToUpperInvariant(), Font = @"Venera", Colour = judgementColour(Judgement.Result), Scale = new Vector2(0.85f, 1), diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index fb7f6cd03b..51d39762d2 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -29,7 +28,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = "current progress".ToUpper(CultureInfo.InvariantCulture), + Text = "current progress".ToUpperInvariant(), TextSize = 15, Font = "Exo2.0-Black", }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 9a17e7708b..c4767f404d 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -1,7 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System.Globalization; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -95,7 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, - Text = Title.ToUpper(CultureInfo.InvariantCulture), + Text = Title.ToUpperInvariant(), TextSize = 17, Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 7bc8217329..63d29d5cd7 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -324,7 +323,7 @@ namespace osu.Game.Screens.Tournament if (string.IsNullOrEmpty(line)) continue; - if (line.ToUpper(CultureInfo.InvariantCulture).StartsWith("GROUP")) + if (line.ToUpperInvariant().StartsWith("GROUP")) continue; // ReSharper disable once AccessToModifiedClosure diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index f62c26a62e..6845d8fc48 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Text; using osu.Framework.Allocation; @@ -52,7 +51,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), - Text = $"GROUP {name.ToUpper(CultureInfo.InvariantCulture)}", + Text = $"GROUP {name.ToUpperInvariant()}", TextSize = 8f, Font = @"Exo2.0-Bold", Colour = new Color4(255, 204, 34, 255), @@ -162,7 +161,7 @@ namespace osu.Game.Screens.Tournament Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Text = team.Acronym.ToUpper(CultureInfo.InvariantCulture), + Text = team.Acronym.ToUpperInvariant(), TextSize = 10f, Font = @"Exo2.0-Bold" } From 3ca112aef0779c29fd7eaeca0dd9d9d24656e661 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 22:04:02 +0300 Subject: [PATCH 166/171] Clean code and apply requested changes --- .../LabelledComponents/LabelledTextBox.cs | 124 ++++++------------ 1 file changed, 39 insertions(+), 85 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 5f4e88b52c..9f364c6cf4 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -27,82 +27,41 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_text_size = 16; public event OnCommitHandler OnCommit; - - private bool readOnly; + public bool ReadOnly { - get => readOnly; - set - { - textBox.ReadOnly = value; - readOnly = value; - } + get => textBox.ReadOnly; + set => textBox.ReadOnly = value; } - - private string labelText; + public string LabelText { - get => labelText; - set - { - labelText = value; - label.Text = value; - } + get => label.Text; + set => label.Text = value; } - - private float labelTextSize; + public float LabelTextSize { - get => labelTextSize; - set - { - labelTextSize = value; - label.TextSize = value; - } + get => label.TextSize; + set => label.TextSize = value; } - - private string placeholderText; + public string PlaceholderText { - get => placeholderText; - set - { - placeholderText = value; - textBox.PlaceholderText = value; - } + get => textBox.PlaceholderText; + set => textBox.PlaceholderText = value; } - private string text; public string Text { - get => text; - set - { - text = value; - textBox.Text = value; - } - } - - private float height = default_height; - public float Height - { - get => height; - private set - { - height = value; - textBox.Height = value; - content.Height = value; - } + get => textBox.Text; + set => textBox.Text = value; } public MarginPadding Padding { get => base.Padding; - set - { - base.Padding = value; - base.Height = Height + base.Padding.Top; - } + set => base.Padding = value; } public MarginPadding LabelPadding @@ -132,7 +91,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public LabelledTextBox() { RelativeSizeAxes = Axes.X; - base.Height = default_height + Padding.Top; + Height = default_height; CornerRadius = outer_corner_radius; Masking = true; @@ -148,42 +107,37 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex("1c2125"), }, - new Container + new GridContainer { RelativeSizeAxes = Axes.X, Height = default_height, - Child = new GridContainer + Content = new[] { - RelativeSizeAxes = Axes.X, - Height = default_height, - Content = new[] + new Drawable[] { - new Drawable[] + label = new OsuSpriteText { - label = new OsuSpriteText - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, - Colour = Color4.White, - TextSize = default_label_text_size, - Font = @"Exo2.0-Bold", - }, - textBox = new OsuTextBox - { - Anchor = Anchor.TopLeft, - Origin = Anchor.TopLeft, - RelativeSizeAxes = Axes.X, - Height = default_height, - CornerRadius = inner_corner_radius, - }, + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, + Colour = Color4.White, + TextSize = default_label_text_size, + Font = @"Exo2.0-Bold", + }, + textBox = new OsuTextBox + { + Anchor = Anchor.TopLeft, + Origin = Anchor.TopLeft, + RelativeSizeAxes = Axes.Both, + Height = 1, + CornerRadius = inner_corner_radius, }, }, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, label_container_width), - new Dimension() - } + }, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, label_container_width), + new Dimension() } } } From 6675c455f3d6761343b969849db8d92d376238c5 Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Tue, 24 Jul 2018 22:33:19 +0300 Subject: [PATCH 167/171] Trim whitespace that magically appeared --- .../Components/LabelledComponents/LabelledTextBox.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 9f364c6cf4..fbfb771c8a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -27,25 +27,25 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_text_size = 16; public event OnCommitHandler OnCommit; - + public bool ReadOnly { get => textBox.ReadOnly; set => textBox.ReadOnly = value; } - + public string LabelText { get => label.Text; set => label.Text = value; } - + public float LabelTextSize { get => label.TextSize; set => label.TextSize = value; } - + public string PlaceholderText { get => textBox.PlaceholderText; From da8fc0ee5dd169946155aa4150bf34354c14255e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 25 Jul 2018 07:37:05 +0200 Subject: [PATCH 168/171] ToLower -> ToLowerInvariant --- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 4 ++-- osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/Online/API/Requests/GetUserScoresRequest.cs | 2 +- osu.Game/Online/API/Requests/PostMessageRequest.cs | 2 +- osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs | 2 +- osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs | 4 ++-- osu.Game/Screens/Multi/Header.cs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index 64ed08373a..fdc8f362f7 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLower()}") + Child = new NoteContainer(direction, $"note, scrolling {direction.ToString().ToLowerInvariant()}") { Child = new DrawableNote(note) { AccentColour = Color4.OrangeRed } } @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Tests return new ScrollingTestContainer(direction) { AutoSizeAxes = Axes.Both, - Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLower()}") + Child = new NoteContainer(direction, $"hold note, scrolling {direction.ToString().ToLowerInvariant()}") { Child = new DrawableHoldNote(note) { diff --git a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs index 52d9f31814..26f28c86ca 100644 --- a/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyBeatmapDecoder.cs @@ -312,7 +312,7 @@ namespace osu.Game.Beatmaps.Formats omitFirstBarSignature = effectFlags.HasFlag(EffectFlags.OmitFirstBarLine); } - string stringSampleSet = sampleSet.ToString().ToLower(); + string stringSampleSet = sampleSet.ToString().ToLowerInvariant(); if (stringSampleSet == @"none") stringSampleSet = @"normal"; diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index 90580c50df..7b3337cb23 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -134,7 +134,7 @@ namespace osu.Game.Graphics private string getFileName() { var dt = DateTime.Now; - var fileExt = screenshotFormat.ToString().ToLower(); + var fileExt = screenshotFormat.ToString().ToLowerInvariant(); var withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}"; if (!storage.Exists(withoutIndex)) diff --git a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs index ea14135a61..4d4aa4d957 100644 --- a/osu.Game/Online/API/Requests/GetUserScoresRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserScoresRequest.cs @@ -20,7 +20,7 @@ namespace osu.Game.Online.API.Requests } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLower()}?offset={offset}"; + protected override string Target => $@"users/{userId}/scores/{type.ToString().ToLowerInvariant()}?offset={offset}"; } public enum ScoreType diff --git a/osu.Game/Online/API/Requests/PostMessageRequest.cs b/osu.Game/Online/API/Requests/PostMessageRequest.cs index 44429bdcd5..e0a9fb83b2 100644 --- a/osu.Game/Online/API/Requests/PostMessageRequest.cs +++ b/osu.Game/Online/API/Requests/PostMessageRequest.cs @@ -23,7 +23,7 @@ namespace osu.Game.Online.API.Requests req.Method = HttpMethod.POST; req.AddParameter(@"target_type", message.TargetType.GetDescription()); req.AddParameter(@"target_id", message.TargetId.ToString()); - req.AddParameter(@"is_action", message.IsAction.ToString().ToLower()); + req.AddParameter(@"is_action", message.IsAction.ToString().ToLowerInvariant()); req.AddParameter(@"message", message.Content); return req; diff --git a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs index 2a154d1230..3c808d1bee 100644 --- a/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs +++ b/osu.Game/Online/API/Requests/SearchBeatmapSetsRequest.cs @@ -29,7 +29,7 @@ namespace osu.Game.Online.API.Requests } // ReSharper disable once ImpureMethodCallOnReadonlyValueField - protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLower()}_{directionString}"; + protected override string Target => $@"beatmapsets/search?q={query}&m={ruleset.ID ?? 0}&s={(int)searchCategory}&sort={sortCriteria.ToString().ToLowerInvariant()}_{directionString}"; } public enum BeatmapSearchCategory diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs index 0ac8e585f8..c48060bfa9 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectParser.cs @@ -197,10 +197,10 @@ namespace osu.Game.Rulesets.Objects.Legacy var bank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[0]); var addbank = (LegacyBeatmapDecoder.LegacySampleBank)int.Parse(split[1]); - string stringBank = bank.ToString().ToLower(); + string stringBank = bank.ToString().ToLowerInvariant(); if (stringBank == @"none") stringBank = null; - string stringAddBank = addbank.ToString().ToLower(); + string stringAddBank = addbank.ToString().ToLowerInvariant(); if (stringAddBank == @"none") stringAddBank = null; diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 46610a36d8..809fc25083 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += s => screenType.Text = ((MultiplayerScreen)s).Type.ToLower(); + breadcrumbs.Current.ValueChanged += s => screenType.Text = ((MultiplayerScreen)s).Type.ToLowerInvariant(); breadcrumbs.Current.TriggerChange(); } From b60e4b0728cc24a0067d673c6552f12de6e331e9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 25 Jul 2018 18:34:47 +0900 Subject: [PATCH 169/171] Cleanup --- .../Components/LabelledComponents/LabelledTextBox.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index fbfb771c8a..4c8e90400a 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -5,19 +5,15 @@ using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using static osu.Framework.Graphics.UserInterface.TextBox; namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { public class LabelledTextBox : CompositeDrawable { - private readonly OsuTextBox textBox; - private readonly Container content; - private readonly OsuSpriteText label; - private const float label_container_width = 150; private const float outer_corner_radius = 15; private const float inner_corner_radius = 10; @@ -26,7 +22,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents private const float default_label_top_padding = 12; private const float default_label_text_size = 16; - public event OnCommitHandler OnCommit; + public event TextBox.OnCommitHandler OnCommit; public bool ReadOnly { @@ -88,6 +84,10 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents set => content.Colour = value; } + private readonly OsuTextBox textBox; + private readonly Container content; + private readonly OsuSpriteText label; + public LabelledTextBox() { RelativeSizeAxes = Axes.X; From 206e3686f2dc2fd98273892f6d5faeee4dfad304 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 25 Jul 2018 18:38:50 +0900 Subject: [PATCH 170/171] Add back blue border --- .../Setup/Components/LabelledComponents/LabelledTextBox.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 4c8e90400a..736d785b41 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -1,6 +1,7 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using osu.Framework.Allocation; using OpenTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -145,5 +146,11 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents textBox.OnCommit += OnCommit; } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + textBox.BorderColour = colours.Blue; + } } } From c4b1ba2979ede6c0b00c29c6912801ad6e4d0adf Mon Sep 17 00:00:00 2001 From: AlFasGD Date: Wed, 25 Jul 2018 15:14:40 +0300 Subject: [PATCH 171/171] Remove padding, fix corner radiuses --- .../Visual/TestCaseLabelledTextBox.cs | 10 ++++--- .../LabelledComponents/LabelledTextBox.cs | 27 +++---------------- 2 files changed, 11 insertions(+), 26 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs index be11562bb0..d41739bfb5 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents; using System; using System.Collections.Generic; @@ -21,15 +22,18 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Children = new Drawable[] + Child = new Container { - new LabelledTextBox + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.X, + Padding = new MarginPadding { Left = 150, Right = 150 }, + Child = new LabelledTextBox { Anchor = Anchor.Centre, Origin = Anchor.Centre, LabelText = "Testing text", PlaceholderText = "This is definitely working as intended", - Padding = new MarginPadding { Left = 150, Right = 150 } } }; } diff --git a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs index 736d785b41..94200b7f4e 100644 --- a/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Screens/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -16,8 +16,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents public class LabelledTextBox : CompositeDrawable { private const float label_container_width = 150; - private const float outer_corner_radius = 15; - private const float inner_corner_radius = 10; + private const float corner_radius = 15; private const float default_height = 40; private const float default_label_left_padding = 15; private const float default_label_top_padding = 12; @@ -55,24 +54,6 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents set => textBox.Text = value; } - public MarginPadding Padding - { - get => base.Padding; - set => base.Padding = value; - } - - public MarginPadding LabelPadding - { - get => label.Padding; - set => label.Padding = value; - } - - public MarginPadding TextBoxPadding - { - get => textBox.Padding; - set => textBox.Padding = value; - } - public Color4 LabelTextColour { get => label.Colour; @@ -93,13 +74,13 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents { RelativeSizeAxes = Axes.X; Height = default_height; - CornerRadius = outer_corner_radius; + CornerRadius = corner_radius; Masking = true; InternalChild = new Container { RelativeSizeAxes = Axes.Both, - CornerRadius = outer_corner_radius, + CornerRadius = corner_radius, Masking = true, Children = new Drawable[] { @@ -131,7 +112,7 @@ namespace osu.Game.Screens.Edit.Screens.Setup.Components.LabelledComponents Origin = Anchor.TopLeft, RelativeSizeAxes = Axes.Both, Height = 1, - CornerRadius = inner_corner_radius, + CornerRadius = corner_radius, }, }, },