Merge branch 'master' of github.com:ppy/osu into peppy/hitcircle-revision-2

# Conflicts:
#	osu.Desktop.VisualTests/Tests/TestCasePlayer.cs
#	osu.Game/Beatmaps/Objects/Osu/Drawable/DrawableCircle.cs
This commit is contained in:
Thomas Müller
2016-11-05 13:35:15 +01:00
23 changed files with 144 additions and 66 deletions

View File

@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps.Drawable
header.State = PanelSelectedState.Selected;
break;
case BeatmapGroupState.Collapsed:
FadeTo(0.5f, 250);
FadeTo(0.8f, 250);
header.State = PanelSelectedState.NotSelected;
difficulties.Hide();
@ -61,7 +61,7 @@ namespace osu.Game.Beatmaps.Drawable
}
}
public BeatmapGroup(BeatmapSetInfo beatmapSet)
public BeatmapGroup(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
{
this.beatmapSet = beatmapSet;
@ -78,7 +78,7 @@ namespace osu.Game.Beatmaps.Drawable
Direction = FlowDirection.VerticalOnly,
Children = new Framework.Graphics.Drawable[]
{
header = new BeatmapSetHeader(beatmapSet)
header = new BeatmapSetHeader(beatmapSet, working)
{
GainedSelection = headerGainedSelection,
RelativeSizeAxes = Axes.X,

View File

@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Drawable
public BeatmapPanel(BeatmapInfo beatmap)
{
Beatmap = beatmap;
Height *= 0.75f;
Height *= 0.60f;
Children = new Framework.Graphics.Drawable[]
{
@ -44,12 +44,20 @@ namespace osu.Game.Beatmaps.Drawable
Padding = new MarginPadding(5),
Direction = FlowDirection.HorizontalOnly,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Framework.Graphics.Drawable[]
{
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255)),
new DifficultyIcon(FontAwesome.dot_circle_o, new Color4(159, 198, 0, 255))
{
Scale = new Vector2(1.8f),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new FlowContainer
{
Padding = new MarginPadding { Left = 10 },
Padding = new MarginPadding { Left = 5 },
Spacing = new Vector2(0, 5),
Direction = FlowDirection.VerticalOnly,
AutoSizeAxes = Axes.Both,
Children = new Framework.Graphics.Drawable[]
@ -58,17 +66,32 @@ namespace osu.Game.Beatmaps.Drawable
{
Direction = FlowDirection.HorizontalOnly,
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(4, 0),
Children = new[]
{
new SpriteText
{
Font = @"Exo2.0-Medium",
Text = beatmap.Version,
TextSize = 20,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new SpriteText
{
Text = $" mapped by {(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
Font = @"Exo2.0-Medium",
Text = "mapped by",
TextSize = 16,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
new SpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
TextSize = 16,
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft
},
}
},

View File

@ -31,27 +31,18 @@ namespace osu.Game.Beatmaps.Drawable
Width = 0.8f;
}
public BeatmapSetHeader(BeatmapSetInfo beatmapSet)
public BeatmapSetHeader(BeatmapSetInfo beatmapSet, WorkingBeatmap working)
{
Children = new Framework.Graphics.Drawable[]
{
new Box
working.Background == null ? new Box{ RelativeSizeAxes = Axes.Both, Colour = new Color4(20, 20, 20, 255) } : new Sprite
{
Colour = new Color4(85, 85, 85, 255),
RelativeSizeAxes = Axes.Both,
},
new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Framework.Graphics.Drawable[]
{
new Box // TODO: Gradient
{
Colour = new Color4(0, 0, 0, 100),
RelativeSizeAxes = Axes.Both,
}
}
},
Texture = working.Background,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.5f),
Colour = new Color4(200, 200, 200, 255),
},
new FlowContainer
{
Direction = FlowDirection.VerticalOnly,
@ -60,14 +51,15 @@ namespace osu.Game.Beatmaps.Drawable
AutoSizeAxes = Axes.Both,
Children = new[]
{
// TODO: Make these italic
new SpriteText
{
Font = @"Exo2.0-SemiBoldItalic",
Text = beatmapSet.Metadata.Title ?? beatmapSet.Metadata.TitleUnicode,
TextSize = 20
TextSize = 22
},
new SpriteText
{
Font = @"Exo2.0-MediumItalic",
Text = beatmapSet.Metadata.Artist ?? beatmapSet.Metadata.ArtistUnicode,
TextSize = 16
},

View File

@ -10,6 +10,7 @@ using osu.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawable
@ -69,7 +70,13 @@ namespace osu.Game.Beatmaps.Drawable
BorderColour = new Color4(BorderColour.R, BorderColour.G, BorderColour.B, 0);
BorderThickness = 0;
EdgeEffect = new EdgeEffect { Type = EdgeEffectType.None };
EdgeEffect = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Offset = new Vector2(1),
Radius = 10,
Colour = new Color4(0, 0, 0, 100),
};
}
protected override bool OnClick(InputState state)

View File

@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.IO.Stores;
using osu.Framework.Platform;
using osu.Game.Database;
namespace osu.Game.Beatmaps.IO
{
public abstract class ArchiveReader : IDisposable
public abstract class ArchiveReader : IDisposable, IResourceStore<byte[]>
{
private class Reader
{
@ -42,8 +43,23 @@ namespace osu.Game.Beatmaps.IO
/// <summary>
/// Opens a stream for reading a specific file from this archive.
/// </summary>
public abstract Stream ReadFile(string name);
public abstract Stream GetStream(string name);
public abstract void Dispose();
public virtual byte[] Get(string name)
{
using (Stream input = GetStream(name))
{
if (input == null)
return null;
using (MemoryStream ms = new MemoryStream())
{
input.CopyTo(ms);
return ms.ToArray();
}
}
}
}
}

View File

@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.IO
.Select(e => e.FileName).ToArray();
if (beatmaps.Length == 0)
throw new FileNotFoundException(@"This directory contains no beatmaps");
using (var stream = new StreamReader(ReadFile(beatmaps[0])))
using (var stream = new StreamReader(GetStream(beatmaps[0])))
{
var decoder = BeatmapDecoder.GetDecoder(stream);
firstMap = decoder.Decode(stream);
@ -45,7 +45,7 @@ namespace osu.Game.Beatmaps.IO
return beatmaps;
}
public override Stream ReadFile(string name)
public override Stream GetStream(string name)
{
ZipEntry entry = archive.Entries.SingleOrDefault(e => e.FileName == name);
if (entry == null)

View File

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

View File

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

View File

@ -4,6 +4,7 @@
using System;
using System.IO;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps.Formats;
using osu.Game.Beatmaps.IO;
using osu.Game.Database;
@ -12,9 +13,30 @@ namespace osu.Game.Beatmaps
{
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 Texture background;
public Texture Background
{
get
{
if (background != null) return background;
try
{
background = new TextureStore(new RawTextureLoaderStore(reader)).Get(BeatmapInfo.Metadata.BackgroundFile);
}
catch { }
return background;
}
set { background = value; }
}
private Beatmap beatmap;
public Beatmap Beatmap
@ -25,7 +47,7 @@ namespace osu.Game.Beatmaps
try
{
using (var stream = new StreamReader(Reader.ReadFile(BeatmapInfo.Path)))
using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path)))
beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream);
}
catch { }
@ -44,7 +66,7 @@ namespace osu.Game.Beatmaps
try
{
var trackData = Reader.ReadFile(BeatmapInfo.Metadata.AudioFile);
var trackData = reader.GetStream(BeatmapInfo.Metadata.AudioFile);
if (trackData != null)
track = new AudioTrackBass(trackData);
}
@ -55,10 +77,16 @@ namespace osu.Game.Beatmaps
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;
Reader = reader;
this.BeatmapSetInfo = beatmapSetInfo;
this.database = database;
}
private bool isDisposed;
@ -68,7 +96,7 @@ namespace osu.Game.Beatmaps
if (!isDisposed)
{
track?.Dispose();
Reader?.Dispose();
reader?.Dispose();
isDisposed = true;
}
}