1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-19 09:07:18 +08:00

Merge pull request #258 from peppy/general-fixes

General improvements.
This commit is contained in:
Thomas Müller 2016-12-18 10:48:26 +01:00 committed by GitHub
commit 705afb9080
4 changed files with 27 additions and 11 deletions

View File

@ -6,6 +6,7 @@ using System.Collections.Generic;
using System.Linq;
using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Transformations;
using osu.Game.Database;
namespace osu.Game.Beatmaps.Drawables
@ -19,12 +20,16 @@ namespace osu.Game.Beatmaps.Drawables
/// </summary>
public Action<BeatmapGroup, BeatmapInfo> SelectionChanged;
/// <summary>
/// Fires when one of our difficulties is clicked when already selected. Should start playing the map.
/// </summary>
public Action<BeatmapInfo> StartRequested;
public BeatmapSetHeader Header;
private BeatmapGroupState state;
public List<BeatmapPanel> BeatmapPanels;
private WorkingBeatmap beatmap;
public BeatmapGroupState State
{
@ -48,7 +53,7 @@ namespace osu.Game.Beatmaps.Drawables
SelectedPanel.State = PanelSelectedState.NotSelected;
foreach (BeatmapPanel panel in BeatmapPanels)
panel.FadeOut(250);
panel.FadeOut(300, EasingTypes.OutQuint);
break;
}
}
@ -56,8 +61,6 @@ namespace osu.Game.Beatmaps.Drawables
public BeatmapGroup(WorkingBeatmap beatmap, BeatmapSetInfo set = null)
{
this.beatmap = beatmap;
Header = new BeatmapSetHeader(beatmap)
{
GainedSelection = headerGainedSelection,
@ -68,6 +71,7 @@ namespace osu.Game.Beatmaps.Drawables
{
Alpha = 0,
GainedSelection = panelGainedSelection,
StartRequested = p => { StartRequested?.Invoke(p.Beatmap); },
RelativeSizeAxes = Axes.X,
}).ToList();
}

View File

@ -16,7 +16,8 @@ using osu.Game.Graphics.Backgrounds;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Input;
namespace osu.Game.Beatmaps.Drawables
{
class BeatmapPanel : Panel
@ -25,6 +26,7 @@ namespace osu.Game.Beatmaps.Drawables
private Sprite background;
public Action<BeatmapPanel> GainedSelection;
public Action<BeatmapPanel> StartRequested;
Color4 deselectedColour = new Color4(20, 43, 51, 255);
@ -45,6 +47,14 @@ namespace osu.Game.Beatmaps.Drawables
background.Colour = deselectedColour;
}
protected override bool OnClick(InputState state)
{
if (State == PanelSelectedState.Selected)
StartRequested?.Invoke(this);
return base.OnClick(state);
}
public BeatmapPanel(BeatmapInfo beatmap)
{
Beatmap = beatmap;

View File

@ -61,6 +61,7 @@ namespace osu.Game.Screens.Select
(beatmapInfoContainer = new BufferedContainer
{
Depth = newDepth,
PixelSnapping = true,
CacheDrawnFrameBuffer = true,
Shear = -Shear,
RelativeSizeAxes = Axes.Both,

View File

@ -213,11 +213,8 @@ namespace osu.Game.Screens.Select
Content.FadeInFromZero(250);
beatmapInfoWedge.MoveTo(wedged_container_start_position + new Vector2(-100, 50));
beatmapInfoWedge.RotateTo(10);
beatmapInfoWedge.MoveTo(wedged_container_start_position, 800, EasingTypes.OutQuint);
beatmapInfoWedge.RotateTo(0, 800, EasingTypes.OutQuint);
beatmapInfoWedge.MoveToX(wedged_container_start_position.X - 50);
beatmapInfoWedge.MoveToX(wedged_container_start_position.X, 800, EasingTypes.OutQuint);
}
protected override void OnResuming(GameMode last)
@ -351,7 +348,11 @@ namespace osu.Game.Screens.Select
var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);
var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged };
var group = new BeatmapGroup(beatmap)
{
SelectionChanged = selectionChanged,
StartRequested = b => start()
};
//for the time being, let's completely load the difficulty panels in the background.
//this likely won't scale so well, but allows us to completely async the loading flow.