mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Enforce readonly private members where possible.
This commit is contained in:
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Backgrounds
|
||||
|
||||
private class BeatmapBackground : Background
|
||||
{
|
||||
private WorkingBeatmap beatmap;
|
||||
private readonly WorkingBeatmap beatmap;
|
||||
|
||||
public BeatmapBackground(WorkingBeatmap beatmap)
|
||||
{
|
||||
|
@ -19,14 +19,14 @@ namespace osu.Game.Screens
|
||||
{
|
||||
public class ScreenWhiteBox : OsuScreen
|
||||
{
|
||||
private BackButton popButton;
|
||||
private readonly BackButton popButton;
|
||||
|
||||
private const double transition_time = 1000;
|
||||
|
||||
protected virtual IEnumerable<Type> PossibleChildren => null;
|
||||
|
||||
private Container textContainer;
|
||||
private Box box;
|
||||
private readonly Container textContainer;
|
||||
private readonly Box box;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg2");
|
||||
|
||||
|
@ -26,13 +26,13 @@ namespace osu.Game.Screens.Menu
|
||||
/// </summary>
|
||||
public class Button : Container, IStateful<ButtonState>
|
||||
{
|
||||
private Container iconText;
|
||||
private Container box;
|
||||
private Box boxHoverLayer;
|
||||
private TextAwesome icon;
|
||||
private string internalName;
|
||||
private Action clickAction;
|
||||
private Key triggerKey;
|
||||
private readonly Container iconText;
|
||||
private readonly Container box;
|
||||
private readonly Box boxHoverLayer;
|
||||
private readonly TextAwesome icon;
|
||||
private readonly string internalName;
|
||||
private readonly Action clickAction;
|
||||
private readonly Key triggerKey;
|
||||
private SampleChannel sampleClick;
|
||||
|
||||
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||
|
@ -32,7 +32,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private Toolbar toolbar;
|
||||
|
||||
private FlowContainerWithOrigin buttonFlow;
|
||||
private readonly FlowContainerWithOrigin buttonFlow;
|
||||
|
||||
//todo: make these non-internal somehow.
|
||||
internal const float BUTTON_AREA_HEIGHT = 100;
|
||||
@ -41,16 +41,16 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public const int EXIT_DELAY = 3000;
|
||||
|
||||
private OsuLogo osuLogo;
|
||||
private Drawable iconFacade;
|
||||
private Container buttonArea;
|
||||
private Box buttonAreaBackground;
|
||||
private readonly OsuLogo osuLogo;
|
||||
private readonly Drawable iconFacade;
|
||||
private readonly Container buttonArea;
|
||||
private readonly Box buttonAreaBackground;
|
||||
|
||||
private Button backButton;
|
||||
private Button settingsButton;
|
||||
private readonly Button backButton;
|
||||
private readonly Button settingsButton;
|
||||
|
||||
private List<Button> buttonsTopLevel = new List<Button>();
|
||||
private List<Button> buttonsPlay = new List<Button>();
|
||||
private readonly List<Button> buttonsTopLevel = new List<Button>();
|
||||
private readonly List<Button> buttonsPlay = new List<Button>();
|
||||
|
||||
public ButtonSystem()
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Menu
|
||||
internal class Disclaimer : OsuScreen
|
||||
{
|
||||
private Intro intro;
|
||||
private TextAwesome icon;
|
||||
private readonly TextAwesome icon;
|
||||
private Color4 iconColour;
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class Intro : OsuScreen
|
||||
{
|
||||
private OsuLogo logo;
|
||||
private readonly OsuLogo logo;
|
||||
|
||||
/// <summary>
|
||||
/// Whether we have loaded the menu previously.
|
||||
|
@ -22,11 +22,11 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public class MainMenu : OsuScreen
|
||||
{
|
||||
private ButtonSystem buttons;
|
||||
private readonly ButtonSystem buttons;
|
||||
|
||||
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
|
||||
|
||||
private BackgroundScreen background;
|
||||
private readonly BackgroundScreen background;
|
||||
private Screen songSelect;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => background;
|
||||
|
@ -25,22 +25,22 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
public Color4 OsuPink = OsuColour.FromHex(@"e967a1");
|
||||
|
||||
private Sprite logo;
|
||||
private CircularContainer logoContainer;
|
||||
private Container logoBounceContainer;
|
||||
private Container logoHoverContainer;
|
||||
private readonly Sprite logo;
|
||||
private readonly CircularContainer logoContainer;
|
||||
private readonly Container logoBounceContainer;
|
||||
private readonly Container logoHoverContainer;
|
||||
|
||||
private SampleChannel sampleClick;
|
||||
|
||||
private Container colourAndTriangles;
|
||||
private readonly Container colourAndTriangles;
|
||||
|
||||
public Action Action;
|
||||
|
||||
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
|
||||
{
|
||||
@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
public bool Interactive = true;
|
||||
private Box flashLayer;
|
||||
private readonly Box flashLayer;
|
||||
|
||||
public OsuLogo()
|
||||
{
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public class Receptor : Drawable
|
||||
{
|
||||
private KeyCounterCollection target;
|
||||
private readonly KeyCounterCollection target;
|
||||
|
||||
public Receptor(KeyCounterCollection target)
|
||||
{
|
||||
|
@ -13,10 +13,10 @@ namespace osu.Game.Screens.Play.Pause
|
||||
{
|
||||
public class PauseProgressBar : Container
|
||||
{
|
||||
private Color4 fillColour = new Color4(221, 255, 255, 255);
|
||||
private Color4 glowColour = new Color4(221, 255, 255, 150);
|
||||
private readonly Color4 fillColour = new Color4(221, 255, 255, 255);
|
||||
private readonly Color4 glowColour = new Color4(221, 255, 255, 150);
|
||||
|
||||
private Container fill;
|
||||
private readonly Container fill;
|
||||
private WorkingBeatmap current;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public int RestartCount;
|
||||
|
||||
private double pauseCooldown = 1000;
|
||||
private readonly double pauseCooldown = 1000;
|
||||
private double lastPauseActionTime;
|
||||
|
||||
private bool canPause => Time.Current >= lastPauseActionTime + pauseCooldown;
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class PlayerInputManager : PassThroughInputManager
|
||||
{
|
||||
private ManualClock clock = new ManualClock();
|
||||
private readonly ManualClock clock = new ManualClock();
|
||||
private IFrameBasedClock parentClock;
|
||||
|
||||
private ReplayInputHandler replayInputHandler;
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Screens.Play
|
||||
public class PlayerLoader : OsuScreen
|
||||
{
|
||||
private readonly Player player;
|
||||
private OsuLogo logo;
|
||||
private readonly OsuLogo logo;
|
||||
private BeatmapMetadataDisplay info;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
@ -60,18 +60,18 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
private List<float> yPositions = new List<float>();
|
||||
private readonly List<float> yPositions = new List<float>();
|
||||
|
||||
/// <summary>
|
||||
/// Required for now unfortunately.
|
||||
/// </summary>
|
||||
private BeatmapDatabase database;
|
||||
|
||||
private Container<Panel> scrollableContent;
|
||||
private readonly Container<Panel> scrollableContent;
|
||||
|
||||
private List<BeatmapGroup> groups = new List<BeatmapGroup>();
|
||||
private readonly List<BeatmapGroup> groups = new List<BeatmapGroup>();
|
||||
|
||||
private List<Panel> panels = new List<Panel>();
|
||||
private readonly List<Panel> panels = new List<Panel>();
|
||||
|
||||
private BeatmapGroup selectedGroup;
|
||||
|
||||
|
@ -24,9 +24,9 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public Action<FilterCriteria> FilterChanged;
|
||||
|
||||
private OsuTabControl<SortMode> sortTabs;
|
||||
private readonly OsuTabControl<SortMode> sortTabs;
|
||||
|
||||
private TabControl<GroupMode> groupTabs;
|
||||
private readonly TabControl<GroupMode> groupTabs;
|
||||
|
||||
private SortMode sort = SortMode.Title;
|
||||
public SortMode Sort
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public Action Exit;
|
||||
|
||||
private SearchTextBox searchTextBox;
|
||||
private readonly SearchTextBox searchTextBox;
|
||||
|
||||
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class Footer : Container
|
||||
{
|
||||
private Box modeLight;
|
||||
private readonly Box modeLight;
|
||||
|
||||
private const float play_song_select_button_width = 100;
|
||||
private const float play_song_select_button_height = 50;
|
||||
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select
|
||||
public Action OnBack;
|
||||
public Action OnStart;
|
||||
|
||||
private FillFlowContainer buttons;
|
||||
private readonly FillFlowContainer buttons;
|
||||
|
||||
public OsuLogo StartButton;
|
||||
|
||||
|
@ -51,9 +51,9 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
private SpriteText spriteText;
|
||||
private Box box;
|
||||
private Box light;
|
||||
private readonly SpriteText spriteText;
|
||||
private readonly Box box;
|
||||
private readonly Box light;
|
||||
|
||||
public FooterButton()
|
||||
{
|
||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class DrawableRank : Container
|
||||
{
|
||||
private Sprite sprite;
|
||||
private readonly Sprite sprite;
|
||||
|
||||
public ScoreRank Rank { get; private set; }
|
||||
|
||||
|
@ -16,8 +16,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class Leaderboard : Container
|
||||
{
|
||||
private ScrollContainer scrollContainer;
|
||||
private FillFlowContainer<LeaderboardScore> scrollFlow;
|
||||
private readonly ScrollContainer scrollContainer;
|
||||
private readonly FillFlowContainer<LeaderboardScore> scrollFlow;
|
||||
|
||||
private IEnumerable<Score> scores;
|
||||
public IEnumerable<Score> Scores
|
||||
|
@ -30,14 +30,16 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
private const float background_alpha = 0.25f;
|
||||
private const float rank_width = 30;
|
||||
|
||||
private Box background;
|
||||
private Container content, avatar;
|
||||
private DrawableRank scoreRank;
|
||||
private OsuSpriteText nameLabel;
|
||||
private GlowingSpriteText scoreLabel;
|
||||
private ScoreComponentLabel maxCombo, accuracy;
|
||||
private Container flagBadgeContainer;
|
||||
private FillFlowContainer<ScoreModIcon> modsContainer;
|
||||
private readonly Box background;
|
||||
private readonly Container content;
|
||||
private readonly Container avatar;
|
||||
private readonly DrawableRank scoreRank;
|
||||
private readonly OsuSpriteText nameLabel;
|
||||
private readonly GlowingSpriteText scoreLabel;
|
||||
private readonly ScoreComponentLabel maxCombo;
|
||||
private readonly ScoreComponentLabel accuracy;
|
||||
private readonly Container flagBadgeContainer;
|
||||
private readonly FillFlowContainer<ScoreModIcon> modsContainer;
|
||||
|
||||
private Visibility state;
|
||||
public Visibility State
|
||||
|
@ -20,10 +20,12 @@ namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
private static readonly float width = 130;
|
||||
|
||||
private Box background, flash;
|
||||
private TextAwesome iconText;
|
||||
private OsuSpriteText firstLine, secondLine;
|
||||
private Container box;
|
||||
private readonly Box background;
|
||||
private readonly Box flash;
|
||||
private readonly TextAwesome iconText;
|
||||
private readonly OsuSpriteText firstLine;
|
||||
private readonly OsuSpriteText secondLine;
|
||||
private readonly Container box;
|
||||
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Screens.Select.Options
|
||||
|
||||
private const float height = 100;
|
||||
|
||||
private Box holder;
|
||||
private FillFlowContainer<BeatmapOptionsButton> buttonsContainer;
|
||||
private readonly Box holder;
|
||||
private readonly FillFlowContainer<BeatmapOptionsButton> buttonsContainer;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
|
@ -19,8 +19,8 @@ namespace osu.Game.Screens.Select
|
||||
public class PlaySongSelect : SongSelect
|
||||
{
|
||||
private OsuScreen player;
|
||||
private ModSelectOverlay modSelect;
|
||||
private Leaderboard leaderboard;
|
||||
private readonly ModSelectOverlay modSelect;
|
||||
private readonly Leaderboard leaderboard;
|
||||
|
||||
public PlaySongSelect()
|
||||
{
|
||||
|
@ -31,20 +31,19 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen
|
||||
{
|
||||
private Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
||||
private readonly Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
||||
private BeatmapDatabase database;
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
||||
private BeatmapCarousel carousel;
|
||||
private readonly BeatmapCarousel carousel;
|
||||
private TrackManager trackManager;
|
||||
private DialogOverlay dialogOverlay;
|
||||
|
||||
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||
|
||||
private const float left_area_padding = 20;
|
||||
|
||||
private BeatmapInfoWedge beatmapInfoWedge;
|
||||
private readonly BeatmapInfoWedge beatmapInfoWedge;
|
||||
|
||||
protected Container LeftContent;
|
||||
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Tournament.Components
|
||||
}
|
||||
}
|
||||
|
||||
private List<VisualiserLine> allLines = new List<VisualiserLine>();
|
||||
private readonly List<VisualiserLine> allLines = new List<VisualiserLine>();
|
||||
|
||||
private float offset;
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Screens.Tournament
|
||||
private GroupContainer groupsContainer;
|
||||
private OsuSpriteText fullTeamNameText;
|
||||
|
||||
private List<Country> allTeams = new List<Country>();
|
||||
private readonly List<Country> allTeams = new List<Country>();
|
||||
|
||||
private DrawingsConfigManager drawingsConfig;
|
||||
|
||||
|
@ -23,9 +23,9 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
public int TeamsCount { get; private set; }
|
||||
|
||||
private FlowContainer<GroupTeam> teams;
|
||||
private readonly FlowContainer<GroupTeam> teams;
|
||||
|
||||
private List<GroupTeam> allTeams = new List<GroupTeam>();
|
||||
private readonly List<GroupTeam> allTeams = new List<GroupTeam>();
|
||||
|
||||
public Group(string name)
|
||||
{
|
||||
@ -122,10 +122,10 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
private class GroupTeam : Container
|
||||
{
|
||||
public Country Team;
|
||||
public readonly Country Team;
|
||||
|
||||
private FillFlowContainer innerContainer;
|
||||
private Sprite flagSprite;
|
||||
private readonly FillFlowContainer innerContainer;
|
||||
private readonly Sprite flagSprite;
|
||||
|
||||
public GroupTeam(Country team)
|
||||
{
|
||||
|
@ -14,9 +14,9 @@ namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
public class GroupContainer : Container
|
||||
{
|
||||
private List<Group> groups = new List<Group>();
|
||||
private readonly List<Group> groups = new List<Group>();
|
||||
|
||||
private int maxTeams;
|
||||
private readonly int maxTeams;
|
||||
private int currentGroup;
|
||||
|
||||
public GroupContainer(int numGroups, int teamsPerGroup)
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
private readonly List<Country> availableTeams = new List<Country>();
|
||||
|
||||
private Container tracker;
|
||||
private readonly Container tracker;
|
||||
|
||||
private float speed;
|
||||
private int expiredCount;
|
||||
@ -328,8 +328,8 @@ namespace osu.Game.Screens.Tournament
|
||||
|
||||
public Country Team;
|
||||
|
||||
private Sprite flagSprite;
|
||||
private Box outline;
|
||||
private readonly Sprite flagSprite;
|
||||
private readonly Box outline;
|
||||
|
||||
private bool selected;
|
||||
public bool Selected
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Screens.Tournament.Teams
|
||||
{
|
||||
private const string teams_filename = "drawings.txt";
|
||||
|
||||
private Storage storage;
|
||||
private readonly Storage storage;
|
||||
|
||||
public StorageBackedTeamList(Storage storage)
|
||||
{
|
||||
|
Reference in New Issue
Block a user