Merge pull request #132 from peppy/general-fixes

General fixes & framework update.
This commit is contained in:
Dean Herbert
2016-11-05 18:20:45 +09:00
committed by GitHub
12 changed files with 36 additions and 30 deletions

View File

@ -46,13 +46,10 @@ namespace osu.Desktop.VisualTests.Tests
Add(new Player Add(new Player
{ {
Beatmap = new WorkingBeatmap Beatmap = new WorkingBeatmap(new Beatmap
{ {
Beatmap = new Beatmap HitObjects = objects
{ })
HitObjects = objects
}
}
}); });
} }

View File

@ -153,7 +153,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Additive = true, BlendingMode = BlendingMode.Additive,
Alpha = 0.5f, Alpha = 0.5f,
} }
}; };
@ -203,7 +203,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Additive = true; BlendingMode = BlendingMode.Additive;
Alpha = 0; Alpha = 0;
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
@ -225,7 +225,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Additive = true; BlendingMode = BlendingMode.Additive;
Alpha = 0; Alpha = 0;
Children = new Framework.Graphics.Drawable[] Children = new Framework.Graphics.Drawable[]
@ -296,7 +296,7 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
}, },
triangles = new Triangles triangles = new Triangles
{ {
Additive = true, BlendingMode = BlendingMode.Additive,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
}; };

View File

@ -13,6 +13,11 @@ namespace osu.Game.Beatmaps.Timing
{ {
public double BeatLength; public double BeatLength;
public TimingChange(double beatLength)
{
BeatLength = beatLength;
}
public double BPM => 60000 / BeatLength; public double BPM => 60000 / BeatLength;
} }
} }

View File

@ -12,9 +12,12 @@ namespace osu.Game.Beatmaps
{ {
public class WorkingBeatmap : IDisposable public class WorkingBeatmap : IDisposable
{ {
public BeatmapInfo BeatmapInfo; public readonly BeatmapInfo BeatmapInfo;
public readonly ArchiveReader Reader; public readonly BeatmapSetInfo BeatmapSetInfo;
private readonly BeatmapDatabase database;
private ArchiveReader reader => database.GetReader(BeatmapSetInfo);
private Beatmap beatmap; private Beatmap beatmap;
public Beatmap Beatmap public Beatmap Beatmap
@ -25,7 +28,7 @@ namespace osu.Game.Beatmaps
try try
{ {
using (var stream = new StreamReader(Reader.ReadFile(BeatmapInfo.Path))) using (var stream = new StreamReader(reader.ReadFile(BeatmapInfo.Path)))
beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream); beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream);
} }
catch { } catch { }
@ -44,7 +47,7 @@ namespace osu.Game.Beatmaps
try try
{ {
var trackData = Reader.ReadFile(BeatmapInfo.Metadata.AudioFile); var trackData = reader.ReadFile(BeatmapInfo.Metadata.AudioFile);
if (trackData != null) if (trackData != null)
track = new AudioTrackBass(trackData); track = new AudioTrackBass(trackData);
} }
@ -55,10 +58,16 @@ namespace osu.Game.Beatmaps
set { track = value; } set { track = value; }
} }
public WorkingBeatmap(BeatmapInfo beatmapInfo = null, ArchiveReader reader = null) public WorkingBeatmap(Beatmap beatmap)
{
this.beatmap = beatmap;
}
public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database)
{ {
this.BeatmapInfo = beatmapInfo; this.BeatmapInfo = beatmapInfo;
Reader = reader; this.BeatmapSetInfo = beatmapSetInfo;
this.database = database;
} }
private bool isDisposed; private bool isDisposed;
@ -68,7 +77,7 @@ namespace osu.Game.Beatmaps
if (!isDisposed) if (!isDisposed)
{ {
track?.Dispose(); track?.Dispose();
Reader?.Dispose(); reader?.Dispose();
isDisposed = true; isDisposed = true;
} }
} }

View File

@ -149,12 +149,10 @@ namespace osu.Game.Database
if (beatmapSetInfo == null) if (beatmapSetInfo == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database."); throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database.");
var reader = GetReader(beatmapSetInfo);
if (beatmapInfo.Metadata == null) if (beatmapInfo.Metadata == null)
beatmapInfo.Metadata = beatmapSetInfo.Metadata; beatmapInfo.Metadata = beatmapSetInfo.Metadata;
var working = new WorkingBeatmap(beatmapInfo, reader); var working = new WorkingBeatmap(beatmapInfo, beatmapSetInfo, this);
previous?.TransferTo(working); previous?.TransferTo(working);

View File

@ -91,7 +91,7 @@ namespace osu.Game.GameModes
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = getColourFor(GetType()), Colour = getColourFor(GetType()),
Alpha = 1, Alpha = 1,
Additive = false BlendingMode = BlendingMode.Additive,
}, },
textContainer = new Container textContainer = new Container
{ {

View File

@ -35,7 +35,7 @@ namespace osu.Game.GameModes.Menu
logo = new OsuLogo() logo = new OsuLogo()
{ {
Alpha = 0, Alpha = 0,
Additive = true, BlendingMode = BlendingMode.Additive,
Interactive = false, Interactive = false,
Colour = Color4.DarkGray, Colour = Color4.DarkGray,
Ripple = false Ripple = false

View File

@ -83,7 +83,7 @@ namespace osu.Game.GameModes.Menu
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Additive = true, BlendingMode = BlendingMode.Additive,
Alpha = 0.05f Alpha = 0.05f
} }
} }
@ -93,7 +93,7 @@ namespace osu.Game.GameModes.Menu
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = logo.Size, Size = logo.Size,
Additive = true, BlendingMode = BlendingMode.Additive,
Alpha = 0.2f, Alpha = 0.2f,
} }
} }

View File

@ -10,7 +10,6 @@ using OpenTK.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework; using osu.Framework;
using System.Threading.Tasks; using System.Threading.Tasks;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Graphics.Background namespace osu.Game.Graphics.Background
{ {
@ -27,8 +26,6 @@ namespace osu.Game.Graphics.Background
Depth = float.MinValue; Depth = float.MinValue;
} }
Texture texture;
protected override void Load(BaseGame game) protected override void Load(BaseGame game)
{ {
base.Load(game); base.Load(game);

View File

@ -44,7 +44,7 @@ namespace osu.Game.Overlays
new ScrollContainer new ScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ScrollDraggerOnLeft = true, ScrollDraggerAnchor = Anchor.TopLeft,
Children = new[] Children = new[]
{ {
new FlowContainer new FlowContainer

View File

@ -66,7 +66,7 @@ namespace osu.Game.Overlays
HoverBackground = new Box HoverBackground = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Additive = true, BlendingMode = BlendingMode.Additive,
Colour = new Color4(60, 60, 60, 255), Colour = new Color4(60, 60, 60, 255),
Alpha = 0, Alpha = 0,
}, },