mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Apply batch fixing of built-in types using var
This commit is contained in:
@ -92,7 +92,7 @@ namespace osu.Game.Screens.Edit
|
||||
{
|
||||
int beat = index % beatDivisor;
|
||||
|
||||
foreach (var divisor in BindableBeatDivisor.VALID_DIVISORS)
|
||||
foreach (int divisor in BindableBeatDivisor.VALID_DIVISORS)
|
||||
{
|
||||
if ((beat * divisor) % beatDivisor == 0)
|
||||
return divisor;
|
||||
|
@ -205,7 +205,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
foreach (var t in availableDivisors)
|
||||
foreach (int t in availableDivisors)
|
||||
{
|
||||
AddInternal(new Tick
|
||||
{
|
||||
@ -287,7 +287,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
private void handleMouseInput(Vector2 screenSpaceMousePosition)
|
||||
{
|
||||
// copied from SliderBar so we can do custom spacing logic.
|
||||
var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth;
|
||||
float xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth;
|
||||
|
||||
CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First();
|
||||
OnUserChange(Current.Value);
|
||||
|
@ -58,13 +58,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
switch (args.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Add:
|
||||
foreach (var o in args.NewItems)
|
||||
foreach (object o in args.NewItems)
|
||||
SelectionBlueprints.FirstOrDefault(b => b.Item == o)?.Select();
|
||||
|
||||
break;
|
||||
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
foreach (var o in args.OldItems)
|
||||
foreach (object o in args.OldItems)
|
||||
SelectionBlueprints.FirstOrDefault(b => b.Item == o)?.Deselect();
|
||||
|
||||
break;
|
||||
@ -468,7 +468,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (snapProvider != null)
|
||||
{
|
||||
// check for positional snap for every object in selection (for things like object-object snapping)
|
||||
for (var i = 0; i < movementBlueprintOriginalPositions.Length; i++)
|
||||
for (int i = 0; i < movementBlueprintOriginalPositions.Length; i++)
|
||||
{
|
||||
Vector2 originalPosition = movementBlueprintOriginalPositions[i];
|
||||
var testPosition = originalPosition + distanceTravelled;
|
||||
|
@ -132,8 +132,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
protected ColourInfo GetColourForIndexFromPlacement(int placementIndex)
|
||||
{
|
||||
var timingPoint = beatmap.ControlPointInfo.TimingPointAt(StartTime);
|
||||
var beatLength = timingPoint.BeatLength / beatDivisor.Value;
|
||||
var beatIndex = (int)Math.Round((StartTime - timingPoint.Time) / beatLength);
|
||||
double beatLength = timingPoint.BeatLength / beatDivisor.Value;
|
||||
int beatIndex = (int)Math.Round((StartTime - timingPoint.Time) / beatLength);
|
||||
|
||||
var colour = BindableBeatDivisor.GetColourFor(BindableBeatDivisor.GetDivisorForBeatIndex(beatIndex + placementIndex + 1, beatDivisor.Value), Colours);
|
||||
|
||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// </summary>
|
||||
private void createStateBindables()
|
||||
{
|
||||
foreach (var sampleName in HitSampleInfo.AllAdditions)
|
||||
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
{
|
||||
@ -102,7 +102,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
SelectionNewComboState.Value = GetStateFromSelection(SelectedItems.OfType<IHasComboInformation>(), h => h.NewCombo);
|
||||
|
||||
foreach (var (sampleName, bindable) in SelectionSampleStates)
|
||||
foreach ((string sampleName, var bindable) in SelectionSampleStates)
|
||||
{
|
||||
bindable.Value = GetStateFromSelection(SelectedItems, h => h.Samples.Any(s => s.Name == sampleName));
|
||||
}
|
||||
|
@ -176,7 +176,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
if (timeline != null)
|
||||
{
|
||||
var timelineQuad = timeline.ScreenSpaceDrawQuad;
|
||||
var mouseX = e.ScreenSpaceMousePosition.X;
|
||||
float mouseX = e.ScreenSpaceMousePosition.X;
|
||||
|
||||
// scroll if in a drag and dragging outside visible extents
|
||||
if (mouseX > timelineQuad.TopRight.X)
|
||||
|
@ -397,7 +397,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
if (hitObject.DifficultyControlPoint == DifficultyControlPoint.DEFAULT)
|
||||
hitObject.DifficultyControlPoint = new DifficultyControlPoint();
|
||||
|
||||
var newVelocity = hitObject.DifficultyControlPoint.SliderVelocity * (repeatHitObject.Duration / proposedDuration);
|
||||
double newVelocity = hitObject.DifficultyControlPoint.SliderVelocity * (repeatHitObject.Duration / proposedDuration);
|
||||
|
||||
if (Precision.AlmostEquals(newVelocity, hitObject.DifficultyControlPoint.SliderVelocity))
|
||||
return;
|
||||
@ -408,8 +408,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
else
|
||||
{
|
||||
// find the number of repeats which can fit in the requested time.
|
||||
var lengthOfOneRepeat = repeatHitObject.Duration / (repeatHitObject.RepeatCount + 1);
|
||||
var proposedCount = Math.Max(0, (int)Math.Round(proposedDuration / lengthOfOneRepeat) - 1);
|
||||
double lengthOfOneRepeat = repeatHitObject.Duration / (repeatHitObject.RepeatCount + 1);
|
||||
int proposedCount = Math.Max(0, (int)Math.Round(proposedDuration / lengthOfOneRepeat) - 1);
|
||||
|
||||
if (proposedCount == repeatHitObject.RepeatCount)
|
||||
return;
|
||||
@ -421,7 +421,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
break;
|
||||
|
||||
case IHasDuration endTimeHitObject:
|
||||
var snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time));
|
||||
double snappedTime = Math.Max(hitObject.StartTime, beatSnapProvider.SnapTime(time));
|
||||
|
||||
if (endTimeHitObject.EndTime == snappedTime || Precision.AlmostEquals(snappedTime, hitObject.StartTime, beatmap.GetBeatLengthAtTime(snappedTime)))
|
||||
return;
|
||||
|
@ -104,10 +104,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
nextMinTick = null;
|
||||
nextMaxTick = null;
|
||||
|
||||
for (var i = 0; i < beatmap.ControlPointInfo.TimingPoints.Count; i++)
|
||||
for (int i = 0; i < beatmap.ControlPointInfo.TimingPoints.Count; i++)
|
||||
{
|
||||
var point = beatmap.ControlPointInfo.TimingPoints[i];
|
||||
var until = i + 1 < beatmap.ControlPointInfo.TimingPoints.Count ? beatmap.ControlPointInfo.TimingPoints[i + 1].Time : working.Value.Track.Length;
|
||||
double until = i + 1 < beatmap.ControlPointInfo.TimingPoints.Count ? beatmap.ControlPointInfo.TimingPoints[i + 1].Time : working.Value.Track.Length;
|
||||
|
||||
int beat = 0;
|
||||
|
||||
@ -127,7 +127,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
|
||||
int indexInBar = beat % ((int)point.TimeSignature * beatDivisor.Value);
|
||||
|
||||
var divisor = BindableBeatDivisor.GetDivisorForBeatIndex(beat, beatDivisor.Value);
|
||||
int divisor = BindableBeatDivisor.GetDivisorForBeatIndex(beat, beatDivisor.Value);
|
||||
var colour = BindableBeatDivisor.GetColourFor(divisor, colours);
|
||||
|
||||
// even though "bar lines" take up the full vertical space, we render them in two pieces because it allows for less anchor/origin churn.
|
||||
|
@ -301,7 +301,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
editorBeatmap.SelectedHitObjects.BindCollectionChanged((_, __) =>
|
||||
{
|
||||
var hasObjects = editorBeatmap.SelectedHitObjects.Count > 0;
|
||||
bool hasObjects = editorBeatmap.SelectedHitObjects.Count > 0;
|
||||
|
||||
cutMenuItem.Action.Disabled = !hasObjects;
|
||||
copyMenuItem.Action.Disabled = !hasObjects;
|
||||
|
@ -183,7 +183,7 @@ namespace osu.Game.Screens.Edit
|
||||
public void Add(HitObject hitObject)
|
||||
{
|
||||
// Preserve existing sorting order in the beatmap
|
||||
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||
int insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||
Insert(insertionIndex + 1, hitObject);
|
||||
}
|
||||
|
||||
@ -332,7 +332,7 @@ namespace osu.Game.Screens.Edit
|
||||
// For now we'll remove and re-add the hitobject. This is not optimal and can be improved if required.
|
||||
mutableHitObjects.Remove(hitObject);
|
||||
|
||||
var insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||
int insertionIndex = findInsertionIndex(PlayableBeatmap.HitObjects, hitObject.StartTime);
|
||||
mutableHitObjects.Insert(insertionIndex + 1, hitObject);
|
||||
|
||||
Update(hitObject);
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Edit
|
||||
using (var sw = new StreamWriter(stream, Encoding.UTF8, 1024, true))
|
||||
new LegacyBeatmapEncoder(editorBeatmap, editorBeatmap.BeatmapSkin).Encode(sw);
|
||||
|
||||
var newState = stream.ToArray();
|
||||
byte[] newState = stream.ToArray();
|
||||
|
||||
// if the previous state is binary equal we don't need to push a new one, unless this is the initial state.
|
||||
if (savedStates.Count > 0 && newState.SequenceEqual(savedStates[currentState])) return;
|
||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Screens.Edit
|
||||
if (toAdd.Count > 0)
|
||||
{
|
||||
IBeatmap newBeatmap = readBeatmap(newState);
|
||||
foreach (var i in toAdd)
|
||||
foreach (int i in toAdd)
|
||||
editorBeatmap.Insert(i, newBeatmap.HitObjects[i]);
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
if (!isNew)
|
||||
return;
|
||||
|
||||
if (double.TryParse(sender.Text, out var newTime))
|
||||
if (double.TryParse(sender.Text, out double newTime))
|
||||
{
|
||||
changeSelectedGroupTime(newTime);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ namespace osu.Game.Screens.Menu
|
||||
else
|
||||
{
|
||||
const int quick_appear = 350;
|
||||
var initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
|
||||
int initialMovementTime = logo.Alpha > 0.2f ? quick_appear : 0;
|
||||
|
||||
logo.MoveTo(new Vector2(0.5f), initialMovementTime, Easing.OutQuint);
|
||||
|
||||
|
@ -272,7 +272,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
lastBeatIndex = beatIndex;
|
||||
|
||||
var beatLength = timingPoint.BeatLength;
|
||||
double beatLength = timingPoint.BeatLength;
|
||||
|
||||
float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum);
|
||||
|
||||
@ -337,7 +337,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
if (musicController.CurrentTrack.IsRunning)
|
||||
{
|
||||
var maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
|
||||
float maxAmplitude = lastBeatIndex >= 0 ? musicController.CurrentTrack.CurrentAmplitudes.Maximum : 0;
|
||||
logoAmplitudeContainer.Scale = new Vector2((float)Interpolation.Damp(logoAmplitudeContainer.Scale.X, 1 - Math.Max(0, maxAmplitude - scale_adjust_cutoff) * 0.04f, 0.9f, Time.Elapsed));
|
||||
|
||||
if (maxAmplitude > velocity_adjust_cutoff)
|
||||
|
@ -95,7 +95,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
var result = base.OnExiting(next);
|
||||
bool result = base.OnExiting(next);
|
||||
this.MoveToX(0);
|
||||
return result;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
|
||||
|
||||
var ruleset = rulesets.GetRuleset(Room.Settings.RulesetID).CreateInstance();
|
||||
|
||||
var currentModeRank = User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank;
|
||||
int? currentModeRank = User.User?.RulesetsStatistics?.GetValueOrDefault(ruleset.ShortName)?.GlobalRank;
|
||||
userRankText.Text = currentModeRank != null ? $"#{currentModeRank.Value:N0}" : string.Empty;
|
||||
|
||||
userStateDisplay.UpdateStatus(User.State, User.BeatmapAvailability);
|
||||
|
@ -180,11 +180,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
{
|
||||
// Seek the master clock to the gameplay time.
|
||||
// This is chosen as the first available frame in the players' replays, which matches the seek by each individual SpectatorPlayer.
|
||||
var startTime = instances.Where(i => i.Score != null)
|
||||
.SelectMany(i => i.Score.Replay.Frames)
|
||||
.Select(f => f.Time)
|
||||
.DefaultIfEmpty(0)
|
||||
.Min();
|
||||
double startTime = instances.Where(i => i.Score != null)
|
||||
.SelectMany(i => i.Score.Replay.Frames)
|
||||
.Select(f => f.Time)
|
||||
.DefaultIfEmpty(0)
|
||||
.Min();
|
||||
|
||||
masterClockContainer.Seek(startTime);
|
||||
masterClockContainer.Start();
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play.Break
|
||||
|
||||
private void currentValueChanged(ValueChangedEvent<T> e)
|
||||
{
|
||||
var newText = prefix + Format(e.NewValue);
|
||||
string newText = prefix + Format(e.NewValue);
|
||||
|
||||
if (valueText.Text == newText)
|
||||
return;
|
||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void updateBreakTime()
|
||||
{
|
||||
var time = Clock.CurrentTime;
|
||||
double time = Clock.CurrentTime;
|
||||
|
||||
isBreakTime.Value = breaks?.IsInAny(time) == true
|
||||
|| time < gameplayStartTime
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
private void updateState()
|
||||
{
|
||||
// Don't display ever if the ruleset is not using a draining health display.
|
||||
var showLayer = HealthProcessor is DrainingHealthProcessor && fadePlayfieldWhenHealthLow.Value && ShowHealth.Value;
|
||||
bool showLayer = HealthProcessor is DrainingHealthProcessor && fadePlayfieldWhenHealthLow.Value && ShowHealth.Value;
|
||||
this.FadeTo(showLayer ? 1 : 0, fade_time, Easing.OutQuint);
|
||||
}
|
||||
|
||||
|
@ -157,11 +157,11 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
||||
// max to avoid div-by-zero.
|
||||
maxHitWindow = Math.Max(1, windows.First().length);
|
||||
|
||||
for (var i = 0; i < windows.Length; i++)
|
||||
for (int i = 0; i < windows.Length; i++)
|
||||
{
|
||||
var (result, length) = windows[i];
|
||||
(var result, double length) = windows[i];
|
||||
|
||||
var hitWindow = (float)(length / maxHitWindow);
|
||||
float hitWindow = (float)(length / maxHitWindow);
|
||||
|
||||
colourBarsEarly.Add(createColourBar(result, hitWindow, i == 0));
|
||||
colourBarsLate.Add(createColourBar(result, hitWindow, i == 0));
|
||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
var winningBar = Team1Score.Value > Team2Score.Value ? score1Bar : score2Bar;
|
||||
var losingBar = Team1Score.Value <= Team2Score.Value ? score1Bar : score2Bar;
|
||||
|
||||
var diff = Math.Max(Team1Score.Value, Team2Score.Value) - Math.Min(Team1Score.Value, Team2Score.Value);
|
||||
int diff = Math.Max(Team1Score.Value, Team2Score.Value) - Math.Min(Team1Score.Value, Team2Score.Value);
|
||||
|
||||
losingBar.ResizeWidthTo(0, 400, Easing.OutQuint);
|
||||
winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint);
|
||||
|
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyCollectionChangedAction.Remove:
|
||||
foreach (var userId in e.OldItems.OfType<int>())
|
||||
foreach (int userId in e.OldItems.OfType<int>())
|
||||
{
|
||||
spectatorClient.StopWatchingUser(userId);
|
||||
|
||||
|
@ -24,17 +24,17 @@ namespace osu.Game.Screens.Play
|
||||
if (!objects.Any())
|
||||
return;
|
||||
|
||||
var firstHit = objects.First().StartTime;
|
||||
var lastHit = objects.Max(o => o.GetEndTime());
|
||||
double firstHit = objects.First().StartTime;
|
||||
double lastHit = objects.Max(o => o.GetEndTime());
|
||||
|
||||
if (lastHit == 0)
|
||||
lastHit = objects.Last().StartTime;
|
||||
|
||||
var interval = (lastHit - firstHit + 1) / granularity;
|
||||
double interval = (lastHit - firstHit + 1) / granularity;
|
||||
|
||||
foreach (var h in objects)
|
||||
{
|
||||
var endTime = h.GetEndTime();
|
||||
double endTime = h.GetEndTime();
|
||||
|
||||
Debug.Assert(endTime >= h.StartTime);
|
||||
|
||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
base.Update();
|
||||
|
||||
var time = gameplayClock?.CurrentTime ?? Time.Current;
|
||||
double time = gameplayClock?.CurrentTime ?? Time.Current;
|
||||
|
||||
double songCurrentTime = time - startTime;
|
||||
int currentPercent = Math.Max(0, Math.Min(100, (int)(songCurrentTime / songLength * 100)));
|
||||
|
@ -165,7 +165,7 @@ namespace osu.Game.Screens.Play
|
||||
return;
|
||||
}
|
||||
|
||||
var max = values.Max();
|
||||
int max = values.Max();
|
||||
|
||||
float step = values.Length / (float)ColumnCount;
|
||||
|
||||
|
@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
var exiting = base.OnExiting(next);
|
||||
bool exiting = base.OnExiting(next);
|
||||
|
||||
submitScore(Score.DeepClone());
|
||||
|
||||
|
@ -62,12 +62,12 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
{
|
||||
var beatmap = score.BeatmapInfo;
|
||||
var metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata;
|
||||
var creator = metadata.Author?.Username;
|
||||
string creator = metadata.Author?.Username;
|
||||
|
||||
var topStatistics = new List<StatisticDisplay>
|
||||
{
|
||||
new AccuracyStatistic(score.Accuracy),
|
||||
new ComboStatistic(score.MaxCombo, !score.Statistics.TryGetValue(HitResult.Miss, out var missCount) || missCount == 0),
|
||||
new ComboStatistic(score.MaxCombo, !score.Statistics.TryGetValue(HitResult.Miss, out int missCount) || missCount == 0),
|
||||
new PerformanceStatistic(score),
|
||||
};
|
||||
|
||||
|
@ -287,7 +287,7 @@ namespace osu.Game.Screens.Ranking
|
||||
detachedPanelContainer.Add(expandedPanel);
|
||||
|
||||
// Move into its original location in the local container first, then to the final location.
|
||||
var origLocation = detachedPanelContainer.ToLocalSpace(screenSpacePos).X;
|
||||
float origLocation = detachedPanelContainer.ToLocalSpace(screenSpacePos).X;
|
||||
expandedPanel.MoveToX(origLocation)
|
||||
.Then()
|
||||
.MoveToX(StatisticsPanel.SIDE_PADDING, 150, Easing.OutQuint);
|
||||
|
@ -20,8 +20,8 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
public UnstableRate(IEnumerable<HitEvent> hitEvents)
|
||||
: base("Unstable Rate")
|
||||
{
|
||||
var timeOffsets = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit())
|
||||
.Select(ev => ev.TimeOffset).ToArray();
|
||||
double[] timeOffsets = hitEvents.Where(e => !(e.HitObject.HitWindows is HitWindows.EmptyHitWindows) && e.Result.IsHit())
|
||||
.Select(ev => ev.TimeOffset).ToArray();
|
||||
Value = 10 * standardDeviation(timeOffsets);
|
||||
}
|
||||
|
||||
@ -30,8 +30,8 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
if (timeOffsets.Length == 0)
|
||||
return double.NaN;
|
||||
|
||||
var mean = timeOffsets.Average();
|
||||
var squares = timeOffsets.Select(offset => Math.Pow(offset - mean, 2)).Sum();
|
||||
double mean = timeOffsets.Average();
|
||||
double squares = timeOffsets.Select(offset => Math.Pow(offset - mean, 2)).Sum();
|
||||
return Math.Sqrt(squares / timeOffsets.Length);
|
||||
}
|
||||
|
||||
|
@ -233,7 +233,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void updateMetrics()
|
||||
{
|
||||
var hasMetrics = (failTimes?.Retries?.Any() ?? false) || (failTimes?.Fails?.Any() ?? false);
|
||||
bool hasMetrics = (failTimes?.Retries?.Any() ?? false) || (failTimes?.Fails?.Any() ?? false);
|
||||
|
||||
if (ratings?.Any() ?? false)
|
||||
{
|
||||
|
@ -57,9 +57,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
if (match)
|
||||
{
|
||||
var terms = BeatmapInfo.GetSearchableTerms();
|
||||
string[] terms = BeatmapInfo.GetSearchableTerms();
|
||||
|
||||
foreach (var criteriaTerm in criteria.SearchTerms)
|
||||
foreach (string criteriaTerm in criteria.SearchTerms)
|
||||
match &= terms.Any(term => term.Contains(criteriaTerm, StringComparison.InvariantCultureIgnoreCase));
|
||||
|
||||
// if a match wasn't found via text matching of terms, do a second catch-all check matching against online IDs.
|
||||
@ -89,7 +89,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
default:
|
||||
case SortMode.Difficulty:
|
||||
var ruleset = BeatmapInfo.RulesetID.CompareTo(otherBeatmap.BeatmapInfo.RulesetID);
|
||||
int ruleset = BeatmapInfo.RulesetID.CompareTo(otherBeatmap.BeatmapInfo.RulesetID);
|
||||
if (ruleset != 0) return ruleset;
|
||||
|
||||
return BeatmapInfo.StarDifficulty.CompareTo(otherBeatmap.BeatmapInfo.StarDifficulty);
|
||||
|
@ -95,8 +95,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private int compareUsingAggregateMax(CarouselBeatmapSet other, Func<BeatmapInfo, double> func)
|
||||
{
|
||||
var ourBeatmaps = ValidBeatmaps.Any();
|
||||
var otherBeatmaps = other.ValidBeatmaps.Any();
|
||||
bool ourBeatmaps = ValidBeatmaps.Any();
|
||||
bool otherBeatmaps = other.ValidBeatmaps.Any();
|
||||
|
||||
if (!ourBeatmaps && !otherBeatmaps) return 0;
|
||||
if (!ourBeatmaps) return -1;
|
||||
|
@ -241,7 +241,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
TernaryState state;
|
||||
|
||||
var countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b));
|
||||
int countExisting = beatmapSet.Beatmaps.Count(b => collection.Beatmaps.Contains(b));
|
||||
|
||||
if (countExisting == beatmapSet.Beatmaps.Count)
|
||||
state = TernaryState.True;
|
||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
failTimes = value;
|
||||
|
||||
var retries = FailTimes?.Retries ?? Array.Empty<int>();
|
||||
var fails = FailTimes?.Fails ?? Array.Empty<int>();
|
||||
var retriesAndFails = sumRetriesAndFails(retries, fails);
|
||||
int[] retries = FailTimes?.Retries ?? Array.Empty<int>();
|
||||
int[] fails = FailTimes?.Fails ?? Array.Empty<int>();
|
||||
int[] retriesAndFails = sumRetriesAndFails(retries, fails);
|
||||
|
||||
float maxValue = retriesAndFails.Any() ? retriesAndFails.Max() : 0;
|
||||
failGraph.MaxValue = maxValue;
|
||||
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
private int[] sumRetriesAndFails(int[] retries, int[] fails)
|
||||
{
|
||||
var result = new int[Math.Max(retries.Length, fails.Length)];
|
||||
int[] result = new int[Math.Max(retries.Length, fails.Length)];
|
||||
|
||||
for (int i = 0; i < retries.Length; ++i)
|
||||
result[i] = retries[i];
|
||||
|
@ -45,8 +45,8 @@ namespace osu.Game.Screens.Select.Details
|
||||
{
|
||||
var usableRange = Ratings.Skip(1).Take(rating_range); // adjust for API returning weird empty data at 0.
|
||||
|
||||
var negativeCount = usableRange.Take(rating_range / 2).Sum();
|
||||
var totalCount = usableRange.Sum();
|
||||
int negativeCount = usableRange.Take(rating_range / 2).Sum();
|
||||
int totalCount = usableRange.Sum();
|
||||
|
||||
negativeRatings.Text = negativeCount.ToLocalisableString(@"N0");
|
||||
positiveRatings.Text = (totalCount - negativeCount).ToLocalisableString(@"N0");
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
Debug.Assert(ruleset.Value.ID != null);
|
||||
|
||||
var query = searchTextBox.Text;
|
||||
string query = searchTextBox.Text;
|
||||
|
||||
var criteria = new FilterCriteria
|
||||
{
|
||||
|
@ -22,9 +22,9 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
foreach (Match match in query_syntax_regex.Matches(query))
|
||||
{
|
||||
var key = match.Groups["key"].Value.ToLower();
|
||||
string key = match.Groups["key"].Value.ToLower();
|
||||
var op = parseOperator(match.Groups["op"].Value);
|
||||
var value = match.Groups["value"].Value;
|
||||
string value = match.Groups["value"].Value;
|
||||
|
||||
if (tryParseKeywordCriteria(criteria, key, value, op))
|
||||
query = query.Replace(match.ToString(), "");
|
||||
@ -310,10 +310,10 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private static bool tryUpdateLengthRange(FilterCriteria criteria, Operator op, string val)
|
||||
{
|
||||
if (!tryParseDoubleWithPoint(val.TrimEnd('m', 's', 'h'), out var length))
|
||||
if (!tryParseDoubleWithPoint(val.TrimEnd('m', 's', 'h'), out double length))
|
||||
return false;
|
||||
|
||||
var scale = getLengthScale(val);
|
||||
int scale = getLengthScale(val);
|
||||
return tryUpdateCriteriaRange(ref criteria.Length, op, length * scale, scale / 2.0);
|
||||
}
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ namespace osu.Game.Screens.Spectate
|
||||
managerUpdated = beatmaps.ItemUpdated.GetBoundCopy();
|
||||
managerUpdated.BindValueChanged(beatmapUpdated);
|
||||
|
||||
foreach (var (id, _) in userMap)
|
||||
foreach ((int id, var _) in userMap)
|
||||
spectatorClient.WatchUser(id);
|
||||
}));
|
||||
}
|
||||
@ -86,7 +86,7 @@ namespace osu.Game.Screens.Spectate
|
||||
if (!e.NewValue.TryGetTarget(out var beatmapSet))
|
||||
return;
|
||||
|
||||
foreach (var (userId, _) in userMap)
|
||||
foreach ((int userId, var _) in userMap)
|
||||
{
|
||||
if (!playingUserStates.TryGetValue(userId, out var userState))
|
||||
continue;
|
||||
@ -101,20 +101,20 @@ namespace osu.Game.Screens.Spectate
|
||||
switch (e.Action)
|
||||
{
|
||||
case NotifyDictionaryChangedAction.Add:
|
||||
foreach (var (userId, state) in e.NewItems.AsNonNull())
|
||||
foreach ((int userId, var state) in e.NewItems.AsNonNull())
|
||||
onUserStateAdded(userId, state);
|
||||
break;
|
||||
|
||||
case NotifyDictionaryChangedAction.Remove:
|
||||
foreach (var (userId, _) in e.OldItems.AsNonNull())
|
||||
foreach ((int userId, var _) in e.OldItems.AsNonNull())
|
||||
onUserStateRemoved(userId);
|
||||
break;
|
||||
|
||||
case NotifyDictionaryChangedAction.Replace:
|
||||
foreach (var (userId, _) in e.OldItems.AsNonNull())
|
||||
foreach ((int userId, var _) in e.OldItems.AsNonNull())
|
||||
onUserStateRemoved(userId);
|
||||
|
||||
foreach (var (userId, state) in e.NewItems.AsNonNull())
|
||||
foreach ((int userId, var state) in e.NewItems.AsNonNull())
|
||||
onUserStateAdded(userId, state);
|
||||
break;
|
||||
}
|
||||
@ -219,7 +219,7 @@ namespace osu.Game.Screens.Spectate
|
||||
|
||||
if (spectatorClient != null)
|
||||
{
|
||||
foreach (var (userId, _) in userMap)
|
||||
foreach ((int userId, var _) in userMap)
|
||||
spectatorClient.StopWatchingUser(userId);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user