Add spaces to comments

This commit is contained in:
alex
2020-05-04 18:31:11 -07:00
parent c987af988c
commit 0e2ccac33b
48 changed files with 92 additions and 92 deletions

View File

@ -43,7 +43,7 @@ namespace osu.Desktop.Updater
private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null) private async void checkForUpdateAsync(bool useDeltaPatching = true, UpdateProgressNotification notification = null)
{ {
//should we schedule a retry on completion of this check? // should we schedule a retry on completion of this check?
bool scheduleRecheck = true; bool scheduleRecheck = true;
try try
@ -52,7 +52,7 @@ namespace osu.Desktop.Updater
var info = await updateManager.CheckForUpdate(!useDeltaPatching); var info = await updateManager.CheckForUpdate(!useDeltaPatching);
if (info.ReleasesToApply.Count == 0) if (info.ReleasesToApply.Count == 0)
//no updates available. bail and retry later. // no updates available. bail and retry later.
return; return;
if (notification == null) if (notification == null)
@ -81,8 +81,8 @@ namespace osu.Desktop.Updater
{ {
logger.Add(@"delta patching failed; will attempt full download!"); logger.Add(@"delta patching failed; will attempt full download!");
//could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959) // could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959)
//try again without deltas. // try again without deltas.
checkForUpdateAsync(false, notification); checkForUpdateAsync(false, notification);
scheduleRecheck = false; scheduleRecheck = false;
} }
@ -101,7 +101,7 @@ namespace osu.Desktop.Updater
{ {
if (scheduleRecheck) if (scheduleRecheck)
{ {
//check again in 30 minutes. // check again in 30 minutes.
Scheduler.AddDelayed(() => checkForUpdateAsync(), 60000 * 30); Scheduler.AddDelayed(() => checkForUpdateAsync(), 60000 * 30);
} }
} }

View File

@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Catch.Mods
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }
//disable keyboard controls // disable keyboard controls
public bool OnPressed(CatchAction action) => true; public bool OnPressed(CatchAction action) => true;
public void OnReleased(CatchAction action) public void OnReleased(CatchAction action)

View File

@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Catch.Replays
if (lastPosition - catcher_width_half < h.X && lastPosition + catcher_width_half > h.X) if (lastPosition - catcher_width_half < h.X && lastPosition + catcher_width_half > h.X)
{ {
//we are already in the correct range. // we are already in the correct range.
lastTime = h.StartTime; lastTime = h.StartTime;
addFrame(h.StartTime, lastPosition); addFrame(h.StartTime, lastPosition);
return; return;
@ -72,14 +72,14 @@ namespace osu.Game.Rulesets.Catch.Replays
} }
else if (dashRequired) else if (dashRequired)
{ {
//we do a movement in two parts - the dash part then the normal part... // we do a movement in two parts - the dash part then the normal part...
double timeAtNormalSpeed = positionChange / movement_speed; double timeAtNormalSpeed = positionChange / movement_speed;
double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable; double timeWeNeedToSave = timeAtNormalSpeed - timeAvailable;
double timeAtDashSpeed = timeWeNeedToSave / 2; double timeAtDashSpeed = timeWeNeedToSave / 2;
float midPosition = (float)Interpolation.Lerp(lastPosition, h.X, (float)timeAtDashSpeed / timeAvailable); float midPosition = (float)Interpolation.Lerp(lastPosition, h.X, (float)timeAtDashSpeed / timeAvailable);
//dash movement // dash movement
addFrame(h.StartTime - timeAvailable + 1, lastPosition, true); addFrame(h.StartTime - timeAvailable + 1, lastPosition, true);
addFrame(h.StartTime - timeAvailable + timeAtDashSpeed, midPosition); addFrame(h.StartTime - timeAvailable + timeAtDashSpeed, midPosition);
addFrame(h.StartTime, h.X); addFrame(h.StartTime, h.X);

View File

@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
double stackThreshold = objectN.TimePreempt * beatmap.BeatmapInfo.StackLeniency; double stackThreshold = objectN.TimePreempt * beatmap.BeatmapInfo.StackLeniency;
if (objectN.StartTime - endTime > stackThreshold) if (objectN.StartTime - endTime > stackThreshold)
//We are no longer within stacking range of the next object. // We are no longer within stacking range of the next object.
break; break;
if (Vector2Extensions.Distance(stackBaseObject.Position, objectN.Position) < stack_distance if (Vector2Extensions.Distance(stackBaseObject.Position, objectN.Position) < stack_distance
@ -88,7 +88,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--)
@ -124,7 +124,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
double endTime = objectN.GetEndTime(); double endTime = objectN.GetEndTime();
if (objectI.StartTime - endTime > stackThreshold) if (objectI.StartTime - endTime > stackThreshold)
//We are no longer within stacking range of the previous object. // We are no longer within stacking range of the previous object.
break; break;
// HitObjects before the specified update range haven't been reset yet // HitObjects before the specified update range haven't been reset yet
@ -145,20 +145,20 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
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).
OsuHitObject objectJ = beatmap.HitObjects[j]; OsuHitObject objectJ = beatmap.HitObjects[j];
if (Vector2Extensions.Distance(objectN.EndPosition, objectJ.Position) < stack_distance) if (Vector2Extensions.Distance(objectN.EndPosition, objectJ.Position) < stack_distance)
objectJ.StackHeight -= offset; objectJ.StackHeight -= offset;
} }
//We have hit a slider. We should restart calculation using this as the new base. // We have hit a slider. We should restart calculation using this as the new base.
//Breaking here will mean that the slider still has StackCount of 0, so will be handled in the i-outer-loop. // Breaking here will mean that the slider still has StackCount of 0, so will be handled in the i-outer-loop.
break; break;
} }
if (Vector2Extensions.Distance(objectN.Position, objectI.Position) < stack_distance) if (Vector2Extensions.Distance(objectN.Position, objectI.Position) < stack_distance)
{ {
//Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out. // Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out.
//NOTE: Sliders with start positions stacking are a special case that is also handled here. //NOTE: Sliders with start positions stacking are a special case that is also handled here.
objectN.StackHeight = objectI.StackHeight + 1; objectN.StackHeight = objectI.StackHeight + 1;
@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
if (objectN is Spinner) continue; if (objectN is Spinner) continue;
if (objectI.StartTime - objectN.StartTime > stackThreshold) if (objectI.StartTime - objectN.StartTime > stackThreshold)
//We are no longer within stacking range of the previous object. // We are no longer within stacking range of the previous object.
break; break;
if (Vector2Extensions.Distance(objectN.EndPosition, objectI.Position) < stack_distance) if (Vector2Extensions.Distance(objectN.EndPosition, objectI.Position) < stack_distance)
@ -221,7 +221,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
} }
else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, position2) < stack_distance) else if (Vector2Extensions.Distance(beatmap.HitObjects[j].Position, position2) < stack_distance)
{ {
//Case for sliders - bump notes down and right, rather than up and left. // Case for sliders - bump notes down and right, rather than up and left.
sliderStack++; sliderStack++;
beatmap.HitObjects[j].StackHeight -= sliderStack; beatmap.HitObjects[j].StackHeight -= sliderStack;
startTime = beatmap.HitObjects[j].GetEndTime(); startTime = beatmap.HitObjects[j].GetEndTime();

View File

@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Osu.Mods
Vector2 originalPosition = drawable.Position; Vector2 originalPosition = drawable.Position;
Vector2 appearOffset = new Vector2(MathF.Cos(theta), MathF.Sin(theta)) * appearDistance; Vector2 appearOffset = new Vector2(MathF.Cos(theta), MathF.Sin(theta)) * appearDistance;
//the - 1 and + 1 prevents the hit objects to appear in the wrong position. // the - 1 and + 1 prevents the hit objects to appear in the wrong position.
double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1;
double moveDuration = hitObject.TimePreempt + 1; double moveDuration = hitObject.TimePreempt + 1;

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
using (BeginDelayedSequence(flash_in, true)) using (BeginDelayedSequence(flash_in, true))
{ {
//after the flash, we can hide some elements that were behind it // after the flash, we can hide some elements that were behind it
ring.FadeOut(); ring.FadeOut();
circle.FadeOut(); circle.FadeOut();
number.FadeOut(); number.FadeOut();

View File

@ -31,7 +31,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportWhenClosed() public async Task TestImportWhenClosed()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWhenClosed))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWhenClosed)))
{ {
try try
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportThenDelete() public async Task TestImportThenDelete()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenDelete))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenDelete)))
{ {
try try
@ -69,7 +69,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportThenImport() public async Task TestImportThenImport()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenImport))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenImport)))
{ {
try try
@ -96,7 +96,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportCorruptThenImport() public async Task TestImportCorruptThenImport()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportCorruptThenImport))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportCorruptThenImport)))
{ {
try try
@ -138,7 +138,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestRollbackOnFailure() public async Task TestRollbackOnFailure()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestRollbackOnFailure))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestRollbackOnFailure)))
{ {
try try
@ -215,7 +215,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportThenImportDifferentHash() public async Task TestImportThenImportDifferentHash()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenImportDifferentHash))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenImportDifferentHash)))
{ {
try try
@ -246,7 +246,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportThenDeleteThenImport() public async Task TestImportThenDeleteThenImport()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenDeleteThenImport))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportThenDeleteThenImport)))
{ {
try try
@ -274,7 +274,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[TestCase(false)] [TestCase(false)]
public async Task TestImportThenDeleteThenImportWithOnlineIDMismatch(bool set) public async Task TestImportThenDeleteThenImportWithOnlineIDMismatch(bool set)
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"{nameof(TestImportThenDeleteThenImportWithOnlineIDMismatch)}-{set}")) using (HeadlessGameHost host = new CleanRunHeadlessGameHost($"{nameof(TestImportThenDeleteThenImportWithOnlineIDMismatch)}-{set}"))
{ {
try try
@ -308,7 +308,7 @@ namespace osu.Game.Tests.Beatmaps.IO
[Test] [Test]
public async Task TestImportWithDuplicateBeatmapIDs() public async Task TestImportWithDuplicateBeatmapIDs()
{ {
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here. // unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWithDuplicateBeatmapIDs))) using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestImportWithDuplicateBeatmapIDs)))
{ {
try try
@ -695,12 +695,12 @@ namespace osu.Game.Tests.Beatmaps.IO
waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Any(), waitForOrAssert(() => (resultSets = store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526)).Any(),
@"BeatmapSet did not import to the database in allocated time.", timeout); @"BeatmapSet did not import to the database in allocated time.", timeout);
//ensure we were stored to beatmap database backing... // ensure we were stored to beatmap database backing...
Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1)."); Assert.IsTrue(resultSets.Count() == 1, $@"Incorrect result count found ({resultSets.Count()} but should be 1).");
IEnumerable<BeatmapInfo> queryBeatmaps() => store.QueryBeatmaps(s => s.BeatmapSet.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0); IEnumerable<BeatmapInfo> queryBeatmaps() => store.QueryBeatmaps(s => s.BeatmapSet.OnlineBeatmapSetID == 241526 && s.BaseDifficultyID > 0);
IEnumerable<BeatmapSetInfo> queryBeatmapSets() => store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526); IEnumerable<BeatmapSetInfo> queryBeatmapSets() => store.QueryBeatmapSets(s => s.OnlineBeatmapSetID == 241526);
//if we don't re-check here, the set will be inserted but the beatmaps won't be present yet. // if we don't re-check here, the set will be inserted but the beatmaps won't be present yet.
waitForOrAssert(() => queryBeatmaps().Count() == 12, waitForOrAssert(() => queryBeatmaps().Count() == 12,
@"Beatmaps did not import to the database in allocated time", timeout); @"Beatmaps did not import to the database in allocated time", timeout);
waitForOrAssert(() => queryBeatmapSets().Count() == 1, waitForOrAssert(() => queryBeatmapSets().Count() == 1,

View File

@ -35,7 +35,7 @@ namespace osu.Game.Tests.NonVisual
Assert.That(cpi.TimingPoints.Count, Is.EqualTo(2)); Assert.That(cpi.TimingPoints.Count, Is.EqualTo(2));
Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(2)); Assert.That(cpi.AllControlPoints.Count(), Is.EqualTo(2));
cpi.Add(1000, new TimingControlPoint()); //is redundant cpi.Add(1000, new TimingControlPoint()); // is redundant
Assert.That(cpi.Groups.Count, Is.EqualTo(2)); Assert.That(cpi.Groups.Count, Is.EqualTo(2));
Assert.That(cpi.TimingPoints.Count, Is.EqualTo(2)); Assert.That(cpi.TimingPoints.Count, Is.EqualTo(2));

View File

@ -46,12 +46,12 @@ namespace osu.Game.Tests.NonVisual
confirmCurrentFrame(0); confirmCurrentFrame(0);
confirmNextFrame(1); confirmNextFrame(1);
//if we hit the first frame perfectly, time should progress to it. // if we hit the first frame perfectly, time should progress to it.
setTime(1000, 1000); setTime(1000, 1000);
confirmCurrentFrame(1); confirmCurrentFrame(1);
confirmNextFrame(2); confirmNextFrame(2);
//in between non-important frames should progress based on input. // in between non-important frames should progress based on input.
setTime(1200, 1200); setTime(1200, 1200);
confirmCurrentFrame(1); confirmCurrentFrame(1);
@ -144,7 +144,7 @@ namespace osu.Game.Tests.NonVisual
confirmCurrentFrame(2); confirmCurrentFrame(2);
confirmNextFrame(1); confirmNextFrame(1);
//ensure each frame plays out until start // ensure each frame plays out until start
setTime(-500, 1000); setTime(-500, 1000);
confirmCurrentFrame(1); confirmCurrentFrame(1);
confirmNextFrame(0); confirmNextFrame(0);

View File

@ -381,7 +381,7 @@ namespace osu.Game.Beatmaps
foreach (var file in files.Where(f => f.Filename.EndsWith(".osu"))) foreach (var file in files.Where(f => f.Filename.EndsWith(".osu")))
{ {
using (var raw = Files.Store.GetStream(file.FileInfo.StoragePath)) using (var raw = Files.Store.GetStream(file.FileInfo.StoragePath))
using (var ms = new MemoryStream()) //we need a memory stream so we can seek using (var ms = new MemoryStream()) // we need a memory stream so we can seek
using (var sr = new LineBufferedReader(ms)) using (var sr = new LineBufferedReader(ms))
{ {
raw.CopyTo(ms); raw.CopyTo(ms);

View File

@ -193,8 +193,8 @@ namespace osu.Game.Graphics.Backgrounds
float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats
float u2 = 1 - RNG.NextSingle(); float u2 = 1 - RNG.NextSingle();
float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1) float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); // random normal(0,1)
var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); //random normal(mean,stdDev^2) var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); // random normal(mean,stdDev^2)
return new TriangleParticle { Scale = scale }; return new TriangleParticle { Scale = scale };
} }

View File

@ -158,7 +158,7 @@ namespace osu.Game.Graphics.Containers
{ {
if (!base.OnMouseDown(e)) return false; if (!base.OnMouseDown(e)) return false;
//note that we are changing the colour of the box here as to not interfere with the hover effect. // note that we are changing the colour of the box here as to not interfere with the hover effect.
box.FadeColour(highlightColour, 100); box.FadeColour(highlightColour, 100);
return true; return true;
} }

View File

@ -32,7 +32,7 @@ namespace osu.Game.IPC
{ {
if (importer == null) if (importer == null)
{ {
//we want to contact a remote osu! to handle the import. // we want to contact a remote osu! to handle the import.
await SendMessageAsync(new ArchiveImportMessage { Path = path }); await SendMessageAsync(new ArchiveImportMessage { Path = path });
return; return;
} }

View File

@ -127,7 +127,7 @@ namespace osu.Game.Online.API
case APIState.Offline: case APIState.Offline:
case APIState.Connecting: case APIState.Connecting:
//work to restore a connection... // work to restore a connection...
if (!HasLogin) if (!HasLogin)
{ {
State = APIState.Offline; State = APIState.Offline;
@ -180,7 +180,7 @@ namespace osu.Game.Online.API
break; break;
} }
//hard bail if we can't get a valid access token. // hard bail if we can't get a valid access token.
if (authentication.RequestAccessToken() == null) if (authentication.RequestAccessToken() == null)
{ {
Logout(); Logout();
@ -274,7 +274,7 @@ namespace osu.Game.Online.API
{ {
req.Perform(this); req.Perform(this);
//we could still be in initialisation, at which point we don't want to say we're Online yet. // we could still be in initialisation, at which point we don't want to say we're Online yet.
if (IsLoggedIn) State = APIState.Online; if (IsLoggedIn) State = APIState.Online;
failureCount = 0; failureCount = 0;
@ -339,7 +339,7 @@ namespace osu.Game.Online.API
log.Add($@"API failure count is now {failureCount}"); log.Add($@"API failure count is now {failureCount}");
if (failureCount < 3) if (failureCount < 3)
//we might try again at an api level. // we might try again at an api level.
return false; return false;
if (State == APIState.Online) if (State == APIState.Online)

View File

@ -98,7 +98,7 @@ namespace osu.Game.Online.API
if (checkAndScheduleFailure()) if (checkAndScheduleFailure())
return; return;
if (!WebRequest.Aborted) //could have been aborted by a Cancel() call if (!WebRequest.Aborted) // could have been aborted by a Cancel() call
{ {
Logger.Log($@"Performing request {this}", LoggingTarget.Network); Logger.Log($@"Performing request {this}", LoggingTarget.Network);
WebRequest.Perform(); WebRequest.Perform();

View File

@ -61,7 +61,7 @@ namespace osu.Game.Online.Chat
/// </summary> /// </summary>
public event Action<Message> MessageRemoved; public event Action<Message> MessageRemoved;
public bool ReadOnly => false; //todo not yet used. public bool ReadOnly => false; // todo: not yet used.
public override string ToString() => Name; public override string ToString() => Name;

View File

@ -78,13 +78,13 @@ namespace osu.Game.Online.Chat
{ {
result.Text = result.Text.Remove(index, m.Length).Insert(index, displayText); result.Text = result.Text.Remove(index, m.Length).Insert(index, displayText);
//since we just changed the line display text, offset any already processed links. // since we just changed the line display text, offset any already processed links.
result.Links.ForEach(l => l.Index -= l.Index > index ? m.Length - displayText.Length : 0); result.Links.ForEach(l => l.Index -= l.Index > index ? m.Length - displayText.Length : 0);
var details = GetLinkDetails(linkText); var details = GetLinkDetails(linkText);
result.Links.Add(new Link(linkText, index, displayText.Length, linkActionOverride ?? details.Action, details.Argument)); result.Links.Add(new Link(linkText, index, displayText.Length, linkActionOverride ?? details.Action, details.Argument));
//adjust the offset for processing the current matches group. // adjust the offset for processing the current matches group.
captureOffset += m.Length - displayText.Length; captureOffset += m.Length - displayText.Length;
} }
} }

View File

@ -609,7 +609,7 @@ namespace osu.Game
loadComponentSingleFile(screenshotManager, Add); loadComponentSingleFile(screenshotManager, Add);
//overlay elements // overlay elements
loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true); loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true);
loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true); loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true);
var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true); var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true);
@ -781,7 +781,7 @@ namespace osu.Game
{ {
var previousLoadStream = asyncLoadStream; var previousLoadStream = asyncLoadStream;
//chain with existing load stream // chain with existing load stream
asyncLoadStream = Task.Run(async () => asyncLoadStream = Task.Run(async () =>
{ {
if (previousLoadStream != null) if (previousLoadStream != null)

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
: base(beatmap) : base(beatmap)
{ {
Width = 380; Width = 380;
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) Height = 140 + vertical_padding; // full height of all the elements plus vertical padding (autosize uses the image)
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -140,7 +140,7 @@ namespace osu.Game.Overlays.BeatmapSet
{ {
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font Margin = new MarginPadding { Left = 3, Bottom = 4 }, // To better lineup with the font
}, },
} }
}, },

View File

@ -358,7 +358,7 @@ namespace osu.Game.Overlays
protected override void OnFocus(FocusEvent e) protected override void OnFocus(FocusEvent e)
{ {
//this is necessary as textbox is masked away and therefore can't get focus :( // this is necessary as textbox is masked away and therefore can't get focus :(
textbox.TakeFocus(); textbox.TakeFocus();
base.OnFocus(e); base.OnFocus(e);
} }

View File

@ -50,7 +50,7 @@ namespace osu.Game.Overlays
{ {
if (v != Visibility.Hidden) return; if (v != Visibility.Hidden) return;
//handle the dialog being dismissed. // handle the dialog being dismissed.
dialog.Delay(PopupDialog.EXIT_DURATION).Expire(); dialog.Delay(PopupDialog.EXIT_DURATION).Expire();
if (dialog == CurrentDialog) if (dialog == CurrentDialog)

View File

@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Music
{ {
text.Clear(); text.Clear();
//space after the title to put a space between the title and artist // space after the title to put a space between the title and artist
titleSprites = text.AddText(title.Value + @" ", sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)).OfType<SpriteText>(); titleSprites = text.AddText(title.Value + @" ", sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)).OfType<SpriteText>();
text.AddText(artist.Value, sprite => text.AddText(artist.Value, sprite =>

View File

@ -250,7 +250,7 @@ namespace osu.Game.Overlays
} }
else else
{ {
//figure out the best direction based on order in playlist. // figure out the best direction based on order in playlist.
var last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); var last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
var next = beatmap.NewValue == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); var next = beatmap.NewValue == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count();

View File

@ -162,7 +162,7 @@ namespace osu.Game.Overlays.News
public string TooltipText => date.ToString("dddd dd MMMM yyyy hh:mm:ss UTCz").ToUpper(); public string TooltipText => date.ToString("dddd dd MMMM yyyy hh:mm:ss UTCz").ToUpper();
} }
//fake API data struct to use for now as a skeleton for data, as there is no API struct for news article info for now // fake API data struct to use for now as a skeleton for data, as there is no API struct for news article info for now
public class ArticleInfo public class ArticleInfo
{ {
public string Title { get; set; } public string Title { get; set; }

View File

@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Notifications
{ {
base.LoadComplete(); base.LoadComplete();
//we may have received changes before we were displayed. // we may have received changes before we were displayed.
updateState(); updateState();
} }

View File

@ -261,7 +261,7 @@ namespace osu.Game.Overlays
// todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync() // todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync()
Task.Run(() => Task.Run(() =>
{ {
if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists if (beatmap?.Beatmap == null) // this is not needed if a placeholder exists
{ {
title.Text = @"Nothing to play"; title.Text = @"Nothing to play";
artist.Text = @"Nothing to play"; artist.Text = @"Nothing to play";

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.OSD
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new Container //this container exists just to set a minimum width for the toast new Container // this container exists just to set a minimum width for the toast
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{ {
Font = OsuFont.GetFont(size: big ? 40 : 18, weight: FontWeight.Light) Font = OsuFont.GetFont(size: big ? 40 : 18, weight: FontWeight.Light)
}, },
new Container //Add a minimum size to the FillFlowContainer new Container // Add a minimum size to the FillFlowContainer
{ {
Width = minimumWidth, Width = minimumWidth,
} }

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Header
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5, Colour = colourProvider.Background5,
}, },
new Container //artificial shadow new Container // artificial shadow
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 3, Height = 3,

View File

@ -94,7 +94,7 @@ namespace osu.Game.Overlays.SearchableList
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
}, },
new Box //keep the tab strip part of autosize, but don't put it in the flow container new Box // keep the tab strip part of autosize, but don't put it in the flow container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 1, Height = 1,

View File

@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Toolbar
tooltipContainer = new FillFlowContainer tooltipContainer = new FillFlowContainer
{ {
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize RelativeSizeAxes = Axes.Both, // stops us being considered in parent's autosize
Anchor = TooltipAnchor.HasFlag(Anchor.x0) ? Anchor.BottomLeft : Anchor.BottomRight, Anchor = TooltipAnchor.HasFlag(Anchor.x0) ? Anchor.BottomLeft : Anchor.BottomRight,
Origin = TooltipAnchor, Origin = TooltipAnchor,
Position = new Vector2(TooltipAnchor.HasFlag(Anchor.x0) ? 5 : -5, 5), Position = new Vector2(TooltipAnchor.HasFlag(Anchor.x0) ? 5 : -5, 5),

View File

@ -58,7 +58,7 @@ namespace osu.Game.Overlays
{ {
volumeMeterEffect = new VolumeMeter("EFFECTS", 125, colours.BlueDarker) volumeMeterEffect = new VolumeMeter("EFFECTS", 125, colours.BlueDarker)
{ {
Margin = new MarginPadding { Top = 100 + MuteButton.HEIGHT } //to counter the mute button and re-center the volume meters Margin = new MarginPadding { Top = 100 + MuteButton.HEIGHT } // to counter the mute button and re-center the volume meters
}, },
volumeMeterMaster = new VolumeMeter("MASTER", 150, colours.PinkDarker), volumeMeterMaster = new VolumeMeter("MASTER", 150, colours.PinkDarker),
volumeMeterMusic = new VolumeMeter("MUSIC", 125, colours.BlueDarker), volumeMeterMusic = new VolumeMeter("MUSIC", 125, colours.BlueDarker),

View File

@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Replays
{ {
int newFrame = nextFrameIndex; int newFrame = nextFrameIndex;
//ensure we aren't at an extent. // ensure we aren't at an extent.
if (newFrame == currentFrameIndex) return false; if (newFrame == currentFrameIndex) return false;
currentFrameIndex = newFrame; currentFrameIndex = newFrame;
@ -99,8 +99,8 @@ namespace osu.Game.Rulesets.Replays
if (frame == null) if (frame == null)
return false; return false;
return IsImportant(frame) && //a button is in a pressed state return IsImportant(frame) && // a button is in a pressed state
Math.Abs(CurrentTime - NextFrame?.Time ?? 0) <= AllowedImportantTimeSpan; //the next frame is within an allowable time span Math.Abs(CurrentTime - NextFrame?.Time ?? 0) <= AllowedImportantTimeSpan; // the next frame is within an allowable time span
} }
} }

View File

@ -81,7 +81,7 @@ namespace osu.Game.Rulesets
var instances = loadedAssemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r)).ToList(); var instances = loadedAssemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r)).ToList();
//add all legacy rulesets first to ensure they have exclusive choice of primary key. // add all legacy rulesets first to ensure they have exclusive choice of primary key.
foreach (var r in instances.Where(r => r is ILegacyRuleset)) foreach (var r in instances.Where(r => r is ILegacyRuleset))
{ {
if (context.RulesetInfo.SingleOrDefault(dbRuleset => dbRuleset.ID == r.RulesetInfo.ID) == null) if (context.RulesetInfo.SingleOrDefault(dbRuleset => dbRuleset.ID == r.RulesetInfo.ID) == null)
@ -90,7 +90,7 @@ namespace osu.Game.Rulesets
context.SaveChanges(); context.SaveChanges();
//add any other modes // add any other modes
foreach (var r in instances.Where(r => !(r is ILegacyRuleset))) foreach (var r in instances.Where(r => !(r is ILegacyRuleset)))
{ {
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo == r.RulesetInfo.InstantiationInfo) == null) if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo == r.RulesetInfo.InstantiationInfo) == null)
@ -99,7 +99,7 @@ namespace osu.Game.Rulesets
context.SaveChanges(); context.SaveChanges();
//perform a consistency check // perform a consistency check
foreach (var r in context.RulesetInfo) foreach (var r in context.RulesetInfo)
{ {
try try

View File

@ -30,7 +30,7 @@ namespace osu.Game.Screens
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)
{ {
//we don't want to handle escape key. // we don't want to handle escape key.
return false; return false;
} }

View File

@ -101,7 +101,7 @@ namespace osu.Game.Screens.Menu
this.FadeIn(300); this.FadeIn(300);
double fadeOutTime = exit_delay; double fadeOutTime = exit_delay;
//we also handle the exit transition. // we also handle the exit transition.
if (MenuVoice.Value) if (MenuVoice.Value)
seeya.Play(); seeya.Play();
else else

View File

@ -162,7 +162,7 @@ namespace osu.Game.Screens.Menu
private IShader shader; private IShader shader;
private Texture texture; private Texture texture;
//Assuming the logo is a circle, we don't need a second dimension. // Assuming the logo is a circle, we don't need a second dimension.
private float size; private float size;
private Color4 colour; private Color4 colour;
@ -209,13 +209,13 @@ namespace osu.Game.Screens.Menu
float rotation = MathUtils.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds); float rotation = MathUtils.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds);
float rotationCos = MathF.Cos(rotation); float rotationCos = MathF.Cos(rotation);
float rotationSin = MathF.Sin(rotation); float rotationSin = MathF.Sin(rotation);
//taking the cos and sin to the 0..1 range // taking the cos and sin to the 0..1 range
var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * size; var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * size;
var barSize = new Vector2(size * MathF.Sqrt(2 * (1 - MathF.Cos(MathUtils.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * audioData[i]); var barSize = new Vector2(size * MathF.Sqrt(2 * (1 - MathF.Cos(MathUtils.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * audioData[i]);
//The distance between the position and the sides of the bar. // The distance between the position and the sides of the bar.
var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2); var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2);
//The distance between the bottom side of the bar and the top side. // The distance between the bottom side of the bar and the top side.
var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y); var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y);
var rectangle = new Quad( var rectangle = new Quad(
@ -231,7 +231,7 @@ namespace osu.Game.Screens.Menu
colourInfo, colourInfo,
null, null,
vertexBatch.AddAction, vertexBatch.AddAction,
//barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that. // barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that.
Vector2.Divide(inflation, barSize.Yx)); Vector2.Divide(inflation, barSize.Yx));
} }
} }

View File

@ -250,7 +250,7 @@ namespace osu.Game.Screens.Menu
(Background as BackgroundScreenDefault)?.Next(); (Background as BackgroundScreenDefault)?.Next();
//we may have consumed our preloaded instance, so let's make another. // we may have consumed our preloaded instance, so let's make another.
preloadSongSelect(); preloadSongSelect();
if (Beatmap.Value.Track != null && music?.IsUserPaused != true) if (Beatmap.Value.Track != null && music?.IsUserPaused != true)

View File

@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play
FinishTransforms(true); FinishTransforms(true);
Scheduler.CancelDelayedTasks(); Scheduler.CancelDelayedTasks();
if (breaks == null) return; //we need breaks. if (breaks == null) return; // we need breaks.
foreach (var b in breaks) foreach (var b in breaks)
{ {

View File

@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play.HUD
protected override void PopIn() => this.FadeIn(fade_duration); protected override void PopIn() => this.FadeIn(fade_duration);
protected override void PopOut() => this.FadeOut(fade_duration); protected override void PopOut() => this.FadeOut(fade_duration);
//We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible // We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
public override bool PropagateNonPositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true;
protected override bool OnKeyDown(KeyDownEvent e) protected override bool OnKeyDown(KeyDownEvent e)

View File

@ -124,8 +124,8 @@ namespace osu.Game.Screens.Play
} }
} }
}; };
//Set this manually because an element with Alpha=0 won't take it size to AutoSizeContainer, // Set this manually because an element with Alpha=0 won't take it size to AutoSizeContainer,
//so the size can be changing between buttonSprite and glowSprite. // so the size can be changing between buttonSprite and glowSprite.
Height = buttonSprite.DrawHeight; Height = buttonSprite.DrawHeight;
Width = buttonSprite.DrawWidth; Width = buttonSprite.DrawWidth;
} }

View File

@ -314,8 +314,8 @@ namespace osu.Game.Screens.Play
LoadTask = null; LoadTask = null;
//By default, we want to load the player and never be returned to. // By default, we want to load the player and never be returned to.
//Note that this may change if the player we load requested a re-run. // Note that this may change if the player we load requested a re-run.
ValidForResume = false; ValidForResume = false;
if (player.LoadedBeatmapSuccessfully) if (player.LoadedBeatmapSuccessfully)
@ -360,7 +360,7 @@ namespace osu.Game.Screens.Play
{ {
if (!muteWarningShownOnce.Value) if (!muteWarningShownOnce.Value)
{ {
//Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted. // Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted.
if (volumeOverlay?.IsMuted.Value == true || audioManager.Volume.Value <= audioManager.Volume.MinValue || audioManager.VolumeTrack.Value <= audioManager.VolumeTrack.MinValue) if (volumeOverlay?.IsMuted.Value == true || audioManager.Volume.Value <= audioManager.Volume.MinValue || audioManager.VolumeTrack.Value <= audioManager.VolumeTrack.MinValue)
{ {
notificationOverlay?.Post(new MutedNotification()); notificationOverlay?.Post(new MutedNotification());

View File

@ -208,7 +208,7 @@ namespace osu.Game.Screens.Select
// without this, during a large beatmap import it is impossible to navigate the carousel. // without this, during a large beatmap import it is impossible to navigate the carousel.
applyActiveCriteria(false, alwaysResetScrollPosition: false); applyActiveCriteria(false, alwaysResetScrollPosition: false);
//check if we can/need to maintain our current selection. // check if we can/need to maintain our current selection.
if (previouslySelectedID != null) if (previouslySelectedID != null)
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet); select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet);

View File

@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
set => tabs.Current = value; set => tabs.Current = value;
} }
public Action<BeatmapDetailAreaTabItem, bool> OnFilter; //passed the selected tab and if mods is checked public Action<BeatmapDetailAreaTabItem, bool> OnFilter; // passed the selected tab and if mods is checked
public IReadOnlyList<BeatmapDetailAreaTabItem> TabItems public IReadOnlyList<BeatmapDetailAreaTabItem> TabItems
{ {

View File

@ -201,7 +201,7 @@ namespace osu.Game.Screens.Select
Schedule(() => Schedule(() =>
{ {
if (beatmap != requestedBeatmap) if (beatmap != requestedBeatmap)
//the beatmap has been changed since we started the lookup. // the beatmap has been changed since we started the lookup.
return; return;
var b = res.ToBeatmap(rulesets); var b = res.ToBeatmap(rulesets);
@ -222,7 +222,7 @@ namespace osu.Game.Screens.Select
Schedule(() => Schedule(() =>
{ {
if (beatmap != requestedBeatmap) if (beatmap != requestedBeatmap)
//the beatmap has been changed since we started the lookup. // the beatmap has been changed since we started the lookup.
return; return;
updateMetrics(); updateMetrics();

View File

@ -52,7 +52,7 @@ namespace osu.Game.Screens.Select.Details
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Children = new[] Children = new[]
{ {
FirstValue = new StatisticRow(), //circle size/key amount FirstValue = new StatisticRow(), // circle size/key amount
HpDrain = new StatisticRow { Title = "HP Drain" }, HpDrain = new StatisticRow { Title = "HP Drain" },
Accuracy = new StatisticRow { Title = "Accuracy" }, Accuracy = new StatisticRow { Title = "Accuracy" },
ApproachRate = new StatisticRow { Title = "Approach Rate" }, ApproachRate = new StatisticRow { Title = "Approach Rate" },

View File

@ -798,7 +798,7 @@ namespace osu.Game.Screens.Select
Masking = true; Masking = true;
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Width = panel_overflow; //avoid horizontal masking so the panels don't clip when screen stack is pushed. Width = panel_overflow; // avoid horizontal masking so the panels don't clip when screen stack is pushed.
InternalChild = Content = new Container InternalChild = Content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,