Fix additional bugs, tweak L+F

This commit is contained in:
Drew DeVault 2016-10-19 14:02:03 -04:00
parent 8d4a211419
commit 6da092ab30
4 changed files with 45 additions and 23 deletions

View File

@ -56,13 +56,13 @@ namespace osu.Game.Database
var beatmapSet = new BeatmapSetInfo
{
BeatmapSetID = metadata.BeatmapSetID,
Beatmaps = new List<BeatmapInfo>(),
Path = path,
Hash = hash,
};
beatmapSet.Metadata = metadata;
connection.Insert(beatmapSet);
connection.Insert(metadata);
var maps = new List<BeatmapInfo>();
beatmapSet.Metadata = metadata;
connection.Insert(beatmapSet);
using (var reader = ArchiveReader.GetReader(storage, path))
{
string[] mapNames = reader.ReadBeatmaps();
@ -73,9 +73,10 @@ namespace osu.Game.Database
var decoder = BeatmapDecoder.GetDecoder(stream);
Beatmap beatmap = decoder.Decode(stream);
beatmap.BeatmapInfo.Path = name;
beatmap.BeatmapInfo.BeatmapSetID = beatmapSet.BeatmapSetID;
// TODO: Diff beatmap metadata with set metadata and leave it here if necessary
beatmap.BeatmapInfo.Metadata = null;
maps.Add(beatmap.BeatmapInfo);
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
connection.Insert(beatmap.BeatmapInfo);
}
}

View File

@ -11,7 +11,7 @@ namespace osu.Game.Database
{
[PrimaryKey]
public int BeatmapID { get; set; }
[ForeignKey(typeof(BeatmapSetInfo)), NotNull]
[ForeignKey(typeof(BeatmapSetInfo))]
public int BeatmapSetID { get; set; }
[ManyToOne]
public BeatmapSetInfo BeatmapSet { get; set; }

View File

@ -24,6 +24,7 @@ namespace osu.Game.GameModes.Play
public event Action<BeatmapSetInfo> SetSelected;
public event Action<BeatmapSetInfo, BeatmapInfo> BeatmapSelected;
public BeatmapSetInfo BeatmapSet;
private BeatmapSetBox setBox;
private FlowContainer topContainer;
private FlowContainer difficulties;
private bool collapsed;
@ -48,6 +49,11 @@ namespace osu.Game.GameModes.Play
topContainer.Remove(difficulties);
else
topContainer.Add(difficulties);
setBox.BorderColour = new Color4(
setBox.BorderColour.R,
setBox.BorderColour.G,
setBox.BorderColour.B,
collapsed ? 0 : 255);
}
}
@ -64,7 +70,7 @@ namespace osu.Game.GameModes.Play
RelativeSizeAxes = Axes.X,
Size = new Vector2(1, 0),
Direction = FlowDirection.VerticalOnly,
Children = new[] { new BeatmapSetBox(beatmapSet) }
Children = new[] { setBox = new BeatmapSetBox(beatmapSet) }
}
};
difficulties = new FlowContainer // Deliberately not added to children
@ -96,6 +102,10 @@ namespace osu.Game.GameModes.Play
this.beatmapSet = beatmapSet;
RelativeSizeAxes = Axes.X;
Size = new Vector2(1, 0);
Masking = true;
CornerRadius = 5;
BorderThickness = 2;
BorderColour = new Color4(221, 255, 255, 0);
Children = new Drawable[]
{
new Box

View File

@ -56,30 +56,41 @@ namespace osu.Game.GameModes.Play
public PlaySongSelect()
{
const float backgroundWidth = 0.6f;
const float backgroundSlant = 25;
const float scrollWidth = 500;
Children = new Drawable[]
{
new Box
new Container
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(backgroundWidth, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f),
},
new Box
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Y,
Size = new Vector2(backgroundWidth, 0.5f),
Position = new Vector2(0, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f),
Size = new Vector2(1),
Padding = new MarginPadding { Right = scrollWidth - 100 },
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(0.15f, 0),
},
new Box
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Position = new Vector2(0, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f),
// TODO: Figure out the inverse shear problem
//Shear = new Vector2(-0.15f, 0),
},
}
},
scrollContainer = new ScrollContainer
{
RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Both,
Size = new Vector2(0.5f, 1),
Position = new Vector2(0.5f, 0),
RelativeSizeAxes = Axes.Y,
Size = new Vector2(scrollWidth, 1),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Children = new Drawable[]
{
setList = new FlowContainer