mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 08:27:23 +08:00
Formatting
This commit is contained in:
parent
0a96aaf575
commit
c981a4a511
@ -3,12 +3,9 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using osu.Game.Overlays.Direct;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
@ -41,7 +38,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
var ruleset = rulesets.GetRuleset(0);
|
||||
|
||||
direct.BeatmapSets = new BeatmapSetInfo[]
|
||||
direct.BeatmapSets = new[]
|
||||
{
|
||||
new BeatmapSetInfo
|
||||
{
|
||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Database
|
||||
{
|
||||
internal class OnlineWorkingBeatmap : WorkingBeatmap
|
||||
{
|
||||
private TextureStore textures;
|
||||
private TrackManager tracks;
|
||||
private readonly TextureStore textures;
|
||||
private readonly TrackManager tracks;
|
||||
|
||||
public OnlineWorkingBeatmap(BeatmapInfo beatmapInfo, TextureStore textures, TrackManager tracks) : base(beatmapInfo)
|
||||
{
|
||||
|
@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class DirectGridPanel : DirectPanel
|
||||
{
|
||||
private readonly float horizontal_padding = 10;
|
||||
private readonly float vertical_padding = 5;
|
||||
private const float horizontal_padding = 10;
|
||||
private const float vertical_padding = 5;
|
||||
|
||||
private FillFlowContainer bottomPanel;
|
||||
|
||||
@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Direct
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
|
@ -21,9 +21,9 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class DirectListPanel : DirectPanel
|
||||
{
|
||||
private readonly float horizontal_padding = 10;
|
||||
private readonly float vertical_padding = 5;
|
||||
private readonly float height = 70;
|
||||
private const float horizontal_padding = 10;
|
||||
private const float vertical_padding = 5;
|
||||
private const float height = 70;
|
||||
|
||||
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
||||
{
|
||||
@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Direct
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LocalisationEngine localisation, TextureStore textures)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Direct
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Margin = new MarginPadding { Right = (height - vertical_padding * 2) + vertical_padding },
|
||||
Margin = new MarginPadding { Right = height - vertical_padding * 2 + vertical_padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0)
|
||||
@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Size = new Vector2(height - (vertical_padding * 2)),
|
||||
Size = new Vector2(height - vertical_padding * 2),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
protected readonly BeatmapSetInfo SetInfo;
|
||||
|
||||
public DirectPanel(BeatmapSetInfo setInfo)
|
||||
protected DirectPanel(BeatmapSetInfo setInfo)
|
||||
{
|
||||
SetInfo = setInfo;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Direct
|
||||
public FilterControl()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 35 + 32 + 30 + (padding * 2); // search + mode toggle buttons + sort tabs + padding
|
||||
Height = 35 + 32 + 30 + padding * 2; // search + mode toggle buttons + sort tabs + padding
|
||||
DisplayStyle.Value = PanelDisplayStyle.Grid;
|
||||
|
||||
Children = new Drawable[]
|
||||
@ -170,9 +170,9 @@ namespace osu.Game.Overlays.Direct
|
||||
resultCountsContainer.FadeTo(ResultCounts == null ? 0 : 1, 200, EasingTypes.Out);
|
||||
if (resultCounts == null) return;
|
||||
|
||||
resultCountsText.Text = pluralize(@"Artist", ResultCounts.Artists) + ", " +
|
||||
pluralize(@"Song", ResultCounts.Songs) + ", " +
|
||||
pluralize(@"Tag", ResultCounts.Tags);
|
||||
resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " +
|
||||
pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " +
|
||||
pluralize(@"Tag", ResultCounts?.Tags ?? 0);
|
||||
}
|
||||
|
||||
private string pluralize(string prefix, int value)
|
||||
@ -196,7 +196,7 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
private class RulesetToggleButton : ClickableContainer
|
||||
{
|
||||
private TextAwesome icon;
|
||||
private readonly TextAwesome icon;
|
||||
|
||||
private RulesetInfo ruleset;
|
||||
public RulesetInfo Ruleset
|
||||
@ -209,11 +209,11 @@ namespace osu.Game.Overlays.Direct
|
||||
}
|
||||
}
|
||||
|
||||
private Bindable<RulesetInfo> bindable;
|
||||
private readonly Bindable<RulesetInfo> bindable;
|
||||
|
||||
void Bindable_ValueChanged(RulesetInfo obj)
|
||||
private void Bindable_ValueChanged(RulesetInfo obj)
|
||||
{
|
||||
icon.FadeTo((Ruleset.ID == obj?.ID) ? 1f : 0.5f, 100);
|
||||
icon.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100);
|
||||
}
|
||||
|
||||
public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset)
|
||||
@ -280,7 +280,7 @@ namespace osu.Game.Overlays.Direct
|
||||
icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
bindable.ValueChanged -= Bindable_ValueChanged;
|
||||
}
|
||||
@ -347,9 +347,9 @@ namespace osu.Game.Overlays.Direct
|
||||
MyMaps,
|
||||
}
|
||||
|
||||
public enum PanelDisplayStyle
|
||||
{
|
||||
public enum PanelDisplayStyle
|
||||
{
|
||||
Grid,
|
||||
List,
|
||||
List,
|
||||
}
|
||||
}
|
||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
private class SortTabItem : TabItem<SortCriteria>
|
||||
{
|
||||
private readonly float transition_duration = 100;
|
||||
private const float transition_duration = 100;
|
||||
|
||||
private Box box;
|
||||
private readonly Box box;
|
||||
|
||||
public override bool Active
|
||||
{
|
||||
|
@ -17,10 +17,8 @@ namespace osu.Game.Overlays
|
||||
public class DirectOverlay : WaveOverlayContainer
|
||||
{
|
||||
public static readonly int WIDTH_PADDING = 80;
|
||||
private readonly float panel_padding = 10f;
|
||||
private const float panel_padding = 10f;
|
||||
|
||||
private readonly Box background;
|
||||
private readonly Header header;
|
||||
private readonly FilterControl filter;
|
||||
private readonly FillFlowContainer<DirectPanel> panels;
|
||||
|
||||
@ -30,7 +28,7 @@ namespace osu.Game.Overlays
|
||||
get { return beatmapSets; }
|
||||
set
|
||||
{
|
||||
if (beatmapSets == value) return;
|
||||
if (value == beatmapSets) return;
|
||||
beatmapSets = value;
|
||||
|
||||
recreatePanels(filter.DisplayStyle.Value);
|
||||
@ -54,9 +52,10 @@ namespace osu.Game.Overlays
|
||||
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
|
||||
Header header = null;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"485e74"),
|
||||
@ -111,10 +110,10 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
};
|
||||
|
||||
header.Tabs.Current.ValueChanged += (tab) => { if (tab != DirectTab.Search) filter.Search.Current.Value = @""; };
|
||||
header.Tabs.Current.ValueChanged += tab => { if (tab != DirectTab.Search) filter.Search.Current.Value = @""; };
|
||||
|
||||
filter.Search.Exit = Hide;
|
||||
filter.Search.Current.ValueChanged += (s) => { if (s != @"") header.Tabs.Current.Value = DirectTab.Search; };
|
||||
filter.Search.Current.ValueChanged += text => { if (text != @"") header.Tabs.Current.Value = DirectTab.Search; };
|
||||
filter.DisplayStyle.ValueChanged += recreatePanels;
|
||||
}
|
||||
|
||||
@ -123,8 +122,8 @@ namespace osu.Game.Overlays
|
||||
var p = new List<DirectPanel>();
|
||||
|
||||
foreach (BeatmapSetInfo b in BeatmapSets)
|
||||
p.Add(displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)(new DirectGridPanel(b) { Width = 400 }) :
|
||||
(DirectPanel)(new DirectListPanel(b)));
|
||||
p.Add(displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } :
|
||||
new DirectListPanel(b));
|
||||
|
||||
panels.Children = p;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user