mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Formatting
This commit is contained in:
@ -3,12 +3,9 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Dialog;
|
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
@ -41,7 +38,7 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
{
|
{
|
||||||
var ruleset = rulesets.GetRuleset(0);
|
var ruleset = rulesets.GetRuleset(0);
|
||||||
|
|
||||||
direct.BeatmapSets = new BeatmapSetInfo[]
|
direct.BeatmapSets = new[]
|
||||||
{
|
{
|
||||||
new BeatmapSetInfo
|
new BeatmapSetInfo
|
||||||
{
|
{
|
||||||
|
@ -10,8 +10,8 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
internal class OnlineWorkingBeatmap : WorkingBeatmap
|
internal class OnlineWorkingBeatmap : WorkingBeatmap
|
||||||
{
|
{
|
||||||
private TextureStore textures;
|
private readonly TextureStore textures;
|
||||||
private TrackManager tracks;
|
private readonly TrackManager tracks;
|
||||||
|
|
||||||
public OnlineWorkingBeatmap(BeatmapInfo beatmapInfo, TextureStore textures, TrackManager tracks) : base(beatmapInfo)
|
public OnlineWorkingBeatmap(BeatmapInfo beatmapInfo, TextureStore textures, TrackManager tracks) : base(beatmapInfo)
|
||||||
{
|
{
|
||||||
|
@ -19,8 +19,8 @@ namespace osu.Game.Overlays.Direct
|
|||||||
{
|
{
|
||||||
public class DirectGridPanel : DirectPanel
|
public class DirectGridPanel : DirectPanel
|
||||||
{
|
{
|
||||||
private readonly float horizontal_padding = 10;
|
private const float horizontal_padding = 10;
|
||||||
private readonly float vertical_padding = 5;
|
private const float vertical_padding = 5;
|
||||||
|
|
||||||
private FillFlowContainer bottomPanel;
|
private FillFlowContainer bottomPanel;
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
private void load(OsuColour colours, LocalisationEngine localisation, TextureStore textures)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
|
@ -21,9 +21,9 @@ namespace osu.Game.Overlays.Direct
|
|||||||
{
|
{
|
||||||
public class DirectListPanel : DirectPanel
|
public class DirectListPanel : DirectPanel
|
||||||
{
|
{
|
||||||
private readonly float horizontal_padding = 10;
|
private const float horizontal_padding = 10;
|
||||||
private readonly float vertical_padding = 5;
|
private const float vertical_padding = 5;
|
||||||
private readonly float height = 70;
|
private const float height = 70;
|
||||||
|
|
||||||
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
||||||
{
|
{
|
||||||
@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation, TextureStore textures)
|
private void load(LocalisationEngine localisation, TextureStore textures)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
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[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0)
|
new Statistic(FontAwesome.fa_play_circle, SetInfo.Beatmaps.FirstOrDefault()?.OnlineInfo.PlayCount ?? 0)
|
||||||
@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = 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;
|
protected readonly BeatmapSetInfo SetInfo;
|
||||||
|
|
||||||
public DirectPanel(BeatmapSetInfo setInfo)
|
protected DirectPanel(BeatmapSetInfo setInfo)
|
||||||
{
|
{
|
||||||
SetInfo = setInfo;
|
SetInfo = setInfo;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
public FilterControl()
|
public FilterControl()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
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;
|
DisplayStyle.Value = PanelDisplayStyle.Grid;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -170,9 +170,9 @@ namespace osu.Game.Overlays.Direct
|
|||||||
resultCountsContainer.FadeTo(ResultCounts == null ? 0 : 1, 200, EasingTypes.Out);
|
resultCountsContainer.FadeTo(ResultCounts == null ? 0 : 1, 200, EasingTypes.Out);
|
||||||
if (resultCounts == null) return;
|
if (resultCounts == null) return;
|
||||||
|
|
||||||
resultCountsText.Text = pluralize(@"Artist", ResultCounts.Artists) + ", " +
|
resultCountsText.Text = pluralize(@"Artist", ResultCounts?.Artists ?? 0) + ", " +
|
||||||
pluralize(@"Song", ResultCounts.Songs) + ", " +
|
pluralize(@"Song", ResultCounts?.Songs ?? 0) + ", " +
|
||||||
pluralize(@"Tag", ResultCounts.Tags);
|
pluralize(@"Tag", ResultCounts?.Tags ?? 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string pluralize(string prefix, int value)
|
private string pluralize(string prefix, int value)
|
||||||
@ -196,7 +196,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
private class RulesetToggleButton : ClickableContainer
|
private class RulesetToggleButton : ClickableContainer
|
||||||
{
|
{
|
||||||
private TextAwesome icon;
|
private readonly TextAwesome icon;
|
||||||
|
|
||||||
private RulesetInfo ruleset;
|
private RulesetInfo ruleset;
|
||||||
public 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)
|
public RulesetToggleButton(Bindable<RulesetInfo> bindable, RulesetInfo ruleset)
|
||||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
private class SortTabItem : TabItem<SortCriteria>
|
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
|
public override bool Active
|
||||||
{
|
{
|
||||||
|
@ -17,10 +17,8 @@ namespace osu.Game.Overlays
|
|||||||
public class DirectOverlay : WaveOverlayContainer
|
public class DirectOverlay : WaveOverlayContainer
|
||||||
{
|
{
|
||||||
public static readonly int WIDTH_PADDING = 80;
|
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 FilterControl filter;
|
||||||
private readonly FillFlowContainer<DirectPanel> panels;
|
private readonly FillFlowContainer<DirectPanel> panels;
|
||||||
|
|
||||||
@ -30,7 +28,7 @@ namespace osu.Game.Overlays
|
|||||||
get { return beatmapSets; }
|
get { return beatmapSets; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (beatmapSets == value) return;
|
if (value == beatmapSets) return;
|
||||||
beatmapSets = value;
|
beatmapSets = value;
|
||||||
|
|
||||||
recreatePanels(filter.DisplayStyle.Value);
|
recreatePanels(filter.DisplayStyle.Value);
|
||||||
@ -54,9 +52,10 @@ namespace osu.Game.Overlays
|
|||||||
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||||
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||||
|
|
||||||
|
Header header = null;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.FromHex(@"485e74"),
|
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.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;
|
filter.DisplayStyle.ValueChanged += recreatePanels;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,8 +122,8 @@ namespace osu.Game.Overlays
|
|||||||
var p = new List<DirectPanel>();
|
var p = new List<DirectPanel>();
|
||||||
|
|
||||||
foreach (BeatmapSetInfo b in BeatmapSets)
|
foreach (BeatmapSetInfo b in BeatmapSets)
|
||||||
p.Add(displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)(new DirectGridPanel(b) { Width = 400 }) :
|
p.Add(displayStyle == PanelDisplayStyle.Grid ? (DirectPanel)new DirectGridPanel(b) { Width = 400 } :
|
||||||
(DirectPanel)(new DirectListPanel(b)));
|
new DirectListPanel(b));
|
||||||
|
|
||||||
panels.Children = p;
|
panels.Children = p;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user