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

View File

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

View File

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

View File

@ -31,6 +31,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
initialiseHyperDash((List<CatchHitObject>)Beatmap.HitObjects);
int index = 0;
foreach (var obj in Beatmap.HitObjects.OfType<CatchHitObject>())
{
obj.IndexInBeatmap = index++;
@ -58,6 +59,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
}
break;
case JuiceStream juiceStream:
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 distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
float distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext);
if (distanceToHyper < 0)
{
currentObject.HyperDashTarget = nextObject;

View File

@ -73,6 +73,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty
lastObject = hitObject;
break;
case JuiceStream _:
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:
return new Container();
case FruitVisualRepresentation.Raspberry:
return new Container
{
@ -143,6 +144,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
},
}
};
case FruitVisualRepresentation.Pineapple:
return new Container
{
@ -181,6 +183,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
},
}
};
case FruitVisualRepresentation.Pear:
return new Container
{
@ -213,6 +216,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
},
}
};
case FruitVisualRepresentation.Grape:
return new Container
{
@ -245,6 +249,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
},
}
};
case FruitVisualRepresentation.Banana:
return new Container
{
@ -282,19 +287,25 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable
default:
case FruitVisualRepresentation.Pear:
return new Color4(17, 136, 170, 255);
case FruitVisualRepresentation.Grape:
return new Color4(204, 102, 0, 255);
case FruitVisualRepresentation.Raspberry:
return new Color4(121, 9, 13, 255);
case FruitVisualRepresentation.Pineapple:
return new Color4(102, 136, 0, 255);
case FruitVisualRepresentation.Banana:
switch (RNG.Next(0, 3))
{
default:
return new Color4(255, 240, 0, 255);
case 1:
return new Color4(255, 192, 0, 255);
case 2:
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;
bool previouslyHyperDashing = HyperDashing;
if (modifier <= 1 || X == targetPosition)
{
hyperDashModifier = 1;
@ -325,9 +326,11 @@ namespace osu.Game.Rulesets.Catch.UI
case CatchAction.MoveLeft:
currentDirection--;
return true;
case CatchAction.MoveRight:
currentDirection++;
return true;
case CatchAction.Dash:
Dashing = true;
return true;
@ -343,9 +346,11 @@ namespace osu.Game.Rulesets.Catch.UI
case CatchAction.MoveLeft:
currentDirection++;
return true;
case CatchAction.MoveRight:
currentDirection--;
return true;
case CatchAction.Dash:
Dashing = false;
return true;

View File

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

View File

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

View File

@ -179,6 +179,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int usableColumns = TotalColumns - RandomStart - PreviousPattern.ColumnWithObjects;
int nextColumn = GetRandomColumn();
for (int i = 0; i < Math.Min(usableColumns, noteCount); i++)
{
// Find available column
@ -217,6 +218,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
nextColumn = FindAvailableColumn(nextColumn, PreviousPattern);
int lastColumn = nextColumn;
for (int i = 0; i < noteCount; i++)
{
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 nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
for (int i = 0; i <= spanCount; i++)
{
addToPattern(pattern, nextColumn, startTime, startTime);
@ -341,16 +344,19 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
p3 = 0;
p4 = 0;
break;
case 3:
p2 = Math.Min(p2, 0.1);
p3 = 0;
p4 = 0;
break;
case 4:
p2 = Math.Min(p2, 0.3);
p3 = Math.Min(p3, 0.04);
p4 = 0;
break;
case 5:
p2 = Math.Min(p2, 0.34);
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);
var rowPattern = new Pattern();
for (int i = 0; i <= spanCount; i++)
{
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);
int nextColumn = GetColumn((HitObject as IHasXPosition)?.X ?? 0, true);
for (int i = 0; i < noteCount; i++)
{
nextColumn = allowStacking
@ -303,6 +304,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2;
int nextColumn = GetRandomColumn(upperBound: columnLimit);
for (int i = 0; i < noteCount; i++)
{
nextColumn = FindAvailableColumn(nextColumn, upperBound: columnLimit, patterns: pattern);
@ -340,18 +342,21 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
p4 = 0;
p5 = 0;
break;
case 3:
p2 = Math.Min(p2, 0.1);
p3 = 0;
p4 = 0;
p5 = 0;
break;
case 4:
p2 = Math.Min(p2, 0.23);
p3 = Math.Min(p3, 0.04);
p4 = 0;
p5 = 0;
break;
case 5:
p3 = Math.Min(p3, 0.15);
p4 = Math.Min(p4, 0.03);
@ -384,20 +389,24 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
p2 = 0;
p3 = 0;
break;
case 3:
centreProbability = Math.Min(centreProbability, 0.03);
p2 = 0;
p3 = 0;
break;
case 4:
centreProbability = 0;
p2 = Math.Min(p2 * 2, 0.2);
p3 = 0;
break;
case 5:
centreProbability = Math.Min(centreProbability, 0.03);
p3 = 0;
break;
case 6:
centreProbability = 0;
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
bool hasValidColumns = false;
for (int i = lowerBound.Value; i < upperBound.Value; i++)
{
hasValidColumns = isValid(i);

View File

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

View File

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

View File

@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Mania.Replays
var normalAction = ManiaAction.Key1;
var specialAction = ManiaAction.Special1;
int totalCounter = 0;
foreach (var stage in Beatmap.Stages)
{
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 actions = new List<ManiaAction>();
foreach (var group in pointGroups)
{
foreach (var point in group)
@ -60,6 +62,7 @@ namespace osu.Game.Rulesets.Mania.Replays
case HitPoint _:
actions.Add(columnActions[point.Column]);
break;
case ReleasePoint _:
actions.Remove(columnActions[point.Column]);
break;

View File

@ -39,6 +39,7 @@ namespace osu.Game.Rulesets.Mania.Replays
int activeColumns = (int)(legacyFrame.MouseX ?? 0);
int counter = 0;
while (activeColumns > 0)
{
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;
int index = 0;
for (double t = timingPoints[i].Time; Precision.DefinitelyBigger(endTime, t); t += point.BeatLength, index++)
{
barLines.Add(new BarLine
@ -104,8 +105,10 @@ namespace osu.Game.Rulesets.Mania.UI
{
case HoldNote holdNote:
return new DrawableHoldNote(holdNote);
case Note note:
return new DrawableNote(note);
default:
return null;
}

View File

@ -38,6 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI
var normalColumnAction = ManiaAction.Key1;
var specialColumnAction = ManiaAction.Special1;
int firstColumnIndex = 0;
for (int i = 0; i < stageDefinitions.Count; i++)
{
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)
{
int sum = 0;
foreach (var stage in stages)
{
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.");
int extendedEndIndex = endIndex;
if (endIndex < beatmap.HitObjects.Count - 1)
{
// Extend the end index to include objects they are stacked on
for (int i = endIndex; i >= startIndex; i--)
{
int stackBaseIndex = i;
for (int n = stackBaseIndex + 1; n < beatmap.HitObjects.Count; n++)
{
OsuHitObject stackBaseObject = beatmap.HitObjects[stackBaseIndex];
@ -87,6 +89,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
//Reverse pass for stack calculation.
int extendedStartIndex = startIndex;
for (int i = extendedEndIndex; i > startIndex; 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)
{
int offset = objectI.StackHeight - objectN.StackHeight + 1;
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).

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);
double approachRateFactor = 1.0f;
if (Attributes.ApproachRate > 10.33f)
approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f);
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.
float scalingFactor = normalized_radius / (float)BaseObject.Radius;
if (BaseObject.Radius < 30)
{
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);
double angleBonus = 1.0;
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;
if (osuCurrent.Angle.Value < pi_over_2)
{
angleBonus = 1.28;

View File

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

View File

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

View File

@ -67,6 +67,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
return;
OsuHitObject prevHitObject = null;
foreach (var currHitObject in hitObjects)
{
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);
if (result == HitResult.None)
{
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.
LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss);
break;
case ArmedState.Miss:
ApproachCircle.FadeOut(50);
this.FadeOut(100);
Expire();
break;
case ArmedState.Hit:
ApproachCircle.FadeOut(50);

View File

@ -191,6 +191,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor
Shader.GetUniform<float>("g_FadeClock").UpdateValue(ref Time);
int updateStart = -1, updateEnd = 0;
for (int i = 0; i < Parts.Length; ++i)
{
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 });
int i = 0;
for (double j = obj.StartTime; j <= obj.StartTime + taikoDuration + tickSpacing / 8; j += tickSpacing)
{
List<SampleInfo> currentSamples = allSamples[i];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -117,6 +117,7 @@ namespace osu.Game.Beatmaps
if (beatmapSet.OnlineBeatmapSetID != null)
{
var existingOnlineId = beatmaps.ConsumableItems.FirstOrDefault(b => b.OnlineBeatmapSetID == beatmapSet.OnlineBeatmapSetID);
if (existingOnlineId != null)
{
Delete(existingOnlineId);
@ -325,6 +326,7 @@ namespace osu.Game.Beatmaps
{
// let's make sure there are actually .osu files to import.
string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu"));
if (string.IsNullOrEmpty(mapName))
{
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()
{
Storyboard storyboard;
try
{
using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
@ -131,6 +132,7 @@ namespace osu.Game.Beatmaps
protected override Skin GetSkin()
{
Skin skin;
try
{
skin = new LegacyBeatmapSkin(BeatmapInfo, store, audioManager);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,6 +51,7 @@ namespace osu.Game.Graphics.Containers
}
int previousLinkEnd = 0;
foreach (var link in links)
{
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))
game?.ShowBeatmap(beatmapId);
break;
case LinkAction.OpenBeatmapSet:
if (int.TryParse(linkArgument, out int setId))
game?.ShowBeatmapSet(setId);
break;
case LinkAction.OpenChannel:
try
{
@ -105,18 +108,22 @@ namespace osu.Game.Graphics.Containers
}
break;
case LinkAction.OpenEditorTimestamp:
case LinkAction.JoinMultiplayerMatch:
case LinkAction.Spectate:
showNotImplementedError?.Invoke();
break;
case LinkAction.External:
game?.OpenUrlExternally(url);
break;
case LinkAction.OpenUserProfile:
if (long.TryParse(linkArgument, out long userId))
game?.ShowUser(userId);
break;
default:
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 footerH = Footer?.LayoutSize.Y ?? 0;
if (headerH != headerHeight || footerH != footerHeight)
{
headerHeight = headerH;
@ -181,6 +182,7 @@ namespace osu.Game.Graphics.Containers
foreach (var section in Children)
{
float diff = Math.Abs(scrollContainer.GetChildPosInContent(section) - currentScroll - scrollOffset);
if (diff < minDiff)
{
minDiff = diff;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -113,6 +113,7 @@ namespace osu.Game.Online.API
}
break;
case APIState.Offline:
case APIState.Connecting:
//work to restore a connection...
@ -300,6 +301,7 @@ namespace osu.Game.Online.API
case HttpStatusCode.Unauthorized:
Logout();
return true;
case HttpStatusCode.RequestTimeout:
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)
{
HitResult newKey;
switch (kvp.Key)
{
case @"count_geki":
CountGeki = kvp.Value;
break;
case @"count_300":
Count300 = kvp.Value;
break;
case @"count_katu":
CountKatu = kvp.Value;
break;
case @"count_100":
Count100 = kvp.Value;
break;
case @"count_50":
Count50 = kvp.Value;
break;
case @"count_miss":
CountMiss = kvp.Value;
break;
default:
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)
{
int captureOffset = 0;
foreach (Match m in regex.Matches(result.Text, startIndex))
{
var index = m.Index - captureOffset;
@ -114,51 +115,63 @@ namespace osu.Game.Online.Chat
case "b":
case "beatmaps":
return new LinkDetails(LinkAction.OpenBeatmap, args[3]);
case "s":
case "beatmapsets":
case "d":
return new LinkDetails(LinkAction.OpenBeatmapSet, args[3]);
case "u":
return new LinkDetails(LinkAction.OpenUserProfile, args[3]);
}
}
return new LinkDetails(LinkAction.External, null);
case "osu":
// every internal link also needs some kind of argument
if (args.Length < 3)
return new LinkDetails(LinkAction.External, null);
LinkAction linkType;
switch (args[1])
{
case "chan":
linkType = LinkAction.OpenChannel;
break;
case "edit":
linkType = LinkAction.OpenEditorTimestamp;
break;
case "b":
linkType = LinkAction.OpenBeatmap;
break;
case "s":
case "dl":
linkType = LinkAction.OpenBeatmapSet;
break;
case "spectate":
linkType = LinkAction.Spectate;
break;
case "u":
linkType = LinkAction.OpenUserProfile;
break;
default:
linkType = LinkAction.External;
break;
}
return new LinkDetails(linkType, args[2]);
case "osump":
return new LinkDetails(LinkAction.JoinMultiplayerMatch, args[1]);
default:
return new LinkDetails(LinkAction.External, null);
}

View File

@ -74,6 +74,7 @@ namespace osu.Game.Online.Leaderboards
scrollContainer.Add(scrollFlow);
int i = 0;
foreach (var s in scrollFlow.Children)
{
using (s.BeginDelayedSequence(i++ * 50, true))
@ -138,18 +139,23 @@ namespace osu.Game.Online.Leaderboards
OnRetry = UpdateScores,
});
break;
case PlaceholderState.Unavailable:
replacePlaceholder(new MessagePlaceholder(@"Leaderboards are not available for this beatmap!"));
break;
case PlaceholderState.NoScores:
replacePlaceholder(new MessagePlaceholder(@"No records yet!"));
break;
case PlaceholderState.NotLoggedIn:
replacePlaceholder(new MessagePlaceholder(@"Please sign in to view online leaderboards!"));
break;
case PlaceholderState.NotSupporter:
replacePlaceholder(new MessagePlaceholder(@"Please invest in an osu!supporter tag to view this leaderboard!"));
break;
default:
replacePlaceholder(null);
break;

View File

@ -271,6 +271,7 @@ namespace osu.Game
{
var databasedScore = ScoreManager.GetScore(score);
var databasedScoreInfo = databasedScore.ScoreInfo;
if (databasedScore.Replay == null)
{
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);
if (databasedBeatmap == null)
{
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:
chatOverlay.ToggleVisibility();
return true;
case GlobalAction.ToggleSocial:
social.ToggleVisibility();
return true;
case GlobalAction.ResetInputSettings:
var sensitivity = frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity);
@ -674,15 +678,19 @@ namespace osu.Game
frameworkConfig.Set(FrameworkSetting.IgnoredInputHandlers, string.Empty);
frameworkConfig.GetBindable<ConfineMouseMode>(FrameworkSetting.ConfineMouseMode).SetDefault();
return true;
case GlobalAction.ToggleToolbar:
Toolbar.ToggleVisibility();
return true;
case GlobalAction.ToggleSettings:
settings.ToggleVisibility();
return true;
case GlobalAction.ToggleDirect:
direct.ToggleVisibility();
return true;
case GlobalAction.ToggleGameplayMouseButtons:
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons));
return true;
@ -758,6 +766,7 @@ namespace osu.Game
case Intro intro:
introScreen = intro;
break;
case MainMenu menu:
menuScreen = menu;
break;

View File

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

View File

@ -99,6 +99,7 @@ namespace osu.Game.Overlays.Chat
private void pendingMessageResolved(Message existing, Message updated)
{
var found = ChatLineFlow.Children.LastOrDefault(c => c.Message == existing);
if (found != null)
{
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);
var loaded = loadedChannels.Find(d => d.Channel == e.NewValue);
if (loaded == null)
{
currentChannelContainer.FadeOut(500, Easing.OutQuint);
@ -288,6 +289,7 @@ namespace osu.Game.Overlays
case Key.Number9:
selectTab((int)e.Key - (int)Key.Number1);
return true;
case Key.Number0:
selectTab(9);
return true;

View File

@ -72,6 +72,7 @@ namespace osu.Game.Overlays.Dialog
set
{
buttonsContainer.ChildrenEnumerable = value;
foreach (PopupDialogButton b in value)
{
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
var k = e.Key;
if (k >= Key.Number1 && k <= Key.Number9)
{
pressButtonAtIndex(k - Key.Number1);

View File

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

View File

@ -117,6 +117,7 @@ namespace osu.Game.Overlays.KeyBinding
public void RestoreDefaults()
{
int i = 0;
foreach (var d in Defaults)
{
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.Icon = modAfter.Icon;
using (BeginDelayedSequence(mod_switch_duration, true))
{
foregroundIcon
@ -139,6 +140,7 @@ namespace osu.Game.Overlays.Mods
}
createIcons();
if (Mods.Length > 0)
{
displayMod(Mods[0]);
@ -168,6 +170,7 @@ namespace osu.Game.Overlays.Mods
case MouseButton.Left:
SelectNext(1);
break;
case MouseButton.Right:
SelectNext(-1);
break;
@ -219,6 +222,7 @@ namespace osu.Game.Overlays.Mods
private void createIcons()
{
iconsContainer.Clear();
if (Mods.Length > 1)
{
iconsContainer.AddRange(new[]

View File

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

View File

@ -190,6 +190,7 @@ namespace osu.Game.Overlays.Music
// the item positions as they are being transformed
float heightAccumulator = 0;
int dstIndex = 0;
for (; dstIndex < items.Count; dstIndex++)
{
// 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) =>
{
BeatmapInfo toSelect = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
if (toSelect != null)
{
beatmap.Value = beatmaps.GetWorkingBeatmap(toSelect);

View File

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

View File

@ -106,6 +106,7 @@ namespace osu.Game.Overlays.Profile.Header
visibleBadge = 0;
badgeFlowContainer.Clear();
for (var index = 0; index < badges.Length; 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);
string websiteWithoutProtcol = user.Website;
if (!string.IsNullOrEmpty(websiteWithoutProtcol))
{
int protocolIndex = websiteWithoutProtcol.IndexOf("//", StringComparison.Ordinal);
@ -468,14 +469,11 @@ namespace osu.Game.Overlays.Profile
if (string.IsNullOrEmpty(str)) return;
infoTextRight.AddIcon(icon);
if (url != null)
{
infoTextRight.AddLink(" " + str, url);
}
else
{
infoTextRight.AddText(" " + str);
}
infoTextRight.NewLine();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -118,6 +118,7 @@ namespace osu.Game.Screens.Menu
base.Update();
float decayFactor = (float)Time.Elapsed * decay_per_milisecond;
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

View File

@ -258,6 +258,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components
// nice little progressive fade
int time = 500;
foreach (var c in fill.Children)
{
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 =>
{
const float fade_duration = 500;
if (tab.NewValue is SettingsMatchPage)
{
settings.Show();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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