1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 05:22:54 +08:00

Apply brace style.

This commit is contained in:
Huo Yaoyuan 2019-11-11 19:53:22 +08:00
parent 3d1c31f2ae
commit ccc8aa6fa4
58 changed files with 214 additions and 52 deletions

View File

@ -40,8 +40,10 @@ namespace osu.Game.Rulesets.Catch.Tests
beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, });
for (int i = 0; i < 512; i++)
{
if (i % 5 < 3)
beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 });
}
return beatmap;
}

View File

@ -196,9 +196,13 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
if (currentObject is Fruit)
objectWithDroplets.Add(currentObject);
if (currentObject is JuiceStream)
{
foreach (var currentJuiceElement in currentObject.NestedHitObjects)
{
if (!(currentJuiceElement is TinyDroplet))
objectWithDroplets.Add((CatchHitObject)currentJuiceElement);
}
}
}
objectWithDroplets.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));

View File

@ -27,11 +27,13 @@ namespace osu.Game.Rulesets.Catch.Objects
return;
for (double i = StartTime; i <= EndTime; i += spacing)
{
AddNested(new Banana
{
Samples = Samples,
StartTime = i
});
}
}
public double EndTime => StartTime + Duration;

View File

@ -109,8 +109,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
// 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;
}
@ -132,8 +134,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
{
// 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;
}

View File

@ -24,12 +24,14 @@ namespace osu.Game.Rulesets.Osu.Tests
public TestSceneDrawableJudgement()
{
foreach (HitResult result in Enum.GetValues(typeof(HitResult)).OfType<HitResult>().Skip(1))
{
AddStep("Show " + result.GetDescription(), () => SetContents(() =>
new DrawableOsuJudgement(new JudgementResult(new HitObject(), new Judgement()) { Type = result }, null)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}));
}
}
}
}

View File

@ -29,8 +29,10 @@ namespace osu.Game.Rulesets.Osu.Tests
};
for (int i = 0; i < 512; i++)
{
if (i % 32 < 20)
beatmap.HitObjects.Add(new HitCircle { Position = new Vector2(256, 192), StartTime = i * 100 });
}
return beatmap;
}

View File

@ -55,8 +55,10 @@ namespace osu.Game.Rulesets.Osu.Mods
}
for (int i = 0; i < amountWiggles; i++)
{
using (drawable.BeginAbsoluteSequence(osuObject.StartTime - osuObject.TimePreempt + i * wiggle_duration, true))
wiggle();
}
// Keep wiggling sliders and spinners for their duration
if (!(osuObject is IHasEndTime endTime))
@ -65,8 +67,10 @@ namespace osu.Game.Rulesets.Osu.Mods
amountWiggles = (int)(endTime.Duration / wiggle_duration);
for (int i = 0; i < amountWiggles; i++)
{
using (drawable.BeginAbsoluteSequence(osuObject.StartTime + i * wiggle_duration, true))
wiggle();
}
}
}
}

View File

@ -133,12 +133,14 @@ namespace osu.Game.Rulesets.Osu.Objects
var sampleList = new List<HitSampleInfo>();
if (firstSample != null)
{
sampleList.Add(new HitSampleInfo
{
Bank = firstSample.Bank,
Volume = firstSample.Volume,
Name = @"slidertick",
});
}
switch (e.Type)
{

View File

@ -225,8 +225,10 @@ namespace osu.Game.Tests.NonVisual
private void fastForwardToPoint(double destination)
{
for (int i = 0; i < 1000; i++)
{
if (handler.SetFrameFromTime(destination) == null)
return;
}
throw new TimeoutException("Seek was never fulfilled");
}

View File

@ -26,6 +26,7 @@ namespace osu.Game.Tests.Skins
List<Color4> expectedColors;
if (hasColours)
{
expectedColors = new List<Color4>
{
new Color4(142, 199, 255, 255),
@ -33,6 +34,7 @@ namespace osu.Game.Tests.Skins
new Color4(128, 255, 255, 255),
new Color4(100, 100, 100, 100),
};
}
else
expectedColors = new DefaultSkin().Configuration.ComboColours;

View File

@ -130,12 +130,14 @@ namespace osu.Game.Tests.Visual.Online
AddRepeatStep("add many messages", () =>
{
for (int i = 0; i < messages_per_call; i++)
{
testChannel.AddNewMessages(new Message(sequence++)
{
Sender = longUsernameUser,
Content = "Many messages! " + Guid.NewGuid(),
Timestamp = DateTimeOffset.Now
});
}
}, Channel.MAX_HISTORY / messages_per_call + 5);
AddAssert("Ensure no adjacent day separators", () =>
@ -143,8 +145,10 @@ namespace osu.Game.Tests.Visual.Online
var indices = chatDisplay.FillFlow.OfType<DrawableChannel.DaySeparator>().Select(ds => chatDisplay.FillFlow.IndexOf(ds));
foreach (var i in indices)
{
if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DrawableChannel.DaySeparator)
return false;
}
return true;
});

View File

@ -467,8 +467,10 @@ namespace osu.Game.Tests.Visual.SongSelect
private void advanceSelection(bool diff, int direction = 1, int count = 1)
{
if (count == 1)
{
AddStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
carousel.SelectNext(direction, !diff));
}
else
{
AddRepeatStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>

View File

@ -132,11 +132,13 @@ namespace osu.Game.Tests.Visual.SongSelect
changeRuleset(1);
if (rulesetsInSameBeatmap)
{
AddStep("import multi-ruleset map", () =>
{
var usableRulesets = rulesets.AvailableRulesets.Where(r => r.ID != 2).ToArray();
manager.Import(createTestBeatmapSet(0, usableRulesets)).Wait();
});
}
else
{
addRulesetImportStep(1);

View File

@ -109,16 +109,20 @@ namespace osu.Game.Tests.Visual
AddAssert("check OsuGame DI members", () =>
{
foreach (var type in requiredGameDependencies)
{
if (game.Dependencies.Get(type) == null)
throw new Exception($"{type} has not been cached");
}
return true;
});
AddAssert("check OsuGameBase DI members", () =>
{
foreach (var type in requiredGameBaseDependencies)
{
if (gameBase.Dependencies.Get(type) == null)
throw new Exception($"{type} has not been cached");
}
return true;
});

View File

@ -103,20 +103,20 @@ namespace osu.Game.Tournament.Tests.Components
}));
AddStep("multiple messages", () => testChannel.AddNewMessages(new Message(nextMessageId())
{
Sender = admin,
Content = "I spam you!"
},
new Message(nextMessageId())
{
Sender = admin,
Content = "I spam you!!!1"
},
new Message(nextMessageId())
{
Sender = admin,
Content = "I spam you!1!1"
}));
{
Sender = admin,
Content = "I spam you!"
},
new Message(nextMessageId())
{
Sender = admin,
Content = "I spam you!!!1"
},
new Message(nextMessageId())
{
Sender = admin,
Content = "I spam you!1!1"
}));
AddStep("change channel to 2", () => chatDisplay.Channel.Value = testChannel2);

View File

@ -131,6 +131,7 @@ namespace osu.Game.Tournament.Components
});
if (!string.IsNullOrEmpty(mods))
{
AddInternal(new Sprite
{
Texture = textures.Get($"mods/{mods}"),
@ -139,6 +140,7 @@ namespace osu.Game.Tournament.Components
Margin = new MarginPadding(20),
Scale = new Vector2(0.5f)
});
}
}
private void matchChanged(ValueChangedEvent<TournamentMatch> match)

View File

@ -29,12 +29,14 @@ namespace osu.Game.Tournament.Components
};
}
else
{
InternalChild = video = new VideoSprite(stream)
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Clock = new FramedClock(manualClock = new ManualClock())
};
}
}
public bool Loop

View File

@ -60,6 +60,7 @@ namespace osu.Game.Tournament.IPC
const string file_ipc_channel_filename = "ipc-channel.txt";
if (Storage.Exists(file_ipc_filename))
{
scheduled = Scheduler.AddDelayed(delegate
{
try
@ -134,6 +135,7 @@ namespace osu.Game.Tournament.IPC
// file might be in use.
}
}, 250, true);
}
}
catch (Exception e)
{

View File

@ -266,12 +266,14 @@ namespace osu.Game.Tournament.Screens.Editors
drawableContainer.Clear();
if (Model.BeatmapInfo != null)
{
drawableContainer.Child = new TournamentBeatmapPanel(Model.BeatmapInfo, Model.Mods)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Width = 300
};
}
}
}
}

View File

@ -81,8 +81,10 @@ namespace osu.Game.Tournament.Screens.Ladder
LadderInfo.Matches.ItemsRemoved += matches =>
{
foreach (var p in matches)
foreach (var d in MatchesContainer.Where(d => d.Match == p))
d.Expire();
{
foreach (var d in MatchesContainer.Where(d => d.Match == p))
d.Expire();
}
layout.Invalidate();
};

View File

@ -164,6 +164,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
if (team != null)
{
foreach (var p in team.Players)
{
players.Add(new OsuSpriteText
{
Text = p.Username,
@ -172,6 +173,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
});
}
}
}

View File

@ -164,15 +164,17 @@ namespace osu.Game.Tournament
// link matches to rounds
foreach (var round in ladder.Rounds)
foreach (var id in round.Matches)
{
var found = ladder.Matches.FirstOrDefault(p => p.ID == id);
if (found != null)
foreach (var id in round.Matches)
{
found.Round.Value = round;
if (round.StartDate.Value > found.Date.Value)
found.Date.Value = round.StartDate.Value;
var found = ladder.Matches.FirstOrDefault(p => p.ID == id);
if (found != null)
{
found.Round.Value = round;
if (round.StartDate.Value > found.Date.Value)
found.Date.Value = round.StartDate.Value;
}
}
}
@ -192,15 +194,19 @@ namespace osu.Game.Tournament
bool addedInfo = false;
foreach (var t in ladder.Teams)
foreach (var p in t.Players)
if (string.IsNullOrEmpty(p.Username))
{
foreach (var p in t.Players)
{
var req = new GetUserRequest(p.Id);
req.Perform(API);
p.Username = req.Result.Username;
if (string.IsNullOrEmpty(p.Username))
{
var req = new GetUserRequest(p.Id);
req.Perform(API);
p.Username = req.Result.Username;
addedInfo = true;
addedInfo = true;
}
}
}
return addedInfo;
}
@ -213,15 +219,19 @@ namespace osu.Game.Tournament
bool addedInfo = false;
foreach (var r in ladder.Rounds)
foreach (var b in r.Beatmaps)
if (b.BeatmapInfo == null && b.ID > 0)
{
foreach (var b in r.Beatmaps)
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
req.Perform(API);
b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore);
if (b.BeatmapInfo == null && b.ID > 0)
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
req.Perform(API);
b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore);
addedInfo = true;
addedInfo = true;
}
}
}
return addedInfo;
}

View File

@ -144,16 +144,16 @@ namespace osu.Game.Beatmaps.Formats
var endTime = split.Length > 3 ? double.Parse(split[3], CultureInfo.InvariantCulture) : double.MaxValue;
var groupNumber = split.Length > 4 ? int.Parse(split[4]) : 0;
timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber);
}
break;
}
case "L":
{
var startTime = double.Parse(split[1], CultureInfo.InvariantCulture);
var loopCount = int.Parse(split[2]);
timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount);
}
break;
}
default:
{
@ -172,7 +172,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue);
}
break;
break;
case "S":
{
@ -180,7 +180,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Scale.Add(easing, startTime, endTime, new Vector2(startValue), new Vector2(endValue));
}
break;
break;
case "V":
{
@ -190,7 +190,7 @@ namespace osu.Game.Beatmaps.Formats
var endY = split.Length > 7 ? float.Parse(split[7], CultureInfo.InvariantCulture) : startY;
timelineGroup?.Scale.Add(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY));
}
break;
break;
case "R":
{
@ -198,7 +198,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Rotation.Add(easing, startTime, endTime, MathHelper.RadiansToDegrees(startValue), MathHelper.RadiansToDegrees(endValue));
}
break;
break;
case "M":
{
@ -209,7 +209,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup?.X.Add(easing, startTime, endTime, startX, endX);
timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY);
}
break;
break;
case "MX":
{
@ -217,7 +217,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue);
}
break;
break;
case "MY":
{
@ -225,7 +225,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue);
}
break;
break;
case "C":
{
@ -239,7 +239,7 @@ namespace osu.Game.Beatmaps.Formats
new Color4(startRed / 255f, startGreen / 255f, startBlue / 255f, 1),
new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1));
}
break;
break;
case "P":
{
@ -260,13 +260,13 @@ namespace osu.Game.Beatmaps.Formats
break;
}
}
break;
break;
default:
throw new InvalidDataException($@"Unknown command type: {commandType}");
}
}
break;
break;
}
}
}

View File

@ -133,8 +133,10 @@ namespace osu.Game.Beatmaps
obj.ApplyDefaults(converted.ControlPointInfo, converted.BeatmapInfo.BaseDifficulty);
foreach (var mod in mods.OfType<IApplicableToHitObject>())
foreach (var obj in converted.HitObjects)
mod.ApplyToHitObject(obj);
{
foreach (var obj in converted.HitObjects)
mod.ApplyToHitObject(obj);
}
processor?.PostProcess();

View File

@ -265,8 +265,10 @@ namespace osu.Game.Database
// for now, concatenate all .osu files in the set to create a unique hash.
MemoryStream hashable = new MemoryStream();
foreach (string file in reader.Filenames.Where(f => HashableFileTypes.Any(f.EndsWith)))
{
using (Stream s = reader.GetStream(file))
s.CopyTo(hashable);
}
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null;
}
@ -485,12 +487,16 @@ namespace osu.Game.Database
// import files to manager
foreach (string file in reader.Filenames)
{
using (Stream s = reader.GetStream(file))
{
fileInfos.Add(new TFileModel
{
Filename = FileSafety.PathStandardise(file.Substring(prefix.Length)),
FileInfo = files.Add(s)
});
}
}
return fileInfos;
}
@ -651,8 +657,10 @@ namespace osu.Game.Database
private void handleEvent(Action a)
{
if (delayingEvents)
{
lock (queuedEvents)
queuedEvents.Add(a);
}
else
a.Invoke();
}

View File

@ -43,9 +43,11 @@ namespace osu.Game.Graphics.Containers
// if we don't have enough time for the second shake, skip it.
if (!maximumLength.HasValue || maximumLength >= ShakeDuration * 4)
{
sequence = sequence
.MoveToX(shake_amount, ShakeDuration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then();
}
sequence.MoveToX(0, ShakeDuration / 2, Easing.InSine);
}

View File

@ -51,8 +51,10 @@ namespace osu.Game.Graphics.UserInterface
});
if (isEnumType && AddEnumEntriesAutomatically)
{
foreach (var val in (T[])Enum.GetValues(typeof(T)))
AddItem(val);
}
}
[BackgroundDependencyLoader]

View File

@ -44,8 +44,10 @@ namespace osu.Game.Graphics.UserInterface
{
string format = new string('0', (int)LeadingZeroes);
if (UseCommaSeparator)
{
for (int i = format.Length - 3; i > 0; i -= 3)
format = format.Insert(i, @",");
}
return ((long)count).ToString(format);
}

View File

@ -47,6 +47,7 @@ namespace osu.Game.Input
foreach (var insertable in group.Skip(count).Take(aimCount - count))
// insert any defaults which are missing.
{
usage.Context.DatabasedKeyBinding.Add(new DatabasedKeyBinding
{
KeyCombination = insertable.KeyCombination,
@ -54,6 +55,7 @@ namespace osu.Game.Input
RulesetID = rulesetId,
Variant = variant
});
}
}
}
}

View File

@ -75,8 +75,10 @@ namespace osu.Game.Online.Leaderboards
int i = 0;
foreach (var s in scrollFlow.Children)
{
using (s.BeginDelayedSequence(i++ * 50, true))
s.Show();
}
scrollContainer.ScrollTo(0f, false);
}, (showScoresCancellationSource = new CancellationTokenSource()).Token));
@ -342,13 +344,17 @@ namespace osu.Game.Online.Leaderboards
else
{
if (bottomY - fadeBottom > 0 && FadeBottom)
{
c.Colour = ColourInfo.GradientVertical(
Color4.White.Opacity(Math.Min(1 - (topY - fadeBottom) / LeaderboardScore.HEIGHT, 1)),
Color4.White.Opacity(Math.Min(1 - (bottomY - fadeBottom) / LeaderboardScore.HEIGHT, 1)));
}
else if (FadeTop)
{
c.Colour = ColourInfo.GradientVertical(
Color4.White.Opacity(Math.Min(1 - (fadeTop - topY) / LeaderboardScore.HEIGHT, 1)),
Color4.White.Opacity(Math.Min(1 - (fadeTop - bottomY) / LeaderboardScore.HEIGHT, 1)));
}
}
}
}

View File

@ -402,8 +402,10 @@ namespace osu.Game
nextBeatmap.Track.Completed += currentTrackCompleted;
using (var oldBeatmap = beatmap.OldValue)
{
if (oldBeatmap?.Track != null)
oldBeatmap.Track.Completed -= currentTrackCompleted;
}
nextBeatmap?.LoadBeatmapAsync();
}

View File

@ -292,8 +292,10 @@ namespace osu.Game
var extension = Path.GetExtension(paths.First())?.ToLowerInvariant();
foreach (var importer in fileImporters)
{
if (importer.HandledExtensions.Contains(extension))
await importer.Import(paths);
}
}
public string[] HandledExtensions => fileImporters.SelectMany(i => i.HandledExtensions).ToArray();

View File

@ -130,6 +130,7 @@ namespace osu.Game.Overlays.Changelog
});
if (entry.GithubUser.UserId != null)
{
title.AddUserLink(new User
{
Username = entry.GithubUser.OsuUsername,
@ -139,18 +140,23 @@ namespace osu.Game.Overlays.Changelog
t.Font = fontMedium;
t.Colour = entryColour;
});
}
else if (entry.GithubUser.GithubUrl != null)
{
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
{
t.Font = fontMedium;
t.Colour = entryColour;
});
}
else
{
title.AddText(entry.GithubUser.DisplayName, t =>
{
t.Font = fontSmall;
t.Colour = entryColour;
});
}
ChangelogEntries.Add(titleContainer);

View File

@ -68,11 +68,13 @@ namespace osu.Game.Overlays.Changelog
}
if (build != null)
{
Children = new Drawable[]
{
new ChangelogBuildWithNavigation(build) { SelectBuild = SelectBuild },
new Comments(build)
};
}
}
public class ChangelogBuildWithNavigation : ChangelogBuild

View File

@ -162,10 +162,12 @@ namespace osu.Game.Overlays.Comments
foreach (var c in response.Comments)
{
if (c.IsTopLevel)
{
page.Add(new DrawableComment(c)
{
ShowDeleted = { BindTarget = ShowDeleted }
});
}
}
LoadComponentAsync(page, loaded =>

View File

@ -149,8 +149,10 @@ namespace osu.Game.Overlays.Direct
icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset)), ruleset, this is DirectListPanel ? Color4.White : colours.Gray5));
}
else
{
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty))
icons.Add(new DifficultyIcon(b));
}
return icons;
}

View File

@ -194,8 +194,10 @@ namespace osu.Game.Overlays.Mods
start = Mods.Length - 1;
for (int i = start; i < Mods.Length && i >= 0; i += direction)
{
if (SelectAt(i))
return;
}
Deselect();
}

View File

@ -112,6 +112,7 @@ namespace osu.Game.Overlays.Mods
if (selected == null) continue;
foreach (var type in modTypes)
{
if (type.IsInstanceOfType(selected))
{
if (immediate)
@ -119,6 +120,7 @@ namespace osu.Game.Overlays.Mods
else
Scheduler.AddDelayed(button.Deselect, delay += 50);
}
}
}
}

View File

@ -81,8 +81,10 @@ namespace osu.Game.Rulesets.Difficulty.Utils
yield return array[i];
if (Count == capacity)
{
for (int i = 0; i < marker; ++i)
yield return array[i];
}
}
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

View File

@ -113,8 +113,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (samples.Length > 0)
{
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}.");
}
samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray();
foreach (var s in samples)

View File

@ -75,8 +75,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
int pointCount = 1;
foreach (var t in pointSplit)
{
if (t.Length > 1)
pointCount++;
}
var points = new Vector2[pointCount];

View File

@ -185,8 +185,10 @@ namespace osu.Game.Rulesets.Objects
ReadOnlySpan<Vector2> cpSpan = ControlPoints.Slice(start, end - start);
foreach (Vector2 t in calculateSubpath(cpSpan))
{
if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
calculatedPath.Add(t);
}
start = end;
}

View File

@ -69,8 +69,10 @@ namespace osu.Game.Rulesets
//add any other modes
foreach (var r in instances.Where(r => r.LegacyID == null))
{
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo == r.RulesetInfo.InstantiationInfo) == null)
context.RulesetInfo.Add(r.RulesetInfo);
}
context.SaveChanges();

View File

@ -436,8 +436,10 @@ namespace osu.Game.Rulesets.UI
return h.HitWindows;
foreach (var n in h.NestedHitObjects)
{
if (h.HitWindows.WindowFor(HitResult.Miss) > 0)
return n.HitWindows;
}
}
return null;

View File

@ -130,9 +130,13 @@ namespace osu.Game.Rulesets.UI
base.Update();
if (beatmap != null)
{
foreach (var mod in mods)
{
if (mod is IUpdatableByPlayfield updatable)
updatable.Update(this);
}
}
}
/// <summary>

View File

@ -57,11 +57,13 @@ namespace osu.Game.Screens.Multi.Components
var beatmap = CurrentItem.Value?.Beatmap;
if (beatmap == null)
{
textFlow.AddText("No beatmap selected", s =>
{
s.Font = s.Font.With(size: TextSize);
s.Colour = colours.PinkLight;
});
}
else
{
textFlow.AddLink(new[]

View File

@ -100,9 +100,11 @@ namespace osu.Game.Screens.Play.HUD
if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered)
Alpha = 1;
else
{
Alpha = Interpolation.ValueAt(
MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 200),
Alpha, MathHelper.Clamp(1 - positionalAdjust, 0.04f, 1), 0, 200, Easing.OutQuint);
}
}
private class Button : HoldToConfirmContainer, IKeyBindingHandler<GlobalAction>

View File

@ -181,8 +181,11 @@ namespace osu.Game.Screens.Play
this.FadeIn(500, Easing.OutExpo);
if (!IsHovered && !IsDragged)
{
using (BeginDelayedSequence(1000))
scheduledHide = Schedule(Hide);
}
break;
case Visibility.Hidden:

View File

@ -44,10 +44,14 @@ namespace osu.Game.Screens.Select.Carousel
criteria.Artist.Matches(Beatmap.Metadata.ArtistUnicode);
if (match)
{
foreach (var criteriaTerm in criteria.SearchTerms)
{
match &=
Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0) ||
Beatmap.Version.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0;
}
}
Filtered.Value = !match;
}

View File

@ -251,11 +251,13 @@ namespace osu.Game.Screens.Select
{
// if we have no beatmaps but osu-stable is found, let's prompt the user to import.
if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
{
dialogOverlay.Push(new ImportFromStablePopup(() =>
{
Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
Task.Run(skins.ImportFromStableAsync);
}));
}
});
}
}
@ -333,11 +335,13 @@ namespace osu.Game.Screens.Select
if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(e.NewValue?.BeatmapInfo, false))
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch
{
if (e.NewValue?.BeatmapInfo?.Ruleset != null && !e.NewValue.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value))
{
Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset;
Carousel.SelectBeatmap(e.NewValue.BeatmapInfo);
}
}
}
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.

View File

@ -36,8 +36,10 @@ namespace osu.Game.Skinning
{
Stream stream = storage?.GetStream(filename);
if (stream != null)
{
using (LineBufferedReader reader = new LineBufferedReader(stream))
Configuration = new LegacySkinDecoder().Decode(reader);
}
else
Configuration = new DefaultSkinConfiguration();

View File

@ -22,17 +22,19 @@ namespace osu.Game.Skinning
if (animatable)
{
for (int i = 0;; i++)
for (int i = 0; true; i++)
{
if ((texture = getFrameTexture(i)) == null)
break;
if (animation == null)
{
animation = new TextureAnimation
{
DefaultFrameLength = default_frame_time,
Repeat = looping
};
}
animation.AddFrame(texture);
}
@ -42,10 +44,12 @@ namespace osu.Game.Skinning
return animation;
if ((texture = source.GetTexture(componentName)) != null)
{
return new Sprite
{
Texture = texture
};
}
return null;
}

View File

@ -81,9 +81,13 @@ namespace osu.Game.Skinning
var ch = skin.GetSample(s);
if (ch == null && allowFallback)
{
foreach (var lookup in s.LookupNames)
{
if ((ch = samples.Get($"Gameplay/{lookup}")) != null)
break;
}
}
if (ch != null)
{
@ -91,8 +95,10 @@ namespace osu.Game.Skinning
ch.Volume.Value = s.Volume / 100.0;
if (adjustments != null)
{
foreach (var adjustment in adjustments)
ch.AddAdjustment(adjustment.property, adjustment.bindable);
}
}
return ch;
@ -104,8 +110,10 @@ namespace osu.Game.Skinning
base.Dispose(isDisposing);
if (channels != null)
{
foreach (var c in channels)
c.Dispose();
}
}
}
}

View File

@ -65,6 +65,7 @@ namespace osu.Game.Storyboards
public virtual IEnumerable<CommandTimeline<T>.TypedCommand> GetCommands<T>(CommandTimelineSelector<T> timelineSelector, double offset = 0)
{
if (offset != 0)
{
return timelineSelector(this).Commands.Select(command =>
new CommandTimeline<T>.TypedCommand
{
@ -74,6 +75,7 @@ namespace osu.Game.Storyboards
StartValue = command.StartValue,
EndValue = command.EndValue,
});
}
return timelineSelector(this).Commands;
}

View File

@ -106,8 +106,11 @@ namespace osu.Game.Storyboards
foreach (var loop in loops)
commands = commands.Concat(loop.GetCommands(timelineSelector));
if (triggeredGroups != null)
{
foreach (var pair in triggeredGroups)
commands = commands.Concat(pair.Item1.GetCommands(timelineSelector, pair.Item2));
}
return commands;
}

View File

@ -72,11 +72,15 @@ namespace osu.Game.Tests.Beatmaps
break;
if (objectCounter >= ourMapping.Objects.Count)
{
Assert.Fail($"The conversion did not generate a hitobject, but should have, for hitobject at time: {expectedMapping.StartTime}:\n"
+ $"Expected: {JsonConvert.SerializeObject(expectedMapping.Objects[objectCounter])}\n");
}
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.Objects[objectCounter].Equals(ourMapping.Objects[objectCounter]))
{
Assert.Fail($"The conversion generated differing hitobjects for object at time: {expectedMapping.StartTime}:\n"

View File

@ -38,8 +38,10 @@ namespace osu.Game.Tests.Visual
cells = new Drawable[rows, cols];
for (int r = 0; r < rows; r++)
for (int c = 0; c < cols; c++)
cells[r, c] = new Container { RelativeSizeAxes = Axes.Both };
{
for (int c = 0; c < cols; c++)
cells[r, c] = new Container { RelativeSizeAxes = Axes.Both };
}
testContainer.Content = cells.ToJagged();
}

View File

@ -46,6 +46,7 @@ namespace osu.Game.Users
};
}
else
{
InternalChild = new Sprite
{
RelativeSizeAxes = Axes.Both,
@ -54,6 +55,7 @@ namespace osu.Game.Users
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
}
}
protected override void LoadComplete()