1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 09:02:55 +08:00

No footer in EditSongSelect.

This commit is contained in:
Huo Yaoyuan 2017-03-14 21:51:26 +08:00
parent 259d39c6ad
commit f068f7c4bd
5 changed files with 89 additions and 74 deletions

View File

@ -8,6 +8,7 @@ namespace osu.Game.Screens.Select
{ {
internal class EditSongSelect : SongSelect internal class EditSongSelect : SongSelect
{ {
public EditSongSelect() : base(false) { }
protected override void OnSelected(WorkingBeatmap beatmap) => Push(new Editor(beatmap)); protected override void OnSelected(WorkingBeatmap beatmap) => Push(new Editor(beatmap));
} }
} }

View File

@ -126,16 +126,5 @@ namespace osu.Game.Screens.Select
updateModeLight(); updateModeLight();
} }
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{
if (!args.Repeat && args.Key == Key.Enter)
{
OnStart?.Invoke();
return true;
}
return base.OnKeyDown(state, args);
}
} }
} }

View File

@ -7,6 +7,7 @@ namespace osu.Game.Screens.Select
{ {
internal class MatchSongSelect : SongSelect internal class MatchSongSelect : SongSelect
{ {
public MatchSongSelect() : base(true) { }
protected override void OnSelected(WorkingBeatmap beatmap) => Exit(); protected override void OnSelected(WorkingBeatmap beatmap) => Exit();
} }
} }

View File

@ -18,8 +18,7 @@ namespace osu.Game.Screens.Select
private OsuScreen player; private OsuScreen player;
private ModSelectOverlay modSelect; private ModSelectOverlay modSelect;
[BackgroundDependencyLoader] public PlaySongSelect() : base(true)
private void load(OsuColour colours)
{ {
Add(modSelect = new ModSelectOverlay Add(modSelect = new ModSelectOverlay
{ {
@ -28,7 +27,11 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Margin = new MarginPadding { Bottom = 50 } Margin = new MarginPadding { Bottom = 50 }
}); });
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue); Footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility, Key.F1, float.MaxValue);
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);

View File

@ -53,7 +53,13 @@ namespace osu.Game.Screens.Select
private List<BeatmapGroup> beatmapGroups; private List<BeatmapGroup> beatmapGroups;
/// <summary>
/// Can be null if hasFooter:false in constructor
/// </summary>
protected BeatmapOptionsOverlay BeatmapOptions { get; private set; } protected BeatmapOptionsOverlay BeatmapOptions { get; private set; }
/// <summary>
/// Can be null if hasFooter:false in constructor
/// </summary>
protected Footer Footer { get; private set; } protected Footer Footer { get; private set; }
private FilterControl filter; private FilterControl filter;
@ -73,83 +79,80 @@ namespace osu.Game.Screens.Select
} }
} }
[BackgroundDependencyLoader(permitNulls: true)] protected SongSelect(bool hasFooter)
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
OsuGame osu, OsuColour colours)
{ {
const float carousel_width = 640; const float carousel_width = 640;
const float filter_height = 100; const float filter_height = 100;
beatmapGroups = new List<BeatmapGroup>(); beatmapGroups = new List<BeatmapGroup>();
Children = new Drawable[] Add(new ParallaxContainer
{ {
new ParallaxContainer Padding = new MarginPadding { Top = filter_height },
ParallaxAmount = 0.005f,
RelativeSizeAxes = Axes.Both,
Children = new[]
{ {
Padding = new MarginPadding { Top = filter_height }, new WedgeBackground
ParallaxAmount = 0.005f,
RelativeSizeAxes = Axes.Both,
Children = new[]
{ {
new WedgeBackground RelativeSizeAxes = Axes.Both,
{ Padding = new MarginPadding { Right = carousel_width * 0.76f },
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding
{
Right = carousel_width * 0.76f
},
},
} }
}, }
carousel = new CarouselContainer });
Add(carousel = new CarouselContainer
{
RelativeSizeAxes = Axes.Y,
Size = new Vector2(carousel_width, 1),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
});
Add(filter = new FilterControl
{
RelativeSizeAxes = Axes.X,
Height = filter_height,
FilterChanged = () => filterChanged(),
Exit = Exit,
});
Add(beatmapInfoWedge = new BeatmapInfoWedge
{
Alpha = 0,
Size = wedged_container_size,
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding
{ {
RelativeSizeAxes = Axes.Y, Top = 20,
Size = new Vector2(carousel_width, 1), Right = 20,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
}, },
filter = new FilterControl X = -50,
{ });
RelativeSizeAxes = Axes.X, if (hasFooter)
Height = filter_height, {
FilterChanged = () => filterChanged(), Add(BeatmapOptions = new BeatmapOptionsOverlay
Exit = Exit,
},
beatmapInfoWedge = new BeatmapInfoWedge
{
Alpha = 0,
Size = wedged_container_size,
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding
{
Top = 20,
Right = 20,
},
X = -50,
},
BeatmapOptions = new BeatmapOptionsOverlay
{ {
Margin = new MarginPadding Margin = new MarginPadding
{ {
Bottom = 50, Bottom = 50,
}, },
}, });
Footer = new Footer Add(Footer = new Footer
{ {
OnBack = Exit, OnBack = Exit,
OnStart = () => OnStart = raiseSelect,
{ });
if (Beatmap == null) return; }
}
Beatmap.PreferredPlayMode = playMode.Value; [BackgroundDependencyLoader(permitNulls: true)]
OnSelected(Beatmap); private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
} OsuGame osu, OsuColour colours)
}, {
}; if (Footer != null)
{
Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2);
Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);
Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2); BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3); }
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
if (osu != null) if (osu != null)
playMode.BindTo(osu.PlayMode); playMode.BindTo(osu.PlayMode);
@ -172,6 +175,14 @@ namespace osu.Game.Screens.Select
Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token); Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
} }
private void raiseSelect()
{
if (Beatmap == null) return;
Beatmap.PreferredPlayMode = playMode.Value;
OnSelected(Beatmap);
}
public void SelectRandom() => carousel.SelectRandom(); public void SelectRandom() => carousel.SelectRandom();
protected abstract void OnSelected(WorkingBeatmap beatmap); protected abstract void OnSelected(WorkingBeatmap beatmap);
@ -364,7 +375,7 @@ namespace osu.Game.Screens.Select
var group = new BeatmapGroup(beatmapSet, database) var group = new BeatmapGroup(beatmapSet, database)
{ {
SelectionChanged = selectionChanged, SelectionChanged = selectionChanged,
StartRequested = b => Footer.StartButton.TriggerClick() StartRequested = b => raiseSelect()
}; };
//for the time being, let's completely load the difficulty panels in the background. //for the time being, let's completely load the difficulty panels in the background.
@ -417,10 +428,20 @@ namespace osu.Game.Screens.Select
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
{ {
if (!args.Repeat && args.Key == Key.Delete && state.Keyboard.ShiftPressed) if (args.Repeat) return false;
switch (args.Key)
{ {
promptDelete(); case Key.Enter:
return true; raiseSelect();
return true;
case Key.Delete:
if (state.Keyboard.ShiftPressed)
{
promptDelete();
return true;
}
break;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);