1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 04:07:25 +08:00

Fix up wrt upstream development

This commit is contained in:
Drew DeVault 2016-10-19 10:47:23 -04:00
parent 8e31965fb4
commit c41b3d92c6
5 changed files with 21 additions and 46 deletions

View File

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

View File

@ -1,5 +1,6 @@
using System; using System;
using SQLite.Net.Attributes; using System.Collections.Generic;
using SQLite.Net.Attributes;
using SQLiteNetExtensions.Attributes; using SQLiteNetExtensions.Attributes;
namespace osu.Game.Database namespace osu.Game.Database
@ -12,6 +13,8 @@ namespace osu.Game.Database
public BeatmapMetadata Metadata { get; set; } public BeatmapMetadata Metadata { get; set; }
[NotNull, ForeignKey(typeof(BeatmapMetadata))] [NotNull, ForeignKey(typeof(BeatmapMetadata))]
public int BeatmapMetadataID { get; set; } public int BeatmapMetadataID { get; set; }
[OneToMany]
public List<BeatmapInfo> Beatmaps { get; set; }
public string Hash { get; set; } public string Hash { get; set; }
public string Path { get; set; } public string Path { get; set; }
} }

View File

@ -12,7 +12,6 @@ using osu.Game.GameModes.Backgrounds;
using osu.Framework; using osu.Framework;
using osu.Game.Database; using osu.Game.Database;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Drawables;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK; using OpenTK;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -21,10 +20,10 @@ namespace osu.Game.GameModes.Play
{ {
class BeatmapButton : AutoSizeContainer class BeatmapButton : AutoSizeContainer
{ {
private BeatmapSet beatmapSet; private BeatmapSetInfo beatmapSet;
private Beatmap beatmap; private BeatmapInfo beatmap;
public BeatmapButton(BeatmapSet set, Beatmap beatmap) public BeatmapButton(BeatmapSetInfo set, BeatmapInfo beatmap)
{ {
this.beatmapSet = set; this.beatmapSet = set;
this.beatmap = beatmap; this.beatmap = beatmap;

View File

@ -7,10 +7,10 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using OpenTK; using OpenTK;
using System.Linq; using System.Linq;
using osu.Framework.Graphics.Drawables;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -21,9 +21,9 @@ namespace osu.Game.GameModes.Play
{ {
private const float collapsedAlpha = 0.3f; private const float collapsedAlpha = 0.3f;
public event Action<BeatmapSet> SetSelected; public event Action<BeatmapSetInfo> SetSelected;
public event Action<BeatmapSet, Beatmap> BeatmapSelected; public event Action<BeatmapSetInfo, BeatmapInfo> BeatmapSelected;
public BeatmapSet BeatmapSet; public BeatmapSetInfo BeatmapSet;
private FlowContainer topContainer; private FlowContainer topContainer;
private FlowContainer difficulties; private FlowContainer difficulties;
private bool collapsed; private bool collapsed;
@ -51,7 +51,7 @@ namespace osu.Game.GameModes.Play
} }
} }
public BeatmapGroup(BeatmapSet beatmapSet) public BeatmapGroup(BeatmapSetInfo beatmapSet)
{ {
BeatmapSet = beatmapSet; BeatmapSet = beatmapSet;
Alpha = collapsedAlpha; Alpha = collapsedAlpha;
@ -89,9 +89,9 @@ namespace osu.Game.GameModes.Play
class BeatmapSetBox : AutoSizeContainer class BeatmapSetBox : AutoSizeContainer
{ {
private BeatmapSet beatmapSet; private BeatmapSetInfo beatmapSet;
public BeatmapSetBox(BeatmapSet beatmapSet) public BeatmapSetBox(BeatmapSetInfo beatmapSet)
{ {
this.beatmapSet = beatmapSet; this.beatmapSet = beatmapSet;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;

View File

@ -12,7 +12,6 @@ using osu.Game.GameModes.Backgrounds;
using osu.Framework; using osu.Framework;
using osu.Game.Database; using osu.Game.Database;
using osu.Framework.Graphics.Primitives; using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Drawables;
using System.Linq; using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
@ -23,7 +22,7 @@ namespace osu.Game.GameModes.Play
{ {
private Bindable<PlayMode> playMode; private Bindable<PlayMode> playMode;
private BeatmapDatabase beatmaps; private BeatmapDatabase beatmaps;
private BeatmapSet selectedBeatmapSet; private BeatmapSetInfo selectedBeatmapSet;
// TODO: use currently selected track as bg // TODO: use currently selected track as bg
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
@ -31,7 +30,7 @@ namespace osu.Game.GameModes.Play
private ScrollContainer scrollContainer; private ScrollContainer scrollContainer;
private FlowContainer setList; private FlowContainer setList;
private void selectBeatmapSet(BeatmapSet beatmapSet) private void selectBeatmapSet(BeatmapSetInfo beatmapSet)
{ {
selectedBeatmapSet = beatmapSet; selectedBeatmapSet = beatmapSet;
foreach (var child in setList.Children) foreach (var child in setList.Children)
@ -41,7 +40,7 @@ namespace osu.Game.GameModes.Play
} }
} }
private void addBeatmapSet(BeatmapSet beatmapSet) private void addBeatmapSet(BeatmapSetInfo beatmapSet)
{ {
var group = new BeatmapGroup(beatmapSet); var group = new BeatmapGroup(beatmapSet);
group.SetSelected += (selectedSet) => selectBeatmapSet(selectedSet); group.SetSelected += (selectedSet) => selectBeatmapSet(selectedSet);
@ -50,11 +49,7 @@ namespace osu.Game.GameModes.Play
private void addBeatmapSets() private void addBeatmapSets()
{ {
var sets = beatmaps.GetBeatmapSets(); foreach (var beatmapSet in beatmaps.Query<BeatmapSetInfo>())
if (sets.Length == 0) return;
foreach (var beatmapSet in sets)
addBeatmapSet(beatmapSet); addBeatmapSet(beatmapSet);
} }
@ -64,13 +59,13 @@ namespace osu.Game.GameModes.Play
const float backgroundSlant = 25; const float backgroundSlant = 25;
Children = new Drawable[] Children = new Drawable[]
{ {
new BackgroundBox(backgroundSlant) new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = new Vector2(backgroundWidth, 0.5f), Size = new Vector2(backgroundWidth, 0.5f),
Colour = new Color4(0, 0, 0, 0.5f), Colour = new Color4(0, 0, 0, 0.5f),
}, },
new BackgroundBox(-backgroundSlant) new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
RelativePositionAxes = Axes.Y, RelativePositionAxes = Axes.Y,
@ -133,27 +128,5 @@ namespace osu.Game.GameModes.Play
private void PlayMode_ValueChanged(object sender, EventArgs e) private void PlayMode_ValueChanged(object sender, EventArgs e)
{ {
} }
class BackgroundBox : Box
{
private float wedgeWidth;
public BackgroundBox(float wedgeWidth)
{
this.wedgeWidth = wedgeWidth;
}
protected override Quad DrawQuad
{
get
{
Quad q = base.DrawQuad;
q.TopRight.X += wedgeWidth;
q.BottomRight.X -= wedgeWidth;
return q;
}
}
}
} }
} }