mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12:57 +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>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// 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.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Dialog;
|
using osu.Game.Overlays.Dialog;
|
||||||
@ -14,14 +17,52 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
public override string Description => @"osu!direct overlay";
|
public override string Description => @"osu!direct overlay";
|
||||||
|
|
||||||
private DirectOverlay direct;
|
private DirectOverlay direct;
|
||||||
|
private RulesetDatabase rulesets;
|
||||||
|
|
||||||
public override void Reset()
|
public override void Reset()
|
||||||
{
|
{
|
||||||
base.Reset();
|
base.Reset();
|
||||||
|
|
||||||
Add(direct = new DirectOverlay());
|
Add(direct = new DirectOverlay());
|
||||||
|
newBeatmaps();
|
||||||
|
|
||||||
AddStep(@"Toggle", direct.ToggleVisibility);
|
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
|
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 Box tabStrip;
|
||||||
private readonly FillFlowContainer<ModeToggleButton> modeButtons;
|
private readonly FillFlowContainer<ModeToggleButton> modeButtons;
|
||||||
private FillFlowContainer resultCounts;
|
private FillFlowContainer resultCounts;
|
||||||
|
@ -20,13 +20,15 @@ namespace osu.Game.Overlays.Direct
|
|||||||
{
|
{
|
||||||
public class Header : Container
|
public class Header : Container
|
||||||
{
|
{
|
||||||
|
public static readonly float HEIGHT = 90;
|
||||||
|
|
||||||
private readonly Box tabStrip;
|
private readonly Box tabStrip;
|
||||||
|
|
||||||
public readonly OsuTabControl<DirectTab> Tabs;
|
public readonly OsuTabControl<DirectTab> Tabs;
|
||||||
|
|
||||||
public Header()
|
public Header()
|
||||||
{
|
{
|
||||||
Height = 90;
|
Height = HEIGHT;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using OpenTK;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -16,9 +17,24 @@ 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 readonly Box background;
|
private readonly Box background;
|
||||||
private readonly FilterControl filter;
|
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()
|
public DirectOverlay()
|
||||||
{
|
{
|
||||||
@ -53,67 +69,44 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new ScrollContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Both,
|
||||||
RelativeSizeAxes = Axes.X,
|
ScrollDraggerVisible = false,
|
||||||
|
Padding = new MarginPadding { Top = Header.HEIGHT },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Header
|
new FillFlowContainer
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
},
|
|
||||||
filter = new FilterControl
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
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;
|
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()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
base.PopIn();
|
base.PopIn();
|
||||||
|
Loading…
Reference in New Issue
Block a user