1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:18:22 +08:00

Merge branch 'master' into ignore_beatmap_skin

This commit is contained in:
UselessToucan 2018-04-23 13:06:24 +03:00 committed by GitHub
commit 254e9929be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 37 additions and 23 deletions

View File

@ -21,7 +21,7 @@ namespace osu.Game.Beatmaps.Formats
return output;
}
protected abstract void ParseStreamInto(StreamReader stream, TOutput beatmap);
protected abstract void ParseStreamInto(StreamReader stream, TOutput output);
}
public abstract class Decoder

View File

@ -13,15 +13,15 @@ namespace osu.Game.Beatmaps.Formats
AddDecoder<Beatmap>("{", m => new JsonBeatmapDecoder());
}
protected override void ParseStreamInto(StreamReader stream, Beatmap beatmap)
protected override void ParseStreamInto(StreamReader stream, Beatmap output)
{
stream.BaseStream.Position = 0;
stream.DiscardBufferedData();
stream.ReadToEnd().DeserializeInto(beatmap);
stream.ReadToEnd().DeserializeInto(output);
foreach (var hitObject in beatmap.HitObjects)
hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty);
foreach (var hitObject in output.HitObjects)
hitObject.ApplyDefaults(output.ControlPointInfo, output.BeatmapInfo.BaseDifficulty);
}
}
}

View File

@ -19,7 +19,7 @@ namespace osu.Game.Beatmaps.Formats
FormatVersion = version;
}
protected override void ParseStreamInto(StreamReader stream, T beatmap)
protected override void ParseStreamInto(StreamReader stream, T output)
{
Section section = Section.None;
@ -33,14 +33,21 @@ namespace osu.Game.Beatmaps.Formats
{
if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section))
{
Logger.Log($"Unknown section \"{line}\" in {beatmap}");
Logger.Log($"Unknown section \"{line}\" in {output}");
section = Section.None;
}
continue;
}
ParseLine(beatmap, section, line);
try
{
ParseLine(output, section, line);
}
catch (Exception e)
{
Logger.Error(e, $"Failed to process line \"{line}\" into {output}");
}
}
}

View File

@ -11,7 +11,7 @@ namespace osu.Game.Online.API.Requests
public class GetMessagesRequest : APIRequest<List<Message>>
{
private readonly List<Channel> channels;
private long? since;
private readonly long? since;
public GetMessagesRequest(List<Channel> channels, long? sinceId)
{

View File

@ -7,7 +7,7 @@ namespace osu.Game.Online.API.Requests
{
public class GetUserRequest : APIRequest<User>
{
private long? userId;
private readonly long? userId;
public GetUserRequest(long? userId = null)
{

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
@ -43,6 +44,8 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
public override void Add(HitObjectMask drawable)
{
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
base.Add(drawable);
drawable.Selected += onMaskSelected;
@ -51,8 +54,10 @@ namespace osu.Game.Screens.Edit.Screens.Compose.Layers
drawable.DragRequested += onDragRequested;
}
public override bool Remove(HitObjectMask drawable)
public override bool Remove([NotNull] HitObjectMask drawable)
{
if (drawable == null) throw new ArgumentNullException(nameof(drawable));
var result = base.Remove(drawable);
if (result)

View File

@ -39,6 +39,7 @@ namespace osu.Game.Screens.Menu
private Bindable<bool> menuVoice;
private Bindable<bool> menuMusic;
private Track track;
private WorkingBeatmap beatmap;
[BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
@ -69,9 +70,8 @@ namespace osu.Game.Screens.Menu
}
}
Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
track = Beatmap.Value.Track;
beatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
track = beatmap.Track;
welcome = audio.Sample.Get(@"welcome");
seeya = audio.Sample.Get(@"seeya");
@ -81,6 +81,8 @@ namespace osu.Game.Screens.Menu
{
base.OnEntering(last);
Game.Beatmap.Value = beatmap;
if (menuVoice)
welcome.Play();

View File

@ -223,11 +223,11 @@ namespace osu.Game.Screens.Ranking
private class DateTimeDisplay : Container
{
private DateTime datetime;
private readonly DateTime date;
public DateTimeDisplay(DateTime datetime)
public DateTimeDisplay(DateTime date)
{
this.datetime = datetime;
this.date = date;
AutoSizeAxes = Axes.Y;
@ -251,7 +251,7 @@ namespace osu.Game.Screens.Ranking
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Text = datetime.ToShortDateString(),
Text = date.ToShortDateString(),
Padding = new MarginPadding { Horizontal = 10, Vertical = 5 },
Colour = Color4.White,
},
@ -259,7 +259,7 @@ namespace osu.Game.Screens.Ranking
{
Origin = Anchor.CentreRight,
Anchor = Anchor.CentreRight,
Text = datetime.ToShortTimeString(),
Text = date.ToShortTimeString(),
Padding = new MarginPadding { Horizontal = 10, Vertical = 5 },
Colour = Color4.White,
}

View File

@ -12,7 +12,7 @@ namespace osu.Game.Skinning
{
}
protected override void ParseLine(SkinConfiguration output, Section section, string line)
protected override void ParseLine(SkinConfiguration skin, Section section, string line)
{
switch (section)
{
@ -22,17 +22,17 @@ namespace osu.Game.Skinning
switch (pair.Key)
{
case @"Name":
output.SkinInfo.Name = pair.Value;
skin.SkinInfo.Name = pair.Value;
break;
case @"Author":
output.SkinInfo.Creator = pair.Value;
skin.SkinInfo.Creator = pair.Value;
break;
}
break;
}
base.ParseLine(output, section, line);
base.ParseLine(skin, section, line);
}
}
}