mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 15:44:04 +09:00
Apply batch fixing of built-in types using var
This commit is contained in:
@ -214,7 +214,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
float u1 = 1 - nextRandom(); //uniform(0,1] random floats
|
||||
float u2 = 1 - nextRandom();
|
||||
float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); // random normal(0,1)
|
||||
var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); // random normal(mean,stdDev^2)
|
||||
float scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); // random normal(mean,stdDev^2)
|
||||
|
||||
return new TriangleParticle { Scale = scale };
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ namespace osu.Game.Graphics.Containers
|
||||
// - If we were to use RelativeSize/FillMode, we'd need to set the Icon's RelativeSizeAxes directly.
|
||||
// We can't do this because we would need access to AutoSizeAxes to set it to none.
|
||||
// Other issues come up along the way too, so it's not a good solution.
|
||||
var fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y);
|
||||
float fitScale = Math.Min(DrawSize.X / InternalChild.DrawSize.X, DrawSize.Y / InternalChild.DrawSize.Y);
|
||||
InternalChild.Scale = new Vector2(fitScale);
|
||||
InternalChild.Anchor = Anchor.Centre;
|
||||
InternalChild.Origin = Anchor.Centre;
|
||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
double elapsedDuration = (double)(Time.Current - startTime);
|
||||
|
||||
var amount = (float)Interpolation.ApplyEasing(easing, Math.Min(elapsedDuration / duration, 1));
|
||||
float amount = (float)Interpolation.ApplyEasing(easing, Math.Min(elapsedDuration / duration, 1));
|
||||
|
||||
// Interpolate the position of the logo, where amount 0 is where the logo was when it first began interpolating, and amount 1 is the target location.
|
||||
Logo.Position = Vector2.Lerp(startPosition.Value, localPos, amount);
|
||||
|
@ -182,7 +182,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override bool OnInvalidate(Invalidation invalidation, InvalidationSource source)
|
||||
{
|
||||
var result = base.OnInvalidate(invalidation, source);
|
||||
bool result = base.OnInvalidate(invalidation, source);
|
||||
|
||||
if (source == InvalidationSource.Child && (invalidation & Invalidation.DrawSize) != 0)
|
||||
{
|
||||
@ -240,7 +240,7 @@ namespace osu.Game.Graphics.Containers
|
||||
headerBackgroundContainer.Height = expandableHeaderSize + fixedHeaderSize;
|
||||
headerBackgroundContainer.Y = ExpandableHeader?.Y ?? 0;
|
||||
|
||||
var smallestSectionHeight = Children.Count > 0 ? Children.Min(d => d.Height) : 0;
|
||||
float smallestSectionHeight = Children.Count > 0 ? Children.Min(d => d.Height) : 0;
|
||||
|
||||
// scroll offset is our fixed header height if we have it plus 10% of content height
|
||||
// plus 5% to fix floating point errors and to not have a section instantly unselect when scrolling upwards
|
||||
|
@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
public void Select(T item)
|
||||
{
|
||||
var newIndex = IndexOf(item);
|
||||
int newIndex = IndexOf(item);
|
||||
|
||||
if (newIndex < 0)
|
||||
setSelected(null);
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Graphics.Cursor
|
||||
if (dragRotationState != DragRotationState.NotDragging)
|
||||
{
|
||||
var position = e.MousePosition;
|
||||
var distance = Vector2Extensions.Distance(position, positionMouseDown);
|
||||
float distance = Vector2Extensions.Distance(position, positionMouseDown);
|
||||
|
||||
// don't start rotating until we're moved a minimum distance away from the mouse down location,
|
||||
// else it can have an annoying effect.
|
||||
|
@ -28,7 +28,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
if (errors == null) return;
|
||||
|
||||
foreach (var error in errors)
|
||||
foreach (string error in errors)
|
||||
errorDrawables.AddRange(AddParagraph(error, cp => cp.Colour = Color4.Red));
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
protected override void Blit(Action<TexturedVertex2D> vertexAction)
|
||||
{
|
||||
var time = currentTime - startTime;
|
||||
double time = currentTime - startTime;
|
||||
|
||||
foreach (var p in parts)
|
||||
{
|
||||
@ -136,7 +136,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
public Vector2 PositionAtTime(double time)
|
||||
{
|
||||
var travelledDistance = distance * progressAtTime(time);
|
||||
float travelledDistance = distance * progressAtTime(time);
|
||||
return new Vector2(0.5f) + travelledDistance * new Vector2(MathF.Sin(direction), MathF.Cos(direction));
|
||||
}
|
||||
|
||||
|
@ -109,18 +109,18 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
foreach (var p in particles)
|
||||
{
|
||||
var timeSinceStart = currentTime - p.StartTime;
|
||||
float timeSinceStart = currentTime - p.StartTime;
|
||||
|
||||
// ignore particles from the future.
|
||||
// these can appear when seeking in replays.
|
||||
if (timeSinceStart < 0) continue;
|
||||
|
||||
var alpha = p.AlphaAtTime(timeSinceStart);
|
||||
float alpha = p.AlphaAtTime(timeSinceStart);
|
||||
if (alpha <= 0) continue;
|
||||
|
||||
var pos = p.PositionAtTime(timeSinceStart, gravity, maxDuration);
|
||||
var scale = p.ScaleAtTime(timeSinceStart);
|
||||
var angle = p.AngleAtTime(timeSinceStart);
|
||||
float scale = p.ScaleAtTime(timeSinceStart);
|
||||
float angle = p.AngleAtTime(timeSinceStart);
|
||||
|
||||
var rect = createDrawRect(pos, scale);
|
||||
|
||||
@ -139,8 +139,8 @@ namespace osu.Game.Graphics
|
||||
|
||||
private RectangleF createDrawRect(Vector2 position, float scale)
|
||||
{
|
||||
var width = Texture.DisplayWidth * scale;
|
||||
var height = Texture.DisplayHeight * scale;
|
||||
float width = Texture.DisplayWidth * scale;
|
||||
float height = Texture.DisplayHeight * scale;
|
||||
|
||||
if (relativePositionAxes.HasFlagFast(Axes.X))
|
||||
position.X *= sourceSize.X;
|
||||
@ -188,7 +188,7 @@ namespace osu.Game.Graphics
|
||||
|
||||
public Vector2 PositionAtTime(float timeSinceStart, float gravity, float maxDuration)
|
||||
{
|
||||
var progress = progressAtTime(timeSinceStart);
|
||||
float progress = progressAtTime(timeSinceStart);
|
||||
var currentGravity = new Vector2(0, gravity * Duration / maxDuration * progress);
|
||||
|
||||
return StartPosition + (Velocity + currentGravity) * timeSinceStart / maxDuration;
|
||||
|
@ -147,15 +147,15 @@ namespace osu.Game.Graphics
|
||||
private string getFilename()
|
||||
{
|
||||
var dt = DateTime.Now;
|
||||
var fileExt = screenshotFormat.ToString().ToLowerInvariant();
|
||||
string fileExt = screenshotFormat.ToString().ToLowerInvariant();
|
||||
|
||||
var withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}";
|
||||
string withoutIndex = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}.{fileExt}";
|
||||
if (!storage.Exists(withoutIndex))
|
||||
return withoutIndex;
|
||||
|
||||
for (ulong i = 1; i < ulong.MaxValue; i++)
|
||||
{
|
||||
var indexedName = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}-{i}.{fileExt}";
|
||||
string indexedName = $"osu_{dt:yyyy-MM-dd_HH-mm-ss}-{i}.{fileExt}";
|
||||
if (!storage.Exists(indexedName))
|
||||
return indexedName;
|
||||
}
|
||||
|
@ -33,8 +33,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
foreach (var t in TabContainer.Children.OfType<BreadcrumbTabItem>())
|
||||
{
|
||||
var tIndex = TabContainer.IndexOf(t);
|
||||
var tabIndex = TabContainer.IndexOf(TabMap[index.NewValue]);
|
||||
int tIndex = TabContainer.IndexOf(t);
|
||||
int tabIndex = TabContainer.IndexOf(TabMap[index.NewValue]);
|
||||
|
||||
t.State = tIndex > tabIndex ? Visibility.Hidden : Visibility.Visible;
|
||||
t.Chevron.FadeTo(tIndex >= tabIndex ? 0f : 1f, 500, Easing.OutQuint);
|
||||
|
@ -216,10 +216,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
else
|
||||
{
|
||||
var decimalPrecision = normalise(CurrentNumber.Precision.ToDecimal(NumberFormatInfo.InvariantInfo), max_decimal_digits);
|
||||
decimal decimalPrecision = normalise(CurrentNumber.Precision.ToDecimal(NumberFormatInfo.InvariantInfo), max_decimal_digits);
|
||||
|
||||
// Find the number of significant digits (we could have less than 5 after normalize())
|
||||
var significantDigits = findPrecision(decimalPrecision);
|
||||
int significantDigits = findPrecision(decimalPrecision);
|
||||
|
||||
TooltipText = floatValue.ToString($"N{significantDigits}");
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public void ReplayAnimation()
|
||||
{
|
||||
var t = current;
|
||||
float t = current;
|
||||
ResetCount();
|
||||
Current = t;
|
||||
}
|
||||
@ -105,7 +105,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private void animate(float newValue)
|
||||
{
|
||||
for (var i = 0; i < stars.Children.Count; i++)
|
||||
for (int i = 0; i < stars.Children.Count; i++)
|
||||
{
|
||||
var star = stars.Children[i];
|
||||
|
||||
|
@ -236,7 +236,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||
|
||||
var beatLength = timingPoint.BeatLength;
|
||||
double beatLength = timingPoint.BeatLength;
|
||||
|
||||
float amplitudeAdjust = Math.Min(1, 0.4f + amplitudes.Maximum);
|
||||
|
||||
|
Reference in New Issue
Block a user