mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 07:07:45 +08:00
Apply batch fixing of built-in types using var
This commit is contained in:
parent
1d7e97625a
commit
6944151486
@ -156,7 +156,7 @@ namespace osu.Desktop
|
||||
{
|
||||
lock (importableFiles)
|
||||
{
|
||||
var firstExtension = Path.GetExtension(filePaths.First());
|
||||
string firstExtension = Path.GetExtension(filePaths.First());
|
||||
|
||||
if (filePaths.Any(f => Path.GetExtension(f) != firstExtension)) return;
|
||||
|
||||
@ -177,7 +177,7 @@ namespace osu.Desktop
|
||||
{
|
||||
Logger.Log($"Handling batch import of {importableFiles.Count} files");
|
||||
|
||||
var paths = importableFiles.ToArray();
|
||||
string[] paths = importableFiles.ToArray();
|
||||
importableFiles.Clear();
|
||||
|
||||
Task.Factory.StartNew(() => Import(paths), TaskCreationOptions.LongRunning);
|
||||
|
@ -22,17 +22,17 @@ namespace osu.Desktop
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
// Back up the cwd before DesktopGameHost changes it
|
||||
var cwd = Environment.CurrentDirectory;
|
||||
string cwd = Environment.CurrentDirectory;
|
||||
|
||||
string gameName = base_game_name;
|
||||
bool tournamentClient = false;
|
||||
|
||||
foreach (var arg in args)
|
||||
foreach (string arg in args)
|
||||
{
|
||||
var split = arg.Split('=');
|
||||
string[] split = arg.Split('=');
|
||||
|
||||
var key = split[0];
|
||||
var val = split.Length > 1 ? split[1] : string.Empty;
|
||||
string key = split[0];
|
||||
string val = split.Length > 1 ? split[1] : string.Empty;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
@ -62,7 +62,7 @@ namespace osu.Desktop
|
||||
{
|
||||
var importer = new ArchiveImportIPCChannel(host);
|
||||
|
||||
foreach (var file in args)
|
||||
foreach (string file in args)
|
||||
{
|
||||
Console.WriteLine(@"Importing {0}", file);
|
||||
if (!importer.ImportAsync(Path.GetFullPath(file, cwd)).Wait(3000))
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Editor
|
||||
|
||||
AddAssert("correct outline count", () =>
|
||||
{
|
||||
var expected = hitObject.NestedHitObjects.Count(h => !(h is TinyDroplet));
|
||||
int expected = hitObject.NestedHitObjects.Count(h => !(h is TinyDroplet));
|
||||
return this.ChildrenOfType<FruitOutline>().Count() == expected;
|
||||
});
|
||||
AddAssert("correct vertex piece count", () =>
|
||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
[Test]
|
||||
public void TestCatcherCatchWidth()
|
||||
{
|
||||
var halfWidth = Catcher.CalculateCatchWidth(new BeatmapDifficulty { CircleSize = 0 }) / 2;
|
||||
float halfWidth = Catcher.CalculateCatchWidth(new BeatmapDifficulty { CircleSize = 0 }) / 2;
|
||||
AddStep("catch fruit", () =>
|
||||
{
|
||||
attemptCatch(new Fruit { X = -halfWidth + 1 });
|
||||
@ -237,7 +237,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
|
||||
private void attemptCatch(Func<CatchHitObject> hitObject, int count)
|
||||
{
|
||||
for (var i = 0; i < count; i++)
|
||||
for (int i = 0; i < count; i++)
|
||||
attemptCatch(hitObject(), out _, out _);
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
|
||||
private void spawnJuiceStream(bool hit = false)
|
||||
{
|
||||
var xCoords = getXCoords(hit);
|
||||
float xCoords = getXCoords(hit);
|
||||
|
||||
var juice = new JuiceStream
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing
|
||||
: base(hitObject, lastObject, clockRate)
|
||||
{
|
||||
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
|
||||
var scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
||||
float scalingFactor = normalized_hitobject_radius / halfCatcherWidth;
|
||||
|
||||
NormalizedPosition = BaseObject.EffectiveX * scalingFactor;
|
||||
LastNormalizedPosition = LastObject.EffectiveX * scalingFactor;
|
||||
|
@ -52,8 +52,8 @@ namespace osu.Game.Rulesets.Catch.Mods
|
||||
{
|
||||
var hitObject = drawable.HitObject;
|
||||
|
||||
var offset = hitObject.TimePreempt * fade_out_offset_multiplier;
|
||||
var duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier;
|
||||
double offset = hitObject.TimePreempt * fade_out_offset_multiplier;
|
||||
double duration = offset - hitObject.TimePreempt * fade_out_duration_multiplier;
|
||||
|
||||
using (drawable.BeginAbsoluteSequence(hitObject.StartTime - offset))
|
||||
drawable.FadeOut(duration);
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Catch.Replays
|
||||
|
||||
public override void CollectPendingInputs(List<IInput> inputs)
|
||||
{
|
||||
var position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
float position = Interpolation.ValueAt(CurrentTime, StartFrame.Position, EndFrame.Position, StartFrame.Time, EndFrame.Time);
|
||||
|
||||
inputs.Add(new CatchReplayState
|
||||
{
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Skinning.Legacy
|
||||
return null;
|
||||
|
||||
case CatchSkinComponents.Catcher:
|
||||
var version = GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value ?? 1;
|
||||
decimal version = GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version)?.Value ?? 1;
|
||||
|
||||
if (version < 2.3m)
|
||||
{
|
||||
|
@ -226,9 +226,9 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
if (result.IsHit && hitObject.HyperDash)
|
||||
{
|
||||
var target = hitObject.HyperDashTarget;
|
||||
var timeDifference = target.StartTime - hitObject.StartTime;
|
||||
double timeDifference = target.StartTime - hitObject.StartTime;
|
||||
double positionDifference = target.EffectiveX - X;
|
||||
var velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0);
|
||||
double velocity = positionDifference / Math.Max(1.0, timeDifference - 1000.0 / 60.0);
|
||||
|
||||
SetHyperDashState(Math.Abs(velocity), target.EffectiveX);
|
||||
}
|
||||
@ -266,7 +266,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
/// <param name="targetPosition">When this catcher crosses this position, this catcher ends hyper-dashing.</param>
|
||||
public void SetHyperDashState(double modifier = 1, float targetPosition = -1)
|
||||
{
|
||||
var wasHyperDashing = HyperDashing;
|
||||
bool wasHyperDashing = HyperDashing;
|
||||
|
||||
if (modifier <= 1 || X == targetPosition)
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Tests.Editor
|
||||
|
||||
protected override SnapResult SnapForBlueprint(PlacementBlueprint blueprint)
|
||||
{
|
||||
var time = column.TimeAtScreenSpacePosition(InputManager.CurrentState.Mouse.Position);
|
||||
double time = column.TimeAtScreenSpacePosition(InputManager.CurrentState.Mouse.Position);
|
||||
var pos = column.ScreenSpacePositionAtTime(time);
|
||||
|
||||
return new SnapResult(pos, time, column);
|
||||
|
@ -111,7 +111,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
|
||||
public int CompareTo(ConvertValue other)
|
||||
{
|
||||
var result = StartTime.CompareTo(other.StartTime);
|
||||
int result = StartTime.CompareTo(other.StartTime);
|
||||
|
||||
if (result != 0)
|
||||
return result;
|
||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
|
||||
private IEnumerable<ColumnType> getResults(StageDefinition definition)
|
||||
{
|
||||
for (var i = 0; i < definition.Columns; i++)
|
||||
for (int i = 0; i < definition.Columns; i++)
|
||||
yield return definition.GetTypeOfColumn(i);
|
||||
}
|
||||
}
|
||||
|
@ -42,8 +42,8 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
{
|
||||
IsForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo);
|
||||
|
||||
var roundedCircleSize = Math.Round(beatmap.Difficulty.CircleSize);
|
||||
var roundedOverallDifficulty = Math.Round(beatmap.Difficulty.OverallDifficulty);
|
||||
double roundedCircleSize = Math.Round(beatmap.Difficulty.CircleSize);
|
||||
double roundedOverallDifficulty = Math.Round(beatmap.Difficulty.OverallDifficulty);
|
||||
|
||||
if (IsForCurrentRuleset)
|
||||
{
|
||||
@ -73,7 +73,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
||||
|
||||
public static int GetColumnCountForNonConvert(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
var roundedCircleSize = Math.Round(beatmapInfo.BaseDifficulty.CircleSize);
|
||||
double roundedCircleSize = Math.Round(beatmapInfo.BaseDifficulty.CircleSize);
|
||||
return (int)Math.Max(1, roundedCircleSize);
|
||||
}
|
||||
|
||||
|
@ -493,7 +493,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
if (!(HitObject is IHasPathWithRepeats curveData))
|
||||
return null;
|
||||
|
||||
var index = SegmentDuration == 0 ? 0 : (time - StartTime) / SegmentDuration;
|
||||
int index = SegmentDuration == 0 ? 0 : (time - StartTime) / SegmentDuration;
|
||||
|
||||
// avoid slicing the list & creating copies, if at all possible.
|
||||
return index == 0 ? curveData.NodeSamples : curveData.NodeSamples.Skip(index).ToList();
|
||||
|
@ -302,7 +302,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy
|
||||
|
||||
var pattern = new Pattern();
|
||||
|
||||
int noteCount = getRandomNoteCountMirrored(centreProbability, p2, p3, out var addToCentre);
|
||||
int noteCount = getRandomNoteCountMirrored(centreProbability, p2, p3, out bool addToCentre);
|
||||
|
||||
int columnLimit = (TotalColumns % 2 == 0 ? TotalColumns : TotalColumns - 1) / 2;
|
||||
int nextColumn = GetRandomColumn(upperBound: columnLimit);
|
||||
|
@ -35,8 +35,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Skills
|
||||
protected override double StrainValueOf(DifficultyHitObject current)
|
||||
{
|
||||
var maniaCurrent = (ManiaDifficultyHitObject)current;
|
||||
var endTime = maniaCurrent.EndTime;
|
||||
var column = maniaCurrent.BaseObject.Column;
|
||||
double endTime = maniaCurrent.EndTime;
|
||||
int column = maniaCurrent.BaseObject.Column;
|
||||
|
||||
double holdFactor = 1.0; // Factor to all additional strains in case something else is held
|
||||
double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly
|
||||
|
@ -316,7 +316,7 @@ namespace osu.Game.Rulesets.Mania
|
||||
|
||||
case PlayfieldType.Dual:
|
||||
{
|
||||
var keys = getDualStageKeyCount(variant);
|
||||
int keys = getDualStageKeyCount(variant);
|
||||
return $"{keys}K + {keys}K";
|
||||
}
|
||||
}
|
||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Mania.MathUtils
|
||||
|
||||
while (i <= n / 2)
|
||||
{
|
||||
var child = 2 * i;
|
||||
int child = 2 * i;
|
||||
|
||||
if (child < n && comparer.Compare(keys[lo + child - 1], keys[lo + child]) < 0)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
|
||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||
{
|
||||
var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||
int availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||
|
||||
beatmap.HitObjects.OfType<ManiaHitObject>().ForEach(h => h.Column = availableColumns - 1 - h.Column);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
Seed.Value ??= RNG.Next();
|
||||
var rng = new Random((int)Seed.Value);
|
||||
|
||||
var availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||
int availableColumns = ((ManiaBeatmap)beatmap).TotalColumns;
|
||||
var shuffledColumns = Enumerable.Range(0, availableColumns).OrderBy(item => rng.Next()).ToList();
|
||||
|
||||
beatmap.HitObjects.OfType<ManiaHitObject>().ForEach(h => h.Column = shuffledColumns[h.Column]);
|
||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (Time.Current < HitObject.StartTime)
|
||||
return;
|
||||
|
||||
var startTime = holdStartTime?.Invoke();
|
||||
double? startTime = holdStartTime?.Invoke();
|
||||
|
||||
if (startTime == null || startTime > HitObject.StartTime)
|
||||
ApplyResult(r => r.Type = r.Judgement.MinResult);
|
||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Mania.Replays
|
||||
{
|
||||
var currentObject = Beatmap.HitObjects[i];
|
||||
var nextObjectInColumn = GetNextObject(i); // Get the next object that requires pressing the same button
|
||||
var releaseTime = calculateReleaseTime(currentObject, nextObjectInColumn);
|
||||
double releaseTime = calculateReleaseTime(currentObject, nextObjectInColumn);
|
||||
|
||||
yield return new HitPoint { Time = currentObject.StartTime, Column = currentObject.Column };
|
||||
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Mania.Skinning.Legacy
|
||||
isLegacySkin = new Lazy<bool>(() => GetConfig<LegacySkinConfiguration.LegacySetting, decimal>(LegacySkinConfiguration.LegacySetting.Version) != null);
|
||||
hasKeyTexture = new Lazy<bool>(() =>
|
||||
{
|
||||
var keyImage = this.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.KeyImage, 0)?.Value ?? "mania-key1";
|
||||
string keyImage = this.GetManiaSkinConfig<string>(LegacyManiaSkinConfigurationLookups.KeyImage, 0)?.Value ?? "mania-key1";
|
||||
return this.GetAnimation(keyImage, true, true) != null;
|
||||
});
|
||||
}
|
||||
|
@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
|
||||
private void scheduleHit() => AddStep("schedule action", () =>
|
||||
{
|
||||
var delay = hitCircle.StartTime - hitCircle.HitWindows.WindowFor(HitResult.Great) - Time.Current;
|
||||
double delay = hitCircle.StartTime - hitCircle.HitWindows.WindowFor(HitResult.Great) - Time.Current;
|
||||
Scheduler.AddDelayed(() => hitAreaReceptor.OnPressed(new KeyBindingPressEvent<OsuAction>(GetContainingInputManager().CurrentState, OsuAction.LeftButton)), delay);
|
||||
});
|
||||
}
|
||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
AddAssert("player score matching expected bonus score", () =>
|
||||
{
|
||||
// multipled by 2 to nullify the score multiplier. (autoplay mod selected)
|
||||
var totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2;
|
||||
double totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2;
|
||||
return totalScore == (int)(drawableSpinner.Result.RateAdjustedRotation / 360) * new SpinnerTick().CreateJudgement().MaxNumericResult;
|
||||
});
|
||||
|
||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
|
||||
// Skip the head circle
|
||||
var scoringTimes = slider.NestedHitObjects.Skip(1).Select(t => t.StartTime);
|
||||
foreach (var time in scoringTimes)
|
||||
foreach (double time in scoringTimes)
|
||||
computeVertex(time);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills
|
||||
{
|
||||
const double scale = 90;
|
||||
|
||||
var angleBonus = Math.Sqrt(
|
||||
double angleBonus = Math.Sqrt(
|
||||
Math.Max(osuPrevious.JumpDistance - scale, 0)
|
||||
* Math.Pow(Math.Sin(osuCurrent.Angle.Value - angle_bonus_begin), 2)
|
||||
* Math.Max(osuCurrent.JumpDistance - scale, 0));
|
||||
|
@ -184,7 +184,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
{
|
||||
Vector2[] oldControlPoints = slider.Path.ControlPoints.Select(cp => cp.Position).ToArray();
|
||||
var oldPosition = slider.Position;
|
||||
var oldStartTime = slider.StartTime;
|
||||
double oldStartTime = slider.StartTime;
|
||||
|
||||
if (ControlPoint == slider.Path.ControlPoints[0])
|
||||
{
|
||||
@ -205,7 +205,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
|
||||
if (!slider.Path.HasValidLength)
|
||||
{
|
||||
for (var i = 0; i < slider.Path.ControlPoints.Count; i++)
|
||||
for (int i = 0; i < slider.Path.ControlPoints.Count; i++)
|
||||
slider.Path.ControlPoints[i].Position = oldControlPoints[i];
|
||||
|
||||
slider.Position = oldPosition;
|
||||
|
@ -47,14 +47,14 @@ namespace osu.Game.Rulesets.Osu.Edit.Checks
|
||||
if (!(hitObjects[i + 1] is OsuHitObject nextHitObject) || nextHitObject is Spinner)
|
||||
continue;
|
||||
|
||||
var deltaTime = nextHitObject.StartTime - hitObject.GetEndTime();
|
||||
double deltaTime = nextHitObject.StartTime - hitObject.GetEndTime();
|
||||
if (deltaTime >= hitObject.TimeFadeIn + hitObject.TimePreempt)
|
||||
// The objects are not visible at the same time (without mods), hence skipping.
|
||||
continue;
|
||||
|
||||
var distanceSq = (hitObject.StackedEndPosition - nextHitObject.StackedPosition).LengthSquared;
|
||||
var diameter = (hitObject.Radius - overlap_leniency) * 2;
|
||||
var diameterSq = diameter * diameter;
|
||||
float distanceSq = (hitObject.StackedEndPosition - nextHitObject.StackedPosition).LengthSquared;
|
||||
double diameter = (hitObject.Radius - overlap_leniency) * 2;
|
||||
double diameterSq = diameter * diameter;
|
||||
|
||||
bool areOverlapping = distanceSq < diameterSq;
|
||||
|
||||
|
@ -88,21 +88,21 @@ namespace osu.Game.Rulesets.Osu.Edit.Checks
|
||||
if (!(hitObjects[i + 1] is OsuHitObject nextHitObject) || nextHitObject is Spinner)
|
||||
continue;
|
||||
|
||||
var deltaTime = nextHitObject.StartTime - hitObject.GetEndTime();
|
||||
double deltaTime = nextHitObject.StartTime - hitObject.GetEndTime();
|
||||
|
||||
// Ignore objects that are far enough apart in time to not be considered the same pattern.
|
||||
if (deltaTime > pattern_lifetime)
|
||||
continue;
|
||||
|
||||
// Relying on FastInvSqrt is probably good enough here. We'll be taking the difference between distances later, hence square not being sufficient.
|
||||
var distance = (hitObject.StackedEndPosition - nextHitObject.StackedPosition).LengthFast;
|
||||
float distance = (hitObject.StackedEndPosition - nextHitObject.StackedPosition).LengthFast;
|
||||
|
||||
// Ignore stacks and half-stacks, as these are close enough to where they can't be confused for being time-distanced.
|
||||
if (distance < stack_leniency)
|
||||
continue;
|
||||
|
||||
var observedTimeDistance = new ObservedTimeDistance(nextHitObject.StartTime, deltaTime, distance);
|
||||
var expectedDistance = getExpectedDistance(prevObservedTimeDistances, observedTimeDistance);
|
||||
double expectedDistance = getExpectedDistance(prevObservedTimeDistances, observedTimeDistance);
|
||||
|
||||
if (expectedDistance == 0)
|
||||
{
|
||||
@ -125,7 +125,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Checks
|
||||
|
||||
private double getExpectedDistance(IEnumerable<ObservedTimeDistance> prevObservedTimeDistances, ObservedTimeDistance observedTimeDistance)
|
||||
{
|
||||
var observations = prevObservedTimeDistances.Count();
|
||||
int observations = prevObservedTimeDistances.Count();
|
||||
|
||||
int count = 0;
|
||||
double sum = 0;
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
|
||||
int gridSizeIndex = Array.IndexOf(grid_sizes, editorBeatmap.BeatmapInfo.GridSize);
|
||||
if (gridSizeIndex >= 0)
|
||||
currentGridSizeIndex = gridSizeIndex;
|
||||
updateSpacing();
|
||||
|
@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
base.LoadComplete();
|
||||
|
||||
var firstObj = beatmap.HitObjects[0];
|
||||
var startDelay = firstObj.StartTime - firstObj.TimePreempt;
|
||||
double startDelay = firstObj.StartTime - firstObj.TimePreempt;
|
||||
|
||||
using (BeginAbsoluteSequence(startDelay + break_close_late))
|
||||
leaveBreak();
|
||||
|
@ -155,11 +155,11 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
static (double fadeStartTime, double fadeDuration) getParameters(OsuHitObject hitObject)
|
||||
{
|
||||
var fadeOutStartTime = hitObject.StartTime - hitObject.TimePreempt + hitObject.TimeFadeIn;
|
||||
var fadeOutDuration = hitObject.TimePreempt * fade_out_duration_multiplier;
|
||||
double fadeOutStartTime = hitObject.StartTime - hitObject.TimePreempt + hitObject.TimeFadeIn;
|
||||
double fadeOutDuration = hitObject.TimePreempt * fade_out_duration_multiplier;
|
||||
|
||||
// new duration from completed fade in to end (before fading out)
|
||||
var longFadeDuration = hitObject.GetEndTime() - fadeOutStartTime;
|
||||
double longFadeDuration = hitObject.GetEndTime() - fadeOutStartTime;
|
||||
|
||||
switch (hitObject)
|
||||
{
|
||||
@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
return (fadeOutStartTime, longFadeDuration);
|
||||
|
||||
case SliderTick _:
|
||||
var tickFadeOutDuration = Math.Min(hitObject.TimePreempt - DrawableSliderTick.ANIM_DURATION, 1000);
|
||||
double tickFadeOutDuration = Math.Min(hitObject.TimePreempt - DrawableSliderTick.ANIM_DURATION, 1000);
|
||||
return (hitObject.StartTime - tickFadeOutDuration, tickFadeOutDuration);
|
||||
|
||||
case Spinner _:
|
||||
|
@ -124,7 +124,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
// to allow jumps and prevent too sharp turns during streams.
|
||||
|
||||
// Allow maximum jump angle when jump distance is more than half of playfield diagonal length
|
||||
var randomAngleRad = rateOfChangeMultiplier * 2 * Math.PI * Math.Min(1f, distanceToPrev / (playfield_diagonal * 0.5f));
|
||||
double randomAngleRad = rateOfChangeMultiplier * 2 * Math.PI * Math.Min(1f, distanceToPrev / (playfield_diagonal * 0.5f));
|
||||
|
||||
current.AngleRad = (float)randomAngleRad + previous.AngleRad;
|
||||
if (current.AngleRad < 0)
|
||||
@ -171,11 +171,11 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
// Clamp slider position to the placement area
|
||||
// If the slider is larger than the playfield, force it to stay at the original position
|
||||
var newX = possibleMovementBounds.Width < 0
|
||||
float newX = possibleMovementBounds.Width < 0
|
||||
? objectInfo.PositionOriginal.X
|
||||
: Math.Clamp(previousPosition.X, possibleMovementBounds.Left, possibleMovementBounds.Right);
|
||||
|
||||
var newY = possibleMovementBounds.Height < 0
|
||||
float newY = possibleMovementBounds.Height < 0
|
||||
? objectInfo.PositionOriginal.Y
|
||||
: Math.Clamp(previousPosition.Y, possibleMovementBounds.Top, possibleMovementBounds.Bottom);
|
||||
|
||||
@ -235,7 +235,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
}
|
||||
|
||||
// Take the circle radius into account.
|
||||
var radius = (float)slider.Radius;
|
||||
float radius = (float)slider.Radius;
|
||||
|
||||
minX -= radius;
|
||||
minY -= radius;
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
// because the spinner is under the gameplay clock, it is affected by rate adjustments on the track;
|
||||
// for that reason using ElapsedFrameTime directly leads to fewer SPM with Half Time and more SPM with Double Time.
|
||||
// for spinners we want the real (wall clock) elapsed time; to achieve that, unapply the clock rate locally here.
|
||||
var rateIndependentElapsedTime = spinner.Clock.ElapsedFrameTime / spinner.Clock.Rate;
|
||||
double rateIndependentElapsedTime = spinner.Clock.ElapsedFrameTime / spinner.Clock.Rate;
|
||||
spinner.RotationTracker.AddRotation(MathUtils.RadiansToDegrees((float)rateIndependentElapsedTime * 0.03f));
|
||||
}
|
||||
}
|
||||
|
@ -193,8 +193,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
private IEnumerable<double> generateBeats(IBeatmap beatmap)
|
||||
{
|
||||
var startTime = originalHitObjects.First().StartTime;
|
||||
var endTime = originalHitObjects.Last().GetEndTime();
|
||||
double startTime = originalHitObjects.First().StartTime;
|
||||
double endTime = originalHitObjects.Last().GetEndTime();
|
||||
|
||||
var beats = beatmap.ControlPointInfo.TimingPoints
|
||||
// Ignore timing points after endTime
|
||||
@ -208,9 +208,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
.ToList();
|
||||
|
||||
// Remove beats that are too close to the next one (e.g. due to timing point changes)
|
||||
for (var i = beats.Count - 2; i >= 0; i--)
|
||||
for (int i = beats.Count - 2; i >= 0; i--)
|
||||
{
|
||||
var beat = beats[i];
|
||||
double beat = beats[i];
|
||||
|
||||
if (!definitelyBigger(beats[i + 1] - beat, beatmap.ControlPointInfo.TimingPointAt(beat).BeatLength / 2))
|
||||
beats.RemoveAt(i);
|
||||
@ -250,13 +250,13 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
// Other kinds of combo info are also added in the process
|
||||
var combos = hitObjects.GroupBy(x => x.ComboIndex).ToList();
|
||||
|
||||
for (var i = 0; i < combos.Count; i++)
|
||||
for (int i = 0; i < combos.Count; i++)
|
||||
{
|
||||
var group = combos[i].ToList();
|
||||
group.First().NewCombo = true;
|
||||
group.Last().LastInCombo = true;
|
||||
|
||||
for (var j = 0; j < group.Count; j++)
|
||||
for (int j = 0; j < group.Count; j++)
|
||||
{
|
||||
var x = group[j];
|
||||
x.ComboIndex = i;
|
||||
@ -273,17 +273,17 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
const float two_pi = MathF.PI * 2;
|
||||
|
||||
var direction = two_pi * nextSingle();
|
||||
var maxComboIndex = hitObjects.Last().ComboIndex;
|
||||
float direction = two_pi * nextSingle();
|
||||
int maxComboIndex = hitObjects.Last().ComboIndex;
|
||||
|
||||
for (var i = 0; i < hitObjects.Count; i++)
|
||||
for (int i = 0; i < hitObjects.Count; i++)
|
||||
{
|
||||
var obj = hitObjects[i];
|
||||
var lastPos = i == 0
|
||||
? Vector2.Divide(OsuPlayfield.BASE_SIZE, 2)
|
||||
: hitObjects[i - 1].Position;
|
||||
|
||||
var distance = maxComboIndex == 0
|
||||
float distance = maxComboIndex == 0
|
||||
? (float)obj.Radius
|
||||
: mapRange(obj.ComboIndex, 0, maxComboIndex, (float)obj.Radius, max_base_distance);
|
||||
if (obj.NewCombo) distance *= 1.5f;
|
||||
@ -292,7 +292,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
// Attempt to place the circle at a place that does not overlap with previous ones
|
||||
|
||||
var tryCount = 0;
|
||||
int tryCount = 0;
|
||||
|
||||
// for checking overlap
|
||||
var precedingObjects = hitObjects.SkipLast(hitObjects.Count - i).TakeLast(overlap_check_count).ToList();
|
||||
@ -363,7 +363,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
var beats = new List<double>();
|
||||
int i = 0;
|
||||
var currentTime = timingPoint.Time;
|
||||
double currentTime = timingPoint.Time;
|
||||
|
||||
while (!definitelyBigger(currentTime, mapEndTime) && controlPointInfo.TimingPointAt(currentTime) == timingPoint)
|
||||
{
|
||||
@ -377,7 +377,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
private OsuHitObject getClosestHitObject(List<OsuHitObject> hitObjects, double time)
|
||||
{
|
||||
var precedingIndex = hitObjects.FindLastIndex(h => h.StartTime < time);
|
||||
int precedingIndex = hitObjects.FindLastIndex(h => h.StartTime < time);
|
||||
|
||||
if (precedingIndex == hitObjects.Count - 1) return hitObjects[precedingIndex];
|
||||
|
||||
@ -457,7 +457,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
private void clampToPlayfield(OsuHitObject obj)
|
||||
{
|
||||
var position = obj.Position;
|
||||
var radius = (float)obj.Radius;
|
||||
float radius = (float)obj.Radius;
|
||||
|
||||
if (position.Y < radius)
|
||||
position.Y = radius;
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
Vector2 pointStartPosition = startPosition + (fraction - 0.1f) * distanceVector;
|
||||
Vector2 pointEndPosition = startPosition + fraction * distanceVector;
|
||||
|
||||
GetFadeTimes(start, end, (float)d / distance, out var fadeInTime, out var fadeOutTime);
|
||||
GetFadeTimes(start, end, (float)d / distance, out double fadeInTime, out double fadeOutTime);
|
||||
|
||||
FollowPoint fp;
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
|
||||
// The lifetime start will match the fade-in time of the first follow point.
|
||||
float fraction = (int)(FollowPointConnection.SPACING * 1.5) / distanceVector.Length;
|
||||
FollowPointConnection.GetFadeTimes(Start, End, fraction, out var fadeInTime, out _);
|
||||
FollowPointConnection.GetFadeTimes(Start, End, fraction, out double fadeInTime, out _);
|
||||
|
||||
LifetimeStart = fadeInTime;
|
||||
LifetimeEnd = double.MaxValue; // This will be set by the connection.
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections
|
||||
{
|
||||
var newEntry = new FollowPointLifetimeEntry(hitObject);
|
||||
|
||||
var index = lifetimeEntries.AddInPlace(newEntry, Comparer<FollowPointLifetimeEntry>.Create((e1, e2) =>
|
||||
int index = lifetimeEntries.AddInPlace(newEntry, Comparer<FollowPointLifetimeEntry>.Create((e1, e2) =>
|
||||
{
|
||||
int comp = e1.Start.StartTime.CompareTo(e2.Start.StartTime);
|
||||
|
||||
|
@ -70,8 +70,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
|
||||
Slider slider = drawableSlider.HitObject;
|
||||
|
||||
var span = slider.SpanAt(completionProgress);
|
||||
var spanProgress = slider.ProgressAt(completionProgress);
|
||||
int span = slider.SpanAt(completionProgress);
|
||||
double spanProgress = slider.ProgressAt(completionProgress);
|
||||
|
||||
double start = 0;
|
||||
double end = SnakingIn.Value ? Math.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / (slider.TimePreempt / 3), 0, 1) : 1;
|
||||
@ -110,8 +110,8 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
snakedPosition = Path.PositionInBoundingBox(Vector2.Zero);
|
||||
snakedPathOffset = Path.PositionInBoundingBox(Path.Vertices[0]);
|
||||
|
||||
var lastSnakedStart = SnakedStart ?? 0;
|
||||
var lastSnakedEnd = SnakedEnd ?? 0;
|
||||
double lastSnakedStart = SnakedStart ?? 0;
|
||||
double lastSnakedEnd = SnakedEnd ?? 0;
|
||||
|
||||
SnakedStart = null;
|
||||
SnakedEnd = null;
|
||||
|
@ -62,9 +62,9 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
var thisAngle = -MathUtils.RadiansToDegrees(MathF.Atan2(mousePosition.X - DrawSize.X / 2, mousePosition.Y - DrawSize.Y / 2));
|
||||
float thisAngle = -MathUtils.RadiansToDegrees(MathF.Atan2(mousePosition.X - DrawSize.X / 2, mousePosition.Y - DrawSize.Y / 2));
|
||||
|
||||
var delta = thisAngle - lastAngle;
|
||||
float delta = thisAngle - lastAngle;
|
||||
|
||||
if (Tracking)
|
||||
AddRotation(delta);
|
||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
if (hasNumber)
|
||||
{
|
||||
var legacyVersion = skin.GetConfig<LegacySetting, decimal>(LegacySetting.Version)?.Value;
|
||||
decimal? legacyVersion = skin.GetConfig<LegacySetting, decimal>(LegacySetting.Version)?.Value;
|
||||
|
||||
if (legacyVersion >= 2.0m)
|
||||
// legacy skins of version 2.0 and newer only apply very short fade out to the number piece.
|
||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
// careful: need to call this exactly once for all calculations in a frame
|
||||
// as the function has a random factor in it
|
||||
var metreHeight = getMetreHeight(DrawableSpinner.Progress);
|
||||
float metreHeight = getMetreHeight(DrawableSpinner.Progress);
|
||||
|
||||
// hack to make the metre blink up from below than down from above.
|
||||
// move down the container to be able to apply masking for the metre,
|
||||
|
@ -216,7 +216,7 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
// Likewise sin(pi/2)=1 and sin(3pi/2)=-1, whereas we actually want these values to appear on the bottom/top respectively, so the y-coordinate also needs to be inverted.
|
||||
//
|
||||
// We also need to apply the anti-clockwise rotation.
|
||||
var rotatedAngle = finalAngle - MathUtils.DegreesToRadians(rotation);
|
||||
double rotatedAngle = finalAngle - MathUtils.DegreesToRadians(rotation);
|
||||
var rotatedCoordinate = -1 * new Vector2((float)Math.Cos(rotatedAngle), (float)Math.Sin(rotatedAngle));
|
||||
|
||||
Vector2 localCentre = new Vector2(points_per_dimension - 1) / 2;
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Utils
|
||||
/// <returns>The new position of the hit object, relative to the previous one.</returns>
|
||||
public static Vector2 RotateAwayFromEdge(Vector2 prevObjectPos, Vector2 posRelativeToPrev, float rotationRatio = 0.5f)
|
||||
{
|
||||
var relativeRotationDistance = 0f;
|
||||
float relativeRotationDistance = 0f;
|
||||
|
||||
if (prevObjectPos.X < playfield_middle.X)
|
||||
{
|
||||
@ -88,16 +88,16 @@ namespace osu.Game.Rulesets.Osu.Utils
|
||||
/// <returns>The rotated vector.</returns>
|
||||
public static Vector2 RotateVectorTowardsVector(Vector2 initial, Vector2 destination, float rotationRatio)
|
||||
{
|
||||
var initialAngleRad = MathF.Atan2(initial.Y, initial.X);
|
||||
var destAngleRad = MathF.Atan2(destination.Y, destination.X);
|
||||
float initialAngleRad = MathF.Atan2(initial.Y, initial.X);
|
||||
float destAngleRad = MathF.Atan2(destination.Y, destination.X);
|
||||
|
||||
var diff = destAngleRad - initialAngleRad;
|
||||
float diff = destAngleRad - initialAngleRad;
|
||||
|
||||
while (diff < -MathF.PI) diff += 2 * MathF.PI;
|
||||
|
||||
while (diff > MathF.PI) diff -= 2 * MathF.PI;
|
||||
|
||||
var finalAngleRad = initialAngleRad + rotationRatio * diff;
|
||||
float finalAngleRad = initialAngleRad + rotationRatio * diff;
|
||||
|
||||
return new Vector2(
|
||||
initial.Length * MathF.Cos(finalAngleRad),
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
base.SetUpSteps();
|
||||
|
||||
var expectedSampleNames = new[]
|
||||
string[] expectedSampleNames = new[]
|
||||
{
|
||||
string.Empty,
|
||||
string.Empty,
|
||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Rulesets.Taiko.Beatmaps
|
||||
{
|
||||
case IHasDistance distanceData:
|
||||
{
|
||||
if (shouldConvertSliderToHits(obj, beatmap, distanceData, out var taikoDuration, out var tickSpacing))
|
||||
if (shouldConvertSliderToHits(obj, beatmap, distanceData, out int taikoDuration, out double tickSpacing))
|
||||
{
|
||||
List<IList<HitSampleInfo>> allSamples = obj is IHasPathWithRepeats curveData ? curveData.NodeSamples : new List<IList<HitSampleInfo>>(new[] { samples });
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
var corrected = samples.ToList();
|
||||
|
||||
for (var i = 0; i < corrected.Count; i++)
|
||||
for (int i = 0; i < corrected.Count; i++)
|
||||
{
|
||||
var s = corrected[i];
|
||||
|
||||
@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
validActionPressed = HitActions.Contains(e.Action);
|
||||
|
||||
// Only count this as handled if the new judgement is a hit
|
||||
var result = UpdateResult(true);
|
||||
bool result = UpdateResult(true);
|
||||
if (IsHit)
|
||||
HitAction = e.Action;
|
||||
|
||||
|
@ -185,9 +185,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
|
||||
nextTick?.TriggerResult(true);
|
||||
|
||||
var numHits = ticks.Count(r => r.IsHit);
|
||||
int numHits = ticks.Count(r => r.IsHit);
|
||||
|
||||
var completion = (float)numHits / HitObject.RequiredHits;
|
||||
float completion = (float)numHits / HitObject.RequiredHits;
|
||||
|
||||
expandingRing
|
||||
.FadeTo(expandingRing.Alpha + Math.Clamp(completion / 16, 0.1f, 0.6f), 50)
|
||||
@ -273,7 +273,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
if (Time.Current < HitObject.StartTime)
|
||||
return false;
|
||||
|
||||
var isCentre = e.Action == TaikoAction.LeftCentre || e.Action == TaikoAction.RightCentre;
|
||||
bool isCentre = e.Action == TaikoAction.LeftCentre || e.Action == TaikoAction.RightCentre;
|
||||
|
||||
// Ensure alternating centre and rim hits
|
||||
if (lastWasCentre == isCentre)
|
||||
|
@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
|
||||
case TaikoSkinComponents.TaikoExplosionOk:
|
||||
case TaikoSkinComponents.TaikoExplosionGreat:
|
||||
var hitName = getHitName(taikoComponent.Component);
|
||||
string hitName = getHitName(taikoComponent.Component);
|
||||
var hitSprite = this.GetAnimation(hitName, true, false);
|
||||
|
||||
if (hitSprite != null)
|
||||
@ -162,10 +162,10 @@ namespace osu.Game.Rulesets.Taiko.Skinning.Legacy
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (var name in base.LookupNames)
|
||||
foreach (string name in base.LookupNames)
|
||||
yield return name.Insert(name.LastIndexOf('/') + 1, "taiko-");
|
||||
|
||||
foreach (var name in base.LookupNames)
|
||||
foreach (string name in base.LookupNames)
|
||||
yield return name;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
base.Update();
|
||||
|
||||
// Remove any auxiliary hit notes that were spawned during a drum roll but subsequently rewound.
|
||||
for (var i = AliveInternalChildren.Count - 1; i >= 0; i--)
|
||||
for (int i = AliveInternalChildren.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var flyingHit = (DrawableFlyingHit)AliveInternalChildren[i];
|
||||
if (Time.Current <= flyingHit.HitObject.StartTime)
|
||||
|
@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
|
||||
if (skin == null) return;
|
||||
|
||||
foreach (var frameIndex in clear_animation_sequence)
|
||||
foreach (int frameIndex in clear_animation_sequence)
|
||||
{
|
||||
var texture = getAnimationFrame(skin, TaikoMascotAnimationState.Clear, frameIndex);
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
|
||||
protected override bool ShouldSkipLine(string line)
|
||||
{
|
||||
var result = base.ShouldSkipLine(line);
|
||||
bool result = base.ShouldSkipLine(line);
|
||||
|
||||
if (!result)
|
||||
ParsedLines.Add(line);
|
||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var tempPath = TestResources.GetTestBeatmapForImport();
|
||||
string tempPath = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
@ -144,7 +144,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -196,7 +196,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -251,7 +251,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -302,7 +302,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -424,7 +424,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
checkBeatmapCount(osu, 12);
|
||||
checkSingleReferencedFileCount(osu, 18);
|
||||
|
||||
var brokenTempFilename = TestResources.GetTestBeatmapForImport();
|
||||
string brokenTempFilename = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
MemoryStream brokenOsu = new MemoryStream();
|
||||
MemoryStream brokenOsz = new MemoryStream(await File.ReadAllBytesAsync(brokenTempFilename));
|
||||
@ -594,7 +594,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
var importer = new ArchiveImportIPCChannel(client);
|
||||
if (!importer.ImportAsync(temp).Wait(10000))
|
||||
@ -619,7 +619,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
try
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
using (File.OpenRead(temp))
|
||||
await osu.Dependencies.Get<BeatmapManager>().Import(temp);
|
||||
ensureLoaded(osu);
|
||||
@ -642,7 +642,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -684,7 +684,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
string subfolder = Path.Combine(extractedFolder, "subfolder");
|
||||
@ -729,7 +729,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
{
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
string dataFolder = Path.Combine(extractedFolder, "actual_data");
|
||||
@ -784,7 +784,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
await osu.Dependencies.Get<BeatmapManager>().Import(temp);
|
||||
|
||||
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
||||
@ -814,7 +814,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
var osu = LoadOsuIntoHost(host);
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
await osu.Dependencies.Get<BeatmapManager>().Import(temp);
|
||||
|
||||
BeatmapSetInfo setToUpdate = manager.GetAllUsableBeatmapSets()[0];
|
||||
@ -905,7 +905,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
public static async Task<BeatmapSetInfo> LoadQuickOszIntoOsu(OsuGameBase osu)
|
||||
{
|
||||
var temp = TestResources.GetQuickTestBeatmapForImport();
|
||||
string temp = TestResources.GetQuickTestBeatmapForImport();
|
||||
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
@ -920,7 +920,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
public static async Task<BeatmapSetInfo> LoadOszIntoOsu(OsuGameBase osu, string path = null, bool virtualTrack = false)
|
||||
{
|
||||
var temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
string temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
|
||||
var manager = osu.Dependencies.Get<BeatmapManager>();
|
||||
|
||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
Assert.AreEqual("this line is gone", bufferedReader.ReadLine());
|
||||
Assert.AreEqual("this one shouldn't be", bufferedReader.PeekLine());
|
||||
|
||||
var endingLines = bufferedReader.ReadToEnd().Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] endingLines = bufferedReader.ReadToEnd().Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Assert.AreEqual(3, endingLines.Length);
|
||||
Assert.AreEqual("this one shouldn't be", endingLines[0]);
|
||||
Assert.AreEqual("these ones", endingLines[1]);
|
||||
|
@ -36,8 +36,8 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
"Soleily - Renatus (MMzz) [Muzukashii].osu",
|
||||
"Soleily - Renatus (MMzz) [Oni].osu"
|
||||
};
|
||||
var maps = reader.Filenames.ToArray();
|
||||
foreach (var map in expected)
|
||||
string[] maps = reader.Filenames.ToArray();
|
||||
foreach (string map in expected)
|
||||
Assert.Contains(map, maps);
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var tempPath = TestResources.GetTestBeatmapForImport();
|
||||
string? tempPath = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
ILive<RealmBeatmapSet>? importedSet;
|
||||
|
||||
@ -144,7 +144,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -193,7 +193,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -245,7 +245,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -293,7 +293,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -391,7 +391,7 @@ namespace osu.Game.Tests.Database
|
||||
checkBeatmapCount(realmFactory.Context, 12);
|
||||
checkSingleReferencedFileCount(realmFactory.Context, 18);
|
||||
|
||||
var brokenTempFilename = TestResources.GetTestBeatmapForImport();
|
||||
string? brokenTempFilename = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
MemoryStream brokenOsu = new MemoryStream();
|
||||
MemoryStream brokenOsz = new MemoryStream(await File.ReadAllBytesAsync(brokenTempFilename));
|
||||
@ -522,7 +522,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
using (File.OpenRead(temp))
|
||||
await importer.Import(temp);
|
||||
ensureLoaded(realmFactory.Context);
|
||||
@ -539,7 +539,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
@ -575,7 +575,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
string subfolder = Path.Combine(extractedFolder, "subfolder");
|
||||
@ -617,7 +617,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
string dataFolder = Path.Combine(extractedFolder, "actual_data");
|
||||
@ -668,7 +668,7 @@ namespace osu.Game.Tests.Database
|
||||
using var importer = new BeatmapImporter(realmFactory, storage);
|
||||
using var store = new RealmRulesetStore(realmFactory, storage);
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string? temp = TestResources.GetTestBeatmapForImport();
|
||||
await importer.Import(temp);
|
||||
|
||||
// Update via the beatmap, not the beatmap info, to ensure correct linking
|
||||
@ -685,7 +685,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
public static async Task<RealmBeatmapSet?> LoadQuickOszIntoOsu(BeatmapImporter importer, Realm realm)
|
||||
{
|
||||
var temp = TestResources.GetQuickTestBeatmapForImport();
|
||||
string? temp = TestResources.GetQuickTestBeatmapForImport();
|
||||
|
||||
var importedSet = await importer.Import(new ImportTask(temp));
|
||||
|
||||
@ -700,7 +700,7 @@ namespace osu.Game.Tests.Database
|
||||
|
||||
public static async Task<RealmBeatmapSet> LoadOszIntoStore(BeatmapImporter importer, Realm realm, string? path = null, bool virtualTrack = false)
|
||||
{
|
||||
var temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
string? temp = path ?? TestResources.GetTestBeatmapForImport(virtualTrack);
|
||||
|
||||
var importedSet = await importer.Import(new ImportTask(temp));
|
||||
|
||||
|
@ -49,7 +49,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
for (int i = 0; i * beat_length_denominator < barLines.Count; i++)
|
||||
{
|
||||
var barLine = barLines[i * beat_length_denominator];
|
||||
var expectedTime = beat_length_numerator * (int)signature * i;
|
||||
int expectedTime = beat_length_numerator * (int)signature * i;
|
||||
|
||||
// every seventh bar's start time should be at least greater than the whole number we expect.
|
||||
// It cannot be less, as that can affect overlapping scroll algorithms
|
||||
|
@ -87,7 +87,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
File.WriteAllText(actualTestFile, "test");
|
||||
|
||||
var rulesetStorage = storage.GetStorageForDirectory("rulesets");
|
||||
var lookupPath = rulesetStorage.GetFiles(".").Single();
|
||||
string lookupPath = rulesetStorage.GetFiles(".").Single();
|
||||
|
||||
Assert.That(lookupPath, Is.EqualTo("test"));
|
||||
}
|
||||
@ -140,7 +140,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
|
||||
Assert.That(osuStorage, Is.Not.Null);
|
||||
|
||||
foreach (var file in osuStorage.IgnoreFiles)
|
||||
foreach (string file in osuStorage.IgnoreFiles)
|
||||
{
|
||||
// avoid touching realm files which may be a pipe and break everything.
|
||||
// this is also done locally inside OsuStorage via the IgnoreFiles list.
|
||||
@ -149,7 +149,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.That(storage.Exists(file), Is.False);
|
||||
}
|
||||
|
||||
foreach (var dir in osuStorage.IgnoreDirectories)
|
||||
foreach (string dir in osuStorage.IgnoreDirectories)
|
||||
{
|
||||
Assert.That(Directory.Exists(Path.Combine(originalDirectory, dir)));
|
||||
Assert.That(storage.ExistsDirectory(dir), Is.False);
|
||||
|
@ -347,7 +347,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
{
|
||||
for (int i = 0; i < 1000; i++)
|
||||
{
|
||||
var time = handler.SetFrameFromTime(destination);
|
||||
double? time = handler.SetFrameFromTime(destination);
|
||||
if (time == null || time == destination)
|
||||
return;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.Throws<InvalidOperationException>(() => _ = queue.Dequeue());
|
||||
|
||||
int count = 0;
|
||||
foreach (var _ in queue)
|
||||
foreach (int _ in queue)
|
||||
count++;
|
||||
|
||||
Assert.AreEqual(0, count);
|
||||
@ -50,7 +50,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.AreEqual(i, queue[i]);
|
||||
|
||||
int j = 0;
|
||||
foreach (var item in queue)
|
||||
foreach (int item in queue)
|
||||
Assert.AreEqual(j++, item);
|
||||
|
||||
for (int i = queue.Count; i < queue.Count + capacity; i++)
|
||||
@ -71,7 +71,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
Assert.AreEqual(count - capacity + i, queue[i]);
|
||||
|
||||
int j = count - capacity;
|
||||
foreach (var item in queue)
|
||||
foreach (int item in queue)
|
||||
Assert.AreEqual(j++, item);
|
||||
|
||||
for (int i = queue.Count; i < queue.Count + capacity; i++)
|
||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Tests.NonVisual.Multiplayer
|
||||
{
|
||||
for (int i = 0; i < userCount; ++i)
|
||||
{
|
||||
var userId = Client.Room?.Users[i].UserID ?? throw new AssertionException("Room cannot be null!");
|
||||
int userId = Client.Room?.Users[i].UserID ?? throw new AssertionException("Room cannot be null!");
|
||||
Client.ChangeUserState(userId, state);
|
||||
}
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
});
|
||||
|
||||
int count = 0;
|
||||
foreach (var unused in queue)
|
||||
foreach (char unused in queue)
|
||||
count++;
|
||||
|
||||
Assert.AreEqual(0, count);
|
||||
@ -72,7 +72,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
|
||||
// Assert correct item return and no longer in queue after dequeueing
|
||||
Assert.AreEqual('a', queue[5]);
|
||||
var dequeuedItem = queue.Dequeue();
|
||||
char dequeuedItem = queue.Dequeue();
|
||||
|
||||
Assert.AreEqual('a', dequeuedItem);
|
||||
Assert.AreEqual(5, queue.Count);
|
||||
@ -133,7 +133,7 @@ namespace osu.Game.Tests.NonVisual
|
||||
int expectedValueIndex = 0;
|
||||
|
||||
// Assert items are enumerated in correct order
|
||||
foreach (var item in queue)
|
||||
foreach (char item in queue)
|
||||
{
|
||||
Assert.AreEqual(expectedValues[expectedValueIndex], item);
|
||||
expectedValueIndex++;
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Tests.Online
|
||||
MatchState = new TeamVersusRoomState()
|
||||
};
|
||||
|
||||
var serialized = MessagePackSerializer.Serialize(room);
|
||||
byte[] serialized = MessagePackSerializer.Serialize(room);
|
||||
|
||||
var deserialized = MessagePackSerializer.Deserialize<MultiplayerRoom>(serialized);
|
||||
|
||||
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Online
|
||||
{
|
||||
var state = new TeamVersusUserState();
|
||||
|
||||
var serialized = MessagePackSerializer.Serialize(typeof(MatchUserState), state);
|
||||
byte[] serialized = MessagePackSerializer.Serialize(typeof(MatchUserState), state);
|
||||
var deserialized = MessagePackSerializer.Deserialize<MatchUserState>(serialized);
|
||||
|
||||
Assert.IsTrue(deserialized is TeamVersusUserState);
|
||||
@ -44,7 +44,7 @@ namespace osu.Game.Tests.Online
|
||||
var state = new TeamVersusUserState();
|
||||
|
||||
// SignalR serialises using the actual type, rather than a base specification.
|
||||
var serialized = MessagePackSerializer.Serialize(typeof(TeamVersusUserState), state);
|
||||
byte[] serialized = MessagePackSerializer.Serialize(typeof(TeamVersusUserState), state);
|
||||
|
||||
// works with explicit type specified.
|
||||
MessagePackSerializer.Deserialize<TeamVersusUserState>(serialized);
|
||||
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Online
|
||||
var state = new TeamVersusUserState();
|
||||
|
||||
// SignalR serialises using the actual type, rather than a base specification.
|
||||
var serialized = MessagePackSerializer.Serialize(typeof(TeamVersusUserState), state, SignalRUnionWorkaroundResolver.OPTIONS);
|
||||
byte[] serialized = MessagePackSerializer.Serialize(typeof(TeamVersusUserState), state, SignalRUnionWorkaroundResolver.OPTIONS);
|
||||
|
||||
// works with explicit type specified.
|
||||
MessagePackSerializer.Deserialize<TeamVersusUserState>(serialized);
|
||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Tests.Resources
|
||||
/// <returns>A path to a copy of a beatmap archive (osz). Should be deleted after use.</returns>
|
||||
public static string GetQuickTestBeatmapForImport()
|
||||
{
|
||||
var tempPath = getTempFilename();
|
||||
string tempPath = getTempFilename();
|
||||
using (var stream = OpenResource("Archives/241526 Soleily - Renatus_virtual_quick.osz"))
|
||||
using (var newFile = File.Create(tempPath))
|
||||
stream.CopyTo(newFile);
|
||||
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Resources
|
||||
/// <returns>A path to a copy of a beatmap archive (osz). Should be deleted after use.</returns>
|
||||
public static string GetTestBeatmapForImport(bool virtualTrack = false)
|
||||
{
|
||||
var tempPath = getTempFilename();
|
||||
string tempPath = getTempFilename();
|
||||
|
||||
using (var stream = GetTestBeatmapStream(virtualTrack))
|
||||
using (var newFile = File.Create(tempPath))
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
private Vector2 getPositionForDivisor(int divisor)
|
||||
{
|
||||
var relativePosition = (float)Math.Clamp(divisor, 0, 16) / 16;
|
||||
float relativePosition = (float)Math.Clamp(divisor, 0, 16) / 16;
|
||||
var sliderDrawQuad = tickSliderBar.ScreenSpaceDrawQuad;
|
||||
return new Vector2(
|
||||
sliderDrawQuad.TopLeft.X + sliderDrawQuad.Width * relativePosition,
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
var setup = Editor.ChildrenOfType<SetupScreen>().First();
|
||||
|
||||
var temp = TestResources.GetTestBeatmapForImport();
|
||||
string temp = TestResources.GetTestBeatmapForImport();
|
||||
|
||||
string extractedFolder = $"{temp}_extracted";
|
||||
Directory.CreateDirectory(extractedFolder);
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
showOverlay();
|
||||
|
||||
var retryCount = 0;
|
||||
int retryCount = 0;
|
||||
|
||||
AddRepeatStep("Add retry", () =>
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
{ PLAYER_2_ID, new ManualClock() }
|
||||
};
|
||||
|
||||
foreach (var (userId, _) in clocks)
|
||||
foreach ((int userId, var _) in clocks)
|
||||
{
|
||||
SpectatorClient.StartPlay(userId, 0);
|
||||
OnlinePlayDependencies.Client.AddUser(new User { Id = userId });
|
||||
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddStep("add clock sources", () =>
|
||||
{
|
||||
foreach (var (userId, clock) in clocks)
|
||||
foreach ((int userId, var clock) in clocks)
|
||||
leaderboard.AddClock(userId, clock);
|
||||
});
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestSpectatingDuringGameplay()
|
||||
{
|
||||
var players = new[] { PLAYER_1_ID, PLAYER_2_ID };
|
||||
int[] players = new[] { PLAYER_1_ID, PLAYER_2_ID };
|
||||
|
||||
start(players);
|
||||
sendFrames(players, 300);
|
||||
@ -326,7 +326,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
for (int count = 3; count >= 0; count--)
|
||||
{
|
||||
var id = PLAYER_1_ID + count;
|
||||
int id = PLAYER_1_ID + count;
|
||||
|
||||
end(id);
|
||||
AddUntilStep($"{id} area grayed", () => getInstance(id).Colour != Color4.White);
|
||||
|
@ -582,7 +582,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
// Gameplay runs in real-time, so we need to incrementally check if gameplay has finished in order to not time out.
|
||||
for (double i = 1000; i < TestResources.QUICK_BEATMAP_LENGTH; i += 1000)
|
||||
{
|
||||
var time = i;
|
||||
double time = i;
|
||||
AddUntilStep($"wait for time > {i}", () => this.ChildrenOfType<GameplayClockContainer>().SingleOrDefault()?.GameplayClock.CurrentTime > time);
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
||||
var multiplayerUsers = new List<MultiplayerRoomUser>();
|
||||
|
||||
foreach (var user in users)
|
||||
foreach (int user in users)
|
||||
{
|
||||
SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0);
|
||||
multiplayerUsers.Add(OnlinePlayDependencies.Client.AddUser(new User { Id = user }, true));
|
||||
@ -89,7 +89,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
[Test]
|
||||
public void TestUserQuit()
|
||||
{
|
||||
foreach (var user in users)
|
||||
foreach (int user in users)
|
||||
AddStep($"mark user {user} quit", () => Client.RemoveUser(LookupCache.GetUserAsync(user).Result.AsNonNull()));
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public void RandomlyUpdateState()
|
||||
{
|
||||
foreach (var userId in PlayingUsers)
|
||||
foreach (int userId in PlayingUsers)
|
||||
{
|
||||
if (RNG.NextBool())
|
||||
continue;
|
||||
|
@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var playableBeatmap = Beatmap.Value.GetPlayableBeatmap(Ruleset.Value);
|
||||
var multiplayerUsers = new List<MultiplayerRoomUser>();
|
||||
|
||||
foreach (var user in users)
|
||||
foreach (int user in users)
|
||||
{
|
||||
SpectatorClient.StartPlay(user, Beatmap.Value.BeatmapInfo.OnlineBeatmapID ?? 0);
|
||||
var roomUser = OnlinePlayDependencies.Client.AddUser(new User { Id = user }, true);
|
||||
|
@ -112,7 +112,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
AddRepeatStep("increment progress", () =>
|
||||
{
|
||||
var progress = this.ChildrenOfType<ParticipantPanel>().Single().User.BeatmapAvailability.DownloadProgress ?? 0;
|
||||
float progress = this.ChildrenOfType<ParticipantPanel>().Single().User.BeatmapAvailability.DownloadProgress ?? 0;
|
||||
Client.ChangeBeatmapAvailability(BeatmapAvailability.Downloading(progress + RNG.NextSingle(0.1f)));
|
||||
}, 25);
|
||||
|
||||
|
@ -190,8 +190,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
for (int zeroBasedIndex = 0; zeroBasedIndex < 10; ++zeroBasedIndex)
|
||||
{
|
||||
var oneBasedIndex = zeroBasedIndex + 1;
|
||||
var targetNumberKey = oneBasedIndex % 10;
|
||||
int oneBasedIndex = zeroBasedIndex + 1;
|
||||
int targetNumberKey = oneBasedIndex % 10;
|
||||
var targetChannel = channels[zeroBasedIndex];
|
||||
AddStep($"Press Alt+{targetNumberKey}", () => pressChannelHotkey(targetNumberKey));
|
||||
AddAssert($"Channel #{oneBasedIndex} is selected", () => currentChannel == targetChannel);
|
||||
|
@ -24,10 +24,10 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
RankGraph graph;
|
||||
|
||||
var data = new int[89];
|
||||
var dataWithZeros = new int[89];
|
||||
var smallData = new int[89];
|
||||
var edgyData = new int[89];
|
||||
int[] data = new int[89];
|
||||
int[] dataWithZeros = new int[89];
|
||||
int[] smallData = new int[89];
|
||||
int[] edgyData = new int[89];
|
||||
|
||||
for (int i = 0; i < 89; i++)
|
||||
data[i] = dataWithZeros[i] = (i + 1) * 1000;
|
||||
|
@ -171,7 +171,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
var indices = chatDisplay.FillFlow.OfType<DrawableChannel.DaySeparator>().Select(ds => chatDisplay.FillFlow.IndexOf(ds));
|
||||
|
||||
foreach (var i in indices)
|
||||
foreach (int i in indices)
|
||||
{
|
||||
if (i < chatDisplay.FillFlow.Count && chatDisplay.FillFlow[i + 1] is DrawableChannel.DaySeparator)
|
||||
return false;
|
||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
|
||||
private bool checkBreadcrumb()
|
||||
{
|
||||
var result = header.TabControlItems.Contains(wikiPageData.Value.Title);
|
||||
bool result = header.TabControlItems.Contains(wikiPageData.Value.Title);
|
||||
|
||||
if (wikiPageData.Value.Subtitle != null)
|
||||
result = header.TabControlItems.Contains(wikiPageData.Value.Subtitle) && result;
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
AddStep("Add TOC", () =>
|
||||
{
|
||||
for (var i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
addTitle($"This is a very long title {i + 1}");
|
||||
});
|
||||
}
|
||||
@ -46,7 +46,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
AddStep("Add TOC", () =>
|
||||
{
|
||||
for (var i = 0; i < 10; i++)
|
||||
for (int i = 0; i < 10; i++)
|
||||
addTitle($"This is a very long title {i + 1}", i % 4 != 0);
|
||||
});
|
||||
}
|
||||
|
@ -31,18 +31,18 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Test]
|
||||
public void TestAddAndRemoveItem()
|
||||
{
|
||||
foreach (var item in items.Skip(1))
|
||||
foreach (string item in items.Skip(1))
|
||||
AddStep($"Add {item} item", () => header.AddItem(item));
|
||||
|
||||
foreach (var item in items.Reverse().SkipLast(3))
|
||||
foreach (string item in items.Reverse().SkipLast(3))
|
||||
AddStep($"Remove {item} item", () => header.RemoveItem(item));
|
||||
|
||||
AddStep("Clear items", () => header.ClearItems());
|
||||
|
||||
foreach (var item in items)
|
||||
foreach (string item in items)
|
||||
AddStep($"Add {item} item", () => header.AddItem(item));
|
||||
|
||||
foreach (var item in items)
|
||||
foreach (string item in items)
|
||||
AddStep($"Remove {item} item", () => header.RemoveItem(item));
|
||||
}
|
||||
|
||||
|
@ -73,8 +73,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
private bool assertModsMultiplier(IEnumerable<Mod> mods)
|
||||
{
|
||||
var multiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
|
||||
var expectedValue = multiplier.Equals(1.0) ? string.Empty : $"{multiplier:N2}x";
|
||||
double multiplier = mods.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier);
|
||||
string expectedValue = multiplier.Equals(1.0) ? string.Empty : $"{multiplier:N2}x";
|
||||
|
||||
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
foreach (var p in typeof(OsuIcon).GetProperties(BindingFlags.Public | BindingFlags.Static))
|
||||
{
|
||||
var propValue = p.GetValue(null);
|
||||
object propValue = p.GetValue(null);
|
||||
Debug.Assert(propValue != null);
|
||||
|
||||
flow.Add(new Icon($"{nameof(OsuIcon)}.{p.Name}", (IconUsage)propValue));
|
||||
|
@ -101,12 +101,12 @@ namespace osu.Game.Tournament.Components
|
||||
return;
|
||||
}
|
||||
|
||||
var bpm = beatmapInfo.BeatmapSet.OnlineInfo.BPM;
|
||||
var length = beatmapInfo.Length;
|
||||
double bpm = beatmapInfo.BeatmapSet.OnlineInfo.BPM;
|
||||
double length = beatmapInfo.Length;
|
||||
string hardRockExtra = "";
|
||||
string srExtra = "";
|
||||
|
||||
var ar = beatmapInfo.BaseDifficulty.ApproachRate;
|
||||
float ar = beatmapInfo.BaseDifficulty.ApproachRate;
|
||||
|
||||
if ((mods & LegacyMods.HardRock) > 0)
|
||||
{
|
||||
@ -252,9 +252,9 @@ namespace osu.Game.Tournament.Components
|
||||
s.Font = OsuFont.Torus.With(weight: bold ? FontWeight.Bold : FontWeight.Regular, size: 15);
|
||||
}
|
||||
|
||||
for (var i = 0; i < tuples.Length; i++)
|
||||
for (int i = 0; i < tuples.Length; i++)
|
||||
{
|
||||
var (heading, content) = tuples[i];
|
||||
(string heading, string content) = tuples[i];
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Tournament.IPC
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
var stablePath = stableInfo.StablePath ?? findStablePath();
|
||||
string stablePath = stableInfo.StablePath ?? findStablePath();
|
||||
initialiseIPCStorage(stablePath);
|
||||
}
|
||||
|
||||
@ -78,8 +78,8 @@ namespace osu.Game.Tournament.IPC
|
||||
using (var stream = IPCStorage.GetStream(file_ipc_filename))
|
||||
using (var sr = new StreamReader(stream))
|
||||
{
|
||||
var beatmapId = int.Parse(sr.ReadLine().AsNonNull());
|
||||
var mods = int.Parse(sr.ReadLine().AsNonNull());
|
||||
int beatmapId = int.Parse(sr.ReadLine().AsNonNull());
|
||||
int mods = int.Parse(sr.ReadLine().AsNonNull());
|
||||
|
||||
if (lastBeatmapId != beatmapId)
|
||||
{
|
||||
@ -187,10 +187,10 @@ namespace osu.Game.Tournament.IPC
|
||||
[CanBeNull]
|
||||
private string findStablePath()
|
||||
{
|
||||
var stableInstallPath = findFromEnvVar() ??
|
||||
findFromRegistry() ??
|
||||
findFromLocalAppData() ??
|
||||
findFromDotFolder();
|
||||
string stableInstallPath = findFromEnvVar() ??
|
||||
findFromRegistry() ??
|
||||
findFromLocalAppData() ??
|
||||
findFromDotFolder();
|
||||
|
||||
Logger.Log($"Stable path for tourney usage: {stableInstallPath}");
|
||||
return stableInstallPath;
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Tournament
|
||||
|
||||
if (reader.TokenType == JsonToken.PropertyName)
|
||||
{
|
||||
var name = reader.Value?.ToString();
|
||||
string name = reader.Value?.ToString();
|
||||
int? val = reader.ReadAsInt32();
|
||||
|
||||
if (val == null)
|
||||
|
@ -36,10 +36,10 @@ namespace osu.Game.Tournament.Models
|
||||
{
|
||||
get
|
||||
{
|
||||
var ranks = Players.Select(p => p.Statistics?.GlobalRank)
|
||||
.Where(i => i.HasValue)
|
||||
.Select(i => i.Value)
|
||||
.ToArray();
|
||||
int[] ranks = Players.Select(p => p.Statistics?.GlobalRank)
|
||||
.Where(i => i.HasValue)
|
||||
.Select(i => i.Value)
|
||||
.ToArray();
|
||||
|
||||
if (ranks.Length == 0)
|
||||
return 0;
|
||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
var winningBar = score1.Value > score2.Value ? score1Bar : score2Bar;
|
||||
var losingBar = score1.Value <= score2.Value ? score1Bar : score2Bar;
|
||||
|
||||
var diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value);
|
||||
int diff = Math.Max(score1.Value, score2.Value) - Math.Min(score1.Value, score2.Value);
|
||||
|
||||
losingBar.ResizeWidthTo(0, 400, Easing.OutQuint);
|
||||
winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint);
|
||||
|
@ -208,7 +208,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
if (Match.Round.Value == null) return;
|
||||
|
||||
var instaWinAmount = Match.Round.Value.BestOf.Value / 2;
|
||||
int instaWinAmount = Match.Round.Value.BestOf.Value / 2;
|
||||
|
||||
Match.Completed.Value = Match.Round.Value.BestOf.Value > 0
|
||||
&& (Match.Team1Score.Value + Match.Team2Score.Value >= Match.Round.Value.BestOf.Value || Match.Team1Score.Value > instaWinAmount || Match.Team2Score.Value > instaWinAmount);
|
||||
@ -243,8 +243,8 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
{
|
||||
foreach (var conditional in Match.ConditionalMatches)
|
||||
{
|
||||
var team1Match = conditional.Acronyms.Contains(Match.Team1Acronym);
|
||||
var team2Match = conditional.Acronyms.Contains(Match.Team2Acronym);
|
||||
bool team1Match = conditional.Acronyms.Contains(Match.Team1Acronym);
|
||||
bool team2Match = conditional.Acronyms.Contains(Match.Team2Acronym);
|
||||
|
||||
if (team1Match && team2Match)
|
||||
Match.Date.Value = conditional.Date.Value;
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.Ladder
|
||||
|
||||
protected override bool OnScroll(ScrollEvent e)
|
||||
{
|
||||
var newScale = Math.Clamp(scale + e.ScrollDelta.Y / 15 * scale, min_scale, max_scale);
|
||||
float newScale = Math.Clamp(scale + e.ScrollDelta.Y / 15 * scale, min_scale, max_scale);
|
||||
|
||||
this.MoveTo(target -= e.MousePosition * (newScale - scale), 2000, Easing.OutQuint);
|
||||
this.ScaleTo(scale = newScale, 2000, Easing.OutQuint);
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
return;
|
||||
|
||||
// box contains text
|
||||
if (!int.TryParse(numberBox.Text, out var number))
|
||||
if (!int.TryParse(numberBox.Text, out int number))
|
||||
{
|
||||
// at this point, the only reason we can arrive here is if the input number was too big to parse into an int
|
||||
// so clamp to max allowed value
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
private void load(Storage storage, OsuColour colours)
|
||||
{
|
||||
var initialStorage = (ipc as FileBasedIPC)?.IPCStorage ?? storage;
|
||||
var initialPath = new DirectoryInfo(initialStorage.GetFullPath(string.Empty)).Parent?.FullName;
|
||||
string initialPath = new DirectoryInfo(initialStorage.GetFullPath(string.Empty)).Parent?.FullName;
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
@ -129,7 +129,7 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
|
||||
protected virtual void ChangePath()
|
||||
{
|
||||
var target = directorySelector.CurrentPath.Value.FullName;
|
||||
string target = directorySelector.CurrentPath.Value.FullName;
|
||||
var fileBasedIpc = ipc as FileBasedIPC;
|
||||
Logger.Log($"Changing Stable CE location to {target}");
|
||||
|
||||
|
@ -134,7 +134,7 @@ namespace osu.Game.Tournament
|
||||
|
||||
windowSize.BindValueChanged(size => ScheduleAfterChildren(() =>
|
||||
{
|
||||
var minWidth = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
|
||||
int minWidth = (int)(size.NewValue.Height / 768f * TournamentSceneManager.REQUIRED_WIDTH) - 1;
|
||||
heightWarning.Alpha = size.NewValue.Width < minWidth ? 1 : 0;
|
||||
}), true);
|
||||
|
||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Tournament
|
||||
// link matches to rounds
|
||||
foreach (var round in ladder.Rounds)
|
||||
{
|
||||
foreach (var id in round.Matches)
|
||||
foreach (int id in round.Matches)
|
||||
{
|
||||
var found = ladder.Matches.FirstOrDefault(p => p.ID == id);
|
||||
|
||||
|
@ -103,7 +103,7 @@ namespace osu.Game.Audio.Effects
|
||||
|
||||
ensureAttached();
|
||||
|
||||
var filterIndex = mixer.Effects.IndexOf(filter);
|
||||
int filterIndex = mixer.Effects.IndexOf(filter);
|
||||
|
||||
if (filterIndex < 0) return;
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace osu.Game.Beatmaps
|
||||
if (t.Time > lastTime)
|
||||
return (beatLength: t.BeatLength, 0);
|
||||
|
||||
var nextTime = i == ControlPointInfo.TimingPoints.Count - 1 ? lastTime : ControlPointInfo.TimingPoints[i + 1].Time;
|
||||
double nextTime = i == ControlPointInfo.TimingPoints.Count - 1 ? lastTime : ControlPointInfo.TimingPoints[i + 1].Time;
|
||||
return (beatLength: t.BeatLength, duration: nextTime - t.Time);
|
||||
})
|
||||
// Aggregate durations into a set of (beatLength, duration) tuples for each beat length
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
if (includeDifficultyName)
|
||||
{
|
||||
var versionString = getVersionString(beatmapInfo);
|
||||
string versionString = getVersionString(beatmapInfo);
|
||||
return new RomanisableString($"{metadata.GetPreferred(true)} {versionString}".Trim(), $"{metadata.GetPreferred(false)} {versionString}".Trim());
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,8 @@ namespace osu.Game.Beatmaps
|
||||
public static RomanisableString GetDisplayTitleRomanisable(this IBeatmapMetadataInfo metadataInfo)
|
||||
{
|
||||
string author = string.IsNullOrEmpty(metadataInfo.Author) ? string.Empty : $"({metadataInfo.Author})";
|
||||
var artistUnicode = string.IsNullOrEmpty(metadataInfo.ArtistUnicode) ? metadataInfo.Artist : metadataInfo.ArtistUnicode;
|
||||
var titleUnicode = string.IsNullOrEmpty(metadataInfo.TitleUnicode) ? metadataInfo.Title : metadataInfo.TitleUnicode;
|
||||
string artistUnicode = string.IsNullOrEmpty(metadataInfo.ArtistUnicode) ? metadataInfo.Artist : metadataInfo.ArtistUnicode;
|
||||
string titleUnicode = string.IsNullOrEmpty(metadataInfo.TitleUnicode) ? metadataInfo.Title : metadataInfo.TitleUnicode;
|
||||
|
||||
return new RomanisableString($"{artistUnicode} - {titleUnicode} {author}".Trim(), $"{metadataInfo.Artist} - {metadataInfo.Title} {author}".Trim());
|
||||
}
|
||||
|
@ -180,8 +180,8 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
|
||||
private static double getClosestSnappedTime(TimingControlPoint timingPoint, double time, int beatDivisor)
|
||||
{
|
||||
var beatLength = timingPoint.BeatLength / beatDivisor;
|
||||
var beatLengths = (int)Math.Round((time - timingPoint.Time) / beatLength, MidpointRounding.AwayFromZero);
|
||||
double beatLength = timingPoint.BeatLength / beatDivisor;
|
||||
int beatLengths = (int)Math.Round((time - timingPoint.Time) / beatLength, MidpointRounding.AwayFromZero);
|
||||
|
||||
return timingPoint.Time + beatLengths * beatLength;
|
||||
}
|
||||
|
@ -59,12 +59,12 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
foreach (var r in orderedRulesets)
|
||||
{
|
||||
if (!recommendedDifficultyMapping.TryGetValue(r, out var recommendation))
|
||||
if (!recommendedDifficultyMapping.TryGetValue(r, out double recommendation))
|
||||
continue;
|
||||
|
||||
BeatmapInfo beatmapInfo = beatmaps.Where(b => b.Ruleset.Equals(r)).OrderBy(b =>
|
||||
{
|
||||
var difference = b.StarDifficulty - recommendation;
|
||||
double difference = b.StarDifficulty - recommendation;
|
||||
return difference >= 0 ? difference * 2 : difference * -1; // prefer easier over harder
|
||||
}).FirstOrDefault();
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user