1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +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, }); beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, });
for (int i = 0; i < 512; i++) for (int i = 0; i < 512; i++)
{
if (i % 5 < 3) 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 }); beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 });
}
return beatmap; return beatmap;
} }

View File

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

View File

@ -27,11 +27,13 @@ namespace osu.Game.Rulesets.Catch.Objects
return; return;
for (double i = StartTime; i <= EndTime; i += spacing) for (double i = StartTime; i <= EndTime; i += spacing)
{
AddNested(new Banana AddNested(new Banana
{ {
Samples = Samples, Samples = Samples,
StartTime = i StartTime = i
}); });
}
} }
public double EndTime => StartTime + Duration; 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 // Generate a new pattern by copying the last hit objects in reverse-column order
for (int i = RandomStart; i < TotalColumns; i++) for (int i = RandomStart; i < TotalColumns; i++)
{
if (PreviousPattern.ColumnHasObject(i)) if (PreviousPattern.ColumnHasObject(i))
addToPattern(pattern, RandomStart + TotalColumns - i - 1); addToPattern(pattern, RandomStart + TotalColumns - i - 1);
}
return pattern; 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 // Generate a new pattern by placing on the already filled columns
for (int i = RandomStart; i < TotalColumns; i++) for (int i = RandomStart; i < TotalColumns; i++)
{
if (PreviousPattern.ColumnHasObject(i)) if (PreviousPattern.ColumnHasObject(i))
addToPattern(pattern, i); addToPattern(pattern, i);
}
return pattern; return pattern;
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -130,12 +130,14 @@ namespace osu.Game.Tests.Visual.Online
AddRepeatStep("add many messages", () => AddRepeatStep("add many messages", () =>
{ {
for (int i = 0; i < messages_per_call; i++) for (int i = 0; i < messages_per_call; i++)
{
testChannel.AddNewMessages(new Message(sequence++) testChannel.AddNewMessages(new Message(sequence++)
{ {
Sender = longUsernameUser, Sender = longUsernameUser,
Content = "Many messages! " + Guid.NewGuid(), Content = "Many messages! " + Guid.NewGuid(),
Timestamp = DateTimeOffset.Now Timestamp = DateTimeOffset.Now
}); });
}
}, Channel.MAX_HISTORY / messages_per_call + 5); }, Channel.MAX_HISTORY / messages_per_call + 5);
AddAssert("Ensure no adjacent day separators", () => 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)); var indices = chatDisplay.FillFlow.OfType<DrawableChannel.DaySeparator>().Select(ds => chatDisplay.FillFlow.IndexOf(ds));
foreach (var i in indices) foreach (var i in indices)
{
if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DrawableChannel.DaySeparator) if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DrawableChannel.DaySeparator)
return false; return false;
}
return true; 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) private void advanceSelection(bool diff, int direction = 1, int count = 1)
{ {
if (count == 1) if (count == 1)
{
AddStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () => AddStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>
carousel.SelectNext(direction, !diff)); carousel.SelectNext(direction, !diff));
}
else else
{ {
AddRepeatStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () => AddRepeatStep($"select {(direction > 0 ? "next" : "prev")} {(diff ? "diff" : "set")}", () =>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -81,8 +81,10 @@ namespace osu.Game.Tournament.Screens.Ladder
LadderInfo.Matches.ItemsRemoved += matches => LadderInfo.Matches.ItemsRemoved += matches =>
{ {
foreach (var p in 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(); layout.Invalidate();
}; };

View File

@ -164,6 +164,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
if (team != null) if (team != null)
{ {
foreach (var p in team.Players) foreach (var p in team.Players)
{
players.Add(new OsuSpriteText players.Add(new OsuSpriteText
{ {
Text = p.Username, Text = p.Username,
@ -172,6 +173,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = 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 // link matches to rounds
foreach (var round in ladder.Rounds) foreach (var round in ladder.Rounds)
foreach (var id in round.Matches)
{ {
var found = ladder.Matches.FirstOrDefault(p => p.ID == id); foreach (var id in round.Matches)
if (found != null)
{ {
found.Round.Value = round; var found = ladder.Matches.FirstOrDefault(p => p.ID == id);
if (round.StartDate.Value > found.Date.Value)
found.Date.Value = round.StartDate.Value; 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; bool addedInfo = false;
foreach (var t in ladder.Teams) 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); if (string.IsNullOrEmpty(p.Username))
req.Perform(API); {
p.Username = req.Result.Username; var req = new GetUserRequest(p.Id);
req.Perform(API);
p.Username = req.Result.Username;
addedInfo = true; addedInfo = true;
}
} }
}
return addedInfo; return addedInfo;
} }
@ -213,15 +219,19 @@ namespace osu.Game.Tournament
bool addedInfo = false; bool addedInfo = false;
foreach (var r in ladder.Rounds) 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 }); if (b.BeatmapInfo == null && b.ID > 0)
req.Perform(API); {
b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore); var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = b.ID });
req.Perform(API);
b.BeatmapInfo = req.Result?.ToBeatmap(RulesetStore);
addedInfo = true; addedInfo = true;
}
} }
}
return addedInfo; 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 endTime = split.Length > 3 ? double.Parse(split[3], CultureInfo.InvariantCulture) : double.MaxValue;
var groupNumber = split.Length > 4 ? int.Parse(split[4]) : 0; var groupNumber = split.Length > 4 ? int.Parse(split[4]) : 0;
timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber); timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber);
}
break; break;
}
case "L": case "L":
{ {
var startTime = double.Parse(split[1], CultureInfo.InvariantCulture); var startTime = double.Parse(split[1], CultureInfo.InvariantCulture);
var loopCount = int.Parse(split[2]); var loopCount = int.Parse(split[2]);
timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount); timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount);
}
break; break;
}
default: default:
{ {
@ -172,7 +172,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue);
} }
break; break;
case "S": case "S":
{ {
@ -180,7 +180,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Scale.Add(easing, startTime, endTime, new Vector2(startValue), new Vector2(endValue)); timelineGroup?.Scale.Add(easing, startTime, endTime, new Vector2(startValue), new Vector2(endValue));
} }
break; break;
case "V": case "V":
{ {
@ -190,7 +190,7 @@ namespace osu.Game.Beatmaps.Formats
var endY = split.Length > 7 ? float.Parse(split[7], CultureInfo.InvariantCulture) : startY; 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)); timelineGroup?.Scale.Add(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY));
} }
break; break;
case "R": case "R":
{ {
@ -198,7 +198,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Rotation.Add(easing, startTime, endTime, MathHelper.RadiansToDegrees(startValue), MathHelper.RadiansToDegrees(endValue)); timelineGroup?.Rotation.Add(easing, startTime, endTime, MathHelper.RadiansToDegrees(startValue), MathHelper.RadiansToDegrees(endValue));
} }
break; break;
case "M": case "M":
{ {
@ -209,7 +209,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup?.X.Add(easing, startTime, endTime, startX, endX); timelineGroup?.X.Add(easing, startTime, endTime, startX, endX);
timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY); timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY);
} }
break; break;
case "MX": case "MX":
{ {
@ -217,7 +217,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue);
} }
break; break;
case "MY": case "MY":
{ {
@ -225,7 +225,7 @@ namespace osu.Game.Beatmaps.Formats
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue;
timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue);
} }
break; break;
case "C": case "C":
{ {
@ -239,7 +239,7 @@ namespace osu.Game.Beatmaps.Formats
new Color4(startRed / 255f, startGreen / 255f, startBlue / 255f, 1), new Color4(startRed / 255f, startGreen / 255f, startBlue / 255f, 1),
new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1)); new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1));
} }
break; break;
case "P": case "P":
{ {
@ -260,13 +260,13 @@ namespace osu.Game.Beatmaps.Formats
break; break;
} }
} }
break; break;
default: default:
throw new InvalidDataException($@"Unknown command type: {commandType}"); 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); obj.ApplyDefaults(converted.ControlPointInfo, converted.BeatmapInfo.BaseDifficulty);
foreach (var mod in mods.OfType<IApplicableToHitObject>()) 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(); 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. // for now, concatenate all .osu files in the set to create a unique hash.
MemoryStream hashable = new MemoryStream(); MemoryStream hashable = new MemoryStream();
foreach (string file in reader.Filenames.Where(f => HashableFileTypes.Any(f.EndsWith))) foreach (string file in reader.Filenames.Where(f => HashableFileTypes.Any(f.EndsWith)))
{
using (Stream s = reader.GetStream(file)) using (Stream s = reader.GetStream(file))
s.CopyTo(hashable); s.CopyTo(hashable);
}
return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null; return hashable.Length > 0 ? hashable.ComputeSHA2Hash() : null;
} }
@ -485,12 +487,16 @@ namespace osu.Game.Database
// import files to manager // import files to manager
foreach (string file in reader.Filenames) foreach (string file in reader.Filenames)
{
using (Stream s = reader.GetStream(file)) using (Stream s = reader.GetStream(file))
{
fileInfos.Add(new TFileModel fileInfos.Add(new TFileModel
{ {
Filename = FileSafety.PathStandardise(file.Substring(prefix.Length)), Filename = FileSafety.PathStandardise(file.Substring(prefix.Length)),
FileInfo = files.Add(s) FileInfo = files.Add(s)
}); });
}
}
return fileInfos; return fileInfos;
} }
@ -651,8 +657,10 @@ namespace osu.Game.Database
private void handleEvent(Action a) private void handleEvent(Action a)
{ {
if (delayingEvents) if (delayingEvents)
{
lock (queuedEvents) lock (queuedEvents)
queuedEvents.Add(a); queuedEvents.Add(a);
}
else else
a.Invoke(); 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 we don't have enough time for the second shake, skip it.
if (!maximumLength.HasValue || maximumLength >= ShakeDuration * 4) if (!maximumLength.HasValue || maximumLength >= ShakeDuration * 4)
{
sequence = sequence sequence = sequence
.MoveToX(shake_amount, ShakeDuration, Easing.InOutSine).Then() .MoveToX(shake_amount, ShakeDuration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then(); .MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then();
}
sequence.MoveToX(0, ShakeDuration / 2, Easing.InSine); sequence.MoveToX(0, ShakeDuration / 2, Easing.InSine);
} }

View File

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

View File

@ -44,8 +44,10 @@ namespace osu.Game.Graphics.UserInterface
{ {
string format = new string('0', (int)LeadingZeroes); string format = new string('0', (int)LeadingZeroes);
if (UseCommaSeparator) if (UseCommaSeparator)
{
for (int i = format.Length - 3; i > 0; i -= 3) for (int i = format.Length - 3; i > 0; i -= 3)
format = format.Insert(i, @","); format = format.Insert(i, @",");
}
return ((long)count).ToString(format); 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)) foreach (var insertable in group.Skip(count).Take(aimCount - count))
// insert any defaults which are missing. // insert any defaults which are missing.
{
usage.Context.DatabasedKeyBinding.Add(new DatabasedKeyBinding usage.Context.DatabasedKeyBinding.Add(new DatabasedKeyBinding
{ {
KeyCombination = insertable.KeyCombination, KeyCombination = insertable.KeyCombination,
@ -54,6 +55,7 @@ namespace osu.Game.Input
RulesetID = rulesetId, RulesetID = rulesetId,
Variant = variant Variant = variant
}); });
}
} }
} }
} }

View File

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

View File

@ -292,8 +292,10 @@ namespace osu.Game
var extension = Path.GetExtension(paths.First())?.ToLowerInvariant(); var extension = Path.GetExtension(paths.First())?.ToLowerInvariant();
foreach (var importer in fileImporters) foreach (var importer in fileImporters)
{
if (importer.HandledExtensions.Contains(extension)) if (importer.HandledExtensions.Contains(extension))
await importer.Import(paths); await importer.Import(paths);
}
} }
public string[] HandledExtensions => fileImporters.SelectMany(i => i.HandledExtensions).ToArray(); 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) if (entry.GithubUser.UserId != null)
{
title.AddUserLink(new User title.AddUserLink(new User
{ {
Username = entry.GithubUser.OsuUsername, Username = entry.GithubUser.OsuUsername,
@ -139,18 +140,23 @@ namespace osu.Game.Overlays.Changelog
t.Font = fontMedium; t.Font = fontMedium;
t.Colour = entryColour; t.Colour = entryColour;
}); });
}
else if (entry.GithubUser.GithubUrl != null) else if (entry.GithubUser.GithubUrl != null)
{
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t => title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
{ {
t.Font = fontMedium; t.Font = fontMedium;
t.Colour = entryColour; t.Colour = entryColour;
}); });
}
else else
{
title.AddText(entry.GithubUser.DisplayName, t => title.AddText(entry.GithubUser.DisplayName, t =>
{ {
t.Font = fontSmall; t.Font = fontSmall;
t.Colour = entryColour; t.Colour = entryColour;
}); });
}
ChangelogEntries.Add(titleContainer); ChangelogEntries.Add(titleContainer);

View File

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

View File

@ -162,10 +162,12 @@ namespace osu.Game.Overlays.Comments
foreach (var c in response.Comments) foreach (var c in response.Comments)
{ {
if (c.IsTopLevel) if (c.IsTopLevel)
{
page.Add(new DrawableComment(c) page.Add(new DrawableComment(c)
{ {
ShowDeleted = { BindTarget = ShowDeleted } ShowDeleted = { BindTarget = ShowDeleted }
}); });
}
} }
LoadComponentAsync(page, loaded => 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)); icons.Add(new GroupedDifficultyIcon(SetInfo.Beatmaps.FindAll(b => b.Ruleset.Equals(ruleset)), ruleset, this is DirectListPanel ? Color4.White : colours.Gray5));
} }
else else
{
foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty)) foreach (var b in SetInfo.Beatmaps.OrderBy(beatmap => beatmap.StarDifficulty))
icons.Add(new DifficultyIcon(b)); icons.Add(new DifficultyIcon(b));
}
return icons; return icons;
} }

View File

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

View File

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

View File

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

View File

@ -113,8 +113,10 @@ namespace osu.Game.Rulesets.Objects.Drawables
if (samples.Length > 0) if (samples.Length > 0)
{ {
if (HitObject.SampleControlPoint == null) if (HitObject.SampleControlPoint == null)
{
throw new ArgumentNullException(nameof(HitObject.SampleControlPoint), $"{nameof(HitObject)}s must always have an attached {nameof(HitObject.SampleControlPoint)}." 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}."); + $" This is an indication that {nameof(HitObject.ApplyDefaults)} has not been invoked on {this}.");
}
samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray(); samples = samples.Select(s => HitObject.SampleControlPoint.ApplyTo(s)).ToArray();
foreach (var s in samples) foreach (var s in samples)

View File

@ -75,8 +75,10 @@ namespace osu.Game.Rulesets.Objects.Legacy
int pointCount = 1; int pointCount = 1;
foreach (var t in pointSplit) foreach (var t in pointSplit)
{
if (t.Length > 1) if (t.Length > 1)
pointCount++; pointCount++;
}
var points = new Vector2[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); ReadOnlySpan<Vector2> cpSpan = ControlPoints.Slice(start, end - start);
foreach (Vector2 t in calculateSubpath(cpSpan)) foreach (Vector2 t in calculateSubpath(cpSpan))
{
if (calculatedPath.Count == 0 || calculatedPath.Last() != t) if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
calculatedPath.Add(t); calculatedPath.Add(t);
}
start = end; start = end;
} }

View File

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

View File

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

View File

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

View File

@ -57,11 +57,13 @@ namespace osu.Game.Screens.Multi.Components
var beatmap = CurrentItem.Value?.Beatmap; var beatmap = CurrentItem.Value?.Beatmap;
if (beatmap == null) if (beatmap == null)
{
textFlow.AddText("No beatmap selected", s => textFlow.AddText("No beatmap selected", s =>
{ {
s.Font = s.Font.With(size: TextSize); s.Font = s.Font.With(size: TextSize);
s.Colour = colours.PinkLight; s.Colour = colours.PinkLight;
}); });
}
else else
{ {
textFlow.AddLink(new[] 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) if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered)
Alpha = 1; Alpha = 1;
else else
{
Alpha = Interpolation.ValueAt( Alpha = Interpolation.ValueAt(
MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 200), MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 200),
Alpha, MathHelper.Clamp(1 - positionalAdjust, 0.04f, 1), 0, 200, Easing.OutQuint); Alpha, MathHelper.Clamp(1 - positionalAdjust, 0.04f, 1), 0, 200, Easing.OutQuint);
}
} }
private class Button : HoldToConfirmContainer, IKeyBindingHandler<GlobalAction> private class Button : HoldToConfirmContainer, IKeyBindingHandler<GlobalAction>

View File

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

View File

@ -44,10 +44,14 @@ namespace osu.Game.Screens.Select.Carousel
criteria.Artist.Matches(Beatmap.Metadata.ArtistUnicode); criteria.Artist.Matches(Beatmap.Metadata.ArtistUnicode);
if (match) if (match)
{
foreach (var criteriaTerm in criteria.SearchTerms) foreach (var criteriaTerm in criteria.SearchTerms)
{
match &= match &=
Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0) || Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0) ||
Beatmap.Version.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0; Beatmap.Version.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0;
}
}
Filtered.Value = !match; 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 we have no beatmaps but osu-stable is found, let's prompt the user to import.
if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable) if (!beatmaps.GetAllUsableBeatmapSetsEnumerable().Any() && beatmaps.StableInstallationAvailable)
{
dialogOverlay.Push(new ImportFromStablePopup(() => dialogOverlay.Push(new ImportFromStablePopup(() =>
{ {
Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion); Task.Run(beatmaps.ImportFromStableAsync).ContinueWith(_ => scores.ImportFromStableAsync(), TaskContinuationOptions.OnlyOnRanToCompletion);
Task.Run(skins.ImportFromStableAsync); Task.Run(skins.ImportFromStableAsync);
})); }));
}
}); });
} }
} }
@ -333,11 +335,13 @@ namespace osu.Game.Screens.Select
if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(e.NewValue?.BeatmapInfo, false)) if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(e.NewValue?.BeatmapInfo, false))
// If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch // 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)) if (e.NewValue?.BeatmapInfo?.Ruleset != null && !e.NewValue.BeatmapInfo.Ruleset.Equals(decoupledRuleset.Value))
{ {
Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset; Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset;
Carousel.SelectBeatmap(e.NewValue.BeatmapInfo); Carousel.SelectBeatmap(e.NewValue.BeatmapInfo);
} }
}
} }
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds. // 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); Stream stream = storage?.GetStream(filename);
if (stream != null) if (stream != null)
{
using (LineBufferedReader reader = new LineBufferedReader(stream)) using (LineBufferedReader reader = new LineBufferedReader(stream))
Configuration = new LegacySkinDecoder().Decode(reader); Configuration = new LegacySkinDecoder().Decode(reader);
}
else else
Configuration = new DefaultSkinConfiguration(); Configuration = new DefaultSkinConfiguration();

View File

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

View File

@ -81,9 +81,13 @@ namespace osu.Game.Skinning
var ch = skin.GetSample(s); var ch = skin.GetSample(s);
if (ch == null && allowFallback) if (ch == null && allowFallback)
{
foreach (var lookup in s.LookupNames) foreach (var lookup in s.LookupNames)
{
if ((ch = samples.Get($"Gameplay/{lookup}")) != null) if ((ch = samples.Get($"Gameplay/{lookup}")) != null)
break; break;
}
}
if (ch != null) if (ch != null)
{ {
@ -91,8 +95,10 @@ namespace osu.Game.Skinning
ch.Volume.Value = s.Volume / 100.0; ch.Volume.Value = s.Volume / 100.0;
if (adjustments != null) if (adjustments != null)
{
foreach (var adjustment in adjustments) foreach (var adjustment in adjustments)
ch.AddAdjustment(adjustment.property, adjustment.bindable); ch.AddAdjustment(adjustment.property, adjustment.bindable);
}
} }
return ch; return ch;
@ -104,8 +110,10 @@ namespace osu.Game.Skinning
base.Dispose(isDisposing); base.Dispose(isDisposing);
if (channels != null) if (channels != null)
{
foreach (var c in channels) foreach (var c in channels)
c.Dispose(); 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) public virtual IEnumerable<CommandTimeline<T>.TypedCommand> GetCommands<T>(CommandTimelineSelector<T> timelineSelector, double offset = 0)
{ {
if (offset != 0) if (offset != 0)
{
return timelineSelector(this).Commands.Select(command => return timelineSelector(this).Commands.Select(command =>
new CommandTimeline<T>.TypedCommand new CommandTimeline<T>.TypedCommand
{ {
@ -74,6 +75,7 @@ namespace osu.Game.Storyboards
StartValue = command.StartValue, StartValue = command.StartValue,
EndValue = command.EndValue, EndValue = command.EndValue,
}); });
}
return timelineSelector(this).Commands; return timelineSelector(this).Commands;
} }

View File

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

View File

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

View File

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