1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 20:07:29 +08:00

Merge branch 'master' into tidy-osu-game

This commit is contained in:
Dan Balasescu 2019-05-14 16:52:56 +09:00 committed by GitHub
commit d040fe9635
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 113 additions and 7 deletions

View File

@ -0,0 +1,56 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.IO;
using NUnit.Framework;
using osu.Game.Beatmaps.Formats;
using osu.Game.Tests.Resources;
namespace osu.Game.Tests.Beatmaps.Formats
{
[TestFixture]
public class LegacyDecoderTest
{
[Test]
public void TestDecodeComments()
{
var decoder = new LineLoggingDecoder(14);
using (var resStream = TestResources.OpenResource("comments.osu"))
using (var stream = new StreamReader(resStream))
{
decoder.Decode(stream);
Assert.That(decoder.ParsedLines, Has.None.EqualTo("// Combo1: 0, 0, 0"));
Assert.That(decoder.ParsedLines, Has.None.EqualTo("//Combo2: 0, 0, 0"));
Assert.That(decoder.ParsedLines, Has.None.EqualTo(" // Combo3: 0, 0, 0"));
Assert.That(decoder.ParsedLines, Has.One.EqualTo("Combo1: 100, 100, 100 // Comment at end of line"));
}
}
private class LineLoggingDecoder : LegacyDecoder<TestModel>
{
public readonly List<string> ParsedLines = new List<string>();
public LineLoggingDecoder(int version)
: base(version)
{
}
protected override bool ShouldSkipLine(string line)
{
var result = base.ShouldSkipLine(line);
if (!result)
ParsedLines.Add(line);
return result;
}
}
private class TestModel
{
}
}
}

View File

@ -0,0 +1,9 @@
osu file format v14
[Colours]
// Combo1: 0, 0, 0
//Combo2: 0, 0, 0
// Combo3: 0, 0, 0
Combo1: 100, 100, 100 // Comment at end of line

View File

@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps.Formats
}
}
protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.StartsWith("//", StringComparison.Ordinal);
protected virtual bool ShouldSkipLine(string line) => string.IsNullOrWhiteSpace(line) || line.AsSpan().TrimStart().StartsWith("//".AsSpan(), StringComparison.Ordinal);
protected virtual void ParseLine(T output, Section section, string line)
{

View File

@ -68,6 +68,48 @@ namespace osu.Game.Graphics
public readonly Color4 GreenDark = FromHex(@"668800");
public readonly Color4 GreenDarker = FromHex(@"445500");
public readonly Color4 Sky = FromHex(@"6bb5ff");
public readonly Color4 GreySkyLighter = FromHex(@"c6e3f4");
public readonly Color4 GreySkyLight = FromHex(@"8ab3cc");
public readonly Color4 GreySky = FromHex(@"405461");
public readonly Color4 GreySkyDark = FromHex(@"303d47");
public readonly Color4 GreySkyDarker = FromHex(@"21272c");
public readonly Color4 Seafoam = FromHex(@"05ffa2");
public readonly Color4 GreySeafoamLighter = FromHex(@"9ebab1");
public readonly Color4 GreySeafoamLight = FromHex(@"4d7365");
public readonly Color4 GreySeafoam = FromHex(@"33413c");
public readonly Color4 GreySeafoamDark = FromHex(@"2c3532");
public readonly Color4 GreySeafoamDarker = FromHex(@"1e2422");
public readonly Color4 Cyan = FromHex(@"05f4fd");
public readonly Color4 GreyCyanLighter = FromHex(@"77b1b3");
public readonly Color4 GreyCyanLight = FromHex(@"436d6f");
public readonly Color4 GreyCyan = FromHex(@"293d3e");
public readonly Color4 GreyCyanDark = FromHex(@"243536");
public readonly Color4 GreyCyanDarker = FromHex(@"1e2929");
public readonly Color4 Lime = FromHex(@"82ff05");
public readonly Color4 GreyLimeLighter = FromHex(@"deff87");
public readonly Color4 GreyLimeLight = FromHex(@"657259");
public readonly Color4 GreyLime = FromHex(@"3f443a");
public readonly Color4 GreyLimeDark = FromHex(@"32352e");
public readonly Color4 GreyLimeDarker = FromHex(@"2e302b");
public readonly Color4 Violet = FromHex(@"bf04ff");
public readonly Color4 GreyVioletLighter = FromHex(@"ebb8fe");
public readonly Color4 GreyVioletLight = FromHex(@"685370");
public readonly Color4 GreyViolet = FromHex(@"46334d");
public readonly Color4 GreyVioletDark = FromHex(@"2c2230");
public readonly Color4 GreyVioletDarker = FromHex(@"201823");
public readonly Color4 Carmine = FromHex(@"ff0542");
public readonly Color4 GreyCarmineLighter = FromHex(@"deaab4");
public readonly Color4 GreyCarmineLight = FromHex(@"644f53");
public readonly Color4 GreyCarmine = FromHex(@"342b2d");
public readonly Color4 GreyCarmineDark = FromHex(@"302a2b");
public readonly Color4 GreyCarmineDarker = FromHex(@"241d1e");
public readonly Color4 Gray0 = FromHex(@"000");
public readonly Color4 Gray1 = FromHex(@"111");
public readonly Color4 Gray2 = FromHex(@"222");

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -66,13 +67,11 @@ namespace osu.Game.Storyboards.Drawables
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
{
var basePath = Animation.Path.ToLowerInvariant();
for (var frame = 0; frame < Animation.FrameCount; frame++)
{
var framePath = basePath.Replace(".", frame + ".");
var framePath = Animation.Path.Replace(".", frame + ".");
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.ToLowerInvariant() == framePath)?.FileInfo.StoragePath;
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.Equals(framePath, StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
if (path == null)
continue;

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using osuTK;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -65,8 +66,7 @@ namespace osu.Game.Storyboards.Drawables
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> beatmap, TextureStore textureStore)
{
var spritePath = Sprite.Path.ToLowerInvariant();
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.ToLowerInvariant() == spritePath)?.FileInfo.StoragePath;
var path = beatmap.Value.BeatmapSetInfo.Files.Find(f => f.Filename.Equals(Sprite.Path, StringComparison.InvariantCultureIgnoreCase))?.FileInfo.StoragePath;
if (path == null)
return;