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

@ -19,8 +19,8 @@ namespace osu.Game.Screens
return other?.GetType() == GetType();
}
const float transition_length = 500;
const float x_movement_amount = 50;
private const float transition_length = 500;
private const float x_movement_amount = 50;
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
@ -28,7 +28,7 @@ namespace osu.Game.Screens
return false;
}
Framework.Game game;
private Framework.Game game;
[BackgroundDependencyLoader]
private void load(Framework.Game game)
@ -58,7 +58,7 @@ namespace osu.Game.Screens
protected override void Update()
{
base.Update();
Content.Scale = new Vector2(1 + (x_movement_amount / DrawSize.X) * 2);
Content.Scale = new Vector2(1 + x_movement_amount / DrawSize.X * 2);
}
protected override void OnEntering(Screen last)

View File

@ -68,10 +68,13 @@ namespace osu.Game.Screens.Backgrounds
public override bool Equals(BackgroundScreen other)
{
return base.Equals(other) && beatmap == ((BackgroundScreenBeatmap)other).Beatmap;
var otherBeatmapBackground = (BackgroundScreenBeatmap)other;
if (otherBeatmapBackground == null) return false;
return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap;
}
class BeatmapBackground : Background
private class BeatmapBackground : Background
{
private WorkingBeatmap beatmap;

View File

@ -17,7 +17,10 @@ namespace osu.Game.Screens.Backgrounds
public override bool Equals(BackgroundScreen other)
{
return base.Equals(other) && textureName == ((BackgroundScreenCustom)other).textureName;
var backgroundScreenCustom = (BackgroundScreenCustom)other;
if (backgroundScreenCustom == null) return false;
return base.Equals(other) && textureName == backgroundScreenCustom.textureName;
}
}
}

View File

@ -3,7 +3,7 @@
namespace osu.Game.Screens.Charts
{
class ChartInfo : ScreenWhiteBox
internal class ChartInfo : ScreenWhiteBox
{
}
}

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace osu.Game.Screens.Charts
{
class ChartListing : ScreenWhiteBox
internal class ChartListing : ScreenWhiteBox
{
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(ChartInfo)

View File

@ -3,7 +3,7 @@
namespace osu.Game.Screens.Direct
{
class OnlineListing : ScreenWhiteBox
internal class OnlineListing : ScreenWhiteBox
{
}
}

View File

@ -7,7 +7,7 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Edit
{
class Editor : ScreenWhiteBox
internal class Editor : ScreenWhiteBox
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");

View File

@ -21,7 +21,7 @@ namespace osu.Game.Screens
{
private BackButton popButton;
const int transition_time = 1000;
private const int transition_time = 1000;
protected virtual IEnumerable<Type> PossibleChildren => null;
@ -56,7 +56,7 @@ namespace osu.Game.Screens
protected override bool OnExiting(Screen next)
{
textContainer.MoveTo(new Vector2((DrawSize.X / 16), 0), transition_time, EasingTypes.OutExpo);
textContainer.MoveTo(new Vector2(DrawSize.X / 16, 0), transition_time, EasingTypes.OutExpo);
Content.FadeOut(transition_time, EasingTypes.OutExpo);
return base.OnExiting(next);

View File

@ -7,7 +7,7 @@ using osu.Game.Screens.Menu;
namespace osu.Game.Screens
{
class Loader : OsuScreen
internal class Loader : OsuScreen
{
internal override bool ShowOverlays => false;

View File

@ -292,7 +292,7 @@ namespace osu.Game.Screens.Menu
public int ContractStyle;
ButtonState state;
private ButtonState state;
public ButtonState State
{

View File

@ -49,8 +49,8 @@ namespace osu.Game.Screens.Menu
private Button backButton;
private Button settingsButton;
List<Button> buttonsTopLevel = new List<Button>();
List<Button> buttonsPlay = new List<Button>();
private List<Button> buttonsTopLevel = new List<Button>();
private List<Button> buttonsPlay = new List<Button>();
public ButtonSystem()
{
@ -187,7 +187,7 @@ namespace osu.Game.Screens.Menu
}
}
MenuState state;
private MenuState state;
public override bool HandleInput => state != MenuState.Exit;

View File

@ -13,7 +13,7 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Menu
{
class Disclaimer : OsuScreen
internal class Disclaimer : OsuScreen
{
private Intro intro;
private TextAwesome icon;

View File

@ -23,7 +23,7 @@ namespace osu.Game.Screens.Menu
/// </summary>
internal bool DidLoadMenu;
MainMenu mainMenu;
private MainMenu mainMenu;
private SampleChannel welcome;
private SampleChannel seeya;
private Track bgm;

View File

@ -141,7 +141,7 @@ namespace osu.Game.Screens.Menu
Origin = Anchor.Centre,
Children = new Drawable[]
{
ripple = new Sprite()
ripple = new Sprite
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace osu.Game.Screens.Multiplayer
{
class Lobby : ScreenWhiteBox
internal class Lobby : ScreenWhiteBox
{
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(MatchCreate),

View File

@ -11,7 +11,7 @@ using osu.Game.Screens.Select;
namespace osu.Game.Screens.Multiplayer
{
class Match : ScreenWhiteBox
internal class Match : ScreenWhiteBox
{
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(MatchSongSelect),

View File

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace osu.Game.Screens.Multiplayer
{
class MatchCreate : ScreenWhiteBox
internal class MatchCreate : ScreenWhiteBox
{
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(Match)

View File

@ -10,7 +10,7 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Play
{
class FailDialog : OsuScreen
internal class FailDialog : OsuScreen
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);

View File

@ -49,7 +49,7 @@ namespace osu.Game.Screens.Play
}
}
private int fadeTime = 0;
private int fadeTime;
public int FadeTime
{
get { return fadeTime; }

View File

@ -58,7 +58,7 @@ namespace osu.Game.Screens.Play
},
new OsuSpriteText
{
Text = $" time{((value == 1) ? "" : "s")} in this session",
Text = $" time{(value == 1 ? "" : "s")} in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18

View File

@ -39,21 +39,14 @@ namespace osu.Game.Screens.Play
public PlayMode PreferredPlayMode;
private bool isPaused;
public bool IsPaused
{
get
{
return isPaused;
}
}
public bool IsPaused { get; private set; }
public int RestartCount;
private double pauseCooldown = 1000;
private double lastPauseActionTime = 0;
private double lastPauseActionTime;
private bool canPause => Time.Current >= (lastPauseActionTime + pauseCooldown);
private bool canPause => Time.Current >= lastPauseActionTime + pauseCooldown;
private IAdjustableClock sourceClock;
@ -198,11 +191,11 @@ namespace osu.Game.Screens.Play
pauseOverlay.Retries = RestartCount;
pauseOverlay.Show();
sourceClock.Stop();
isPaused = true;
IsPaused = true;
}
else
{
isPaused = false;
IsPaused = false;
}
}
@ -212,12 +205,12 @@ namespace osu.Game.Screens.Play
scoreOverlay.KeyCounter.IsCounting = true;
pauseOverlay.Hide();
sourceClock.Start();
isPaused = false;
IsPaused = false;
}
public void TogglePaused()
{
isPaused = !IsPaused;
IsPaused = !IsPaused;
if (IsPaused) Pause(); else Resume();
}
@ -327,6 +320,6 @@ namespace osu.Game.Screens.Play
private Bindable<bool> mouseWheelDisabled;
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !isPaused;
protected override bool OnWheel(InputState state) => mouseWheelDisabled.Value && !IsPaused;
}
}

View File

@ -10,11 +10,11 @@ using System.Linq;
namespace osu.Game.Screens.Play
{
class PlayerInputManager : UserInputManager
internal class PlayerInputManager : UserInputManager
{
bool leftViaKeyboard;
bool rightViaKeyboard;
Bindable<bool> mouseDisabled;
private bool leftViaKeyboard;
private bool rightViaKeyboard;
private Bindable<bool> mouseDisabled;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config)

View File

@ -95,9 +95,9 @@ namespace osu.Game.Screens.Play
return base.OnExiting(next);
}
class BeatmapMetadataDisplay : Container
private class BeatmapMetadataDisplay : Container
{
class MetadataLine : Container
private class MetadataLine : Container
{
public MetadataLine(string left, string right)
{
@ -131,7 +131,7 @@ namespace osu.Game.Screens.Play
AutoSizeAxes = Axes.Both;
Children = new Drawable[]
{
new FillFlowContainer()
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Origin = Anchor.TopCentre,

View File

@ -13,13 +13,13 @@ using OpenTK.Graphics;
namespace osu.Game.Screens.Ranking
{
class Results : OsuScreen
internal class Results : OsuScreen
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
private static readonly Vector2 background_blur = new Vector2(20);
ScoreDisplay scoreDisplay;
private ScoreDisplay scoreDisplay;
protected override void OnEntering(Screen last)
{
@ -57,7 +57,7 @@ namespace osu.Game.Screens.Ranking
}
}
class ScoreDisplay : Container
internal class ScoreDisplay : Container
{
public ScoreDisplay(Score s)
{

View File

@ -1,6 +1,7 @@
// 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.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Database;
@ -21,9 +22,11 @@ namespace osu.Game.Screens.Select
public BeatmapDeleteDialog(WorkingBeatmap beatmap)
{
if (beatmap == null) throw new ArgumentNullException(nameof(beatmap));
Icon = FontAwesome.fa_trash_o;
HeaderText = @"Confirm deletion of";
BodyText = $@"{beatmap?.Beatmap?.Metadata?.Artist} - {beatmap?.Beatmap?.Metadata?.Title}";
BodyText = $@"{beatmap.Beatmap?.Metadata?.Artist} - {beatmap.Beatmap?.Metadata?.Title}";
Buttons = new PopupDialogButton[]
{
new PopupDialogOkButton

View File

@ -24,7 +24,7 @@ using osu.Game.Modes;
namespace osu.Game.Screens.Select
{
class BeatmapInfoWedge : Container
internal class BeatmapInfoWedge : Container
{
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select
public void UpdateBeatmap(WorkingBeatmap beatmap)
{
if (beatmap == null)
if (beatmap?.BeatmapInfo == null)
return;
var lastContainer = beatmapInfoContainer;

View File

@ -18,7 +18,7 @@ using System.Diagnostics;
namespace osu.Game.Screens.Select
{
class CarouselContainer : ScrollContainer, IEnumerable<BeatmapGroup>
internal class CarouselContainer : ScrollContainer, IEnumerable<BeatmapGroup>
{
private Container<Panel> scrollableContent;
private List<BeatmapGroup> groups = new List<BeatmapGroup>();
@ -354,7 +354,7 @@ namespace osu.Game.Screens.Select
public void SelectRandom()
{
List<BeatmapGroup> visibleGroups = this.groups.Where((BeatmapGroup selectGroup) => selectGroup.State != BeatmapGroupState.Hidden).ToList();
List<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden).ToList();
if (visibleGroups.Count < 1)
return;
BeatmapGroup group = visibleGroups[RNG.Next(visibleGroups.Count)];

View File

@ -8,7 +8,7 @@ using osu.Game.Screens.Edit;
namespace osu.Game.Screens.Select
{
class EditSongSelect : ScreenWhiteBox
internal class EditSongSelect : ScreenWhiteBox
{
protected override IEnumerable<Type> PossibleChildren => new[] {
typeof(Editor)

View File

@ -5,7 +5,7 @@ using osu.Game.Screens.Backgrounds;
namespace osu.Game.Screens.Select
{
class MatchSongSelect : ScreenWhiteBox
internal class MatchSongSelect : ScreenWhiteBox
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
}

View File

@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select.Options
};
}
class ButtonFlow : FillFlowContainer<BeatmapOptionsButton>
private class ButtonFlow : FillFlowContainer<BeatmapOptionsButton>
{
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
protected override IEnumerable<BeatmapOptionsButton> FlowingChildren => base.FlowingChildren.Reverse();

View File

@ -59,7 +59,7 @@ namespace osu.Game.Screens.Select
private BeatmapOptionsOverlay beatmapOptions;
private Footer footer;
OsuScreen player;
private OsuScreen player;
private FilterControl filter;
public FilterControl Filter

View File

@ -12,7 +12,7 @@ using System.Linq;
namespace osu.Game.Screens.Tournament.Components
{
class VisualiserContainer : Container
internal class VisualiserContainer : Container
{
/// <summary>
/// Number of lines in the visualiser.
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Tournament.Components
private void addLine()
{
VisualiserLine newLine = new VisualiserLine()
VisualiserLine newLine = new VisualiserLine
{
RelativeSizeAxes = Axes.Both,
@ -59,7 +59,7 @@ namespace osu.Game.Screens.Tournament.Components
allLines.Remove(allLines.First());
}
class VisualiserLine : Container
private class VisualiserLine : Container
{
/// <summary>
/// Time offset.
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Tournament.Components
private Texture texture;
private int expiredCount = 0;
private int expiredCount;
[BackgroundDependencyLoader]
private void load(TextureStore textures)
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Tournament.Components
private void addLine()
{
Add(new Sprite()
Add(new Sprite
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,

View File

@ -120,7 +120,7 @@ namespace osu.Game.Screens.Tournament
return sb.ToString();
}
class GroupTeam : Container
private class GroupTeam : Container
{
public Team Team;

View File

@ -296,7 +296,7 @@ namespace osu.Game.Screens.Tournament
TransformFloatTo(speed, value, duration, easing, new TransformScrollSpeed());
}
enum ScrollState
private enum ScrollState
{
None,
Idle,

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Tournament.Teams
{
while (sr.Peek() != -1)
{
string line = sr.ReadLine().Trim();
string line = sr.ReadLine()?.Trim();
if (string.IsNullOrEmpty(line))
continue;
@ -52,7 +52,7 @@ namespace osu.Game.Screens.Tournament.Teams
string acronym = split.Length >= 3 ? split[2].Trim() : teamName;
acronym = acronym.Substring(0, Math.Min(3, acronym.Length));
teams.Add(new Team()
teams.Add(new Team
{
FlagName = flagName,
FullName = teamName,