1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 23:27:24 +08:00

Merge remote-tracking branch 'origin/master' into taiko_hitobject_drawable

Conflicts:
	osu.Game.Modes.Taiko/Objects/Drawable/DrawableTaikoHit.cs
	osu.Game.Modes.Taiko/osu.Game.Modes.Taiko.csproj
This commit is contained in:
smoogipooo 2017-03-23 14:40:06 +09:00
commit 3d1dad8185
121 changed files with 374 additions and 287 deletions

@ -1 +1 @@
Subproject commit 42ec8a62fb697f1d967a927549dc51336cd66968 Subproject commit 06e426da039f7bb54aedf5d82c21b8d858a0310e

View File

@ -53,7 +53,7 @@ namespace osu.Desktop.Deploy
private static string nupkgFilename(string ver) => $"{PackageName}.{ver}.nupkg"; private static string nupkgFilename(string ver) => $"{PackageName}.{ver}.nupkg";
private static string nupkgDistroFilename(string ver) => $"{PackageName}-{ver}-full.nupkg"; private static string nupkgDistroFilename(string ver) => $"{PackageName}-{ver}-full.nupkg";
private static Stopwatch sw = new Stopwatch(); private static readonly Stopwatch sw = new Stopwatch();
private static string codeSigningPassword; private static string codeSigningPassword;

View File

@ -15,7 +15,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
this.beatmap = beatmap; this.beatmap = beatmap;
} }
private Beatmap beatmap; private readonly Beatmap beatmap;
protected override Beatmap GetBeatmap() => beatmap; protected override Beatmap GetBeatmap() => beatmap;
protected override Texture GetBackground() => null; protected override Texture GetBackground() => null;

View File

@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests
{ {
public class Benchmark : OsuGameBase public class Benchmark : OsuGameBase
{ {
private double timePerTest = 200; private const double time_per_test = 200;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@ -27,7 +27,7 @@ namespace osu.Desktop.VisualTests
TestBrowser f = new TestBrowser(); TestBrowser f = new TestBrowser();
Add(f); Add(f);
Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {timePerTest}ms each..."); Console.WriteLine($@"{Time}: Running {f.TestCount} tests for {time_per_test}ms each...");
for (int i = 1; i < f.TestCount; i++) for (int i = 1; i < f.TestCount; i++)
{ {
@ -36,10 +36,10 @@ namespace osu.Desktop.VisualTests
{ {
f.LoadTest(loadableCase); f.LoadTest(loadableCase);
Console.WriteLine($@"{Time}: Switching to test #{loadableCase}"); Console.WriteLine($@"{Time}: Switching to test #{loadableCase}");
}, loadableCase * timePerTest); }, loadableCase * time_per_test);
} }
Scheduler.AddDelayed(Host.Exit, f.TestCount * timePerTest); Scheduler.AddDelayed(Host.Exit, f.TestCount * time_per_test);
} }
} }
} }

View File

@ -21,7 +21,7 @@ namespace osu.Desktop.VisualTests.Tests
{ {
internal class TestCaseHitObjects : TestCase internal class TestCaseHitObjects : TestCase
{ {
private FramedClock framedClock; private readonly FramedClock framedClock;
private bool auto; private bool auto;
@ -34,7 +34,7 @@ namespace osu.Desktop.VisualTests.Tests
private HitObjectType mode = HitObjectType.Slider; private HitObjectType mode = HitObjectType.Slider;
private BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 }; private readonly BindableNumber<double> playbackSpeed = new BindableDouble(0.5) { MinValue = 0, MaxValue = 1 };
private Container playfieldContainer; private Container playfieldContainer;
private Container approachContainer; private Container approachContainer;

View File

@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests
progressingNotifications.Add(n); progressingNotifications.Add(n);
} }
private List<ProgressNotification> progressingNotifications = new List<ProgressNotification>(); private readonly List<ProgressNotification> progressingNotifications = new List<ProgressNotification>();
private void sendProgress1() private void sendProgress1()
{ {

View File

@ -17,7 +17,7 @@ namespace osu.Desktop
{ {
internal class OsuGameDesktop : OsuGame internal class OsuGameDesktop : OsuGame
{ {
private VersionManager versionManager; private readonly VersionManager versionManager;
public OsuGameDesktop(string[] args = null) public OsuGameDesktop(string[] args = null)
: base(args) : base(args)

View File

@ -12,7 +12,7 @@ namespace osu.Game.Modes.Catch.Objects.Drawable
{ {
internal class DrawableFruit : Sprite internal class DrawableFruit : Sprite
{ {
private CatchBaseHit h; private readonly CatchBaseHit h;
public DrawableFruit(CatchBaseHit h) public DrawableFruit(CatchBaseHit h)
{ {
@ -29,7 +29,7 @@ namespace osu.Game.Modes.Catch.Objects.Drawable
{ {
Texture = textures.Get(@"Menu/logo"); Texture = textures.Get(@"Menu/logo");
double duration = 0; const double duration = 0;
Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) }); Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); Transforms.Add(new TransformAlpha { StartTime = h.StartTime + duration + 200, EndTime = h.StartTime + duration + 400, StartValue = 1, EndValue = 0 });

View File

@ -26,7 +26,7 @@ namespace osu.Game.Modes.Mania.Objects.Drawable
{ {
Texture = textures.Get(@"Menu/logo"); Texture = textures.Get(@"Menu/logo");
double duration = 0; const double duration = 0;
Transforms.Add(new TransformPositionY { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f }); Transforms.Add(new TransformPositionY { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
Transforms.Add(new TransformAlpha { StartTime = note.StartTime + duration + 200, EndTime = note.StartTime + duration + 400, StartValue = 1, EndValue = 0 }); Transforms.Add(new TransformAlpha { StartTime = note.StartTime + duration + 200, EndTime = note.StartTime + duration + 400, StartValue = 1, EndValue = 0 });

View File

@ -81,7 +81,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
if (endIndex == -1) if (endIndex == -1)
endIndex = hitObjects.Count - 1; endIndex = hitObjects.Count - 1;
int stackDistance = 3; const int stack_distance = 3;
float stackThreshold = DrawableOsuHitObject.TIME_PREEMPT * stackLeniency; float stackThreshold = DrawableOsuHitObject.TIME_PREEMPT * stackLeniency;
// Reset stacking inside the update range // Reset stacking inside the update range
@ -108,8 +108,8 @@ namespace osu.Game.Modes.Osu.Beatmaps
//We are no longer within stacking range of the next object. //We are no longer within stacking range of the next object.
break; break;
if (Vector2.Distance(stackBaseObject.Position, objectN.Position) < stackDistance || if (Vector2.Distance(stackBaseObject.Position, objectN.Position) < stack_distance ||
stackBaseObject is Slider && Vector2.Distance(stackBaseObject.EndPosition, objectN.Position) < stackDistance) stackBaseObject is Slider && Vector2.Distance(stackBaseObject.EndPosition, objectN.Position) < stack_distance)
{ {
stackBaseIndex = n; stackBaseIndex = n;
@ -174,14 +174,14 @@ namespace osu.Game.Modes.Osu.Beatmaps
* o <- hitCircle has stack of -1 * o <- hitCircle has stack of -1
* o <- hitCircle has stack of -2 * o <- hitCircle has stack of -2
*/ */
if (objectN is Slider && Vector2.Distance(objectN.EndPosition, objectI.Position) < stackDistance) if (objectN is Slider && Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance)
{ {
int offset = objectI.StackHeight - objectN.StackHeight + 1; int offset = objectI.StackHeight - objectN.StackHeight + 1;
for (int j = n + 1; j <= i; j++) for (int j = n + 1; j <= i; j++)
{ {
//For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above). //For each object which was declared under this slider, we will offset it to appear *below* the slider end (rather than above).
OsuHitObject objectJ = hitObjects[j]; OsuHitObject objectJ = hitObjects[j];
if (Vector2.Distance(objectN.EndPosition, objectJ.Position) < stackDistance) if (Vector2.Distance(objectN.EndPosition, objectJ.Position) < stack_distance)
objectJ.StackHeight -= offset; objectJ.StackHeight -= offset;
} }
@ -190,7 +190,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
break; break;
} }
if (Vector2.Distance(objectN.Position, objectI.Position) < stackDistance) if (Vector2.Distance(objectN.Position, objectI.Position) < stack_distance)
{ {
//Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out. //Keep processing as if there are no sliders. If we come across a slider, this gets cancelled out.
//NOTE: Sliders with start positions stacking are a special case that is also handled here. //NOTE: Sliders with start positions stacking are a special case that is also handled here.
@ -214,7 +214,7 @@ namespace osu.Game.Modes.Osu.Beatmaps
//We are no longer within stacking range of the previous object. //We are no longer within stacking range of the previous object.
break; break;
if (Vector2.Distance(objectN.EndPosition, objectI.Position) < stackDistance) if (Vector2.Distance(objectN.EndPosition, objectI.Position) < stack_distance)
{ {
objectN.StackHeight = objectI.StackHeight + 1; objectN.StackHeight = objectI.StackHeight + 1;
objectI = objectN; objectI = objectN;

View File

@ -13,15 +13,15 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach public class DrawableHitCircle : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
{ {
private OsuHitObject osuObject; private readonly OsuHitObject osuObject;
public ApproachCircle ApproachCircle; public ApproachCircle ApproachCircle;
private CirclePiece circle; private readonly CirclePiece circle;
private RingPiece ring; private readonly RingPiece ring;
private FlashPiece flash; private readonly FlashPiece flash;
private ExplodePiece explode; private readonly ExplodePiece explode;
private NumberPiece number; private readonly NumberPiece number;
private GlowPiece glow; private readonly GlowPiece glow;
public DrawableHitCircle(OsuHitObject h) : base(h) public DrawableHitCircle(OsuHitObject h) : base(h)
{ {

View File

@ -13,18 +13,18 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach public class DrawableSlider : DrawableOsuHitObject, IDrawableHitObjectWithProxiedApproach
{ {
private Slider slider; private readonly Slider slider;
private DrawableHitCircle initialCircle; private readonly DrawableHitCircle initialCircle;
private List<ISliderProgress> components = new List<ISliderProgress>(); private readonly List<ISliderProgress> components = new List<ISliderProgress>();
private Container<DrawableSliderTick> ticks; private readonly Container<DrawableSliderTick> ticks;
private SliderBody body; private readonly SliderBody body;
private SliderBall ball; private readonly SliderBall ball;
private SliderBouncer bouncer2; private readonly SliderBouncer bouncer2;
public DrawableSlider(Slider s) : base(s) public DrawableSlider(Slider s) : base(s)
{ {

View File

@ -18,7 +18,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class DrawableSliderTick : DrawableOsuHitObject public class DrawableSliderTick : DrawableOsuHitObject
{ {
private SliderTick sliderTick; private readonly SliderTick sliderTick;
public double FadeInTime; public double FadeInTime;
public double FadeOutTime; public double FadeOutTime;

View File

@ -15,12 +15,12 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
public class DrawableSpinner : DrawableOsuHitObject public class DrawableSpinner : DrawableOsuHitObject
{ {
private Spinner spinner; private readonly Spinner spinner;
private SpinnerDisc disc; private readonly SpinnerDisc disc;
private SpinnerBackground background; private readonly SpinnerBackground background;
private Container circleContainer; private readonly Container circleContainer;
private DrawableHitCircle circle; private readonly DrawableHitCircle circle;
public DrawableSpinner(Spinner s) : base(s) public DrawableSpinner(Spinner s) : base(s)
{ {
@ -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 const float spins_per_minute_needed = 100 + 5 * 15; //TODO: read per-map OD and place it on the 5
private float rotationsNeeded => (float)(spinsPerMinuteNeeded * (spinner.EndTime - spinner.StartTime) / 60000f); private float rotationsNeeded => (float)(spins_per_minute_needed * (spinner.EndTime - spinner.StartTime) / 60000f);
public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / rotationsNeeded, 0, 1); public float Progress => MathHelper.Clamp(disc.RotationAbsolute / 360 / rotationsNeeded, 0, 1);

View File

@ -17,8 +17,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
public class HitExplosion : FillFlowContainer public class HitExplosion : FillFlowContainer
{ {
private readonly OsuJudgementInfo judgement; private readonly OsuJudgementInfo judgement;
private SpriteText line1; private readonly SpriteText line1;
private SpriteText line2; private readonly SpriteText line2;
public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null) public HitExplosion(OsuJudgementInfo judgement, OsuHitObject h = null)
{ {

View File

@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
public class ApproachCircle : Container public class ApproachCircle : Container
{ {
private Sprite approachCircle; private readonly Sprite approachCircle;
public ApproachCircle() public ApproachCircle()
{ {

View File

@ -14,7 +14,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
public class CirclePiece : Container public class CirclePiece : Container
{ {
private Sprite disc; private readonly Sprite disc;
public Func<bool> Hit; public Func<bool> Hit;

View File

@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
public class GlowPiece : Container public class GlowPiece : Container
{ {
private Sprite layer; private readonly Sprite layer;
public GlowPiece() public GlowPiece()
{ {

View File

@ -12,7 +12,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
public class NumberPiece : Container public class NumberPiece : Container
{ {
private SpriteText number; private readonly SpriteText number;
public string Text public string Text
{ {

View File

@ -13,7 +13,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
public class SliderBall : CircularContainer, ISliderProgress public class SliderBall : CircularContainer, ISliderProgress
{ {
private readonly Slider slider; private readonly Slider slider;
private Box follow; private readonly Box follow;
private const float width = 128; private const float width = 128;

View File

@ -18,8 +18,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
public class SliderBody : Container, ISliderProgress public class SliderBody : Container, ISliderProgress
{ {
private Path path; private readonly Path path;
private BufferedContainer container; private readonly BufferedContainer container;
public float PathWidth public float PathWidth
{ {
@ -33,7 +33,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
public double? SnakedStart { get; private set; } public double? SnakedStart { get; private set; }
public double? SnakedEnd { get; private set; } public double? SnakedEnd { get; private set; }
private Slider slider; private readonly Slider slider;
public SliderBody(Slider s) public SliderBody(Slider s)
{ {
slider = s; slider = s;
@ -122,7 +122,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
path.Texture = texture; path.Texture = texture;
} }
private List<Vector2> currentCurve = new List<Vector2>(); private readonly List<Vector2> currentCurve = new List<Vector2>();
private bool updateSnaking(double p0, double p1) private bool updateSnaking(double p0, double p1)
{ {
if (SnakedStart == p0 && SnakedEnd == p1) return false; if (SnakedStart == p0 && SnakedEnd == p1) return false;

View File

@ -11,7 +11,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
{ {
private readonly Slider slider; private readonly Slider slider;
private readonly bool isEnd; private readonly bool isEnd;
private TextAwesome icon; private readonly TextAwesome icon;
public SliderBouncer(Slider slider, bool isEnd) public SliderBouncer(Slider slider, bool isEnd)
{ {

View File

@ -47,11 +47,11 @@ namespace osu.Game.Modes.Osu.Objects
internal int MaxCombo = 1; internal int MaxCombo = 1;
private float scalingFactor; private readonly float scalingFactor;
private float lazySliderLength; private float lazySliderLength;
private Vector2 startPosition; private readonly Vector2 startPosition;
private Vector2 endPosition; private readonly Vector2 endPosition;
internal OsuHitObjectDifficulty(OsuHitObject baseHitObject) internal OsuHitObjectDifficulty(OsuHitObject baseHitObject)
{ {

View File

@ -20,7 +20,7 @@ namespace osu.Game.Modes.Osu
private const float spin_radius = 50; private const float spin_radius = 50;
private Beatmap<OsuHitObject> beatmap; private readonly Beatmap<OsuHitObject> beatmap;
public OsuAutoReplay(Beatmap<OsuHitObject> beatmap) public OsuAutoReplay(Beatmap<OsuHitObject> beatmap)
{ {
@ -37,11 +37,11 @@ namespace osu.Game.Modes.Osu
} }
} }
private static IComparer<LegacyReplayFrame> replayFrameComparer = new LegacyReplayFrameComparer(); private static readonly IComparer<LegacyReplayFrame> replay_frame_comparer = new LegacyReplayFrameComparer();
private int findInsertionIndex(LegacyReplayFrame frame) private int findInsertionIndex(LegacyReplayFrame frame)
{ {
int index = Frames.BinarySearch(frame, replayFrameComparer); int index = Frames.BinarySearch(frame, replay_frame_comparer);
if (index < 0) if (index < 0)
{ {

View File

@ -17,9 +17,9 @@ namespace osu.Game.Modes.Osu.UI
{ {
public class OsuPlayfield : Playfield<OsuHitObject, OsuJudgementInfo> public class OsuPlayfield : Playfield<OsuHitObject, OsuJudgementInfo>
{ {
private Container approachCircles; private readonly Container approachCircles;
private Container judgementLayer; private readonly Container judgementLayer;
private ConnectionRenderer<OsuHitObject> connectionLayer; private readonly ConnectionRenderer<OsuHitObject> connectionLayer;
public override Vector2 Size public override Vector2 Size
{ {

View File

@ -0,0 +1,30 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects.Types;
namespace osu.Game.Modes.Taiko.Objects
{
public class Bash : TaikoHitObject, IHasEndTime
{
public double EndTime { get; set; }
public double Duration => EndTime - StartTime;
/// <summary>
/// The number of hits required to complete the bash successfully.
/// </summary>
public int RequiredHits { get; protected set; }
public override void ApplyDefaults(TimingInfo timing, BeatmapDifficulty difficulty)
{
base.ApplyDefaults(timing, difficulty);
double spinnerRotationRatio = BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5);
RequiredHits = (int)Math.Max(1, Duration / 1000f * spinnerRotationRatio);
}
}
}

View File

@ -52,6 +52,7 @@
<Compile Include="Judgements\TaikoJudgementInfo.cs" /> <Compile Include="Judgements\TaikoJudgementInfo.cs" />
<Compile Include="Judgements\TaikoHitResult.cs" /> <Compile Include="Judgements\TaikoHitResult.cs" />
<Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" /> <Compile Include="Objects\Drawable\DrawableTaikoHitObject.cs" />
<Compile Include="Objects\Bash.cs" />
<Compile Include="Objects\DrumRoll.cs" /> <Compile Include="Objects\DrumRoll.cs" />
<Compile Include="Objects\DrumRollTick.cs" /> <Compile Include="Objects\DrumRollTick.cs" />
<Compile Include="TaikoDifficultyCalculator.cs" /> <Compile Include="TaikoDifficultyCalculator.cs" />

View File

@ -15,8 +15,8 @@ namespace osu.Game.Beatmaps
private void loadTiming() private void loadTiming()
{ {
// TODO: Handle mods // TODO: Handle mods
int audioRate = 100; const int audio_rate = 100;
TimeRate = audioRate / 100.0; TimeRate = audio_rate / 100.0;
} }
public double Calculate(Dictionary<string, string> categoryDifficulty = null) public double Calculate(Dictionary<string, string> categoryDifficulty = null)

View File

@ -21,12 +21,12 @@ namespace osu.Game.Beatmaps.Drawables
public class BeatmapPanel : Panel public class BeatmapPanel : Panel
{ {
public BeatmapInfo Beatmap; public BeatmapInfo Beatmap;
private Sprite background; private readonly Sprite background;
public Action<BeatmapPanel> GainedSelection; public Action<BeatmapPanel> GainedSelection;
public Action<BeatmapPanel> StartRequested; public Action<BeatmapPanel> StartRequested;
private Triangles triangles; private readonly Triangles triangles;
private StarCounter starCounter; private readonly StarCounter starCounter;
protected override void Selected() protected override void Selected()
{ {

View File

@ -20,11 +20,12 @@ namespace osu.Game.Beatmaps.Drawables
public class BeatmapSetHeader : Panel public class BeatmapSetHeader : Panel
{ {
public Action<BeatmapSetHeader> GainedSelection; public Action<BeatmapSetHeader> GainedSelection;
private SpriteText title, artist; private readonly SpriteText title;
private readonly SpriteText artist;
private OsuConfigManager config; private OsuConfigManager config;
private Bindable<bool> preferUnicode; private Bindable<bool> preferUnicode;
private WorkingBeatmap beatmap; private readonly WorkingBeatmap beatmap;
private FillFlowContainer difficultyIcons; private readonly FillFlowContainer difficultyIcons;
public BeatmapSetHeader(WorkingBeatmap beatmap) public BeatmapSetHeader(WorkingBeatmap beatmap)
{ {

View File

@ -18,7 +18,7 @@ namespace osu.Game.Beatmaps.Drawables
public override bool RemoveWhenNotAlive => false; public override bool RemoveWhenNotAlive => false;
private Container nestedContainer; private readonly Container nestedContainer;
protected override Container<Drawable> Content => nestedContainer; protected override Container<Drawable> Content => nestedContainer;

View File

@ -21,9 +21,9 @@ namespace osu.Game.Beatmaps.IO
OsuLegacyDecoder.Register(); OsuLegacyDecoder.Register();
} }
private Stream archiveStream; private readonly Stream archiveStream;
private ZipFile archive; private readonly ZipFile archive;
private Beatmap firstMap; private readonly Beatmap firstMap;
public OszArchiveReader(Stream archiveStream) public OszArchiveReader(Stream archiveStream)
{ {

View File

@ -42,7 +42,7 @@ namespace osu.Game.Beatmaps
protected abstract Track GetTrack(); protected abstract Track GetTrack();
private Beatmap beatmap; private Beatmap beatmap;
private object beatmapLock = new object(); private readonly object beatmapLock = new object();
public Beatmap Beatmap public Beatmap Beatmap
{ {
get get
@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps
} }
} }
private object backgroundLock = new object(); private readonly object backgroundLock = new object();
private Texture background; private Texture background;
public Texture Background public Texture Background
{ {
@ -68,7 +68,7 @@ namespace osu.Game.Beatmaps
} }
private Track track; private Track track;
private object trackLock = new object(); private readonly object trackLock = new object();
public Track Track public Track Track
{ {
get get

View File

@ -21,7 +21,7 @@ namespace osu.Game.Database
public class BeatmapDatabase public class BeatmapDatabase
{ {
private SQLiteConnection connection { get; } private SQLiteConnection connection { get; }
private Storage storage; private readonly Storage storage;
public event Action<BeatmapSetInfo> BeatmapSetAdded; public event Action<BeatmapSetInfo> BeatmapSetAdded;
public event Action<BeatmapSetInfo> BeatmapSetRemoved; public event Action<BeatmapSetInfo> BeatmapSetRemoved;

View File

@ -14,7 +14,7 @@ namespace osu.Game.Graphics.Backgrounds
{ {
public Sprite Sprite; public Sprite Sprite;
private string textureName; private readonly string textureName;
public Background(string textureName = @"") public Background(string textureName = @"")
{ {

View File

@ -89,13 +89,13 @@ namespace osu.Game.Graphics.Backgrounds
protected virtual Triangle CreateTriangle() protected virtual Triangle CreateTriangle()
{ {
float stdDev = 0.16f; const float std_dev = 0.16f;
float mean = 0.5f; const float mean = 0.5f;
float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats
float u2 = 1 - RNG.NextSingle(); float u2 = 1 - RNG.NextSingle();
float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1) float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1)
var scale = Math.Max(triangleScale * (mean + stdDev * randStdNormal), 0.1f); //random normal(mean,stdDev^2) var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); //random normal(mean,stdDev^2)
const float size = 100; const float size = 100;

View File

@ -31,7 +31,7 @@ namespace osu.Game.Graphics.Containers
}); });
} }
private Container content; private readonly Container content;
private InputManager input; private InputManager input;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;

View File

@ -31,10 +31,10 @@ namespace osu.Game.Graphics.Cursor
private float time; private float time;
private TrailDrawNodeSharedData trailDrawNodeSharedData = new TrailDrawNodeSharedData(); private readonly TrailDrawNodeSharedData trailDrawNodeSharedData = new TrailDrawNodeSharedData();
private const int max_sprites = 2048; private const int max_sprites = 2048;
private TrailPart[] parts = new TrailPart[max_sprites]; private readonly TrailPart[] parts = new TrailPart[max_sprites];
private Vector2? lastPosition; private Vector2? lastPosition;
@ -88,10 +88,10 @@ namespace osu.Game.Graphics.Cursor
Invalidate(Invalidation.DrawNode, shallPropagate: false); Invalidate(Invalidation.DrawNode, shallPropagate: false);
int fadeClockResetThreshold = 1000000; const int fade_clock_reset_threshold = 1000000;
time = (float)(Time.Current - timeOffset) / 500f; time = (float)(Time.Current - timeOffset) / 500f;
if (time > fadeClockResetThreshold) if (time > fade_clock_reset_threshold)
resetTime(); resetTime();
} }
@ -163,7 +163,7 @@ namespace osu.Game.Graphics.Cursor
public float Time; public float Time;
public TrailDrawNodeSharedData Shared; public TrailDrawNodeSharedData Shared;
public TrailPart[] Parts = new TrailPart[max_sprites]; public readonly TrailPart[] Parts = new TrailPart[max_sprites];
public Vector2 Size; public Vector2 Size;
public TrailDrawNode() public TrailDrawNode()

View File

@ -81,9 +81,14 @@ namespace osu.Game.Graphics.UserInterface
public SampleChannel SampleClick, SampleHover; public SampleChannel SampleClick, SampleHover;
private Container backgroundContainer, colourContainer, glowContainer; private readonly Container backgroundContainer;
private Box leftGlow, centerGlow, rightGlow, background; private readonly Container colourContainer;
private SpriteText spriteText; private readonly Container glowContainer;
private readonly Box leftGlow;
private readonly Box centerGlow;
private readonly Box rightGlow;
private readonly Box background;
private readonly SpriteText spriteText;
private Vector2 hoverSpacing => new Vector2(3f, 0f); private Vector2 hoverSpacing => new Vector2(3f, 0f);
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking

View File

@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface
public const float COLLAPSED_SIZE = 20; public const float COLLAPSED_SIZE = 20;
public const float EXPANDED_SIZE = 40; public const float EXPANDED_SIZE = 40;
private Box fill; private readonly Box fill;
private const float border_width = 3; private const float border_width = 3;
private Color4 glowingColour, idleColour; private Color4 glowingColour, idleColour;

View File

@ -64,8 +64,8 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
private Nub nub; private readonly Nub nub;
private SpriteText labelSpriteText; private readonly SpriteText labelSpriteText;
private SampleChannel sampleChecked; private SampleChannel sampleChecked;
private SampleChannel sampleUnchecked; private SampleChannel sampleUnchecked;

View File

@ -85,7 +85,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4? accentColour; private Color4? accentColour;
private TextAwesome chevron; private readonly TextAwesome chevron;
protected override void FormatForeground(bool hover = false) protected override void FormatForeground(bool hover = false)
{ {
@ -116,7 +116,7 @@ namespace osu.Game.Graphics.UserInterface
protected class OsuDropdownHeader : DropdownHeader protected class OsuDropdownHeader : DropdownHeader
{ {
private SpriteText label; private readonly SpriteText label;
protected override string Label protected override string Label
{ {
get { return label.Text; } get { return label.Text; }

View File

@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface
public class PasswordMaskChar : Container public class PasswordMaskChar : Container
{ {
private CircularContainer circle; private readonly CircularContainer circle;
public PasswordMaskChar(float size) public PasswordMaskChar(float size)
{ {

View File

@ -19,8 +19,9 @@ namespace osu.Game.Graphics.UserInterface
private SampleChannel sample; private SampleChannel sample;
private double lastSampleTime; private double lastSampleTime;
private Nub nub; private readonly Nub nub;
private Box leftBox, rightBox; private readonly Box leftBox;
private readonly Box rightBox;
public OsuSliderBar() public OsuSliderBar()
{ {

View File

@ -59,8 +59,8 @@ namespace osu.Game.Graphics.UserInterface
private class OsuTabItem : TabItem<T> private class OsuTabItem : TabItem<T>
{ {
private SpriteText text; private readonly SpriteText text;
private Box box; private readonly Box box;
private Color4? accentColour; private Color4? accentColour;
public Color4 AccentColour public Color4 AccentColour

View File

@ -147,7 +147,7 @@ namespace osu.Game.Graphics.UserInterface
private class Star : Container private class Star : Container
{ {
public TextAwesome Icon; public readonly TextAwesome Icon;
public Star() public Star()
{ {
Size = new Vector2(star_size); Size = new Vector2(star_size);

View File

@ -16,7 +16,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class TwoLayerButton : ClickableContainer public class TwoLayerButton : ClickableContainer
{ {
private TextAwesome icon; private readonly TextAwesome icon;
public Box IconLayer; public Box IconLayer;
public Box TextLayer; public Box TextLayer;
@ -29,11 +29,11 @@ namespace osu.Game.Graphics.UserInterface
public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50); public static readonly Vector2 SIZE_EXTENDED = new Vector2(140, 50);
public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50); public static readonly Vector2 SIZE_RETRACTED = new Vector2(100, 50);
public SampleChannel ActivationSound; public SampleChannel ActivationSound;
private SpriteText text; private readonly SpriteText text;
public Color4 HoverColour; public Color4 HoverColour;
private Container c1; private readonly Container c1;
private Container c2; private readonly Container c2;
public Color4 BackgroundColour public Color4 BackgroundColour
{ {
@ -171,7 +171,7 @@ namespace osu.Game.Graphics.UserInterface
IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic); IconLayer.FadeColour(HoverColour, transform_time, EasingTypes.OutElastic);
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
double startTime = Time.Current + offset; double startTime = Time.Current + offset;
// basic pulse // basic pulse
@ -200,7 +200,7 @@ namespace osu.Game.Graphics.UserInterface
int duration = 0; //(int)(Game.Audio.BeatLength); int duration = 0; //(int)(Game.Audio.BeatLength);
if (duration == 0) duration = pulse_length * 2; if (duration == 0) duration = pulse_length * 2;
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
double startTime = Time.Current + offset; double startTime = Time.Current + offset;
// slow pulse // slow pulse

View File

@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
{ {
internal class VolumeControl : OverlayContainer internal class VolumeControl : OverlayContainer
{ {
private VolumeMeter volumeMeterMaster; private readonly VolumeMeter volumeMeterMaster;
protected override bool HideOnEscape => false; protected override bool HideOnEscape => false;
@ -89,8 +89,8 @@ namespace osu.Game.Graphics.UserInterface.Volume
private ScheduledDelegate popOutDelegate; private ScheduledDelegate popOutDelegate;
private VolumeMeter volumeMeterEffect; private readonly VolumeMeter volumeMeterEffect;
private VolumeMeter volumeMeterMusic; private readonly VolumeMeter volumeMeterMusic;
protected override void PopIn() protected override void PopIn()
{ {

View File

@ -15,7 +15,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
{ {
internal class VolumeMeter : Container internal class VolumeMeter : Container
{ {
private Box meterFill; private readonly Box meterFill;
public BindableDouble Bindable { get; } = new BindableDouble(); public BindableDouble Bindable { get; } = new BindableDouble();
public VolumeMeter(string meterName) public VolumeMeter(string meterName)

View File

@ -18,7 +18,7 @@ namespace osu.Game.IO.Legacy
/// handle null strings and simplify use with ISerializable. </summary> /// handle null strings and simplify use with ISerializable. </summary>
public class SerializationReader : BinaryReader public class SerializationReader : BinaryReader
{ {
private Stream stream; private readonly Stream stream;
public SerializationReader(Stream s) public SerializationReader(Stream s)
: base(s, Encoding.UTF8) : base(s, Encoding.UTF8)

View File

@ -10,7 +10,7 @@ namespace osu.Game.IPC
{ {
public class BeatmapIPCChannel : IpcChannel<BeatmapImportMessage> public class BeatmapIPCChannel : IpcChannel<BeatmapImportMessage>
{ {
private BeatmapDatabase beatmaps; private readonly BeatmapDatabase beatmaps;
public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null) public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null)
: base(host) : base(host)

View File

@ -10,7 +10,7 @@ namespace osu.Game.IPC
{ {
public class ScoreIPCChannel : IpcChannel<ScoreImportMessage> public class ScoreIPCChannel : IpcChannel<ScoreImportMessage>
{ {
private ScoreDatabase scores; private readonly ScoreDatabase scores;
public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null) public ScoreIPCChannel(IIpcHost host, ScoreDatabase scores = null)
: base(host) : base(host)

View File

@ -8,10 +8,10 @@ namespace osu.Game.Modes.Objects
{ {
public class BezierApproximator public class BezierApproximator
{ {
private int count; private readonly int count;
private List<Vector2> controlPoints; private readonly List<Vector2> controlPoints;
private Vector2[] subdivisionBuffer1; private readonly Vector2[] subdivisionBuffer1;
private Vector2[] subdivisionBuffer2; private readonly Vector2[] subdivisionBuffer2;
private const float tolerance = 0.25f; private const float tolerance = 0.25f;
private const float tolerance_sq = tolerance * tolerance; private const float tolerance_sq = tolerance * tolerance;

View File

@ -10,9 +10,9 @@ namespace osu.Game.Modes.Objects
{ {
public class CircularArcApproximator public class CircularArcApproximator
{ {
private Vector2 a; private readonly Vector2 a;
private Vector2 b; private readonly Vector2 b;
private Vector2 c; private readonly Vector2 c;
private int amountPoints; private int amountPoints;

View File

@ -19,8 +19,8 @@ namespace osu.Game.Modes.Objects
public Vector2 Offset; public Vector2 Offset;
private List<Vector2> calculatedPath = new List<Vector2>(); private readonly List<Vector2> calculatedPath = new List<Vector2>();
private List<double> cumulativeLength = new List<double>(); private readonly List<double> cumulativeLength = new List<double>();
private List<Vector2> calculateSubpath(List<Vector2> subControlPoints) private List<Vector2> calculateSubpath(List<Vector2> subControlPoints)
{ {

View File

@ -21,9 +21,9 @@ namespace osu.Game.Modes
public abstract class Ruleset public abstract class Ruleset
{ {
private static ConcurrentDictionary<PlayMode, Type> availableRulesets = new ConcurrentDictionary<PlayMode, Type>(); private static readonly ConcurrentDictionary<PlayMode, Type> available_rulesets = new ConcurrentDictionary<PlayMode, Type>();
public static IEnumerable<PlayMode> PlayModes => availableRulesets.Keys; public static IEnumerable<PlayMode> PlayModes => available_rulesets.Keys;
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { }; public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
@ -35,7 +35,7 @@ namespace osu.Game.Modes
public abstract ScoreProcessor CreateScoreProcessor(); public abstract ScoreProcessor CreateScoreProcessor();
public static void Register(Ruleset ruleset) => availableRulesets.TryAdd(ruleset.PlayMode, ruleset.GetType()); public static void Register(Ruleset ruleset) => available_rulesets.TryAdd(ruleset.PlayMode, ruleset.GetType());
protected abstract PlayMode PlayMode { get; } protected abstract PlayMode PlayMode { get; }
@ -49,7 +49,7 @@ namespace osu.Game.Modes
{ {
Type type; Type type;
if (!availableRulesets.TryGetValue(mode, out type)) if (!available_rulesets.TryGetValue(mode, out type))
return null; return null;
return Activator.CreateInstance(type) as Ruleset; return Activator.CreateInstance(type) as Ruleset;

View File

@ -155,7 +155,7 @@ namespace osu.Game.Modes.UI
/// </summary> /// </summary>
protected Playfield<TObject, TJudgement> Playfield; protected Playfield<TObject, TJudgement> Playfield;
private Container content; private readonly Container content;
protected HitRenderer(WorkingBeatmap beatmap) protected HitRenderer(WorkingBeatmap beatmap)
: base(beatmap) : base(beatmap)

View File

@ -10,7 +10,8 @@ namespace osu.Game.Modes.UI
{ {
public class ModIcon : Container public class ModIcon : Container
{ {
private TextAwesome modIcon, background; private readonly TextAwesome modIcon;
private readonly TextAwesome background;
private float iconSize = 80; private float iconSize = 80;
public float IconSize public float IconSize

View File

@ -23,7 +23,7 @@ namespace osu.Game.Modes.UI
internal Container<Drawable> ScaledContent; internal Container<Drawable> ScaledContent;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private Container<Drawable> content; private readonly Container<Drawable> content;
/// <summary> /// <summary>
/// A container for keeping track of DrawableHitObjects. /// A container for keeping track of DrawableHitObjects.

View File

@ -15,7 +15,7 @@ namespace osu.Game.Modes.UI
{ {
public class StandardHealthDisplay : HealthDisplay public class StandardHealthDisplay : HealthDisplay
{ {
private Container fill; private readonly Container fill;
public StandardHealthDisplay() public StandardHealthDisplay()
{ {

View File

@ -17,7 +17,7 @@ namespace osu.Game.Online.API
{ {
public class APIAccess : IUpdateable public class APIAccess : IUpdateable
{ {
private OAuth authentication; private readonly OAuth authentication;
public string Endpoint = @"https://new.ppy.sh"; public string Endpoint = @"https://new.ppy.sh";
private const string client_id = @"5"; private const string client_id = @"5";
@ -44,9 +44,9 @@ namespace osu.Game.Online.API
protected bool HasLogin => Token != null || !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password); protected bool HasLogin => Token != null || !string.IsNullOrEmpty(Username) && !string.IsNullOrEmpty(Password);
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable (should dispose of this or at very least keep a reference). // ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable (should dispose of this or at very least keep a reference).
private Thread thread; private readonly Thread thread;
private Logger log; private readonly Logger log;
public APIAccess() public APIAccess()
{ {
@ -57,7 +57,7 @@ namespace osu.Game.Online.API
thread.Start(); thread.Start();
} }
private List<IOnlineComponent> components = new List<IOnlineComponent>(); private readonly List<IOnlineComponent> components = new List<IOnlineComponent>();
public void Register(IOnlineComponent component) public void Register(IOnlineComponent component)
{ {

View File

@ -9,7 +9,7 @@ namespace osu.Game.Online.API.Requests
{ {
public class GetMessagesRequest : APIRequest<List<Message>> public class GetMessagesRequest : APIRequest<List<Message>>
{ {
private List<Channel> channels; private readonly List<Channel> channels;
private long? since; private long? since;
public GetMessagesRequest(List<Channel> channels, long? sinceId) public GetMessagesRequest(List<Channel> channels, long? sinceId)

View File

@ -14,8 +14,8 @@ namespace osu.Game.Online.Chat.Drawables
public class DrawableChannel : Container public class DrawableChannel : Container
{ {
private readonly Channel channel; private readonly Channel channel;
private FillFlowContainer flow; private readonly FillFlowContainer flow;
private ScrollContainer scroll; private readonly ScrollContainer scroll;
public DrawableChannel(Channel channel) public DrawableChannel(Channel channel)
{ {

View File

@ -60,7 +60,7 @@ namespace osu.Game
public Bindable<PlayMode> PlayMode; public Bindable<PlayMode> PlayMode;
private string[] args; private readonly string[] args;
private OptionsOverlay options; private OptionsOverlay options;

View File

@ -31,11 +31,11 @@ namespace osu.Game.Overlays
private ScheduledDelegate messageRequest; private ScheduledDelegate messageRequest;
private Container content; private readonly Container content;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private FocusedTextBox inputTextBox; private readonly FocusedTextBox inputTextBox;
private APIAccess api; private APIAccess api;

View File

@ -27,10 +27,12 @@ namespace osu.Game.Overlays.Dialog
private readonly Vector2 ringMinifiedSize = new Vector2(20f); private readonly Vector2 ringMinifiedSize = new Vector2(20f);
private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f); private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f);
private Container content, ring; private readonly Container content;
private FillFlowContainer<PopupDialogButton> buttonsContainer; private readonly Container ring;
private TextAwesome iconText; private readonly FillFlowContainer<PopupDialogButton> buttonsContainer;
private SpriteText header, body; private readonly TextAwesome iconText;
private readonly SpriteText header;
private readonly SpriteText body;
public FontAwesome Icon public FontAwesome Icon
{ {

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays
{ {
public class DialogOverlay : FocusedOverlayContainer public class DialogOverlay : FocusedOverlayContainer
{ {
private Container dialogContainer; private readonly Container dialogContainer;
private PopupDialog currentDialog; private PopupDialog currentDialog;
public void Push(PopupDialog dialog) public void Push(PopupDialog dialog)

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays
{ {
public class DragBar : Container public class DragBar : Container
{ {
private Box fill; private readonly Box fill;
public Action<float> SeekRequested; public Action<float> SeekRequested;
private bool isDragging; private bool isDragging;

View File

@ -23,8 +23,8 @@ namespace osu.Game.Overlays.Mods
public class ModButton : FillFlowContainer public class ModButton : FillFlowContainer
{ {
private ModIcon foregroundIcon { get; set; } private ModIcon foregroundIcon { get; set; }
private SpriteText text; private readonly SpriteText text;
private Container<ModIcon> iconsContainer; private readonly Container<ModIcon> iconsContainer;
private SampleChannel sampleOn, sampleOff; private SampleChannel sampleOn, sampleOff;
public Action<Mod> Action; // Passed the selected mod or null if none public Action<Mod> Action; // Passed the selected mod or null if none

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Mods
{ {
public abstract class ModSection : Container public abstract class ModSection : Container
{ {
private OsuSpriteText headerLabel; private readonly OsuSpriteText headerLabel;
public FillFlowContainer<ModButton> ButtonsContainer { get; } public FillFlowContainer<ModButton> ButtonsContainer { get; }

View File

@ -30,10 +30,11 @@ namespace osu.Game.Overlays.Mods
private Color4 lowMultiplierColour, highMultiplierColour; private Color4 lowMultiplierColour, highMultiplierColour;
private OsuSpriteText rankedLabel, multiplierLabel; private readonly OsuSpriteText rankedLabel;
private FillFlowContainer rankedMultiplerContainer; private readonly OsuSpriteText multiplierLabel;
private readonly FillFlowContainer rankedMultiplerContainer;
private FillFlowContainer<ModSection> modSectionsContainer; private readonly FillFlowContainer<ModSection> modSectionsContainer;
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(); public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>();

View File

@ -35,7 +35,7 @@ namespace osu.Game.Overlays
private SpriteText title, artist; private SpriteText title, artist;
private List<BeatmapSetInfo> playList; private List<BeatmapSetInfo> playList;
private List<BeatmapInfo> playHistory = new List<BeatmapInfo>(); private readonly List<BeatmapInfo> playHistory = new List<BeatmapInfo>();
private int playListIndex; private int playListIndex;
private int playHistoryIndex = -1; private int playHistoryIndex = -1;
@ -415,8 +415,8 @@ namespace osu.Game.Overlays
private class MusicControllerBackground : BufferedContainer private class MusicControllerBackground : BufferedContainer
{ {
private Sprite sprite; private readonly Sprite sprite;
private WorkingBeatmap beatmap; private readonly WorkingBeatmap beatmap;
public MusicControllerBackground(WorkingBeatmap beatmap = null) public MusicControllerBackground(WorkingBeatmap beatmap = null)
{ {

View File

@ -35,9 +35,9 @@ namespace osu.Game.Overlays.Notifications
public virtual bool DisplayOnTop => true; public virtual bool DisplayOnTop => true;
protected NotificationLight Light; protected NotificationLight Light;
private CloseButton closeButton; private readonly CloseButton closeButton;
protected Container IconContent; protected Container IconContent;
private Container content; private readonly Container content;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;

View File

@ -135,7 +135,7 @@ namespace osu.Game.Overlays.Notifications
private class ClearAllButton : ClickableContainer private class ClearAllButton : ClickableContainer
{ {
private OsuSpriteText text; private readonly OsuSpriteText text;
public ClearAllButton() public ClearAllButton()
{ {

View File

@ -104,12 +104,12 @@ namespace osu.Game.Overlays.Notifications
public override bool DisplayOnTop => false; public override bool DisplayOnTop => false;
private ProgressBar progressBar; private readonly ProgressBar progressBar;
private Color4 colourQueued; private Color4 colourQueued;
private Color4 colourActive; private Color4 colourActive;
private Color4 colourCancelled; private Color4 colourCancelled;
private SpriteText textDrawable; private readonly SpriteText textDrawable;
public ProgressNotification() public ProgressNotification()
{ {

View File

@ -34,8 +34,8 @@ namespace osu.Game.Overlays.Notifications
} }
} }
private SpriteText textDrawable; private readonly SpriteText textDrawable;
private TextAwesome iconDrawable; private readonly TextAwesome iconDrawable;
protected Box IconBackgound; protected Box IconBackgound;

View File

@ -15,8 +15,8 @@ namespace osu.Game.Overlays.Options
{ {
public class OptionDropdown<T> : FillFlowContainer public class OptionDropdown<T> : FillFlowContainer
{ {
private Dropdown<T> dropdown; private readonly Dropdown<T> dropdown;
private SpriteText text; private readonly SpriteText text;
public string LabelText public string LabelText
{ {

View File

@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Options
{ {
public class OptionSlider<T> : FillFlowContainer where T : struct public class OptionSlider<T> : FillFlowContainer where T : struct
{ {
private SliderBar<T> slider; private readonly SliderBar<T> slider;
private SpriteText text; private readonly SpriteText text;
public string LabelText public string LabelText
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Options
public abstract FontAwesome Icon { get; } public abstract FontAwesome Icon { get; }
public abstract string Header { get; } public abstract string Header { get; }
private SpriteText headerLabel; private readonly SpriteText headerLabel;
protected OptionsSection() protected OptionsSection()
{ {

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Options
{ {
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private Container<Drawable> content; private readonly Container<Drawable> content;
protected abstract string Header { get; } protected abstract string Header { get; }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options
{ {
public class Sidebar : Container public class Sidebar : Container
{ {
private FillFlowContainer content; private readonly FillFlowContainer content;
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH; internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
internal const int EXPANDED_WIDTH = 200; internal const int EXPANDED_WIDTH = 200;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;

View File

@ -16,11 +16,11 @@ namespace osu.Game.Overlays.Options
{ {
public class SidebarButton : Container public class SidebarButton : Container
{ {
private TextAwesome drawableIcon; private readonly TextAwesome drawableIcon;
private SpriteText headerText; private readonly SpriteText headerText;
private Box backgroundBox; private readonly Box backgroundBox;
private Box selectionIndicator; private readonly Box selectionIndicator;
private Container text; private readonly Container text;
public Action Action; public Action Action;
private OptionsSection section; private OptionsSection section;

View File

@ -23,8 +23,8 @@ namespace osu.Game.Overlays.Toolbar
public Action OnHome; public Action OnHome;
public Action<PlayMode> OnPlayModeChange; public Action<PlayMode> OnPlayModeChange;
private ToolbarModeSelector modeSelector; private readonly ToolbarModeSelector modeSelector;
private ToolbarUserArea userArea; private readonly ToolbarUserArea userArea;
protected override bool HideOnEscape => false; protected override bool HideOnEscape => false;
@ -90,8 +90,8 @@ namespace osu.Game.Overlays.Toolbar
public class ToolbarBackground : Container public class ToolbarBackground : Container
{ {
private Box solidBackground; private readonly Box solidBackground;
private Box gradientBackground; private readonly Box gradientBackground;
public ToolbarBackground() public ToolbarBackground()
{ {

View File

@ -63,9 +63,9 @@ namespace osu.Game.Overlays.Toolbar
protected TextAwesome DrawableIcon; protected TextAwesome DrawableIcon;
protected SpriteText DrawableText; protected SpriteText DrawableText;
protected Box HoverBackground; protected Box HoverBackground;
private FillFlowContainer tooltipContainer; private readonly FillFlowContainer tooltipContainer;
private SpriteText tooltip1; private readonly SpriteText tooltip1;
private SpriteText tooltip2; private readonly SpriteText tooltip2;
protected FillFlowContainer Flow; protected FillFlowContainer Flow;
private SampleChannel sampleClick; private SampleChannel sampleClick;

View File

@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Toolbar
{ {
private const float padding = 10; private const float padding = 10;
private FillFlowContainer modeButtons; private readonly FillFlowContainer modeButtons;
private Drawable modeButtonLine; private readonly Drawable modeButtonLine;
private ToolbarModeButton activeButton; private ToolbarModeButton activeButton;
public Action<PlayMode> OnPlayModeChange; public Action<PlayMode> OnPlayModeChange;

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
internal class ToolbarOverlayToggleButton : ToolbarButton internal class ToolbarOverlayToggleButton : ToolbarButton
{ {
private Box stateBackground; private readonly Box stateBackground;
private OverlayContainer stateContainer; private OverlayContainer stateContainer;

View File

@ -11,7 +11,7 @@ namespace osu.Game.Overlays.Toolbar
internal class ToolbarUserArea : Container internal class ToolbarUserArea : Container
{ {
public LoginOverlay LoginOverlay; public LoginOverlay LoginOverlay;
private ToolbarUserButton button; private readonly ToolbarUserButton button;
public override RectangleF BoundingBox => button.BoundingBox; public override RectangleF BoundingBox => button.BoundingBox;

View File

@ -14,7 +14,7 @@ namespace osu.Game.Overlays.Toolbar
{ {
internal class ToolbarUserButton : ToolbarButton, IOnlineComponent internal class ToolbarUserButton : ToolbarButton, IOnlineComponent
{ {
private Avatar avatar; private readonly Avatar avatar;
public ToolbarUserButton() public ToolbarUserButton()
{ {

View File

@ -20,9 +20,12 @@ namespace osu.Game.Overlays
private const EasingTypes easing_show = EasingTypes.OutSine; private const EasingTypes easing_show = EasingTypes.OutSine;
private const EasingTypes easing_hide = EasingTypes.InSine; private const EasingTypes easing_hide = EasingTypes.InSine;
private Wave firstWave, secondWave, thirdWave, fourthWave; private readonly Wave firstWave;
private readonly Wave secondWave;
private readonly Wave thirdWave;
private readonly Wave fourthWave;
private Container<Wave> wavesContainer; private readonly Container<Wave> wavesContainer;
private readonly Container contentContainer; private readonly Container contentContainer;

View File

@ -72,7 +72,7 @@ namespace osu.Game.Screens.Backgrounds
private class BeatmapBackground : Background private class BeatmapBackground : Background
{ {
private WorkingBeatmap beatmap; private readonly WorkingBeatmap beatmap;
public BeatmapBackground(WorkingBeatmap beatmap) public BeatmapBackground(WorkingBeatmap beatmap)
{ {

View File

@ -19,14 +19,14 @@ namespace osu.Game.Screens
{ {
public class ScreenWhiteBox : OsuScreen public class ScreenWhiteBox : OsuScreen
{ {
private BackButton popButton; private readonly BackButton popButton;
private const double transition_time = 1000; private const double transition_time = 1000;
protected virtual IEnumerable<Type> PossibleChildren => null; protected virtual IEnumerable<Type> PossibleChildren => null;
private Container textContainer; private readonly Container textContainer;
private Box box; private readonly Box box;
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2"); protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");

View File

@ -26,13 +26,13 @@ namespace osu.Game.Screens.Menu
/// </summary> /// </summary>
public class Button : Container, IStateful<ButtonState> public class Button : Container, IStateful<ButtonState>
{ {
private Container iconText; private readonly Container iconText;
private Container box; private readonly Container box;
private Box boxHoverLayer; private readonly Box boxHoverLayer;
private TextAwesome icon; private readonly TextAwesome icon;
private string internalName; private readonly string internalName;
private Action clickAction; private readonly Action clickAction;
private Key triggerKey; private readonly Key triggerKey;
private SampleChannel sampleClick; private SampleChannel sampleClick;
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos); protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
@ -132,7 +132,7 @@ namespace osu.Game.Screens.Menu
icon.ScaleTo(1, 500, EasingTypes.OutElasticHalf); icon.ScaleTo(1, 500, EasingTypes.OutElasticHalf);
double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration; const double offset = 0; //(1 - Game.Audio.SyncBeatProgress) * duration;
double startTime = Time.Current + offset; double startTime = Time.Current + offset;
icon.RotateTo(10, offset, EasingTypes.InOutSine); icon.RotateTo(10, offset, EasingTypes.InOutSine);

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Menu
private Toolbar toolbar; private Toolbar toolbar;
private FlowContainerWithOrigin buttonFlow; private readonly FlowContainerWithOrigin buttonFlow;
//todo: make these non-internal somehow. //todo: make these non-internal somehow.
internal const float BUTTON_AREA_HEIGHT = 100; internal const float BUTTON_AREA_HEIGHT = 100;
@ -41,16 +41,16 @@ namespace osu.Game.Screens.Menu
public const int EXIT_DELAY = 3000; public const int EXIT_DELAY = 3000;
private OsuLogo osuLogo; private readonly OsuLogo osuLogo;
private Drawable iconFacade; private readonly Drawable iconFacade;
private Container buttonArea; private readonly Container buttonArea;
private Box buttonAreaBackground; private readonly Box buttonAreaBackground;
private Button backButton; private readonly Button backButton;
private Button settingsButton; private readonly Button settingsButton;
private List<Button> buttonsTopLevel = new List<Button>(); private readonly List<Button> buttonsTopLevel = new List<Button>();
private List<Button> buttonsPlay = new List<Button>(); private readonly List<Button> buttonsPlay = new List<Button>();
public ButtonSystem() public ButtonSystem()
{ {

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Menu
internal class Disclaimer : OsuScreen internal class Disclaimer : OsuScreen
{ {
private Intro intro; private Intro intro;
private TextAwesome icon; private readonly TextAwesome icon;
private Color4 iconColour; private Color4 iconColour;
internal override bool ShowOverlays => false; internal override bool ShowOverlays => false;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.Menu
{ {
public class Intro : OsuScreen public class Intro : OsuScreen
{ {
private OsuLogo logo; private readonly OsuLogo logo;
/// <summary> /// <summary>
/// Whether we have loaded the menu previously. /// Whether we have loaded the menu previously.
@ -113,12 +113,12 @@ namespace osu.Game.Screens.Menu
//we also handle the exit transition. //we also handle the exit transition.
seeya.Play(); seeya.Play();
double fadeOutTime = 2000; const double fade_out_time = 2000;
Scheduler.AddDelayed(Exit, fadeOutTime); Scheduler.AddDelayed(Exit, fade_out_time);
//don't want to fade out completely else we will stop running updates and shit will hit the fan. //don't want to fade out completely else we will stop running updates and shit will hit the fan.
Game.FadeTo(0.01f, fadeOutTime); Game.FadeTo(0.01f, fade_out_time);
base.OnResuming(last); base.OnResuming(last);
} }

View File

@ -22,11 +22,11 @@ namespace osu.Game.Screens.Menu
{ {
public class MainMenu : OsuScreen public class MainMenu : OsuScreen
{ {
private ButtonSystem buttons; private readonly ButtonSystem buttons;
internal override bool ShowOverlays => buttons.State != MenuState.Initial; internal override bool ShowOverlays => buttons.State != MenuState.Initial;
private BackgroundScreen background; private readonly BackgroundScreen background;
private Screen songSelect; private Screen songSelect;
protected override BackgroundScreen CreateBackground() => background; protected override BackgroundScreen CreateBackground() => background;

View File

@ -25,22 +25,22 @@ namespace osu.Game.Screens.Menu
{ {
public Color4 OsuPink = OsuColour.FromHex(@"e967a1"); public Color4 OsuPink = OsuColour.FromHex(@"e967a1");
private Sprite logo; private readonly Sprite logo;
private CircularContainer logoContainer; private readonly CircularContainer logoContainer;
private Container logoBounceContainer; private readonly Container logoBounceContainer;
private Container logoHoverContainer; private readonly Container logoHoverContainer;
private SampleChannel sampleClick; private SampleChannel sampleClick;
private Container colourAndTriangles; private readonly Container colourAndTriangles;
public Action Action; public Action Action;
public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.78f; public float SizeForFlow => logo == null ? 0 : logo.DrawSize.X * logo.Scale.X * logoBounceContainer.Scale.X * logoHoverContainer.Scale.X * 0.78f;
private Sprite ripple; private readonly Sprite ripple;
private Container rippleContainer; private readonly Container rippleContainer;
public bool Triangles public bool Triangles
{ {
@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu
} }
public bool Interactive = true; public bool Interactive = true;
private Box flashLayer; private readonly Box flashLayer;
public OsuLogo() public OsuLogo()
{ {

View File

@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play
public class Receptor : Drawable public class Receptor : Drawable
{ {
private KeyCounterCollection target; private readonly KeyCounterCollection target;
public Receptor(KeyCounterCollection target) public Receptor(KeyCounterCollection target)
{ {

View File

@ -13,10 +13,10 @@ namespace osu.Game.Screens.Play.Pause
{ {
public class PauseProgressBar : Container public class PauseProgressBar : Container
{ {
private Color4 fillColour = new Color4(221, 255, 255, 255); private readonly Color4 fillColour = new Color4(221, 255, 255, 255);
private Color4 glowColour = new Color4(221, 255, 255, 150); private readonly Color4 glowColour = new Color4(221, 255, 255, 150);
private Container fill; private readonly Container fill;
private WorkingBeatmap current; private WorkingBeatmap current;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -42,10 +42,10 @@ namespace osu.Game.Screens.Play
public int RestartCount; public int RestartCount;
private double pauseCooldown = 1000; private const double pause_cooldown = 1000;
private double lastPauseActionTime; private double lastPauseActionTime;
private bool canPause => Time.Current >= lastPauseActionTime + pauseCooldown; private bool canPause => Time.Current >= lastPauseActionTime + pause_cooldown;
private IAdjustableClock sourceClock; private IAdjustableClock sourceClock;
private IFrameBasedClock interpolatedSourceClock; private IFrameBasedClock interpolatedSourceClock;

Some files were not shown because too many files have changed in this diff Show More