mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 00:43:22 +08:00
Added displaying sets
This commit is contained in:
parent
c3fb1ab7c6
commit
c2880676db
@ -1,8 +1,11 @@
|
||||
// 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.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;
|
||||
@ -14,14 +17,52 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
public override string Description => @"osu!direct overlay";
|
||||
|
||||
private DirectOverlay direct;
|
||||
private RulesetDatabase rulesets;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Add(direct = new DirectOverlay());
|
||||
newBeatmaps();
|
||||
|
||||
AddStep(@"Toggle", direct.ToggleVisibility);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetDatabase rulesets)
|
||||
{
|
||||
this.rulesets = rulesets;
|
||||
}
|
||||
|
||||
private void newBeatmaps()
|
||||
{
|
||||
var setInfo = new BeatmapSetInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Platina",
|
||||
Artist = @"Maaya Sakamoto",
|
||||
Author = @"TicClick",
|
||||
Source = @"Cardcaptor Sakura",
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>(),
|
||||
};
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
setInfo.Beatmaps.Add(new BeatmapInfo
|
||||
{
|
||||
Ruleset = rulesets.GetRuleset(i),
|
||||
StarDifficulty = i + 1,
|
||||
});
|
||||
}
|
||||
|
||||
var s = new List<BeatmapSetInfo>();
|
||||
for (int i = 0; i < 10; i++)
|
||||
s.Add(setInfo);
|
||||
|
||||
direct.BeatmapSets = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,11 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class FilterControl : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// The height of the content below the filter control (tab strip + result count text).
|
||||
/// </summary>
|
||||
public static readonly float LOWER_HEIGHT = 21;
|
||||
|
||||
private readonly Box tabStrip;
|
||||
private readonly FillFlowContainer<ModeToggleButton> modeButtons;
|
||||
private FillFlowContainer resultCounts;
|
||||
|
@ -20,13 +20,15 @@ namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
public class Header : Container
|
||||
{
|
||||
public static readonly float HEIGHT = 90;
|
||||
|
||||
private readonly Box tabStrip;
|
||||
|
||||
public readonly OsuTabControl<DirectTab> Tabs;
|
||||
|
||||
public Header()
|
||||
{
|
||||
Height = 90;
|
||||
Height = HEIGHT;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -16,9 +17,24 @@ namespace osu.Game.Overlays
|
||||
public class DirectOverlay : WaveOverlayContainer
|
||||
{
|
||||
public static readonly int WIDTH_PADDING = 80;
|
||||
private readonly float panel_padding = 10f;
|
||||
|
||||
private readonly Box background;
|
||||
private readonly FilterControl filter;
|
||||
private readonly FillFlowContainer<DirectPanel> panels;
|
||||
|
||||
public IEnumerable<BeatmapSetInfo> BeatmapSets
|
||||
{
|
||||
set
|
||||
{
|
||||
var p = new List<DirectPanel>();
|
||||
|
||||
foreach (BeatmapSetInfo b in value)
|
||||
p.Add(new DirectGridPanel(b) { Width = 407 });
|
||||
|
||||
panels.Children = p;
|
||||
}
|
||||
}
|
||||
|
||||
public DirectOverlay()
|
||||
{
|
||||
@ -53,67 +69,44 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
new ScrollContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollDraggerVisible = false,
|
||||
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Header
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
filter = new FilterControl
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
filter = new FilterControl
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
panels = new FillFlowContainer<DirectPanel>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Top = FilterControl.LOWER_HEIGHT + panel_padding, Bottom = panel_padding, Left = WIDTH_PADDING, Right = WIDTH_PADDING },
|
||||
Spacing = new Vector2(panel_padding),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new Header
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
};
|
||||
|
||||
filter.Search.Exit = Hide;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(RulesetDatabase rulesets)
|
||||
{
|
||||
var setInfo = new BeatmapSetInfo
|
||||
{
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
Title = @"Platina",
|
||||
Artist = @"Maaya Sakamoto",
|
||||
Author = @"TicClick",
|
||||
Source = @"Cardcaptor Sakura",
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>(),
|
||||
};
|
||||
|
||||
for (int i = 0; i< 4; i++)
|
||||
{
|
||||
setInfo.Beatmaps.Add(new BeatmapInfo {
|
||||
Ruleset = rulesets.GetRuleset(i),
|
||||
StarDifficulty = i + 1,
|
||||
});
|
||||
}
|
||||
|
||||
Add(new Drawable[]
|
||||
{
|
||||
new DirectGridPanel(setInfo)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Width = 300,
|
||||
},
|
||||
new DirectListPanel(setInfo)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Width = 0.8f,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
Loading…
Reference in New Issue
Block a user