Apply newline additions

This commit is contained in:
Dean Herbert
2019-04-01 12:16:05 +09:00
parent 7d6a08d6da
commit 612db31c38
108 changed files with 359 additions and 7 deletions

View File

@ -77,6 +77,7 @@ namespace osu.Desktop
if (versionManager != null) if (versionManager != null)
versionManager.State = Visibility.Visible; versionManager.State = Visibility.Visible;
break; break;
default: default:
if (versionManager != null) if (versionManager != null)
versionManager.State = Visibility.Hidden; versionManager.State = Visibility.Hidden;
@ -87,6 +88,7 @@ namespace osu.Desktop
public override void SetHost(GameHost host) public override void SetHost(GameHost host)
{ {
base.SetHost(host); base.SetHost(host);
if (host.Window is DesktopGameWindow desktopWindow) if (host.Window is DesktopGameWindow desktopWindow)
{ {
desktopWindow.CursorState |= CursorState.Hidden; desktopWindow.CursorState |= CursorState.Hidden;

View File

@ -95,6 +95,7 @@ namespace osu.Desktop.Overlays
var version = game.Version; var version = game.Version;
var lastVersion = config.Get<string>(OsuSetting.Version); var lastVersion = config.Get<string>(OsuSetting.Version);
if (game.IsDeployedBuild && version != lastVersion) if (game.IsDeployedBuild && version != lastVersion)
{ {
config.Set(OsuSetting.Version, version); config.Set(OsuSetting.Version, version);

View File

@ -31,6 +31,7 @@ namespace osu.Desktop
var importer = new ArchiveImportIPCChannel(host); var importer = new ArchiveImportIPCChannel(host);
// Restore the cwd so relative paths given at the command line work correctly // Restore the cwd so relative paths given at the command line work correctly
Directory.SetCurrentDirectory(cwd); Directory.SetCurrentDirectory(cwd);
foreach (var file in args) foreach (var file in args)
{ {
Console.WriteLine(@"Importing {0}", file); Console.WriteLine(@"Importing {0}", file);

View File

@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
initialiseHyperDash((List<CatchHitObject>)Beatmap.HitObjects); initialiseHyperDash((List<CatchHitObject>)Beatmap.HitObjects);
int index = 0; int index = 0;
foreach (var obj in Beatmap.HitObjects.OfType<CatchHitObject>()) foreach (var obj in Beatmap.HitObjects.OfType<CatchHitObject>())
{ {
obj.IndexInBeatmap = index++; obj.IndexInBeatmap = index++;
@ -58,6 +59,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
} }
break; break;
case JuiceStream juiceStream: case JuiceStream juiceStream:
foreach (var nested in juiceStream.NestedHitObjects) foreach (var nested in juiceStream.NestedHitObjects)
{ {
@ -103,6 +105,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable
double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth); double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
float distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext); float distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext);
if (distanceToHyper < 0) if (distanceToHyper < 0)
{ {
currentObject.HyperDashTarget = nextObject; currentObject.HyperDashTarget = nextObject;

View File

@ -73,6 +73,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
lastObject = hitObject; lastObject = hitObject;
break; break;
case JuiceStream _: case JuiceStream _:
foreach (var nested in hitObject.NestedHitObjects.OfType<CatchHitObject>().Where(o => !(o is TinyDroplet))) foreach (var nested in hitObject.NestedHitObjects.OfType<CatchHitObject>().Where(o => !(o is TinyDroplet)))
{ {

View File

@ -105,6 +105,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
{ {
default: default:
return new Container(); return new Container();
case FruitVisualRepresentation.Raspberry: case FruitVisualRepresentation.Raspberry:
return new Container return new Container
{ {
@ -143,6 +144,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
}, },
} }
}; };
case FruitVisualRepresentation.Pineapple: case FruitVisualRepresentation.Pineapple:
return new Container return new Container
{ {
@ -181,6 +183,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
}, },
} }
}; };
case FruitVisualRepresentation.Pear: case FruitVisualRepresentation.Pear:
return new Container return new Container
{ {
@ -213,6 +216,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
}, },
} }
}; };
case FruitVisualRepresentation.Grape: case FruitVisualRepresentation.Grape:
return new Container return new Container
{ {
@ -245,6 +249,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
}, },
} }
}; };
case FruitVisualRepresentation.Banana: case FruitVisualRepresentation.Banana:
return new Container return new Container
{ {
@ -282,19 +287,25 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
default: default:
case FruitVisualRepresentation.Pear: case FruitVisualRepresentation.Pear:
return new Color4(17, 136, 170, 255); return new Color4(17, 136, 170, 255);
case FruitVisualRepresentation.Grape: case FruitVisualRepresentation.Grape:
return new Color4(204, 102, 0, 255); return new Color4(204, 102, 0, 255);
case FruitVisualRepresentation.Raspberry: case FruitVisualRepresentation.Raspberry:
return new Color4(121, 9, 13, 255); return new Color4(121, 9, 13, 255);
case FruitVisualRepresentation.Pineapple: case FruitVisualRepresentation.Pineapple:
return new Color4(102, 136, 0, 255); return new Color4(102, 136, 0, 255);
case FruitVisualRepresentation.Banana: case FruitVisualRepresentation.Banana:
switch (RNG.Next(0, 3)) switch (RNG.Next(0, 3))
{ {
default: default:
return new Color4(255, 240, 0, 255); return new Color4(255, 240, 0, 255);
case 1: case 1:
return new Color4(255, 192, 0, 255); return new Color4(255, 192, 0, 255);
case 2: case 2:
return new Color4(214, 221, 28, 255); return new Color4(214, 221, 28, 255);
} }

View File

@ -292,6 +292,7 @@ namespace osu.Game.Rulesets.Catch.UI
const float hyper_dash_transition_length = 180; const float hyper_dash_transition_length = 180;
bool previouslyHyperDashing = HyperDashing; bool previouslyHyperDashing = HyperDashing;
if (modifier <= 1 || X == targetPosition) if (modifier <= 1 || X == targetPosition)
{ {
hyperDashModifier = 1; hyperDashModifier = 1;
@ -325,9 +326,11 @@ namespace osu.Game.Rulesets.Catch.UI
case CatchAction.MoveLeft: case CatchAction.MoveLeft:
currentDirection--; currentDirection--;
return true; return true;
case CatchAction.MoveRight: case CatchAction.MoveRight:
currentDirection++; currentDirection++;
return true; return true;
case CatchAction.Dash: case CatchAction.Dash:
Dashing = true; Dashing = true;
return true; return true;
@ -343,9 +346,11 @@ namespace osu.Game.Rulesets.Catch.UI
case CatchAction.MoveLeft: case CatchAction.MoveLeft:
currentDirection++; currentDirection++;
return true; return true;
case CatchAction.MoveRight: case CatchAction.MoveRight:
currentDirection--; currentDirection--;
return true; return true;
case CatchAction.Dash: case CatchAction.Dash:
Dashing = false; Dashing = false;
return true; return true;

View File

@ -168,11 +168,13 @@ namespace osu.Game.Rulesets.Mania.Tests
foreach (var nested in obj.NestedHitObjects) foreach (var nested in obj.NestedHitObjects)
{ {
double finalPosition = (nested.HitObject.StartTime - obj.HitObject.StartTime) / endTime.Duration; double finalPosition = (nested.HitObject.StartTime - obj.HitObject.StartTime) / endTime.Duration;
switch (direction) switch (direction)
{ {
case ScrollingDirection.Up: case ScrollingDirection.Up:
nested.Y = (float)(finalPosition * content.DrawHeight); nested.Y = (float)(finalPosition * content.DrawHeight);
break; break;
case ScrollingDirection.Down: case ScrollingDirection.Down:
nested.Y = (float)(-finalPosition * content.DrawHeight); nested.Y = (float)(-finalPosition * content.DrawHeight);
break; break;

View File

@ -48,6 +48,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
if (IsForCurrentRuleset) if (IsForCurrentRuleset)
{ {
TargetColumns = (int)Math.Max(1, roundedCircleSize); TargetColumns = (int)Math.Max(1, roundedCircleSize);
if (TargetColumns >= 10) if (TargetColumns >= 10)
{ {
TargetColumns = TargetColumns / 2; TargetColumns = TargetColumns / 2;

View File

@ -179,6 +179,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int usableColumns = TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects; int usableColumns = TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects;
int nextColumn = GetRandomColumn(); int nextColumn = GetRandomColumn();
for (int i = 0; i < Math.Min(usableColumns, noteCount); i++) for (int i = 0; i < Math.Min(usableColumns, noteCount); i++)
{ {
// Find available column // Find available column
@ -217,6 +218,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
nextColumn = FindAvailableColumn(nextColumn, PreviousPattern); nextColumn = FindAvailableColumn(nextColumn, PreviousPattern);
int lastColumn = nextColumn; int lastColumn = nextColumn;
for (int i = 0; i < noteCount; i++) for (int i = 0; i < noteCount; i++)
{ {
addToPattern(pattern, nextColumn, startTime, startTime); addToPattern(pattern, nextColumn, startTime, startTime);
@ -299,6 +301,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int interval = Random.Next(1, TotalColumns - (legacy ? 1 : 0)); int interval = Random.Next(1, TotalColumns - (legacy ? 1 : 0));
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
for (int i = 0; i <= spanCount; i++) for (int i = 0; i <= spanCount; i++)
{ {
addToPattern(pattern, nextColumn, startTime, startTime); addToPattern(pattern, nextColumn, startTime, startTime);
@ -341,16 +344,19 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
p3 = 0; p3 = 0;
p4 = 0; p4 = 0;
break; break;
case 3: case 3:
p2 = Math.Min(p2, 0.1); p2 = Math.Min(p2, 0.1);
p3 = 0; p3 = 0;
p4 = 0; p4 = 0;
break; break;
case 4: case 4:
p2 = Math.Min(p2, 0.3); p2 = Math.Min(p2, 0.3);
p3 = Math.Min(p3, 0.04); p3 = Math.Min(p3, 0.04);
p4 = 0; p4 = 0;
break; break;
case 5: case 5:
p2 = Math.Min(p2, 0.34); p2 = Math.Min(p2, 0.34);
p3 = Math.Min(p3, 0.1); p3 = Math.Min(p3, 0.1);
@ -440,6 +446,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
bool ignoreHead = !sampleInfoListAt(startTime).Any(s => s.Name == SampleInfo.HIT_WHISTLE || s.Name == SampleInfo.HIT_FINISH || s.Name == SampleInfo.HIT_CLAP); bool ignoreHead = !sampleInfoListAt(startTime).Any(s => s.Name == SampleInfo.HIT_WHISTLE || s.Name == SampleInfo.HIT_FINISH || s.Name == SampleInfo.HIT_CLAP);
var rowPattern = new Pattern(); var rowPattern = new Pattern();
for (int i = 0; i <= spanCount; i++) for (int i = 0; i <= spanCount; i++)
{ {
if (!(ignoreHead && startTime == HitObject.StartTime)) if (!(ignoreHead && startTime == HitObject.StartTime))

View File

@ -233,6 +233,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
noteCount = Math.Min(noteCount, TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects); noteCount = Math.Min(noteCount, TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects);
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true); int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
for (int i = 0; i < noteCount; i++) for (int i = 0; i < noteCount; i++)
{ {
nextColumn = allowStacking nextColumn = allowStacking
@ -303,6 +304,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2; int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2;
int nextColumn = GetRandomColumn(upperBound: columnLimit); int nextColumn = GetRandomColumn(upperBound: columnLimit);
for (int i = 0; i < noteCount; i++) for (int i = 0; i < noteCount; i++)
{ {
nextColumn = FindAvailableColumn(nextColumn, upperBound: columnLimit, patterns: pattern); nextColumn = FindAvailableColumn(nextColumn, upperBound: columnLimit, patterns: pattern);
@ -340,18 +342,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
p4 = 0; p4 = 0;
p5 = 0; p5 = 0;
break; break;
case 3: case 3:
p2 = Math.Min(p2, 0.1); p2 = Math.Min(p2, 0.1);
p3 = 0; p3 = 0;
p4 = 0; p4 = 0;
p5 = 0; p5 = 0;
break; break;
case 4: case 4:
p2 = Math.Min(p2, 0.23); p2 = Math.Min(p2, 0.23);
p3 = Math.Min(p3, 0.04); p3 = Math.Min(p3, 0.04);
p4 = 0; p4 = 0;
p5 = 0; p5 = 0;
break; break;
case 5: case 5:
p3 = Math.Min(p3, 0.15); p3 = Math.Min(p3, 0.15);
p4 = Math.Min(p4, 0.03); p4 = Math.Min(p4, 0.03);
@ -384,20 +389,24 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
p2 = 0; p2 = 0;
p3 = 0; p3 = 0;
break; break;
case 3: case 3:
centreProbability = Math.Min(centreProbability, 0.03); centreProbability = Math.Min(centreProbability, 0.03);
p2 = 0; p2 = 0;
p3 = 0; p3 = 0;
break; break;
case 4: case 4:
centreProbability = 0; centreProbability = 0;
p2 = Math.Min(p2 * 2, 0.2); p2 = Math.Min(p2 * 2, 0.2);
p3 = 0; p3 = 0;
break; break;
case 5: case 5:
centreProbability = Math.Min(centreProbability, 0.03); centreProbability = Math.Min(centreProbability, 0.03);
p3 = 0; p3 = 0;
break; break;
case 6: case 6:
centreProbability = 0; centreProbability = 0;
p2 = Math.Min(p2 * 2, 0.5); p2 = Math.Min(p2 * 2, 0.5);

View File

@ -158,6 +158,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
// Ensure that we have at least one free column, so that an endless loop is avoided // Ensure that we have at least one free column, so that an endless loop is avoided
bool hasValidColumns = false; bool hasValidColumns = false;
for (int i = lowerBound.Value; i < upperBound.Value; i++) for (int i = lowerBound.Value; i < upperBound.Value; i++)
{ {
hasValidColumns = isValid(i); hasValidColumns = isValid(i);

View File

@ -117,6 +117,7 @@ namespace osu.Game.Rulesets.Mania
new ManiaModNoFail(), new ManiaModNoFail(),
new MultiMod(new ManiaModHalfTime(), new ManiaModDaycore()), new MultiMod(new ManiaModHalfTime(), new ManiaModDaycore()),
}; };
case ModType.DifficultyIncrease: case ModType.DifficultyIncrease:
return new Mod[] return new Mod[]
{ {
@ -126,6 +127,7 @@ namespace osu.Game.Rulesets.Mania
new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()), new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()),
new ManiaModFlashlight(), new ManiaModFlashlight(),
}; };
case ModType.Conversion: case ModType.Conversion:
return new Mod[] return new Mod[]
{ {
@ -142,16 +144,19 @@ namespace osu.Game.Rulesets.Mania
new ManiaModDualStages(), new ManiaModDualStages(),
new ManiaModMirror(), new ManiaModMirror(),
}; };
case ModType.Automation: case ModType.Automation:
return new Mod[] return new Mod[]
{ {
new MultiMod(new ManiaModAutoplay(), new ModCinema()), new MultiMod(new ManiaModAutoplay(), new ModCinema()),
}; };
case ModType.Fun: case ModType.Fun:
return new Mod[] return new Mod[]
{ {
new MultiMod(new ModWindUp<ManiaHitObject>(), new ModWindDown<ManiaHitObject>()) new MultiMod(new ModWindUp<ManiaHitObject>(), new ModWindDown<ManiaHitObject>())
}; };
default: default:
return new Mod[] { }; return new Mod[] { };
} }
@ -214,6 +219,7 @@ namespace osu.Game.Rulesets.Mania
SpecialAction = ManiaAction.Special1, SpecialAction = ManiaAction.Special1,
NormalActionStart = ManiaAction.Key1, NormalActionStart = ManiaAction.Key1,
}.GenerateKeyBindingsFor(variant, out _); }.GenerateKeyBindingsFor(variant, out _);
case PlayfieldType.Dual: case PlayfieldType.Dual:
int keys = getDualStageKeyCount(variant); int keys = getDualStageKeyCount(variant);
@ -271,6 +277,7 @@ namespace osu.Game.Rulesets.Mania
{ {
default: default:
return $"{variant}K"; return $"{variant}K";
case PlayfieldType.Dual: case PlayfieldType.Dual:
{ {
var keys = getDualStageKeyCount(variant); var keys = getDualStageKeyCount(variant);

View File

@ -144,6 +144,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces
const float animation_length = 50; const float animation_length = 50;
Foreground.ClearTransforms(false, nameof(Foreground.Colour)); Foreground.ClearTransforms(false, nameof(Foreground.Colour));
if (hitting) if (hitting)
{ {
// wait for the next sync point // wait for the next sync point

View File

@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Mania.Replays
var normalAction = ManiaAction.Key1; var normalAction = ManiaAction.Key1;
var specialAction = ManiaAction.Special1; var specialAction = ManiaAction.Special1;
int totalCounter = 0; int totalCounter = 0;
foreach (var stage in Beatmap.Stages) foreach (var stage in Beatmap.Stages)
{ {
for (int i = 0; i < stage.Columns; i++) for (int i = 0; i < stage.Columns; i++)
@ -51,6 +52,7 @@ namespace osu.Game.Rulesets.Mania.Replays
var pointGroups = generateActionPoints().GroupBy(a => a.Time).OrderBy(g => g.First().Time); var pointGroups = generateActionPoints().GroupBy(a => a.Time).OrderBy(g => g.First().Time);
var actions = new List<ManiaAction>(); var actions = new List<ManiaAction>();
foreach (var group in pointGroups) foreach (var group in pointGroups)
{ {
foreach (var point in group) foreach (var point in group)
@ -60,6 +62,7 @@ namespace osu.Game.Rulesets.Mania.Replays
case HitPoint _: case HitPoint _:
actions.Add(columnActions[point.Column]); actions.Add(columnActions[point.Column]);
break; break;
case ReleasePoint _: case ReleasePoint _:
actions.Remove(columnActions[point.Column]); actions.Remove(columnActions[point.Column]);
break; break;

View File

@ -39,6 +39,7 @@ namespace osu.Game.Rulesets.Mania.Replays
int activeColumns = (int)(legacyFrame.MouseX ?? 0); int activeColumns = (int)(legacyFrame.MouseX ?? 0);
int counter = 0; int counter = 0;
while (activeColumns > 0) while (activeColumns > 0)
{ {
var isSpecial = stage.IsSpecialColumn(counter); var isSpecial = stage.IsSpecialColumn(counter);

View File

@ -56,6 +56,7 @@ namespace osu.Game.Rulesets.Mania.UI
double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - point.BeatLength : lastObjectTime + point.BeatLength * (int)point.TimeSignature; double endTime = i < timingPoints.Count - 1 ? timingPoints[i + 1].Time - point.BeatLength : lastObjectTime + point.BeatLength * (int)point.TimeSignature;
int index = 0; int index = 0;
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++) for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
{ {
barLines.Add(new BarLine barLines.Add(new BarLine
@ -104,8 +105,10 @@ namespace osu.Game.Rulesets.Mania.UI
{ {
case HoldNote holdNote: case HoldNote holdNote:
return new DrawableHoldNote(holdNote); return new DrawableHoldNote(holdNote);
case Note note: case Note note:
return new DrawableNote(note); return new DrawableNote(note);
default: default:
return null; return null;
} }

View File

@ -38,6 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI
var normalColumnAction = ManiaAction.Key1; var normalColumnAction = ManiaAction.Key1;
var specialColumnAction = ManiaAction.Special1; var specialColumnAction = ManiaAction.Special1;
int firstColumnIndex = 0; int firstColumnIndex = 0;
for (int i = 0; i < stageDefinitions.Count; i++) for (int i = 0; i < stageDefinitions.Count; i++)
{ {
var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction); var newStage = new ManiaStage(firstColumnIndex, stageDefinitions[i], ref normalColumnAction, ref specialColumnAction);
@ -92,6 +93,7 @@ namespace osu.Game.Rulesets.Mania.UI
private ManiaStage getStageByColumn(int column) private ManiaStage getStageByColumn(int column)
{ {
int sum = 0; int sum = 0;
foreach (var stage in stages) foreach (var stage in stages)
{ {
sum = sum + stage.Columns.Count; sum = sum + stage.Columns.Count;

View File

@ -44,12 +44,14 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (endIndex < 0) throw new ArgumentOutOfRangeException(nameof(endIndex), $"{nameof(endIndex)} cannot be less than 0."); if (endIndex < 0) throw new ArgumentOutOfRangeException(nameof(endIndex), $"{nameof(endIndex)} cannot be less than 0.");
int extendedEndIndex = endIndex; int extendedEndIndex = endIndex;
if (endIndex < beatmap.HitObjects.Count - 1) if (endIndex < beatmap.HitObjects.Count - 1)
{ {
// Extend the end index to include objects they are stacked on // Extend the end index to include objects they are stacked on
for (int i = endIndex; i >= startIndex; i--) for (int i = endIndex; i >= startIndex; i--)
{ {
int stackBaseIndex = i; int stackBaseIndex = i;
for (int n = stackBaseIndex + 1; n < beatmap.HitObjects.Count; n++) for (int n = stackBaseIndex + 1; n < beatmap.HitObjects.Count; n++)
{ {
OsuHitObject stackBaseObject = beatmap.HitObjects[stackBaseIndex]; OsuHitObject stackBaseObject = beatmap.HitObjects[stackBaseIndex];
@ -87,6 +89,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
//Reverse pass for stack calculation. //Reverse pass for stack calculation.
int extendedStartIndex = startIndex; int extendedStartIndex = startIndex;
for (int i = extendedEndIndex; i > startIndex; i--) for (int i = extendedEndIndex; i > startIndex; i--)
{ {
int n = i; int n = i;
@ -138,6 +141,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (objectN is Slider && Vector2Extensions.Distance(objectN.EndPosition, objectI.Position) < stack_distance) if (objectN is Slider && Vector2Extensions.Distance(objectN.EndPosition, objectI.Position) < stack_distance)
{ {
int offset = objectI.StackHeight - objectN.StackHeight + 1; int offset = objectI.StackHeight - objectN.StackHeight + 1;
for (int j = n + 1; j <= i; j++) for (int j = n + 1; j <= i; j++)
{ {
//For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above). //For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above).

View File

@ -109,6 +109,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty
aimValue *= Math.Min(Math.Pow(scoreMaxCombo, 0.8f) / Math.Pow(beatmapMaxCombo, 0.8f), 1.0f); aimValue *= Math.Min(Math.Pow(scoreMaxCombo, 0.8f) / Math.Pow(beatmapMaxCombo, 0.8f), 1.0f);
double approachRateFactor = 1.0f; double approachRateFactor = 1.0f;
if (Attributes.ApproachRate > 10.33f) if (Attributes.ApproachRate > 10.33f)
approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f); approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f);
else if (Attributes.ApproachRate < 8.0f) else if (Attributes.ApproachRate < 8.0f)

View File

@ -56,6 +56,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
{ {
// We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps. // We will scale distances by this factor, so we can assume a uniform CircleSize among beatmaps.
float scalingFactor = normalized_radius / (float)BaseObject.Radius; float scalingFactor = normalized_radius / (float)BaseObject.Radius;
if (BaseObject.Radius < 30) if (BaseObject.Radius < 30)
{ {
float smallCircleBonus = Math.Min(30 - (float)BaseObject.Radius, 5) / 50; float smallCircleBonus = Math.Min(30 - (float)BaseObject.Radius, 5) / 50;

View File

@ -42,9 +42,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2); speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2);
double angleBonus = 1.0; double angleBonus = 1.0;
if (osuCurrent.Angle != null && osuCurrent.Angle.Value < angle_bonus_begin) if (osuCurrent.Angle != null && osuCurrent.Angle.Value < angle_bonus_begin)
{ {
angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - osuCurrent.Angle.Value)), 2) / 3.57; angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - osuCurrent.Angle.Value)), 2) / 3.57;
if (osuCurrent.Angle.Value < pi_over_2) if (osuCurrent.Angle.Value < pi_over_2)
{ {
angleBonus = 1.28; angleBonus = 1.28;

View File

@ -62,6 +62,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
case PlacementState.Initial: case PlacementState.Initial:
HitObject.Position = e.MousePosition; HitObject.Position = e.MousePosition;
return true; return true;
case PlacementState.Body: case PlacementState.Body:
cursor = e.MousePosition - HitObject.Position; cursor = e.MousePosition - HitObject.Position;
return true; return true;
@ -77,6 +78,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
case PlacementState.Initial: case PlacementState.Initial:
beginCurve(); beginCurve();
break; break;
case PlacementState.Body: case PlacementState.Body:
switch (e.Button) switch (e.Button)
{ {

View File

@ -33,6 +33,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
case DrawableSpinner _: case DrawableSpinner _:
continue; continue;
default: default:
drawable.ApplyCustomUpdateState += ApplyCustomState; drawable.ApplyCustomUpdateState += ApplyCustomState;
break; break;
@ -51,6 +52,7 @@ namespace osu.Game.Rulesets.Osu.Mods
case DrawableSliderTail _: case DrawableSliderTail _:
// special cases we should *not* be scaling. // special cases we should *not* be scaling.
break; break;
case DrawableSlider _: case DrawableSlider _:
case DrawableHitCircle _: case DrawableHitCircle _:
{ {

View File

@ -67,6 +67,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
return; return;
OsuHitObject prevHitObject = null; OsuHitObject prevHitObject = null;
foreach (var currHitObject in hitObjects) foreach (var currHitObject in hitObjects)
{ {
if (prevHitObject != null && !currHitObject.NewCombo && !(prevHitObject is Spinner) && !(currHitObject is Spinner)) if (prevHitObject != null && !currHitObject.NewCombo && !(prevHitObject is Spinner) && !(currHitObject is Spinner))

View File

@ -124,6 +124,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
} }
var result = HitObject.HitWindows.ResultFor(timeOffset); var result = HitObject.HitWindows.ResultFor(timeOffset);
if (result == HitResult.None) if (result == HitResult.None)
{ {
Shake(Math.Abs(timeOffset) - HitObject.HitWindows.HalfWindowFor(HitResult.Miss)); Shake(Math.Abs(timeOffset) - HitObject.HitWindows.HalfWindowFor(HitResult.Miss));
@ -158,11 +159,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
// override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early. // override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early.
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss); LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
break; break;
case ArmedState.Miss: case ArmedState.Miss:
ApproachCircle.FadeOut(50); ApproachCircle.FadeOut(50);
this.FadeOut(100); this.FadeOut(100);
Expire(); Expire();
break; break;
case ArmedState.Hit: case ArmedState.Hit:
ApproachCircle.FadeOut(50); ApproachCircle.FadeOut(50);

View File

@ -191,6 +191,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
Shader.GetUniform<float>("g_FadeClock").UpdateValue(ref Time); Shader.GetUniform<float>("g_FadeClock").UpdateValue(ref Time);
int updateStart = -1, updateEnd = 0; int updateStart = -1, updateEnd = 0;
for (int i = 0; i < Parts.Length; ++i) for (int i = 0; i < Parts.Length; ++i)
{ {
if (Parts[i].WasUpdated) if (Parts[i].WasUpdated)

View File

@ -120,6 +120,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
List<List<SampleInfo>> allSamples = curveData != null ? curveData.NodeSamples : new List<List<SampleInfo>>(new[] { samples }); List<List<SampleInfo>> allSamples = curveData != null ? curveData.NodeSamples : new List<List<SampleInfo>>(new[] { samples });
int i = 0; int i = 0;
for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing) for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing)
{ {
List<SampleInfo> currentSamples = allSamples[i]; List<SampleInfo> currentSamples = allSamples[i];

View File

@ -98,6 +98,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
circlePiece?.FlashBox.FinishTransforms(); circlePiece?.FlashBox.FinishTransforms();
var offset = !AllJudged ? 0 : Time.Current - HitObject.StartTime; var offset = !AllJudged ? 0 : Time.Current - HitObject.StartTime;
using (BeginDelayedSequence(HitObject.StartTime - Time.Current + offset, true)) using (BeginDelayedSequence(HitObject.StartTime - Time.Current + offset, true))
{ {
switch (State.Value) switch (State.Value)
@ -108,15 +109,18 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
UnproxyContent(); UnproxyContent();
this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire(); this.Delay(HitObject.HitWindows.HalfWindowFor(HitResult.Miss)).Expire();
break; break;
case ArmedState.Miss: case ArmedState.Miss:
this.FadeOut(100) this.FadeOut(100)
.Expire(); .Expire();
break; break;
case ArmedState.Hit: case ArmedState.Hit:
// If we're far enough away from the left stage, we should bring outselves in front of it // If we're far enough away from the left stage, we should bring outselves in front of it
ProxyContent(); ProxyContent();
var flash = circlePiece?.FlashBox; var flash = circlePiece?.FlashBox;
if (flash != null) if (flash != null)
{ {
flash.FadeTo(0.9f); flash.FadeTo(0.9f);

View File

@ -111,6 +111,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
MainPiece.KiaiMode = HitObject.Kiai; MainPiece.KiaiMode = HitObject.Kiai;
var strongObject = HitObject.NestedHitObjects.OfType<StrongHitObject>().FirstOrDefault(); var strongObject = HitObject.NestedHitObjects.OfType<StrongHitObject>().FirstOrDefault();
if (strongObject != null) if (strongObject != null)
{ {
var strongHit = CreateStrongHit(strongObject); var strongHit = CreateStrongHit(strongObject);

View File

@ -70,6 +70,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
return; return;
bool first = true; bool first = true;
for (double t = StartTime; t < EndTime + tickSpacing / 2; t += tickSpacing) for (double t = StartTime; t < EndTime + tickSpacing / 2; t += tickSpacing)
{ {
AddNested(new DrumRollTick AddNested(new DrumRollTick

View File

@ -52,6 +52,7 @@ namespace osu.Game.Rulesets.Taiko.Replays
int count = 0; int count = 0;
int req = swell.RequiredHits; int req = swell.RequiredHits;
double hitRate = Math.Min(swell_hit_speed, swell.Duration / req); double hitRate = Math.Min(swell_hit_speed, swell.Duration / req);
for (double j = h.StartTime; j < endTime; j += hitRate) for (double j = h.StartTime; j < endTime; j += hitRate)
{ {
TaikoAction action; TaikoAction action;
@ -62,12 +63,15 @@ namespace osu.Game.Rulesets.Taiko.Replays
case 0: case 0:
action = TaikoAction.LeftCentre; action = TaikoAction.LeftCentre;
break; break;
case 1: case 1:
action = TaikoAction.LeftRim; action = TaikoAction.LeftRim;
break; break;
case 2: case 2:
action = TaikoAction.RightCentre; action = TaikoAction.RightCentre;
break; break;
case 3: case 3:
action = TaikoAction.RightRim; action = TaikoAction.RightRim;
break; break;

View File

@ -508,6 +508,7 @@ namespace osu.Game.Tests.Visual.SongSelect
}, },
Beatmaps = new List<BeatmapInfo>(), Beatmaps = new List<BeatmapInfo>(),
}; };
for (int b = 1; b < 101; b++) for (int b = 1; b < 101; b++)
{ {
toReturn.Beatmaps.Add(new BeatmapInfo toReturn.Beatmaps.Add(new BeatmapInfo

View File

@ -261,6 +261,7 @@ namespace osu.Game.Tests.Visual.SongSelect
Accuracy = 0.8765, Accuracy = 0.8765,
}, },
}; };
foreach (var s in anotherScores) foreach (var s in anotherScores)
{ {
s.Statistics.Add(HitResult.Great, RNG.Next(2000)); s.Statistics.Add(HitResult.Great, RNG.Next(2000));

View File

@ -117,6 +117,7 @@ namespace osu.Game.Beatmaps
if (beatmapSet.OnlineBeatmapSetID != null) if (beatmapSet.OnlineBeatmapSetID != null)
{ {
var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID); var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID);
if (existingOnlineId != null) if (existingOnlineId != null)
{ {
Delete(existingOnlineId); Delete(existingOnlineId);
@ -325,6 +326,7 @@ namespace osu.Game.Beatmaps
{ {
// let's make sure there are actually .osu files to import. // let's make sure there are actually .osu files to import.
string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu")); string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu"));
if (string.IsNullOrEmpty(mapName)) if (string.IsNullOrEmpty(mapName))
{ {
Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name}).", LoggingTarget.Database); Logger.Log($"No beatmap files found in the beatmap archive ({reader.Name}).", LoggingTarget.Database);

View File

@ -101,6 +101,7 @@ namespace osu.Game.Beatmaps
protected override Storyboard GetStoryboard() protected override Storyboard GetStoryboard()
{ {
Storyboard storyboard; Storyboard storyboard;
try try
{ {
using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path)))) using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
@ -131,6 +132,7 @@ namespace osu.Game.Beatmaps
protected override Skin GetSkin() protected override Skin GetSkin()
{ {
Skin skin; Skin skin;
try try
{ {
skin = new LegacyBeatmapSkin(BeatmapInfo, store, audioManager); skin = new LegacyBeatmapSkin(BeatmapInfo, store, audioManager);

View File

@ -49,6 +49,7 @@ namespace osu.Game.Beatmaps.Formats
throw new IOException(@"Unknown decoder type"); throw new IOException(@"Unknown decoder type");
string line; string line;
do do
{ {
line = stream.ReadLine()?.Trim(); line = stream.ReadLine()?.Trim();

View File

@ -70,21 +70,27 @@ namespace osu.Game.Beatmaps.Formats
case Section.General: case Section.General:
handleGeneral(strippedLine); handleGeneral(strippedLine);
return; return;
case Section.Editor: case Section.Editor:
handleEditor(strippedLine); handleEditor(strippedLine);
return; return;
case Section.Metadata: case Section.Metadata:
handleMetadata(line); handleMetadata(line);
return; return;
case Section.Difficulty: case Section.Difficulty:
handleDifficulty(strippedLine); handleDifficulty(strippedLine);
return; return;
case Section.Events: case Section.Events:
handleEvent(strippedLine); handleEvent(strippedLine);
return; return;
case Section.TimingPoints: case Section.TimingPoints:
handleTimingPoint(strippedLine); handleTimingPoint(strippedLine);
return; return;
case Section.HitObjects: case Section.HitObjects:
handleHitObject(strippedLine); handleHitObject(strippedLine);
return; return;
@ -98,29 +104,37 @@ namespace osu.Game.Beatmaps.Formats
var pair = SplitKeyVal(line); var pair = SplitKeyVal(line);
var metadata = beatmap.BeatmapInfo.Metadata; var metadata = beatmap.BeatmapInfo.Metadata;
switch (pair.Key) switch (pair.Key)
{ {
case @"AudioFilename": case @"AudioFilename":
metadata.AudioFile = FileSafety.PathStandardise(pair.Value); metadata.AudioFile = FileSafety.PathStandardise(pair.Value);
break; break;
case @"AudioLeadIn": case @"AudioLeadIn":
beatmap.BeatmapInfo.AudioLeadIn = Parsing.ParseInt(pair.Value); beatmap.BeatmapInfo.AudioLeadIn = Parsing.ParseInt(pair.Value);
break; break;
case @"PreviewTime": case @"PreviewTime":
metadata.PreviewTime = getOffsetTime(Parsing.ParseInt(pair.Value)); metadata.PreviewTime = getOffsetTime(Parsing.ParseInt(pair.Value));
break; break;
case @"Countdown": case @"Countdown":
beatmap.BeatmapInfo.Countdown = Parsing.ParseInt(pair.Value) == 1; beatmap.BeatmapInfo.Countdown = Parsing.ParseInt(pair.Value) == 1;
break; break;
case @"SampleSet": case @"SampleSet":
defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value); defaultSampleBank = (LegacySampleBank)Enum.Parse(typeof(LegacySampleBank), pair.Value);
break; break;
case @"SampleVolume": case @"SampleVolume":
defaultSampleVolume = Parsing.ParseInt(pair.Value); defaultSampleVolume = Parsing.ParseInt(pair.Value);
break; break;
case @"StackLeniency": case @"StackLeniency":
beatmap.BeatmapInfo.StackLeniency = Parsing.ParseFloat(pair.Value); beatmap.BeatmapInfo.StackLeniency = Parsing.ParseFloat(pair.Value);
break; break;
case @"Mode": case @"Mode":
beatmap.BeatmapInfo.RulesetID = Parsing.ParseInt(pair.Value); beatmap.BeatmapInfo.RulesetID = Parsing.ParseInt(pair.Value);
@ -129,24 +143,30 @@ namespace osu.Game.Beatmaps.Formats
case 0: case 0:
parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion); parser = new Rulesets.Objects.Legacy.Osu.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
case 1: case 1:
parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(getOffsetTime(), FormatVersion); parser = new Rulesets.Objects.Legacy.Taiko.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
case 2: case 2:
parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(getOffsetTime(), FormatVersion); parser = new Rulesets.Objects.Legacy.Catch.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
case 3: case 3:
parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(getOffsetTime(), FormatVersion); parser = new Rulesets.Objects.Legacy.Mania.ConvertHitObjectParser(getOffsetTime(), FormatVersion);
break; break;
} }
break; break;
case @"LetterboxInBreaks": case @"LetterboxInBreaks":
beatmap.BeatmapInfo.LetterboxInBreaks = Parsing.ParseInt(pair.Value) == 1; beatmap.BeatmapInfo.LetterboxInBreaks = Parsing.ParseInt(pair.Value) == 1;
break; break;
case @"SpecialStyle": case @"SpecialStyle":
beatmap.BeatmapInfo.SpecialStyle = Parsing.ParseInt(pair.Value) == 1; beatmap.BeatmapInfo.SpecialStyle = Parsing.ParseInt(pair.Value) == 1;
break; break;
case @"WidescreenStoryboard": case @"WidescreenStoryboard":
beatmap.BeatmapInfo.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1; beatmap.BeatmapInfo.WidescreenStoryboard = Parsing.ParseInt(pair.Value) == 1;
break; break;
@ -162,15 +182,19 @@ namespace osu.Game.Beatmaps.Formats
case @"Bookmarks": case @"Bookmarks":
beatmap.BeatmapInfo.StoredBookmarks = pair.Value; beatmap.BeatmapInfo.StoredBookmarks = pair.Value;
break; break;
case @"DistanceSpacing": case @"DistanceSpacing":
beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value)); beatmap.BeatmapInfo.DistanceSpacing = Math.Max(0, Parsing.ParseDouble(pair.Value));
break; break;
case @"BeatDivisor": case @"BeatDivisor":
beatmap.BeatmapInfo.BeatDivisor = Parsing.ParseInt(pair.Value); beatmap.BeatmapInfo.BeatDivisor = Parsing.ParseInt(pair.Value);
break; break;
case @"GridSize": case @"GridSize":
beatmap.BeatmapInfo.GridSize = Parsing.ParseInt(pair.Value); beatmap.BeatmapInfo.GridSize = Parsing.ParseInt(pair.Value);
break; break;
case @"TimelineZoom": case @"TimelineZoom":
beatmap.BeatmapInfo.TimelineZoom = Math.Max(0, Parsing.ParseDouble(pair.Value)); beatmap.BeatmapInfo.TimelineZoom = Math.Max(0, Parsing.ParseDouble(pair.Value));
break; break;
@ -182,35 +206,45 @@ namespace osu.Game.Beatmaps.Formats
var pair = SplitKeyVal(line); var pair = SplitKeyVal(line);
var metadata = beatmap.BeatmapInfo.Metadata; var metadata = beatmap.BeatmapInfo.Metadata;
switch (pair.Key) switch (pair.Key)
{ {
case @"Title": case @"Title":
metadata.Title = pair.Value; metadata.Title = pair.Value;
break; break;
case @"TitleUnicode": case @"TitleUnicode":
metadata.TitleUnicode = pair.Value; metadata.TitleUnicode = pair.Value;
break; break;
case @"Artist": case @"Artist":
metadata.Artist = pair.Value; metadata.Artist = pair.Value;
break; break;
case @"ArtistUnicode": case @"ArtistUnicode":
metadata.ArtistUnicode = pair.Value; metadata.ArtistUnicode = pair.Value;
break; break;
case @"Creator": case @"Creator":
metadata.AuthorString = pair.Value; metadata.AuthorString = pair.Value;
break; break;
case @"Version": case @"Version":
beatmap.BeatmapInfo.Version = pair.Value; beatmap.BeatmapInfo.Version = pair.Value;
break; break;
case @"Source": case @"Source":
beatmap.BeatmapInfo.Metadata.Source = pair.Value; beatmap.BeatmapInfo.Metadata.Source = pair.Value;
break; break;
case @"Tags": case @"Tags":
beatmap.BeatmapInfo.Metadata.Tags = pair.Value; beatmap.BeatmapInfo.Metadata.Tags = pair.Value;
break; break;
case @"BeatmapID": case @"BeatmapID":
beatmap.BeatmapInfo.OnlineBeatmapID = Parsing.ParseInt(pair.Value); beatmap.BeatmapInfo.OnlineBeatmapID = Parsing.ParseInt(pair.Value);
break; break;
case @"BeatmapSetID": case @"BeatmapSetID":
beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = Parsing.ParseInt(pair.Value) }; beatmap.BeatmapInfo.BeatmapSet = new BeatmapSetInfo { OnlineBeatmapSetID = Parsing.ParseInt(pair.Value) };
break; break;
@ -222,23 +256,29 @@ namespace osu.Game.Beatmaps.Formats
var pair = SplitKeyVal(line); var pair = SplitKeyVal(line);
var difficulty = beatmap.BeatmapInfo.BaseDifficulty; var difficulty = beatmap.BeatmapInfo.BaseDifficulty;
switch (pair.Key) switch (pair.Key)
{ {
case @"HPDrainRate": case @"HPDrainRate":
difficulty.DrainRate = Parsing.ParseFloat(pair.Value); difficulty.DrainRate = Parsing.ParseFloat(pair.Value);
break; break;
case @"CircleSize": case @"CircleSize":
difficulty.CircleSize = Parsing.ParseFloat(pair.Value); difficulty.CircleSize = Parsing.ParseFloat(pair.Value);
break; break;
case @"OverallDifficulty": case @"OverallDifficulty":
difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value); difficulty.OverallDifficulty = Parsing.ParseFloat(pair.Value);
break; break;
case @"ApproachRate": case @"ApproachRate":
difficulty.ApproachRate = Parsing.ParseFloat(pair.Value); difficulty.ApproachRate = Parsing.ParseFloat(pair.Value);
break; break;
case @"SliderMultiplier": case @"SliderMultiplier":
difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value); difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value);
break; break;
case @"SliderTickRate": case @"SliderTickRate":
difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value); difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value);
break; break;
@ -259,6 +299,7 @@ namespace osu.Game.Beatmaps.Formats
string filename = split[2].Trim('"'); string filename = split[2].Trim('"');
beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(filename); beatmap.BeatmapInfo.Metadata.BackgroundFile = FileSafety.PathStandardise(filename);
break; break;
case EventType.Break: case EventType.Break:
double start = getOffsetTime(Parsing.ParseDouble(split[1])); double start = getOffsetTime(Parsing.ParseDouble(split[1]));
@ -308,6 +349,7 @@ namespace osu.Game.Beatmaps.Formats
bool kiaiMode = false; bool kiaiMode = false;
bool omitFirstBarSignature = false; bool omitFirstBarSignature = false;
if (split.Length >= 8) if (split.Length >= 8)
{ {
EffectFlags effectFlags = (EffectFlags)Parsing.ParseInt(split[7]); EffectFlags effectFlags = (EffectFlags)Parsing.ParseInt(split[7]);

View File

@ -26,6 +26,7 @@ namespace osu.Game.Beatmaps.Formats
Section section = Section.None; Section section = Section.None;
string line; string line;
while ((line = stream.ReadLine()) != null) while ((line = stream.ReadLine()) != null)
{ {
if (ShouldSkipLine(line)) if (ShouldSkipLine(line))

View File

@ -54,6 +54,7 @@ namespace osu.Game.Beatmaps.Formats
case Section.Events: case Section.Events:
handleEvents(line); handleEvents(line);
return; return;
case Section.Variables: case Section.Variables:
handleVariables(line); handleVariables(line);
return; return;
@ -65,6 +66,7 @@ namespace osu.Game.Beatmaps.Formats
private void handleEvents(string line) private void handleEvents(string line)
{ {
var depth = 0; var depth = 0;
while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal)) while (line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal))
{ {
++depth; ++depth;
@ -94,8 +96,9 @@ namespace osu.Game.Beatmaps.Formats
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo); var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo);
storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y)); storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y));
storyboard.GetLayer(layer).Add(storyboardSprite); storyboard.GetLayer(layer).Add(storyboardSprite);
}
break; break;
}
case EventType.Animation: case EventType.Animation:
{ {
var layer = parseLayer(split[1]); var layer = parseLayer(split[1]);
@ -108,8 +111,9 @@ namespace osu.Game.Beatmaps.Formats
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever; var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType); storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
storyboard.GetLayer(layer).Add(storyboardSprite); storyboard.GetLayer(layer).Add(storyboardSprite);
}
break; break;
}
case EventType.Sample: case EventType.Sample:
{ {
var time = double.Parse(split[1], CultureInfo.InvariantCulture); var time = double.Parse(split[1], CultureInfo.InvariantCulture);
@ -117,8 +121,8 @@ namespace osu.Game.Beatmaps.Formats
var path = cleanFilename(split[3]); var path = cleanFilename(split[3]);
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100; var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100;
storyboard.GetLayer(layer).Add(new StoryboardSample(path, time, volume)); storyboard.GetLayer(layer).Add(new StoryboardSample(path, time, volume));
}
break; break;
}
} }
} }
else else
@ -127,6 +131,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup = storyboardSprite?.TimelineGroup; timelineGroup = storyboardSprite?.TimelineGroup;
var commandType = split[0]; var commandType = split[0];
switch (commandType) switch (commandType)
{ {
case "T": case "T":
@ -138,6 +143,7 @@ namespace osu.Game.Beatmaps.Formats
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);
@ -145,6 +151,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount); timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount);
} }
break; break;
default: default:
{ {
if (string.IsNullOrEmpty(split[3])) if (string.IsNullOrEmpty(split[3]))
@ -163,6 +170,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue);
} }
break; break;
case "S": case "S":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -170,6 +178,7 @@ namespace osu.Game.Beatmaps.Formats
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":
{ {
var startX = float.Parse(split[4], CultureInfo.InvariantCulture); var startX = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -179,6 +188,7 @@ namespace osu.Game.Beatmaps.Formats
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":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -186,6 +196,7 @@ namespace osu.Game.Beatmaps.Formats
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":
{ {
var startX = float.Parse(split[4], CultureInfo.InvariantCulture); var startX = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -196,6 +207,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY); timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY);
} }
break; break;
case "MX": case "MX":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -203,6 +215,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue);
} }
break; break;
case "MY": case "MY":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -210,6 +223,7 @@ namespace osu.Game.Beatmaps.Formats
timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue);
} }
break; break;
case "C": case "C":
{ {
var startRed = float.Parse(split[4], CultureInfo.InvariantCulture); var startRed = float.Parse(split[4], CultureInfo.InvariantCulture);
@ -223,23 +237,28 @@ namespace osu.Game.Beatmaps.Formats
new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1)); new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1));
} }
break; break;
case "P": case "P":
{ {
var type = split[4]; var type = split[4];
switch (type) switch (type)
{ {
case "A": case "A":
timelineGroup?.BlendingMode.Add(easing, startTime, endTime, BlendingMode.Additive, startTime == endTime ? BlendingMode.Additive : BlendingMode.Inherit); timelineGroup?.BlendingMode.Add(easing, startTime, endTime, BlendingMode.Additive, startTime == endTime ? BlendingMode.Additive : BlendingMode.Inherit);
break; break;
case "H": case "H":
timelineGroup?.FlipH.Add(easing, startTime, endTime, true, startTime == endTime); timelineGroup?.FlipH.Add(easing, startTime, endTime, true, startTime == endTime);
break; break;
case "V": case "V":
timelineGroup?.FlipV.Add(easing, startTime, endTime, true, startTime == endTime); timelineGroup?.FlipV.Add(easing, startTime, endTime, true, startTime == endTime);
break; break;
} }
} }
break; break;
default: default:
throw new InvalidDataException($@"Unknown command type: {commandType}"); throw new InvalidDataException($@"Unknown command type: {commandType}");
} }
@ -254,26 +273,36 @@ namespace osu.Game.Beatmaps.Formats
private Anchor parseOrigin(string value) private Anchor parseOrigin(string value)
{ {
var origin = (LegacyOrigins)Enum.Parse(typeof(LegacyOrigins), value); var origin = (LegacyOrigins)Enum.Parse(typeof(LegacyOrigins), value);
switch (origin) switch (origin)
{ {
case LegacyOrigins.TopLeft: case LegacyOrigins.TopLeft:
return Anchor.TopLeft; return Anchor.TopLeft;
case LegacyOrigins.TopCentre: case LegacyOrigins.TopCentre:
return Anchor.TopCentre; return Anchor.TopCentre;
case LegacyOrigins.TopRight: case LegacyOrigins.TopRight:
return Anchor.TopRight; return Anchor.TopRight;
case LegacyOrigins.CentreLeft: case LegacyOrigins.CentreLeft:
return Anchor.CentreLeft; return Anchor.CentreLeft;
case LegacyOrigins.Centre: case LegacyOrigins.Centre:
return Anchor.Centre; return Anchor.Centre;
case LegacyOrigins.CentreRight: case LegacyOrigins.CentreRight:
return Anchor.CentreRight; return Anchor.CentreRight;
case LegacyOrigins.BottomLeft: case LegacyOrigins.BottomLeft:
return Anchor.BottomLeft; return Anchor.BottomLeft;
case LegacyOrigins.BottomCentre: case LegacyOrigins.BottomCentre:
return Anchor.BottomCentre; return Anchor.BottomCentre;
case LegacyOrigins.BottomRight: case LegacyOrigins.BottomRight:
return Anchor.BottomRight; return Anchor.BottomRight;
default: default:
return Anchor.TopLeft; return Anchor.TopLeft;
} }

View File

@ -44,6 +44,7 @@ namespace osu.Game.Configuration
base.AddBindable(lookup, bindable); base.AddBindable(lookup, bindable);
var setting = databasedSettings.Find(s => (int)s.Key == (int)(object)lookup); var setting = databasedSettings.Find(s => (int)s.Key == (int)(object)lookup);
if (setting != null) if (setting != null)
{ {
bindable.Parse(setting.Value); bindable.Parse(setting.Value);

View File

@ -84,6 +84,7 @@ namespace osu.Game.Database
private void flushEvents(bool perform) private void flushEvents(bool perform)
{ {
Action[] events; Action[] events;
lock (queuedEvents) lock (queuedEvents)
{ {
events = queuedEvents.ToArray(); events = queuedEvents.ToArray();
@ -147,6 +148,7 @@ namespace osu.Game.Database
List<TModel> imported = new List<TModel>(); List<TModel> imported = new List<TModel>();
int current = 0; int current = 0;
foreach (string path in paths) foreach (string path in paths)
{ {
if (notification.State == ProgressNotificationState.Cancelled) if (notification.State == ProgressNotificationState.Cancelled)

View File

@ -60,6 +60,7 @@ namespace osu.Game.Database
this.connectionString = connectionString; this.connectionString = connectionString;
var connection = Database.GetDbConnection(); var connection = Database.GetDbConnection();
try try
{ {
connection.Open(); connection.Open();
@ -170,9 +171,11 @@ namespace osu.Game.Database
default: default:
frameworkLogLevel = Framework.Logging.LogLevel.Debug; frameworkLogLevel = Framework.Logging.LogLevel.Debug;
break; break;
case LogLevel.Warning: case LogLevel.Warning:
frameworkLogLevel = Framework.Logging.LogLevel.Important; frameworkLogLevel = Framework.Logging.LogLevel.Important;
break; break;
case LogLevel.Error: case LogLevel.Error:
case LogLevel.Critical: case LogLevel.Critical:
frameworkLogLevel = Framework.Logging.LogLevel.Error; frameworkLogLevel = Framework.Logging.LogLevel.Error;

View File

@ -34,6 +34,7 @@ namespace osu.Game.Graphics.Containers
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0) if (InternalChildren.Count > 0 && InternalChild.DrawSize.X > 0)
{ {
// We're modifying scale here for a few reasons // We're modifying scale here for a few reasons

View File

@ -51,6 +51,7 @@ namespace osu.Game.Graphics.Containers
} }
int previousLinkEnd = 0; int previousLinkEnd = 0;
foreach (var link in links) foreach (var link in links)
{ {
AddText(text.Substring(previousLinkEnd, link.Index - previousLinkEnd)); AddText(text.Substring(previousLinkEnd, link.Index - previousLinkEnd));
@ -90,10 +91,12 @@ namespace osu.Game.Graphics.Containers
if (linkArgument != null && int.TryParse(linkArgument.Contains('?') ? linkArgument.Split('?')[0] : linkArgument, out int beatmapId)) if (linkArgument != null && int.TryParse(linkArgument.Contains('?') ? linkArgument.Split('?')[0] : linkArgument, out int beatmapId))
game?.ShowBeatmap(beatmapId); game?.ShowBeatmap(beatmapId);
break; break;
case LinkAction.OpenBeatmapSet: case LinkAction.OpenBeatmapSet:
if (int.TryParse(linkArgument, out int setId)) if (int.TryParse(linkArgument, out int setId))
game?.ShowBeatmapSet(setId); game?.ShowBeatmapSet(setId);
break; break;
case LinkAction.OpenChannel: case LinkAction.OpenChannel:
try try
{ {
@ -105,18 +108,22 @@ namespace osu.Game.Graphics.Containers
} }
break; break;
case LinkAction.OpenEditorTimestamp: case LinkAction.OpenEditorTimestamp:
case LinkAction.JoinMultiplayerMatch: case LinkAction.JoinMultiplayerMatch:
case LinkAction.Spectate: case LinkAction.Spectate:
showNotImplementedError?.Invoke(); showNotImplementedError?.Invoke();
break; break;
case LinkAction.External: case LinkAction.External:
game?.OpenUrlExternally(url); game?.OpenUrlExternally(url);
break; break;
case LinkAction.OpenUserProfile: case LinkAction.OpenUserProfile:
if (long.TryParse(linkArgument, out long userId)) if (long.TryParse(linkArgument, out long userId))
game?.ShowUser(userId); game?.ShowUser(userId);
break; break;
default: default:
throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action."); throw new NotImplementedException($"This {nameof(LinkAction)} ({linkType.ToString()}) is missing an associated action.");
} }

View File

@ -150,6 +150,7 @@ namespace osu.Game.Graphics.Containers
float headerH = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0); float headerH = (ExpandableHeader?.LayoutSize.Y ?? 0) + (FixedHeader?.LayoutSize.Y ?? 0);
float footerH = Footer?.LayoutSize.Y ?? 0; float footerH = Footer?.LayoutSize.Y ?? 0;
if (headerH != headerHeight || footerH != footerHeight) if (headerH != headerHeight || footerH != footerHeight)
{ {
headerHeight = headerH; headerHeight = headerH;
@ -181,6 +182,7 @@ namespace osu.Game.Graphics.Containers
foreach (var section in Children) foreach (var section in Children)
{ {
float diff = Math.Abs(scrollContainer.GetChildPosInContent(section) - currentScroll - scrollOffset); float diff = Math.Abs(scrollContainer.GetChildPosInContent(section) - currentScroll - scrollOffset);
if (diff < minDiff) if (diff < minDiff)
{ {
minDiff = diff; minDiff = diff;

View File

@ -45,10 +45,12 @@ namespace osu.Game.Graphics.Cursor
{ {
var position = e.MousePosition; var position = e.MousePosition;
var distance = Vector2Extensions.Distance(position, positionMouseDown); var distance = Vector2Extensions.Distance(position, positionMouseDown);
// don't start rotating until we're moved a minimum distance away from the mouse down location, // don't start rotating until we're moved a minimum distance away from the mouse down location,
// else it can have an annoying effect. // else it can have an annoying effect.
if (dragRotationState == DragRotationState.DragStarted && distance > 30) if (dragRotationState == DragRotationState.DragStarted && distance > 30)
dragRotationState = DragRotationState.Rotating; dragRotationState = DragRotationState.Rotating;
// don't rotate when distance is zero to avoid NaN // don't rotate when distance is zero to avoid NaN
if (dragRotationState == DragRotationState.Rotating && distance > 0) if (dragRotationState == DragRotationState.Rotating && distance > 0)
{ {

View File

@ -37,6 +37,7 @@ namespace osu.Game.Graphics.Cursor
if (value == text.Text) return; if (value == text.Text) return;
text.Text = value; text.Text = value;
if (IsPresent) if (IsPresent)
{ {
AutoSizeDuration = 250; AutoSizeDuration = 250;

View File

@ -54,9 +54,11 @@ namespace osu.Game.Graphics
var diffToNow = DateTimeOffset.Now.Subtract(Date); var diffToNow = DateTimeOffset.Now.Subtract(Date);
double timeUntilNextUpdate = 1000; double timeUntilNextUpdate = 1000;
if (Math.Abs(diffToNow.TotalSeconds) > 120) if (Math.Abs(diffToNow.TotalSeconds) > 120)
{ {
timeUntilNextUpdate *= 60; timeUntilNextUpdate *= 60;
if (Math.Abs(diffToNow.TotalMinutes) > 120) if (Math.Abs(diffToNow.TotalMinutes) > 120)
{ {
timeUntilNextUpdate *= 60; timeUntilNextUpdate *= 60;

View File

@ -25,6 +25,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
direction = value; direction = value;
base.Direction = direction.HasFlag(BarDirection.Horizontal) ? FillDirection.Vertical : FillDirection.Horizontal; base.Direction = direction.HasFlag(BarDirection.Horizontal) ? FillDirection.Vertical : FillDirection.Horizontal;
foreach (var bar in Children) foreach (var bar in Children)
{ {
bar.Size = direction.HasFlag(BarDirection.Horizontal) ? 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);
@ -41,6 +42,7 @@ namespace osu.Game.Graphics.UserInterface
set set
{ {
List<Bar> bars = Children.ToList(); List<Bar> bars = Children.ToList();
foreach (var bar in value.Select((length, index) => new { Value = length, Bar = bars.Count > index ? bars[index] : null })) foreach (var bar in value.Select((length, index) => new { Value = length, Bar = bars.Count > index ? bars[index] : null }))
{ {
float length = MaxValue ?? value.Max(); float length = MaxValue ?? value.Max();

View File

@ -86,6 +86,7 @@ namespace osu.Game.Graphics.UserInterface
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
if (!pathCached.IsValid) if (!pathCached.IsValid)
{ {
applyPath(); applyPath();

View File

@ -203,6 +203,7 @@ namespace osu.Game.Graphics.UserInterface
private int findPrecision(decimal d) private int findPrecision(decimal d)
{ {
int precision = 0; int precision = 0;
while (d != Math.Round(d)) while (d != Math.Round(d))
{ {
d *= 10; d *= 10;

View File

@ -100,6 +100,7 @@ namespace osu.Game.Graphics.UserInterface
public void StopAnimation() public void StopAnimation()
{ {
int i = 0; int i = 0;
foreach (var star in stars.Children) foreach (var star in stars.Children)
{ {
star.ClearTransforms(true); star.ClearTransforms(true);
@ -120,6 +121,7 @@ namespace osu.Game.Graphics.UserInterface
private void transformCount(float newValue) private void transformCount(float newValue)
{ {
int i = 0; int i = 0;
foreach (var star in stars.Children) foreach (var star in stars.Children)
{ {
star.ClearTransforms(true); star.ClearTransforms(true);

View File

@ -85,6 +85,7 @@ namespace osu.Game.IO.Legacy
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
{ {
T obj = new T(); T obj = new T();
try try
{ {
obj.ReadFromStream(sr); obj.ReadFromStream(sr);
@ -129,44 +130,63 @@ namespace osu.Game.IO.Legacy
public object ReadObject() public object ReadObject()
{ {
ObjType t = (ObjType)ReadByte(); ObjType t = (ObjType)ReadByte();
switch (t) switch (t)
{ {
case ObjType.boolType: case ObjType.boolType:
return ReadBoolean(); return ReadBoolean();
case ObjType.byteType: case ObjType.byteType:
return ReadByte(); return ReadByte();
case ObjType.uint16Type: case ObjType.uint16Type:
return ReadUInt16(); return ReadUInt16();
case ObjType.uint32Type: case ObjType.uint32Type:
return ReadUInt32(); return ReadUInt32();
case ObjType.uint64Type: case ObjType.uint64Type:
return ReadUInt64(); return ReadUInt64();
case ObjType.sbyteType: case ObjType.sbyteType:
return ReadSByte(); return ReadSByte();
case ObjType.int16Type: case ObjType.int16Type:
return ReadInt16(); return ReadInt16();
case ObjType.int32Type: case ObjType.int32Type:
return ReadInt32(); return ReadInt32();
case ObjType.int64Type: case ObjType.int64Type:
return ReadInt64(); return ReadInt64();
case ObjType.charType: case ObjType.charType:
return ReadChar(); return ReadChar();
case ObjType.stringType: case ObjType.stringType:
return base.ReadString(); return base.ReadString();
case ObjType.singleType: case ObjType.singleType:
return ReadSingle(); return ReadSingle();
case ObjType.doubleType: case ObjType.doubleType:
return ReadDouble(); return ReadDouble();
case ObjType.decimalType: case ObjType.decimalType:
return ReadDecimal(); return ReadDecimal();
case ObjType.dateTimeType: case ObjType.dateTimeType:
return ReadDateTime(); return ReadDateTime();
case ObjType.byteArrayType: case ObjType.byteArrayType:
return ReadByteArray(); return ReadByteArray();
case ObjType.charArrayType: case ObjType.charArrayType:
return ReadCharArray(); return ReadCharArray();
case ObjType.otherType: case ObjType.otherType:
return DynamicDeserializer.Deserialize(BaseStream); return DynamicDeserializer.Deserialize(BaseStream);
default: default:
return null; return null;
} }
@ -241,6 +261,7 @@ namespace osu.Game.IO.Legacy
string toAssemblyName = assemblyName.Split(',')[0]; string toAssemblyName = assemblyName.Split(',')[0];
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly a in assemblies) foreach (Assembly a in assemblies)
{ {
if (a.FullName.Split(',')[0] == toAssemblyName) if (a.FullName.Split(',')[0] == toAssemblyName)

View File

@ -111,6 +111,7 @@ namespace osu.Game.IO.Legacy
else else
{ {
Write(d.Count); Write(d.Count);
foreach (KeyValuePair<T, U> kvp in d) foreach (KeyValuePair<T, U> kvp in d)
{ {
WriteObject(kvp.Key); WriteObject(kvp.Key);

View File

@ -65,6 +65,7 @@ namespace osu.Game.IO.Serialization.Converters
var lookupTable = new List<string>(); var lookupTable = new List<string>();
var objects = new List<JObject>(); var objects = new List<JObject>();
foreach (var item in list) foreach (var item in list)
{ {
var type = item.GetType(); var type = item.GetType();
@ -75,6 +76,7 @@ namespace osu.Game.IO.Serialization.Converters
typeString += $", {assemblyName.Version}"; typeString += $", {assemblyName.Version}";
int typeId = lookupTable.IndexOf(typeString); int typeId = lookupTable.IndexOf(typeString);
if (typeId == -1) if (typeId == -1)
{ {
lookupTable.Add(typeString); lookupTable.Add(typeString);

View File

@ -113,6 +113,7 @@ namespace osu.Game.Online.API
} }
break; break;
case APIState.Offline: case APIState.Offline:
case APIState.Connecting: case APIState.Connecting:
//work to restore a connection... //work to restore a connection...
@ -300,6 +301,7 @@ namespace osu.Game.Online.API
case HttpStatusCode.Unauthorized: case HttpStatusCode.Unauthorized:
Logout(); Logout();
return true; return true;
case HttpStatusCode.RequestTimeout: case HttpStatusCode.RequestTimeout:
failureCount++; failureCount++;
log.Add($@"API failure count is now {failureCount}"); log.Add($@"API failure count is now {failureCount}");

View File

@ -72,26 +72,33 @@ namespace osu.Game.Online.API.Requests.Responses
foreach (var kvp in value) foreach (var kvp in value)
{ {
HitResult newKey; HitResult newKey;
switch (kvp.Key) switch (kvp.Key)
{ {
case @"count_geki": case @"count_geki":
CountGeki = kvp.Value; CountGeki = kvp.Value;
break; break;
case @"count_300": case @"count_300":
Count300 = kvp.Value; Count300 = kvp.Value;
break; break;
case @"count_katu": case @"count_katu":
CountKatu = kvp.Value; CountKatu = kvp.Value;
break; break;
case @"count_100": case @"count_100":
Count100 = kvp.Value; Count100 = kvp.Value;
break; break;
case @"count_50": case @"count_50":
Count50 = kvp.Value; Count50 = kvp.Value;
break; break;
case @"count_miss": case @"count_miss":
CountMiss = kvp.Value; CountMiss = kvp.Value;
break; break;
default: default:
continue; continue;
} }

View File

@ -51,6 +51,7 @@ namespace osu.Game.Online.Chat
private static void handleMatches(Regex regex, string display, string link, MessageFormatterResult result, int startIndex = 0, LinkAction? linkActionOverride = null) private static void handleMatches(Regex regex, string display, string link, MessageFormatterResult result, int startIndex = 0, LinkAction? linkActionOverride = null)
{ {
int captureOffset = 0; int captureOffset = 0;
foreach (Match m in regex.Matches(result.Text, startIndex)) foreach (Match m in regex.Matches(result.Text, startIndex))
{ {
var index = m.Index - captureOffset; var index = m.Index - captureOffset;
@ -114,51 +115,63 @@ namespace osu.Game.Online.Chat
case "b": case "b":
case "beatmaps": case "beatmaps":
return new LinkDetails(LinkAction.OpenBeatmap, args[3]); return new LinkDetails(LinkAction.OpenBeatmap, args[3]);
case "s": case "s":
case "beatmapsets": case "beatmapsets":
case "d": case "d":
return new LinkDetails(LinkAction.OpenBeatmapSet, args[3]); return new LinkDetails(LinkAction.OpenBeatmapSet, args[3]);
case "u": case "u":
return new LinkDetails(LinkAction.OpenUserProfile, args[3]); return new LinkDetails(LinkAction.OpenUserProfile, args[3]);
} }
} }
return new LinkDetails(LinkAction.External, null); return new LinkDetails(LinkAction.External, null);
case "osu": case "osu":
// every internal link also needs some kind of argument // every internal link also needs some kind of argument
if (args.Length < 3) if (args.Length < 3)
return new LinkDetails(LinkAction.External, null); return new LinkDetails(LinkAction.External, null);
LinkAction linkType; LinkAction linkType;
switch (args[1]) switch (args[1])
{ {
case "chan": case "chan":
linkType = LinkAction.OpenChannel; linkType = LinkAction.OpenChannel;
break; break;
case "edit": case "edit":
linkType = LinkAction.OpenEditorTimestamp; linkType = LinkAction.OpenEditorTimestamp;
break; break;
case "b": case "b":
linkType = LinkAction.OpenBeatmap; linkType = LinkAction.OpenBeatmap;
break; break;
case "s": case "s":
case "dl": case "dl":
linkType = LinkAction.OpenBeatmapSet; linkType = LinkAction.OpenBeatmapSet;
break; break;
case "spectate": case "spectate":
linkType = LinkAction.Spectate; linkType = LinkAction.Spectate;
break; break;
case "u": case "u":
linkType = LinkAction.OpenUserProfile; linkType = LinkAction.OpenUserProfile;
break; break;
default: default:
linkType = LinkAction.External; linkType = LinkAction.External;
break; break;
} }
return new LinkDetails(linkType, args[2]); return new LinkDetails(linkType, args[2]);
case "osump": case "osump":
return new LinkDetails(LinkAction.JoinMultiplayerMatch, args[1]); return new LinkDetails(LinkAction.JoinMultiplayerMatch, args[1]);
default: default:
return new LinkDetails(LinkAction.External, null); return new LinkDetails(LinkAction.External, null);
} }

View File

@ -74,6 +74,7 @@ namespace osu.Game.Online.Leaderboards
scrollContainer.Add(scrollFlow); scrollContainer.Add(scrollFlow);
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))
@ -138,18 +139,23 @@ namespace osu.Game.Online.Leaderboards
OnRetry = UpdateScores, OnRetry = UpdateScores,
}); });
break; break;
case PlaceholderState.Unavailable: case PlaceholderState.Unavailable:
replacePlaceholder(new MessagePlaceholder(@"Leaderboards are not available for this beatmap!")); replacePlaceholder(new MessagePlaceholder(@"Leaderboards are not available for this beatmap!"));
break; break;
case PlaceholderState.NoScores: case PlaceholderState.NoScores:
replacePlaceholder(new MessagePlaceholder(@"No records yet!")); replacePlaceholder(new MessagePlaceholder(@"No records yet!"));
break; break;
case PlaceholderState.NotLoggedIn: case PlaceholderState.NotLoggedIn:
replacePlaceholder(new MessagePlaceholder(@"Please sign in to view online leaderboards!")); replacePlaceholder(new MessagePlaceholder(@"Please sign in to view online leaderboards!"));
break; break;
case PlaceholderState.NotSupporter: case PlaceholderState.NotSupporter:
replacePlaceholder(new MessagePlaceholder(@"Please invest in an osu!supporter tag to view this leaderboard!")); replacePlaceholder(new MessagePlaceholder(@"Please invest in an osu!supporter tag to view this leaderboard!"));
break; break;
default: default:
replacePlaceholder(null); replacePlaceholder(null);
break; break;

View File

@ -271,6 +271,7 @@ namespace osu.Game
{ {
var databasedScore = ScoreManager.GetScore(score); var databasedScore = ScoreManager.GetScore(score);
var databasedScoreInfo = databasedScore.ScoreInfo; var databasedScoreInfo = databasedScore.ScoreInfo;
if (databasedScore.Replay == null) if (databasedScore.Replay == null)
{ {
Logger.Log("The loaded score has no replay data.", LoggingTarget.Information); Logger.Log("The loaded score has no replay data.", LoggingTarget.Information);
@ -278,6 +279,7 @@ namespace osu.Game
} }
var databasedBeatmap = BeatmapManager.QueryBeatmap(b => b.ID == databasedScoreInfo.Beatmap.ID); var databasedBeatmap = BeatmapManager.QueryBeatmap(b => b.ID == databasedScoreInfo.Beatmap.ID);
if (databasedBeatmap == null) if (databasedBeatmap == null)
{ {
Logger.Log("Tried to load a score for a beatmap we don't have!", LoggingTarget.Information); Logger.Log("Tried to load a score for a beatmap we don't have!", LoggingTarget.Information);
@ -661,9 +663,11 @@ namespace osu.Game
case GlobalAction.ToggleChat: case GlobalAction.ToggleChat:
chatOverlay.ToggleVisibility(); chatOverlay.ToggleVisibility();
return true; return true;
case GlobalAction.ToggleSocial: case GlobalAction.ToggleSocial:
social.ToggleVisibility(); social.ToggleVisibility();
return true; return true;
case GlobalAction.ResetInputSettings: case GlobalAction.ResetInputSettings:
var sensitivity = frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity); var sensitivity = frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity);
@ -674,15 +678,19 @@ namespace osu.Game
frameworkConfig.Set(FrameworkSetting.IgnoredInputHandlers, string.Empty); frameworkConfig.Set(FrameworkSetting.IgnoredInputHandlers, string.Empty);
frameworkConfig.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault(); frameworkConfig.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault();
return true; return true;
case GlobalAction.ToggleToolbar: case GlobalAction.ToggleToolbar:
Toolbar.ToggleVisibility(); Toolbar.ToggleVisibility();
return true; return true;
case GlobalAction.ToggleSettings: case GlobalAction.ToggleSettings:
settings.ToggleVisibility(); settings.ToggleVisibility();
return true; return true;
case GlobalAction.ToggleDirect: case GlobalAction.ToggleDirect:
direct.ToggleVisibility(); direct.ToggleVisibility();
return true; return true;
case GlobalAction.ToggleGameplayMouseButtons: case GlobalAction.ToggleGameplayMouseButtons:
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons)); LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons));
return true; return true;
@ -758,6 +766,7 @@ namespace osu.Game
case Intro intro: case Intro intro:
introScreen = intro; introScreen = intro;
break; break;
case MainMenu menu: case MainMenu menu:
menuScreen = menu; menuScreen = menu;
break; break;

View File

@ -209,6 +209,7 @@ namespace osu.Game.Overlays.AccountCreation
private bool focusNextTextbox() private bool focusNextTextbox()
{ {
var nextTextbox = nextUnfilledTextbox(); var nextTextbox = nextUnfilledTextbox();
if (nextTextbox != null) if (nextTextbox != null)
{ {
Schedule(() => GetContainingInputManager().ChangeFocus(nextTextbox)); Schedule(() => GetContainingInputManager().ChangeFocus(nextTextbox));

View File

@ -99,6 +99,7 @@ namespace osu.Game.Overlays.Chat
private void pendingMessageResolved(Message existing, Message updated) private void pendingMessageResolved(Message existing, Message updated)
{ {
var found = ChatLineFlow.Children.LastOrDefault(c => c.Message == existing); var found = ChatLineFlow.Children.LastOrDefault(c => c.Message == existing);
if (found != null) if (found != null)
{ {
Trace.Assert(updated.Id.HasValue, "An updated message was returned with no ID."); Trace.Assert(updated.Id.HasValue, "An updated message was returned with no ID.");

View File

@ -205,6 +205,7 @@ namespace osu.Game.Overlays
Scheduler.Add(() => channelTabControl.Current.Value = e.NewValue); Scheduler.Add(() => channelTabControl.Current.Value = e.NewValue);
var loaded = loadedChannels.Find(d => d.Channel == e.NewValue); var loaded = loadedChannels.Find(d => d.Channel == e.NewValue);
if (loaded == null) if (loaded == null)
{ {
currentChannelContainer.FadeOut(500, Easing.OutQuint); currentChannelContainer.FadeOut(500, Easing.OutQuint);
@ -288,6 +289,7 @@ namespace osu.Game.Overlays
case Key.Number9: case Key.Number9:
selectTab((int)e.Key - (int)Key.Number1); selectTab((int)e.Key - (int)Key.Number1);
return true; return true;
case Key.Number0: case Key.Number0:
selectTab(9); selectTab(9);
return true; return true;

View File

@ -72,6 +72,7 @@ namespace osu.Game.Overlays.Dialog
set set
{ {
buttonsContainer.ChildrenEnumerable = value; buttonsContainer.ChildrenEnumerable = value;
foreach (PopupDialogButton b in value) foreach (PopupDialogButton b in value)
{ {
var action = b.Action; var action = b.Action;
@ -222,6 +223,7 @@ namespace osu.Game.Overlays.Dialog
// press button at number if 1-9 on number row or keypad are pressed // press button at number if 1-9 on number row or keypad are pressed
var k = e.Key; var k = e.Key;
if (k >= Key.Number1 && k <= Key.Number9) if (k >= Key.Number1 && k <= Key.Number9)
{ {
pressButtonAtIndex(k - Key.Number1); pressButtonAtIndex(k - Key.Number1);

View File

@ -58,6 +58,7 @@ namespace osu.Game.Overlays
var artists = new List<string>(); var artists = new List<string>();
var songs = new List<string>(); var songs = new List<string>();
var tags = new List<string>(); var tags = new List<string>();
foreach (var s in beatmapSets) foreach (var s in beatmapSets)
{ {
artists.Add(s.Metadata.Artist); artists.Add(s.Metadata.Artist);
@ -210,6 +211,7 @@ namespace osu.Game.Overlays
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
}; };
default: default:
return new DirectListPanel(b); return new DirectListPanel(b);
} }

View File

@ -117,6 +117,7 @@ namespace osu.Game.Overlays.KeyBinding
public void RestoreDefaults() public void RestoreDefaults()
{ {
int i = 0; int i = 0;
foreach (var d in Defaults) foreach (var d in Defaults)
{ {
var button = buttons[i++]; var button = buttons[i++];

View File

@ -81,6 +81,7 @@ namespace osu.Game.Overlays.Mods
backgroundIcon.RotateTo(-rotate_angle * direction, mod_switch_duration, mod_switch_easing); backgroundIcon.RotateTo(-rotate_angle * direction, mod_switch_duration, mod_switch_easing);
backgroundIcon.Icon = modAfter.Icon; backgroundIcon.Icon = modAfter.Icon;
using (BeginDelayedSequence(mod_switch_duration, true)) using (BeginDelayedSequence(mod_switch_duration, true))
{ {
foregroundIcon foregroundIcon
@ -139,6 +140,7 @@ namespace osu.Game.Overlays.Mods
} }
createIcons(); createIcons();
if (Mods.Length > 0) if (Mods.Length > 0)
{ {
displayMod(Mods[0]); displayMod(Mods[0]);
@ -168,6 +170,7 @@ namespace osu.Game.Overlays.Mods
case MouseButton.Left: case MouseButton.Left:
SelectNext(1); SelectNext(1);
break; break;
case MouseButton.Right: case MouseButton.Right:
SelectNext(-1); SelectNext(-1);
break; break;
@ -219,6 +222,7 @@ namespace osu.Game.Overlays.Mods
private void createIcons() private void createIcons()
{ {
iconsContainer.Clear(); iconsContainer.Clear();
if (Mods.Length > 1) if (Mods.Length > 1)
{ {
iconsContainer.AddRange(new[] iconsContainer.AddRange(new[]

View File

@ -77,6 +77,7 @@ namespace osu.Game.Overlays.Mods
public void DeselectTypes(IEnumerable<Type> modTypes, bool immediate = false) public void DeselectTypes(IEnumerable<Type> modTypes, bool immediate = false)
{ {
int delay = 0; int delay = 0;
foreach (var button in buttons) foreach (var button in buttons)
{ {
Mod selected = button.SelectedMod; Mod selected = button.SelectedMod;

View File

@ -190,6 +190,7 @@ namespace osu.Game.Overlays.Music
// the item positions as they are being transformed // the item positions as they are being transformed
float heightAccumulator = 0; float heightAccumulator = 0;
int dstIndex = 0; int dstIndex = 0;
for (; dstIndex < items.Count; dstIndex++) for (; dstIndex < items.Count; dstIndex++)
{ {
// Using BoundingBox here takes care of scale, paddings, etc... // Using BoundingBox here takes care of scale, paddings, etc...

View File

@ -81,6 +81,7 @@ namespace osu.Game.Overlays.Music
filter.Search.OnCommit = (sender, newText) => filter.Search.OnCommit = (sender, newText) =>
{ {
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault(); BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
if (toSelect != null) if (toSelect != null)
{ {
beatmap.Value = beatmaps.GetWorkingBeatmap(toSelect); beatmap.Value = beatmaps.GetWorkingBeatmap(toSelect);

View File

@ -296,6 +296,7 @@ namespace osu.Game.Overlays
queuedDirection = TransformDirection.Prev; queuedDirection = TransformDirection.Prev;
var playable = beatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? beatmapSets.LastOrDefault(); var playable = beatmapSets.TakeWhile(i => i.ID != current.BeatmapSetInfo.ID).LastOrDefault() ?? beatmapSets.LastOrDefault();
if (playable != null) if (playable != null)
{ {
beatmap.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value); beatmap.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
@ -309,6 +310,7 @@ namespace osu.Game.Overlays
queuedDirection = TransformDirection.Next; queuedDirection = TransformDirection.Next;
var playable = beatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? beatmapSets.FirstOrDefault(); var playable = beatmapSets.SkipWhile(i => i.ID != current.BeatmapSetInfo.ID).Skip(1).FirstOrDefault() ?? beatmapSets.FirstOrDefault();
if (playable != null) if (playable != null)
{ {
beatmap.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value); beatmap.Value = beatmaps.GetWorkingBeatmap(playable.Beatmaps.First(), beatmap.Value);
@ -399,6 +401,7 @@ namespace osu.Game.Overlays
newBackground.MoveToX(0, 500, Easing.OutCubic); newBackground.MoveToX(0, 500, Easing.OutCubic);
background.MoveToX(-400, 500, Easing.OutCubic); background.MoveToX(-400, 500, Easing.OutCubic);
break; break;
case TransformDirection.Prev: case TransformDirection.Prev:
newBackground.Position = new Vector2(-400, 0); newBackground.Position = new Vector2(-400, 0);
newBackground.MoveToX(0, 500, Easing.OutCubic); newBackground.MoveToX(0, 500, Easing.OutCubic);

View File

@ -106,6 +106,7 @@ namespace osu.Game.Overlays.Profile.Header
visibleBadge = 0; visibleBadge = 0;
badgeFlowContainer.Clear(); badgeFlowContainer.Clear();
for (var index = 0; index < badges.Length; index++) for (var index = 0; index < badges.Length; index++)
{ {
int displayIndex = index; int displayIndex = index;

View File

@ -408,6 +408,7 @@ namespace osu.Game.Overlays.Profile
infoTextLeft.AddLink("forum post".ToQuantity(user.PostCount), url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic); infoTextLeft.AddLink("forum post".ToQuantity(user.PostCount), url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic);
string websiteWithoutProtcol = user.Website; string websiteWithoutProtcol = user.Website;
if (!string.IsNullOrEmpty(websiteWithoutProtcol)) if (!string.IsNullOrEmpty(websiteWithoutProtcol))
{ {
int protocolIndex = websiteWithoutProtcol.IndexOf("//", StringComparison.Ordinal); int protocolIndex = websiteWithoutProtcol.IndexOf("//", StringComparison.Ordinal);
@ -468,14 +469,11 @@ namespace osu.Game.Overlays.Profile
if (string.IsNullOrEmpty(str)) return; if (string.IsNullOrEmpty(str)) return;
infoTextRight.AddIcon(icon); infoTextRight.AddIcon(icon);
if (url != null) if (url != null)
{
infoTextRight.AddLink(" " + str, url); infoTextRight.AddLink(" " + str, url);
}
else else
{
infoTextRight.AddText(" " + str); infoTextRight.AddText(" " + str);
}
infoTextRight.NewLine(); infoTextRight.NewLine();
} }

View File

@ -64,6 +64,7 @@ namespace osu.Game.Overlays.Settings
{ {
bindable = value; bindable = value;
controlWithCurrent?.Current.BindTo(bindable); controlWithCurrent?.Current.BindTo(bindable);
if (ShowsDefaultIndicator) if (ShowsDefaultIndicator)
{ {
restoreDefaultButton.Bindable = bindable.GetBoundCopy(); restoreDefaultButton.Bindable = bindable.GetBoundCopy();

View File

@ -46,6 +46,7 @@ namespace osu.Game.Overlays.Settings
set set
{ {
selected = value; selected = value;
if (selected) if (selected)
{ {
selectionIndicator.FadeIn(50); selectionIndicator.FadeIn(50);

View File

@ -111,6 +111,7 @@ namespace osu.Game.Overlays
ChildrenEnumerable = Users.Select(u => ChildrenEnumerable = Users.Select(u =>
{ {
SocialPanel panel; SocialPanel panel;
switch (displayStyle) switch (displayStyle)
{ {
case PanelDisplayStyle.Grid: case PanelDisplayStyle.Grid:
@ -120,6 +121,7 @@ namespace osu.Game.Overlays
Origin = Anchor.TopCentre Origin = Anchor.TopCentre
}; };
break; break;
default: default:
panel = new SocialListPanel(u); panel = new SocialListPanel(u);
break; break;
@ -167,6 +169,7 @@ namespace osu.Game.Overlays
friendRequest.Success += updateUsers; friendRequest.Success += updateUsers;
api.Queue(getUsersRequest = friendRequest); api.Queue(getUsersRequest = friendRequest);
break; break;
default: default:
var userRequest = new GetUsersRequest(); // TODO filter arguments! var userRequest = new GetUsersRequest(); // TODO filter arguments!
userRequest.Success += response => updateUsers(response.Select(r => r.User)); userRequest.Success += response => updateUsers(response.Select(r => r.User));
@ -200,6 +203,7 @@ namespace osu.Game.Overlays
case APIState.Online: case APIState.Online:
Scheduler.AddOnce(updateSearch); Scheduler.AddOnce(updateSearch);
break; break;
default: default:
Users = null; Users = null;
clearPanels(); clearPanels();

View File

@ -21,6 +21,7 @@ namespace osu.Game.Overlays.Toolbar
set set
{ {
stateContainer = value; stateContainer = value;
if (stateContainer != null) if (stateContainer != null)
{ {
Action = stateContainer.ToggleVisibility; Action = stateContainer.ToggleVisibility;
@ -55,6 +56,7 @@ namespace osu.Game.Overlays.Toolbar
case Visibility.Hidden: case Visibility.Hidden:
stateBackground.FadeOut(200); stateBackground.FadeOut(200);
break; break;
case Visibility.Visible: case Visibility.Visible:
stateBackground.FadeIn(200); stateBackground.FadeIn(200);
break; break;

View File

@ -71,6 +71,7 @@ namespace osu.Game.Overlays.Toolbar
private void load(RulesetStore rulesets, Bindable<RulesetInfo> parentRuleset) private void load(RulesetStore rulesets, Bindable<RulesetInfo> parentRuleset)
{ {
this.rulesets = rulesets; this.rulesets = rulesets;
foreach (var r in rulesets.AvailableRulesets) foreach (var r in rulesets.AvailableRulesets)
{ {
modeButtons.Add(new ToolbarRulesetButton modeButtons.Add(new ToolbarRulesetButton

View File

@ -176,6 +176,7 @@ namespace osu.Game.Overlays
foreach (string id in user.ProfileOrder) foreach (string id in user.ProfileOrder)
{ {
var sec = sections.FirstOrDefault(s => s.Identifier == id); var sec = sections.FirstOrDefault(s => s.Identifier == id);
if (sec != null) if (sec != null)
{ {
sec.User.Value = user; sec.User.Value = user;

View File

@ -71,12 +71,14 @@ namespace osu.Game.Rulesets.Edit
if (state == value) return; if (state == value) return;
state = value; state = value;
switch (state) switch (state)
{ {
case SelectionState.Selected: case SelectionState.Selected:
Show(); Show();
Selected?.Invoke(this); Selected?.Invoke(this);
break; break;
case SelectionState.NotSelected: case SelectionState.NotSelected:
Hide(); Hide();
Deselected?.Invoke(this); Deselected?.Invoke(this);

View File

@ -97,6 +97,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
private void load() private void load()
{ {
var judgement = HitObject.CreateJudgement(); var judgement = HitObject.CreateJudgement();
if (judgement != null) if (judgement != null)
{ {
Result = CreateResult(judgement); Result = CreateResult(judgement);
@ -211,9 +212,11 @@ namespace osu.Game.Rulesets.Objects.Drawables
{ {
case HitResult.None: case HitResult.None:
break; break;
case HitResult.Miss: case HitResult.Miss:
State.Value = ArmedState.Miss; State.Value = ArmedState.Miss;
break; break;
default: default:
State.Value = ArmedState.Hit; State.Value = ArmedState.Hit;
break; break;

View File

@ -84,6 +84,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
var points = new Vector2[pointCount]; var points = new Vector2[pointCount];
int pointIndex = 1; int pointIndex = 1;
foreach (string t in pointSplit) foreach (string t in pointSplit)
{ {
if (t.Length == 1) if (t.Length == 1)
@ -93,12 +94,15 @@ namespace osu.Game.Rulesets.Objects.Legacy
case @"C": case @"C":
pathType = PathType.Catmull; pathType = PathType.Catmull;
break; break;
case @"B": case @"B":
pathType = PathType.Bezier; pathType = PathType.Bezier;
break; break;
case @"L": case @"L":
pathType = PathType.Linear; pathType = PathType.Linear;
break; break;
case @"P": case @"P":
pathType = PathType.PerfectCurve; pathType = PathType.PerfectCurve;
break; break;
@ -143,6 +147,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (split.Length > 9 && split[9].Length > 0) if (split.Length > 9 && split[9].Length > 0)
{ {
string[] sets = split[9].Split('|'); string[] sets = split[9].Split('|');
for (int i = 0; i < nodes; i++) for (int i = 0; i < nodes; i++)
{ {
if (i >= sets.Length) if (i >= sets.Length)
@ -162,6 +167,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
if (split.Length > 8 && split[8].Length > 0) if (split.Length > 8 && split[8].Length > 0)
{ {
string[] adds = split[8].Split('|'); string[] adds = split[8].Split('|');
for (int i = 0; i < nodes; i++) for (int i = 0; i < nodes; i++)
{ {
if (i >= adds.Length) if (i >= adds.Length)

View File

@ -95,6 +95,7 @@ namespace osu.Game.Rulesets.Objects
path.Clear(); path.Clear();
int i = 0; int i = 0;
for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i)
{ {
} }
@ -142,6 +143,7 @@ namespace osu.Game.Rulesets.Objects
{ {
case PathType.Linear: case PathType.Linear:
return PathApproximator.ApproximateLinear(subControlPoints); return PathApproximator.ApproximateLinear(subControlPoints);
case PathType.PerfectCurve: case PathType.PerfectCurve:
//we can only use CircularArc iff we have exactly three control points and no dissection. //we can only use CircularArc iff we have exactly three control points and no dissection.
if (ControlPoints.Length != 3 || subControlPoints.Length != 3) if (ControlPoints.Length != 3 || subControlPoints.Length != 3)
@ -155,6 +157,7 @@ namespace osu.Game.Rulesets.Objects
break; break;
return subpath; return subpath;
case PathType.Catmull: case PathType.Catmull:
return PathApproximator.ApproximateCatmull(subControlPoints); return PathApproximator.ApproximateCatmull(subControlPoints);
} }

View File

@ -124,6 +124,7 @@ namespace osu.Game.Rulesets.UI
onScreenDisplay = dependencies.Get<OnScreenDisplay>(); onScreenDisplay = dependencies.Get<OnScreenDisplay>();
Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset); Config = dependencies.Get<RulesetConfigCache>().GetConfigFor(Ruleset);
if (Config != null) if (Config != null)
{ {
dependencies.Cache(Config); dependencies.Cache(Config);

View File

@ -76,6 +76,7 @@ namespace osu.Game.Screens.Backgrounds
private void switchBackground(BeatmapBackground b) private void switchBackground(BeatmapBackground b)
{ {
float newDepth = 0; float newDepth = 0;
if (Background != null) if (Background != null)
{ {
newDepth = Background.Depth + 1; newDepth = Background.Depth + 1;

View File

@ -100,6 +100,7 @@ namespace osu.Game.Screens.Edit.Compose
}; };
var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance(); var ruleset = Beatmap.Value.BeatmapInfo.Ruleset?.CreateInstance();
if (ruleset == null) if (ruleset == null)
{ {
Logger.Log("Beatmap doesn't have a ruleset assigned."); Logger.Log("Beatmap doesn't have a ruleset assigned.");
@ -108,6 +109,7 @@ namespace osu.Game.Screens.Edit.Compose
} }
composer = ruleset.CreateHitObjectComposer(); composer = ruleset.CreateHitObjectComposer();
if (composer == null) if (composer == null)
{ {
Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition."); Logger.Log($"Ruleset {ruleset.Description} doesn't support hitobject composition.");

View File

@ -70,6 +70,7 @@ namespace osu.Game.Screens.Edit
PlaybackControl playback; PlaybackControl playback;
var fileMenuItems = new List<MenuItem>(); var fileMenuItems = new List<MenuItem>();
if (RuntimeInfo.IsDesktop) if (RuntimeInfo.IsDesktop)
{ {
fileMenuItems.Add(new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap)); fileMenuItems.Add(new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap));
@ -173,6 +174,7 @@ namespace osu.Game.Screens.Edit
case Key.Left: case Key.Left:
seek(e, -1); seek(e, -1);
return true; return true;
case Key.Right: case Key.Right:
seek(e, 1); seek(e, 1);
return true; return true;
@ -218,6 +220,7 @@ namespace osu.Game.Screens.Edit
public override bool OnExiting(IScreen next) public override bool OnExiting(IScreen next)
{ {
Background.FadeColour(Color4.White, 500); Background.FadeColour(Color4.White, 500);
if (Beatmap.Value.Track != null) if (Beatmap.Value.Track != null)
{ {
Beatmap.Value.Track.Tempo.Value = 1; Beatmap.Value.Track.Tempo.Value = 1;
@ -238,9 +241,11 @@ namespace osu.Game.Screens.Edit
case EditorScreenMode.Compose: case EditorScreenMode.Compose:
currentScreen = new ComposeScreen(); currentScreen = new ComposeScreen();
break; break;
case EditorScreenMode.Design: case EditorScreenMode.Design:
currentScreen = new DesignScreen(); currentScreen = new DesignScreen();
break; break;
default: default:
currentScreen = new EditorScreen(); currentScreen = new EditorScreen();
break; break;

View File

@ -83,6 +83,7 @@ namespace osu.Game.Screens.Edit
if (amount <= 0) throw new ArgumentException("Value should be greater than zero", nameof(amount)); if (amount <= 0) throw new ArgumentException("Value should be greater than zero", nameof(amount));
var timingPoint = ControlPointInfo.TimingPointAt(CurrentTime); var timingPoint = ControlPointInfo.TimingPointAt(CurrentTime);
if (direction < 0 && timingPoint.Time == CurrentTime) if (direction < 0 && timingPoint.Time == CurrentTime)
{ {
// When going backwards and we're at the boundary of two timing points, we compute the seek distance with the timing point which we are seeking into // When going backwards and we're at the boundary of two timing points, we compute the seek distance with the timing point which we are seeking into

View File

@ -156,9 +156,11 @@ namespace osu.Game.Screens.Menu
{ {
case GlobalAction.Back: case GlobalAction.Back:
return goBack(); return goBack();
case GlobalAction.Select: case GlobalAction.Select:
logo?.Click(); logo?.Click();
return true; return true;
default: default:
return false; return false;
} }
@ -174,9 +176,11 @@ namespace osu.Game.Screens.Menu
State = ButtonSystemState.Initial; State = ButtonSystemState.Initial;
sampleBack?.Play(); sampleBack?.Play();
return true; return true;
case ButtonSystemState.Play: case ButtonSystemState.Play:
backButton.Click(); backButton.Click();
return true; return true;
default: default:
return false; return false;
} }
@ -188,12 +192,15 @@ namespace osu.Game.Screens.Menu
{ {
default: default:
return true; return true;
case ButtonSystemState.Initial: case ButtonSystemState.Initial:
State = ButtonSystemState.TopLevel; State = ButtonSystemState.TopLevel;
return true; return true;
case ButtonSystemState.TopLevel: case ButtonSystemState.TopLevel:
buttonsTopLevel.First().Click(); buttonsTopLevel.First().Click();
return false; return false;
case ButtonSystemState.Play: case ButtonSystemState.Play:
buttonsPlay.First().Click(); buttonsPlay.First().Click();
return false; return false;
@ -259,12 +266,14 @@ namespace osu.Game.Screens.Menu
logo.ScaleTo(1, 800, Easing.OutExpo); logo.ScaleTo(1, 800, Easing.OutExpo);
}, buttonArea.Alpha * 150); }, buttonArea.Alpha * 150);
break; break;
case ButtonSystemState.TopLevel: case ButtonSystemState.TopLevel:
case ButtonSystemState.Play: case ButtonSystemState.Play:
switch (lastState) switch (lastState)
{ {
case ButtonSystemState.TopLevel: // coming from toplevel to play case ButtonSystemState.TopLevel: // coming from toplevel to play
break; break;
case ButtonSystemState.Initial: case ButtonSystemState.Initial:
logo.ClearTransforms(targetMember: nameof(Position)); logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.None; logo.RelativePositionAxes = Axes.None;
@ -287,6 +296,7 @@ namespace osu.Game.Screens.Menu
game?.Toolbar.Show(); game?.Toolbar.Show();
}, 200); }, 200);
break; break;
default: default:
logo.ClearTransforms(targetMember: nameof(Position)); logo.ClearTransforms(targetMember: nameof(Position));
logo.RelativePositionAxes = Axes.None; logo.RelativePositionAxes = Axes.None;
@ -296,6 +306,7 @@ namespace osu.Game.Screens.Menu
} }
break; break;
case ButtonSystemState.EnteringMode: case ButtonSystemState.EnteringMode:
logoTracking = true; logoTracking = true;
break; break;

View File

@ -118,6 +118,7 @@ namespace osu.Game.Screens.Menu
base.Update(); base.Update();
float decayFactor = (float)Time.Elapsed * decay_per_milisecond; float decayFactor = (float)Time.Elapsed * decay_per_milisecond;
for (int i = 0; i < bars_per_visualiser; i++) for (int i = 0; i < bars_per_visualiser; i++)
{ {
//3% of extra bar length to make it a little faster when bar is almost at it's minimum //3% of extra bar length to make it a little faster when bar is almost at it's minimum

View File

@ -258,6 +258,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
// nice little progressive fade // nice little progressive fade
int time = 500; int time = 500;
foreach (var c in fill.Children) foreach (var c in fill.Children)
{ {
c.Delay(500 - time).FadeOut(time, Easing.Out); c.Delay(500 - time).FadeOut(time, Easing.Out);

View File

@ -149,6 +149,7 @@ namespace osu.Game.Screens.Multi.Match
header.Tabs.Current.BindValueChanged(tab => header.Tabs.Current.BindValueChanged(tab =>
{ {
const float fade_duration = 500; const float fade_duration = 500;
if (tab.NewValue is SettingsMatchPage) if (tab.NewValue is SettingsMatchPage)
{ {
settings.Show(); settings.Show();

View File

@ -248,6 +248,7 @@ namespace osu.Game.Screens.Multi
if (screenStack.CurrentScreen is MatchSubScreen) if (screenStack.CurrentScreen is MatchSubScreen)
{ {
var track = Beatmap.Value.Track; var track = Beatmap.Value.Track;
if (track != null) if (track != null)
{ {
track.Looping = true; track.Looping = true;

View File

@ -20,12 +20,14 @@ namespace osu.Game.Screens
if (requireLease) if (requireLease)
{ {
Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy(); Beatmap = parent.Get<LeasedBindable<WorkingBeatmap>>()?.GetBoundCopy();
if (Beatmap == null) if (Beatmap == null)
{ {
Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false)); Cache(Beatmap = parent.Get<Bindable<WorkingBeatmap>>().BeginLease(false));
} }
Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy(); Ruleset = parent.Get<LeasedBindable<RulesetInfo>>()?.GetBoundCopy();
if (Ruleset == null) if (Ruleset == null)
{ {
Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true)); Cache(Ruleset = parent.Get<Bindable<RulesetInfo>>().BeginLease(true));

View File

@ -68,6 +68,7 @@ namespace osu.Game.Screens.Play.HUD
Current.ValueChanged += mods => Current.ValueChanged += mods =>
{ {
iconsContainer.Clear(); iconsContainer.Clear();
foreach (Mod mod in mods.NewValue) foreach (Mod mod in mods.NewValue)
{ {
iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) }); iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) });

View File

@ -52,6 +52,7 @@ namespace osu.Game.Screens.Play
{ {
isLit = value; isLit = value;
updateGlowSprite(value); updateGlowSprite(value);
if (value && IsCounting) if (value && IsCounting)
{ {
CountPresses++; CountPresses++;

View File

@ -169,6 +169,7 @@ namespace osu.Game.Screens.Play
var max = values.Max(); var max = values.Max();
float step = values.Length / (float)ColumnCount; float step = values.Length / (float)ColumnCount;
for (float i = 0; i < values.Length; i += step) for (float i = 0; i < values.Length; i += step)
{ {
newValues.Add((float)values[(int)i] / max); newValues.Add((float)values[(int)i] / max);

View File

@ -180,6 +180,7 @@ namespace osu.Game.Screens.Ranking.Pages
scoreCounter.Increment(Score.TotalScore); scoreCounter.Increment(Score.TotalScore);
int delay = 0; int delay = 0;
foreach (var s in statisticsContainer.Children) foreach (var s in statisticsContainer.Children)
{ {
s.FadeOut() s.FadeOut()
@ -336,6 +337,7 @@ namespace osu.Game.Screens.Ranking.Pages
versionMapper.Colour = colours.Gray8; versionMapper.Colour = colours.Gray8;
var creator = beatmap.Metadata.Author?.Username; var creator = beatmap.Metadata.Author?.Username;
if (!string.IsNullOrEmpty(creator)) if (!string.IsNullOrEmpty(creator))
{ {
versionMapper.Text = $"mapped by {creator}"; versionMapper.Text = $"mapped by {creator}";

View File

@ -257,6 +257,7 @@ namespace osu.Game.Screens.Select
select(beatmap); select(beatmap);
return; return;
case CarouselBeatmapSet set: case CarouselBeatmapSet set:
if (skipDifficulties) if (skipDifficulties)
select(set); select(set);
@ -292,6 +293,7 @@ namespace osu.Game.Screens.Select
if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation) if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation)
{ {
var notYetVisitedSets = visibleSets.Except(previouslyVisitedRandomSets).ToList(); var notYetVisitedSets = visibleSets.Except(previouslyVisitedRandomSets).ToList();
if (!notYetVisitedSets.Any()) if (!notYetVisitedSets.Any())
{ {
previouslyVisitedRandomSets.RemoveAll(s => visibleSets.Contains(s)); previouslyVisitedRandomSets.RemoveAll(s => visibleSets.Contains(s));
@ -394,13 +396,16 @@ namespace osu.Game.Screens.Select
case Key.Up: case Key.Up:
direction = -1; direction = -1;
break; break;
case Key.Down: case Key.Down:
direction = 1; direction = 1;
break; break;
case Key.Left: case Key.Left:
direction = -1; direction = -1;
skipDifficulties = true; skipDifficulties = true;
break; break;
case Key.Right: case Key.Right:
direction = 1; direction = 1;
skipDifficulties = true; skipDifficulties = true;
@ -465,8 +470,10 @@ namespace osu.Game.Screens.Select
case LoadState.NotLoaded: case LoadState.NotLoaded:
LoadComponentAsync(item); LoadComponentAsync(item);
break; break;
case LoadState.Loading: case LoadState.Loading:
break; break;
default: default:
scrollableContent.Add(item); scrollableContent.Add(item);
break; break;
@ -557,6 +564,7 @@ namespace osu.Game.Screens.Select
set.MoveToX(set.Item.State.Value == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo); set.MoveToX(set.Item.State.Value == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo);
set.MoveToY(currentY, 750, Easing.OutExpo); set.MoveToY(currentY, 750, Easing.OutExpo);
break; break;
case DrawableCarouselBeatmap beatmap: case DrawableCarouselBeatmap beatmap:
if (beatmap.Item.State.Value == CarouselItemState.Selected) if (beatmap.Item.State.Value == CarouselItemState.Selected)
scrollTarget = currentY + beatmap.DrawHeight / 2 - DrawHeight / 2; scrollTarget = currentY + beatmap.DrawHeight / 2 - DrawHeight / 2;

Some files were not shown because too many files have changed in this diff Show More