Fix most warnings.

This commit is contained in:
Dean Herbert
2017-03-07 10:59:19 +09:00
parent 9106c45858
commit 0cad5d7d41
168 changed files with 504 additions and 473 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Connections
public double EndTime;
public Vector2 EndPosition;
const float width = 8;
private const float width = 8;
public FollowPoint()
{

View File

@ -74,13 +74,13 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
for (int d = (int)(PointDistance * 1.5); d < distance - PointDistance; d += PointDistance)
{
float fraction = ((float)d / distance);
float fraction = (float)d / distance;
Vector2 pointStartPosition = startPosition + (fraction - 0.1f) * distanceVector;
Vector2 pointEndPosition = startPosition + fraction * distanceVector;
double fadeOutTime = startTime + fraction * duration;
double fadeInTime = fadeOutTime - PreEmpt;
Add(new FollowPoint()
Add(new FollowPoint
{
StartTime = fadeInTime,
EndTime = fadeOutTime,

View File

@ -49,7 +49,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
return true;
},
},
number = new NumberPiece()
number = new NumberPiece
{
Text = h is Spinner ? "S" : (HitObject.ComboIndex + 1).ToString(),
},
@ -59,7 +59,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
Colour = osuObject.Colour,
},
ApproachCircle = new ApproachCircle()
ApproachCircle = new ApproachCircle
{
Colour = osuObject.Colour,
}
@ -69,9 +69,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
Size = circle.DrawSize;
}
double hit50 = 150;
double hit100 = 80;
double hit300 = 30;
private double hit50 = 150;
private double hit100 = 80;
private double hit300 = 30;
protected override void CheckJudgement(bool userTriggered)
{
@ -84,7 +84,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
double hitOffset = Math.Abs(Judgement.TimeOffset);
OsuJudgementInfo osuJudgement = Judgement as OsuJudgementInfo;
OsuJudgementInfo osuJudgement = (OsuJudgementInfo)Judgement;
if (hitOffset < hit50)
{

View File

@ -17,7 +17,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
}
public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 };
protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.Hit300 };
protected override void UpdateState(ArmedState state)
{

View File

@ -21,10 +21,10 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
private Container<DrawableSliderTick> ticks;
SliderBody body;
SliderBall ball;
private SliderBody body;
private SliderBall ball;
SliderBouncer bouncer1, bouncer2;
private SliderBouncer bouncer1, bouncer2;
public DrawableSlider(Slider s) : base(s)
{
@ -94,7 +94,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
// pass all input through.
public override bool Contains(Vector2 screenSpacePos) => true;
int currentRepeat;
private int currentRepeat;
protected override void Update()
{
@ -103,7 +103,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
double progress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
int repeat = (int)(progress * slider.RepeatCount);
progress = (progress * slider.RepeatCount) % 1;
progress = progress * slider.RepeatCount % 1;
if (repeat > currentRepeat)
{

View File

@ -26,7 +26,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
public override bool RemoveWhenNotAlive => false;
public override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick };
protected override JudgementInfo CreateJudgementInfo() => new OsuJudgementInfo { MaxScore = OsuScoreResult.SliderTick };
public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick)
{
@ -71,7 +71,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
protected override void CheckJudgement(bool userTriggered)
{
var j = Judgement as OsuJudgementInfo;
var j = (OsuJudgementInfo)Judgement;
if (Judgement.TimeOffset >= 0)
{

View File

@ -75,7 +75,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{
if (Time.Current < HitObject.StartTime) return;
var j = Judgement as OsuJudgementInfo;
var j = (OsuJudgementInfo)Judgement;
disc.ScaleTo(Interpolation.ValueAt(Math.Sqrt(Progress), scaleToCircle, Vector2.One, 0, 1), 100);
@ -108,9 +108,9 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
}
}
private Vector2 scaleToCircle => (circle.Scale * circle.DrawWidth / DrawWidth) * 0.95f;
private Vector2 scaleToCircle => circle.Scale * circle.DrawWidth / DrawWidth * 0.95f;
private float spinsPerMinuteNeeded = 100 + (5 * 15); //TODO: read per-map OD and place it on the 5
private float spinsPerMinuteNeeded = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5
private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f);

View File

@ -15,7 +15,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
private readonly Slider slider;
private Box follow;
const float width = 128;
private const float width = 128;
public SliderBall(Slider slider)
{
@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
return base.OnMouseMove(state);
}
bool tracking;
private bool tracking;
public bool Tracking
{
get { return tracking; }

View File

@ -29,7 +29,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
set { Disc.Colour = value; }
}
Color4 completeColour;
private Color4 completeColour;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
@ -37,7 +37,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
completeColour = colours.YellowLight.Opacity(0.8f);
}
class SpinnerBorder : Container
private class SpinnerBorder : Container
{
public SpinnerBorder()
{
@ -116,7 +116,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
};
}
bool tracking;
private bool tracking;
public bool Tracking
{
get { return tracking; }
@ -130,7 +130,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
}
}
bool complete;
private bool complete;
public bool Complete
{
get { return complete; }

View File

@ -8,7 +8,7 @@ using System.Linq;
namespace osu.Game.Modes.Osu.Objects
{
class OsuHitObjectDifficulty
internal class OsuHitObjectDifficulty
{
/// <summary>
/// Factor by how much speed / aim strain decays per second.
@ -63,7 +63,7 @@ namespace osu.Game.Modes.Osu.Objects
MaxCombo += slider.Ticks.Count();
// We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps.
scalingFactor = (52.0f / circleRadius);
scalingFactor = 52.0f / circleRadius;
if (circleRadius < 30)
{
float smallCircleBonus = Math.Min(30.0f - circleRadius, 5.0f) / 50.0f;
@ -130,7 +130,7 @@ namespace osu.Game.Modes.Osu.Objects
else if (distance > almost_diameter)
return 1.2 + 0.4 * (distance - almost_diameter) / (stream_spacing_threshold - almost_diameter);
else if (distance > almost_diameter / 2)
return 0.95 + 0.25 * (distance - (almost_diameter / 2)) / (almost_diameter / 2);
return 0.95 + 0.25 * (distance - almost_diameter / 2) / (almost_diameter / 2);
else
return 0.95;

View File

@ -30,11 +30,8 @@ namespace osu.Game.Modes.Osu.Objects
break;
case HitObjectType.Slider:
CurveTypes curveType = CurveTypes.Catmull;
int repeatCount;
double length = 0;
List<Vector2> points = new List<Vector2>();
points.Add(new Vector2(int.Parse(split[0]), int.Parse(split[1])));
List<Vector2> points = new List<Vector2> { new Vector2(int.Parse(split[0]), int.Parse(split[1])) };
string[] pointsplit = split[5].Split('|');
for (int i = 0; i < pointsplit.Length; i++)
@ -67,12 +64,10 @@ namespace osu.Game.Modes.Osu.Objects
points.Add(v);
}
repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
if (repeatCount > 9000)
{
throw new ArgumentOutOfRangeException("wacky man");
}
throw new ArgumentOutOfRangeException(nameof(repeatCount), @"Repeat count is way too high");
if (split.Length > 7)
length = Convert.ToDouble(split[7], CultureInfo.InvariantCulture);

View File

@ -59,10 +59,9 @@ namespace osu.Game.Modes.Osu.Objects
if (i == ControlPoints.Count - 1 || ControlPoints[i] == ControlPoints[i + 1])
{
List<Vector2> subpath = calculateSubpath(subControlPoints);
for (int j = 0; j < subpath.Count; ++j)
// Only add those vertices that add a new segment to the path.
if (calculatedPath.Count == 0 || calculatedPath.Last() != subpath[j])
calculatedPath.Add(subpath[j]);
foreach (Vector2 t in subpath)
if (calculatedPath.Count == 0 || calculatedPath.Last() != t)
calculatedPath.Add(t);
subControlPoints.Clear();
}
@ -175,7 +174,7 @@ namespace osu.Game.Modes.Osu.Objects
path.Clear();
int i = 0;
for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) ;
for (; i < calculatedPath.Count && cumulativeLength[i] < d0; ++i) { }
path.Add(interpolateVertices(i, d0) + Offset);

View File

@ -100,22 +100,23 @@ namespace osu.Game.Modes.Osu
protected bool CalculateStrainValues()
{
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
List<OsuHitObjectDifficulty>.Enumerator hitObjectsEnumerator = DifficultyHitObjects.GetEnumerator();
if (!hitObjectsEnumerator.MoveNext()) return false;
OsuHitObjectDifficulty currentHitObject = hitObjectsEnumerator.Current;
OsuHitObjectDifficulty nextHitObject;
// First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject.
while (hitObjectsEnumerator.MoveNext())
using (List<OsuHitObjectDifficulty>.Enumerator hitObjectsEnumerator = DifficultyHitObjects.GetEnumerator())
{
nextHitObject = hitObjectsEnumerator.Current;
nextHitObject.CalculateStrains(currentHitObject, TimeRate);
currentHitObject = nextHitObject;
}
return true;
if (!hitObjectsEnumerator.MoveNext()) return false;
OsuHitObjectDifficulty current = hitObjectsEnumerator.Current;
// First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject.
while (hitObjectsEnumerator.MoveNext())
{
var next = hitObjectsEnumerator.Current;
next?.CalculateStrains(current, TimeRate);
current = next;
}
return true;
}
}
/// <summary>
@ -184,7 +185,7 @@ namespace osu.Game.Modes.Osu
}
// Those values are used as array indices. Be careful when changing them!
public enum DifficultyType : int
public enum DifficultyType
{
Speed = 0,
Aim,

View File

@ -71,7 +71,7 @@ namespace osu.Game.Modes.Osu
public override string Description => @"Spinners will be automatically completed";
public override double ScoreMultiplier => 0.9;
public override bool Ranked => true;
public override Mods[] DisablesMods => new Mods[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot };
public override Mods[] DisablesMods => new[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot };
}
public class OsuModAutopilot : Mod
@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
public override double ScoreMultiplier => 0;
public override bool Ranked => false;
public override Mods[] DisablesMods => new Mods[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema };
public override Mods[] DisablesMods => new[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema };
}
public class OsuModTarget : Mod

View File

@ -3,7 +3,7 @@
namespace osu.Game.Modes.Osu
{
class OsuScore : Score
internal class OsuScore : Score
{
}
}

View File

@ -6,7 +6,7 @@ using osu.Game.Modes.Osu.Objects.Drawables;
namespace osu.Game.Modes.Osu
{
class OsuScoreProcessor : ScoreProcessor
internal class OsuScoreProcessor : ScoreProcessor
{
public OsuScoreProcessor(int hitObjectCount)
: base(hitObjectCount)
@ -35,8 +35,9 @@ namespace osu.Game.Modes.Osu
int score = 0;
int maxScore = 0;
foreach (OsuJudgementInfo j in Judgements)
foreach (var judgementInfo in Judgements)
{
var j = (OsuJudgementInfo)judgementInfo;
score += j.ScoreValue;
maxScore += j.MaxScoreValue;
}

View File

@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.UI
/// </summary>
public class OsuComboCounter : ComboCounter
{
protected uint ScheduledPopOutCurrentId = 0;
protected uint ScheduledPopOutCurrentId;
protected virtual float PopOutSmallScale => 1.1f;
protected virtual bool CanPopOutWhileRolling => false;

View File

@ -17,12 +17,17 @@ namespace osu.Game.Modes.Osu.UI
protected override DrawableHitObject GetVisualRepresentation(OsuHitObject h)
{
if (h is HitCircle)
return new DrawableHitCircle(h as HitCircle);
if (h is Slider)
return new DrawableSlider(h as Slider);
if (h is Spinner)
return new DrawableSpinner(h as Spinner);
var circle = h as HitCircle;
if (circle != null)
return new DrawableHitCircle(circle);
var slider = h as Slider;
if (slider != null)
return new DrawableSlider(slider);
var spinner = h as Spinner;
if (spinner != null)
return new DrawableSpinner(spinner);
return null;
}
}

View File

@ -22,7 +22,7 @@ namespace osu.Game.Modes.Osu.UI
Margin = new MarginPadding { Right = 5 },
};
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter()
protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
@ -31,7 +31,7 @@ namespace osu.Game.Modes.Osu.UI
Margin = new MarginPadding { Right = 5 },
};
protected override ComboCounter CreateComboCounter() => new OsuComboCounter()
protected override ComboCounter CreateComboCounter() => new OsuComboCounter
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,